一批这些错误,不知道哪一步没做好,呵呵
= array(); $query = $_SGLOBAL['db']->query("SELECT s.*, sf.note FROM ".tname('session')." s LEFT JOIN ".tname('spacefield')." sf ON sf.uid=s.uid ORDER BY s.lastactivity DESC LIMIT 0,12"); while ($value = $_SGLOBAL['db']->fetch_array($query)) { if(!$value['magichidden']) { $value['note'] = shtmlspecialchars(strip_tags($value['note'])); realname_set($value['uid'], $value['username']); $onlinelist[$value['uid']] = $value; } } if(empty($star) && $onlinelist) { $star = sarray_rand($onlinelist, 1); } //在线人数 $olcount = getcount('session', array()); //应用 $myappcount = 0; $myapplist = array(); if($_SCONFIG['my_status']) { $myappcount = $_SGLOBAL['db']->result($_SGLOBAL['db']->query("SELECT COUNT(*) FROM ".tname('myapp')." WHERE flag>='0'"), 0); if($myappcount) { $query = $_SGLOBAL['db']->query("SELECT appid,appname FROM ".tname('myapp')." WHERE flag>=0 ORDER BY flag DESC, displayorder LIMIT 0,15"); while ($value = $_SGLOBAL['db']->fetch_array($query)) { $myapplist[] = $value; } } } //大家的最新动态 $feedlist = array(); $query = $_SGLOBAL['db']->query("SELECT * FROM ".tname('feed')." WHERE friend='0' ORDER BY dateline DESC LIMIT 0,50"); while ($value = $_SGLOBAL['db']->fetch_array($query)) { realname_set($value['uid'], $value['username']); $feedlist[] = $value; } //格式化动态 foreach ($feedlist as $key => $value) { $feedlist[$key] = mkfeed($value); } //分享 $sharelist = array(); $query = $_SGLOBAL['db']->query("SELECT * FROM ".tname('share')." ORDER BY dateline DESC LIMIT 0,5"); while ($value = $_SGLOBAL['db']->fetch_array($query)) { realname_set($value['uid'], $value['username']); $sharelist[] = $value; } realname_get(); //最后登录名 $membername = empty($_SCOOKIE['loginuser'])?'':sstripslashes($_SCOOKIE['loginuser']); $wheretime = $_SGLOBAL['timestamp']-3600*24*30; $_TPL['css'] = 'network'; include_once template("network"); //检查缓存 function check_network_cache($type) { global $_SGLOBAL; if($_SGLOBAL['network'][$type]['cache']) { $cachefile = S_ROOT.'./data/cache_network_'.$type.'.txt'; $ftime = filemtime($cachefile); if($_SGLOBAL['timestamp'] - $ftime < $_SGLOBAL['network'][$type]['cache']) { return true; } } return false; } //获得SQL function mk_network_sql($type, $ids, $crops, $days, $orders) { global $_SGLOBAL; $nt = $_SGLOBAL['network'][$type]; $wherearr = array('1'); //指定 foreach ($ids as $value) { if($nt[$value]) { $wherearr[] = "main.{$value} IN (".$nt[$value].")"; } } //范围 foreach ($crops as $value) { $value1 = $value.'1'; $value2 = $value.'2'; if($nt[$value1]) { $wherearr[] = "main.{$value} >= '".$nt[$value1]."'"; } if($nt[$value2]) { $wherearr[] = "main.{$value} <= '".$nt[$value2]."'"; } } //时间 foreach ($days as $value) { if($nt[$value]) { $daytime = $_SGLOBAL['timestamp'] - $nt[$value]*3600*24; $wherearr[] = "main.{$value}>='$daytime'"; } } //排序 $order = in_array($nt['order'], $orders)?$nt['order']:array_shift($orders); $sc = in_array($nt['sc'], array('desc','asc'))?$nt['sc']:'desc'; return array('wherearr'=>$wherearr, 'order'=>$order, 'sc'=>$sc); } ?> |