当前位置: 首页>>代码示例>>PHP>>正文


PHP get_db_stat函数代码示例

本文整理汇总了PHP中get_db_stat函数的典型用法代码示例。如果您正苦于以下问题:PHP get_db_stat函数的具体用法?PHP get_db_stat怎么用?PHP get_db_stat使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_db_stat函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: imp_statistics_block_func

 function imp_statistics_block_func()
 {
     global $template, $lang, $phpEx;
     $total_posts = get_db_stat('postcount');
     $total_users = get_db_stat('usercount');
     $total_topics = get_db_stat('topiccount');
     $newest_userdata = get_db_stat('newestuser');
     $newest_user = $newest_userdata['username'];
     $newest_uid = $newest_userdata['user_id'];
     if ($total_posts == 0) {
         $l_total_post_s = $lang['Posted_articles_zero_total'];
     } else {
         if ($total_posts == 1) {
             $l_total_post_s = $lang['Posted_article_total'];
         } else {
             $l_total_post_s = $lang['Posted_articles_total'];
         }
     }
     if ($total_users == 0) {
         $l_total_user_s = $lang['Registered_users_zero_total'];
     } else {
         if ($total_users == 1) {
             $l_total_user_s = $lang['Registered_user_total'];
         } else {
             $l_total_user_s = $lang['Registered_users_total'];
         }
     }
     $template->assign_vars(array('TOTAL_USERS' => sprintf($l_total_user_s, $total_users), 'NEWEST_USER' => sprintf($lang['Newest_user'], '<a href="' . append_sid("profile.{$phpEx}?mode=viewprofile&amp;" . POST_USERS_URL . "={$newest_uid}") . '">', $newest_user, '</a>'), 'TOTAL_POSTS' => sprintf($l_total_post_s, $total_posts), 'TOTAL_TOPICS' => sprintf($lang['total_topics'], $total_topics)));
 }
开发者ID:BackupTheBerlios,项目名称:phpbbsfp,代码行数:29,代码来源:blocks_imp_statistics.php

示例2: phpbb_fetch_stats

function phpbb_fetch_stats()
{
    global $CFG;
    $result = array();
    //
    // total posts
    //
    $result['total_posts'] = get_db_stat('postcount');
    //
    // total users
    //
    $result['total_users'] = get_db_stat('usercount');
    //
    // newest user
    //
    $newest_user = get_db_stat('newestuser');
    $result['user_id'] = $newest_user['user_id'];
    $result['username'] = $newest_user['username'];
    //
    // user online
    //
    $sql = 'SELECT session_id
			FROM ' . SESSIONS_TABLE . '
			WHERE session_time >= ' . (time() - $CFG['stats_session_time']) . '
				GROUP BY session_ip';
    $user_online = phpbb_fetch_rows($sql);
    $result['user_online'] = count($user_online);
    //
    // total topics
    //
    $sql = 'SELECT COUNT( topic_id ) AS topics
				FROM ' . TOPICS_TABLE;
    $total_topics = phpbb_fetch_rows($sql);
    $result['total_topics'] = $total_topics[0][0];
    return $result;
}
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:36,代码来源:stats.php

示例3: make_jumpbox

