📄 pcfuncs.php
字号:
fputs($fp,$id."\n",strlen($id)+2); pc_friend_file_close($fp); return TRUE; }}function pc_del_friend($id,$uid){ $friendlist = pc_friend_list($uid); if($file = pc_friend_file_open($uid,"w")) { $fp = $file["FP"]; for($i = 0;$i < count($friendlist); $i ++ ) { if(strtolower($id)!=strtolower($friendlist[$i])) fputs($fp,$friendlist[$i]."\n",strlen($friendlist[$i])+2); } pc_friend_file_close($fp); }}function pc_db_connect(){ GLOBAL $db; @$link = mysql_connect($db["HOST"],$db["USER"],$db["PASS"]) or die("无法连接到服务器!"); @mysql_select_db($db["NAME"],$link); return $link;}function pc_db_close($link){ @mysql_close($link);}function pc_load_infor($link,$userid=FALSE,$uid=0){ global $currentuser; if (!$userid && !$uid) return FALSE; if($userid) $query = "SELECT *,UNIX_TIMESTAMP(`createtime`) 'ts_createtime' FROM users WHERE `username`= '".addslashes($userid)."' LIMIT 0,1;"; else $query = "SELECT *,UNIX_TIMESTAMP(`createtime`) 'ts_createtime' FROM users WHERE `uid` = '".intval($uid)."' LIMIT 0,1;"; $result = mysql_query($query,$link); $rows = mysql_fetch_array($result); mysql_free_result($result); if(!$rows) return FALSE; else { $pcThem = pc_get_theme($rows["theme"]); $pc = array( "NAME" => html_format($rows["corpusname"]), "USER" => $rows["username"], "UID" => $rows["uid"], "DESC" => html_format($rows["description"]), "THEM" => $pcThem, "TIME" => $rows["createtime"], "TS_TIME" => $rows["ts_createtime"], "VISIT" => $rows["visitcount"], "CREATED" => $rows["createtime"], "MODIFY" => $rows["modifytime"], "NODES" => $rows["nodescount"], "NLIM" => $rows["nodelimit"], "DLIM" => $rows["dirlimit"], "STYLE" => pc_style_array($rows["style"]), "LOGO" => str_replace("<","<",stripslashes($rows["logoimage"])), "BKIMG" => str_replace("<","<",stripslashes($rows["backimage"])), "LINKS" => pc_get_links(stripslashes($rows["links"])), "EDITOR" => $rows["htmleditor"], "INDEX" => array("nodeNum"=> $rows["indexnodes"],"nodeChars" => $rows["indexnodechars"]), "EMAIL" => htmlspecialchars(stripslashes($rows["useremail"])), "FAVMODE" => (int)($rows["favmode"]), "UPDATE" => (int)($rows["updatetime"]), "INFOR" => str_replace("<?","<?",stripslashes($rows["userinfor"])), "TYPE" => $rows["pctype"], "DEFAULTTOPIC" => $rows["defaulttopic"], "FILELIMIT" => intval($rows["userfile"]), "FILENUMLIMIT" => intval($rows["filelimit"]), "ANONYCOMMENT" => defined("_BLOG_ANONY_COMMENT_")?$rows["anonycomment"]:false ); if($pc["TYPE"] == 9) if (!pc_is_manager($currentuser)) return false; return $pc; }}function pc_get_theme($theme,$stripSlashes=TRUE){ global $pcconfig; if($stripSlashes) $theme = stripslashes($theme) ; $theme = explode("/",$theme); if(!$pcconfig["SECTION"][$theme[0]]) $theme[0] = "others"; return $theme;}function pc_init_fav($link,$uid){ $query = "INSERT INTO `nodes` ( `nid` , `pid` , `tid` , `type` , `source` , `hostname` , `changed` , `created` , `uid` , `comment` , `commentcount` , `subject` , `body` , `access` , `visitcount` ) ". " VALUES ('', '0', '0', '1', '', '".$_SERVER["REMOTE_ADDR"]."', '".date("YmdHis")."' , '".date("YmdHis")."', '".$uid."', '0', '0', '', NULL , '3', '0');"; $r = mysql_query($query,$link); return $r;}function pc_update_record($link,$uid,$addstr="+0"){ $query = "UPDATE users SET `createtime` = `createtime` , `modifytime` = '".date("YmdHis")."' , `nodescount` = `nodescount` ".$addstr." WHERE `uid` = '".$uid."' "; mysql_query($query,$link);}function pc_visit_counter($link,$uid){ $query = "UPDATE users SET `createtime` = `createtime` , `visitcount` = `visitcount` + 1 WHERE `uid` = '".$uid."' ;"; mysql_query($query,$link);}function pc_used_space($link,$uid,$access,$pid=0){ if($access == 3) $query = "SELECT COUNT(*) FROM nodes WHERE `uid` = '".$uid."' AND `access` = '3' AND `pid` = '".$pid."' AND `type` = 0 ;"; else $query = "SELECT COUNT(*) FROM nodes WHERE `uid` = '".$uid."' AND `access` = '".$access."' AND `type` = 0 ;"; $result = mysql_query($query); $rows = mysql_fetch_row($result); mysql_free_result($result); return $rows[0];}function pc_dir_num($link,$uid,$pid=0){ $query = "SELECT COUNT(*) FROM nodes WHERE `uid` = '".$uid."' AND `access` = '3' AND `pid` = '".$pid."' AND `type` = 1 ;"; $result = mysql_query($query); $rows = mysql_fetch_row($result); mysql_free_result($result); return $rows[0];}function pc_file_num($link,$uid,$pid=0){ $query = "SELECT COUNT(*) FROM nodes WHERE `uid` = '".$uid."' AND `access` = '3' AND `pid` = '".$pid."' AND `type` = 0 ;"; $result = mysql_query($query); $rows = mysql_fetch_row($result); mysql_free_result($result); return $rows[0];}function pc_blog_menu($link,$pc,$tag=9){ if(!$pc || !is_array($pc) || !$pc["UID"]) return NULL; if($tag == 9) $query = "SELECT * FROM topics WHERE `uid` = '".intval($pc["UID"])." ' ORDER BY `sequen` ;"; else $query = "SELECT * FROM topics WHERE `uid` = '".intval($pc["UID"])." ' AND ( `access` = '".intval($tag)."' OR `access` = 9 ) ORDER BY `sequen` DESC ;"; $result = mysql_query($query,$link); $blog = array(); while($rows = mysql_fetch_array($result)) { $blog[] = array( "TID" => $rows["tid"], "NAME" => $rows["topicname"], "SEQ" => $rows["sequen"], "TAG" => $rows["access"] ); } mysql_free_result($result); if($tag==0 && $pc["DEFAULTTOPIC"]) //自定义公开区默认分类 { $blog[] = array( "TID" => 0, "NAME" => $pc["DEFAULTTOPIC"], "SEQ" => 0, "TAG" => 9 ); } elseif($tag != 0 && $tag != 9) { $blog[] = array( "TID" => 0, "NAME" => "其他类别", "SEQ" => 0, "TAG" => 9 ); } else { // nth :p } return $blog;}function pc_style_array($i){ switch($i) { case 1: $style = array( "SID" => 1, "INDEXFUNC" => "display_blog_smth", "TOPIMG" => "style/default/p1.jpg", "CSSFILE" => "default.css" ); break; case 2: $style = array( "SID" => 2, "INDEXFUNC" => "display_blog_earthsong", "TOPIMG" => "style/default/p1.jpg", "CSSFILE" => "style/earthsong/earthsong.css" ); break; case 9: $style = array( "SID" => 9, ); break; default: $style = array( "SID" => 0, "INDEXFUNC" => "display_blog_default", "TOPIMG" => "style/default/p1.jpg", "CSSFILE" => "default.css" ); } return $style;}function get_next_month($yy,$mm){ $mm ++; if($mm > 12) { $mm = 1; $yy ++ ; } return array($yy,$mm);}function get_pre_month($yy,$mm){ $mm --; if($mm < 1) { $mm = 12; $yy --; } return array($yy,$mm);}function display_blog_catalog(){ global $pcconfig; $secNum = count($pcconfig["SECTION"]); $secKeys = array_keys($pcconfig["SECTION"]);?><center><table cellspacing=0 cellpadding=3 border=0 width=90% class=t1><tr> <td class=t8><strong>Blog分类>></strong></td></tr><tr> <td class=t4> <table cellspacing=0 cellpadding=3 border=0 width=98% class=f1><?php for($i = 0 ; $i < $secNum ; $i ++ ) { if( $i % 6 == 0 ) echo "<tr>"; echo "<td class=f1 align=center><a href=\"pcsec.php?sec=".htmlspecialchars($secKeys[$i])."\">".htmlspecialchars($pcconfig["SECTION"][$secKeys[$i]])."</a></td>"; if( $i % 6 == 5 ) echo "</tr>"; }?> </table> </td></tr></table></center><br /><?php }function pc_get_user_permission($currentuser,$pc){ global $loginok; if($pc['USER']=='_filter' && pc_is_manager($currentuser)) { $sec = array(0=>"待处理",1=>"已通过",2=>"未通过", 4=>"被删除"); $pur = 1; $tags = array(1,1,1,0,1,0,0,0); } elseif (pc_is_groupwork($pc)) //群体blog目录 { if (pc_is_admin($currentuser,$pc) && $loginok == 1) { $sec = array(0=>"俱乐部",1=>"会议室",4=>"备份中心",6=>"栏目管理",7=>"参数设定"); $pur = 3; $tags = array(1,1,0,0,1,0,1,1); } else { $sec = array(0=>"俱乐部"); $pur = 0; $tags = array(1,0,0,0,0,0,0,0); } } elseif (pc_is_admin($currentuser,$pc) && $loginok == 1) { $sec = array("公开区","好友区","私人区","收藏区","删除区","设定好友","分类管理","参数设定"); $pur = 3; $tags = array(1,1,1,1,1,1,1,1); } elseif (pc_is_friend($currentuser["userid"],$pc["USER"]) || pc_is_manager($currentuser)) { $sec = array("公开区","好友区"); $pur = 1; $tags = array(1,1,0,0,0,0,0,0); if($pc["FAVMODE"] == 1 || $pc["FAVMODE"] == 2)//收藏夹模式 { $sec[3] = "收藏区"; $tags[3] = 1; } } else { $sec = array("公开区"); $pur = 0; $tags = array(1,0,0,0,0,0,0,0); if($pc["FAVMODE"] == 2)//收藏夹模式 { $sec[3] = "收藏区"; $tags[3] = 1; } } return array( "tags" => $tags , "pur" => $pur , "sec" => $sec );}function pc_select_blogtheme($theme,$themeValue="pcthem"){ global $pcconfig;?><select name="<?php echo $themeValue; ?>" class="f1"><?php reset($pcconfig["SECTION"]); while( list($sec , $secName) = each($pcconfig["SECTION"]) ) { if($theme[0] == $sec) echo "<option value=\"".htmlspecialchars($sec)."\" selected>".htmlspecialchars($secName)."</option>"; else echo "<option value=\"".htmlspecialchars($sec)."\">".htmlspecialchars($secName)."</option>"; } ?></select><?php}function pc_cache( $modifytime ){ $lastmodifytime = time_format( $modifytime ); $lastmodifytime = strtotime( $lastmodifytime ); if (cache_header("public",$lastmodifytime,300)) return TRUE; else return FALSE;}function pc_main_navigation_bar(){ global $pcconfig;?><p align="center">[<a href="index.html">首页</a>]<?php if ($pcconfig["BLOGONBLOG"]) {?>[<a href="/pc/index.php?id=<?php echo urlencode ($pcconfig["BLOGONBLOG"]); ?>">BLOG心得集</a>] <?php }?>[<a href="pc.php">用户</a>][<a href="pclist.php">热门排行</a>][<a href="pcsec.php">分类</a>][<a href="pcreco.php">推荐文章</a>][<a href="pcnew.php">最新日志</a>][<a href="pcnew.php?t=c">最新评论</a>][<a href="pcsearch2.php">BLOG搜索</a>][<a href="pcnsearch.php">日志搜索</a>][<a href="/bbsdoc.php?board=<?php echo $pcconfig["BOARD"]; ?>">论坛</a>][<a href="pcapp0.html"><font color=red>申请</font></a>][<?php bbs_add_super_fav ('BLOG'); ?>]<?php if( $pcconfig["ADMIN"] ){?>[<a href="index.php?id=<?php echo $pcconfig["ADMIN"]; ?>">帮助主题</a>]<?php }?></p><p align="center">[<b><img src="images/xml.gif" border="0" align="absmiddle" alt="XML">RSS频道</b> <a href="rssnew.php">最新日志</a><a href="rssrec.php">推荐文章</a><a href="opml.php?t=2">新用户(OPML)</a><a href="opml.php">最近更新(OPML)</a><a href="opml.php?t=1">访问最多(OPML)</a>]</p><?php }function pc_update_cache_header($updatetime = 10){ global $cachemode; $scope = "public"; $modifytime=time(); $expiretime=300; session_cache_limiter($scope); $cachemode=$scope; @$oldmodified=$_SERVER["HTTP_IF_MODIFIED_SINCE"];
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -