Changeset 1432 for branches

Show
Ignore:
Timestamp:
04/12/06 01:48:25 (3 years ago)
Author:
spetersen
Message:

Update PostgreSQL branch to 1431 and include a modified fix Ticket 379.

Location:
branches/postgresql
Files:
2 added
17 modified

Legend:

Unmodified
Added
Removed
  • branches/postgresql/admin/channels.php

    r1393 r1432  
    240240    case 'LBL_ADMIN_ADD': 
    241241    case 'Add': 
    242      
     242 
    243243        $label  = trim(sanitize($_REQUEST['new_channel'], RSS_SANITIZER_URL)); 
    244         $fid        = trim(sanitize($_REQUEST['add_channel_to_folder'], RSS_SANITIZER_SIMPLE_SQL | RSS_SANITIZER_NO_SPACES)); 
     244        $fid        = trim(sanitize($_REQUEST['add_channel_to_folder'], RSS_SANITIZER_NUMERIC)); 
    245245        list($flabel) = rss_fetch_row(rss_query( 
    246246          "select name from " . getTable('folders') . " where id=$fid")); 
  • branches/postgresql/admin/index.php

    r1393 r1432  
    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. 
     
    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['login_uname']) && isset($_POST['login_pass'])) { 
    94             $login_uname = $_POST['login_uname']; 
    95             $login_pass = $_POST['login_pass']; 
    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) { 
  • branches/postgresql/admin/users.php

    r1393 r1432  
    6969        . LBL_ADMIN_MUST_SET_PASS; 
    7070     
    71     echo "<form action=\"".getPath()."admin/\" onsubmit=\"return on_submit_password_match();\" method=\"post\">\n" 
     71    echo "<form action=\"".$_SERVER['PHP_SELF'] . "\" onsubmit=\"return on_submit_password_match();\" method=\"post\">\n" 
    7272    ."<fieldset style=\"width:400px;\">" 
    7373    ."<p><label style=\"display:block\" for=\"admin_uname\">".LBL_USERNAME.":</label>\n" 
    74     ."<input type=\"text\" id=\"admin_uname\" name=\"admin_uname\"></p>\n" 
     74    ."<input type=\"text\" id=\"admin_uname\" name=\"admin_uname\" /></p>\n" 
    7575    ."<p><label style=\"display:block\" for=\"admin_pass\">".LBL_PASSWORD.":</label>\n" 
    76     ."<input type=\"password\" id=\"admin_pass\" name=\"admin_pass\"></p>\n" 
     76    ."<input type=\"password\" id=\"admin_pass\" name=\"admin_pass\" /></p>\n" 
    7777    ."<p><label style=\"display:block\" for=\"admin_pass2\">".LBL_PASSWORD2.":</label>\n" 
    78     ."<input type=\"password\" id=\"admin_pass2\" name=\"admin_pass2\"></p>\n" 
    79     ."<p><input type=\"submit\" value=\"".LBL_ADMIN_OK."\"></p>\n" 
     78    ."<input type=\"password\" id=\"admin_pass2\" name=\"admin_pass2\" /></p>\n" 
     79    ."<p><input type=\"submit\" value=\"".LBL_ADMIN_OK."\" /></p>\n" 
    8080    ."<div style=\"display:inline;\" id=\"admin_match_result\"></div>\n" 
    8181    ."</fieldset>\n" 
     
    9090     
    9191    admin_header(); 
    92     ?> 
    93     <script type="text/javascript"> 
    94     <!-- 
     92  echo "\n<div id=\"channel_admin\" class=\"frame\">"; 
    9593         
    96         function on_submit_login_form() { 
    97             uname=document.getElementById('login_uname').value; 
    98             pass=hex_md5(document.getElementById('login_pass').value); 
    99             ajax_login(uname,pass,admin_login_hdlr); 
    100             return false; 
    101         } 
    102          
    103          
    104         function admin_login_hdlr(data) { 
    105             tokens=data.split('|'); 
    106             ulevel=tokens[0]; 
    107             uname=tokens[1]; 
    108             pass=tokens[2]; 
    109             if (ulevel > 0) { 
    110                 if (<?php echo (getConfig('rss.config.autologout') ? "true":"false"); ?>) { 
    111                     setRootSessionCookie('<?php echo RSS_USER_COOKIE; ?>', uname+'|'+pass); 
    112                 } else { 
    113                     setRootCookie('<?php echo RSS_USER_COOKIE; ?>', uname+'|'+pass); 
    114                 } 
    115             } 
    116             msg = ''; 
    117             if (ulevel == <?php echo RSS_USER_LEVEL_NOLEVEL ?>) { 
    118                 msg = '<?php echo LBL_ADMIN_LOGIN_BAD_LOGIN ?>'; 
    119             } else if (ulevel > <?php echo RSS_USER_LEVEL_NOLEVEL ?> && ulevel < <?php echo RSS_USER_LEVEL_ADMIN ?>) { 
    120                 msg = '<?php echo LBL_ADMIN_LOGIN_NO_ADMIN ?>'.replace('%s',uname); 
    121             } else if (ulevel >= <?php echo RSS_USER_LEVEL_ADMIN ?>) { 
    122                 document.location=document.location; 
    123                 return 0; 
    124             } 
    125              
    126             if (msg != '') { 
    127                 document.getElementById('admin_login_result').innerHTML = '<br>' + msg; 
    128             } 
    129         } 
    130     --> 
    131     </script> 
    132      
    133     <?php 
    134     echo "\n<div id=\"channel_admin\" class=\"frame\">"; 
    135     echo "<h2></h2>\n"; 
    136      
    137     echo "<form id=\"admin_login\" style=\"text-align:center\" action=\"".getPath()."admin/\" onsubmit=\"return on_submit_login_form();\" method=\"post\">\n" 
    138 //  ."<p>".      LBL_ADMIN_LOGIN ."</p>\n" 
     94    echo "<form id=\"admin_login\" style=\"text-align:center\" action=\"".$_SERVER['PHP_SELF'] ."\" method=\"post\">\n" 
    13995    ."<fieldset>" 
    140     ."<p><label style=\"display:block\" for=\"login_uname\">".LBL_USERNAME.":</label>\n" 
    141     ."<input type=\"text\" id=\"login_uname\" name=\"login_uname\" /></p>\n" 
    142     ."<p><label style=\"display:block\" for=\"login_pass\">".LBL_PASSWORD.":</label>\n" 
    143     ."<input type=\"password\" id=\"login_pass\" name=\"login_pass\" /></p>\n" 
     96    ."<legend>" . LBL_ADMIN_LOGIN . "</legend>\n" 
     97    ."<p><label style=\"display:block\" for=\"username\">".LBL_USERNAME.":</label>\n" 
     98    ."<input type=\"text\" id=\"username\" name=\"username\" /></p>\n" 
     99    ."<p><label style=\"display:block\" for=\"password\">".LBL_PASSWORD.":</label>\n" 
     100    ."<input type=\"password\" id=\"password\" name=\"password\" /></p>\n" 
    144101    ."<p id=\"admin_login_submit\"><input type=\"submit\" value=\"".LBL_LOG_IN."\" /></p>\n" 
    145102    ."<span style=\"display:inline;\" id=\"admin_login_result\"></span>\n" 
  • branches/postgresql/ajax.php

    r1393 r1432  
    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('login_uname').value; 
    168     pass=hex_md5(document.getElementById('login_pass').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'); 
    190     span.innerHTML = '<form method="post" action="#" ' 
    191      + 'onsubmit="login(minilogin_cb_handler); return false;">' 
    192      + '<input style=" width:50px;"  id="login_uname" type="text" />' 
    193      + '<input style=" width:50px;"  id="login_pass"  type="password" />' 
    194      + '<input type="submit" value="<?php echo LBL_LOG_IN; ?>" />' 
    195      + '</form>'; 
    196       
     164    if (span.style.display == 'none') { 
     165        span.style.display = 'block'; 
     166    } else { 
     167        span.style.display = 'none'; 
     168    } 
    197169} 
    198170 
  • branches/postgresql/cls/db/ParsingQuery.class.php

    r1091 r1432  
    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]); 
  • branches/postgresql/cls/update.php

    r1255 r1432  
    416416} 
    417417 
    418 function ajaxUpdateJavacript () { 
     418function ajaxUpdateJavascript () { 
    419419    echo sajax_get_javascript(); 
    420420    ?> 
  • branches/postgresql/cls/wrappers/header.php

    r1181 r1432  
    136136 
    137137function rss_header_logininfo() { 
     138 
    138139    $ret = "<span id=\"loginfo\">\n"; 
    139     $user = rss_getUser(); 
    140     if ($user['ulevel'] > RSS_USER_LEVEL_NOLEVEL) { 
    141         $ret .= sprintf(LBL_LOGGED_IN_AS, $user['uname']) 
     140     
     141    if (rss_user_level() > RSS_USER_LEVEL_NOLEVEL) { 
     142        $ret .= sprintf(LBL_LOGGED_IN_AS, rss_user_name()) 
    142143                ."&nbsp;|&nbsp;<a href=\"".getPath()."?logout\">".LBL_LOG_OUT."</a>\n"; 
    143144    } else { 
    144145        $ret .= LBL_NOT_LOGGED_IN 
    145146                ."&nbsp;|&nbsp;<a href=\"#\" onclick=\"miniloginform(); return false;\">".LBL_LOG_IN."</a>"; 
    146         $ret .= "<span id=\"loginformcontainer\"></span>\n"; 
     147        $ret .= "<span style=\"display:none\" id=\"loginformcontainer\">" 
     148                         . '<form method="post" action="'.getPath().'">' 
     149                         . '<input style=" width:50px;" name="username" id="username" type="text" />' 
     150                         . '<input style=" width:50px;" name="password" id="password"  type="password" />' 
     151                         . '<input type="submit" value="'.LBL_LOG_IN.'" />' 
     152                         . '</form>' 
     153                 ."</span>\n"; 
    147154    } 
    148155    $ret .= "</span>\n"; 
  • branches/postgresql/constants.php

    r1393 r1432  
    3131 
    3232// Application version 
    33 define ('_VERSION_', "0.5.4RC1"); 
     33define ('_VERSION_', "0.5.4"); 
    3434define ('MINUTE',60); 
    3535 
     
    5656// Admin cookie name 
    5757// Deprecated: define('PRIVATE_COOKIE', 'prv'); 
    58 define('RSS_USER_COOKIE', 'user'); 
     58define('RSS_USER_COOKIE', 'gregariusUser'); 
    5959 
    6060define ('RSS_USER_LEVEL_NOLEVEL',0); 
  • branches/postgresql/feed.php

    r1393 r1432  
    418418    case 'LBL_MARK_FOLDER_READ': 
    419419        $fid = sanitize($_REQUEST['folder'],RSS_SANITIZER_NUMERIC); 
    420  
     420        $rs  = rss_query("select id from " .getTable('channels') . " where parent=$fid"); 
     421        $cids_ = array(); 
     422        while(list($cid_) = rss_fetch_row($rs)) { 
     423            $cids_[]=$cid_; 
     424        } 
     425         
     426         
     427        $sql = "update " .getTable('item') 
     428               . " set unread = unread & ".SET_MODE_READ_STATE 
     429               . " where cid  in (" .implode(',', $cids_) . ") "; 
     430          unset($cids_); 
    421431        if (count($IdsToMarkAsRead)) { 
    422             $sql = "update " .getTable('item') 
    423             . " set unread =(unread & ". SET_MODE_READ_STATE .")" 
    424             . " where id in (" . implode(',',$IdsToMarkAsRead) .")"; 
     432            $sql .= " and id in (" . implode(',',$IdsToMarkAsRead) .")"; 
     433        } 
    425434 
    426435        //die($sql); 
    427  
    428436        rss_query($sql); 
    429         } 
    430437 
    431438        rss_invalidate_cache(); 
     
    484491    case 'LBL_MARK_VFOLDER_READ': 
    485492        $vfid = sanitize($_REQUEST['vfolder'],RSS_SANITIZER_NUMERIC); 
    486         $sql = "update " .getTable('item') . " i, " . getTable('metatag') . " m" 
    487                . " set i.unread = i.unread & ".SET_MODE_READ_STATE 
    488                . " where i.cid = m.fid and m.tid = $vfid and m.ttype = 'channel'"; 
     493         
     494        $rs  = rss_query( 
     495            "select fid from " .getTable('metatag') . "m  " 
     496            ." where m.ttype = 'channel' and m.tid = $vfid"); 
     497        $fids_ = array(); 
     498        while(list($fid_) = rss_fetch_row($rs)) { 
     499            $fids_[]=$fid_; 
     500        } 
     501         
     502        $sql = "update " .getTable('item') 
     503               . " set unread = unread & ".SET_MODE_READ_STATE 
     504               . " where cid in (" .implode(',',$fids_). ")"; 
    489505 
    490506        if (count($IdsToMarkAsRead)) { 
    491             $sql .= " and i.id in (" . implode(',',$IdsToMarkAsRead) .")"; 
     507            $sql .= " and id in (" . implode(',',$IdsToMarkAsRead) .")"; 
    492508        } 
    493509 
     
    499515        $next_vfid = $first_vfid = 0; 
    500516        $found = false; 
    501         $res = rss_query("select distinct tid from " .getTable('metatag') ." m," .getTable('tag') ."t where m.tid = t.id order by t.tag asc"); 
     517        $res = rss_query("select distinct m.tid, t.tag from " .getTable('metatag') ." m," .getTable('tag') ."t where m.tid = t.id order by t.tag asc"); 
    502518        while (list($tid__) = rss_fetch_row($res)) { 
    503519            if ($tid__ == $vfid) { 
  • branches/postgresql/index.php

    r1393 r1432  
    6262if (array_key_exists('update',$_REQUEST)) { 
    6363    update(""); 
    64 } 
    65  
    66  
    67 if (array_key_exists('logout',$_GET)) { 
    68     logoutUserCookie(); 
    69     rss_redirect(''); 
    7064} 
    7165 
  • branches/postgresql/init.php

    r1393 r1432  
    6262// 
    6363rss_require('util.php'); 
     64rss_require('cls/user.php'); 
    6465rss_require('cls/rss.php'); 
    6566//rss_require('config.php'); 
  • branches/postgresql/schema.php

    r1393 r1432  
    684684          proptype enum('item','feed','folder','category','plugin','tag','theme','misc') NOT NULL default 'item', 
    685685          property varchar(128) NOT NULL default '', 
    686           value text NOT NULL, 
    687           UNIQUE KEY uniq (fk_ref_object_id(180),property,proptype) 
     686          value text NOT NULL 
    688687        ) TYPE=MyISAM; 
    689688         
     
    696695        return 0; 
    697696    } else { 
    698         return 1; 
     697        $idSql = "alter table $table add UNIQUE KEY uniq (fk_ref_object_id(180),property,proptype)"; 
     698        rss_query_wrapper($idSql, false, true); 
     699        return rss_is_sql_error(RSS_SQL_ERROR_NO_ERROR); 
    699700    } 
    700701} 
  • branches/postgresql/themes/lilina/web/css/look.css

    r1393 r1432  
    373373    background: #CBDFEB; 
    374374} 
     375.dateheader a { color: #777; }  
     376 
  • branches/postgresql/themes/lilina/web/item.php

    r1393 r1432  
    11<?php   
    22    global $lastDate;   
    3     $thisDate = date("F d, Y", $GLOBALS['rss']->currentItem->date);   
     3    $thisDate = rss_locale_date("%B %d, %Y", $GLOBALS['rss']->currentItem->date);   
    44    if (!$lastDate || $lastDate != $thisDate) {    
    5         ?> 
     5        $thisYear = rss_locale_date("%Y", $GLOBALS['rss']->currentItem->date);   
     6        $thisMon = rss_locale_date("%m", $GLOBALS['rss']->currentItem->date);  
     7        $thisDay = rss_locale_date("%d", $GLOBALS['rss']->currentItem->date);  
     8        if(getConfig('rss.output.usemodrewrite')) { 
     9            $dateURL =  getPath() . "$thisYear/$thisMon/$thisDay/"; 
     10        }else{ 
     11            $dateURL = getPath() . "feed.php?y=$thisYear&m=$thisMon&d=$thisDay"; 
     12        } 
     13        $lastDate=$thisDate;  
     14?> 
    615<li> 
    7 <div class="dateheader"> 
    8 <?php echo $thisDate; $lastDate = $thisDate;  ?> 
    9 </div> 
     16    <div class="dateheader"><a href="<?php echo $dateURL; ?>"><?php echo $thisDate; ?></a></div> 
    1017</li> 
    11         <?php    
    12     }  
     18<?php 
     19    } 
    1320?> 
    1421<?php 
  • branches/postgresql/themes/lilina/web/schemes/lowcontrast/diff.css

    r1393 r1432  
    3737  background: #aaaaaa; 
    3838} 
     39 
     40.dateheader a { color:#fff } 
  • branches/postgresql/update.php

    r1181 r1432  
    3939     
    4040if (array_key_exists('js',$_GET)) { 
    41     ajaxUpdateJavacript(); 
     41    header('Content-Type: text/javascript'); 
     42    ajaxUpdateJavascript(); 
    4243    exit(); 
    4344} elseif(array_key_exists('rs',$_REQUEST)) { 
     
    5051$browser = new Browser(); 
    5152 
    52 $cline = isset($argv) && !$_REQUEST; 
     53$cline = isset($argv) && !$_REQUEST && isset($argc) && $argc; 
    5354$silent = array_key_exists('silent', $_GET) || ($cline && in_array('--silent',$argv)); 
    5455$newsonly = array_key_exists('newsonly', $_GET) || ($cline && in_array('--newsonly', $argv)); 
  • branches/postgresql/util.php

    r1393 r1432  
    227227                $guid = $item['id']; 
    228228            } 
     229            $guid = trim($guid); 
    229230            $guid = rss_real_escape_string($guid); 
    230231 
     
    300301                $cDate = strtotime($item['pubdate'], 0); 
    301302            } 
     303            elseif (array_key_exists('published',$item)) { 
     304                // atom 1.0 
     305                $cDate = parse_iso8601($item['published']); 
     306            } 
     307            elseif (array_key_exists('issued', $item)) { 
     308                //Atom, alternative 
     309                $cDate = parse_iso8601($item['issued']); 
     310            } 
    302311            elseif (array_key_exists('created', $item)) { 
    303312                // atom 0.3 
    304313                $cDate = parse_iso8601($item['created']); 
    305             } 
    306             elseif (array_key_exists('published',$item)) { 
    307                 // atom 1.0 
    308                 $cDate = parse_iso8601($item['published']); 
    309             } 
    310             elseif (array_key_exists('issued', $item)) { 
    311                 //Atom, alternative 
    312                 $cDate = parse_iso8601($item['issued']); 
    313314            } 
    314315 
     
    431432 
    432433    $url = sanitize(str_replace('&amp;','&',$url), RSS_SANITIZER_URL); 
    433      
    434     $urlDB = $url; //htmlentities($url); 
     434 
     435    $urlDB = rss_real_escape_string($url); //htmlentities($url); 
    435436 
    436437    $res = rss_query("select count(*) as channel_exists from ".getTable("channels")." where url='$urlDB'"); 
     
    675676        $h = @fopen($url, "r"); 
    676677        if ($h) { 
    677               while (!feof($h)) { 
    678                     $c .= @fread($h, 8192); 
    679               } 
    680             } 
     678            while (!feof($h)) { 
     679                $c .= @fread($h, 8192); 
     680            } 
     681        } 
    681682        @fclose($h); 
    682683        return $c; 
     
    867868} 
    868869 
    869 function rss_getUser() { 
    870     static $user; 
    871     if ($user == null) { 
    872  
    873         $user = array( 
    874                     'uid' => 0, 
    875                     'uname' => null, 
    876                     'ulevel' => RSS_USER_LEVEL_NOLEVEL, 
    877                     'realname' => null, 
    878                     'lastip' => null, 
    879                     'userips' => null, 
    880                     'lastlogin' => null 
    881                 ); 
    882  
    883         $cuname =  $chash = null; 
    884         if (isset($_COOKIE[RSS_USER_COOKIE])) { 
    885             list($cuname,$chash) = explode('|',$_COOKIE[RSS_USER_COOKIE]); 
    886         } 
    887         elseif(isset($_SESSION['mobile'])) { 
    888             list($cuname,$chash) = explode('|',$_SESSION['mobile']); 
    889         } 
    890         if ($cuname && $chash) { 
    891             $sql = "select * from " . getTable('users') . " where uname='" 
    892                    .rss_real_escape_string($cuname) ."' and password='" 
    893                    .preg_replace('#[^a-zA-Z0-9]#','',md5($chash)) ."'"; 
    894             $rs = rss_query($sql); 
    895             if (rss_num_rows($rs) == 1) { 
    896                 $tmp = rss_fetch_assoc($rs); 
    897                 if (isset($tmp['userips'])) { 
    898                     $tmp['userips'] = explode(' ',$tmp['userips']); 
    899                 } else { 
    900                     $tmp['userips'] = array(); 
    901                 } 
    902  
    903                 unset($tmp['password']); 
    904                 $subnet = preg_replace('#^([0-9]+\.[0-9]+\.[0-9]+)\.[0-9]+$#','\1',$_SERVER['REMOTE_ADDR']); 
    905                 if (array_search($subnet, $tmp['userips']) !== FALSE) { 
    906                     // success: password hash was checked and the user's IP 
    907                     // address subnet is registered 
    908                     $user = $tmp; 
    909                 } 
    910             } 
    911         } 
    912     } 
    913     return $user; 
    914 } 
    915  
    916 function setUserCookie($user,$hash) { 
    917     if (getConfig('rss.config.autologout')) { 
    918         $t = 0; 
    919     } else { 
    920         $t =time()+COOKIE_LIFESPAN; 
    921     } 
    922     setcookie(RSS_USER_COOKIE, "$user|$hash", $t, getPath()); 
    923 } 
    924  
    925 function logoutUserCookie() { 
    926     if (array_key_exists(RSS_USER_COOKIE, $_COOKIE)) { 
    927  
    928         // remove the user's IP subnet from the list of valid addresses 
    929         $user = rss_getUser(); 
    930         $subnet = preg_replace('#^([0-9]+\.[0-9]+\.[0-9]+)\.[0-9]+$#','\1',$_SERVER['REMOTE_ADDR']); 
    931  
    932         if (($idx = array_search($subnet, $user['userips'])) !== FALSE) { 
    933             $cnt = count($user['userips']); 
    934             unset($user['userips'][$idx]); 
    935             $uname = trim($user['uname']); 
    936             if ($uname && ($cnt > count($user['userips']))) { 
    937                 $sql = "update " .getTable('users') 
    938                        . " set userips = '" . implode(' ',$user['userips']) ."'" 
    939                        ." where uname = '$uname' "; 
    940                 rss_query($sql); 
    941             } 
    942         } 
    943  
    944         // get rid of the cookie 
    945         unset($_COOKIE[RSS_USER_COOKIE]); 
    946         setcookie(RSS_USER_COOKIE, "", -1, getPath()); 
    947         rss_invalidate_cache(); 
    948  
    949     } 
    950 } 
    951  
    952 function hidePrivate() { 
    953     static $ret; 
    954     if ($ret === null) { 
    955         $ret = !rss_check_user_level(RSS_USER_LEVEL_PRIVATE); 
    956     } 
    957  
    958     return $ret; 
    959 } 
    960  
    961 f