space_doing.php(记录)代码注释
来源:互联网 发布:网络视频解码器 编辑:程序博客网 时间:2024/06/01 07:18
<?php
/*
[UCenter Home] (C) 2007-2008 Comsenz Inc.
$Id: space_doing.php 12998 2009-08-05 03:29:54Z liguode $
*/
if(!defined('IN_UCHOME')) {
exit('Access Denied');
}
//分页
$perpage = 20;
$perpage = mob_perpage($perpage);//为手机应用留下接口,具体见function_common.php
$page = empty($_GET['page'])?0:intval($_GET['page']); //如果page有传递数据,则从第page页开始输出,没有则从头开始输出。
if($page<1) $page=1;
$start = ($page-1)*$perpage; //开始输出的记录号
//检查开始数
ckstart($start, $perpage);
$dolist = array();
$count = 0;
if(empty($_GET['view']) && ($space['friendnum']<$_SCONFIG['showallfriendnum'])) {
$_GET['view'] = 'all';//默认显示
}
//处理查询
$f_index = '';
if($_GET['view'] == 'all') { //所有记录
$wheresql = "1"; //查询条件
$theurl = "space.php?uid=$space[uid]&do=$do&view=all"; //multi函数的参数,分页时候的地址链接
$f_index = 'USE INDEX(dateline)'; //排序
$actives = array('all'=>' class="active"');
} else {
if(empty($space['feedfriend'])) $_GET['view'] = 'me'; //我的记录
if($_GET['view'] == 'me') {
$wheresql = "uid='$space[uid]'";
$theurl = "space.php?uid=$space[uid]&do=$do&view=me";
$actives = array('me'=>' class="active"');
} else { //朋友+我的记录
$wheresql = "uid IN ($space[feedfriend],$space[uid])";
$theurl = "space.php?uid=$space[uid]&do=$do&view=we";
$f_index = 'USE INDEX(dateline)';
$actives = array('we'=>' class="active"');
}
}
$doid = empty($_GET['doid'])?0:intval($_GET['doid']); //传递过来记录号,表明仅需要查找一条记录
if($doid) {
$count = 1;
$f_index = '';
$wheresql = "doid='$doid'";
$theurl .= "&doid=$doid";
}
$doids = $clist = $newdoids = array();
if(empty($count)) {
$count = $_SGLOBAL['db']->result($_SGLOBAL['db']->query("SELECT COUNT(*) FROM ".tname('doing')." WHERE $wheresql"), 0);
//更新统计
if($wheresql == "uid='$space[uid]'" && $space['doingnum'] != $count) {
updatetable('space', array('doingnum' => $count), array('uid'=>$space['uid']));
}
}
if($count) {
$query = $_SGLOBAL['db']->query("SELECT * FROM ".tname('doing')." $f_index
WHERE $wheresql
ORDER BY dateline DESC
LIMIT $start,$perpage");
while ($value = $_SGLOBAL['db']->fetch_array($query)) {
realname_set($value['uid'], $value['username']);
$doids[] = $value['doid'];
$dolist[] = $value;
} //将从$start开始的$perpage个记录存入dolist[]数组中,在view中显示时调用。
}
//单条处理
if($doid) {
$dovalue = empty($dolist)?array():$dolist[0];
if($dovalue) {
if($dovalue['uid'] == $_SGLOBAL['supe_uid']) {
$actives = array('me'=>' class="active"');
} else {
$space = getspace($dovalue['uid']);//对方的空间
$actives = array('all'=>' class="active"');
}
}
}
//回复
if($doids) {
include_once(S_ROOT.'./source/class_tree.php');
$tree = new tree();
$values = array();
$query = $_SGLOBAL['db']->query("SELECT * FROM ".tname('docomment')." USE INDEX(dateline) WHERE doid IN (".simplode($doids).") ORDER BY dateline");
while ($value = $_SGLOBAL['db']->fetch_array($query)) {
realname_set($value['uid'], $value['username']);
$newdoids[$value['doid']] = $value['doid'];
if(empty($value['upid'])) {
$value['upid'] = "do$value[doid]";
}
$tree->setNode($value['id'], $value['upid'], $value);
}
}
foreach ($newdoids as $cdoid) {
$values = $tree->getChilds("do$cdoid");
foreach ($values as $key => $id) {
$one = $tree->getValue($id);
$one['layer'] = $tree->getLayer($id) * 2 - 2;
$one['style'] = "padding-left:{$one['layer']}em;";
if($_GET['highlight'] && $one['id'] == $_GET['highlight']) {
$one['style'] .= 'color:red;font-weight:bold;';
}
$clist[$cdoid][] = $one;
}
}
//分页
$multi = multi($count, $perpage, $page, $theurl);
//同心情的
$moodlist = array();
if($space['mood'] && empty($start)) {
$query = $_SGLOBAL['db']->query("SELECT s.uid,s.username,s.name,s.namestatus,s.mood,s.updatetime,s.groupid,sf.note,sf.sex
FROM ".tname('space')." s
LEFT JOIN ".tname('spacefield')." sf ON sf.uid=s.uid
WHERE s.mood='$space[mood]' ORDER BY s.updatetime DESC LIMIT 0,13");
while ($value = $_SGLOBAL['db']->fetch_array($query)) {
if($value['uid'] != $space['uid']) {
realname_set($value['uid'], $value['username'], $value['name'], $value['namestatus']);
$moodlist[] = $value;
if(count($moodlist)==12) break;
}
}
}
$upid = 0;
//实名
realname_get();
$_TPL['css'] = 'doing';
include_once template("space_doing");
?>
- space_doing.php(记录)代码注释
- php代码注释说明
- php代码注释
- PHP代码注释规范
- PHP代码注释规范
- PHP代码规范注释
- php代码注释
- webview学习记录(有比较详细的代码注释)
- PHP Document 代码注释规范
- PHP Document 代码注释规范
- PHP Document 代码注释规范
- PHP Document 代码注释规范
- PHP Document 代码注释规范
- PHP Document 代码注释规范
- PHP标记和代码注释
- PHP Document 代码注释规范
- php记录代码执行时间
- php记录代码执行时间
- Android Java Binder 通信机制
- 基于Axis 1.4 部署WebService 笔记(五)
- 张宇《趁早》歌词
- DeltaOffice 在线编辑控件说明文档
- QTimer源码分析(以Windows下实现为例)
- space_doing.php(记录)代码注释
- java基础整理5--面向对象的高级特性
- VC2008以资源形式实现多语言版本
- [gdc07]Rendering Architecture and Real-time Procedural Shading & Texturing Techniques
- Visual Studio 2008 (vs 2008)简体中文专业版、团队版及SP1下载地址
- GNU内嵌汇编 ARM版 (ZZ)
- 快速去掉项目里面的SVN 或者CVS 文件
- Acm BFS
- C++程序设计的各种编译器及IDE