Changeset 1759

Show
Ignore:
Timestamp:
09/26/07 08:57:31 (14 months ago)
Author:
mdodoo
Message:

Lots of things are still not working, but I think this code is better than what was currently committed ([1639]
should have been reverted, and the person who committed should have had their SVN access pulled, for example).
Created this by grabbing the trunk code and then manually inserting the MU branch's changes in. This is probably
not usable in an actual installation (no support for creating new user accounts yet, for example), but patches are
welcome.

Not sure why I write so much here - I am not sure anyone other than my fellow devs actually read them...

Location:
branches/multiuser
Files:
15 modified

Legend:

Unmodified
Added
Removed
  • branches/multiuser/admin/index.php

    r1627 r1759  
    7777 
    7878 
    79 $auth=rss_user_check_user_level(RSS_USER_LEVEL_ADMIN); 
     79$auth=rss_user_check_user_level(RSS_USER_LEVEL_BASIC); 
    8080if (! $auth) { 
     81// we should either be setting the admin password during installation 
     82// or setting it automatically and sending it to the person installing thr. email 
    8183    // check whether the admin password has been set. 
    8284    $sql = "select uname,password from " . getTable('users') . " where ulevel=99"; 
     
    9092        } 
    9193        set_admin_pass($admin_uname,$admin_pass); 
    92      } else if(!rss_user_check_user_level(RSS_USER_LEVEL_BASIC)) { 
    93                rss_login_form(); 
    94                exit(); 
     94    } else { 
     95        rss_login_form(); 
     96      exit(); 
    9597    } 
    9698} 
     
    114116            switch($_REQUEST[CST_ADMIN_DOMAIN]) { 
    115117            case CST_ADMIN_DOMAIN_FOLDER: 
    116                     $show = folder_admin(); 
     118                $show = folder_admin(); 
    117119                break; 
    118120            case CST_ADMIN_DOMAIN_CHANNEL: 
     
    120122                break; 
    121123            case CST_ADMIN_DOMAIN_CONFIG: 
    122                 $show = config_admin(); 
     124                if ($authorised >= RSS_USER_LEVEL_ADMIN) $show = config_admin(); 
    123125                break; 
    124126            case CST_ADMIN_DOMAIN_ITEM: 
    125                 $show = item_admin(); 
     127                if ($authorised >= RSS_USER_LEVEL_ADMIN) $show = item_admin(); 
    126128                break; 
    127129            case CST_ADMIN_DOMAIN_PLUGINS: 
    128                 $show = plugins_admin(); 
     130                // TODO: add plugin management for individual users 
     131                if ($authorised >= RSS_USER_LEVEL_ADMIN) $show = plugins_admin(); 
    129132                break; 
    130133            case CST_ADMIN_DOMAIN_THEMES: 
  • branches/multiuser/admin/users.php

    r1604 r1759  
    9797    ."<legend>" . __('Please log in') . "</legend>\n" 
    9898    ."<p><label style=\"display:block\" for=\"username\">".__('Username').":</label>\n" 
    99     ."<input type=\"text\" id=\"username\" name=\"username\" value=\"$uname\" /></p>\n" 
     99    ."<input type=\"text\" id=\"username\" name=\"username\" /></p>\n" 
    100100    ."<p><label style=\"display:block\" for=\"password\">".__('Password').":</label>\n" 
    101     ."<input type=\"password\" id=\"password\" name=\"password\" value=\"$pass\" /></p>\n" 
    102     ."<p id=\"admin_login_submit\"><input type=\"submit\" value=\"".LBL_LOG_IN."\" /></p>\n" 
     101    ."<input type=\"password\" id=\"password\" name=\"password\" /></p>\n" 
     102    ."<p id=\"admin_login_submit\"><input type=\"submit\" value=\"".__('Login')."\" /></p>\n" 
    103103    ."<span style=\"display:inline;\" id=\"admin_login_result\"></span>\n" 
    104104    ."</fieldset>\n" 
  • branches/multiuser/cls/channels.php

    r1640 r1759  
    224224            ." from " . getTable('item2user') ." i2u " 
    225225            . " inner join " . getTable('channels2user') . " c2u on c2u.fkuid=" . rss_user_id() 
    226             . " inner join " . getTable('folders') ." f on c2u.parent=f.id" 
     226            . " inner join " . getTable('channels') . " c on c.id = c2u.fkcid" 
     227            . " inner join " . getTable('folders') ." f on c.parent=f.id" 
    227228            ." where i2u.flgunread =1 " 
    228229            ." and i2u.flgdeleted=0 "; 
     
    252253        _pf('FeedList->populate() ...'); 
    253254        $sql = "select " 
    254         ." c.id, c.title, c.url, c.siteurl, f.name, c2u.parent, c2u.icon, c.descr, c2u.flgdeleted,c2u.flgprivate " 
     255        ." c.id, c.title, c.url, c.siteurl, f.name, c.parent, c2u.icon, c.descr, c2u.flgdeleted,c2u.flgprivate " 
    255256        ." from ".getTable("channels")." c " 
    256257        . " inner join " . getTable("channels2user")." c2u on c2u.fkcid=c.id " 
     
    265266 
    266267        if (getConfig('rss.config.absoluteordering')) { 
    267             $sql .= " order by f.position asc, c2u.position asc"; 
     268            $sql .= " order by f.position asc, c.position asc"; 
    268269        } else { 
    269270            $sql .= " order by f.name, c.title asc"; 
  • branches/multiuser/cls/items.php

    r1639 r1759  
    6060     * ctor 
    6161     */ 
    62     function Item($id, $title, $url, $enclosure, $parent, $author, $description, $date, $isPubDate, $unread, $rating) { 
     62    function Item($id, $title, $url, $enclosure, $parent, $author, $description, $date, $isPubDate, $unread, $private, $sticky, $flagged) { 
    6363        $this->rss = &$GLOBALS['rss']; 
    6464        $this->id = $id; 
    65         $this->flags = $unread; 
    6665        if ($title) { 
    6766            $this->title = $title; 
     
    8685        $this->isPubDate = $isPubDate; 
    8786        $this -> tags=array(); 
    88         $this -> rating = $rating; 
    89         $this ->isUnread    = $unread & RSS_MODE_UNREAD_STATE; 
    90         $this ->isPrivate   = $unread & RSS_MODE_PRIVATE_STATE; 
    91         $this ->isDeleted   = $unread & RSS_MODE_DELETED_STATE; 
    92         $this ->isSticky    = $unread & RSS_MODE_STICKY_STATE; 
    93         $this ->isFlag    = $unread & RSS_MODE_FLAG_STATE; 
     87        //$this -> rating = $rating; 
     88        $this ->isUnread    = $unread; 
     89        $this ->isPrivate   = $private; 
     90        //$this ->isDeleted = $deleted; 
     91        $this ->isSticky    = $sticky; 
     92        $this ->isFlag    = $flagged; 
    9493        //$this -> key = md5(rand(0,10000)); 
    9594         
     
    193192        $this->items[] = $item; 
    194193         
    195         if ((!$this -> hasUnreadItems) && $item->flags & RSS_MODE_UNREAD_STATE) { 
     194        if ((!$this -> hasUnreadItems) && $item->isUnread) { 
    196195            $this -> hasUnreadItems = true; 
    197196        } 
     
    260259         
    261260        // Predefined alternate ordering 
    262         $this -> ORDER_BY_UNREAD_FIRST = " order by i2u.flgunread & " . RSS_MODE_UNREAD_STATE . " desc, "; 
     261        $this -> ORDER_BY_UNREAD_FIRST = " order by i2u.flgunread desc, "; 
    263262        if (getConfig('rss.config.absoluteordering')) { 
    264             $this -> ORDER_BY_UNREAD_FIRST .= " f.position asc, c2u.position asc"; 
     263            $this -> ORDER_BY_UNREAD_FIRST .= " f.position asc, c.position asc"; 
    265264        } else { 
    266             $this -> ORDER_BY_UNREAD_FIRST .= " f.name asc, c2u.title asc"; 
     265            $this -> ORDER_BY_UNREAD_FIRST .= " f.name asc, c.title asc"; 
    267266        } 
    268267        $this -> ORDER_BY_UNREAD_FIRST .= ", i.added desc, i.id asc"; 
     
    283282 
    284283      _pf('ItemList::populate()'); 
    285         $this -> _sqlActualWhat = " i.title,  c.title, c.id, i2u.flgunread, " 
    286             ."i.url, i.enclosure, i.author, i.description, c2u.icon, " 
     284        $this -> _sqlActualWhat = " i.title,  c.title, c.id," 
     285         . " i2u.flgunread, i2u.flgprivate, i2u.flgsticky, i2u.flgdeleted, i2u.flgflagged," 
     286            ." i.url, i.enclosure, i.author, i.description, c.icon, " 
    287287            ." unix_timestamp(ifnull(i.pubdate,i.added)) as ts, " 
    288288            ." i.pubdate is not null as ispubdate, i.id " 
     
    298298            . " inner join " . getTable('channels2user') ." c2u on (i.cid=c2u.fkcid)" 
    299299            . " inner join " . getTable("channels")." c on (c2u.fkcid=c.id)" 
    300             . " inner join " . getTable("folders") ." f on (c2u.parent=f.id) "; 
     300            . " inner join " . getTable("folders") ." f on (c.parent=f.id) "; 
    301301 
    302302 
     
    336336            if (!getConfig('rss.config.feedgrouping')) { 
    337337                if(getConfig("rss.config.datedesc.$skey")){ 
    338                     $this -> _sqlActualOrder = " ts desc, f.position asc, c2u.position asc "; 
     338                    $this -> _sqlActualOrder = " ts desc, f.position asc, c.position asc "; 
    339339                }else{ 
    340                     $this -> _sqlActualOrder = " ts asc, f.position asc, c2u.position asc "; 
     340                    $this -> _sqlActualOrder = " ts asc, f.position asc, c.position asc "; 
    341341                } 
    342342            } elseif (getConfig('rss.config.absoluteordering')) { 
    343                 $this -> _sqlActualOrder = " f.position asc, c2u.position asc"; 
     343                $this -> _sqlActualOrder = " f.position asc, c.position asc"; 
    344344            } else { 
    345345                $this -> _sqlActualOrder = " f.name asc, c.title asc"; 
     
    376376        $curIdx = 0; 
    377377        $f=null; 
    378         while (list ($ititle_, $ctitle_, $cid_, $iunread_, $iurl_, $ienclosure_, $iauthor_, $idescr_, $cicon_, $its_, $iispubdate_, $iid_) = $GLOBALS['rss_db']->rss_fetch_row($res)) { 
     378        while (list ($ititle_, $ctitle_, $cid_, $iunread_, $iprivate_, $isticky_, $ideleted_, $iflagged_, $iurl_, $ienclosure_, $iauthor_, $idescr_, $cicon_, $its_, $iispubdate_, $iid_) = $GLOBALS['rss_db']->rss_fetch_row($res)) { 
    379379             
    380380            // Built a new Item 
    381             $i = new Item($iid_, $ititle_, $iurl_, $ienclosure_, $cid_, $iauthor_, $idescr_, $its_, $iispubdate_, $iunread_); 
     381            $i = new Item($iid_, $ititle_, $iurl_, $ienclosure_, $cid_, $iauthor_, $idescr_, $its_, $iispubdate_, $iunread_, $iprivate_, $isticky_, $iflagged_); 
    382382             
    383383            // no dupes, please 
     
    411411            // Some stats... 
    412412            $this -> itemCount++;            
    413             if ($iunread_ & RSS_MODE_UNREAD_STATE) { 
     413            if ($iunread_) { 
    414414                $this -> unreadCount++;  
    415415                $this -> unreadIids[] = $iid_; 
  • branches/multiuser/cls/update.php

    r1639 r1759  
    9999        if (!hidePrivate() || $ignorePrivate) { 
    100100            if (count($newIds) > 0 && getConfig('rss.config.markreadonupdate')) { 
    101                 rss_query("update ".getTable("item2user")." i2u set i2u.flgunread = unread & " 
    102                           .SET_MODE_READ_STATE." where unread & ".RSS_MODE_UNREAD_STATE 
    103                           ." and i2u.fkiid not in (".implode(",", $newIds).")"); 
     101                rss_query("update ".getTable("item2user")." i2u set i2u.flgunread = 0" 
     102                    . " where i2u.flgunread=1" 
     103                    ." and i2u.fkiid not in (".implode(",", $newIds).")"); 
    104104            } 
    105105        } 
  • branches/multiuser/cls/user.php

    r1524 r1759  
    2727############################################################################### 
    2828rss_require('cls/wrappers/user.php'); 
     29rss_require('themes.php'); 
     30rss_require('plugins.php'); 
    2931 
    3032define ('RSS_USER_ACTION_LOGIN',0x01); 
     
    8183            rss_redirect(''); 
    8284        } 
     85 
    8386                 
    8487        $cuname = $chash = null; 
  • branches/multiuser/cls/wrappers/user.php

    r1524 r1759  
    3838} 
    3939 
     40function rss_user_show_private() { 
     41    return $GLOBALS['rssuser'] -> getShowPrivate(); 
     42} 
     43 
    4044function rss_user_logout() { 
    4145    $GLOBALS['rssuser'] -> logout(); 
  • branches/multiuser/constants.php

    r1639 r1759  
    2727 
    2828// Application title 
    29 define ('_TITLE_', "Gregarius"); 
     29define ('_TITLE_', "GregariusMU"); 
    3030 
    3131 
  • branches/multiuser/feed.php

    r1604 r1759  
    6060    && !is_numeric($_REQUEST['channel']) 
    6161) { 
    62     $sqlid = sanitize($_REQUEST['channel'], RSS_SANITIZER_SIMPLE_SQL | RSS_SANITIZER_NO_SPACES); 
    63     $sql = "select c.id from "  
    64     . getTable("channels")  
    65     ." c left join " .getTable('channels2user') ." c2u on (c.id=c2u.fkcid) " 
    66     ." where c.title like '$sqlid'"; 
     62    $sqlid = preg_replace('#'.RSS_URI_SEPARATOR.'#','_', 
     63        sanitize($_REQUEST['channel'] , RSS_SANITIZER_SIMPLE_SQL ) 
     64        ); 
     65 
     66    $sql = "select c.id from " . getTable("channels")  
     67      . " c left join " .getTable('channels2user')  
     68      ." c2u on (c.id=c2u.fkcid) where title like '$sqlid'"; 
    6769    if (hidePrivate()) { 
    6870        $sql .=" and c2u.flgprivate=0 "; 
    6971    } 
    7072    // don't hide deprecated items becuase we want items of deprecated feeds to be accessible 
    71     // $sql .= " and not(mode & " . RSS_MODE_DELETED_STATE . ") "; 
     73    // $sql .= " and c2u.flgdeleted=0 "; 
    7274 
    7375    $res =  rss_query( $sql ); 
     
    8082        // is this a folder? 
    8183        $sql = "select c.id, c.parent from ". getTable('channels')." c left join " 
    82             . getTable('channels2user') .m" c2u on (c.id=c2u.fkcid) " 
    83         . "inner join " . getTable('folders') . " f  on c.parent=f.id " 
    84         . "where f.name like '$sqlid' and f.id > 0"; 
     84          . getTable('channels2user') . " c2u on (c.id=c2u.fkcid) " 
     85          ." inner join " . getTable('folders') . " f on f.id = c.parent " 
     86          ." where f.name like '$sqlid' and f.id > 0"; 
    8587 
    8688        if (hidePrivate()) { 
     
    308310 
    309311        /** mark channel as read **/ 
    310         $sql = "update " .getTable("item") 
    311                ." set unread = unread & ".SET_MODE_READ_STATE." where cid=$cid"; 
     312        $sql = "update " .getTable("i2u") 
     313               ." set flgunread = 0 where i2u.fkcid=$cid"; 
    312314        if (hidePrivate()) { 
    313             $sql .= " and not(unread & " . RSS_MODE_PRIVATE_STATE . ")"; 
     315            $sql .= " and i2u.flgprivate =0"; 
    314316        } 
    315317        if (count($IdsToMarkAsRead)) { 
     
    323325 
    324326        $sql = "select count(*) from " .getTable("item2user") . " i2u " 
    325                ." where i2u.flgunread=1 " 
    326                ." and i2u.fkcid=$cid" 
    327                ." and i2u.flgdeleted=0 " 
    328                ; 
     327                ." where i2u.flgunread=1 " 
     328                ." and i2u.fkcid=$cid" 
     329                ." and i2u.flgdeleted=0 "; 
    329330        if (hidePrivate()) { 
    330331            $sql .=" and i2u.flgprivate =0"; 
     
    11811182     
    11821183            $sql = "select c.id, c.title from " . getTable("channels") ." c " 
    1183             . "inner join " . getTable("folders") ." d on d.id = c.parent "; 
     1184            . "inner join " . getTable("folders") ." d on d.id = c.parent " 
    11841185            . " where not(c.mode & " .  RSS_MODE_DELETED_STATE .") "; 
    11851186 
  • branches/multiuser/index.php

    r1639 r1759  
    9292 
    9393rss_plugin_hook('rss.plugins.frontpage.afterread', null); 
    94  
    9594$GLOBALS['rss'] -> header = new Header("",LOCATION_HOME,array('cid'=>null,'fid'=>null)); 
    9695$GLOBALS['rss'] -> feedList = new FeedList(false); 
     
    132131    $sqlWhereHidden = ""; 
    133132     
    134     $unreadItems -> populate("i2u.flgunread=1 & " . RSS_MODE_UNREAD_STATE . $sqlWhereHidden, "", 0, $numItems,ITEM_SORT_HINT_UNREAD); 
     133    $unreadItems -> populate("i2u.flgunread=1 " . $sqlWhereHidden, "", 0, $numItems,ITEM_SORT_HINT_UNREAD); 
    135134    //var_dump($unreadItems); 
    136135    _pf('end populate unread items'); 
     
    166165 
    167166    if (getConfig('rss.config.feedgrouping')) { 
    168         if ($limit <= 0) { 
     167        if ($limit <= 0) { 
    169168            return; 
    170169        } 
    171     $sql = "select c2u.fkcid from " . getTable("channels2user") . " c2u "  
    172             . "inner join " . getTable("folders") ." f on c2u.parent = f.id "; 
     170        $sql = "select c2u.fkcid from " . getTable("channels2user") . " c2u "  
     171            . "inner join " . getTable("channels") . " c " 
     172            . "inner join " . getTable("folders") ." f on c.parent = f.id "; 
    173173           
    174174         // $sql .= $sqlWhereHidden; 
     
    177177         
    178178        if (getConfig('rss.config.absoluteordering')) { 
    179             $sql .= " order by f.position asc, c2u.position asc"; 
     179            $sql .= " order by f.position asc, c.position asc"; 
    180180        } else { 
    181             $sql .=" order by f.name asc, c2u.title asc"; 
     181            $sql .=" order by f.name asc, c.title asc"; 
    182182        } 
    183183        $res1=rss_query($sql); 
    184184        while ($readItems->itemCount < $limit && (list($cid) = rss_fetch_row($res1))) { 
    185             $sqlWhere  = " i2u.flgunread=0 and i.cid= $cid"; 
     185            $sqlWhere  = " i2u.flgunread=0 and i.cid= $cid"; 
    186186            $sqlWhere .= " and i.pubdate <= now() "; 
    187187             
  • branches/multiuser/opml.php

    r1604 r1759  
    136136    $sql = "select c.id, c.title, c.url, c.siteurl, d.name, c.parent, c.descr " 
    137137      ." from ". getTable("channels") . " c " 
    138       ."inner join " . getTable("folders") ." d on d.id = c.parent" 
     138      ."inner join " . getTable("folders") ." d on d.id = c.parent"; 
    139139 
    140140    if (hidePrivate()) { 
  • branches/multiuser/plugins.php

    r1486 r1759  
    2727 
    2828require_once('init.php'); 
     29require_once('cls/config.php'); 
    2930 
    3031/** 
  • branches/multiuser/schema.php

    r1627 r1759  
    3030require_once('util.php'); 
    3131require_once('cls/user.php'); 
     32require_once('cls/l10n.php'); 
    3233 
    3334/** 
     
    9091        "rating" => trim(getTable("rating")), 
    9192        "cache" => trim(getTable("cache")), 
    92         "users" => trim(getTable("users")),      
     93        "users" => trim(getTable("users")), 
    9394        "dashboard" => trim(getTable("dashboard")), 
    9495        "properties" => trim(getTable("properties")), 
    95         "item2user" => trim(getTable("item2user")), 
    96         "channels2user" => trim(getTable("channels2user")) 
     96        "channels2user" => trim(getTable("channels2user")), 
     97        "item2user" => trim(getTable("item2user")) 
    9798    ); 
    9899    return $expected_tables; 
     
    273274                    . rss_sql_error_message(), RSS_ERROR_ERROR); 
    274275            } 
    275          
     276        case 'm.fkuid': 
     277            // userid on metatags - added in 0.5.5 
     278            rss_query('alter table ' . getTable('metatag') . ' add column fkuid bigint(15) not null'); 
     279            rss_query('alter table ' . getTable('metatag') . " add index 'fkuid' ('fkuid')"); 
     280            if (rss_is_sql_error(RSS_SQL_ERROR_NO_ERROR)) { 
     281                $updated++; 
     282                rss_error('updated schema for table ' . getTable('metatag'), RSS_ERROR_NOTICE); 
     283            } else { 
     284                rss_error('Failed updating schema for table ' . getTable('metatag') . ': ' 
     285                 . rss_sql_error_message(), RSS_ERROR_ERROR); 
     286            } 
     287            break; 
    276288        break; 
    277289        case 'm.fkuid': 
     
    531543          enclosure varchar(255) default NULL, 
    532544          description text, 
    533           unread tinyint(4) default '1', 
    534545          pubdate datetime default NULL, 
    535546          author varchar(255) default NULL,        
     
    585596    $sql_create = str_replace('__table__',$table, <<< _SQL_ 
    586597        CREATE TABLE __table__ ( 
    587             fid bigint(16) NOT NULL default '0',                     
    588             tid bigint(16) NOT NULL default '0',  
     598            fid bigint(16) NOT NULL default '0', 
     599            tid bigint(16) NOT NULL default '0', 
    589600            fkuid bigint(16) NOT NULL default '1', 
    590             ttype enum('item','folder','channel') NOT NULL default 'item',  
    591             KEY fid (fid),  
     601            ttype enum('item','folder','channel') NOT NULL default 'item', 
     602            KEY fid (fid), 
    592603            KEY tid (tid), 
    593604            KEY fkuid (fkuid), 
    594605            KEY ttype (ttype) 
    595         ) TYPE=MyISAM;     
     606        ) TYPE=MyISAM; 
    596607_SQL_ 
    597608); 
     
    672683        CREATE TABLE __table__ ( 
    673684          uid bigint(16) NOT NULL auto_increment, 
    674           uname varchar(255) NOT NULL,         
    675           password varchar(255) NOT NULL,          
    676           ulevel bigint(11) NOT NULL default '1',          
    677           realname varchar(255) default NULL,                  
    678           lastip varchar(255) default NULL,                        
    679           userips TEXT default '',         
     685          uname varchar(255) NOT NULL, 
     686          password varchar(255) NOT NULL, 
     687          ulevel bigint(11) NOT NULL default '1', 
     688          realname varchar(255) default NULL, 
     689          lastip varchar(255) default NULL, 
     690          userips TEXT default '', 
    680691          lastlogin datetime NULL default '0000-00-00 00:00:00', 
    681692          PRIMARY KEY  (uid), 
     
    704715} 
    705716 
    706 /////////////////////////////////////////////////////////////////////////////// 
     717function _init_channels2user() { 
     718    $table = getTable('channels2user'); 
     719    rss_query_wrapper ('DROP TABLE IF EXISTS ' . $table, true, true); 
     720    $sql_create = str_replace('__table__',$table, <<< _SQL_ 
     721        CREATE TABLE __table__ ( 
     722          id bigint(16) not null auto_increment, 
     723          fkcid bigint(16) NOT NULL, 
     724          fkuid bigint(16) NOT NULL, 
     725          flgprivate tinyint(1) NOT NULL default '0', 
     726          flgdeleted tinyint(1) not null default '0', 
     727          primary key (id), 
     728          KEY flgprivate (flgprivate), 
     729          KEY flgdeleted (flgdeleted), 
     730          KEY fkuid (fkuid), 
     731          KEY iids (fkcid) 
     732        ) ENGINE=MyISAM; 
     733_SQL_ 
     734); 
     735 
     736 
     737    rss_query_wrapper($sql_create, false, true); 
     738 
     739    if (!rss_is_sql_error(RSS_SQL_ERROR_NO_ERROR)) { 
     740        rss_error('The ' . $table . 'table doesn\'t exist and I couldn\'t create it! Please create it manually.', RSS_ERROR_ERROR); 
     741        return 0; 
     742    } else { 
     743        $fillSql = "insert into $table " 
     744        ." (fkcid,fkuid,icon,position,parent,flgprivate,flgdeleted) " 
     745        ."select id, " . rss_user_id() . ", icon, position, parent, " 
     746        ." mode & ".RSS_MODE_PRIVATE_STATE." = ".RSS_MODE_PRIVATE_STATE.", " 
     747        ." mode & ".RSS_MODE_DELETED_STATE." = ".RSS_MODE_DELETED_STATE." " 
     748        ." from " .getTable('channels') 
     749        ." where url != ''"; 
     750        //die($fillSql); 
     751        rss_query_wrapper($fillSql, false, true); 
     752         
     753        rss_query( 
     754            'update ' .getTable('metatag') .' m ' 
     755            .'set m.fkuid=' .rss_user_id()); 
     756        /* 
     757        $rs = rss_query( "select id, fkcid from " .getTable('channels2user')); 
     758        $cids=array(); 
     759        while(list($c2uid,$cid) = rss_fetch_row($rs)) { 
     760            $cids[$cid]=$c2uid; 
     761        } 
     762        */ 
     763        return rss_is_sql_error(RSS_SQL_ERROR_NO_ERROR); 
     764    } 
     765} 
     766 
    707767function _init_item2user() { 
    708        $table = getTable('item2user'); 
    709        rss_query_wrapper ('DROP TABLE IF EXISTS ' . $table, true, true); 
    710        $sql_create = str_replace('__table__',$table, <<< _SQL_ 
    711                CREATE TABLE __table__ ( 
    712                  fkiid bigint(16) NOT NULL, 
    713                  fkuid bigint(16) NOT NULL, 
    714                  fkcid bigint(11) NOT NULL, 
    715                  flgunread tinyint(1) NOT NULL default '1', 
    716                  flgsticky tinyint(1) NOT NULL default '0', 
    717                  flgprivate tinyint(1) NOT NULL default '0', 
    718                  flgdeleted tinyint(1) NOT NULL default '0', 
    719                  flgflagged tinyint(1) NOT NULL default '0', 
    720                  KEY flgunread (flgunread), 
    721                  KEY flgsticky (flgsticky), 
    722                  KEY flgprivate (flgprivate), 
    723                  KEY flgdeleted (flgdeleted), 
    724                  KEY flgflagged (flgflagged), 
    725                  KEY fkuid (fkuid), 
    726                  KEY iids (fkiid) 
    727                ) ENGINE=MyISAM;                 
    728 _SQL_