- <?
- if(!defined('IN_UCHOME')) {
- exit('Access Denied');
- }
- include_once(S_ROOT.'./data/data_indexjufeng.php');
- include_once(S_ROOT.'./data/data_huandeng.php');
- $spacecount = $_SGLOBAL['db']->result($_SGLOBAL['db']->query('SELECT COUNT(*) FROM '.tname('space')),0);
- $cachefile = S_ROOT.'./data/cache_indexjufeng_blog.txt';
- if(check_indexjufeng_cache('blog')) {
- $bloglist = unserialize(sreadfile($cachefile));
- }else {
- $sqlarr = mk_indexjufeng_sql('blog',
- array('blogid','uid'),
- array('hot','viewnum','replynum'),
- array('dateline'),
- array('dateline','viewnum','replynum','hot')
- );
- extract($sqlarr);
- $wherearr[] = "main.friend='0'";
- $query = $_SGLOBAL['db']->query('SELECT main.*, field.*
- FROM '.tname('blog').' main
- LEFT JOIN '.tname('blogfield').' field ON field.blogid=main.blogid
- WHERE '.implode(' AND ',$wherearr)." AND main.pic<>''
- ORDER BY RAND() LIMIT 0,1");
- $bloglist = array();
- while ($value = $_SGLOBAL['db']->fetch_array($query)) {
- if($value['pic']) $value['pic'] = pic_cover_get($value['pic'],$value['picflag']);
- $value['title'] = getstr($value['message'],0,0,0,0,0,-1);
- $value['message'] = getstr($value['message'],66,0,0,0,0,-1);
- $value['subject'] = getstr($value['subject'],50,0,0,0,0,-1);
- $bloglist[] = $value;
- }
- if($_SGLOBAL['indexjufeng']['blog']['cache']) {
- swritefile($cachefile,serialize($bloglist));
- }
- }
- foreach($bloglist as $key =>$value) {
- realname_set($value['uid'],$value['username']);
- $bloglist[$key] = $value;
- }
- $cachefile = S_ROOT.'./data/cache_huandeng1_blog.txt';
- if(check_huandeng_cache('blog')) {
- $erblog = unserialize(sreadfile($cachefile));
- }else {
- $sqlarr = mk_huandeng_sql('blog',
- array('blogid','uid'),
- array('hot','viewnum','replynum'),
- array('dateline'),
- array('dateline','viewnum','replynum','hot')
- );
- extract($sqlarr);
- $wherearr[] = "main.friend='0' and feeld.uid=field.uid";
- $query = $_SGLOBAL['db']->query('SELECT main.*, field.*, feeld.*
- FROM '.tname('blog').' main
- LEFT JOIN '.tname('blogfield').' field ON field.blogid=main.blogid
- LEFT JOIN '.tname('class').' feeld ON feeld.classid=main.classid
- WHERE '.implode(' AND ',$wherearr)."
- ORDER BY main.{$order} $sc LIMIT 0,3");
- $erblog = array();
- while ($value = $_SGLOBAL['db']->fetch_array($query)) {
- $value['subject'] = getstr($value['subject'],50,0,0,0,0,-1);
- $erblog[] = $value;
- }
- if($_SGLOBAL['huandeng']['blog']['cache']) {
- swritefile($cachefile,serialize($erblog));
- }
- }
- foreach($erblog as $key =>$value) {
- realname_set($value['uid'],$value['username']);
- $erblog[$key] = $value;
- }
- $cachefile = S_ROOT.'./data/cache_huandeng_blog.txt';
- if(check_huandeng_cache('blog')) {
- $bablog = unserialize(sreadfile($cachefile));
- }else {
- $sqlarr = mk_huandeng_sql('blog',
- array('blogid','uid'),
- array('hot','viewnum','replynum'),
- array('dateline'),
- array('dateline','viewnum','replynum','hot')
- );
- extract($sqlarr);
- $wherearr[] = "main.friend='0' and main.uid=feeld.uid";
- $query = $_SGLOBAL['db']->query('SELECT main.*, field.*, feeld.*
- FROM '.tname('blog').' main
- LEFT JOIN '.tname('blogfield').' field ON field.blogid=main.blogid
- LEFT JOIN '.tname('class').' feeld ON feeld.classid=main.classid
- WHERE '.implode(' AND ',$wherearr)."
- ORDER BY main.{$order} $sc LIMIT 4,8");
- $bablog = array();
- while ($value = $_SGLOBAL['db']->fetch_array($query)) {
- $value['subject'] = getstr($value['subject'],50,0,0,0,0,-1);
- $bablog[] = $value;
- }
- if($_SGLOBAL['huandeng']['blog']['cache']) {
- swritefile($cachefile,serialize($bablog));
- }
- }
- foreach($bablog as $key =>$value) {
- realname_set($value['uid'],$value['username']);
- $bablog[$key] = $value;
- }
- $cachefile = S_ROOT.'./data/cache_indexjufeng_pic.txt';
- if(check_indexjufeng_cache('pic')) {
- $piclist = unserialize(sreadfile($cachefile));
- }else {
- $sqlarr = mk_indexjufeng_sql('pic',
- array('picid','uid'),
- array('hot'),
- array('dateline'),
- array('dateline','hot')
- );
- extract($sqlarr);
- $shownum = 5;
- $piclist = array();
- $query = $_SGLOBAL['db']->query('SELECT album.albumname, album.friend, space.username, space.name, space.namestatus, main.*
- FROM '.tname('pic').' main
- LEFT JOIN '.tname('album').' album ON album.albumid=main.albumid
- LEFT JOIN '.tname('space').' space ON space.uid=main.uid
- WHERE '.implode(' AND ',$wherearr)."
- ORDER BY main.{$order} $sc LIMIT 0,$shownum");
- while ($value = $_SGLOBAL['db']->fetch_array($query)) {
- if(empty($value['friend'])) {
- $value['pic'] = pic_get($value['filepath'],$value['remote']);
- $piclist[] = $value;
- }
- }
- if($_SGLOBAL['indexjufeng']['pic']['cache']) {
- swritefile($cachefile,serialize($piclist));
- }
- }
- foreach($piclist as $key =>$value) {
- realname_set($value['uid'],$value['username'],$value['name'],$value['namestatus']);
- $piclist[$key] = $value;
- }
- $cachefile = S_ROOT.'./data/cache_huandeng_pic.txt';
- if(check_huandeng_cache('pic')) {
- $albumlist = unserialize(sreadfile($cachefile));
- }else {
- $sqlarr = mk_huandeng_sql('pic',
- array('picid','uid'),
- array('hot'),
- array('dateline'),
- array('dateline','hot')
- );
- extract($sqlarr);
- $shownum = 8;
- $wherearr[] = "main.albumid != '0'";
- $albumlist = array();
- $query = $_SGLOBAL['db']->query('SELECT album.albumname, album.friend, album.albumname, space.username, space.name, space.namestatus, main.*
- FROM '.tname('pic').' main
- LEFT JOIN '.tname('album').' album ON album.albumid=main.albumid
- LEFT JOIN '.tname('space').' space ON space.uid=main.uid
- WHERE '.implode(' AND ',$wherearr)."
- ORDER BY main.{$order} $sc LIMIT 0,$shownum");
- while ($value = $_SGLOBAL['db']->fetch_array($query)) {
- if(empty($value['friend'])) {
- $value['pic'] = pic_get($value['filepath'],$value['remote']);
- $albumlist[] = $value;
- }
- }
- if($_SGLOBAL['huandeng']['pic']['cache']) {
- swritefile($cachefile,serialize($albumlist));
- }
- }
- foreach($albumlist as $key =>$value) {
- realname_set($value['uid'],$value['username'],$value['name'],$value['albumname'],$value['namestatus']);
- $albumlist[$key] = $value;
- }
- $cachefile = S_ROOT.'./data/cache_indexjufeng_thread.txt';
- if(check_indexjufeng_cache('thread')) {
- $gonggao = unserialize(sreadfile($cachefile));
- }else {
- $sqlarr = mk_indexjufeng_sql('thread',
- array('tid','uid'),
- array('hot','viewnum','replynum'),
- array('dateline','lastpost'),
- array('dateline','viewnum','replynum','hot')
- );
- extract($sqlarr);
- $shownum = 10;
- $gonggao = array();
- $query = $_SGLOBAL['db']->query('SELECT main.*, m.tagname
- FROM '.tname('thread').' main
- LEFT JOIN '.tname('mtag').' m ON m.tagid=main.tagid
- WHERE '.implode(' AND ',$wherearr)."
- ORDER BY main.{$order} $sc LIMIT 0,$shownum");
- while ($value = $_SGLOBAL['db']->fetch_array($query)) {
- $value['tagname'] = getstr($value['tagname'],20);
- $value['subject'] = getstr($value['subject'],50);
- $gonggao[] = $value;
- }
- if($_SGLOBAL['indexjufeng']['thread']['cache']) {
- swritefile($cachefile,serialize($gonggao));
- }
- }
- foreach($gonggao as $key =>$value) {
- realname_set($value['uid'],$value['username']);
- $gonggao[$key] = $value;
- }
- $cachefile = S_ROOT.'./data/cache_huandeng_thread.txt';
- if(check_huandeng_cache('thread')) {
- $threadlist = unserialize(sreadfile($cachefile));
- }else {
- $sqlarr = mk_huandeng_sql('thread',
- array('tid','uid'),
- array('hot','viewnum','replynum'),
- array('dateline','lastpost'),
- array('dateline','viewnum','replynum','hot')
- );
- extract($sqlarr);
- $shownum = 3;
- $threadlist = array();
- $query = $_SGLOBAL['db']->query('SELECT main.*, m.tagname
- FROM '.tname('thread').' main
- LEFT JOIN '.tname('mtag').' m ON m.tagid=main.tagid
- WHERE '.implode(' AND ',$wherearr)."
- ORDER BY main.{$order} $sc LIMIT 0,$shownum");
- while ($value = $_SGLOBAL['db']->fetch_array($query)) {
- $value['tagname'] = getstr($value['tagname'],20);
- $threadlist[] = $value;
- }
- if($_SGLOBAL['huandeng']['thread']['cache']) {
- swritefile($cachefile,serialize($threadlist));
- }
- }
- foreach($threadlist as $key =>$value) {
- realname_set($value['uid'],$value['username']);
- $threadlist[$key] = $value;
- }
- include_once(S_ROOT.'./data/data_eventclass.php');
- $cachefile = S_ROOT.'./data/cache_indexjufeng_event.txt';
- if(check_indexjufeng_cache('event')) {
- $eventlist = unserialize(sreadfile($cachefile));
- }else {
- $sqlarr = mk_indexjufeng_sql('event',
- array('eventid','uid'),
- array('hot','membernum','follownum'),
- array('dateline'),
- array('dateline','membernum','follownum','hot')
- );
- extract($sqlarr);
- $shownum = 4;
- $eventlist = array();
- $query = $_SGLOBAL['db']->query('SELECT main.*
- FROM '.tname('event').' main
- WHERE '.implode(' AND ',$wherearr)."
- ORDER BY main.{$order} $sc LIMIT 0,$shownum");
- while ($value = $_SGLOBAL['db']->fetch_array($query)) {
- $value['title'] = getstr($value['title'],45);
- if($value['poster']){
- $value['pic'] = pic_get($value['poster'],$value['thumb'],$value['remote']);
- }else {
- $value['pic'] = $_SGLOBAL['eventclass'][$value['classid']]['poster'];
- }
- $eventlist[] = $value;
- }
- if($_SGLOBAL['indexjufeng']['event']['cache']) {
- swritefile($cachefile,serialize($eventlist));
- }
- }
- foreach($eventlist as $key =>$value) {
- realname_set($value['uid'],$value['username']);
- $eventlist[$key] = $value;
- }
- $feedlist = array();
- if(ckprivacy('feed')) {
- $query = $_SGLOBAL['db']->query('SELECT * FROM '.tname('feed')." WHERE friend='0' ORDER BY dateline DESC LIMIT 0,20");
- while ($value = $_SGLOBAL['db']->fetch_array($query)) {
- if(ckfriend($value['uid'],$value['friend'],$value['target_ids'])) {
- realname_set($value['uid'],$value['username']);
- $feedlist[] = $value;
- }
- }
- $feednum = count($feedlist);
- }
- $mtaglist = $mtaglist = array();
- $query = $_SGLOBAL['db']->query('SELECT tagid,tagname,membernum,pic,announcement FROM '.tname('mtag').' ORDER BY membernum DESC LIMIT 0,3');
- while ($value = $_SGLOBAL['db']->fetch_array($query)) {
- if(empty($value['pic'])) {
- $value['pic'] = 'image/nologo.jpg';
- }
- $value['title'] = getstr($value['announcement'],0,0,0,0,0,-1);
- $mtaglist[] = $value;
- }
- $jiluspacelist = array();
- $query = $_SGLOBAL['db']->query('SELECT a.uid,a.username,a.name,a.namestatus,b.uid,b.doid,b.message,b.dateline FROM '.tname('space').' a, '.tname('doing')." b where a.uid=b.uid and a.updatetime>'$wheretime' and b.doid in (select max(doid) from ".tname('doing').' b group by b.uid) ORDER BY b.dateline DESC LIMIT 0,3
- ');
- while ($value = $_SGLOBAL['db']->fetch_array($query)) {
- realname_set($value['uid'],$value['username'],$value['name'],$value['namestatus']);
- $value['title'] = getstr($value['message'],0,0,0,0,0,-1);
- $jiluspacelist[] = $value;
- }
- $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 RAND() LIMIT 0,7');
- while ($value = $_SGLOBAL['db']->fetch_array($query)) {
- $myapplist[] = $value;
- }
- }
- }
- $sharelist = array();
- $query = $_SGLOBAL['db']->query('SELECT *
- FROM '.tname('share').'
- ORDER BY dateline DESC LIMIT 0,11');
- while ($value = $_SGLOBAL['db']->fetch_array($query)) {
- realname_set($value['uid'],$value['username']);
- $sharelist[] = $value;
- }
- foreach ($feedlist as $key =>$value) {
- $feedlist[$key] = mkfeed($value);
- }
- realname_get();
- $membername = empty($_SCOOKIE['loginuser'])?'':sstripslashes($_SCOOKIE['loginuser']);
- $wheretime = $_SGLOBAL['timestamp']-3600*24*30;
- if(empty($uid))
- {
- $uid=$_SGLOBAL['supe_uid'];
- }
- $sex = '';
- $space = getspace($uid);
- if($space['sex']==1)
- {
- $sex = 2;
- }
- if($space['sex']==2)
- {
- $sex = 1;
- }
- if(!empty($sex))
- {
- $wheresql = 'where sex ='.$sex;
- }
- $onlinelist = array();
- $i=0;
- $query = $_SGLOBAL['db']->query('SELECT * FROM '.tname('spacefield').' '.$wheresql.' ORDER BY rand() DESC');
- while ($value = $_SGLOBAL['db']->fetch_array($query)) {
- if($i>=10)
- {
- break;
- }
- realname_set($value['uid'],$value['username']);
- if(!ckavatar($value['uid']))
- {
- continue;
- }
- else
- {
- $onlinelist[] = $value;
- $i++;
- }
- }
- $_TPL['css'] = 'indexjufeng';
- include_once template('indexjufeng');
- function check_indexjufeng_cache($type) {
- global $_SGLOBAL;
- if($_SGLOBAL['indexjufeng'][$type]['cache']) {
- $cachefile = S_ROOT.'./data/cache_indexjufeng_'.$type.'.txt';
- $ftime = filemtime($cachefile);
- if($_SGLOBAL['timestamp'] -$ftime <$_SGLOBAL['indexjufeng'][$type]['cache']) {
- return true;
- }
- }
- return false;
- }
- function check_huandeng_cache($type) {
- global $_SGLOBAL;
- if($_SGLOBAL['huandeng'][$type]['cache']) {
- $cachefile = S_ROOT.'./data/cache_huandeng_'.$type.'.txt';
- $ftime = filemtime($cachefile);
- if($_SGLOBAL['timestamp'] -$ftime <$_SGLOBAL['huandeng'][$type]['cache']) {
- return true;
- }
- }
- return false;
- }
- function mk_indexjufeng_sql($type,$ids,$crops,$days,$orders) {
- global $_SGLOBAL;
- $nt = $_SGLOBAL['indexjufeng'][$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);
- }
- function mk_huandeng_sql($type,$ids,$crops,$days,$orders) {
- global $_SGLOBAL;
- $nt = $_SGLOBAL['huandeng'][$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);
- }
- ?>
复制代码 谁帮我从中分离出 可以调用 【message】这个表,像下图一样的调用
请高手帮忙,顺便告诉我使用方法
如果你提供有偿服务,只要价格合理,请留下QQ 号码。马上开学了,我得尽快搞,感谢! |