Changeset 1544

Show
Ignore:
Timestamp:
08/24/06 01:14:02 (3 years ago)
Author:
cfriesen
Message:

Feel free to scream if this breaks something...

Location:
trunk/gregarius
Files:
12 modified

Legend:

Unmodified
Added
Removed
  • trunk/gregarius/api.php

    r1275 r1544  
    6666    $sql = "select " 
    6767           ." 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"; 
    7071 
    7172    if (hidePrivate()) { 
     
    135136           ." c.descr as cdescr, c.url as curl, i.author as iauth, i.url as iurl, " 
    136137           ." 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"; 
    139142 
    140143    if ($date) { 
  • trunk/gregarius/cls/alltags.php

    r1181 r1544  
    7777        if($this -> type == 'channel'){ 
    7878            $sql .= " left join " . getTable('channels') . " c on (fid=c.id)," 
    79                 .getTable('tag')." t "." where tid=t.id " 
    80                 . " and ttype = 'channel'"; 
     79                ."inner join " . getTable('tag')." t "." on tid=t.id " 
     80                . " where ttype = 'channel'"; 
    8181        }else{ 
    8282            $sql .= " left join ".getTable('item')." i on (fid=i.id)," 
    83                 .getTable('tag')." t "." where tid=t.id " 
    84                 ." and ttype = 'item'"; 
     83                ."inner join " . getTable('tag')." t "." on tid=t.id " 
     84                ." where ttype = 'item'"; 
    8585        } 
    8686 
     
    121121            $cntr ++; 
    122122        } 
    123  
    124  
    125123    } 
    126124     
  • trunk/gregarius/cls/categories.php

    r1519 r1544  
    109109            //get unread count per folder 
    110110            $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 " 
    116115            ." where i.unread & ". RSS_MODE_UNREAD_STATE 
    117116            ." and not(i.unread & ". RSS_MODE_DELETED_STATE .")"; 
     
    120119            } 
    121120            $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" 
    123121            ." group by m.tid"; 
    124122            _pf('query'); 
     
    142140        $sql = "select " 
    143141         ." 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' " 
    151146 
    152147        if (hidePrivate()) { 
  • trunk/gregarius/cls/channels.php

    r1539 r1544  
    169169 
    170170        _pf(' ... totalCount');      
    171         $sql =  
    172         "select count(*) from ".getTable("item") . "i , " . getTable('channels') . " c " 
    173              
    174             ." where i.cid=c.id and not(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.")" 
    176176            . (hidePrivate()? " and not(unread & ".RSS_MODE_PRIVATE_STATE.")":""); 
    177177             
     
    218218            //get unread count per folder                                                                         
    219219            $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 " 
    224223            ." where i.unread & ". RSS_MODE_UNREAD_STATE 
    225224            ." and not(i.unread & ". RSS_MODE_DELETED_STATE .")"; 
     
    228227            } 
    229228            $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"; 
    232230            _pf('query'); 
    233231            $res = rss_query($sql); 
     
    249247    function populate() { 
    250248        _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 "." where f.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"; 
    253251 
    254252        if (hidePrivate()) { 
  • trunk/gregarius/cls/update.php

    r1516 r1544  
    7676 
    7777    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.") "; 
    8281 
    8382        if (hidePrivate() && !$updatePrivateAlso) { 
  • trunk/gregarius/cls/wrappers/searchform.php

    r1384 r1544  
    2626# 
    2727############################################################################### 
    28  
    2928 
    3029function rss_search_title() { 
     
    9998    $sql = "select " 
    10099             ." 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 "; 
    103103               
    104104    if (hidePrivate()) { 
  • trunk/gregarius/cls/wrappers/toolkit.php

    r1529 r1544  
    5555  $sql = "select " 
    5656         ." 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 "; 
    5960 
    6061  if (hidePrivate()) { 
  • trunk/gregarius/feed.php

    r1509 r1544  
    7676 
    7777        // 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 and f.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"; 
    8181 
    8282        if (hidePrivate()) { 
     
    9494        } else { 
    9595            // 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' " 
    99100                   . "and t.tag like '$sqlid'"; 
    100101 
     
    194195    } 
    195196    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'"; 
    199201        // $vfid can be numeric (t.id) or alphabetic (t.tag) 
    200202        if(is_numeric($vfid)) { 
     
    343345            // 1: build a list of all feeds: 
    344346            $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 
    351351            if (hidePrivate()) { 
    352352                $sql .= " and not (c.mode & " . RSS_MODE_PRIVATE_STATE . ") "; 
     
    449449             
    450450            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__"; 
    455454                if (hidePrivate()) { 
    456455                    $sql .= " and not(i.unread & " . RSS_MODE_PRIVATE_STATE . ")"; 
     
    513512        $next_vfid = $first_vfid = 0; 
    514513        $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"); 
    516516        while (list($tid__) = rss_fetch_row($res)) { 
    517517            if ($tid__ == $vfid) { 
     
    681681} else { 
    682682    // "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" 
    685685                      ." and not(i.unread & " . RSS_MODE_DELETED_STATE  .") " 
    686686                     ); 
     
    11731173            $sql = "select " 
    11741174                   ." 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 .") "; 
    11811180            if (hidePrivate()) { 
    11821181                $sql .=" and not(c.mode & " . RSS_MODE_PRIVATE_STATE .") "; 
    11831182            } 
    1184             $sql .= " and not(c.mode & " .  RSS_MODE_DELETED_STATE .") "; 
    11851183 
    11861184            if (getConfig('rss.config.absoluteordering')) { 
     
    12291227        case 'cat': 
    12301228            $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' " 
    12341232                             ." order by t.tag asc"); 
    12351233 
     
    12781276 
    12791277        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 != '' "; 
    12841281 
    12851282            if (hidePrivate()) { 
  • trunk/gregarius/index.php

    r1424 r1544  
    171171    $sql = "select " 
    172172          ." 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 "; 
    177175           
    178176         // $sql .= $sqlWhereHidden; 
    179177     
    180         $sql .= " and not(c.mode & " . RSS_MODE_DELETED_STATE  .") "; 
     178        $sql .= " where not(c.mode & " . RSS_MODE_DELETED_STATE  .") "; 
    181179         
    182180        if (getConfig('rss.config.absoluteordering')) { 
  • trunk/gregarius/opml.php

    r1511 r1544  
    122122if (array_key_exists('act',$_REQUEST)) { 
    123123 
    124     $rs = rss_query( "select fid,tag from " .getTable('tag')  
    125         ." t, " .getTable('metatag') ." mt " 
    126         ." where mt.tid=t.id and ttype='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'"); 
    127127    $cats=array(); 
    128128    while(list($cid,$tag) = rss_fetch_row($rs)) { 
     
    136136    $sql = "select " 
    137137      ." 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 "; 
    141140       
    142141    if (hidePrivate()) { 
    143         $sql .=" and not(c.mode & " . RSS_MODE_PRIVATE_STATE .") ";        
     142        $sql .=" where not(c.mode & " . RSS_MODE_PRIVATE_STATE .") ";          
    144143    } 
    145144     
     
    151150        $sql .=" order by d.name asc, c.title asc"; 
    152151    } 
    153      
    154      
    155      
    156152     
    157153    $res = rss_query($sql); 
  • trunk/gregarius/tags.php

    r1502 r1544  
    3636    $twhere .= "1=0"; 
    3737 
    38     $sql = "select fid,tid,m.tdate from ".getTable('metatag') 
    39     ." m, ".getTable('tag')." t  where m.tid=t.id and m.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'" 
    4040    ." and ($twhere)"; 
    4141 
     
    5454    if (count($fids)) { 
    5555        $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).")" 
    5959        ." and t.id not in (".implode(",", $tids).")"; 
    6060 
     
    8787    $twhere .= " 1=0"; 
    8888 
    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) " 
    9392    ." and m.ttype = 'item'" 
    9493    ." group by fid order by 2 desc"; 
  • trunk/gregarius/util.php

    r1538 r1544  
    883883    } 
    884884 
    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 " 
    887887           ." 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 .") " 
    889889           ." and not(c.mode & ".RSS_MODE_DELETED_STATE.") "; 
    890890