Show
Ignore:
Timestamp:
08/21/06 19:48:40 (2 years ago)
Author:
mbonetti
Message:

Some more multi-user-hacking

Location:
branches/multiuser/cls
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • branches/multiuser/cls/channels.php

    r1524 r1541  
    170170        _pf(' ... totalCount');      
    171171        $sql =  
    172         "select count(*) from ".getTable("item2user") . "i , " . getTable('channels') . " c " 
    173              
    174             ." where i.fkcid=c.id and i.flgdeleted=0 " 
    175             ." and not (c.mode & " .RSS_MODE_DELETED_STATE.")" 
     172            "select count(*) from ".getTable("item2user") . "i , "  
     173            . getTable('channels2user') . " c2u "    
     174            ." where i.fkcid=c2u.fkcid and i.flgdeleted=0 " 
     175            ." and c2u.fkuid=" . rss_user_id() 
     176            ." and i.fkuid=" . rss_user_id() 
     177            ." and c2u.flgdeleted=0" 
    176178            . (hidePrivate()? " and i.flgprivate=0":""); 
    177179             
     
    184186        _pf(' ... feedsCount');              
    185187        $res = rss_query("select count(*) from " 
    186             .getTable("channels")." where not(mode & ".RSS_MODE_DELETED_STATE.")" 
    187             . (hidePrivate()? " and not(mode & ".RSS_MODE_PRIVATE_STATE.")":"") 
     188            .getTable("channels2user")." where flgdeleted=0 " 
     189            ." and fkuid=" . rss_user_id() 
     190            . (hidePrivate()? " and flgprivate=0":"") 
    188191            ); 
    189192             
     
    220223            ." from " 
    221224            .getTable('item2user') ." i2u, " 
    222             .getTable('channels') . " c, " 
     225            .getTable('channels2user') . " c2u, " 
    223226            .getTable('folders') ." f " 
    224227            ." where i2u.flgunread =1 " 
     
    227230                $sql .=" and i2u.flgprivate =0 "; 
    228231            } 
    229             $sql .= " and not(c.mode & " . RSS_MODE_DELETED_STATE .") "; 
    230             $sql .= " and i2u.fkcid=c.id and c.parent=f.id " 
     232            $sql .= " and c2u.fkuid=" . rss_user_id(); 
     233            $sql .= " and c2u.flgdeleted=0 "; 
     234            $sql .= " and c2u.parent=f.id " 
    231235            ." group by f.id";  
    232236            _pf('query'); 
     
    249253    function populate() { 
    250254        _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"; 
    253  
     255        $sql = "select " 
     256        ." c.id, c.title, c.url, c.siteurl, f.name, c2u.parent, c2u.icon, c.descr, c2u.flgdeleted,c2u.flgprivate " 
     257        ." from " 
     258        .getTable("channels")." c, " 
     259        .getTable("channels2user")." c2u, " 
     260        .getTable("folders")." f " 
     261         
     262        ." where " 
     263        ." f.id = c.parent " 
     264        ." and c2u.fkcid=c.id " 
     265        . " and c2u.fkuid=" . rss_user_id(); 
    254266        if (hidePrivate()) { 
    255             $sql .= " and not(c.mode & ".RSS_MODE_PRIVATE_STATE.") "; 
    256         } 
    257  
    258         $sql .= " and not(c.mode & ".RSS_MODE_DELETED_STATE.") "; 
     267            $sql .= " and c2u.flgprivate=0 "; 
     268        } 
     269 
     270        $sql .= " and c2u.flgdeleted=0 "; 
    259271 
    260272        if (getConfig('rss.config.absoluteordering')) { 
    261             $sql .= " order by f.position asc, c.position asc"; 
     273            $sql .= " order by f.position asc, c2u.position asc"; 
    262274        } else { 
    263275            $sql .= " order by f.name, c.title asc"; 
  • branches/multiuser/cls/items.php

    r1524 r1541  
    262262        $this -> ORDER_BY_UNREAD_FIRST = " order by i2u.flgunread desc, "; 
    263263        if (getConfig('rss.config.absoluteordering')) { 
    264             $this -> ORDER_BY_UNREAD_FIRST .= " f.position asc, c.position asc"; 
     264            $this -> ORDER_BY_UNREAD_FIRST .= " f.position asc, c2u.position asc"; 
    265265        } else { 
    266266            $this -> ORDER_BY_UNREAD_FIRST .= " f.name asc, c.title asc"; 
     
    284284      _pf('ItemList::populate()'); 
    285285        $this -> _sqlActualWhat = " i.title,  c.title, c.id, " 
    286         ."i2u.flgunread, i2u.flgprivate, i2u.flgsticky, i2u.flgdeleted, i2u.flgflagged," 
    287             ."i.url, i.enclosure, i.author, i.description, c.icon, " 
     286        ."i2u.flgunread, i2u.flgprivate, i2u.flgsticky, i2u.flgdeleted, " 
     287        ." i2u.flgflagged," 
     288            ."i.url, i.enclosure, i.author, i.description, c2u.icon, " 
    288289            ." unix_timestamp(ifnull(i.pubdate,i.added)) as ts, " 
    289290            ." i.pubdate is not null as ispubdate, i.id " 
     
    298299            //." left join " 
    299300            //. getTable("rating") ." r on (i.id = r.iid), " 
    300             .getTable("channels")." c on (i.cid=c.id) left join " 
    301             .getTable("folders") ." f on (c.parent=f.id) "; 
     301            .getTable('channels2user') ." c2u on (i.cid=c2u.fkcid) left join " 
     302            .getTable("channels")." c on (c2u.fkcid=c.id) left join " 
     303            .getTable("folders") ." f on (c2u.parent=f.id) "; 
    302304 
    303305 
     
    308310         
    309311        $this -> _sqlActualWhere .= " and " 
    310             . (false == $includeDeprecated ? " not(c.mode & ".RSS_MODE_DELETED_STATE.") and " : "") 
     312            . (false == $includeDeprecated ? " c2u.flgdeleted=0 and " : "") 
    311313            ." i2u.flgdeleted=0 and "; 
    312314             
     
    337339            if (!getConfig('rss.config.feedgrouping')) { 
    338340                if(getConfig("rss.config.datedesc.$skey")){ 
    339                     $this -> _sqlActualOrder = " ts desc, f.position asc, c.position asc "; 
     341                    $this -> _sqlActualOrder = " ts desc, f.position asc, c2u.position asc "; 
    340342                }else{ 
    341                     $this -> _sqlActualOrder = " ts asc, f.position asc, c.position asc "; 
     343                    $this -> _sqlActualOrder = " ts asc, f.position asc, c2u.position asc "; 
    342344                } 
    343345            } elseif (getConfig('rss.config.absoluteordering')) { 
    344                 $this -> _sqlActualOrder = " f.position asc, c.position asc"; 
     346                $this -> _sqlActualOrder = " f.position asc, c2u.position asc"; 
    345347            } else { 
    346348                $this -> _sqlActualOrder = " f.name asc, c.title asc";