Changeset 1544
- Timestamp:
- 08/24/06 01:14:02 (2 years ago)
- Location:
- trunk/gregarius
- Files:
-
- 12 modified
-
api.php (modified) (2 diffs)
-
cls/alltags.php (modified) (2 diffs)
-
cls/categories.php (modified) (3 diffs)
-
cls/channels.php (modified) (4 diffs)
-
cls/update.php (modified) (1 diff)
-
cls/wrappers/searchform.php (modified) (2 diffs)
-
cls/wrappers/toolkit.php (modified) (1 diff)
-
feed.php (modified) (10 diffs)
-
index.php (modified) (1 diff)
-
opml.php (modified) (3 diffs)
-
tags.php (modified) (3 diffs)
-
util.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/gregarius/api.php
r1275 r1544 66 66 $sql = "select " 67 67 ." c.id, c.title, c.url, c.siteurl, f.name " 68 ." from ".getTable("channels")." c, " 69 .getTable("folders")." f "." where f.id = c.parent"; 68 ." from ".getTable("channels")." c " 69 ." inner join " . getTable("folders")." f " 70 ." on f.id = c.parent"; 70 71 71 72 if (hidePrivate()) { … … 135 136 ." c.descr as cdescr, c.url as curl, i.author as iauth, i.url as iurl, " 136 137 ." unix_timestamp(ifnull(i.pubdate, i.added)) as idate ,i.id as iid" 137 ." from ".getTable('item')." i, ".getTable('channels') ." c " 138 ." where i.cid=c.id and i.unread & ". RSS_MODE_UNREAD_STATE ." and c.id=$cid"; 138 ." from ".getTable('item')." i " 139 ." inner join " .getTable('channels') ." c " 140 ." on c.id = i.cid " 141 ." where i.unread & ". RSS_MODE_UNREAD_STATE ." and c.id=$cid"; 139 142 140 143 if ($date) { -
trunk/gregarius/cls/alltags.php
r1181 r1544 77 77 if($this -> type == 'channel'){ 78 78 $sql .= " left join " . getTable('channels') . " c on (fid=c.id)," 79 . getTable('tag')." t "." wheretid=t.id "80 . " andttype = 'channel'";79 ."inner join " . getTable('tag')." t "." on tid=t.id " 80 . " where ttype = 'channel'"; 81 81 }else{ 82 82 $sql .= " left join ".getTable('item')." i on (fid=i.id)," 83 . getTable('tag')." t "." wheretid=t.id "84 ." andttype = 'item'";83 ."inner join " . getTable('tag')." t "." on tid=t.id " 84 ." where ttype = 'item'"; 85 85 } 86 86 … … 121 121 $cntr ++; 122 122 } 123 124 125 123 } 126 124 -
trunk/gregarius/cls/categories.php
r1519 r1544 109 109 //get unread count per folder 110 110 $sql = "select m.tid, t.tag, count(*) as cnt " 111 ." from " 112 .getTable('item') ." i, " 113 .getTable('channels') . " c, " 114 .getTable('metatag') ." m, " 115 .getTable('tag') . " t" 111 ." from " . getTable('item') ." i " 112 ." inner join " . getTable('channels') . " c on c.id = i.cid " 113 ." inner join " . getTable('metatag') ." m on m.fid = c.id " 114 ." inner join " . getTable('tag') . " t on t.id = m.tid " 116 115 ." where i.unread & ". RSS_MODE_UNREAD_STATE 117 116 ." and not(i.unread & ". RSS_MODE_DELETED_STATE .")"; … … 120 119 } 121 120 $sql .= " and not(c.mode & " . RSS_MODE_DELETED_STATE .") "; 122 $sql .= " and i.cid=c.id and c.id=m.fid and m.tid=t.id"123 121 ." group by m.tid"; 124 122 _pf('query'); … … 142 140 $sql = "select " 143 141 ." c.id, c.title, c.url, c.siteurl, t.tag, c.parent, c.icon, c.descr, c.mode, t.id " 144 ." from " 145 .getTable('channels') ." c, " 146 .getTable('metatag') ." m, " 147 .getTable('tag') . " t " 148 ." where m.fid = c.id and m.ttype = 'channel' " 149 ." and m.tid = t.id "; 150 142 ." from " . getTable('channels') ." c " 143 ." inner join " . getTable('metatag') ." m m.fid = c.id " 144 ." inner join " . getTable('tag') . " t on t.id = m.tid " 145 ." where m.ttype = 'channel' " 151 146 152 147 if (hidePrivate()) { -
trunk/gregarius/cls/channels.php
r1539 r1544 169 169 170 170 _pf(' ... totalCount'); 171 $sql = 172 "select count(*) from ".getTable("item") . "i ," . getTable('channels') . " c "173 174 ." where i.cid=c.id andnot(i.unread & ".RSS_MODE_DELETED_STATE.") "175 ." and not (c.mode & " .RSS_MODE_DELETED_STATE.")"171 $sql ="select count(*) from ".getTable("item") . "i " 172 ."inner join " . getTable('channels') . " c " 173 ." on c.id = i.cid " 174 ." where not(i.unread & ".RSS_MODE_DELETED_STATE.") " 175 ." and not (c.mode & " .RSS_MODE_DELETED_STATE.")" 176 176 . (hidePrivate()? " and not(unread & ".RSS_MODE_PRIVATE_STATE.")":""); 177 177 … … 218 218 //get unread count per folder 219 219 $sql = "select f.id, f.name, count(*) as cnt " 220 ." from " 221 .getTable('item') ." i, " 222 .getTable('channels') . " c, " 223 .getTable('folders') ." f " 220 ." from " .getTable('item') ." i " 221 ." inner join " . getTable('channels') . " c on c.id = i.cid " 222 ." inner join " . getTable('folders') ." f on f.id = c.parent " 224 223 ." where i.unread & ". RSS_MODE_UNREAD_STATE 225 224 ." and not(i.unread & ". RSS_MODE_DELETED_STATE .")"; … … 228 227 } 229 228 $sql .= " and not(c.mode & " . RSS_MODE_DELETED_STATE .") "; 230 $sql .= " and i.cid=c.id and c.parent=f.id " 231 ." group by f.id"; 229 $sql .= " group by f.id"; 232 230 _pf('query'); 233 231 $res = rss_query($sql); … … 249 247 function populate() { 250 248 _pf('FeedList->populate() ...'); 251 $sql = "select "." c.id, c.title, c.url, c.siteurl, f.name, c.parent, c.icon, c.descr, c.mode "." from ".getTable("channels")." c ,"252 . getTable("folders")." f "." wheref.id = c.parent";249 $sql = "select "." c.id, c.title, c.url, c.siteurl, f.name, c.parent, c.icon, c.descr, c.mode "." from ".getTable("channels")." c " 250 ."inner join " . getTable("folders")." f on f.id = c.parent"; 253 251 254 252 if (hidePrivate()) { -
trunk/gregarius/cls/update.php
r1516 r1544 76 76 77 77 function populate($updatePrivateAlso = false) { 78 $sql = "select c.id, c.url, c.title from ".getTable("channels") . " c, " 79 . getTable('folders') . " f "; 80 $sql .= " where not(c.mode & ".RSS_MODE_DELETED_STATE.") "; 81 $sql .= " and c.parent = f.id "; 78 $sql = "select c.id, c.url, c.title from ".getTable("channels") . " c " 79 . " inner join " . getTable('folders') . " f on f.id = c.parent " 80 . " where not(c.mode & ".RSS_MODE_DELETED_STATE.") "; 82 81 83 82 if (hidePrivate() && !$updatePrivateAlso) { -
trunk/gregarius/cls/wrappers/searchform.php
r1384 r1544 26 26 # 27 27 ############################################################################### 28 29 28 30 29 function rss_search_title() { … … 99 98 $sql = "select " 100 99 ." c.id, c.title, f.name, f.id " 101 ." from " . getTable("channels") ." c, " . getTable("folders"). " f " 102 ." where f.id=c.parent "; 100 ." from " . getTable("channels") ." c " 101 ." inner join " . getTable("folders"). " f " 102 ." on f.id = c.parent "; 103 103 104 104 if (hidePrivate()) { -
trunk/gregarius/cls/wrappers/toolkit.php
r1529 r1544 55 55 $sql = "select " 56 56 ." c.id, c.title, f.name, f.id " 57 ." from " . getTable("channels") ." c, " . getTable("folders"). " f " 58 ." where f.id=c.parent "; 57 ." from " . getTable("channels") ." c " 58 ." inner join " . getTable("folders"). " f " 59 ." on f.id = c.parent "; 59 60 60 61 if (hidePrivate()) { -
trunk/gregarius/feed.php
r1509 r1544 76 76 77 77 // is this a folder? 78 $sql = "select c.id, c.parent from ". getTable('channels')." c ,"79 . getTable('folders') . " f"80 ." where c.parent=f.id andf.name like '$sqlid' and f.id > 0";78 $sql = "select c.id, c.parent from ". getTable('channels')." c " 79 ." inner join " . getTable('folders') . " f on f.id = c.parent " 80 ." where f.name like '$sqlid' and f.id > 0"; 81 81 82 82 if (hidePrivate()) { … … 94 94 } else { 95 95 // maybe it's a virtual folder? 96 $sql = "select c.id, m.tid from ". getTable('channels')." c, " 97 . getTable('metatag') . " m, " . getTable('tag') . " t " 98 . "where c.id = m.fid and m.ttype = 'channel' and m.tid = t.id " 96 $sql = "select c.id, m.tid from ". getTable('channels')." c " 97 ."inner join " . getTable('metatag') . " m on m.fid = c.id " 98 ."inner join " . getTable('tag') . " t on t.id = m.tid " 99 . "where m.ttype = 'channel' " 99 100 . "and t.tag like '$sqlid'"; 100 101 … … 194 195 } 195 196 elseif ($vfid) { 196 $sql = "select c.id, m.tid from ". getTable('channels')." c, " 197 . getTable('metatag') . " m, " . getTable('tag') . " t " 198 . "where c.id = m.fid and m.ttype = 'channel' and m.tid = t.id "; 197 $sql = "select c.id, m.tid from ". getTable('channels')." c " 198 ."inner join " . getTable('metatag') . " m on m.fid = c.id " 199 ."inner join " . getTable('tag') . " t on t.id = m.tid " 200 . "where m.ttype = 'channel'"; 199 201 // $vfid can be numeric (t.id) or alphabetic (t.tag) 200 202 if(is_numeric($vfid)) { … … 343 345 // 1: build a list of all feeds: 344 346 $feeds = array(); 345 $sql = "select c.id from " 346 . getTable('channels') . " c, " 347 . getTable('folders') . " f " 348 . "where c.parent=f.id " 349 ." and not (c.mode & " . RSS_MODE_DELETED_STATE .") " 350 ; 347 $sql = "select c.id from " . getTable('channels') . " c " 348 ."inner join " . getTable('folders') . " f on f.id = c.parent " 349 . "where not (c.mode & " . RSS_MODE_DELETED_STATE .") "; 350 351 351 if (hidePrivate()) { 352 352 $sql .= " and not (c.mode & " . RSS_MODE_PRIVATE_STATE . ") "; … … 449 449 450 450 if( $found || !$first_fid ) { 451 $sql = "select count(*) from " 452 .getTable('item') ." i, " 453 .getTable('channels') ." c " 454 ." where i.unread & " .RSS_MODE_UNREAD_STATE ." and i.cid = c.id and c.parent = $fid__"; 451 $sql = "select count(*) from " . getTable('item') ." i " 452 ."inner join " . getTable('channels') ." c on c.id = i.cid " 453 ." where i.unread & " .RSS_MODE_UNREAD_STATE ." and c.parent = $fid__"; 455 454 if (hidePrivate()) { 456 455 $sql .= " and not(i.unread & " . RSS_MODE_PRIVATE_STATE . ")"; … … 513 512 $next_vfid = $first_vfid = 0; 514 513 $found = false; 515 $res = rss_query("select distinct tid from " .getTable('metatag') ." m," .getTable('tag') ."t where m.tid = t.id order by t.tag asc"); 514 $res = rss_query("select distinct tid from " .getTable('metatag') ." m " 515 . "inner join " . getTable('tag') ."t on t.id = m.tid order by t.tag asc"); 516 516 while (list($tid__) = rss_fetch_row($res)) { 517 517 if ($tid__ == $vfid) { … … 681 681 } else { 682 682 // "item mode" 683 $res = rss_query ("select c.title, c.icon, i.title from " . getTable("channels") ." c ,"684 . getTable("item") ." i where c.id = $cid and i.cid=c.id and i.id=$iid"683 $res = rss_query ("select c.title, c.icon, i.title from " . getTable("channels") ." c " 684 ."inner join " . getTable("item") ." i on i.cid = c.id where c.id = $cid and i.id=$iid" 685 685 ." and not(i.unread & " . RSS_MODE_DELETED_STATE .") " 686 686 ); … … 1173 1173 $sql = "select " 1174 1174 ." c.id, c.title " 1175 ." from " 1176 .getTable("channels") ." c, " 1177 . getTable("folders") ." d " 1178 ." where d.id = c.parent "; 1179 1180 1175 ." from " . getTable("channels") ." c " 1176 ." inner join " . getTable("folders") ." d " 1177 ." on d.id = c.parent "; 1178 1179 $sql .= " where not(c.mode & " . RSS_MODE_DELETED_STATE .") "; 1181 1180 if (hidePrivate()) { 1182 1181 $sql .=" and not(c.mode & " . RSS_MODE_PRIVATE_STATE .") "; 1183 1182 } 1184 $sql .= " and not(c.mode & " . RSS_MODE_DELETED_STATE .") ";1185 1183 1186 1184 if (getConfig('rss.config.absoluteordering')) { … … 1229 1227 case 'cat': 1230 1228 $res = rss_query(" select t.tag,t.id from " 1231 .getTable('metatag') ." m ,"1232 . getTable('tag') . "t"1233 ." where m.ttype = 'channel' and m.tid = t.id"1229 .getTable('metatag') ." m " 1230 ."inner join " . getTable('tag') . "t on t.id = m.tid " 1231 ." where m.ttype = 'channel' " 1234 1232 ." order by t.tag asc"); 1235 1233 … … 1278 1276 1279 1277 case 'folder': 1280 $sql = "select f.id, f.name, count(*) from " 1281 . getTable('channels') . " c, " 1282 . getTable('folders') . " f " 1283 ." where c.parent=f.id and f.name != '' "; 1278 $sql = "select f.id, f.name, count(*) from " . getTable('channels') . " c " 1279 ."inne join " . getTable('folders') . " f on f.id = c.parent " 1280 ." where f.name != '' "; 1284 1281 1285 1282 if (hidePrivate()) { -
trunk/gregarius/index.php
r1424 r1544 171 171 $sql = "select " 172 172 ." c.id" 173 ." from " 174 .getTable("channels") . " c, " 175 .getTable("folders") ." f " 176 ." where c.parent = f.id "; 173 ." from " . getTable("channels") . " c " 174 ." inner join " . getTable("folders") ." f on f.id = c.parent "; 177 175 178 176 // $sql .= $sqlWhereHidden; 179 177 180 $sql .= " andnot(c.mode & " . RSS_MODE_DELETED_STATE .") ";178 $sql .= " where not(c.mode & " . RSS_MODE_DELETED_STATE .") "; 181 179 182 180 if (getConfig('rss.config.absoluteordering')) { -
trunk/gregarius/opml.php
r1511 r1544 122 122 if (array_key_exists('act',$_REQUEST)) { 123 123 124 $rs = rss_query( "select fid,tag from " .getTable('tag') 125 ." t, " .getTable('metatag') ." mt"126 ." where mt.tid=t.id andttype='channel'");124 $rs = rss_query( "select fid,tag from " .getTable('tag') ." t " 125 ."inner join " .getTable('metatag') ." mt on mt.tid = t.id " 126 ." where ttype='channel'"); 127 127 $cats=array(); 128 128 while(list($cid,$tag) = rss_fetch_row($rs)) { … … 136 136 $sql = "select " 137 137 ." c.id, c.title, c.url, c.siteurl, d.name, c.parent, c.descr " 138 ." from ". getTable("channels") . " c, " .getTable("folders") ." d " 139 ." where d.id = c.parent"; 140 138 ." from ". getTable("channels") . " c " 139 ." inner join " . getTable("folders") ." d on d.id = c.parent "; 141 140 142 141 if (hidePrivate()) { 143 $sql .=" andnot(c.mode & " . RSS_MODE_PRIVATE_STATE .") ";142 $sql .=" where not(c.mode & " . RSS_MODE_PRIVATE_STATE .") "; 144 143 } 145 144 … … 151 150 $sql .=" order by d.name asc, c.title asc"; 152 151 } 153 154 155 156 152 157 153 $res = rss_query($sql); -
trunk/gregarius/tags.php
r1502 r1544 36 36 $twhere .= "1=0"; 37 37 38 $sql = "select fid,tid,m.tdate from ".getTable('metatag') 39 ." m, ".getTable('tag')." t where m.tid=t.id andm.ttype = 'item'"38 $sql = "select fid,tid,m.tdate from ".getTable('metatag') ." m " 39 ."inner join " . getTable('tag') . " t on t.id = m.tid where m.ttype = 'item'" 40 40 ." and ($twhere)"; 41 41 … … 54 54 if (count($fids)) { 55 55 $sql = "select t.tag, count(*) as cnt from ".getTable('metatag') 56 ." m left join ".getTable('item')." i on (m.fid=i.id) ,"57 . getTable('tag')." t"58 ." where m. tid=t.id and m.fid in (".implode(",", $fids).")"56 ." m left join ".getTable('item')." i on (m.fid=i.id) " 57 ." inner join " . getTable('tag')." t on (t.id = m.tid) " 58 ." where m.fid in (".implode(",", $fids).")" 59 59 ." and t.id not in (".implode(",", $tids).")"; 60 60 … … 87 87 $twhere .= " 1=0"; 88 88 89 $sql = "select fid, count(*) as cnt from " 90 .getTable('metatag')." m, " 91 .getTable('tag')." t " 92 ." where m.tid=t.id and ($twhere) " 89 $sql = "select fid, count(*) as cnt from " . getTable('metatag')." m " 90 ."inner join " . getTable('tag')." t on t.id = m.tid " 91 ." where ($twhere) " 93 92 ." and m.ttype = 'item'" 94 93 ." group by fid order by 2 desc"; -
trunk/gregarius/util.php
r1538 r1544 883 883 } 884 884 885 $sql = "select count(*) from " 886 . getTable("item") ."i, ".getTable('channels')."c"885 $sql = "select count(*) from " . getTable("item") ."i " 886 ."inner join " . getTable('channels')." c on c.id = i.cid " 887 887 ." where i.unread & ".RSS_MODE_UNREAD_STATE. " and not(i.unread & " . 888 RSS_MODE_DELETED_STATE .") and i.cid=c.id"888 RSS_MODE_DELETED_STATE .") " 889 889 ." and not(c.mode & ".RSS_MODE_DELETED_STATE.") "; 890 890
