pcdoc.php
来自「清华BBS源代码」· PHP 代码 · 共 866 行 · 第 1/2 页
PHP
866 行
<?php /* ** this file display article list in personal corp. ** @id:windinsn Nov 19,2003 */ require("pcfuncs.php"); function display_blog_menu($pc,$tid,$tag,$blogMenus) { $blogs = $blogMenus;?><table cellspacing="0" cellpadding="5" border="0" width="95%"><tr> <td align="right" class="f2">Blog分类</td></tr><tr> <td align="right"><hr align="right" width="90%" class="hr"></td></tr><?php for($i=0;$i < count($blogs) ;$i++) { if($blogs[$i]["TID"] == $tid) echo "<tr>\n<td align=\"right\" class='t6'>\n".html_format($blogs[$i]["NAME"])."\n</td>\n</tr>\n"; else echo "<tr>\n<td align=\"right\" class='t7'>\n<a href=\"pcdoc.php?userid=".$pc["USER"]."&tag=".$tag."&tid=".$blogs[$i]["TID"]."\" class='t7'>".html_format($blogs[$i]["NAME"])."</a>\n</td>\n</tr>\n"; }?></table><?php } function display_action_bar($tag,$tid=0,$pid=0) { global $pc,$sec,$blogMenus;?><table cellspacing="0" cellpadding="5" border="0" width="95%" class="b2"><tr><td><a href="pcmanage.php?userid=<?php echo $pc["USER"]; ?>&act=post&<?php echo "tag=".$tag."&pid=".$pid."&tid=".$tid; ?>"><img src="images/post.gif" border="0" alt="发表文章"></a></td><td align="right"><input type="hidden" name="access" value="<?php echo $tag; ?>"><input onclick="checkall(this.form)" type="checkbox" value="on" name="chkall" align="absmiddle" class="b2">选中本目录下所有文章 将选中文章<select name="act" class="b2">
<option value="cut" selected>移动</option>
<option value="copy">复制</option></select>到<select name="target" class="b2">
<?php for( $i = 0 ; $i < 5 ; $i ++) { if($i!=$tag) echo "<option value=\"".$i."\">".$sec[$i]."</option>\n"; } for( $i = 0 ; $i < count($blogMenus) ; $i ++ ) { if($blogMenus[$i]["TID"]!=$tid) echo "<option value=\"T".$blogMenus[$i]["TID"]."\">[".$sec[$tag]."]".html_format($blogMenus[$i]["NAME"])."</option>\n"; }?></select><input type="submit" value="GO" class="b1"></td><td align="right"><a href="#" onclick="bbsconfirm('pcmanage.php?userid=<?php echo $pc["USER"]; ?>&act=clear','清空删除区的文章吗(无法恢复)?')">清空删除区</a></td></tr></table><?php } function display_art_list($link,$pc,$tag,$pur,$tid=0,$order="") { $query = "SELECT `nid` , `pid` , `created` , `emote` , `changed` , `comment` , `commentcount` , `subject` , `visitcount` , `htmltag` ,`trackbackcount` , `trackback` ". " FROM nodes WHERE `access` = '".$tag."' AND `uid` = '".$pc["UID"]."' AND `tid` = '".$tid."' "; switch($order) { case "c": $query.=" ORDER BY `created` DESC , "; break; case "u": $query.=" ORDER BY `changed` DESC , "; break; case "v": $query.=" ORDER BY `visitcount` DESC , "; break; case "r": $query.=" ORDER BY `commentcount` DESC , "; break; case "co": $query.=" ORDER BY `comment` ASC , "; break; case "tb": $query.=" ORDER BY `trackbackcount` DESC , "; break; default: $query.=" ORDER BY "; } $query .= " `created` DESC ;"; $result = mysql_query($query,$link); $i = 0;?><form action="pcmanage.php?userid=<?php echo $pc["USER"]; ?>" method="post"> <table cellspacing="0" cellpadding="3" border="0" width="99%" class="t1"><?php if($pur > 2) {?><tr> <td class="t2" width="30">序号</td> <td class="t2" width="30">选中</td> <td class="t2" width="30"><a href="pcdoc.php?<?php echo "userid=".$pc["USER"]."&tag=".$tag."&order=co&tid=".$tid; ?>" class="f3">状态</a></td> <td class="t2">主题</td> <td class="t2" width="120"> <a href="pcdoc.php?<?php echo "userid=".$pc["USER"]."&tag=".$tag."&order=c&tid=".$tid; ?>" class="f3">创建</a> | <a href="pcdoc.php?<?php echo "userid=".$pc["USER"]."&tag=".$tag."&order=u&tid=".$tid; ?>" class="f3">更新</a></td> <td class="t2" width="30"><a href="pcdoc.php?<?php echo "userid=".$pc["USER"]."&tag=".$tag."&order=v&tid=".$tid; ?>" class="f3">浏览</a></td> <td class="t2" width="30"><a href="pcdoc.php?<?php echo "userid=".$pc["USER"]."&tag=".$tag."&order=r&tid=".$tid; ?>" class="f3">评论</a></td><?php if($tag == 0) {?> <td class="t2" width="30"><a href="pcdoc.php?<?php echo "userid=".$pc["USER"]."&tag=".$tag."&order=tb&tid=".$tid; ?>" class="f3">引用</td><?php }?> <td class="t2" width="15">改</td> <td class="t2" width="15">删</td></tr><?php } else {?><tr> <td class="t2" width="30">序号</td> <td class="t2" width="30"><a href="pcdoc.php?<?php echo "userid=".$pc["USER"]."&tag=".$tag."&order=co&tid=".$tid; ?>" class="f3">状态</a></td> <td class="t2">主题</td> <td class="t2" width="120"><a href="pcdoc.php?<?php echo "userid=".$pc["USER"]."&tag=".$tag."&order=c&tid=".$tid; ?>" class="f3">创建</a> | <a href="pcdoc.php?<?php echo "userid=".$pc["USER"]."&tag=".$tag."&order=u&tid=".$tid; ?>" class="f3">更新</a></td> <td class="t2" width="30"><a href="pcdoc.php?<?php echo "userid=".$pc["USER"]."&tag=".$tag."&order=v&tid=".$tid; ?>" class="f3">浏览</a></td> <td class="t2" width="30"><a href="pcdoc.php?<?php echo "userid=".$pc["USER"]."&tag=".$tag."&order=r&tid=".$tid; ?>" class="f3">评论</a></td><?php if($tag == 0) {?> <td class="t2" width="30"><a href="pcdoc.php?<?php echo "userid=".$pc["USER"]."&tag=".$tag."&order=tb&tid=".$tid; ?>" class="f3">引用</td><?php }?></tr><?php } while($rows = mysql_fetch_array($result)) { $i ++; if($rows[comment] == 0) $c = "<img src='images/lock.gif' alt='被锁定的主题' border='0'>"; else $c = "<img src='images/open.gif' alt='开放的主题' border='0'>"; if($pur > 2) { echo "<tr>\n<td class='t3'>".$i."</td>\n". "<td align=\"center\" class='t4'><input type=\"checkbox\" name=\"art".$i."\" value=\"".$rows[nid]."\" class=\"b2\"></td>\n". "<td class='t3'>".$c."</td>\n". "<td class='t5'>"; echo ($rows[htmltag]==1)?" ":"#"; echo "<img src=\"icon/".$rows[emote].".gif\" border=\"0\" align=\"absmiddle\">\n<a href=\"pccon.php?id=".$pc["UID"]."&nid=".$rows[nid]."&order=".$order."&tid=".$tid."\">".html_format($rows[subject])."</a></td>\n". "<td class='t3'>\n".time_format($rows[created])."<br/>".time_format($rows[changed])."\n</td>\n". "<td class='t4'>".$rows[visitcount]."</td>\n". "<td class='t3'>".$rows[commentcount]."</td>\n"; if($tag == 0) { echo "<td class='t4'>"; echo $rows[trackback]?$rows[trackbackcount]:"-"; echo "</td>\n"; } echo "<td class='t3'><a href=\"pcmanage.php?userid=".$pc["USER"]."&act=edit&nid=".$rows[nid]."\">改</a></td>\n". "<td class='t4'><a href=\"#\" onclick=\"bbsconfirm('pcmanage.php?userid=".$pc["USER"]."&act=del&nid=".$rows[nid]."','确认删除?')\">删</a></td>\n". "</tr>\n"; } else { echo "<tr>\n<td class='t3'>".$i."</td>\n". "<td class='t4'>".$c."</td>\n". "<td class='t8'> <img src=\"icon/".$rows[emote].".gif\" border=\"0\ align=\"absmiddle\">\n<a href=\"pccon.php?id=".$pc["UID"]."&nid=".$rows[nid]."&order=".$order."&tid=".$tid."\">".html_format($rows[subject])."</a></td>\n". "<td class='t4'>\n".time_format($rows[created])."<br/>".time_format($rows[changed])."\n</td>\n". "<td class='t3'>".$rows[visitcount]."</td>\n". "<td class='t4'>".$rows[commentcount]."</td>\n"; if($tag == 0) { echo "<td class='t3'>"; echo $rows[trackback]?$rows[trackbackcount]:"-"; echo "</td>\n"; } echo "</tr>\n"; } }?></table><?php if($pur > 2) display_action_bar($tag,$tid);?></form><?php mysql_free_result($result); } function display_fav_folder($link,$pc,$pid=0,$pur,$order="") { $rootpid = pc_fav_rootpid($link,$pc["UID"]); if(!$rootpid) { $pif = pc_init_fav($link,$pc["UID"]); if($pif) {?><script language="javascript">window.location.href="pcdoc.php?userid=<?php echo $pc["USER"]; ?>&tag=3";</script><?php } else { html_error_quit("对不起,Blog收藏夹初始化错误!"); exit(); } } if($pid == 0) $pid = $rootpid; else { $query = "UPDATE nodes SET `visitcount` = visitcount + 1 WHERE `access` = '3' AND `nid` = '".$pid."' AND `uid` = '".$pc["UID"]."';"; mysql_query($query,$link); } $query = "SELECT `nid` , `type` , `created` , `changed` , `emote` , `comment` , `commentcount` , `subject` , `visitcount`,`pid`,`htmltag` ". " FROM nodes WHERE `access` = '3' AND `uid` = '".$pc["UID"]."' AND `pid` = '".$pid."' "; switch($order) { case "c": $query.=" ORDER BY `created` DESC , "; break; case "u": $query.=" ORDER BY `changed` DESC ,"; break; case "v": $query.=" ORDER BY `visitcount` DESC ,"; break; case "r": $query.=" ORDER BY `commentcount` DESC ,"; break; case "co": $query.=" ORDER BY `comment` ASC ,"; break; default: $query.=" ORDER BY "; } $query .= " `type` DESC ;"; $result = mysql_query($query,$link); $i = 0;?><form action="pcmanage.php?userid=<?php echo $pc["USER"]; ?>" method="post"> <table cellspacing="0" cellpadding="5" border="0" width="99%" class="t1"><?php if($pur > 2) {?><tr> <td class="t2" width="30">序号</td> <td class="t2" width="30">选中</td> <td class="t2" width="30">类型</td> <td class="t2" width="30"><a href="pcdoc.php?<?php echo "userid=".$pc["USER"]."&tag=3&pid=".$pid."&order=co"; ?>" class="f3">状态</a></td> <td class="t2">主题</td> <td class="t2" width="120"> <a href="pcdoc.php?<?php echo "userid=".$pc["USER"]."&tag=3&pid=".$pid."&order=c"; ?>" class="f3">创建</a> | <a href="pcdoc.php?<?php echo "userid=".$pc["USER"]."&tag=3&pid=".$pid."&order=u"; ?>" class="f3">更新</a> </td> <td class="t2" width="30"><a href="pcdoc.php?<?php echo "userid=".$pc["USER"]."&tag=3&pid=".$pid."&order=v"; ?>" class="f3">浏览</a></td> <td class="t2" width="30"><a href="pcdoc.php?<?php echo "userid=".$pc["USER"]."&tag=3&pid=".$pid."&order=r"; ?>" class="f3">评论</a></td> <td class="t2" width="15">改</td> <td class="t2" width="15">删</td> <td class="t2" colspan="<?php echo $_COOKIE["BLOGFAVACTION"]?3:2; ?>">操作</a></tr><?php } else {?><tr> <td class="t2" width="30">序号</td> <td class="t2" width="30">类型</td> <td class="t2" width="30"><a href="pcdoc.php?<?php echo "userid=".$pc["USER"]."&tag=3&pid=".$pid."&order=co"; ?>" class="f3">状态</a></td> <td class="t2">主题</td> <td class="t2" width="120"> <a href="pcdoc.php?<?php echo "userid=".$pc["USER"]."&tag=3&pid=".$pid."&order=c"; ?>" class="f3">创建</a> | <a href="pcdoc.php?<?php echo "userid=".$pc["USER"]."&tag=3&pid=".$pid."&order=u"; ?>" class="f3">更新</a></td> <td class="t2" width="30"><a href="pcdoc.php?<?php echo "userid=".$pc["USER"]."&tag=3&pid=".$pid."&order=v"; ?>" class="f3">浏览</a></td> <td class="t2" width="30"><a href="pcdoc.php?<?php echo "userid=".$pc["USER"]."&tag=3&pid=".$pid."&order=r"; ?>" class="f3">评论</a></td></tr><?php } while($rows = mysql_fetch_array($result)) { $i ++; if($rows[comment] == 1 && $rows[type] == 0) $c = "<img src='images/open.gif' alt='开放的主题' border='0'>"; else $c = "<img src='images/lock.gif' alt='被锁定的主题' border='0'>"; if($rows[type]==1) { $type = "<img src='images/dir.gif' alt='目录' border='0'>"; $url = "pcdoc.php?userid=".$pc["USER"]."&tag=3&pid=".$rows[nid]; } else { $type = "<img src='images/art.gif' alt='文章' border='0'>"; $url = "pccon.php?id=".$pc["UID"]."&nid=".$rows[nid]."&order=".$order; } if( $pur > 2) { echo "<tr>\n<td class='t3'>".$i."</td>\n<td align=\"center\" class='t4'>"; if($rows[type]==0) echo "<input type=\"checkbox\" name=\"art".$i."\" value=\"".$rows[nid]."\" class=\"b2\">"; else echo " "; echo "</td>\n<td class='t3'>".$type."</td>\n". "<td class='t4'>".$c."</td>\n". "<td class='t8'>"; echo ($rows[htmltag]==1)?" ":"#"; echo "<img src=\"icon/".$rows[emote].".gif\" border=\"0\" align=\"absmiddle\">\n<a href=\"".$url."\">".html_format($rows[subject])."</a></td>\n". "<td class='t4'>".time_format($rows[created])."<br/>".time_format($rows[changed])."</td>\n". "<td class='t3'>".$rows[visitcount]."</td>\n". "<td class='t4'>".$rows[commentcount]."</td>\n". "<td class='t3'><a href=\"pcmanage.php?userid=".$pc["USER"]."&act=edit&nid=".$rows[nid]."\">改</a></td>\n". "<td class='t4'><a href=\"#\" onclick=\"bbsconfirm('pcmanage.php?userid=".$pc["USER"]."&act=del&nid=".$rows[nid]."','确认删除?')\">删</a></td>\n"; if($rows[type]==0) echo "<td class='t3' width=20><a href=\"pcmanage.php?userid=".$pc["USER"]."&act=favcut&nid=".$rows[nid]."\">剪</a></td>". "<td class='t3' width=20><a href=\"pcmanage.php?userid=".$pc["USER"]."&act=favcopy&nid=".$rows[nid]."\">复</a></td>"; else echo "<td class='t3' width=20>-</td>\n<td class='t3'>-</td>\n"; if($_COOKIE["BLOGFAVACTION"]) { if($rows[type]==1) echo "<td class='t3' width=20><a href=\"pcmanage.php?userid=".$pc["USER"]."&act=favpaste&pid=".$rows[nid]."\">贴</a></td>"; else echo "<td class='t3' width=20>-</td>"; } echo "</tr>\n"; } else echo "<tr>\n<td class='t3'>".$i."</td>\n". "<td class='t4'>".$type."</td>\n". "<td class='t3'>".$c."</td>\n". "<td class='t5'> <img src=\"icon/".$rows[emote].".gif\" border=\"0\" align=\"absmiddle\">\n<a href=\"".$url."\">".html_format($rows[subject])."</a></td>\n". "<td class='t3'>".time_format($rows[created])."<br/>".time_format($rows[changed])."</td>\n". "<td class='t4'>".$rows[visitcount]."</td>\n". "<td class='t3'>".$rows[commentcount]."</td>\n". "</tr>\n"; } mysql_free_result($result);?></table><?php if($pid != $rootpid) { $query = "SELECT `pid` FROM nodes WHERE `nid` = '".$pid."' LIMIT 0 , 1 ;"; $result = mysql_query($query); $rows = mysql_fetch_array($result); mysql_free_result($result); $prepid = ($rows[pid]>$rootpid)?$rows[pid]:$rootpid;?><p align="center" class="b2">[<a href="pcdoc.php?<?php echo "userid=".$pc["USER"]."&tag=3&pid=".$rows[pid]; ?>">返回上层目录</a>][<a href="pcdoc.php?<?php echo "userid=".$pc["USER"]."&tag=3"; ?>">返回根目录</a>]</p><?php } if( $pur > 2 ) { display_action_bar(3,0,$pid); ?></form><?php if($_COOKIE["BLOGFAVACTION"]) echo "<p align='center' class='b2'>[<a href=\"pcmanage.php?userid=".$pc["USER"]."&act=favpaste&pid=".$rootpid."\">粘贴到根目录</a>]</p>\n";?><form action="pcmanage.php?userid=<?php echo $pc["USER"]; ?>&act=adddir" method="post" onsubmit="if(this.dir.value==''){alert('请输入目录名!');return false;}"><input type="hidden" name="pid" value="<?php echo $pid; ?>"><p class="b2" align="center">新建目录:<input type="text" name="dir" maxlength="200" size="40" id="dir" class="b2"><input type="submit" value="新建目录" class="b1"></p></form><?php } } function add_friend($pc) { $id = $_GET["id"]; $lookupuser=array (); if($friendid = pc_is_friend($id,$pc["USER"])) return $friendid."已在好友列表中!"; elseif( $id=="" || bbs_getuser($id, $lookupuser) == 0 ) return "用户 ".$id." 不存在!"; else { $id = $lookupuser["userid"]; pc_add_friend($id,$pc["USER"]); }
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?