function misc_statistic() { global $zbp; $zbp->BuildTemplate(); $r = null; CountNormalArticleNums(); CountTopArticle(null, null); CountCommentNums(null, null); $all_comments = $zbp->cache->all_comment_nums; $xmlrpc_address = $zbp->xmlrpcurl; $current_member = $zbp->user->Name; $current_version = ZC_VERSION_FULL; $all_artiles = GetValueInArrayByCurrent($zbp->db->Query('SELECT COUNT(*) AS num FROM ' . $GLOBALS['table']['Post'] . ' WHERE log_Type=\'0\''), 'num'); $all_pages = GetValueInArrayByCurrent($zbp->db->Query('SELECT COUNT(*) AS num FROM ' . $GLOBALS['table']['Post'] . ' WHERE log_Type=\'1\''), 'num'); $all_categorys = GetValueInArrayByCurrent($zbp->db->Query('SELECT COUNT(*) AS num FROM ' . $GLOBALS['table']['Category']), 'num'); $all_views = $zbp->option['ZC_VIEWNUMS_TURNOFF'] == true ? 0 : GetValueInArrayByCurrent($zbp->db->Query('SELECT SUM(log_ViewNums) AS num FROM ' . $GLOBALS['table']['Post']), 'num'); $all_tags = GetValueInArrayByCurrent($zbp->db->Query('SELECT COUNT(*) as num FROM ' . $GLOBALS['table']['Tag']), 'num'); $all_members = GetValueInArrayByCurrent($zbp->db->Query('SELECT COUNT(*) AS num FROM ' . $GLOBALS['table']['Member']), 'num'); $current_theme = '{$zbp->theme}'; $current_style = '{$zbp->style}'; $current_member = '{$zbp->user->Name}'; $current_version = '{$zbp->version}'; $system_environment = '{$system_environment}'; if ($zbp->option['ZC_DEBUG_MODE']) { $r .= "<tr><td colspan='4' style='text-align: center'>{$zbp->lang['msg']['debugging_warning']}</td></tr>"; } $r .= "<tr><td class='td20'>{$zbp->lang['msg']['current_member']}</td><td class='td30'><a href='../cmd.php?act=misc&type=vrs' target='_blank'>{$current_member}</a></td><td class='td20'>{$zbp->lang['msg']['current_version']}</td><td class='td30'>{$current_version}</td></tr>"; $r .= "<tr><td class='td20'>{$zbp->lang['msg']['all_artiles']}</td><td>{$all_artiles}</td><td>{$zbp->lang['msg']['all_categorys']}</td><td>{$all_categorys}</td></tr>"; $r .= "<tr><td class='td20'>{$zbp->lang['msg']['all_pages']}</td><td>{$all_pages}</td><td>{$zbp->lang['msg']['all_tags']}</td><td>{$all_tags}</td></tr>"; $r .= "<tr><td class='td20'>{$zbp->lang['msg']['all_comments']}</td><td>{$all_comments}</td><td>{$zbp->lang['msg']['all_views']}</td><td>{$all_views}</td></tr>"; $r .= "<tr><td class='td20'>{$zbp->lang['msg']['current_theme']} / {$zbp->lang['msg']['current_style']}</td><td>{$current_theme}/{$current_style}</td><td>{$zbp->lang['msg']['all_members']}</td><td>{$all_members}</td></tr>"; $r .= "<tr><td class='td20'>{$zbp->lang['msg']['xmlrpc_address']}</td><td>{$xmlrpc_address}</td><td>{$zbp->lang['msg']['system_environment']}</td><td><a href='../cmd.php?act=misc&type=phpinfo' target='_blank'>{$system_environment}</a></td></tr>"; $r .= "<script type=\"text/javascript\">\$('#statistic').attr('title','" . date("c", $zbp->cache->reload_statistic_time) . "');</script>"; $zbp->cache->reload_statistic = $r; $zbp->cache->reload_statistic_time = time(); $zbp->cache->system_environment = GetEnvironment(); $zbp->cache->all_article_nums = $all_artiles; $zbp->cache->all_page_nums = $all_pages; $zbp->AddBuildModule('statistics', array($all_artiles, $all_pages, $all_categorys, $all_tags, $all_views, $all_comments)); $zbp->BuildModule(); $zbp->SaveCache(); $r = str_replace('{#ZC_BLOG_HOST#}', $zbp->host, $r); $r = str_replace('{$zbp->user->Name}', $zbp->user->Name, $r); $r = str_replace('{$zbp->theme}', $zbp->theme, $r); $r = str_replace('{$zbp->style}', $zbp->style, $r); $r = str_replace('{$zbp->version}', ZC_VERSION_FULL, $r); $r = str_replace('{$system_environment}', $zbp->cache->system_environment, $r); echo $r; }
/** * 删除文章 * @return bool */ function DelArticle() { global $zbp; $id = (int) GetVars('id', 'GET'); $article = new Post(); $article->LoadInfoByID($id); if ($article->ID > 0) { if (!$zbp->CheckRights('ArticleAll') && $article->AuthorID != $zbp->user->ID) { $zbp->ShowError(6, __FILE__, __LINE__); } $pre_author = $article->AuthorID; $pre_tag = $article->Tag; $pre_category = $article->CateID; $pre_istop = $article->IsTop; $pre_status = $article->Status; $article->Del(); DelArticle_Comments($article->ID); CountTagArrayString($pre_tag, -1, $article->ID); CountMemberArray(array($pre_author), array(-1, 0, 0, 0)); CountCategoryArray(array($pre_category), -1); if ($pre_istop == 0 && $pre_status == 0) { CountNormalArticleNums(-1); } if ($article->IsTop == true) { CountTopArticle(null, $article->ID); } $zbp->AddBuildModule('previous'); $zbp->AddBuildModule('calendar'); $zbp->AddBuildModule('comments'); $zbp->AddBuildModule('archives'); $zbp->AddBuildModule('tags'); $zbp->AddBuildModule('authors'); foreach ($GLOBALS['Filter_Plugin_DelArticle_Succeed'] as $fpname => &$fpsignal) { $fpname($article); } return true; } }
function LargeData_Misc_Statistic() { global $zbp; $r = null; CountNormalArticleNums(); CountTopArticle(null, null); CountCommentNums(null, null); $all_comments = $zbp->cache->all_comment_nums; $xmlrpc_address = $zbp->host . 'zb_system/xml-rpc/'; $current_member = $zbp->user->Name; $current_version = ZC_VERSION_FULL; $all_artiles = GetValueInArrayByCurrent($zbp->db->Query($zbp->db->sql->Select($zbp->table['Post'], 'Count(log_ID) AS num', array(array('=', 'log_Type', '0')), null, 1, null)), 'num'); $all_pages = GetValueInArrayByCurrent($zbp->db->Query($zbp->db->sql->Select($zbp->table['Post'], 'Count(log_ID) AS num', array(array('=', 'log_Type', '1')), null, 1, null)), 'num'); $all_categorys = GetValueInArrayByCurrent($zbp->db->Query($zbp->db->sql->Select($zbp->table['Category'], 'Count(*) AS num', null, null, 1, null)), 'num'); $all_views = '不计算'; $all_tags = GetValueInArrayByCurrent($zbp->db->Query($zbp->db->sql->Select($zbp->table['Tag'], 'Count(*) AS num', null, null, 1, null)), 'num'); $all_members = GetValueInArrayByCurrent($zbp->db->Query($zbp->db->sql->Select($zbp->table['Member'], 'Count(*) AS num', null, null, 1, null)), 'num'); $current_theme = '{$zbp->theme}'; $current_style = '{$zbp->style}'; $current_member = '{$zbp->user->Name}'; $system_environment = '{$system_environment}'; $r .= "<tr><td class='td20'>{$zbp->lang['msg']['current_member']}" . '' . "</td><td class='td30'>{$current_member}</td><td class='td20'>{$zbp->lang['msg']['current_version']}</td><td class='td30'>{$current_version}</td></tr>"; $r .= "<tr><td class='td20'>{$zbp->lang['msg']['all_artiles']}" . '' . "</td><td>{$all_artiles}</td><td>{$zbp->lang['msg']['all_categorys']}" . '' . "</td><td>{$all_categorys}</td></tr>"; $r .= "<tr><td class='td20'>{$zbp->lang['msg']['all_pages']}" . '' . "</td><td>{$all_pages}</td><td>{$zbp->lang['msg']['all_tags']}" . '' . "</td><td>{$all_tags}</td></tr>"; $r .= "<tr><td class='td20'>{$zbp->lang['msg']['all_comments']}" . '' . "</td><td>{$all_comments}</td><td>{$zbp->lang['msg']['all_views']}" . '' . "</td><td>{$all_views}</td></tr>"; $r .= "<tr><td class='td20'>{$zbp->lang['msg']['current_theme']}/{$zbp->lang['msg']['current_style']}</td><td>{$current_theme}/{$current_style}</td><td>{$zbp->lang['msg']['all_members']}" . '' . "</td><td>{$all_members}</td></tr>"; $r .= "<tr><td class='td20'>{$zbp->lang['msg']['xmlrpc_address']}</td><td>{$xmlrpc_address}</td><td>{$zbp->lang['msg']['system_environment']}</td><td>{$system_environment}</td></tr>"; $r .= "<script type=\"text/javascript\">\$('#statistic').next('small').remove();\$('#statistic').after('<small> 更新时间:" . date("c", $zbp->cache->reload_statistic_time) . "</small>');</script>"; $zbp->cache->reload_statistic = $r; $zbp->cache->reload_statistic_time = time(); $zbp->cache->system_environment = $system_environment; $zbp->cache->all_article_nums = $all_artiles; $zbp->cache->all_page_nums = $all_pages; $zbp->AddBuildModule('statistics', array($all_artiles, $all_pages, $all_categorys, $all_tags, $all_views, $all_comments)); $zbp->BuildModule(); $zbp->SaveCache(); $r = str_replace('{#ZC_BLOG_HOST#}', $zbp->host, $r); $r = str_replace('{$zbp->user->Name}', $zbp->user->Name, $r); $r = str_replace('{$zbp->theme}', $zbp->theme, $r); $r = str_replace('{$zbp->style}', $zbp->style, $r); $r = str_replace('{$system_environment}', GetEnvironment(), $r); echo $r; }
/** * 获取全部置顶文章(优先从cache里读数组) */ public function GetTopArticle() { if (!is_object($this->cache)) { return array(); } $articles_top_notorder_idarray = unserialize($this->cache->top_post_array); if (!is_array($articles_top_notorder_idarray)) { CountTopArticle(null, null); $articles_top_notorder_idarray = unserialize($this->cache->top_post_array); } $articles_top_notorder = $this->GetPostByArray($articles_top_notorder_idarray); return $articles_top_notorder; }