- Timestamp:
- 04/12/06 01:48:25 (3 years ago)
- Location:
- branches/postgresql
- Files:
-
- 2 added
- 17 modified
-
admin/channels.php (modified) (1 diff)
-
admin/index.php (modified) (3 diffs)
-
admin/users.php (modified) (2 diffs)
-
ajax.php (modified) (2 diffs)
-
cls/db/ParsingQuery.class.php (modified) (1 diff)
-
cls/update.php (modified) (1 diff)
-
cls/user.php (added)
-
cls/wrappers/header.php (modified) (1 diff)
-
cls/wrappers/user.php (added)
-
constants.php (modified) (2 diffs)
-
feed.php (modified) (3 diffs)
-
index.php (modified) (1 diff)
-
init.php (modified) (1 diff)
-
schema.php (modified) (2 diffs)
-
themes/lilina/web/css/look.css (modified) (1 diff)
-
themes/lilina/web/item.php (modified) (1 diff)
-
themes/lilina/web/schemes/lowcontrast/diff.css (modified) (1 diff)
-
update.php (modified) (2 diffs)
-
util.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/postgresql/admin/channels.php
r1393 r1432 240 240 case 'LBL_ADMIN_ADD': 241 241 case 'Add': 242 242 243 243 $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)); 245 245 list($flabel) = rss_fetch_row(rss_query( 246 246 "select name from " . getTable('folders') . " where id=$fid")); -
branches/postgresql/admin/index.php
r1393 r1432 73 73 74 74 75 $auth=rss_ check_user_level(RSS_USER_LEVEL_ADMIN);75 $auth=rss_user_check_user_level(RSS_USER_LEVEL_ADMIN); 76 76 if (! $auth) { 77 77 // check whether the admin password has been set. … … 87 87 set_admin_pass($admin_uname,$admin_pass); 88 88 } 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(); 100 91 } 101 92 } … … 113 104 */ 114 105 function admin_main($authorised) { 115 116 106 echo "\n<div id=\"channel_admin\" class=\"frame\">"; 117 107 if ($authorised) { -
branches/postgresql/admin/users.php
r1393 r1432 69 69 . LBL_ADMIN_MUST_SET_PASS; 70 70 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" 72 72 ."<fieldset style=\"width:400px;\">" 73 73 ."<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" 75 75 ."<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" 77 77 ."<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" 80 80 ."<div style=\"display:inline;\" id=\"admin_match_result\"></div>\n" 81 81 ."</fieldset>\n" … … 90 90 91 91 admin_header(); 92 ?> 93 <script type="text/javascript"> 94 <!-- 92 echo "\n<div id=\"channel_admin\" class=\"frame\">"; 95 93 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" 139 95 ."<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" 144 101 ."<p id=\"admin_login_submit\"><input type=\"submit\" value=\"".LBL_LOG_IN."\" /></p>\n" 145 102 ."<span style=\"display:inline;\" id=\"admin_login_result\"></span>\n" -
branches/postgresql/ajax.php
r1393 r1432 120 120 121 121 // 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"); 123 123 124 124 // Plugins shall export ajax functions as well … … 160 160 /// Released under GPL 161 161 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 + ' | <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 188 162 function miniloginform() { 189 163 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 } 197 169 } 198 170 -
branches/postgresql/cls/db/ParsingQuery.class.php
r1091 r1432 116 116 unset($defineElement[$numElement]['sup']); 117 117 } 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++) { 119 121 $tabValue[1] .= ','.$tableElement[$i]; 120 122 unset($tableElement[$i]); -
branches/postgresql/cls/update.php
r1255 r1432 416 416 } 417 417 418 function ajaxUpdateJava cript () {418 function ajaxUpdateJavascript () { 419 419 echo sajax_get_javascript(); 420 420 ?> -
branches/postgresql/cls/wrappers/header.php
r1181 r1432 136 136 137 137 function rss_header_logininfo() { 138 138 139 $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()) 142 143 ." | <a href=\"".getPath()."?logout\">".LBL_LOG_OUT."</a>\n"; 143 144 } else { 144 145 $ret .= LBL_NOT_LOGGED_IN 145 146 ." | <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"; 147 154 } 148 155 $ret .= "</span>\n"; -
branches/postgresql/constants.php
r1393 r1432 31 31 32 32 // Application version 33 define ('_VERSION_', "0.5.4 RC1");33 define ('_VERSION_', "0.5.4"); 34 34 define ('MINUTE',60); 35 35 … … 56 56 // Admin cookie name 57 57 // Deprecated: define('PRIVATE_COOKIE', 'prv'); 58 define('RSS_USER_COOKIE', ' user');58 define('RSS_USER_COOKIE', 'gregariusUser'); 59 59 60 60 define ('RSS_USER_LEVEL_NOLEVEL',0); -
branches/postgresql/feed.php
r1393 r1432 418 418 case 'LBL_MARK_FOLDER_READ': 419 419 $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_); 421 431 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 } 425 434 426 435 //die($sql); 427 428 436 rss_query($sql); 429 }430 437 431 438 rss_invalidate_cache(); … … 484 491 case 'LBL_MARK_VFOLDER_READ': 485 492 $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_). ")"; 489 505 490 506 if (count($IdsToMarkAsRead)) { 491 $sql .= " and i .id in (" . implode(',',$IdsToMarkAsRead) .")";507 $sql .= " and id in (" . implode(',',$IdsToMarkAsRead) .")"; 492 508 } 493 509 … … 499 515 $next_vfid = $first_vfid = 0; 500 516 $found = false; 501 $res = rss_query("select distinct tidfrom " .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"); 502 518 while (list($tid__) = rss_fetch_row($res)) { 503 519 if ($tid__ == $vfid) { -
branches/postgresql/index.php
r1393 r1432 62 62 if (array_key_exists('update',$_REQUEST)) { 63 63 update(""); 64 }65 66 67 if (array_key_exists('logout',$_GET)) {68 logoutUserCookie();69 rss_redirect('');70 64 } 71 65 -
branches/postgresql/init.php
r1393 r1432 62 62 // 63 63 rss_require('util.php'); 64 rss_require('cls/user.php'); 64 65 rss_require('cls/rss.php'); 65 66 //rss_require('config.php'); -
branches/postgresql/schema.php
r1393 r1432 684 684 proptype enum('item','feed','folder','category','plugin','tag','theme','misc') NOT NULL default 'item', 685 685 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 688 687 ) TYPE=MyISAM; 689 688 … … 696 695 return 0; 697 696 } 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); 699 700 } 700 701 } -
branches/postgresql/themes/lilina/web/css/look.css
r1393 r1432 373 373 background: #CBDFEB; 374 374 } 375 .dateheader a { color: #777; } 376 -
branches/postgresql/themes/lilina/web/item.php
r1393 r1432 1 1 <?php 2 2 global $lastDate; 3 $thisDate = date("F d,Y", $GLOBALS['rss']->currentItem->date);3 $thisDate = rss_locale_date("%B %d, %Y", $GLOBALS['rss']->currentItem->date); 4 4 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 ?> 6 15 <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> 10 17 </li> 11 <?php 12 } 18 <?php 19 } 13 20 ?> 14 21 <?php -
branches/postgresql/themes/lilina/web/schemes/lowcontrast/diff.css
r1393 r1432 37 37 background: #aaaaaa; 38 38 } 39 40 .dateheader a { color:#fff } -
branches/postgresql/update.php
r1181 r1432 39 39 40 40 if (array_key_exists('js',$_GET)) { 41 ajaxUpdateJavacript(); 41 header('Content-Type: text/javascript'); 42 ajaxUpdateJavascript(); 42 43 exit(); 43 44 } elseif(array_key_exists('rs',$_REQUEST)) { … … 50 51 $browser = new Browser(); 51 52 52 $cline = isset($argv) && !$_REQUEST ;53 $cline = isset($argv) && !$_REQUEST && isset($argc) && $argc; 53 54 $silent = array_key_exists('silent', $_GET) || ($cline && in_array('--silent',$argv)); 54 55 $newsonly = array_key_exists('newsonly', $_GET) || ($cline && in_array('--newsonly', $argv)); -
branches/postgresql/util.php
r1393 r1432 227 227 $guid = $item['id']; 228 228 } 229 $guid = trim($guid); 229 230 $guid = rss_real_escape_string($guid); 230 231 … … 300 301 $cDate = strtotime($item['pubdate'], 0); 301 302 } 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 } 302 311 elseif (array_key_exists('created', $item)) { 303 312 // atom 0.3 304 313 $cDate = parse_iso8601($item['created']); 305 }306 elseif (array_key_exists('published',$item)) {307 // atom 1.0308 $cDate = parse_iso8601($item['published']);309 }310 elseif (array_key_exists('issued', $item)) {311 //Atom, alternative312 $cDate = parse_iso8601($item['issued']);313 314 } 314 315 … … 431 432 432 433 $url = sanitize(str_replace('&','&',$url), RSS_SANITIZER_URL); 433 434 $urlDB = $url; //htmlentities($url);434 435 $urlDB = rss_real_escape_string($url); //htmlentities($url); 435 436 436 437 $res = rss_query("select count(*) as channel_exists from ".getTable("channels")." where url='$urlDB'"); … … 675 676 $h = @fopen($url, "r"); 676 677 if ($h) { 677 while (!feof($h)) {678 $c .= @fread($h, 8192);679 }680 }678 while (!feof($h)) { 679 $c .= @fread($h, 8192); 680 } 681 } 681 682 @fclose($h); 682 683 return $c; … … 867 868 } 868 869 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
