示例#1
0
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;
}
示例#2
0
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;
}
示例#3
0
/**
 * 评论批量处理(删除、通过审核、加入审核)
 */
function BatchComment()
{
    global $zbp;
    if (isset($_POST['all_del'])) {
        $type = 'all_del';
    }
    if (isset($_POST['all_pass'])) {
        $type = 'all_pass';
    }
    if (isset($_POST['all_audit'])) {
        $type = 'all_audit';
    }
    $array = $_POST['id'];
    if (is_array($array)) {
        $array = array_unique($array);
    } else {
        $array = array($array);
    }
    // Search Child Comments
    $childArray = array();
    foreach ($array as $i => $id) {
        $cmt = $zbp->GetCommentByID($id);
        if ($cmt->ID == 0) {
            continue;
        }
        $childArray[] = $cmt;
        GetSubComments($cmt->ID, $childArray);
    }
    // Unique child array
    $childArray = array_unique($childArray);
    if ($type == 'all_del') {
        foreach ($childArray as $i => $cmt) {
            $cmt->Del();
            if (!$cmt->IsChecking) {
                CountPostArray(array($cmt->LogID), -1);
                CountCommentNums(-1, 0);
            } else {
                CountCommentNums(-1, -1);
            }
        }
    } elseif ($type == 'all_pass') {
        foreach ($childArray as $i => $cmt) {
            if (!$cmt->IsChecking) {
                continue;
            }
            $cmt->IsChecking = false;
            $cmt->Save();
            CountPostArray(array($cmt->LogID), +1);
            CountCommentNums(0, -1);
        }
    } elseif ($type == 'all_audit') {
        foreach ($childArray as $i => $cmt) {
            if ($cmt->IsChecking) {
                continue;
            }
            $cmt->IsChecking = true;
            $cmt->Save();
            CountPostArray(array($cmt->LogID), -1);
            CountCommentNums(0, +1);
        }
    }
    $zbp->AddBuildModule('comments');
}
示例#4
0
/**
 * 评论批量处理(删除、通过审核、加入审核)
 */
function BatchComment()
{
    global $zbp;
    if (isset($_POST['all_del'])) {
        $type = 'all_del';
    }
    if (isset($_POST['all_pass'])) {
        $type = 'all_pass';
    }
    if (isset($_POST['all_audit'])) {
        $type = 'all_audit';
    }
    $array = array();
    $array = $_POST['id'];
    $array = array_unique($array);
    if ($type == 'all_del') {
        $arrdel = array();
        foreach ($array as $i => $id) {
            $cmt = $zbp->GetCommentByID($id);
            if ($cmt->ID == 0) {
                continue;
            }
            $arrdel[] = $cmt->ID;
            DelComment_Children_NoDel($cmt->ID, $arrdel);
        }
        foreach ($arrdel as $i => $id) {
            $cmt = $zbp->GetCommentByID($id);
            if ($cmt->ID == 0) {
                continue;
            }
            $cmt->Del();
            if ($cmt->IsChecking == false) {
                CountPostArray(array($cmt->LogID), -1);
            }
            if ($cmt->IsChecking == false) {
                CountCommentNums(-1, 0);
            } else {
                CountCommentNums(-1, -1);
            }
        }
    }
    if ($type == 'all_pass') {
        foreach ($array as $i => $id) {
            $cmt = $zbp->GetCommentByID($id);
            if ($cmt->ID == 0) {
                continue;
            }
            $cmt->IsChecking = false;
            $cmt->Save();
            CountPostArray(array($cmt->LogID), +1);
            CountCommentNums(0, -1);
        }
    }
    if ($type == 'all_audit') {
        foreach ($array as $i => $id) {
            $cmt = $zbp->GetCommentByID($id);
            if ($cmt->ID == 0) {
                continue;
            }
            $cmt->IsChecking = true;
            $cmt->Save();
            CountPostArray(array($cmt->LogID), -1);
            CountCommentNums(0, +1);
        }
    }
    $zbp->AddBuildModule('comments');
}
示例#5
0
 public function kill_ip($ip)
 {
     global $zbp;
     $logid = array();
     $cmtid = array();
     $sql = $zbp->db->sql->Select('%pre%comment', array('comm_ID', 'comm_logID'), array(array('=', 'comm_IP', $ip), array('=', 'comm_IsChecking', 0), array('>', 'comm_PostTime', time() - 24 * 60 * 60)), null, null, null);
     $result = $zbp->db->Query($sql);
     $foundComment = count($result);
     if ($foundComment > 0) {
         for ($i = 0; $i < count($result); $i++) {
             $cmtid[] = $result[$i]['comm_ID'];
             $logid[] = $result[$i]['comm_logID'];
         }
     }
     $zbp->Config('Totoro')->CHECK_INT = (int) $zbp->Config('Totoro')->CHECK_INT + $foundComment;
     $zbp->SaveConfig('Totoro');
     if (function_exists('CountCommentNums')) {
         CountCommentNums(0, +$foundComment);
     }
     CountPostArray($logid);
     $zbp->AddBuildModule('comments');
     $sql = $zbp->db->sql->Update('%pre%comment', array('comm_IsChecking' => 1), array(array('=', 'comm_IP', $ip), array('=', 'comm_IsChecking', 0), array('>', 'comm_PostTime', time() - 24 * 60 * 60)));
     $zbp->db->Update($sql);
 }