$db->sql_freeresult($result);
//
// Output page header and profile_view template
//
$template->set_filenames(array('body' => 'profile_view_body.tpl'));
make_jumpbox('viewforum.' . $phpEx);
//
// Calculate the number of days this user has been a member ($memberdays)
// Then calculate their posts per day
//
$regdate = $profiledata['user_regdate'];
$memberdays = max(1, round((time() - $regdate) / 86400));
$posts_per_day = $profiledata['user_posts'] / $memberdays;
// Get the users percentage of total posts
if ($profiledata['user_posts'] != 0) {
    $total_posts = get_db_stat('postcount');
    $percentage = $total_posts ? min(100, $profiledata['user_posts'] / $total_posts * 100) : 0;
} else {
    $percentage = 0;
}
$avatar_img = '';
if ($profiledata['user_avatar_type'] && $profiledata['user_allowavatar']) {
    switch ($profiledata['user_avatar_type']) {
        case USER_AVATAR_UPLOAD:
            $avatar_img = $board_config['allow_avatar_upload'] ? '<img src="' . $board_config['avatar_path'] . '/' . $profiledata['user_avatar'] . '" alt="" border="0" />' : '';
            break;
        case USER_AVATAR_REMOTE:
            $avatar_img = $board_config['allow_avatar_remote'] ? '<img src="' . $profiledata['user_avatar'] . '" alt="" border="0" />' : '';
            break;
        case USER_AVATAR_GALLERY:
            $avatar_img = $board_config['allow_avatar_local'] ? '<img src="' . $board_config['avatar_gallery_path'] . '/' . $profiledata['user_avatar'] . '" alt="" border="0" />' : '';
开发者ID:wrtcoder,项目名称:mini_isp,代码行数:31,代码来源:usercp_viewprofile.php

示例4: append_sid

    $template->assign_vars(array("META" => '<meta http-equiv="refresh" content="3;url=' . append_sid("index.{$phpEx}") . '">'));
    $message = $lang['Forums_marked_read'] . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.{$phpEx}") . '">', '</a> ');
    message_die(GENERAL_MESSAGE, $message);
}
//
// End handle marking posts
//
$tracking_topics = isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . "_t"]) : array();
$tracking_forums = isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . "_f"]) : array();
//
// If you don't use these stats on your index you may want to consider
// removing them
//
$total_posts = get_db_stat('postcount');
$total_users = get_db_stat('usercount');
$newest_userdata = get_db_stat('newestuser');
$newest_user = $newest_userdata['username'];
$newest_uid = $newest_userdata['user_id'];
if ($total_posts == 0) {
    $l_total_post_s = $lang['Posted_articles_zero_total'];
} else {
    if ($total_posts == 1) {
        $l_total_post_s = $lang['Posted_article_total'];
    } else {
        $l_total_post_s = $lang['Posted_articles_total'];
    }
}
if ($total_users == 0) {
    $l_total_user_s = $lang['Registered_users_zero_total'];
} else {
    if ($total_users == 1) {
开发者ID:BackupTheBerlios,项目名称:smileinstaller,代码行数:31,代码来源:index.php

示例5: array

            $template->assign_block_vars("catrow.modulerow", array("ROW_COLOR" => "#" . $row_color, "ROW_CLASS" => $row_class, "ADMIN_MODULE" => $action, "U_ADMIN_MODULE" => append_sid($file)));
            $row_count++;
        }
    }
    $template->pparse("body");
    include './page_footer_admin.' . $phpEx;
} elseif (isset($HTTP_GET_VARS['pane']) && $HTTP_GET_VARS['pane'] == 'right') {
    include './page_header_admin.' . $phpEx;
    $template->set_filenames(array("body" => "admin/index_body.tpl"));
    $template->assign_vars(array("L_WELCOME" => $lang['Welcome_phpBB'], "L_ADMIN_INTRO" => $lang['Admin_intro'], "L_FORUM_STATS" => $lang['Forum_stats'], "L_WHO_IS_ONLINE" => $lang['Who_is_Online'], "L_USERNAME" => $lang['Username'], "L_LOCATION" => $lang['Location'], "L_LAST_UPDATE" => $lang['Last_updated'], "L_IP_ADDRESS" => $lang['IP_Address'], "L_STATISTIC" => $lang['Statistic'], "L_VALUE" => $lang['Value'], "L_NUMBER_POSTS" => $lang['Number_posts'], "L_POSTS_PER_DAY" => $lang['Posts_per_day'], "L_NUMBER_TOPICS" => $lang['Number_topics'], "L_TOPICS_PER_DAY" => $lang['Topics_per_day'], "L_NUMBER_USERS" => $lang['Number_users'], "L_USERS_PER_DAY" => $lang['Users_per_day'], "L_BOARD_STARTED" => $lang['Board_started'], "L_AVATAR_DIR_SIZE" => $lang['Avatar_dir_size'], "L_DB_SIZE" => $lang['Database_size'], "L_FORUM_LOCATION" => $lang['Forum_Location'], "L_STARTED" => $lang['Login'], "L_GZIP_COMPRESSION" => $lang['Gzip_compression']));
    //
    // Get forum statistics
    //
    $total_posts = get_db_stat('postcount');
    $total_users = get_db_stat('usercount');
    $total_topics = get_db_stat('topiccount');
    $start_date = create_date($board_config['default_dateformat'], $board_config['board_startdate'], $board_config['board_timezone']);
    $boarddays = (time() - $board_config['board_startdate']) / 86400;
    $posts_per_day = sprintf("%.2f", $total_posts / $boarddays);
    $topics_per_day = sprintf("%.2f", $total_topics / $boarddays);
    $users_per_day = sprintf("%.2f", $total_users / $boarddays);
    $avatar_dir_size = 0;
    if ($avatar_dir = @opendir($phpbb_root_path . $board_config['avatar_path'])) {
        while ($file = @readdir($avatar_dir)) {
            if ($file != "." && $file != "..") {
                $avatar_dir_size += @filesize($phpbb_root_path . $board_config['avatar_path'] . "/" . $file);
            }
        }
        @closedir($avatar_dir);
        //
        // This bit of code translates the avatar directory size into human readable format
开发者ID:damncabbage,项目名称:publicwhip,代码行数:31,代码来源:index.php

示例6: get_db_stat

         }
     } else {
         // Trust forum_topics to be acurate enough (no real big deal if it isn't some time)
         $topic_forum_sql = "t.forum_id = {$forum_id} AND ";
         $item_count = $forum_data['forum_topics'];
     }
     $time_limit_sql = '';
 } else {
     // Is it a general rss feed call or a forum rss feed call
     if ($this->actions['action'] === 'forum') {
         //If so check for dupes and build channel header
         $rss_list_url = $this->path_config['rss_url'] . ($this->mod_r_config['mod_rewrite'] ? "forum-rss" . $this->mod_r_config['extra_params'] . ".xml" . $this->ext_config['gzip_ext_out'] : 'rss.' . $phpEx . '?forum' . $this->mod_r_config['extra_params']);
         $this->seo_kill_dupes($rss_list_url);
         // Forum stats
         $total_posts = get_db_stat('postcount');
         $total_users = get_db_stat('usercount');
         $l_total_post_s = $total_posts >= 0 ? $lang['Posted_articles_total'] : $lang['Posted_article_total'];
         $l_total_user_s = $total_users >= 0 ? $lang['Registered_users_total'] : $lang['Registered_user_total'];
         $forum_stats = sprintf($l_total_user_s, $total_users) . ' || ' . sprintf($l_total_post_s, $total_posts);
         // Chan info
         $chan_title = htmlspecialchars($board_config['sitename'] . $this->rss_config['extra_title']);
         $chan_desc = htmlspecialchars($board_config['site_desc'] . ' : <hr/><br/> ' . $forum_stats);
         $forum_image = sprintf($this->style_config['rsschan_img_tpl'], $chan_title, $this->rss_config['rss_image'], $this->path_config['phpbb_url']);
         $chan_time = gmdate('D, d M Y H:i:s \\G\\M\\T', $this->output_data['last_mod_time']);
         $this->output_data['data'] .= sprintf($this->style_config['rsschan_tpl'], $chan_title, $this->path_config['phpbb_url'], $chan_desc . $auth_msg, $chan_time, $forum_image);
         $this->output_data['data'] .= sprintf($this->style_config['rss_tpl'], htmlspecialchars($board_config['sitename']), $this->path_config['phpbb_url'], $chan_time, $chan_desc, $rss_list_url, $chan_title, $this->path_config['phpbb_url']);
         $this->output_data['url_sofar']++;
         $this->output_data['url_sofar']++;
     }
     // Grabb forums info
     $forumdata = array();
开发者ID:Nekrofage,项目名称:FJR,代码行数:31,代码来源:rss_forum.php

示例7: pcp_output_forums_stat

function pcp_output_forums_stat($field_name, $view_userdata, $map_name = '')
{
    global $board_config, $phpbb_root_path, $phpEx, $lang, $images, $userdata;
    global $values_list, $tables_linked, $classes_fields, $user_maps, $user_fields;
    global $db;
    $txt = '';
    $img = '';
    $res = '';
    if (!empty($view_userdata['user_posts']) && $view_userdata['user_id'] != ANONYMOUS) {
        $most_active_forum_id = -1;
        $most_active_forum_name = '';
        $most_active_forum_posts = 0;
        $most_active_forum_posts_total = 0;
        $total_posts = get_db_stat('postcount');
        $is_auth = auth(AUTH_VIEW, AUTH_LIST_ALL, $userdata);
        $forum_ids = array();
        while (list($forum_id, $auth) = @each($is_auth)) {
            if ($auth['auth_view']) {
                $forum_ids[] = $forum_id;
            }
        }
        if (!empty($forum_ids)) {
            $s_forum_ids = implode(', ', $forum_ids);
            // most active forum
            $sql = "SELECT t.forum_id, f.forum_name, f.forum_posts, count(p.post_id) AS posts_count\n                    FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f\n                    WHERE p.poster_id = " . $view_userdata['user_id'] . "\n                        AND t.topic_id = p.topic_id\n                        AND t.forum_id IN ({$s_forum_ids})\n                        AND f.forum_id = t.forum_id\n                    GROUP BY t.forum_id\n                    ORDER BY posts_count DESC\n                    LIMIT 0, 1";
            if (!($result = $db->sql_query($sql))) {
                message_die(GENERAL_ERROR, 'Could not get most active forum informations', '', __LINE__, __FILE__, $sql);
            }
            if ($row = $db->sql_fetchrow($result)) {
                $most_active_forum_id = $row['forum_id'];
                $most_active_forum_name = isset($lang[$row['forum_name']]) ? $lang[$row['forum_name']] : $row['forum_name'];
                $most_active_forum_posts = $row['posts_count'];
                $most_active_forum_posts_total = $row['forum_posts'];
            }
            // display
            if ($most_active_forum_id > -1) {
                // forum
                $temp_url = append_sid("./viewforum.{$phpEx}?" . POST_FORUM_URL . "={$most_active_forum_id}");
                $txt = '<a href="' . $temp_url . '" class="topictitle">' . $most_active_forum_name . '</a>';
                $txt .= '<br /><span class="genmed">' . sprintf('[' . $lang['Most_active_forum_stat'] . ']', $most_active_forum_posts, $most_active_forum_posts * 100 / $most_active_forum_posts_total, $most_active_forum_posts * 100 / $total_posts) . '</span>';
            }
        }
        // result
        $res = pcp_output_format($field_name, $txt, $img, $map_name);
    }
    return $res;
}
开发者ID:BackupTheBerlios,项目名称:phpbbsfp,代码行数:47,代码来源:def_userfuncs_std.php

示例8: sprintf

$l_topics_per_user_s = ($total_topics == 0) ? 'TOPICS_PER_USER_ZERO' : 'TOPICS_PER_USER_OTHER';
$l_posts_per_user_s = ($total_posts == 0) ? 'POSTS_PER_USER_ZERO' : 'POSTS_PER_USER_OTHER';
$l_posts_per_topic_s = ($total_posts == 0) ? 'POSTS_PER_TOPIC_ZERO' : 'POSTS_PER_TOPIC_OTHER';

// Assign specific vars
$template->assign_vars(array(
	'S_DISPLAY_ADVANCED_STAT' => true,
	'TOTAL_POSTS'	=> sprintf($user->lang[$l_total_post_s], $total_posts),
	'TOTAL_TOPICS'	=> sprintf($user->lang[$l_total_topic_s], $total_topics),
	'TOTAL_USERS'	=> sprintf($user->lang[$l_total_user_s], $total_users),
	'NEWEST_USER'	=> sprintf($user->lang['NEWEST_USER'], '<a href="' . append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&amp;u=' . $newest_uid) . '">' . $newest_user . '</a>'),
/*
	'S_NEW_POSTS'	=> get_db_stat('newposttotal'),
	'S_NEW_TOPIC'	=> get_db_stat('newtopictotal'),
	'S_NEW_ANN'		=> get_db_stat('newannouncmenttotal'),
	'S_NEW_SCT'		=> get_db_stat('newstickytotal'),
*/
	'S_ANN'			=> get_db_stat('announcmenttotal'),
	'S_SCT'			=> get_db_stat('stickytotal'),
	'S_TOT_ATTACH'	=> get_db_stat('attachmentstotal'),
	
	// avarage stat
	'TOPICS_PER_DAY'	=> sprintf($user->lang[$l_topics_per_day_s], $topics_per_day),	
	'POSTS_PER_DAY'		=> sprintf($user->lang[$l_posts_per_day_s], $posts_per_day),	
	'USERS_PER_DAY'		=> sprintf($user->lang[$l_users_per_day_s], $users_per_day),	
	'TOPICS_PER_USER'	=> sprintf($user->lang[$l_topics_per_user_s], $topics_per_user),	
	'POSTS_PER_USER'	=> sprintf($user->lang[$l_posts_per_user_s], $posts_per_user),	
	'POSTS_PER_TOPIC'	=> sprintf($user->lang[$l_posts_per_topic_s], $posts_per_topic),
));

?>
开发者ID:sietf,项目名称:sietf.org,代码行数:31,代码来源:statistics.php

示例9: stats

 function stats($stat)
 {
     if ('PHPBB2' == $this->ver) {
         switch ($stat) {
             case 'num_topics':
                 return get_db_stat('topiccount');
             case 'num_users':
                 return get_db_stat('usercount');
             case 'newest_username':
                 $result = get_db_stat('newestuser');
                 return $result['username'];
             case 'newest_user_id':
                 $result = get_db_stat('newestuser');
                 return $result['user_id'];
             case 'num_posts':
             default:
                 return get_db_stat('postcount');
         }
     } else {
         return $GLOBALS['config'][$stat];
     }
 }
开发者ID:Oddsor,项目名称:lpt-forum,代码行数:22,代码来源:abstractify.php


注:本文中的get_db_stat函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。