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


PHP comma_format函数代码示例

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


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

示例1: action_browse

    /**
     * Display the mail queue...
     *
     * @uses ManageMail template
     */
    public function action_browse()
    {
        global $scripturl, $context, $txt;
        require_once SUBSDIR . '/Mail.subs.php';
        loadTemplate('ManageMail');
        // First, are we deleting something from the queue?
        if (isset($_REQUEST['delete'])) {
            checkSession('post');
            deleteMailQueueItems($_REQUEST['delete']);
        }
        // Fetch the number of items in the current queue
        $status = list_MailQueueStatus();
        $context['oldest_mail'] = empty($status['mailOldest']) ? $txt['mailqueue_oldest_not_available'] : time_since(time() - $status['mailOldest']);
        $context['mail_queue_size'] = comma_format($status['mailQueueSize']);
        // Build our display list
        $listOptions = array('id' => 'mail_queue', 'title' => $txt['mailqueue_browse'], 'items_per_page' => 20, 'base_href' => $scripturl . '?action=admin;area=mailqueue', 'default_sort_col' => 'age', 'no_items_label' => $txt['mailqueue_no_items'], 'get_items' => array('function' => 'list_getMailQueue'), 'get_count' => array('function' => 'list_getMailQueueSize'), 'columns' => array('subject' => array('header' => array('value' => $txt['mailqueue_subject']), 'data' => array('function' => create_function('$rowData', '
							return Util::shorten_text(Util::htmlspecialchars($rowData[\'subject\'], 50));
						')), 'sort' => array('default' => 'subject', 'reverse' => 'subject DESC')), 'recipient' => array('header' => array('value' => $txt['mailqueue_recipient']), 'data' => array('sprintf' => array('format' => '<a href="mailto:%1$s">%1$s</a>', 'params' => array('recipient' => true))), 'sort' => array('default' => 'recipient', 'reverse' => 'recipient DESC')), 'priority' => array('header' => array('value' => $txt['mailqueue_priority'], 'class' => 'centertext'), 'data' => array('function' => create_function('$rowData', '
							global $txt;

							// We probably have a text label with your priority.
							$txtKey = sprintf(\'mq_mpriority_%1$s\', $rowData[\'priority\']);

							// But if not, revert to priority 0.
							return isset($txt[$txtKey]) ? $txt[$txtKey] : $txt[\'mq_mpriority_1\'];
						'), 'class' => 'centertext'), 'sort' => array('default' => 'priority', 'reverse' => 'priority DESC')), 'age' => array('header' => array('value' => $txt['mailqueue_age']), 'data' => array('function' => create_function('$rowData', '
							return time_since(time() - $rowData[\'time_sent\']);
						')), 'sort' => array('default' => 'time_sent', 'reverse' => 'time_sent DESC')), 'check' => array('header' => array('value' => '<input type="checkbox" onclick="invertAll(this, this.form);" class="input_check" />'), 'data' => array('function' => create_function('$rowData', '
							return \'<input type="checkbox" name="delete[]" value="\' . $rowData[\'id_mail\'] . \'" class="input_check" />\';
						')))), 'form' => array('href' => $scripturl . '?action=admin;area=mailqueue', 'include_start' => true, 'include_sort' => true), 'additional_rows' => array(array('position' => 'bottom_of_list', 'class' => 'submitbutton', 'value' => '
						<input type="submit" name="delete_redirects" value="' . $txt['quickmod_delete_selected'] . '" onclick="return confirm(\'' . $txt['quickmod_confirm'] . '\');" class="right_submit" />
						<a class="linkbutton" href="' . $scripturl . '?action=admin;area=mailqueue;sa=clear;' . $context['session_var'] . '=' . $context['session_id'] . '" onclick="return confirm(\'' . $txt['mailqueue_clear_list_warning'] . '\');">' . $txt['mailqueue_clear_list'] . '</a> ')));
        require_once SUBSDIR . '/GenericList.class.php';
        createList($listOptions);
    }
开发者ID:KeiroD,项目名称:Elkarte,代码行数:40,代码来源:ManageMail.controller.php

示例2: arcadeStats

/**
 * SMF Arcade
 *
 * @package SMF Arcade
 * @version 2.6 Alpha
 * @license http://download.smfarcade.info/license.php New-BSD
 */
function arcadeStats($memID)
{
    global $db_prefix, $scripturl, $txt, $modSettings, $context, $settings, $user_info, $smcFunc, $sourcedir;
    require_once $sourcedir . '/Arcade.php';
    SMFArcade::loadArcade('profile');
    $context['arcade']['member_stats'] = array();
    $result = $smcFunc['db_query']('', '
		SELECT COUNT(*) AS champion
		FROM {db_prefix}arcade_games
		WHERE id_champion = {int:member}
			AND enabled = 1', array('member' => $memID));
    $context['arcade']['member_stats'] += $smcFunc['db_fetch_assoc']($result);
    $smcFunc['db_free_result']($result);
    $result = $smcFunc['db_query']('', '
		SELECT COUNT(*) AS rates, (SUM(rating) / COUNT(*)) AS avg_rating
		FROM {db_prefix}arcade_rates
		WHERE id_member = {int:member}', array('member' => $memID));
    $context['arcade']['member_stats'] += $smcFunc['db_fetch_assoc']($result);
    $smcFunc['db_free_result']($result);
    $result = $smcFunc['db_query']('', '
		SELECT s.position, s.score, s.end_time, game.game_name, game.id_game
		FROM ({db_prefix}arcade_scores AS s, {db_prefix}arcade_games AS game)
		WHERE id_member = {int:member}
			AND personal_best = 1
			AND s.id_game = game.id_game
			AND game.enabled = 1
		ORDER BY position
		LIMIT 10', array('member' => $memID));
    $context['arcade']['member_stats']['scores'] = array();
    while ($row = $smcFunc['db_fetch_assoc']($result)) {
        $context['arcade']['member_stats']['scores'][] = array('link' => $scripturl . '?action=arcade;game=' . $row['id_game'], 'name' => $row['game_name'], 'score' => comma_format($row['score']), 'position' => $row['position'], 'time' => timeformat($row['end_time']));
    }
    $smcFunc['db_free_result']($result);
    $result = $smcFunc['db_query']('', '
		SELECT s.position, s.score, s.end_time, game.game_name, game.id_game
		FROM ({db_prefix}arcade_scores AS s, {db_prefix}arcade_games AS game)
		WHERE id_member = {int:member}
			AND personal_best = 1
			AND s.id_game = game.id_game
			AND game.enabled = 1
		ORDER BY end_time DESC
		LIMIT 10', array('member' => $memID));
    $context['arcade']['member_stats']['latest_scores'] = array();
    while ($row = $smcFunc['db_fetch_assoc']($result)) {
        $context['arcade']['member_stats']['latest_scores'][] = array('link' => $scripturl . '?action=arcade;game=' . $row['id_game'], 'name' => $row['game_name'], 'score' => comma_format($row['score']), 'position' => $row['position'], 'time' => timeformat($row['end_time']));
    }
    $smcFunc['db_free_result']($result);
    // Layout
    $context['sub_template'] = 'arcade_user_statistics';
    $context['page_title'] = sprintf($txt['arcade_user_stats_title'], $context['member']['name']);
}
开发者ID:nikop,项目名称:SMF-Arcade,代码行数:58,代码来源:Profile-Arcade.php

示例3: BrowseMailQueue

/**
 * Display the mail queue...
 */
function BrowseMailQueue()
{
    global $scripturl, $context, $modSettings, $txt, $smcFunc;
    global $sourcedir;
    // First, are we deleting something from the queue?
    if (isset($_REQUEST['delete'])) {
        checkSession('post');
        $smcFunc['db_query']('', '
			DELETE FROM {db_prefix}mail_queue
			WHERE id_mail IN ({array_int:mail_ids})', array('mail_ids' => $_REQUEST['delete']));
    }
    // How many items do we have?
    $request = $smcFunc['db_query']('', '
		SELECT COUNT(*) AS queue_size, MIN(time_sent) AS oldest
		FROM {db_prefix}mail_queue', array());
    list($mailQueueSize, $mailOldest) = $smcFunc['db_fetch_row']($request);
    $smcFunc['db_free_result']($request);
    $context['oldest_mail'] = empty($mailOldest) ? $txt['mailqueue_oldest_not_available'] : time_since(time() - $mailOldest);
    $context['mail_queue_size'] = comma_format($mailQueueSize);
    $listOptions = array('id' => 'mail_queue', 'title' => $txt['mailqueue_browse'], 'items_per_page' => 20, 'base_href' => $scripturl . '?action=admin;area=mailqueue', 'default_sort_col' => 'age', 'no_items_label' => $txt['mailqueue_no_items'], 'get_items' => array('function' => 'list_getMailQueue'), 'get_count' => array('function' => 'list_getMailQueueSize'), 'columns' => array('subject' => array('header' => array('value' => $txt['mailqueue_subject']), 'data' => array('function' => create_function('$rowData', '
						global $smcFunc;
						return $smcFunc[\'strlen\']($rowData[\'subject\']) > 50 ? sprintf(\'%1$s...\', htmlspecialchars($smcFunc[\'substr\']($rowData[\'subject\'], 0, 47))) : htmlspecialchars($rowData[\'subject\']);
					'), 'class' => 'smalltext'), 'sort' => array('default' => 'subject', 'reverse' => 'subject DESC')), 'recipient' => array('header' => array('value' => $txt['mailqueue_recipient']), 'data' => array('sprintf' => array('format' => '<a href="mailto:%1$s">%1$s</a>', 'params' => array('recipient' => true)), 'class' => 'smalltext'), 'sort' => array('default' => 'recipient', 'reverse' => 'recipient DESC')), 'priority' => array('header' => array('value' => $txt['mailqueue_priority']), 'data' => array('function' => create_function('$rowData', '
						global $txt;

						// We probably have a text label with your priority.
						$txtKey = sprintf(\'mq_mpriority_%1$s\', $rowData[\'priority\']);

						// But if not, revert to priority 0.
						return isset($txt[$txtKey]) ? $txt[$txtKey] : $txt[\'mq_mpriority_1\'];
					'), 'class' => 'smalltext'), 'sort' => array('default' => 'priority', 'reverse' => 'priority DESC')), 'age' => array('header' => array('value' => $txt['mailqueue_age']), 'data' => array('function' => create_function('$rowData', '
						return time_since(time() - $rowData[\'time_sent\']);
					'), 'class' => 'smalltext'), 'sort' => array('default' => 'time_sent', 'reverse' => 'time_sent DESC')), 'check' => array('header' => array('value' => '<input type="checkbox" onclick="invertAll(this, this.form);" class="input_check" />'), 'data' => array('function' => create_function('$rowData', '
						return \'<input type="checkbox" name="delete[]" value="\' . $rowData[\'id_mail\'] . \'" class="input_check" />\';
					'), 'class' => 'smalltext'))), 'form' => array('href' => $scripturl . '?action=admin;area=mailqueue', 'include_start' => true, 'include_sort' => true), 'additional_rows' => array(array('position' => 'below_table_data', 'value' => '<input type="submit" name="delete_redirects" value="' . $txt['quickmod_delete_selected'] . '" onclick="return confirm(\'' . $txt['quickmod_confirm'] . '\');" class="button_submit" /><a class="button_link" href="' . $scripturl . '?action=admin;area=mailqueue;sa=clear;' . $context['session_var'] . '=' . $context['session_id'] . '" onclick="return confirm(\'' . $txt['mailqueue_clear_list_warning'] . '\');">' . $txt['mailqueue_clear_list'] . '</a> ')));
    require_once $sourcedir . '/Subs-List.php';
    createList($listOptions);
    loadTemplate('ManageMail');
    $context['sub_template'] = 'browse';
}
开发者ID:Glyph13,项目名称:SMF2.1,代码行数:43,代码来源:ManageMail.php

示例4: template_board_children

function template_board_children(&$board)
{
    global $modSettings, $scripturl, $txt, $context, $settings;
    $children = array();
    foreach ($board['children'] as $child) {
        if (!$child['is_redirect']) {
            $child['link'] = '<h4 class="childlink"><a data-tip="tip_b_' . $child['id'] . '" href="' . $child['href'] . '" class="boardlink easytip">' . $child['name'] . '</a></h4>';
            $child['img'] = '<div class="csrcwrapper16px" style="left:-12px;margin-bottom:-16px;"><img class="clipsrc ' . ($child['new'] ? '_child_new' : '_child_old') . '" src="' . $context['sprite_image_src'] . '" alt="*" title="*" /></div>';
            $child['tip'] = '<div id="tip_b_' . $child['id'] . '" style="display:none;">' . (!empty($child['description']) ? $child['description'] . '<br>' : '') . ($child['new'] ? $txt['new_posts'] : $txt['old_posts']) . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')' . '</div>';
        } else {
            $child['link'] = '<a class="boardlink" href="' . $child['href'] . '" title="' . comma_format($child['posts']) . ' ' . $txt['redirects'] . '"><h4>' . $child['name'] . '</h4></a>' . '&nbsp;<span class="tinytext lowcontrast">(' . $child['description'] . ')</span>';
            $child['img'] = $child['tip'] = '';
        }
        if ($child['can_approve_posts'] && ($child['unapproved_posts'] || $child['unapproved_topics'])) {
            $child['link'] .= ' <a href="' . $scripturl . '?action=moderate;area=postmod;sa=' . ($child['unapproved_topics'] > 0 ? 'topics' : 'posts') . ';brd=' . $child['id'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '" title="' . sprintf($txt['unapproved_posts'], $child['unapproved_topics'], $child['unapproved_posts']) . '" class="moderation_link">(!)</a>';
        }
        $children[] = array('link' => $child['link'], 'new' => $child['new'], 'img' => $child['img'], 'tip' => $child['tip']);
    }
    echo '
	<div class="td_children" id="board_', $board['id'], '_children"><div class="floatleft lowcontrast">&#9492;</div>
		<table style="display:table;margin-left:12px;width:99%;">
		  <tr>';
    $n = 0;
    $columns = $modSettings['tidy_child_display_columns'];
    $width = 100 / $columns - 1;
    foreach ($children as &$child) {
        echo '<td style="width:', $width, '%;" class="tinytext"><div style="padding-left:12px;">', $child['img'], $child['link'], '</div>', $child['tip'], '</td>';
        if (++$n >= $columns) {
            $n = 0;
            echo '</tr><tr>';
        }
    }
    echo '
		  </tr>
		</table>
	</div>';
}
开发者ID:norv,项目名称:EosAlpha,代码行数:37,代码来源:GenericBits.template.php

示例5: loadMemberContext

function loadMemberContext($user, $display_custom_fields = false)
{
    global $memberContext, $user_profile, $txt, $scripturl, $user_info;
    global $context, $modSettings, $settings;
    static $dataLoaded = array();
    // If this person's data is already loaded, skip it.
    if (isset($dataLoaded[$user])) {
        return true;
    }
    // We can't load guests or members not loaded by loadMemberData()!
    if ($user == 0) {
        return false;
    }
    if (!isset($user_profile[$user])) {
        trigger_error('loadMemberContext(): member id ' . $user . ' not previously loaded by loadMemberData()', E_USER_WARNING);
        return false;
    }
    // Well, it's loaded now anyhow.
    $dataLoaded[$user] = true;
    $profile = $user_profile[$user];
    // Censor everything.
    censorText($profile['signature']);
    censorText($profile['personal_text']);
    censorText($profile['location']);
    // Set things up to be used before hand.
    $gendertxt = $profile['gender'] == 2 ? $txt['female'] : ($profile['gender'] == 1 ? $txt['male'] : '');
    $profile['signature'] = str_replace(array("\n", "\r"), array('<br />', ''), $profile['signature']);
    $profile['signature'] = parse_bbc($profile['signature'], true, 'sig' . $profile['id_member']);
    $profile['is_online'] = (!empty($profile['show_online']) || allowedTo('moderate_forum')) && $profile['is_online'] > 0;
    $profile['stars'] = empty($profile['stars']) ? array('', '') : explode('#', $profile['stars']);
    // Setup the buddy status here (One whole in_array call saved :P)
    $profile['buddy'] = in_array($profile['id_member'], $user_info['buddies']);
    $buddy_list = !empty($profile['buddy_list']) ? explode(',', $profile['buddy_list']) : array();
    // If we're always html resizing, assume it's too large.
    if ($modSettings['avatar_action_too_large'] == 'option_html_resize' || $modSettings['avatar_action_too_large'] == 'option_js_resize') {
        $avatar_width = !empty($modSettings['avatar_max_width_external']) ? ' width="' . $modSettings['avatar_max_width_external'] . '"' : '';
        $avatar_height = !empty($modSettings['avatar_max_height_external']) ? ' height="' . $modSettings['avatar_max_height_external'] . '"' : '';
    } else {
        $avatar_width = '';
        $avatar_height = '';
    }
    $m_href = URL::user($profile['id_member'], $profile['real_name']);
    // What a monstrous array...
    $memberContext[$user] = array('username' => $profile['member_name'], 'name' => $profile['real_name'], 'id' => $profile['id_member'], 'is_buddy' => $profile['buddy'], 'is_reverse_buddy' => in_array($user_info['id'], $buddy_list), 'buddies' => $buddy_list, 'title' => !empty($modSettings['titlesEnable']) ? $profile['usertitle'] : '', 'href' => $m_href, 'link' => '<a class="member group_' . (empty($profile['id_group']) ? $profile['id_post_group'] : $profile['id_group']) . '" onclick="getMcard(' . $profile['id_member'] . ');return(false);" href="' . $m_href . '" title="' . $txt['profile_of'] . ' ' . $profile['real_name'] . '">' . $profile['real_name'] . '</a>', 'email' => $profile['email_address'], 'show_email' => showEmailAddress(!empty($profile['hide_email']), $profile['id_member']), 'registered' => empty($profile['date_registered']) ? $txt['not_applicable'] : timeformat($profile['date_registered']), 'blurb' => $profile['personal_text'], 'gender' => array('name' => $gendertxt, 'image' => !empty($profile['gender']) ? '<img class="gender" src="' . $settings['images_url'] . '/' . ($profile['gender'] == 1 ? 'Male' : 'Female') . '.gif" alt="' . $gendertxt . '" />' : ''), 'birth_date' => empty($profile['birthdate']) || $profile['birthdate'] === '0001-01-01' ? '0000-00-00' : (substr($profile['birthdate'], 0, 4) === '0004' ? '0000' . substr($profile['birthdate'], 4) : $profile['birthdate']), 'signature' => $profile['signature'], 'location' => $profile['location'], 'real_posts' => $profile['posts'], 'posts' => comma_format($profile['posts']), 'avatar' => array('name' => $profile['avatar'], 'image' => $profile['avatar'] == '' ? $profile['id_attach'] > 0 ? '<img class="avatar" src="' . (empty($profile['attachment_type']) ? $scripturl . '?action=dlattach;attach=' . $profile['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $profile['filename']) . '" alt="" />' : '' : (stristr($profile['avatar'], 'http://') ? '<img class="avatar" src="' . $profile['avatar'] . '"' . $avatar_width . $avatar_height . ' alt="" />' : '<img class="avatar" src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($profile['avatar']) . '" alt="" />'), 'href' => $profile['avatar'] == '' ? $profile['id_attach'] > 0 ? empty($profile['attachment_type']) ? $scripturl . '?action=dlattach;attach=' . $profile['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $profile['filename'] : '' : (stristr($profile['avatar'], 'http://') ? $profile['avatar'] : $modSettings['avatar_url'] . '/' . $profile['avatar']), 'url' => $profile['avatar'] == '' ? '' : (stristr($profile['avatar'], 'http://') ? $profile['avatar'] : $modSettings['avatar_url'] . '/' . $profile['avatar'])), 'last_login' => empty($profile['last_login']) ? $txt['never'] : !empty($profile['show_online']) || allowedTo('moderate_forum') ? timeformat($profile['last_login']) : $txt['hidden'], 'ip' => htmlspecialchars($profile['member_ip']), 'ip2' => htmlspecialchars($profile['member_ip2']), 'online' => array('is_online' => $profile['is_online'], 'text' => $txt[$profile['is_online'] ? 'online' : 'offline'], 'href' => $scripturl . '?action=pm;sa=send;u=' . $profile['id_member'], 'link' => '<a href="' . $scripturl . '?action=pm;sa=send;u=' . $profile['id_member'] . '">' . $txt[$profile['is_online'] ? 'online' : 'offline'] . '</a>', 'image_href' => $settings['images_url'] . '/' . ($profile['buddy'] ? 'buddy_' : '') . ($profile['is_online'] ? 'useron' : 'useroff') . '.gif', 'label' => $txt[$profile['is_online'] ? 'online' : 'offline']), 'language' => commonAPI::ucwords(strtr($profile['lngfile'], array('_' => ' ', '-utf8' => ''))), 'is_activated' => isset($profile['is_activated']) ? $profile['is_activated'] : 1, 'is_banned' => isset($profile['is_activated']) ? $profile['is_activated'] >= 10 : 0, 'options' => $profile['options'], 'is_guest' => false, 'group' => $profile['member_group'], 'group_id' => $profile['id_group'], 'post_group_id' => $profile['id_post_group'], 'post_group' => $profile['post_group'], 'group_stars' => str_repeat('<img src="' . str_replace('$language', $context['user']['language'], isset($profile['stars'][1]) ? $settings['images_url'] . '/' . $profile['stars'][1] : '') . '" alt="*" />', empty($profile['stars'][0]) || empty($profile['stars'][1]) ? 0 : $profile['stars'][0]), 'warning' => $profile['warning'], 'warning_status' => !empty($modSettings['warning_mute']) && $modSettings['warning_mute'] <= $profile['warning'] ? 'mute' : (!empty($modSettings['warning_moderate']) && $modSettings['warning_moderate'] <= $profile['warning'] ? 'moderate' : (!empty($modSettings['warning_watch']) && $modSettings['warning_watch'] <= $profile['warning'] ? 'watch' : '')), 'local_time' => timeformat_static(time() + ($profile['time_offset'] - $user_info['time_offset']) * 3600, false), 'liked' => isset($profile['liked']) ? $profile['liked'] : 0, 'likesgiven' => isset($profile['likesgiven']) ? $profile['likesgiven'] : 0, 'notify_optout' => isset($profile['notify_optout']) ? $profile['notify_optout'] : '');
    if ($memberContext[$user]['avatar']['name'] == 'gravatar') {
        $hash = md5(strtolower(trim($memberContext[$user]['email'])));
        $memberContext[$user]['avatar']['image'] = '<img class="avatar" alt="avatar" src="http://www.gravatar.com/avatar/' . $hash . '" />';
        $memberContext[$user]['avatar']['href'] = 'http://www.gravatar.com/avatar/' . $hash;
        $memberContext[$user]['avatar']['url'] = $memberContext[$user]['avatar']['href'];
    }
    // First do a quick run through to make sure there is something to be shown.
    $memberContext[$user]['has_messenger'] = false;
    // Are we also loading the members custom fields into context?
    if ($display_custom_fields && !empty($modSettings['displayFields'])) {
        $memberContext[$user]['custom_fields'] = array();
        if (!isset($context['display_fields'])) {
            $context['display_fields'] = unserialize($modSettings['displayFields']);
        }
        foreach ($context['display_fields'] as $custom) {
            if (empty($custom['title']) || empty($profile['options'][$custom['colname']])) {
                continue;
            }
            $value = $profile['options'][$custom['colname']];
            // BBC?
            if ($custom['bbc']) {
                $value = parse_bbc($value);
            } elseif (isset($custom['type']) && $custom['type'] == 'check') {
                $value = $value ? $txt['yes'] : $txt['no'];
            }
            // Enclosing the user input within some other text?
            if (!empty($custom['enclose'])) {
                $value = strtr($custom['enclose'], array('{SCRIPTURL}' => $scripturl, '{IMAGES_URL}' => $settings['images_url'], '{DEFAULT_IMAGES_URL}' => $settings['default_images_url'], '{INPUT}' => $value));
            }
            $memberContext[$user]['custom_fields'][] = array('title' => $custom['title'], 'colname' => $custom['colname'], 'value' => $value, 'placement' => !empty($custom['placement']) ? $custom['placement'] : 0);
        }
    }
    HookAPI::callHook('integrate_loadmembercontext', array(&$memberContext[$user], &$profile));
    return true;
}
开发者ID:norv,项目名称:EosAlpha,代码行数:79,代码来源:Load.php

示例6: template_info_center


//.........这里部分代码省略.........
			', $context['show_member_list'] ? '<a href="' . $scripturl . '?action=mlist">' : '', '<img src="', $settings['images_url'], '/icons/members.gif" alt="', $txt['members_list'], '" border="0" />', $context['show_member_list'] ? '</a>' : '', '
		</td>
		<td class="windowbg2" width="100%">
			<strong>', $context['show_member_list'] ? '<a href="' . $scripturl . '?action=mlist">' . $txt['members_list'] . '</a>' : $txt['members_list'], '</strong>
			<div class="smalltext">', $txt['memberlist_searchable'], '</div>
		</td>
	</tr>';
    }
    // Show stats?
    if ($settings['show_stats_index']) {
        echo '
	<tr>
		<td class="catbg" colspan="2">', $txt['forum_stats'], '</td>
	</tr>
	<tr>
		<td class="windowbg" width="20" valign="middle" align="center">
			<a href="', $scripturl, '?action=stats">
				<img src="', $settings['images_url'], '/icons/info.gif" alt="', $txt['forum_stats'], '" border="0" /></a>
		</td>
		<td class="windowbg2" width="100%">
			<table border="0" width="90%"><tr>
				<td class="smalltext">
					<div class="floatleft" style="width: 50%;">', $txt['total_topics'], ': <strong>', $context['common_stats']['total_topics'], '</strong></div>', $txt['total_posts'], ': <strong>', $context['common_stats']['total_posts'], '</strong><br />', !empty($context['latest_post']) ? '
					' . $txt['latest_post'] . ': &quot;' . $context['latest_post']['link'] . '&quot;  (' . $context['latest_post']['time'] . ')<br />' : '', '
					<a href="', $scripturl, '?action=recent">', $txt['recent_view'], '</a>', $context['show_stats'] ? '<br />
					<a href="' . $scripturl . '?action=stats">' . $txt['more_stats'] . '</a>' : '', '
				</td>
				<td width="32%" class="smalltext" valign="top">
					', $txt['total_members'], ': <strong><a href="', $scripturl, '?action=mlist">', $context['common_stats']['total_members'], '</a></strong><br />
					', !empty($settings['show_latest_member']) ? $txt['latest_member'] . ': <strong> ' . $context['common_stats']['latest_member']['link'] . '</strong><br />' : '';
        // If they are logged in, show their unread message count, etc..
        if ($context['user']['is_logged']) {
            echo '
					', $txt['your_pms'], ': <strong><a href="', $scripturl, '?action=pm">', comma_format($context['user']['messages']), '</a></strong> ', $txt['newmessages3'], ': <strong><a href="', $scripturl, '?action=pm">', comma_format($context['user']['unread_messages']), '</a></strong>';
        }
        echo '
				</td>
			</tr></table>
		</td>
	</tr>';
    }
    // "Users online" - in order of activity.
    echo '
	<tr>
		<td class="catbg" colspan="2">', $txt['online_users'], '</td>
	</tr><tr>
		<td class="windowbg" width="20" valign="middle" align="center">
			', $context['show_who'] ? '<a href="' . $scripturl . '?action=who">' : '', '<img src="', $settings['images_url'], '/icons/online.gif" alt="', $txt['online_users'], '" border="0" />', $context['show_who'] ? '</a>' : '', '
		</td>
		<td class="windowbg2" width="100%">';
    if ($context['show_who']) {
        echo '
			<a href="', $scripturl, '?action=who">';
    }
    echo comma_format($context['num_guests']), ' ', $context['num_guests'] == 1 ? $txt['guest'] : $txt['guests'], ', ' . comma_format($context['num_users_online']), ' ', $context['num_users_online'] == 1 ? $txt['user'] : $txt['users'];
    // Handle hidden users and buddies.
    $bracketList = array();
    if ($context['show_buddies']) {
        $bracketList[] = comma_format($context['num_buddies']) . ' ' . ($context['num_buddies'] == 1 ? $txt['buddy'] : $txt['buddies']);
    }
    if (!empty($context['num_spiders'])) {
        $bracketList[] = comma_format($context['num_spiders']) . ' ' . ($context['num_spiders'] == 1 ? $txt['spider'] : $txt['spiders']);
    }
    if (!empty($context['num_users_hidden'])) {
        $bracketList[] = comma_format($context['num_users_hidden']) . ' ' . $txt['hidden'];
    }
开发者ID:dailinjie,项目名称:babylon,代码行数:67,代码来源:BoardIndex.template.php

示例7: db_debug_junk

function db_debug_junk()
{
    global $context, $scripturl, $boarddir, $modSettings, $boarddir;
    global $db_cache, $db_count, $db_show_debug, $cache_count, $cache_hits, $txt;
    // Add to Settings.php if you want to show the debugging information.
    if (!isset($db_show_debug) || $db_show_debug !== true || isset($_GET['action']) && $_GET['action'] == 'viewquery' || WIRELESS) {
        return;
    }
    if (empty($_SESSION['view_queries'])) {
        $_SESSION['view_queries'] = 0;
    }
    if (empty($context['debug']['language_files'])) {
        $context['debug']['language_files'] = array();
    }
    if (empty($context['debug']['sheets'])) {
        $context['debug']['sheets'] = array();
    }
    $files = get_included_files();
    $total_size = 0;
    for ($i = 0, $n = count($files); $i < $n; $i++) {
        if (file_exists($files[$i])) {
            $total_size += filesize($files[$i]);
        }
        $files[$i] = strtr($files[$i], array($boarddir => '.'));
    }
    $warnings = 0;
    if (!empty($db_cache)) {
        foreach ($db_cache as $q => $qq) {
            if (!empty($qq['w'])) {
                $warnings += count($qq['w']);
            }
        }
        $_SESSION['debug'] =& $db_cache;
    }
    // Gotta have valid HTML ;).
    $temp = ob_get_contents();
    if (function_exists('ob_clean')) {
        ob_clean();
    } else {
        ob_end_clean();
        ob_start('ob_sessrewrite');
    }
    echo preg_replace('~</body>\\s*</html>~', '', $temp), '
<div class="smalltext" style="text-align: left; margin: 1ex;">
	', $txt['debug_templates'], count($context['debug']['templates']), ': <em>', implode('</em>, <em>', $context['debug']['templates']), '</em>.<br />
	', $txt['debug_subtemplates'], count($context['debug']['sub_templates']), ': <em>', implode('</em>, <em>', $context['debug']['sub_templates']), '</em>.<br />
	', $txt['debug_language_files'], count($context['debug']['language_files']), ': <em>', implode('</em>, <em>', $context['debug']['language_files']), '</em>.<br />
	', $txt['debug_stylesheets'], count($context['debug']['sheets']), ': <em>', implode('</em>, <em>', $context['debug']['sheets']), '</em>.<br />
	', $txt['debug_files_included'], count($files), ' - ', round($total_size / 1024), $txt['debug_kb'], ' (<a href="javascript:void(0);" onclick="document.getElementById(\'debug_include_info\').style.display = \'inline\'; this.style.display = \'none\'; return false;">', $txt['debug_show'], '</a><span id="debug_include_info" style="display: none;"><em>', implode('</em>, <em>', $files), '</em></span>)<br />';
    if (!empty($modSettings['cache_enable']) && !empty($cache_hits)) {
        $entries = array();
        $total_t = 0;
        $total_s = 0;
        foreach ($cache_hits as $cache_hit) {
            $entries[] = $cache_hit['d'] . ' ' . $cache_hit['k'] . ': ' . sprintf($txt['debug_cache_seconds_bytes'], comma_format($cache_hit['t'], 5), $cache_hit['s']);
            $total_t += $cache_hit['t'];
            $total_s += $cache_hit['s'];
        }
        echo '
	', $txt['debug_cache_hits'], $cache_count, ': ', sprintf($txt['debug_cache_seconds_bytes_total'], comma_format($total_t, 5), comma_format($total_s)), ' (<a href="javascript:void(0);" onclick="document.getElementById(\'debug_cache_info\').style.display = \'inline\'; this.style.display = \'none\'; return false;">', $txt['debug_show'], '</a><span id="debug_cache_info" style="display: none;"><em>', implode('</em>, <em>', $entries), '</em></span>)<br />';
    }
    echo '
	<a href="', $scripturl, '?action=viewquery" target="_blank" class="new_win">', $warnings == 0 ? sprintf($txt['debug_queries_used'], (int) $db_count) : sprintf($txt['debug_queries_used_and_warnings'], (int) $db_count, $warnings), '</a><br />
	<br />';
    if ($_SESSION['view_queries'] == 1 && !empty($db_cache)) {
        foreach ($db_cache as $q => $qq) {
            $is_select = substr(trim($qq['q']), 0, 6) == 'SELECT' || preg_match('~^INSERT(?: IGNORE)? INTO \\w+(?:\\s+\\([^)]+\\))?\\s+SELECT .+$~s', trim($qq['q'])) != 0;
            // Temporary tables created in earlier queries are not explainable.
            if ($is_select) {
                foreach (array('log_topics_unread', 'topics_posted_in', 'tmp_log_search_topics', 'tmp_log_search_messages') as $tmp) {
                    if (strpos(trim($qq['q']), $tmp) !== false) {
                        $is_select = false;
                        break;
                    }
                }
            } elseif (preg_match('~^CREATE TEMPORARY TABLE .+?SELECT .+$~s', trim($qq['q'])) != 0) {
                $is_select = true;
            }
            // Make the filenames look a bit better.
            if (isset($qq['f'])) {
                $qq['f'] = preg_replace('~^' . preg_quote($boarddir, '~') . '~', '...', $qq['f']);
            }
            echo '
	<strong>', $is_select ? '<a href="' . $scripturl . '?action=viewquery;qq=' . ($q + 1) . '#qq' . $q . '" target="_blank" class="new_win" style="text-decoration: none;">' : '', nl2br(str_replace("\t", '&nbsp;&nbsp;&nbsp;', htmlspecialchars(ltrim($qq['q'], "\n\r")))) . ($is_select ? '</a></strong>' : '</strong>') . '<br />
	&nbsp;&nbsp;&nbsp;';
            if (!empty($qq['f']) && !empty($qq['l'])) {
                echo sprintf($txt['debug_query_in_line'], $qq['f'], $qq['l']);
            }
            if (isset($qq['s'], $qq['t']) && isset($txt['debug_query_which_took_at'])) {
                echo sprintf($txt['debug_query_which_took_at'], round($qq['t'], 8), round($qq['s'], 8)) . '<br />';
            } elseif (isset($qq['t'])) {
                echo sprintf($txt['debug_query_which_took'], round($qq['t'], 8)) . '<br />';
            }
            echo '
	<br />';
        }
    }
    echo '
	<a href="' . $scripturl . '?action=viewquery;sa=hide">', $txt['debug_' . (empty($_SESSION['view_queries']) ? 'show' : 'hide') . '_queries'], '</a>
</div></body></html>';
//.........这里部分代码省略.........
开发者ID:AhoyLemon,项目名称:ballpit,代码行数:101,代码来源:Subs.backup.2.php

示例8: adk_whois

function adk_whois()
{
    global $user_info, $txt, $sourcedir, $settings, $modSettings, $boardurl, $adkFolder;
    require_once $sourcedir . '/Subs-MembersOnline.php';
    $membersOnlineOptions = array('show_hidden' => allowedTo('moderate_forum'), 'sort' => 'log_time', 'reverse_sort' => true);
    global $smcFunc, $context, $scripturl, $user_info, $adkportal;
    // The list can be sorted in several ways.
    $allowed_sort_options = array('log_time', 'real_name', 'show_online', 'online_color', 'group_name');
    // Default the sorting method to 'most recent online members first'.
    if (!isset($membersOnlineOptions['sort'])) {
        $membersOnlineOptions['sort'] = 'log_time';
        $membersOnlineOptions['reverse_sort'] = true;
    } elseif (!in_array($membersOnlineOptions['sort'], $allowed_sort_options)) {
        trigger_error('Sort method for getMembersOnlineStats() function is not allowed', E_USER_NOTICE);
    }
    // Initialize the array that'll be returned later on.
    $membersOnlineStats = array('users_online' => array(), 'list_users_online' => array(), 'online_groups' => array(), 'num_guests' => 0, 'num_spiders' => 0, 'num_buddies' => 0, 'num_users_hidden' => 0, 'num_users_online' => 0);
    // Get any spiders if enabled.
    $spiders = array();
    $spider_finds = array();
    if (!empty($modSettings['show_spider_online']) && ($modSettings['show_spider_online'] < 3 || allowedTo('admin_forum')) && !empty($modSettings['spider_name_cache'])) {
        $spiders = unserialize($modSettings['spider_name_cache']);
    }
    // Load the users online right now.
    $request = $smcFunc['db_query']('', '
		SELECT
			lo.id_member, lo.log_time, lo.id_spider, mem.real_name, mem.member_name, mem.show_online,
			mg.online_color, mg.id_group, mg.group_name
		FROM {db_prefix}log_online AS lo
			LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = lo.id_member)
			LEFT JOIN {db_prefix}membergroups AS mg ON (mg.id_group = CASE WHEN mem.id_group = {int:reg_mem_group} THEN mem.id_post_group ELSE mem.id_group END)', array('reg_mem_group' => 0));
    while ($row = $smcFunc['db_fetch_assoc']($request)) {
        if (empty($row['real_name'])) {
            // Do we think it's a spider?
            if ($row['id_spider'] && isset($spiders[$row['id_spider']])) {
                $spider_finds[$row['id_spider']] = isset($spider_finds[$row['id_spider']]) ? $spider_finds[$row['id_spider']] + 1 : 1;
                $membersOnlineStats['num_spiders']++;
            }
            // Guests are only nice for statistics.
            $membersOnlineStats['num_guests']++;
            continue;
        } elseif (empty($row['show_online']) && empty($membersOnlineOptions['show_hidden'])) {
            // Just increase the stats and don't add this hidden user to any list.
            $membersOnlineStats['num_users_hidden']++;
            continue;
        }
        // Some basic color coding...
        if (!empty($row['online_color'])) {
            $link = '<a title="' . $row['group_name'] . ' - ' . $row['real_name'] . '" href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '" style="color: ' . $row['online_color'] . ';">' . $row['real_name'] . '</a>';
        } else {
            $link = '<a title="' . $row['group_name'] . ' - ' . $row['real_name'] . '" href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>';
        }
        // Buddies get counted and highlighted.
        $is_buddy = in_array($row['id_member'], $user_info['buddies']);
        if ($is_buddy) {
            $membersOnlineStats['num_buddies']++;
            $link = '<strong>' . $link . '</strong>';
        }
        // A lot of useful information for each member.
        $membersOnlineStats['users_online'][$row[$membersOnlineOptions['sort']] . $row['member_name']] = array('id' => $row['id_member'], 'username' => $row['member_name'], 'name' => $row['real_name'], 'group' => $row['id_group'], 'href' => $scripturl . '?action=profile;u=' . $row['id_member'], 'link' => $link, 'is_buddy' => $is_buddy, 'hidden' => empty($row['show_online']), 'is_last' => false);
        // This is the compact version, simply implode it to show.
        $membersOnlineStats['list_users_online'][$row[$membersOnlineOptions['sort']] . $row['member_name']] = empty($row['show_online']) ? '<em>' . $link . '</em>' : $link;
        // Store all distinct (primary) membergroups that are shown.
        if (!isset($membersOnlineStats['online_groups'][$row['id_group']])) {
            $membersOnlineStats['online_groups'][$row['id_group']] = array('id' => $row['id_group'], 'name' => $row['group_name'], 'color' => $row['online_color']);
        }
    }
    $smcFunc['db_free_result']($request);
    // If there are spiders only and we're showing the detail, add them to the online list - at the bottom.
    if (!empty($spider_finds) && $modSettings['show_spider_online'] > 1) {
        foreach ($spider_finds as $id => $count) {
            $link = $spiders[$id] . ($count > 1 ? ' (' . $count . ')' : '');
            $sort = $membersOnlineOptions['sort'] = 'log_time' && $membersOnlineOptions['reverse_sort'] ? 0 : 'zzz_';
            $membersOnlineStats['users_online'][$sort . $spiders[$id]] = array('id' => 0, 'username' => $spiders[$id], 'name' => $link, 'group' => $txt['spiders'], 'href' => '', 'link' => $link, 'is_buddy' => false, 'hidden' => false, 'is_last' => false);
            $membersOnlineStats['list_users_online'][$sort . $spiders[$id]] = $link;
        }
    }
    // Time to sort the list a bit.
    if (!empty($membersOnlineStats['users_online'])) {
        // Determine the sort direction.
        $sortFunction = empty($membersOnlineOptions['reverse_sort']) ? 'ksort' : 'krsort';
        // Sort the two lists.
        $sortFunction($membersOnlineStats['users_online']);
        $sortFunction($membersOnlineStats['list_users_online']);
        // Mark the last list item as 'is_last'.
        $userKeys = array_keys($membersOnlineStats['users_online']);
        $membersOnlineStats['users_online'][end($userKeys)]['is_last'] = true;
    }
    // Also sort the membergroups.
    ksort($membersOnlineStats['online_groups']);
    // Hidden and non-hidden members make up all online members.
    $membersOnlineStats['num_users_online'] = count($membersOnlineStats['users_online']) + $membersOnlineStats['num_users_hidden'] - (isset($modSettings['show_spider_online']) && $modSettings['show_spider_online'] > 1 ? count($spider_finds) : 0);
    $return = $membersOnlineStats;
    echo '
	<div style="font-weight: bold;" >
		', comma_format($return['num_guests']), ' ', $return['num_guests'] == 1 ? $txt['guest'] : $txt['guests'], ', ', comma_format($return['num_users_online']), ' ', $return['num_users_online'] == 1 ? $txt['user'] : $txt['users'], '
	</div><br />';
    $bracketList = array();
    if (!empty($user_info['buddies'])) {
        $bracketList[] = comma_format($return['num_buddies']) . ' ' . ($return['num_buddies'] == 1 ? $txt['buddy'] : $txt['buddies']);
//.........这里部分代码省略.........
开发者ID:lucasruroken,项目名称:adkportal,代码行数:101,代码来源:Subs-adkblocks.php

示例9: action_edit

 /**
  * Edit the search method and search index used.
  *
  * What it does:
  * - Calculates the size of the current search indexes in use.
  * - Allows to create and delete a fulltext index on the messages table.
  * - Allows to delete a custom index (that action_create() created).
  * - Called by ?action=admin;area=managesearch;sa=method.
  * - Requires the admin_forum permission.
  *
  * @uses ManageSearch template, 'select_search_method' sub-template.
  */
 public function action_edit()
 {
     global $txt, $context, $modSettings;
     // Need to work with some db search stuffs
     $db_search = db_search();
     require_once SUBSDIR . '/ManageSearch.subs.php';
     $context[$context['admin_menu_name']]['current_subsection'] = 'method';
     $context['page_title'] = $txt['search_method_title'];
     $context['sub_template'] = 'select_search_method';
     $context['supports_fulltext'] = $db_search->search_support('fulltext');
     // Load any apis.
     $context['search_apis'] = $this->loadSearchAPIs();
     // Detect whether a fulltext index is set.
     if ($context['supports_fulltext']) {
         detectFulltextIndex();
     }
     if (!empty($_REQUEST['sa']) && $_REQUEST['sa'] == 'createfulltext') {
         checkSession('get');
         validateToken('admin-msm', 'get');
         $context['fulltext_index'] = 'body';
         alterFullTextIndex('{db_prefix}messages', $context['fulltext_index'], true);
     } elseif (!empty($_REQUEST['sa']) && $_REQUEST['sa'] == 'removefulltext' && !empty($context['fulltext_index'])) {
         checkSession('get');
         validateToken('admin-msm', 'get');
         alterFullTextIndex('{db_prefix}messages', $context['fulltext_index']);
         $context['fulltext_index'] = '';
         // Go back to the default search method.
         if (!empty($modSettings['search_index']) && $modSettings['search_index'] == 'fulltext') {
             updateSettings(array('search_index' => ''));
         }
     } elseif (!empty($_REQUEST['sa']) && $_REQUEST['sa'] == 'removecustom') {
         checkSession('get');
         validateToken('admin-msm', 'get');
         drop_log_search_words();
         updateSettings(array('search_custom_index_config' => '', 'search_custom_index_resume' => ''));
         // Go back to the default search method.
         if (!empty($modSettings['search_index']) && $modSettings['search_index'] == 'custom') {
             updateSettings(array('search_index' => ''));
         }
     } elseif (isset($_POST['save'])) {
         checkSession();
         validateToken('admin-msmpost');
         updateSettings(array('search_index' => empty($_POST['search_index']) || !in_array($_POST['search_index'], array('fulltext', 'custom')) && !isset($context['search_apis'][$_POST['search_index']]) ? '' : $_POST['search_index'], 'search_force_index' => isset($_POST['search_force_index']) ? '1' : '0', 'search_match_words' => isset($_POST['search_match_words']) ? '1' : '0'));
     }
     $table_info_defaults = array('data_length' => 0, 'index_length' => 0, 'fulltext_length' => 0, 'custom_index_length' => 0);
     // Get some info about the messages table, to show its size and index size.
     if (method_exists($db_search, 'membersTableInfo')) {
         $context['table_info'] = array_merge($table_info_defaults, $db_search->membersTableInfo());
     } else {
         // Here may be wolves.
         $context['table_info'] = array('data_length' => $txt['not_applicable'], 'index_length' => $txt['not_applicable'], 'fulltext_length' => $txt['not_applicable'], 'custom_index_length' => $txt['not_applicable']);
     }
     // Format the data and index length in kilobytes.
     foreach ($context['table_info'] as $type => $size) {
         // If it's not numeric then just break.  This database engine doesn't support size.
         if (!is_numeric($size)) {
             break;
         }
         $context['table_info'][$type] = comma_format($context['table_info'][$type] / 1024) . ' ' . $txt['search_method_kilobytes'];
     }
     $context['custom_index'] = !empty($modSettings['search_custom_index_config']);
     $context['partial_custom_index'] = !empty($modSettings['search_custom_index_resume']) && empty($modSettings['search_custom_index_config']);
     $context['double_index'] = !empty($context['fulltext_index']) && $context['custom_index'];
     createToken('admin-msmpost');
     createToken('admin-msm', 'get');
 }
开发者ID:KeiroD,项目名称:Elkarte,代码行数:78,代码来源:ManageSearch.controller.php

示例10: loadMemberContext

function loadMemberContext($user, $display_custom_fields = false)
{
    global $memberContext, $user_profile, $txt, $scripturl, $user_info;
    global $context, $modSettings, $board_info, $settings;
    global $smcFunc;
    static $dataLoaded = array();
    // If this person's data is already loaded, skip it.
    if (isset($dataLoaded[$user])) {
        return true;
    }
    // We can't load guests or members not loaded by loadMemberData()!
    if ($user == 0) {
        return false;
    }
    if (!isset($user_profile[$user])) {
        trigger_error('loadMemberContext(): member id ' . $user . ' not previously loaded by loadMemberData()', E_USER_WARNING);
        return false;
    }
    // Well, it's loaded now anyhow.
    $dataLoaded[$user] = true;
    $profile = $user_profile[$user];
    // Censor everything.
    censorText($profile['signature']);
    censorText($profile['personal_text']);
    censorText($profile['location']);
    // Set things up to be used before hand.
    $gendertxt = $profile['gender'] == 2 ? $txt['female'] : ($profile['gender'] == 1 ? $txt['male'] : '');
    $profile['signature'] = str_replace(array("\n", "\r"), array('<br />', ''), $profile['signature']);
    $profile['signature'] = parse_bbc($profile['signature'], true, 'sig' . $profile['id_member']);
    $profile['is_online'] = (!empty($profile['show_online']) || allowedTo('moderate_forum')) && $profile['is_online'] > 0;
    $profile['stars'] = empty($profile['stars']) ? array('', '') : explode('#', $profile['stars']);
    // Setup the buddy status here (One whole in_array call saved :P)
    $profile['buddy'] = in_array($profile['id_member'], $user_info['buddies']);
    $buddy_list = !empty($profile['buddy_list']) ? explode(',', $profile['buddy_list']) : array();
    // If we're always html resizing, assume it's too large.
    if ($modSettings['avatar_action_too_large'] == 'option_html_resize' || $modSettings['avatar_action_too_large'] == 'option_js_resize') {
        $avatar_width = !empty($modSettings['avatar_max_width_external']) ? ' width="' . $modSettings['avatar_max_width_external'] . '"' : '';
        $avatar_height = !empty($modSettings['avatar_max_height_external']) ? ' height="' . $modSettings['avatar_max_height_external'] . '"' : '';
    } else {
        $avatar_width = '';
        $avatar_height = '';
    }
    // What a monstrous array...
    $memberContext[$user] = array('username' => $profile['member_name'], 'name' => $profile['real_name'], 'id' => $profile['id_member'], 'is_buddy' => $profile['buddy'], 'is_reverse_buddy' => in_array($user_info['id'], $buddy_list), 'buddies' => $buddy_list, 'title' => !empty($modSettings['titlesEnable']) ? $profile['usertitle'] : '', 'href' => $scripturl . '?action=profile;u=' . $profile['id_member'], 'link' => '<a href="' . $scripturl . '?action=profile;u=' . $profile['id_member'] . '" title="' . $txt['profile_of'] . ' ' . $profile['real_name'] . '">' . $profile['real_name'] . '</a>', 'email' => $profile['email_address'], 'show_email' => showEmailAddress(!empty($profile['hide_email']), $profile['id_member']), 'registered' => empty($profile['date_registered']) ? $txt['not_applicable'] : timeformat($profile['date_registered']), 'registered_timestamp' => empty($profile['date_registered']) ? 0 : forum_time(true, $profile['date_registered']), 'blurb' => $profile['personal_text'], 'gender' => array('name' => $gendertxt, 'image' => !empty($profile['gender']) ? '<img class="gender" src="' . $settings['images_url'] . '/' . ($profile['gender'] == 1 ? 'Male' : 'Female') . '.gif" alt="' . $gendertxt . '" />' : ''), 'website' => array('title' => $profile['website_title'], 'url' => $profile['website_url']), 'birth_date' => empty($profile['birthdate']) || $profile['birthdate'] === '0001-01-01' ? '0000-00-00' : (substr($profile['birthdate'], 0, 4) === '0004' ? '0000' . substr($profile['birthdate'], 4) : $profile['birthdate']), 'signature' => $profile['signature'], 'location' => $profile['location'], 'icq' => $profile['icq'] != '' && (empty($modSettings['guest_hideContacts']) || !$user_info['is_guest']) ? array('name' => $profile['icq'], 'href' => 'http://www.icq.com/whitepages/about_me.php?uin=' . $profile['icq'], 'link' => '<a class="icq new_win" href="http://www.icq.com/whitepages/about_me.php?uin=' . $profile['icq'] . '" target="_blank" title="' . $txt['icq_title'] . ' - ' . $profile['icq'] . '"><img src="http://status.icq.com/online.gif?img=5&amp;icq=' . $profile['icq'] . '" alt="' . $txt['icq_title'] . ' - ' . $profile['icq'] . '" width="18" height="18" /></a>', 'link_text' => '<a class="icq extern" href="http://www.icq.com/whitepages/about_me.php?uin=' . $profile['icq'] . '" title="' . $txt['icq_title'] . ' - ' . $profile['icq'] . '">' . $profile['icq'] . '</a>') : array('name' => '', 'add' => '', 'href' => '', 'link' => '', 'link_text' => ''), 'aim' => $profile['aim'] != '' && (empty($modSettings['guest_hideContacts']) || !$user_info['is_guest']) ? array('name' => $profile['aim'], 'href' => 'aim:goim?screenname=' . urlencode(strtr($profile['aim'], array(' ' => '%20'))) . '&amp;message=' . $txt['aim_default_message'], 'link' => '<a class="aim" href="aim:goim?screenname=' . urlencode(strtr($profile['aim'], array(' ' => '%20'))) . '&amp;message=' . $txt['aim_default_message'] . '" title="' . $txt['aim_title'] . ' - ' . $profile['aim'] . '"><img src="' . $settings['images_url'] . '/aim.gif" alt="' . $txt['aim_title'] . ' - ' . $profile['aim'] . '" /></a>', 'link_text' => '<a class="aim" href="aim:goim?screenname=' . urlencode(strtr($profile['aim'], array(' ' => '%20'))) . '&amp;message=' . $txt['aim_default_message'] . '" title="' . $txt['aim_title'] . ' - ' . $profile['aim'] . '">' . $profile['aim'] . '</a>') : array('name' => '', 'href' => '', 'link' => '', 'link_text' => ''), 'yim' => $profile['yim'] != '' && (empty($modSettings['guest_hideContacts']) || !$user_info['is_guest']) ? array('name' => $profile['yim'], 'href' => 'http://edit.yahoo.com/config/send_webmesg?.target=' . urlencode($profile['yim']), 'link' => '<a class="yim" href="http://edit.yahoo.com/config/send_webmesg?.target=' . urlencode($profile['yim']) . '" title="' . $txt['yim_title'] . ' - ' . $profile['yim'] . '"><img src="http://opi.yahoo.com/online?u=' . urlencode($profile['yim']) . '&amp;m=g&amp;t=0" alt="' . $txt['yim_title'] . ' - ' . $profile['yim'] . '" /></a>', 'link_text' => '<a class="yim" href="http://edit.yahoo.com/config/send_webmesg?.target=' . urlencode($profile['yim']) . '" title="' . $txt['yim_title'] . ' - ' . $profile['yim'] . '">' . $profile['yim'] . '</a>') : array('name' => '', 'href' => '', 'link' => '', 'link_text' => ''), 'msn' => $profile['msn'] != '' && (empty($modSettings['guest_hideContacts']) || !$user_info['is_guest']) ? array('name' => $profile['msn'], 'href' => 'http://members.msn.com/' . $profile['msn'], 'link' => '<a class="msn new_win" href="http://members.msn.com/' . $profile['msn'] . '" title="' . $txt['msn_title'] . ' - ' . $profile['msn'] . '"><img src="' . $settings['images_url'] . '/msntalk.gif" alt="' . $txt['msn_title'] . ' - ' . $profile['msn'] . '" /></a>', 'link_text' => '<a class="msn new_win" href="http://members.msn.com/' . $profile['msn'] . '" title="' . $txt['msn_title'] . ' - ' . $profile['msn'] . '">' . $profile['msn'] . '</a>') : array('name' => '', 'href' => '', 'link' => '', 'link_text' => ''), 'real_posts' => $profile['posts'], 'posts' => $profile['posts'] > 500000 ? $txt['geek'] : comma_format($profile['posts']), 'avatar' => array('name' => $profile['avatar'], 'image' => $profile['avatar'] == '' ? $profile['id_attach'] > 0 ? '<img class="avatar" src="' . (empty($profile['attachment_type']) ? $scripturl . '?action=dlattach;attach=' . $profile['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $profile['filename']) . '" alt="" />' : '' : (stristr($profile['avatar'], 'http://') ? '<img class="avatar" src="' . $profile['avatar'] . '"' . $avatar_width . $avatar_height . ' alt="" />' : '<img class="avatar" src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($profile['avatar']) . '" alt="" />'), 'href' => $profile['avatar'] == '' ? $profile['id_attach'] > 0 ? empty($profile['attachment_type']) ? $scripturl . '?action=dlattach;attach=' . $profile['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $profile['filename'] : '' : (stristr($profile['avatar'], 'http://') ? $profile['avatar'] : $modSettings['avatar_url'] . '/' . $profile['avatar']), 'url' => $profile['avatar'] == '' ? '' : (stristr($profile['avatar'], 'http://') ? $profile['avatar'] : $modSettings['avatar_url'] . '/' . $profile['avatar'])), 'last_login' => empty($profile['last_login']) ? $txt['never'] : timeformat($profile['last_login']), 'last_login_timestamp' => empty($profile['last_login']) ? 0 : forum_time(0, $profile['last_login']), 'karma' => array('good' => $profile['karma_good'], 'bad' => $profile['karma_bad'], 'allow' => !$user_info['is_guest'] && !empty($modSettings['karmaMode']) && $user_info['id'] != $user && allowedTo('karma_edit') && ($user_info['posts'] >= $modSettings['karmaMinPosts'] || $user_info['is_admin'])), 'ip' => htmlspecialchars($profile['member_ip']), 'ip2' => htmlspecialchars($profile['member_ip2']), 'online' => array('is_online' => $profile['is_online'], 'text' => $txt[$profile['is_online'] ? 'online' : 'offline'], 'href' => $scripturl . '?action=pm;sa=send;u=' . $profile['id_member'], 'link' => '<a href="' . $scripturl . '?action=pm;sa=send;u=' . $profile['id_member'] . '">' . $txt[$profile['is_online'] ? 'online' : 'offline'] . '</a>', 'image_href' => $settings['images_url'] . '/' . ($profile['buddy'] ? 'buddy_' : '') . ($profile['is_online'] ? 'useron' : 'useroff') . '.gif', 'label' => $txt[$profile['is_online'] ? 'online' : 'offline']), 'language' => $smcFunc['ucwords'](strtr($profile['lngfile'], array('_' => ' ', '-utf8' => ''))), 'is_activated' => isset($profile['is_activated']) ? $profile['is_activated'] : 1, 'is_banned' => isset($profile['is_activated']) ? $profile['is_activated'] >= 10 : 0, 'options' => $profile['options'], 'is_guest' => false, 'group' => $profile['member_group'], 'group_color' => $profile['member_group_color'], 'group_id' => $profile['id_group'], 'post_group' => $profile['post_group'], 'post_group_color' => $profile['post_group_color'], 'group_stars' => str_repeat('<img src="' . str_replace('$language', $context['user']['language'], isset($profile['stars'][1]) ? $settings['images_url'] . '/' . $profile['stars'][1] : '') . '" alt="*" />', empty($profile['stars'][0]) || empty($profile['stars'][1]) ? 0 : $profile['stars'][0]), 'warning' => $profile['warning'], 'warning_status' => !empty($modSettings['warning_mute']) && $modSettings['warning_mute'] <= $profile['warning'] ? 'mute' : (!empty($modSettings['warning_moderate']) && $modSettings['warning_moderate'] <= $profile['warning'] ? 'moderate' : (!empty($modSettings['warning_watch']) && $modSettings['warning_watch'] <= $profile['warning'] ? 'watch' : '')), 'local_time' => timeformat(time() + ($profile['time_offset'] - $user_info['time_offset']) * 3600, false));
    // First do a quick run through to make sure there is something to be shown.
    $memberContext[$user]['has_messenger'] = false;
    foreach (array('icq', 'msn', 'aim', 'yim') as $messenger) {
        if (!isset($context['disabled_fields'][$messenger]) && !empty($memberContext[$user][$messenger]['link'])) {
            $memberContext[$user]['has_messenger'] = true;
            break;
        }
    }
    // Are we also loading the members custom fields into context?
    if ($display_custom_fields && !empty($modSettings['displayFields'])) {
        $memberContext[$user]['custom_fields'] = array();
        if (!isset($context['display_fields'])) {
            $context['display_fields'] = unserialize($modSettings['displayFields']);
        }
        foreach ($context['display_fields'] as $custom) {
            if (empty($custom['title']) || empty($profile['options'][$custom['colname']])) {
                continue;
            }
            $value = $profile['options'][$custom['colname']];
            // BBC?
            if ($custom['bbc']) {
                $value = parse_bbc($value);
            } elseif (isset($custom['type']) && $custom['type'] == 'check') {
                $value = $value ? $txt['yes'] : $txt['no'];
            }
            // Enclosing the user input within some other text?
            if (!empty($custom['enclose'])) {
                $value = strtr($custom['enclose'], array('{SCRIPTURL}' => $scripturl, '{IMAGES_URL}' => $settings['images_url'], '{DEFAULT_IMAGES_URL}' => $settings['default_images_url'], '{INPUT}' => $value));
            }
            $memberContext[$user]['custom_fields'][] = array('title' => $custom['title'], 'colname' => $custom['colname'], 'value' => $value, 'placement' => !empty($custom['placement']) ? $custom['placement'] : 0);
        }
    }
    return true;
}
开发者ID:valek0972,项目名称:hackits,代码行数:78,代码来源:Load.php

示例11: statPanel

function statPanel($memID)
{
    global $txt, $scripturl, $context, $user_profile, $user_info, $modSettings, $smcFunc;
    $context['page_title'] = $txt['statPanel_showStats'] . ' ' . $user_profile[$memID]['real_name'];
    // General user statistics.
    $timeDays = floor($user_profile[$memID]['total_time_logged_in'] / 86400);
    $timeHours = floor($user_profile[$memID]['total_time_logged_in'] % 86400 / 3600);
    $context['time_logged_in'] = ($timeDays > 0 ? $timeDays . $txt['totalTimeLogged2'] : '') . ($timeHours > 0 ? $timeHours . $txt['totalTimeLogged3'] : '') . floor($user_profile[$memID]['total_time_logged_in'] % 3600 / 60) . $txt['totalTimeLogged4'];
    $context['num_posts'] = comma_format($user_profile[$memID]['posts']);
    // Number of topics started.
    $result = $smcFunc['db_query']('', '
		SELECT COUNT(*)
		FROM {db_prefix}topics
		WHERE id_member_started = {int:current_member}' . (!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? '
			AND id_board != {int:recycle_board}' : ''), array('current_member' => $memID, 'recycle_board' => $modSettings['recycle_board']));
    list($context['num_topics']) = $smcFunc['db_fetch_row']($result);
    $smcFunc['db_free_result']($result);
    // Number polls started.
    $result = $smcFunc['db_query']('', '
		SELECT COUNT(*)
		FROM {db_prefix}topics
		WHERE id_member_started = {int:current_member}' . (!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? '
			AND id_board != {int:recycle_board}' : '') . '
			AND id_poll != {int:no_poll}', array('current_member' => $memID, 'recycle_board' => $modSettings['recycle_board'], 'no_poll' => 0));
    list($context['num_polls']) = $smcFunc['db_fetch_row']($result);
    $smcFunc['db_free_result']($result);
    // Number polls voted in.
    $result = $smcFunc['db_query']('distinct_poll_votes', '
		SELECT COUNT(DISTINCT id_poll)
		FROM {db_prefix}log_polls
		WHERE id_member = {int:current_member}', array('current_member' => $memID));
    list($context['num_votes']) = $smcFunc['db_fetch_row']($result);
    $smcFunc['db_free_result']($result);
    // Format the numbers...
    $context['num_topics'] = comma_format($context['num_topics']);
    $context['num_polls'] = comma_format($context['num_polls']);
    $context['num_votes'] = comma_format($context['num_votes']);
    // Grab the board this member posted in most often.
    $result = $smcFunc['db_query']('', '
		SELECT
			b.id_board, MAX(b.name) AS name, MAX(b.num_posts) AS num_posts, COUNT(*) AS message_count
		FROM {db_prefix}messages AS m
			INNER JOIN {db_prefix}boards AS b ON (b.id_board = m.id_board)
		WHERE m.id_member = {int:current_member}
			AND b.count_posts = {int:count_enabled}
			AND {query_see_board}
		GROUP BY b.id_board
		ORDER BY message_count DESC
		LIMIT 10', array('current_member' => $memID, 'count_enabled' => 0));
    $context['popular_boards'] = array();
    while ($row = $smcFunc['db_fetch_assoc']($result)) {
        $context['popular_boards'][$row['id_board']] = array('id' => $row['id_board'], 'posts' => $row['message_count'], 'href' => $scripturl . '?board=' . $row['id_board'] . '.0', 'link' => '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['name'] . '</a>', 'posts_percent' => $user_profile[$memID]['posts'] == 0 ? 0 : $row['message_count'] * 100 / $user_profile[$memID]['posts'], 'total_posts' => $row['num_posts'], 'total_posts_member' => $user_profile[$memID]['posts']);
    }
    $smcFunc['db_free_result']($result);
    // Now get the 10 boards this user has most often participated in.
    $result = $smcFunc['db_query']('profile_board_stats', '
		SELECT
			b.id_board, MAX(b.name) AS name, b.num_posts, COUNT(*) AS message_count,
			CASE WHEN COUNT(*) > MAX(b.num_posts) THEN 1 ELSE COUNT(*) / MAX(b.num_posts) END * 100 AS percentage
		FROM {db_prefix}messages AS m
			INNER JOIN {db_prefix}boards AS b ON (b.id_board = m.id_board)
		WHERE m.id_member = {int:current_member}
			AND {query_see_board}
		GROUP BY b.id_board, b.num_posts
		ORDER BY percentage DESC
		LIMIT 10', array('current_member' => $memID));
    $context['board_activity'] = array();
    while ($row = $smcFunc['db_fetch_assoc']($result)) {
        $context['board_activity'][$row['id_board']] = array('id' => $row['id_board'], 'posts' => $row['message_count'], 'href' => $scripturl . '?board=' . $row['id_board'] . '.0', 'link' => '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['name'] . '</a>', 'percent' => comma_format((double) $row['percentage'], 2), 'posts_percent' => (double) $row['percentage'], 'total_posts' => $row['num_posts']);
    }
    $smcFunc['db_free_result']($result);
    // Posting activity by time.
    $result = $smcFunc['db_query']('user_activity_by_time', '
		SELECT
			HOUR(FROM_UNIXTIME(poster_time + {int:time_offset})) AS hour,
			COUNT(*) AS post_count
		FROM {db_prefix}messages
		WHERE id_member = {int:current_member}' . ($modSettings['totalMessages'] > 100000 ? '
			AND id_topic > {int:top_ten_thousand_topics}' : '') . '
		GROUP BY hour', array('current_member' => $memID, 'top_ten_thousand_topics' => $modSettings['totalTopics'] - 10000, 'time_offset' => ($user_info['time_offset'] + $modSettings['time_offset']) * 3600));
    $maxPosts = $realPosts = 0;
    $context['posts_by_time'] = array();
    while ($row = $smcFunc['db_fetch_assoc']($result)) {
        // Cast as an integer to remove the leading 0.
        $row['hour'] = (int) $row['hour'];
        $maxPosts = max($row['post_count'], $maxPosts);
        $realPosts += $row['post_count'];
        $context['posts_by_time'][$row['hour']] = array('hour' => $row['hour'], 'hour_format' => stripos($user_info['time_format'], '%p') === false ? $row['hour'] : date('g a', mktime($row['hour'])), 'posts' => $row['post_count'], 'posts_percent' => 0, 'is_last' => $row['hour'] == 23);
    }
    $smcFunc['db_free_result']($result);
    if ($maxPosts > 0) {
        for ($hour = 0; $hour < 24; $hour++) {
            if (!isset($context['posts_by_time'][$hour])) {
                $context['posts_by_time'][$hour] = array('hour' => $hour, 'hour_format' => stripos($user_info['time_format'], '%p') === false ? $hour : date('g a', mktime($hour)), 'posts' => 0, 'posts_percent' => 0, 'relative_percent' => 0, 'is_last' => $hour == 23);
            } else {
                $context['posts_by_time'][$hour]['posts_percent'] = round($context['posts_by_time'][$hour]['posts'] * 100 / $realPosts);
                $context['posts_by_time'][$hour]['relative_percent'] = round($context['posts_by_time'][$hour]['posts'] * 100 / $maxPosts);
            }
        }
    }
//.........这里部分代码省略.........
开发者ID:chenhao6593,项目名称:smf,代码行数:101,代码来源:Profile-View.php

示例12: UnreadTopics


//.........这里部分代码省略.........
			WHERE t.id_topic IN ({array_int:topic_list})
			ORDER BY ' . $_REQUEST['sort'] . ($ascending ? '' : ' DESC') . '
			LIMIT ' . count($topics), array('current_member' => $user_info['id'], 'topic_list' => $topics));
    }
    $context['topics'] = array();
    $topic_ids = array();
    while ($row = $smcFunc['db_fetch_assoc']($request)) {
        if ($row['id_poll'] > 0 && $modSettings['pollMode'] == '0') {
            continue;
        }
        $topic_ids[] = $row['id_topic'];
        if (!empty($settings['message_index_preview'])) {
            // Limit them to 128 characters - do this FIRST because it's a lot of wasted censoring otherwise.
            $row['first_body'] = strip_tags(strtr(parse_bbc($row['first_body'], $row['first_smileys'], $row['id_first_msg']), array('<br />' => '&#10;')));
            if ($smcFunc['strlen']($row['first_body']) > 128) {
                $row['first_body'] = $smcFunc['substr']($row['first_body'], 0, 128) . '...';
            }
            $row['last_body'] = strip_tags(strtr(parse_bbc($row['last_body'], $row['last_smileys'], $row['id_last_msg']), array('<br />' => '&#10;')));
            if ($smcFunc['strlen']($row['last_body']) > 128) {
                $row['last_body'] = $smcFunc['substr']($row['last_body'], 0, 128) . '...';
            }
            // Censor the subject and message preview.
            censorText($row['first_subject']);
            censorText($row['first_body']);
            // Don't censor them twice!
            if ($row['id_first_msg'] == $row['id_last_msg']) {
                $row['last_subject'] = $row['first_subject'];
                $row['last_body'] = $row['first_body'];
            } else {
                censorText($row['last_subject']);
                censorText($row['last_body']);
            }
        } else {
            $row['first_body'] = '';
            $row['last_body'] = '';
            censorText($row['first_subject']);
            if ($row['id_first_msg'] == $row['id_last_msg']) {
                $row['last_subject'] = $row['first_subject'];
            } else {
                censorText($row['last_subject']);
            }
        }
        // Decide how many pages the topic should have.
        $topic_length = $row['num_replies'] + 1;
        $messages_per_page = empty($modSettings['disableCustomPerPage']) && !empty($options['messages_per_page']) && !WIRELESS ? $options['messages_per_page'] : $modSettings['defaultMaxMessages'];
        if ($topic_length > $messages_per_page) {
            $tmppages = array();
            $tmpa = 1;
            for ($tmpb = 0; $tmpb < $topic_length; $tmpb += $messages_per_page) {
                $tmppages[] = '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.' . $tmpb . ';topicseen">' . $tmpa . '</a>';
                $tmpa++;
            }
            // Show links to all the pages?
            if (count($tmppages) <= 5) {
                $pages = '&#171; ' . implode(' ', $tmppages);
            } else {
                $pages = '&#171; ' . $tmppages[0] . ' ' . $tmppages[1] . ' ... ' . $tmppages[count($tmppages) - 2] . ' ' . $tmppages[count($tmppages) - 1];
            }
            if (!empty($modSettings['enableAllMessages']) && $topic_length < $modSettings['enableAllMessages']) {
                $pages .= ' &nbsp;<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0;all">' . $txt['all'] . '</a>';
            }
            $pages .= ' &#187;';
        } else {
            $pages = '';
        }
        // We need to check the topic icons exist... you can never be too sure!
        if (empty($modSettings['messageIconChecks_disable'])) {
            // First icon first... as you'd expect.
            if (!isset($context['icon_sources'][$row['first_icon']])) {
                $context['icon_sources'][$row['first_icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['first_icon'] . '.gif') ? 'images_url' : 'default_images_url';
            }
            // Last icon... last... duh.
            if (!isset($context['icon_sources'][$row['last_icon']])) {
                $context['icon_sources'][$row['last_icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['last_icon'] . '.gif') ? 'images_url' : 'default_images_url';
            }
        }
        // And build the array.
        $context['topics'][$row['id_topic']] = array('id' => $row['id_topic'], 'first_post' => array('id' => $row['id_first_msg'], 'member' => array('name' => $row['first_poster_name'], 'id' => $row['id_first_member'], 'href' => $scripturl . '?action=profile;u=' . $row['id_first_member'], 'link' => !empty($row['id_first_member']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row['id_first_member'] . '" title="' . $txt['profile_of'] . ' ' . $row['first_poster_name'] . '">' . $row['first_poster_name'] . '</a>' : $row['first_poster_name']), 'time' => timeformat($row['first_poster_time']), 'timestamp' => forum_time(true, $row['first_poster_time']), 'subject' => $row['first_subject'], 'preview' => $row['first_body'], 'icon' => $row['first_icon'], 'icon_url' => $settings[$context['icon_sources'][$row['first_icon']]] . '/post/' . $row['first_icon'] . '.gif', 'href' => $scripturl . '?topic=' . $row['id_topic'] . '.0;topicseen', 'link' => '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0;topicseen">' . $row['first_subject'] . '</a>'), 'last_post' => array('id' => $row['id_last_msg'], 'member' => array('name' => $row['last_poster_name'], 'id' => $row['id_last_member'], 'href' => $scripturl . '?action=profile;u=' . $row['id_last_member'], 'link' => !empty($row['id_last_member']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row['id_last_member'] . '">' . $row['last_poster_name'] . '</a>' : $row['last_poster_name']), 'time' => timeformat($row['last_poster_time']), 'timestamp' => forum_time(true, $row['last_poster_time']), 'subject' => $row['last_subject'], 'preview' => $row['last_body'], 'icon' => $row['last_icon'], 'icon_url' => $settings[$context['icon_sources'][$row['last_icon']]] . '/post/' . $row['last_icon'] . '.gif', 'href' => $scripturl . '?topic=' . $row['id_topic'] . ($row['num_replies'] == 0 ? '.0' : '.msg' . $row['id_last_msg']) . ';topicseen#msg' . $row['id_last_msg'], 'link' => '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . ($row['num_replies'] == 0 ? '.0' : '.msg' . $row['id_last_msg']) . ';topicseen#msg' . $row['id_last_msg'] . '" rel="nofollow">' . $row['last_subject'] . '</a>'), 'new_from' => $row['new_from'], 'new_href' => $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['new_from'] . ';topicseen#new', 'href' => $scripturl . '?topic=' . $row['id_topic'] . ($row['num_replies'] == 0 ? '.0' : '.msg' . $row['new_from']) . ';topicseen' . ($row['num_replies'] == 0 ? '' : 'new'), 'link' => '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . ($row['num_replies'] == 0 ? '.0' : '.msg' . $row['new_from']) . ';topicseen#msg' . $row['new_from'] . '" rel="nofollow">' . $row['first_subject'] . '</a>', 'is_sticky' => !empty($modSettings['enableStickyTopics']) && !empty($row['is_sticky']), 'is_locked' => !empty($row['locked']), 'is_poll' => $modSettings['pollMode'] == '1' && $row['id_poll'] > 0, 'is_hot' => $row['num_replies'] >= $modSettings['hotTopicPosts'], 'is_very_hot' => $row['num_replies'] >= $modSettings['hotTopicVeryPosts'], 'is_posted_in' => false, 'icon' => $row['first_icon'], 'icon_url' => $settings[$context['icon_sources'][$row['first_icon']]] . '/post/' . $row['first_icon'] . '.gif', 'subject' => $row['first_subject'], 'pages' => $pages, 'replies' => comma_format($row['num_replies']), 'views' => comma_format($row['num_views']), 'board' => array('id' => $row['id_board'], 'name' => $row['bname'], 'href' => $scripturl . '?board=' . $row['id_board'] . '.0', 'link' => '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['bname'] . '</a>'));
        determineTopicClass($context['topics'][$row['id_topic']]);
    }
    $smcFunc['db_free_result']($request);
    if ($is_topics && !empty($modSettings['enableParticipation']) && !empty($topic_ids)) {
        $result = $smcFunc['db_query']('', '
			SELECT id_topic
			FROM {db_prefix}messages
			WHERE id_topic IN ({array_int:topic_list})
				AND id_member = {int:current_member}
			GROUP BY id_topic
			LIMIT {int:limit}', array('current_member' => $user_info['id'], 'topic_list' => $topic_ids, 'limit' => count($topic_ids)));
        while ($row = $smcFunc['db_fetch_assoc']($result)) {
            if (empty($context['topics'][$row['id_topic']]['is_posted_in'])) {
                $context['topics'][$row['id_topic']]['is_posted_in'] = true;
                $context['topics'][$row['id_topic']]['class'] = 'my_' . $context['topics'][$row['id_topic']]['class'];
            }
        }
        $smcFunc['db_free_result']($result);
    }
    $context['querystring_board_limits'] = sprintf($context['querystring_board_limits'], $_REQUEST['start']);
    $context['topics_to_mark'] = implode('-', $topic_ids);
}
开发者ID:abdulhadikaryana,项目名称:kebudayaan,代码行数:101,代码来源:Recent.php

示例13: shd_profile_frontpage

function shd_profile_frontpage($memID)
{
    global $context, $memberContext, $txt, $modSettings, $user_info, $user_profile, $sourcedir, $scripturl, $smcFunc;
    // Attempt to load the member's profile data.
    if (!loadMemberContext($memID) || !isset($memberContext[$memID])) {
        fatal_lang_error('not_a_user', false);
    }
    $context['page_title'] = $txt['shd_profile_area'] . ' - ' . $txt['shd_profile_main'];
    $context['sub_template'] = 'shd_profile_main';
    $query = shd_db_query('', '
		SELECT COUNT(id_ticket) AS count, status
		FROM {db_prefix}helpdesk_tickets AS hdt
		WHERE id_member_started = {int:member}
		GROUP BY status', array('member' => $memID));
    $context['shd_numtickets'] = 0;
    $context['shd_numopentickets'] = 0;
    while ($row = $smcFunc['db_fetch_assoc']($query)) {
        $context['shd_numtickets'] += $row['count'];
        if ($row['status'] != TICKET_STATUS_CLOSED && $row['status'] != TICKET_STATUS_DELETED) {
            $context['shd_numopentickets'] += $row['count'];
        }
    }
    $context['shd_numtickets'] = comma_format($context['shd_numtickets']);
    $context['shd_numopentickets'] = comma_format($context['shd_numopentickets']);
    $smcFunc['db_free_result']($query);
    $query = shd_db_query('', '
		SELECT COUNT(id_ticket)
		FROM {db_prefix}helpdesk_tickets
		WHERE id_member_assigned = {int:member}', array('member' => $memID));
    list($context['shd_numassigned']) = $smcFunc['db_fetch_row']($query);
    $smcFunc['db_free_result']($query);
    $context['shd_numassigned'] = comma_format($context['shd_numassigned']);
    $context['can_post_ticket'] = shd_allowed_to('shd_new_ticket', 0) && $memID == $context['user']['id'];
    $context['can_post_proxy'] = shd_allowed_to('shd_new_ticket', 0) && shd_allowed_to('shd_post_proxy', 0) && $memID != $context['user']['id'];
    // since it's YOUR permissions, whether you can post on behalf of this user and this user isn't you!
    // Everything hereafter is HD only stuff.
    if (empty($modSettings['shd_helpdesk_only'])) {
        return;
    }
    $context['can_send_pm'] = allowedTo('pm_send') && (empty($modSettings['shd_helpdesk_only']) || empty($modSettings['shd_disable_pm']));
    $context['member'] =& $memberContext[$memID];
    if (allowedTo('moderate_forum')) {
        // Make sure it's a valid ip address; otherwise, don't bother...
        if (preg_match('/^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$/', $memberContext[$memID]['ip']) == 1 && empty($modSettings['disableHostnameLookup'])) {
            $context['member']['hostname'] = host_from_ip($memberContext[$memID]['ip']);
        } else {
            $context['member']['hostname'] = '';
        }
        $context['can_see_ip'] = true;
    } else {
        $context['can_see_ip'] = false;
    }
    // If the user is awaiting activation, and the viewer has permission - setup some activation context messages.
    if ($context['member']['is_activated'] % 10 != 1 && allowedTo('moderate_forum')) {
        $context['activate_type'] = $context['member']['is_activated'];
        // What should the link text be?
        $context['activate_link_text'] = in_array($context['member']['is_activated'], array(3, 4, 5, 13, 14, 15)) ? $txt['account_approve'] : $txt['account_activate'];
        // Should we show a custom message?
        $context['activate_message'] = isset($txt['account_activate_method_' . $context['member']['is_activated'] % 10]) ? $txt['account_activate_method_' . $context['member']['is_activated'] % 10] : $txt['account_not_activated'];
    }
    // How about, are they banned?
    $context['member']['bans'] = array();
    if (allowedTo('moderate_forum')) {
        // Can they edit the ban?
        $context['can_edit_ban'] = allowedTo('manage_bans');
        $ban_query = array();
        $ban_query_vars = array('time' => time());
        $ban_query[] = 'id_member = ' . $context['member']['id'];
        // Valid IP?
        if (preg_match('/^(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})$/', $memberContext[$memID]['ip'], $ip_parts) == 1) {
            $ban_query[] = '((' . $ip_parts[1] . ' BETWEEN bi.ip_low1 AND bi.ip_high1)
						AND (' . $ip_parts[2] . ' BETWEEN bi.ip_low2 AND bi.ip_high2)
						AND (' . $ip_parts[3] . ' BETWEEN bi.ip_low3 AND bi.ip_high3)
						AND (' . $ip_parts[4] . ' BETWEEN bi.ip_low4 AND bi.ip_high4))';
            // Do we have a hostname already?
            if (!empty($context['member']['hostname'])) {
                $ban_query[] = '({string:hostname} LIKE hostname)';
                $ban_query_vars['hostname'] = $context['member']['hostname'];
            }
        } elseif ($memberContext[$memID]['ip'] == 'unknown') {
            $ban_query[] = '(bi.ip_low1 = 255 AND bi.ip_high1 = 255
						AND bi.ip_low2 = 255 AND bi.ip_high2 = 255
						AND bi.ip_low3 = 255 AND bi.ip_high3 = 255
						AND bi.ip_low4 = 255 AND bi.ip_high4 = 255)';
        }
        // Check their email as well...
        if (strlen($context['member']['email']) != 0) {
            $ban_query[] = '({string:email} LIKE bi.email_address)';
            $ban_query_vars['email'] = $context['member']['email'];
        }
        // So... are they banned?  Dying to know!
        $request = $smcFunc['db_query']('', '
			SELECT bg.id_ban_group, bg.name, bg.cannot_access, bg.cannot_post, bg.cannot_register,
				bg.cannot_login, bg.reason
			FROM {db_prefix}ban_items AS bi
				INNER JOIN {db_prefix}ban_groups AS bg ON (bg.id_ban_group = bi.id_ban_group AND (bg.expire_time IS NULL OR bg.expire_time > {int:time}))
			WHERE (' . implode(' OR ', $ban_query) . ')', $ban_query_vars);
        while ($row = $smcFunc['db_fetch_assoc']($request)) {
            // Work out what restrictions we actually have.
            $ban_restrictions = array();
//.........这里部分代码省略.........
开发者ID:jdarwood007,项目名称:SimpleDesk,代码行数:101,代码来源:SimpleDesk-Profile.php

示例14: getDailyStats

function getDailyStats($condition_string, $condition_parameters = array())
{
    global $context, $smcFunc;
    // Activity by day.
    $days_result = $smcFunc['db_query']('', '
		SELECT YEAR(date) AS stats_year, MONTH(date) AS stats_month, DAYOFMONTH(date) AS stats_day, topics, posts, registers, most_on, hits
		FROM {db_prefix}log_activity
		WHERE ' . $condition_string . '
		ORDER BY stats_day ASC', $condition_parameters);
    while ($row_days = $smcFunc['db_fetch_assoc']($days_result)) {
        $context['yearly'][$row_days['stats_year']]['months'][(int) $row_days['stats_month']]['days'][] = array('day' => sprintf('%02d', $row_days['stats_day']), 'month' => sprintf('%02d', $row_days['stats_month']), 'year' => $row_days['stats_year'], 'new_topics' => comma_format($row_days['topics']), 'new_posts' => comma_format($row_days['posts']), 'new_members' => comma_format($row_days['registers']), 'most_members_online' => comma_format($row_days['most_on']), 'hits' => comma_format($row_days['hits']));
    }
    $smcFunc['db_free_result']($days_result);
}
开发者ID:abdulhadikaryana,项目名称:kebudayaan,代码行数:14,代码来源:Stats.php

示例15: template_info_center


//.........这里部分代码省略.........
					title, href, is_last, can_edit (are they allowed?), modify_href, and is_today. */
			foreach ($context['calendar_events'] as $event)
				echo '
					', $event['can_edit'] ? '<a href="' . $event['modify_href'] . '" title="' . $txt['calendar_edit'] . '"><img src="' . $settings['images_url'] . '/icons/modify_small.gif" alt="*" /></a> ' : '', $event['href'] == '' ? '' : '<a href="' . $event['href'] . '">', $event['is_today'] ? '<strong>' . $event['title'] . '</strong>' : $event['title'], $event['href'] == '' ? '' : '</a>', $event['is_last'] ? '<br />' : ', ';
		}
		echo '
			</p>';
	}

	// Show statistical style information...
	if ($settings['show_stats_index'])
	{
		echo '
			<div class="title_barIC">
				<h3>
					ballp.it stats
				</h3>
			</div>
			<div class="forum-stats">
				', $context['common_stats']['total_posts'], ' ', $txt['posts_made'], ' ', $txt['in'], ' ', $context['common_stats']['total_topics'], ' ', $txt['topics'], ' ', $txt['by'], ' ', $context['common_stats']['total_members'], ' ', $txt['members'], '. ', !empty($settings['show_latest_member']) ? $txt['latest_member'] . ': <strong> ' . $context['common_stats']['latest_member']['link'] . '</strong>' : '', '<br />
				', (!empty($context['latest_post']) ? $txt['latest_post'] . ': <strong>&quot;' . $context['latest_post']['link'] . '&quot;</strong>  ( ' . $context['latest_post']['time'] . ' )<br />' : ''), '
				<a href="', $scripturl, '?action=recent">', $txt['recent_view'], '</a>', $context['show_stats'] ? '<br />
				<a href="' . $scripturl . '?action=stats">' . $txt['more_stats'] . '</a>' : '', '
			</div>';
	}

	// "Users online" - in order of activity.
	echo '
			<div class="title_barIC">
				<h3>
					Users Online
				</h3>
			</div>
			<div class="forum-stats">
				<h4>
				', $context['show_who'] ? '<a href="' . $scripturl . '?action=who">' : '', comma_format($context['num_guests']), ' ', $context['num_guests'] == 1 ? $txt['guest'] : $txt['guests'], ', ' . comma_format($context['num_users_online']), ' ', $context['num_users_online'] == 1 ? $txt['user'] : $txt['users'];

	// Handle hidden users and buddies.
	$bracketList = array();
	if ($context['show_buddies'])
		$bracketList[] = comma_format($context['num_buddies']) . ' ' . ($context['num_buddies'] == 1 ? $txt['buddy'] : $txt['buddies']);
	if (!empty($context['num_spiders']))
		$bracketList[] = comma_format($context['num_spiders']) . ' ' . ($context['num_spiders'] == 1 ? $txt['spider'] : $txt['spiders']);
	if (!empty($context['num_users_hidden']))
		$bracketList[] = comma_format($context['num_users_hidden']) . ' ' . $txt['hidden'];

	if (!empty($bracketList))
		echo ' (' . implode(', ', $bracketList) . ')';

	echo $context['show_who'] ? '</a>' : '', '
			</h4>
			<p class="inline smalltext">';

	// Assuming there ARE users online... each user in users_online has an id, username, name, group, href, and link.
	if (!empty($context['users_online']))
	{
		echo '
				', sprintf($txt['users_active'], $modSettings['lastActive']), ':<br />', implode(', ', $context['list_users_online']);

		// Showing membergroups?
		if (!empty($settings['show_group_key']) && !empty($context['membergroups']))
			echo '
				<br />[' . implode(']&nbsp;&nbsp;[', $context['membergroups']) . ']';
	}

	echo '
			</p>';
  /**
			<p class="last smalltext">
				', $txt['most_online_today'], ': <strong>', comma_format($modSettings['mostOnlineToday']), '</strong>.
				', $txt['most_online_ever'], ': ', comma_format($modSettings['mostOnline']), ' (', timeformat($modSettings['mostDate']), ')
			</p>
  **/
    echo '
		</div>';

	// If they are logged in, but statistical information is off... show a personal message bar.
	if ($context['user']['is_logged'] && !$settings['show_stats_index'])
	{
		echo '
			<div class="title_barIC">
				<h4 class="titlebg">
					<span class="ie6_header floatleft">
						', $context['allow_pm'] ? '<a href="' . $scripturl . '?action=pm">' : '', '<img class="icon" src="', $settings['images_url'], '/message_sm.gif" alt="', $txt['personal_message'], '" />', $context['allow_pm'] ? '</a>' : '', '
						<span>', $txt['personal_message'], '</span>
					</span>
				</h4>
			</div>
			<p class="pminfo">
				<strong><a href="', $scripturl, '?action=pm">', $txt['personal_message'], '</a></strong>
				<span class="smalltext">
					', $txt['you_have'], ' ', comma_format($context['user']['messages']), ' ', $context['user']['messages'] == 1 ? $txt['message_lowercase'] : $txt['msg_alert_messages'], '.... ', $txt['click'], ' <a href="', $scripturl, '?action=pm">', $txt['here'], '</a> ', $txt['to_view'], '
				</span>
			</p>';
	}

	echo '
		</div>
	</div>';
}
开发者ID:AhoyLemon,项目名称:ballpit,代码行数:101,代码来源:BoardIndex.template.php


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