Changeset 1470

Show
Ignore:
Timestamp:
05/15/06 16:53:07 (3 years ago)
Author:
sdcosta
Message:

0.5.3.9999999999999999999999999999999999999999999999999999999999

Location:
release-branches/0.5.4/gregarius
Files:
1 removed
38 modified
19 copied

Legend:

Unmodified
Added
Removed
  • release-branches/0.5.4/gregarius/INSTALL

    r1290 r1470  
    4141         
    4242        2.  Edit the dbinit.php file to match your database configuration.  
    43             Make sure that the database user you define owns privileges to  
    44             create tables. 
     43            Make sure that the database exists and has the right permissions 
     44            and the database user you define owns privileges to create/modify 
     45            tables. 
    4546    
    4647   6.   Point your browser to the root directory of your installation. 
  • release-branches/0.5.4/gregarius/admin/index.php

    r1409 r1470  
    7373 
    7474 
    75 $auth=rss_check_user_level(RSS_USER_LEVEL_ADMIN); 
     75$auth=rss_user_check_user_level(RSS_USER_LEVEL_ADMIN); 
    7676if (! $auth) { 
    7777    // check whether the admin password has been set. 
     
    8181        $admin_uname = null; 
    8282        $admin_pass = null; 
    83         if (isset($_POST['admin_uname']) && isset($_POST['admin_pass'])) { 
    84             $admin_uname = $_POST['admin_uname']; 
    85             $admin_pass = $_POST['admin_pass']; 
     83        if (isset($_POST['username']) && isset($_POST['password'])) { 
     84            $admin_uname = $_POST['username']; 
     85            $admin_pass = $_POST['password']; 
    8686        } 
    8787        set_admin_pass($admin_uname,$admin_pass); 
    8888    } else { 
    89         // forget the password 
    90         unset($__pw__); 
    91         $login_uname = null; 
    92         $login_pass = null; 
    93         if (isset($_POST['username']) && isset($_POST['password'])) { 
    94             $login_uname = $_POST['username']; 
    95             $login_pass = $_POST['password']; 
    96  
    97         } 
    98         rss_login_form($login_uname,$login_pass); 
    99         exit(); 
     89        rss_login_form(); 
     90      exit(); 
    10091    } 
    10192} 
     
    113104 */ 
    114105function admin_main($authorised) { 
    115  
    116106    echo "\n<div id=\"channel_admin\" class=\"frame\">"; 
    117107    if ($authorised) { 
  • release-branches/0.5.4/gregarius/admin/plugins.php

    r1275 r1470  
    132132                ."</td>\n"; 
    133133                echo "<td><label 
    134                 for=\"_gregarius_plugin_$entry\">".(array_key_exists('name',$info)?$info['name']:"&nbsp"). 
     134                for=\"_gregarius_plugin_$entry\">".(array_key_exists('name',$info)?$info['name']:"&nbsp;"). 
    135135                "</label></td>\n"; 
    136136                echo "<td class=\"cntr\">" 
    137                 .(array_key_exists('version',$info)?$info['version']:"&nbsp"). "</td>\n"; 
    138                 echo "<td>" .(array_key_exists('author',$info)?$info['author']:"&nbsp"). "</td>\n"; 
    139                 echo "<td>" .(array_key_exists('description',$info)?$info['description']:"&nbsp"). "</td>\n"; 
     137                .(array_key_exists('version',$info)?$info['version']:"&nbsp;"). "</td>\n"; 
     138                echo "<td>" .(array_key_exists('author',$info)?$info['author']:"&nbsp;"). "</td>\n"; 
     139                echo "<td>" .(array_key_exists('description',$info)?$info['description']:"&nbsp;"). "</td>\n"; 
    140140 
    141141                // output the column to call a plugin's config page. 
     
    150150                    ."</a>"; 
    151151                } else { 
    152                     echo "&nbsp"; 
     152                    echo "&nbsp;"; 
    153153                } 
    154154                echo "</td>\n"; 
  • release-branches/0.5.4/gregarius/admin/users.php

    r1409 r1470  
    4848    <!-- 
    4949        function on_submit_password_match() { 
    50             pass=document.getElementById('admin_pass').value; 
    51             pass2=document.getElementById('admin_pass2').value; 
     50            pass=document.getElementById('password').value; 
     51            pass2=document.getElementById('password2').value; 
    5252            if(pass !== pass2){ 
    5353                msg = '<?php echo LBL_ADMIN_PASS_NO_MATCH ?>'; 
    5454                document.getElementById('admin_match_result').innerHTML = msg; 
    55                 document.getElementById('admin_pass').value = ''; 
    56                 document.getElementById('admin_pass2').value = ''; 
     55                document.getElementById('password').value = ''; 
     56                document.getElementById('password2').value = ''; 
    5757                return false; 
    5858            }else{ 
    59                 return true; 
     59                document.getElementById('password2').value = ''; 
     60                return loginHandler(); 
    6061            } 
    6162        }    
     
    7071    echo "<form action=\"".$_SERVER['PHP_SELF'] . "\" onsubmit=\"return on_submit_password_match();\" method=\"post\">\n" 
    7172    ."<fieldset style=\"width:400px;\">" 
    72     ."<p><label style=\"display:block\" for=\"admin_uname\">".LBL_USERNAME.":</label>\n" 
    73     ."<input type=\"text\" id=\"admin_uname\" name=\"admin_uname\" /></p>\n" 
    74     ."<p><label style=\"display:block\" for=\"admin_pass\">".LBL_PASSWORD.":</label>\n" 
    75     ."<input type=\"password\" id=\"admin_pass\" name=\"admin_pass\" /></p>\n" 
    76     ."<p><label style=\"display:block\" for=\"admin_pass2\">".LBL_PASSWORD2.":</label>\n" 
    77     ."<input type=\"password\" id=\"admin_pass2\" name=\"admin_pass2\" /></p>\n" 
     73    ."<p><label style=\"display:block\" for=\"username\">".LBL_USERNAME.":</label>\n" 
     74    ."<input type=\"text\" id=\"username\" name=\"username\" /></p>\n" 
     75    ."<p><label style=\"display:block\" for=\"password\">".LBL_PASSWORD.":</label>\n" 
     76    ."<input type=\"password\" id=\"password\" name=\"password\" /></p>\n" 
     77    ."<p><label style=\"display:block\" for=\"password2\">".LBL_PASSWORD2.":</label>\n" 
     78    ."<input type=\"password\" id=\"password2\" name=\"password2\" /></p>\n" 
    7879    ."<p><input type=\"submit\" value=\"".LBL_ADMIN_OK."\" /></p>\n" 
    7980    ."<div style=\"display:inline;\" id=\"admin_match_result\"></div>\n" 
     
    8990     
    9091    admin_header(); 
    91     ?> 
    92     <script type="text/javascript"> 
    93     <!-- 
     92  echo "\n<div id=\"channel_admin\" class=\"frame\">"; 
    9493         
    95         function on_submit_login_form() { 
    96             uname=document.getElementById('username').value; 
    97             pass=hex_md5(document.getElementById('password').value); 
    98             ajax_login(uname,pass,admin_login_hdlr); 
    99             return false; 
    100         } 
    101          
    102          
    103         function admin_login_hdlr(data) { 
    104             tokens=data.split('|'); 
    105             ulevel=tokens[0]; 
    106             uname=tokens[1]; 
    107             pass=tokens[2]; 
    108             if (ulevel > 0) { 
    109                 if (<?php echo (getConfig('rss.config.autologout') ? "true":"false"); ?>) { 
    110                     setRootSessionCookie('<?php echo RSS_USER_COOKIE; ?>', uname+'|'+pass); 
    111                 } else { 
    112                     setRootCookie('<?php echo RSS_USER_COOKIE; ?>', uname+'|'+pass); 
    113                 } 
    114             } 
    115             msg = ''; 
    116             if (ulevel == <?php echo RSS_USER_LEVEL_NOLEVEL ?>) { 
    117                 msg = '<?php echo LBL_ADMIN_LOGIN_BAD_LOGIN ?>'; 
    118             } else if (ulevel > <?php echo RSS_USER_LEVEL_NOLEVEL ?> && ulevel < <?php echo RSS_USER_LEVEL_ADMIN ?>) { 
    119                 msg = '<?php echo LBL_ADMIN_LOGIN_NO_ADMIN ?>'.replace('%s',uname); 
    120             } else if (ulevel >= <?php echo RSS_USER_LEVEL_ADMIN ?>) { 
    121                 document.location=document.location; 
    122                 return 0; 
    123             } 
    124              
    125             if (msg != '') { 
    126                 document.getElementById('admin_login_result').innerHTML = '<br>' + msg; 
    127             } 
    128         } 
    129     --> 
    130     </script> 
    131      
    132     <?php 
    133     echo "\n<div id=\"channel_admin\" class=\"frame\">"; 
    134     echo "<h2></h2>\n"; 
    135      
    136     echo "<form id=\"admin_login\" style=\"text-align:center\" action=\"".$_SERVER['PHP_SELF'] ."\" onsubmit=\"return on_submit_login_form();\" method=\"post\">\n" 
    137 //  ."<p>".      LBL_ADMIN_LOGIN ."</p>\n" 
     94    echo "<form id=\"admin_login\" onsubmit=\"return loginHandler();\"  
     95        style=\"text-align:center\" action=\"".$_SERVER['PHP_SELF'] ."\" method=\"post\">\n" 
    13896    ."<fieldset>" 
     97    ."<legend>" . LBL_ADMIN_LOGIN . "</legend>\n" 
    13998    ."<p><label style=\"display:block\" for=\"username\">".LBL_USERNAME.":</label>\n" 
    14099    ."<input type=\"text\" id=\"username\" name=\"username\" /></p>\n" 
  • release-branches/0.5.4/gregarius/ajax.php

    r1409 r1470  
    120120 
    121121// Non standard! One usually calls sajax_export() ... 
    122 $sajax_export_list = array("__exp__submitTag","__exp__getSideContent","__exp__getFeedContent","__exp_login"); 
     122$sajax_export_list = array("__exp__submitTag","__exp__getSideContent","__exp__getFeedContent"); 
    123123 
    124124// Plugins shall export ajax functions as well 
     
    160160/// Released under GPL 
    161161 
    162 function ajax_login(uname,pass,cb_handler) { 
    163     x___exp_login(uname,pass, cb_handler,cb_handler); 
    164 } 
    165  
    166 function login(cb) { 
    167     uname=document.getElementById('username').value; 
    168     pass=hex_md5(document.getElementById('password').value); 
    169     ajax_login(uname,pass,cb); 
    170 } 
    171  
    172  
    173 function minilogin_cb_handler(data) { 
    174     tokens=data.split('|'); 
    175     if (tokens[0] != <?php echo RSS_USER_LEVEL_NOLEVEL; ?>) { 
    176         document.getElementById('loginfo').innerHTML = '' 
    177         + '<?php echo LBL_LOGGED_IN_AS; ?>'.replace(/%s/gi,tokens[1]) 
    178         + '&nbsp;|&nbsp;<a href="<?php echo getPath() . "?logout\">".LBL_LOG_OUT."</a>" ?>'; 
    179         if (<?php echo (getConfig('rss.config.autologout') ? "true":"false"); ?>) { 
    180           setRootSessionCookie('<?php echo RSS_USER_COOKIE; ?>', tokens[1]+'|'+tokens[2]); 
    181         } else { 
    182           setRootCookie('<?php echo RSS_USER_COOKIE; ?>', tokens[1]+'|'+tokens[2]); 
    183         } 
    184         document.location = document.location.href.replace(/\?logout$/, ""); 
    185     }  
    186 } 
    187  
    188162function miniloginform() { 
    189163    span = document.getElementById('loginformcontainer'); 
     
    195169} 
    196170 
     171function loginHandler() { 
     172    pw = document.getElementById('password'); 
     173    username = document.getElementById('username'); 
     174    var re = /[0-9a-f]{32}/ ; 
     175    if (! re.test(pw.value)) { 
     176        pw.value = hex_md5(pw.value + username.value); 
     177    }  
     178    return true; 
     179} 
    197180 
    198181function setTags(id,tagss) { 
  • release-branches/0.5.4/gregarius/author.php

    r1190 r1470  
    2828require_once ('init.php'); 
    2929 
    30 $a =  preg_replace("/[^A-Za-z0-9\.]/","%",rss_real_escape_string($_REQUEST['author'])); 
    31  
     30$a =trim(sanitize($_REQUEST['author'], RSS_SANITIZER_WORDS)); 
    3231list ($ra) = rss_fetch_row(rss_query( 
    3332    "select distinct(author) from " .getTable('item')  
    34     ." where author like '%$a%'" 
     33    ." where author like '$a'" 
    3534)); 
    3635 
    3736if (!$ra) { 
    38     rss_redirect(); 
     37    rss_404(); 
     38    exit; 
    3939} 
    4040 
     
    4343$GLOBALS['rss']->feedList = new FeedList(false); 
    4444$authorItems = new ItemList(); 
    45 $sqlWhere = " i.author like '%$a%' "; 
    46 $authorItems->populate($sqlWhere); 
     45$sqlWhere = " i.author like '$a' "; 
     46$numItems = getConfig('rss.output.frontpage.numitems'); 
     47$authorItems->populate($sqlWhere, "",  0, $numItems); 
    4748$authorItems->setTitle($t); 
    4849$authorItems->setRenderOptions(IL_NO_COLLAPSE|IL_TITLE_NO_ESCAPE); 
  • release-branches/0.5.4/gregarius/cls/db/ParsingQuery.class.php

    r1091 r1470  
    116116                            unset($defineElement[$numElement]['sup']); 
    117117                        } 
    118                         for($i=($key+1) ; $i<= (count($tableElement)+1) ; $i++) { 
     118                        # FIX wrong enum parsing 
     119                        $nb_items=count($tableElement); 
     120                        for($i=($key+1) ; $i<= ($nb_items+1) ; $i++) { 
    119121                            $tabValue[1] .= ','.$tableElement[$i]; 
    120122                            unset($tableElement[$i]); 
  • release-branches/0.5.4/gregarius/cls/items.php

    r1181 r1470  
    244244    var $unreadIids = array(); 
    245245    var $rss; 
    246      
    247  
     246    var $_template; 
     247     
     248    var $_sqlActualWhat = ""; 
     249    var $_sqlActualFrom = ""; 
     250    var $_sqlActualWhere= ""; 
     251    var $_sqlActualOrder= ""; 
     252    var $_sqlActualLimit= ""; 
    248253     
    249254    function ItemList() { 
    250      
     255        $this -> _template = 'itemlist.php'; 
    251256        $this -> rss = &$GLOBALS['rss']; 
    252257         
     
    277282    function populate($sqlWhere, $sqlOrder="", $startItem = 0, $itemCount = -1, $hint = ITEM_SORT_HINT_MIXED, $includeDeprecated = false) { 
    278283 
    279         _pf('ItemList::populate()'); 
    280         $sql = "select i.title,  c.title, c.id, i.unread, " 
     284      _pf('ItemList::populate()'); 
     285        $this -> _sqlActualWhat = " i.title,  c.title, c.id, i.unread, " 
    281286            ."i.url, i.enclosure, i.author, i.description, c.icon, " 
    282287            ." unix_timestamp(ifnull(i.pubdate,i.added)) as ts, " 
    283             ." i.pubdate is not null as ispubdate, i.id, r.rating  " 
    284             ." from ".getTable("item") ." i " 
     288            ." i.pubdate is not null as ispubdate, i.id, r.rating  "; 
     289        $this -> _sqlActualFrom =   getTable("item") ." i " 
    285290            ." left join " 
    286291            . getTable("rating") ." r on (i.id = r.iid), " 
    287292            .getTable("channels")." c, " 
    288             .getTable("folders") ." f " 
    289  
    290             ." where " 
    291             ." i.cid = c.id and " 
     293            .getTable("folders") ." f "; 
     294 
     295        $this -> _sqlActualWhere = " i.cid = c.id and " 
    292296            ." f.id=c.parent and ". (false == $includeDeprecated ? " not(c.mode & ".RSS_MODE_DELETED_STATE.") and " : "") 
    293297            ." not(i.unread & ".RSS_MODE_DELETED_STATE.") and "; 
     
    296300 
    297301        if (hidePrivate()) { 
    298             $sql .= " not(i.unread & ".RSS_MODE_PRIVATE_STATE.") and "; 
    299         } 
    300  
    301         if ($sqlWhere) { 
    302             $sql .= $sqlWhere ." and "; 
    303         } 
    304         $sql .= " 1=1 "; 
     302            $this -> _sqlActualWhere .= " not(i.unread & ".RSS_MODE_PRIVATE_STATE.") and "; 
     303        } 
     304 
     305        if ($this -> _sqlActualWhere) { 
     306            $this -> _sqlActualWhere .= $sqlWhere ." and "; 
     307        } 
     308        $this -> _sqlActualWhere .= " 1=1 "; 
    305309         
    306310        /// Order by 
     
    318322                    break; 
    319323            } 
    320             $sql .= " order by  "; 
     324 
    321325            if (!getConfig('rss.config.feedgrouping')) { 
    322326                if(getConfig("rss.config.datedesc.$skey")){ 
    323                     $sql .= " ts desc, f.position asc, c.position asc "; 
     327                    $this -> _sqlActualOrder = " ts desc, f.position asc, c.position asc "; 
    324328                }else{ 
    325                     $sql .= " ts asc, f.position asc, c.position asc "; 
     329                    $this -> _sqlActualOrder = " ts asc, f.position asc, c.position asc "; 
    326330                } 
    327331            } elseif (getConfig('rss.config.absoluteordering')) { 
    328                 $sql .= " f.position asc, c.position asc"; 
     332                $this -> _sqlActualOrder = " f.position asc, c.position asc"; 
    329333            } else { 
    330                 $sql .= " f.name asc, c.title asc"; 
     334                $this -> _sqlActualOrder = " f.name asc, c.title asc"; 
    331335            } 
    332336            if(getConfig("rss.config.datedesc.$skey")){ 
    333                 $sql .= ", ts desc, i.id asc"; 
     337                $this -> _sqlActualOrder .= ", ts desc, i.id asc"; 
    334338            }else{ 
    335                 $sql .= ", ts asc, i.id asc"; 
     339                $this -> _sqlActualOrder .= ", ts asc, i.id asc"; 
    336340            } 
    337341        } else { 
    338             $sql .= " $sqlOrder ";   
     342            $this -> _sqlActualOrder = " $sqlOrder ";    
    339343        } 
    340344        if (($itemCount < 0) || ($itemCount > RSS_DB_MAX_QUERY_RESULTS)) { 
    341345            $itemCount = RSS_DB_MAX_QUERY_RESULTS; 
    342346        } 
    343         $sql .= " limit $startItem, $itemCount"; 
    344  
     347        $this -> _sqlActualLimit = " $startItem, $itemCount"; 
     348 
     349        $sql = "select " 
     350            .$this -> _sqlActualWhat 
     351            . " from " 
     352            .$this -> _sqlActualFrom 
     353            . " where " 
     354            . $this -> _sqlActualWhere 
     355            . " order by " 
     356            . $this -> _sqlActualOrder 
     357            . " limit " 
     358            . $this -> _sqlActualLimit; 
     359             
    345360        //echo $sql;         
    346361        $this -> iids = array(); 
     
    461476        rss_plugin_hook('rss.plugins.items.beforeitems', null); 
    462477 
    463         eval($this-> rss ->getCachedTemplateFile("itemlist.php")); 
     478        eval($this-> rss ->getCachedTemplateFile($this -> _template)); 
    464479         
    465480        _pf("done: ItemList -> render()"); 
     
    470485} 
    471486 
    472  
     487class ItemListNavigation { 
     488    var $_parent; 
     489    var $pages; 
     490    function ItemListNavigation($il) { 
     491        $this -> _parent = $il; 
     492        $this -> pages = array(); 
     493        $base = $_SERVER["REQUEST_URI"]; 
     494        if (!preg_match('#page=[0-9]+$#',$base)) { 
     495            $base .= "?page=0"; 
     496        } 
     497        $last = ceil( $this -> _parent -> numItems / $this -> _parent -> itemsPerPage); 
     498        $lastin = 0; 
     499        for ($i = 0; $i < $last; $i++) { 
     500            if ($i == 0 || $i == $last-1 || abs($i - $this -> _parent -> page) < 3) { 
     501                $url = preg_replace('#^(.+)page=[0-9]+$#','${1}page='.$i, $base); 
     502                $this -> pages[$i] = array($url, $i == $this -> _parent -> page, false); 
     503                $lastin = $i; 
     504            } elseif ($i - 1 == $lastin) { 
     505                $this -> pages[$i] = array(null,false,true); 
     506            } 
     507        } 
     508    } 
     509    function render() { 
     510        eval($this-> _parent -> rss ->getCachedTemplateFile('pagination.php')); 
     511    } 
     512} 
     513 
     514class PaginatedItemList extends ItemList { 
     515    var $page; 
     516    var $navigation; 
     517    var $itemsPerPage = 0; 
     518    var $numItems = 0; 
     519    function PaginatedItemList() {  
     520        parent::ItemList();  
     521        if (isset($_REQUEST['page'])) { 
     522            $this -> page = sanitize($_REQUEST['page'], RSS_SANITIZER_NUMERIC); 
     523        } else { 
     524            $this -> page = 0; 
     525        } 
     526         
     527        $this ->  itemsPerPage = getConfig('rss.output.frontpage.numitems'); 
     528    } 
     529    function populate($sqlWhere, $sqlOrder="", $startItem = 0, $itemCount = -1, $hint = ITEM_SORT_HINT_MIXED, $includeDeprecated = false) { 
     530 
     531        $si = $this -> page * $this ->  itemsPerPage; 
     532        parent::populate($sqlWhere, $sqlOrder, $si, $this ->  itemsPerPage, $hint, $includeDeprecated); 
     533         
     534        $sql = "select count(*) as cnt " 
     535            . " from " 
     536            . $this -> _sqlActualFrom 
     537            . " where " 
     538            . $this -> _sqlActualWhere; 
     539        list($this -> numItems) = rss_fetch_row(rss_query($sql)); 
     540        $this -> navigation = new ItemListNavigation(& $this); 
     541    } 
     542} 
    473543?> 
  • release-branches/0.5.4/gregarius/cls/search.php

    r1343 r1470  
    186186 
    187187        if ($this->orderBy == QUERY_ORDER_BY_DATE) { 
    188             $qOrder = " order by ts desc"; 
     188            $qOrder = " ts desc"; 
    189189        } else { 
    190190            if (getConfig('rss.config.absoluteordering')) { 
    191                 $qOrder = " order by f.position asc, c.position asc"; 
     191                $qOrder = " f.position asc, c.position asc"; 
    192192            } else { 
    193                 $qOrder = " order by f.name asc, c.title asc"; 
     193                $qOrder = " f.name asc, c.title asc"; 
    194194            } 
    195195        } 
  • release-branches/0.5.4/gregarius/cls/update.php