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


PHP loadMemberContext函数代码示例

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


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

示例1: teknoromisidebarsag

function teknoromisidebarsag()
{
    global $boarddir, $modSettings, $txt, $context;
    require_once $boarddir . '/SSI.php';
    echo '</td></tr></tbody></table>';
    if (!empty($modSettings['sideright']) && empty($context['current_action'])) {
        echo '<td valign="top" id="upshrinkRightBarTD">
				<div id="upshrinkRightBar" style="width:', $modSettings['siderightwidth'] ? $modSettings['siderightwidth'] : '200px', '; margin-right:4px; overflow:auto;">';
        if (!empty($modSettings['sideright1'])) {
            echo '<div class="cat_bar"><h3 class="catbg">' . $modSettings['righthtmlbaslik'] . '</h3></div>';
            echo '' . $modSettings['sideright1'] . '';
        }
        if (!empty($modSettings['siderightphp'])) {
            echo '<div class="cat_bar"><h3 class="catbg">' . $modSettings['rightphpbaslik'] . '</h3></div>';
            eval($modSettings['siderightphp']);
        }
        if (!empty($modSettings['siderighthaberetkin'])) {
            $array = ssi_boardNews($modSettings['siderighthaber'], $modSettings['siderightsay'], null, 1000, 'array');
            echo '<div class="cat_bar">
							<h3 class="catbg">', $modSettings['rbaslik'], '</h3>
						</div>';
            global $memberContext;
            foreach ($array as $news) {
                loadMemberData($news['poster']['id']);
                loadMemberContext($news['poster']['id']);
                echo '<div class="sidehaber">
								<div class="sideBaslik">
								', $news['icon'], '
								<h3><a href="', $news['href'], '">', $news['subject'], '</a></h3>
								</div>
								<div class="snrj"> ', $memberContext[$news['poster']['id']]['avatar']['image'], ' 
								<p>', $txt['by'], '', $news['poster']['link'], '</p>
								</div>
								</div><hr/>';
            }
        }
        echo '</div>
			</td>
			<td valign="top">
			<button type="button" onclick="rightPanel.toggle();" id="teknoright"></button>
			</td>';
    }
    echo '
		</tr></tbody></table>';
}
开发者ID:CeeMoo,项目名称:Teknoromi-sidebar,代码行数:45,代码来源:Subs-teknoromisidebar.php

示例2: printMemberListRows

/**
 * Retrieves results of the request passed to it
 * Puts results of request into the context for the sub template.
 *
 * @param resource $request
 */
function printMemberListRows($request)
{
    global $txt, $context, $scripturl, $memberContext, $settings;
    $db = database();
    // Get the max post number for the bar graph
    $result = $db->query('', '
		SELECT MAX(posts)
		FROM {db_prefix}members', array());
    list($most_posts) = $db->fetch_row($result);
    $db->free_result($result);
    // Avoid division by zero...
    if ($most_posts == 0) {
        $most_posts = 1;
    }
    $members = array();
    while ($row = $db->fetch_assoc($request)) {
        $members[] = $row['id_member'];
    }
    // Load all the members for display.
    loadMemberData($members);
    $context['members'] = array();
    foreach ($members as $member) {
        if (!loadMemberContext($member)) {
            continue;
        }
        $context['members'][$member] = $memberContext[$member];
        $context['members'][$member]['post_percent'] = round($context['members'][$member]['real_posts'] * 100 / $most_posts);
        $context['members'][$member]['registered_date'] = strftime('%Y-%m-%d', $context['members'][$member]['registered_timestamp']);
        $context['members'][$member]['real_name'] = $context['members'][$member]['link'];
        $context['members'][$member]['avatar'] = '<a href="' . $context['members'][$member]['href'] . '">' . $context['members'][$member]['avatar']['image'] . '</a>';
        $context['members'][$member]['email_address'] = $context['members'][$member]['email'];
        $context['members'][$member]['website_url'] = $context['members'][$member]['website']['url'] != '' ? '<a href="' . $context['members'][$member]['website']['url'] . '" target="_blank" class="new_win"><img src="' . $settings['images_url'] . '/profile/www.png" alt="' . $context['members'][$member]['website']['title'] . '" title="' . $context['members'][$member]['website']['title'] . '" /></a>' : '';
        $context['members'][$member]['id_group'] = empty($context['members'][$member]['group']) ? $context['members'][$member]['post_group'] : $context['members'][$member]['group'];
        $context['members'][$member]['date_registered'] = $context['members'][$member]['registered'];
        // Take care of the custom fields if any are being displayed
        if (!empty($context['custom_profile_fields']['columns'])) {
            foreach ($context['custom_profile_fields']['columns'] as $key => $column) {
                $curField = substr($key, 5);
                // Does this member even have it filled out?
                if (!isset($context['members'][$member]['options'][$curField])) {
                    $context['members'][$member]['options'][$curField] = '';
                    continue;
                }
                // Should it be enclosed for display?
                if (!empty($column['enclose']) && !empty($context['members'][$member]['options'][$curField])) {
                    $context['members'][$member]['options'][$curField] = strtr($column['enclose'], array('{SCRIPTURL}' => $scripturl, '{IMAGES_URL}' => $settings['images_url'], '{DEFAULT_IMAGES_URL}' => $settings['default_images_url'], '{INPUT}' => $context['members'][$member]['options'][$curField]));
                }
                // Anything else to make it look "nice"
                if ($column['bbc']) {
                    $context['members'][$member]['options'][$curField] = strip_tags(parse_bbc($context['members'][$member]['options'][$curField]));
                } elseif ($column['type'] === 'check') {
                    $context['members'][$member]['options'][$curField] = $context['members'][$member]['options'][$curField] == 0 ? $txt['no'] : $txt['yes'];
                }
            }
        }
    }
}
开发者ID:KeiroD,项目名称:Elkarte,代码行数:63,代码来源:Memberlist.subs.php

示例3: prepareDisplayContext

function prepareDisplayContext($reset = false)
{
    global $settings, $txt, $modSettings, $scripturl, $options, $user_info, $smcFunc;
    global $memberContext, $context, $messages_request, $topic, $attachments, $topicinfo;
    static $counter = null;
    // If the query returned false, bail.
    if ($messages_request == false) {
        return false;
    }
    // Remember which message this is.  (ie. reply #83)
    if ($counter === null || $reset) {
        $counter = empty($options['view_newest_first']) ? $context['start'] : $context['total_visible_posts'] - $context['start'];
    }
    // Start from the beginning...
    if ($reset) {
        return @$smcFunc['db_data_seek']($messages_request, 0);
    }
    // Attempt to get the next message.
    $message = $smcFunc['db_fetch_assoc']($messages_request);
    if (!$message) {
        $smcFunc['db_free_result']($messages_request);
        return false;
    }
    // $context['icon_sources'] says where each icon should come from - here we set up the ones which will always exist!
    if (empty($context['icon_sources'])) {
        $stable_icons = array('xx', 'thumbup', 'thumbdown', 'exclamation', 'question', 'lamp', 'smiley', 'angry', 'cheesy', 'grin', 'sad', 'wink', 'moved', 'recycled', 'wireless', 'clip');
        $context['icon_sources'] = array();
        foreach ($stable_icons as $icon) {
            $context['icon_sources'][$icon] = 'images_url';
        }
    }
    // Message Icon Management... check the images exist.
    if (empty($modSettings['messageIconChecks_disable'])) {
        // If the current icon isn't known, then we need to do something...
        if (!isset($context['icon_sources'][$message['icon']])) {
            $context['icon_sources'][$message['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $message['icon'] . '.gif') ? 'images_url' : 'default_images_url';
        }
    } elseif (!isset($context['icon_sources'][$message['icon']])) {
        $context['icon_sources'][$message['icon']] = 'images_url';
    }
    // If you're a lazy bum, you probably didn't give a subject...
    $message['subject'] = $message['subject'] != '' ? $message['subject'] : $txt['no_subject'];
    // Are you allowed to remove at least a single reply?
    $context['can_remove_post'] |= allowedTo('delete_own') && (empty($modSettings['edit_disable_time']) || max($message['modified_time'], $message['poster_time']) + $modSettings['edit_disable_time'] * 60 >= time()) && $message['id_member'] == $user_info['id'];
    // If it couldn't load, or the user was a guest.... someday may be done with a guest table.
    if (!loadMemberContext($message['id_member'], true)) {
        // Notice this information isn't used anywhere else....
        $memberContext[$message['id_member']]['name'] = $message['poster_name'];
        $memberContext[$message['id_member']]['id'] = 0;
        $memberContext[$message['id_member']]['group'] = $txt['guest_title'];
        $memberContext[$message['id_member']]['link'] = $message['poster_name'];
        $memberContext[$message['id_member']]['email'] = $message['poster_email'];
        $memberContext[$message['id_member']]['show_email'] = showEmailAddress(true, 0);
        $memberContext[$message['id_member']]['is_guest'] = true;
    } else {
        $memberContext[$message['id_member']]['can_view_profile'] = allowedTo('profile_view_any') || $message['id_member'] == $user_info['id'] && allowedTo('profile_view_own');
        $memberContext[$message['id_member']]['is_topic_starter'] = $message['id_member'] == $context['topic_starter_id'];
        $memberContext[$message['id_member']]['can_see_warning'] = !isset($context['disabled_fields']['warning_status']) && $memberContext[$message['id_member']]['warning_status'] && ($context['user']['can_mod'] || !$user_info['is_guest'] && !empty($modSettings['warning_show']) && ($modSettings['warning_show'] > 1 || $message['id_member'] == $user_info['id']));
    }
    $memberContext[$message['id_member']]['ip'] = $message['poster_ip'];
    // Do the censor thang.
    censorText($message['body']);
    censorText($message['subject']);
    // Run BBC interpreter on the message.
    $message['body'] = parse_bbc($message['body'], $message['smileys_enabled'], $message['id_msg']);
    // Compose the memory eat- I mean message array.
    $output = array('attachment' => loadAttachmentContext($message['id_msg']), 'alternate' => $counter % 2, 'id' => $message['id_msg'], 'href' => $scripturl . '?topic=' . $topic . '.msg' . $message['id_msg'] . '#msg' . $message['id_msg'], 'link' => '<a href="' . $scripturl . '?topic=' . $topic . '.msg' . $message['id_msg'] . '#msg' . $message['id_msg'] . '" rel="nofollow">' . $message['subject'] . '</a>', 'member' => &$memberContext[$message['id_member']], 'icon' => $message['icon'], 'icon_url' => $settings[$context['icon_sources'][$message['icon']]] . '/post/' . $message['icon'] . '.gif', 'subject' => $message['subject'], 'time' => timeformat($message['poster_time']), 'timestamp' => forum_time(true, $message['poster_time']), 'counter' => $counter, 'modified' => array('time' => timeformat($message['modified_time']), 'timestamp' => forum_time(true, $message['modified_time']), 'name' => $message['modified_name']), 'body' => $message['body'], 'new' => empty($message['is_read']), 'approved' => $message['approved'], 'first_new' => isset($context['start_from']) && $context['start_from'] == $counter, 'is_ignored' => !empty($modSettings['enable_buddylist']) && !empty($options['posts_apply_ignore_list']) && in_array($message['id_member'], $context['user']['ignoreusers']), 'can_approve' => !$message['approved'] && $context['can_approve'], 'can_unapprove' => $message['approved'] && $context['can_approve'], 'can_modify' => (!$context['is_locked'] || allowedTo('moderate_board')) && (allowedTo('modify_any') || allowedTo('modify_replies') && $context['user']['started'] || allowedTo('modify_own') && $message['id_member'] == $user_info['id'] && (empty($modSettings['edit_disable_time']) || !$message['approved'] || max($message['modified_time'], $message['poster_time']) + $modSettings['edit_disable_time'] * 60 > time())), 'can_remove' => allowedTo('delete_any') || allowedTo('delete_replies') && $context['user']['started'] || allowedTo('delete_own') && $message['id_member'] == $user_info['id'] && (empty($modSettings['edit_disable_time']) || max($message['modified_time'], $message['poster_time']) + $modSettings['edit_disable_time'] * 60 > time()), 'can_see_ip' => allowedTo('moderate_forum') || $message['id_member'] == $user_info['id'] && !empty($user_info['id']));
    // Is this user the message author?
    $output['is_message_author'] = $message['id_member'] == $user_info['id'];
    if (empty($options['view_newest_first'])) {
        $counter++;
    } else {
        $counter--;
    }
    return $output;
}
开发者ID:sk8rdude461,项目名称:moparscape.org-smf,代码行数:76,代码来源:Display.php

示例4: Who

function Who()
{
    global $db_prefix, $context, $scripturl, $user_info, $txt, $modSettings, $ID_MEMBER, $memberContext;
    // Permissions, permissions, permissions.
    isAllowedTo('who_view');
    // You can't do anything if this is off.
    if (empty($modSettings['who_enabled'])) {
        fatal_lang_error('who_off', false);
    }
    // Load the 'Who' template.
    loadTemplate('Who');
    // Sort out... the column sorting.
    $sort_methods = array('user' => 'mem.realName', 'time' => 'lo.logTime');
    // By default order by last time online.
    if (!isset($_REQUEST['sort']) || !isset($sort_methods[$_REQUEST['sort']])) {
        $context['sort_by'] = 'time';
        $_REQUEST['sort'] = 'lo.logTime';
    } else {
        $context['sort_by'] = $_REQUEST['sort'];
        $_REQUEST['sort'] = $sort_methods[$_REQUEST['sort']];
    }
    $context['sort_direction'] = isset($_REQUEST['asc']) ? 'up' : 'down';
    // Get the total amount of members online.
    $request = db_query("\n\t\tSELECT COUNT(*)\n\t\tFROM {$db_prefix}log_online AS lo\n\t\t\tLEFT JOIN {$db_prefix}members AS mem ON (lo.ID_MEMBER = mem.ID_MEMBER)" . (!allowedTo('moderate_forum') ? "\n\t\tWHERE IFNULL(mem.showOnline, 1) = 1" : ''), __FILE__, __LINE__);
    list($totalMembers) = mysql_fetch_row($request);
    mysql_free_result($request);
    // Prepare some page index variables.
    $context['page_index'] = constructPageIndex($scripturl . '?action=who;sort=' . $context['sort_by'] . (isset($_REQUEST['asc']) ? ';asc' : ''), $_REQUEST['start'], $totalMembers, $modSettings['defaultMaxMembers']);
    $context['start'] = $_REQUEST['start'];
    // Look for people online, provided they don't mind if you see they are.
    $request = db_query("\n\t\tSELECT\n\t\t\t(UNIX_TIMESTAMP(lo.logTime) - UNIX_TIMESTAMP() + " . time() . ") AS logTime,\n\t\t\tlo.ID_MEMBER, lo.url, INET_NTOA(lo.ip) AS ip, mem.realName, lo.session,\n\t\t\tmg.onlineColor, IFNULL(mem.showOnline, 1) AS showOnline\n\t\tFROM {$db_prefix}log_online AS lo\n\t\t\tLEFT JOIN {$db_prefix}members AS mem ON (lo.ID_MEMBER = mem.ID_MEMBER)\n\t\t\tLEFT JOIN {$db_prefix}membergroups AS mg ON (mg.ID_GROUP = IF(mem.ID_GROUP = 0, mem.ID_POST_GROUP, mem.ID_GROUP))" . (!allowedTo('moderate_forum') ? "\n\t\tWHERE IFNULL(mem.showOnline, 1) = 1" : '') . "\n\t\tORDER BY {$_REQUEST['sort']} " . (isset($_REQUEST['asc']) ? 'ASC' : 'DESC') . "\n\t\tLIMIT {$context['start']}, {$modSettings['defaultMaxMembers']}", __FILE__, __LINE__);
    $context['members'] = array();
    $member_ids = array();
    $url_data = array();
    while ($row = mysql_fetch_assoc($request)) {
        $actions = @unserialize($row['url']);
        if ($actions === false) {
            continue;
        }
        // Send the information to the template.
        $context['members'][$row['session']] = array('id' => $row['ID_MEMBER'], 'ip' => allowedTo('moderate_forum') ? $row['ip'] : '', 'time' => strtr(timeformat($row['logTime']), array($txt['smf10'] => '', $txt['smf10b'] => '')), 'timestamp' => forum_time(true, $row['logTime']), 'query' => $actions, 'is_hidden' => $row['showOnline'] == 0, 'color' => empty($row['onlineColor']) ? '' : $row['onlineColor']);
        $url_data[$row['session']] = array($row['url'], $row['ID_MEMBER']);
        $member_ids[] = $row['ID_MEMBER'];
    }
    mysql_free_result($request);
    // Load the user data for these members.
    loadMemberData($member_ids);
    // Load up the guest user.
    $memberContext[0] = array('id' => 0, 'name' => $txt[28], 'group' => $txt[28], 'href' => '', 'link' => $txt[28], 'email' => $txt[28], 'is_guest' => true);
    $url_data = determineActions($url_data);
    // Setup the linktree and page title (do it down here because the language files are now loaded..)
    $context['page_title'] = $txt['who_title'];
    $context['linktree'][] = array('url' => $scripturl . '?action=who', 'name' => $txt['who_title']);
    // Put it in the context variables.
    foreach ($context['members'] as $i => $member) {
        if ($member['id'] != 0) {
            $member['id'] = loadMemberContext($member['id']) ? $member['id'] : 0;
        }
        // Keep the IP that came from the database.
        $memberContext[$member['id']]['ip'] = $member['ip'];
        $context['members'][$i]['action'] = isset($url_data[$i]) ? $url_data[$i] : $txt['who_hidden'];
        $context['members'][$i] += $memberContext[$member['id']];
    }
    // Some people can't send personal messages...
    $context['can_send_pm'] = allowedTo('pm_send');
}
开发者ID:VBGAMER45,项目名称:SMFMods,代码行数:66,代码来源:Who.php

示例5: foreach

 *
 */
require_once $_SERVER['DOCUMENT_ROOT'] . '/functions.php';
require_once $link['root'] . 'classes/MailManager.php';
//Initalize Value
$from = "noreply@getmusicbee.com";
$pending_addon_count = 5;
$dashboard_link = "";
$official_link = "";
$memberContext = null;
//Clear any previously stored value
//Unfortunately we don't store user personal details such as email in website's database
//so get them from SMF using user ID
foreach (MailManager::getAdminEmailList() as $user) {
    loadMemberData($user['ID_MEMBER']);
    loadMemberContext($user['ID_MEMBER']);
}
$subject = "There are " . $pending_addon_count . " addons require your approval!";
$message = file_get_contents($link['root'] . 'pages/mail_templates/pending.addon.dashboard.html');
//now loop through member data and put all the valid email in an array
foreach ($memberContext as $user) {
    //Make sure the emails are valid
    if (!filter_var($user['email'], FILTER_VALIDATE_EMAIL) === false) {
        $bindedvalarray = array("{username}" => $user['username'], "{pending_request_count}" => $pending_addon_count, "{dashboard_link}" => $link['addon']['dashboard'], "{official_link}" => $link['home'], "{subject}" => $subject);
        if (MailManager::sendMail($user['email'], $from, "UTF-8", "text/html", $subject, $message, $bindedvalarray)) {
            //put some logging function to monitor
            echo "Mail delivered to " . $user['username'] . "<br/>";
        } else {
            //put some logging function to monitor
            echo "Mail Could not be delivered";
        }
开发者ID:Avik-B,项目名称:musicbee-website,代码行数:31,代码来源:mail.php

示例6: __construct

    function __construct($request, $total_items, $not_profile = false)
    {
        global $context, $txt, $user_info, $scripturl, $options, $memberContext, $modSettings;
        if (!isset($context['pageindex_multiplier'])) {
            $context['pageindex_multiplier'] = commonAPI::getMessagesPerPage();
        }
        $cb_name = isset($context['cb_name']) ? $context['cb_name'] : 'topics[]';
        while ($row = mysql_fetch_assoc($request)) {
            censorText($row['subject']);
            $this->topic_ids[] = $row['id_topic'];
            $f_post_mem_href = !empty($row['id_member']) ? URL::user($row['id_member'], $row['first_member_name']) : '';
            $t_href = URL::topic($row['id_topic'], $row['subject'], 0);
            $l_post_mem_href = !empty($row['id_member_updated']) ? URL::user($row['id_member_updated'], $row['last_real_name']) : '';
            $l_post_msg_href = URL::topic($row['id_topic'], $row['last_subject'], $user_info['is_guest'] ? !empty($options['view_newest_first']) ? 0 : (int) ($row['num_replies'] / $context['pageindex_multiplier']) * $context['pageindex_multiplier'] : 0, $user_info['is_guest'] ? true : false, $user_info['is_guest'] ? '' : '.msg' . $row['id_last_msg'], $user_info['is_guest'] ? '#msg' . $row['id_last_msg'] : '#new');
            $this->topiclist[$row['id_topic']] = array('id' => $row['id_topic'], 'id_member_started' => empty($row['id_member']) ? 0 : $row['id_member'], 'first_post' => array('id' => $row['id_first_msg'], 'member' => array('username' => $row['first_member_name'], 'name' => $row['first_member_name'], 'id' => empty($row['id_member']) ? 0 : $row['id_member'], 'href' => $f_post_mem_href, 'link' => !empty($row['id_member']) ? '<a onclick="getMcard(' . $row['id_member'] . ', $(this));return(false);" href="' . $f_post_mem_href . '" title="' . $txt['profile_of'] . ' ' . $row['first_member_name'] . '">' . $row['first_member_name'] . '</a>' : $row['first_member_name']), 'time' => timeformat($row['first_poster_time']), 'timestamp' => forum_time(true, $row['first_poster_time']), 'subject' => $row['subject'], 'icon' => $row['first_icon'], 'icon_url' => getPostIcon($row['first_icon']), 'href' => $t_href, 'link' => '<a href="' . $t_href . '">' . $row['subject'] . '</a>'), 'last_post' => array('id' => $row['id_last_msg'], 'member' => array('username' => $row['last_real_name'], 'name' => $row['last_real_name'], 'id' => $row['id_member_updated'], 'href' => $l_post_mem_href, 'link' => !empty($row['id_member_updated']) ? '<a onclick="getMcard(' . $row['id_member_updated'] . ', $(this));return(false);" href="' . $l_post_mem_href . '">' . $row['last_real_name'] . '</a>' : $row['last_real_name']), 'time' => timeformat($row['last_post_time']), 'timestamp' => forum_time(true, $row['last_post_time']), 'subject' => $row['last_subject'], 'href' => $l_post_msg_href, 'link' => '<a href="' . $l_post_msg_href . ($row['num_replies'] == 0 ? '' : ' rel="nofollow"') . '>' . $row['last_subject'] . '</a>'), 'checkbox_name' => $cb_name, 'subject' => $row['subject'], 'new' => $row['new_from'] <= $row['id_msg_modified'], 'new_from' => $row['new_from'], 'newtime' => $row['new_from'], 'updated' => timeformat($row['poster_time']), 'new_href' => $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['new_from'] . '#new', 'new_link' => '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['new_from'] . '#new">' . $row['subject'] . '</a>', 'replies' => comma_format($row['num_replies']), 'views' => comma_format($row['num_views']), 'approved' => $row['approved'], 'unapproved_posts' => $row['unapproved_posts'], 'is_old' => !empty($modSettings['oldTopicDays']) ? $context['time_now'] - $row['last_post_time'] > $modSettings['oldTopicDays'] * 86400 : false, 'is_posted_in' => false, 'prefix' => '', 'pages' => '', 'is_sticky' => !empty($modSettings['enableStickyTopics']) && !empty($row['is_sticky']), 'is_locked' => !empty($row['locked']), 'is_poll' => false, 'is_hot' => $row['num_replies'] >= $modSettings['hotTopicPosts'], 'is_very_hot' => $row['num_replies'] >= $modSettings['hotTopicVeryPosts'], 'board' => isset($row['id_board']) && !empty($row['id_board']) ? array('name' => $row['board_name'], 'id' => $row['id_board'], 'href' => URL::board($row['id_board'], $row['board_name'])) : array('name' => '', 'id' => 0, 'href' => ''));
            determineTopicClass($this->topiclist[$row['id_topic']]);
            if (!empty($row['id_member']) && ($row['id_member'] != $user_info['id'] || $not_profile)) {
                $this->users_to_load[$row['id_member']] = $row['id_member'];
            }
        }
        loadMemberData($this->users_to_load);
        foreach ($this->topiclist as &$topic) {
            if (!isset($memberContext[$topic['id_member_started']])) {
                loadMemberContext($topic['id_member_started']);
            }
            $topic['first_post']['member']['avatar'] =& $memberContext[$topic['id_member_started']]['avatar']['image'];
        }
        // figure out whether we have posted in a topic (but only if we are not the topic starter)
        if (!empty($modSettings['enableParticipation']) && !$user_info['is_guest'] && !empty($this->topic_ids)) {
            $result = smf_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 ' . count($this->topic_ids), array('current_member' => $user_info['id'], 'topic_list' => $this->topic_ids));
            while ($row = mysql_fetch_assoc($result)) {
                if ($this->topiclist[$row['id_topic']]['first_post']['member']['id'] != $user_info['id']) {
                    $this->topiclist[$row['id_topic']]['is_posted_in'] = true;
                }
            }
            mysql_free_result($result);
        }
    }
开发者ID:norv,项目名称:EosAlpha,代码行数:44,代码来源:CommonAPI.php

示例7: BuddiesShow

function BuddiesShow()
{
    global $smcFunc, $context, $user_profile, $memberContext, $txt;
    // approved buddies
    $buddies = array();
    $request = $smcFunc['db_query']('', '
		SELECT buddy_id 
		FROM {db_prefix}buddies 
		WHERE id_member = {int:id_member}
			AND approved = 1 
		ORDER BY position ASC, time_updated DESC', array('id_member' => $context['user']['id']));
    while ($row = $smcFunc['db_fetch_assoc']($request)) {
        $buddies[] = $row['buddy_id'];
    }
    $smcFunc['db_free_result']($request);
    // Load all the members up.
    loadMemberData($buddies, false, 'profile');
    $context['buddies'] = array();
    foreach ($buddies as $buddy) {
        loadMemberContext($buddy);
        $context['buddies'][$buddy] = $memberContext[$buddy];
    }
    // unapproved buddies
    $buddies = array();
    $request = $smcFunc['db_query']('', '
		SELECT buddy_id 
		FROM {db_prefix}buddies 
		WHERE id_member = {int:id_member}
			AND approved = 0 
			AND requested <> {int:requested}
		ORDER BY position ASC, time_updated DESC', array('id_member' => $context['user']['id'], 'requested' => $context['user']['id']));
    while ($row = $smcFunc['db_fetch_assoc']($request)) {
        $buddies[] = $row['buddy_id'];
    }
    $smcFunc['db_free_result']($request);
    if (count($buddies) > 0) {
        // Load all the members up.
        loadMemberData($buddies, false, 'profile');
        $context['unapproved'] = array();
        foreach ($buddies as $buddy) {
            loadMemberContext($buddy);
            $context['unapproved'][$buddy] = $memberContext[$buddy];
        }
    }
    // pending buddies
    $buddies = array();
    $request = $smcFunc['db_query']('', '
		SELECT id_member 
		FROM {db_prefix}buddies 
		WHERE buddy_id = {int:buddy_id}
			AND approved = 0 
			AND requested = {int:requested}
		ORDER BY position ASC, time_updated DESC', array('buddy_id' => $context['user']['id'], 'requested' => $context['user']['id']));
    while ($row = $smcFunc['db_fetch_assoc']($request)) {
        $buddies[] = $row['id_member'];
    }
    $smcFunc['db_free_result']($request);
    if (count($buddies) > 0) {
        // Load all the members up.
        loadMemberData($buddies, false, 'profile');
        $context['pending'] = array();
        foreach ($buddies as $buddy) {
            loadMemberContext($buddy);
            $context['pending'][$buddy] = $memberContext[$buddy];
        }
    }
    $_GET['action'] = 'profile';
    // £ust for the tab...
    $context['page_title'] = $txt['buddy_center'];
    $context['sub_template'] = 'buddy_center';
}
开发者ID:snrj,项目名称:smf-maximum-profile,代码行数:71,代码来源:Buddies.php

示例8: BanCheckUser

/**
 * Used to see if a user is banned
 *
 * - Checks banning by ip, hostname, email or member id
 *
 * @package Bans
 * @param int $memID
 * @param string $hostname
 * @param string $email
 */
function BanCheckUser($memID, $hostname = '', $email = '')
{
    global $memberContext, $scripturl, $txt;
    $db = database();
    $bans = array();
    // This is a valid member id, we at least need that
    if (loadMemberContext($memID) && isset($memberContext[$memID])) {
        $ban_query = array();
        $ban_query_vars = array('time' => time());
        // Member id and ip
        $ban_query[] = 'id_member = ' . $memID;
        require_once SOURCEDIR . '/Security.php';
        $ban_query[] = constructBanQueryIP($memberContext[$memID]['ip']);
        // Do we have a hostname?
        if (!empty($hostname)) {
            $ban_query[] = '({string:hostname} LIKE hostname)';
            $ban_query_vars['hostname'] = $hostname;
        }
        // Check their email as well...
        if (strlen($email) != 0) {
            $ban_query[] = '({string:email} LIKE bi.email_address)';
            $ban_query_vars['email'] = $email;
        }
        // So... are they banned?  Dying to know!
        $request = $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);
        $bans = array();
        while ($row = $db->fetch_assoc($request)) {
            // Work out what restrictions we actually have.
            $ban_restrictions = array();
            foreach (array('access', 'register', 'login', 'post') as $type) {
                if ($row['cannot_' . $type]) {
                    $ban_restrictions[] = $txt['ban_type_' . $type];
                }
            }
            // No actual ban in place?
            if (empty($ban_restrictions)) {
                continue;
            }
            // Prepare the link for context.
            $ban_explanation = sprintf($txt['user_cannot_due_to'], implode(', ', $ban_restrictions), '<a href="' . $scripturl . '?action=admin;area=ban;sa=edit;bg=' . $row['id_ban_group'] . '">' . $row['name'] . '</a>');
            $bans[$row['id_ban_group']] = array('reason' => empty($row['reason']) ? '' : '<br /><br /><strong>' . $txt['ban_reason'] . ':</strong> ' . $row['reason'], 'cannot' => array('access' => !empty($row['cannot_access']), 'register' => !empty($row['cannot_register']), 'post' => !empty($row['cannot_post']), 'login' => !empty($row['cannot_login'])), 'explanation' => $ban_explanation);
        }
        $db->free_result($request);
    }
    return $bans;
}
开发者ID:KeiroD,项目名称:Elkarte,代码行数:61,代码来源:Bans.subs.php

示例9: MessageSearch2


//.........这里部分代码省略.........
    $context['params'] = base64_encode(implode('|"|', $context['params']));
    // Compile the subject query part.
    $andQueryParts = array();
    foreach ($searchWords as $index => $word) {
        if ($word == '') {
            continue;
        }
        if ($search_params['subject_only']) {
            $andQueryParts[] = "pm.subject" . (in_array($word, $excludedWords) ? ' NOT' : '') . " LIKE '%" . strtr($word, array('_' => '\\_', '%' => '\\%')) . "%'";
        } else {
            $andQueryParts[] = '(pm.subject' . (in_array($word, $excludedWords) ? ' NOT' : '') . " LIKE '%" . strtr($word, array('_' => '\\_', '%' => '\\%')) . "%' " . (in_array($word, $excludedWords) ? 'AND pm.body NOT' : 'OR pm.body') . " LIKE '%" . strtr($word, array('_' => '\\_', '%' => '\\%')) . "%')";
        }
    }
    $searchQuery = ' 1';
    if (!empty($andQueryParts)) {
        $searchQuery = implode(!empty($search_params['searchtype']) && $search_params['searchtype'] == 2 ? ' OR ' : ' AND ', $andQueryParts);
    }
    // If we have errors - return back to the first screen...
    if (!empty($context['search_errors'])) {
        $_REQUEST['params'] = $context['params'];
        return MessageSearch();
    }
    // Get the amount of results.
    $request = db_query("\n\t\tSELECT COUNT(*)\n\t\tFROM ({$db_prefix}pm_recipients AS pmr, {$db_prefix}personal_messages AS pm)\n\t\tWHERE pm.ID_PM = pmr.ID_PM" . ($context['folder'] == 'inbox' ? "\n\t\t\tAND pmr.ID_MEMBER = {$ID_MEMBER}\n\t\t\tAND pmr.deleted = 0" : "\n\t\t\tAND pm.ID_MEMBER_FROM = {$ID_MEMBER}\n\t\t\tAND pm.deletedBySender = 0") . "\n\t\t\t{$userQuery}{$labelQuery}\n\t\t\tAND ({$searchQuery})", __FILE__, __LINE__);
    list($numResults) = mysql_fetch_row($request);
    mysql_free_result($request);
    // Get all the matching messages... using standard search only (No caching and the like!)
    // !!! This doesn't support outbox searching yet.
    $request = db_query("\n\t\tSELECT pm.ID_PM, pm.ID_MEMBER_FROM\n\t\tFROM ({$db_prefix}pm_recipients AS pmr, {$db_prefix}personal_messages AS pm)\n\t\tWHERE pm.ID_PM = pmr.ID_PM" . ($context['folder'] == 'inbox' ? "\n\t\t\tAND pmr.ID_MEMBER = {$ID_MEMBER}\n\t\t\tAND pmr.deleted = 0" : "\n\t\t\tAND pm.ID_MEMBER_FROM = {$ID_MEMBER}\n\t\t\tAND pm.deletedBySender = 0") . "\n\t\t\t{$userQuery}{$labelQuery}\n\t\t\tAND ({$searchQuery})\n\t\tORDER BY {$search_params['sort']} {$search_params['sort_dir']}\n\t\tLIMIT {$context['start']}, {$modSettings['search_results_per_page']}", __FILE__, __LINE__);
    $foundMessages = array();
    $posters = array();
    while ($row = mysql_fetch_assoc($request)) {
        $foundMessages[] = $row['ID_PM'];
        $posters[] = $row['ID_MEMBER_FROM'];
    }
    mysql_free_result($request);
    // Load the users...
    $posters = array_unique($posters);
    if (!empty($posters)) {
        loadMemberData($posters);
    }
    // Sort out the page index.
    $context['page_index'] = constructPageIndex($scripturl . '?action=pm;sa=search2;params=' . $context['params'], $_GET['start'], $numResults, $modSettings['search_results_per_page'], false);
    $context['message_labels'] = array();
    $context['message_replied'] = array();
    $context['personal_messages'] = array();
    if (!empty($foundMessages)) {
        // Now get recipients (but don't include bcc-recipients for your inbox, you're not supposed to know :P!)
        $request = db_query("\n\t\t\tSELECT\n\t\t\t\tpmr.ID_PM, mem_to.ID_MEMBER AS ID_MEMBER_TO, mem_to.realName AS toName,\n\t\t\t\tpmr.bcc, pmr.labels, pmr.is_read\n\t\t\tFROM {$db_prefix}pm_recipients AS pmr\n\t\t\t\tLEFT JOIN {$db_prefix}members AS mem_to ON (mem_to.ID_MEMBER = pmr.ID_MEMBER)\n\t\t\tWHERE pmr.ID_PM IN (" . implode(', ', $foundMessages) . ")", __FILE__, __LINE__);
        while ($row = mysql_fetch_assoc($request)) {
            if ($context['folder'] == 'outbox' || empty($row['bcc'])) {
                $recipients[$row['ID_PM']][empty($row['bcc']) ? 'to' : 'bcc'][] = empty($row['ID_MEMBER_TO']) ? $txt[28] : '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER_TO'] . '">' . $row['toName'] . '</a>';
            }
            if ($row['ID_MEMBER_TO'] == $ID_MEMBER && $context['folder'] != 'outbox') {
                $context['message_replied'][$row['ID_PM']] = $row['is_read'] & 2;
                $row['labels'] = $row['labels'] == '' ? array() : explode(',', $row['labels']);
                // This is a special need for linking to messages.
                foreach ($row['labels'] as $v) {
                    if (isset($context['labels'][(int) $v])) {
                        $context['message_labels'][$row['ID_PM']][(int) $v] = array('id' => $v, 'name' => $context['labels'][(int) $v]['name']);
                    }
                    // Here we find the first label on a message - for linking to posts in results
                    if (!isset($context['first_label'][$row['ID_PM']]) && !in_array('-1', $row['labels'])) {
                        $context['first_label'][$row['ID_PM']] = (int) $v;
                    }
                }
            }
        }
        // Prepare the query for the callback!
        $request = db_query("\n\t\t\tSELECT pm.ID_PM, pm.subject, pm.ID_MEMBER_FROM, pm.body, pm.msgtime, pm.fromName\n\t\t\tFROM {$db_prefix}personal_messages AS pm\n\t\t\tWHERE pm.ID_PM IN (" . implode(',', $foundMessages) . ")\n\t\t\tORDER BY {$search_params['sort']} {$search_params['sort_dir']}\n\t\t\tLIMIT " . count($foundMessages), __FILE__, __LINE__);
        $counter = 0;
        while ($row = mysql_fetch_assoc($request)) {
            // If there's no message subject, use the default.
            $row['subject'] = $row['subject'] == '' ? $txt[24] : $row['subject'];
            // Load this posters context info, if it ain't there then fill in the essentials...
            if (!loadMemberContext($row['ID_MEMBER_FROM'])) {
                $memberContext[$row['ID_MEMBER_FROM']]['name'] = $row['fromName'];
                $memberContext[$row['ID_MEMBER_FROM']]['id'] = 0;
                $memberContext[$row['ID_MEMBER_FROM']]['group'] = $txt[28];
                $memberContext[$row['ID_MEMBER_FROM']]['link'] = $row['fromName'];
                $memberContext[$row['ID_MEMBER_FROM']]['email'] = '';
                $memberContext[$row['ID_MEMBER_FROM']]['hide_email'] = true;
                $memberContext[$row['ID_MEMBER_FROM']]['is_guest'] = true;
            }
            // Censor anything we don't want to see...
            censorText($row['body']);
            censorText($row['subject']);
            // Parse out any BBC...
            $row['body'] = parse_bbc($row['body'], true, 'pm' . $row['ID_PM']);
            $href = $scripturl . '?action=pm;f=' . $context['folder'] . (isset($context['first_label'][$row['ID_PM']]) ? ';l=' . $context['first_label'][$row['ID_PM']] : '') . ';pmid=' . $row['ID_PM'] . '#msg' . $row['ID_PM'];
            $context['personal_messages'][] = array('id' => $row['ID_PM'], 'member' => &$memberContext[$row['ID_MEMBER_FROM']], 'subject' => $row['subject'], 'body' => $row['body'], 'time' => timeformat($row['msgtime']), 'recipients' => &$recipients[$row['ID_PM']], 'labels' => &$context['message_labels'][$row['ID_PM']], 'fully_labeled' => count($context['message_labels'][$row['ID_PM']]) == count($context['labels']), 'is_replied_to' => &$context['message_replied'][$row['ID_PM']], 'href' => $href, 'link' => '<a href="' . $href . '">' . $row['subject'] . '</a>', 'counter' => ++$counter);
        }
        mysql_free_result($request);
    }
    // Finish off the context.
    $context['page_title'] = $txt['pm_search_title'];
    $context['sub_template'] = 'search_results';
    $context['pm_area'] = 'search';
    $context['linktree'][] = array('url' => $scripturl . '?action=pm;sa=search', 'name' => $txt['pm_search_bar_title']);
}
开发者ID:VBGAMER45,项目名称:SMFMods,代码行数:101,代码来源:PersonalMessage.php

示例10: editBuddies

function editBuddies($memID)
{
    global $txt, $scripturl, $modSettings, $db_prefix;
    global $context, $user_profile, $memberContext, $func;
    // Do a quick check to ensure people aren't getting here illegally!
    if (!$context['user']['is_owner'] || empty($modSettings['enable_buddylist'])) {
        fatal_lang_error(1, false);
    }
    // !!! No page_title.
    // For making changes!
    $buddiesArray = explode(',', $user_profile[$memID]['buddy_list']);
    foreach ($buddiesArray as $k => $dummy) {
        if ($dummy == '') {
            unset($buddiesArray[$k]);
        }
    }
    // Removing a buddy?
    if (isset($_GET['remove'])) {
        // Heh, I'm lazy, do it the easy way...
        foreach ($buddiesArray as $key => $buddy) {
            if ($buddy == (int) $_GET['remove']) {
                unset($buddiesArray[$key]);
            }
        }
        // Make the changes.
        $user_profile[$memID]['buddy_list'] = implode(',', $buddiesArray);
        updateMemberData($memID, array('buddy_list' => "'" . $user_profile[$memID]['buddy_list'] . "'"));
        // Redirect off the page because we don't like all this ugly query stuff to stick in the history.
        redirectexit('action=profile;u=' . $memID . ';sa=editBuddies');
    } elseif (isset($_POST['new_buddy'])) {
        // Prepare the string for extraction...
        $_POST['new_buddy'] = strtr(addslashes($func['htmlspecialchars'](stripslashes($_POST['new_buddy']), ENT_QUOTES)), array('&quot;' => '"'));
        preg_match_all('~"([^"]+)"~', $_POST['new_buddy'], $matches);
        $new_buddies = array_unique(array_merge($matches[1], explode(',', preg_replace('~"([^"]+)"~', '', $_POST['new_buddy']))));
        foreach ($new_buddies as $k => $dummy) {
            $new_buddies[$k] = strtr(trim($new_buddies[$k]), array('\\\'' => '&#039;'));
            if (strlen($new_buddies[$k]) == 0) {
                unset($new_buddies[$k]);
            }
        }
        if (!empty($new_buddies)) {
            // Now find out the ID_MEMBER of the buddy.
            $request = db_query("\n\t\t\t\tSELECT ID_MEMBER\n\t\t\t\tFROM {$db_prefix}members\n\t\t\t\tWHERE memberName IN ('" . implode("','", $new_buddies) . "') OR realName IN ('" . implode("','", $new_buddies) . "')\n\t\t\t\tLIMIT " . count($new_buddies), __FILE__, __LINE__);
            // Add the new member to the buddies array.
            while ($row = mysql_fetch_assoc($request)) {
                $buddiesArray[] = (int) $row['ID_MEMBER'];
            }
            mysql_free_result($request);
            // Now update the current users buddy list.
            $user_profile[$memID]['buddy_list'] = implode(',', $buddiesArray);
            updateMemberData($memID, array('buddy_list' => "'" . $user_profile[$memID]['buddy_list'] . "'"));
        }
        // Back to the buddy list!
        redirectexit('action=profile;u=' . $memID . ';sa=editBuddies');
    }
    // Get all the users "buddies"...
    $buddies = array();
    if (!empty($buddiesArray)) {
        $result = db_query("\n\t\t\tSELECT ID_MEMBER\n\t\t\tFROM {$db_prefix}members\n\t\t\tWHERE ID_MEMBER IN (" . implode(', ', $buddiesArray) . ")\n\t\t\tORDER BY realName\n\t\t\tLIMIT " . (substr_count($user_profile[$memID]['buddy_list'], ',') + 1), __FILE__, __LINE__);
        while ($row = mysql_fetch_assoc($result)) {
            $buddies[] = $row['ID_MEMBER'];
        }
        mysql_free_result($result);
    }
    $context['buddy_count'] = count($buddies);
    // Load all the members up.
    loadMemberData($buddies, false, 'profile');
    // Setup the context for each buddy.
    $context['buddies'] = array();
    foreach ($buddies as $buddy) {
        loadMemberContext($buddy);
        $context['buddies'][$buddy] = $memberContext[$buddy];
    }
}
开发者ID:alencarmo,项目名称:OCF,代码行数:74,代码来源:Profile.php

示例11: editIgnoreList

function editIgnoreList($memID)
{
    global $txt, $scripturl, $modSettings;
    global $context, $user_profile, $memberContext, $smcFunc;
    // For making changes!
    $ignoreArray = explode(',', $user_profile[$memID]['pm_ignore_list']);
    foreach ($ignoreArray as $k => $dummy) {
        if ($dummy == '') {
            unset($ignoreArray[$k]);
        }
    }
    // Removing a member from the ignore list?
    if (isset($_GET['remove'])) {
        checkSession('get');
        // Heh, I'm lazy, do it the easy way...
        foreach ($ignoreArray as $key => $id_remove) {
            if ($id_remove == (int) $_GET['remove']) {
                unset($ignoreArray[$key]);
            }
        }
        // Make the changes.
        $user_profile[$memID]['pm_ignore_list'] = implode(',', $ignoreArray);
        updateMemberData($memID, array('pm_ignore_list' => $user_profile[$memID]['pm_ignore_list']));
        // Redirect off the page because we don't like all this ugly query stuff to stick in the history.
        redirectexit('action=profile;area=lists;sa=ignore;u=' . $memID);
    } elseif (isset($_POST['new_ignore'])) {
        // Prepare the string for extraction...
        $_POST['new_ignore'] = strtr($smcFunc['htmlspecialchars']($_POST['new_ignore'], ENT_QUOTES), array('&quot;' => '"'));
        preg_match_all('~"([^"]+)"~', $_POST['new_ignore'], $matches);
        $new_entries = array_unique(array_merge($matches[1], explode(',', preg_replace('~"[^"]+"~', '', $_POST['new_ignore']))));
        foreach ($new_entries as $k => $dummy) {
            $new_entries[$k] = strtr(trim($new_entries[$k]), array('\'' => '&#039;'));
            if (strlen($new_entries[$k]) == 0 || in_array($new_entries[$k], array($user_profile[$memID]['member_name'], $user_profile[$memID]['real_name']))) {
                unset($new_entries[$k]);
            }
        }
        if (!empty($new_entries)) {
            // Now find out the id_member for the members in question.
            $request = $smcFunc['db_query']('', '
				SELECT id_member
				FROM {db_prefix}members
				WHERE member_name IN ({array_string:new_entries}) OR real_name IN ({array_string:new_entries})
				LIMIT {int:count_new_entries}', array('new_entries' => $new_entries, 'count_new_entries' => count($new_entries)));
            // Add the new member to the buddies array.
            while ($row = $smcFunc['db_fetch_assoc']($request)) {
                $ignoreArray[] = (int) $row['id_member'];
            }
            $smcFunc['db_free_result']($request);
            // Now update the current users buddy list.
            $user_profile[$memID]['pm_ignore_list'] = implode(',', $ignoreArray);
            updateMemberData($memID, array('pm_ignore_list' => $user_profile[$memID]['pm_ignore_list']));
        }
        // Back to the list of pityful people!
        redirectexit('action=profile;area=lists;sa=ignore;u=' . $memID);
    }
    // Initialise the list of members we're ignoring.
    $ignored = array();
    if (!empty($ignoreArray)) {
        $result = $smcFunc['db_query']('', '
			SELECT id_member
			FROM {db_prefix}members
			WHERE id_member IN ({array_int:ignore_list})
			ORDER BY real_name
			LIMIT {int:ignore_list_count}', array('ignore_list' => $ignoreArray, 'ignore_list_count' => substr_count($user_profile[$memID]['pm_ignore_list'], ',') + 1));
        while ($row = $smcFunc['db_fetch_assoc']($result)) {
            $ignored[] = $row['id_member'];
        }
        $smcFunc['db_free_result']($result);
    }
    $context['ignore_count'] = count($ignored);
    // Load all the members up.
    loadMemberData($ignored, false, 'profile');
    // Setup the context for each buddy.
    $context['ignore_list'] = array();
    foreach ($ignored as $ignore_member) {
        loadMemberContext($ignore_member);
        $context['ignore_list'][$ignore_member] = $memberContext[$ignore_member];
    }
}
开发者ID:valek0972,项目名称:hackits,代码行数:79,代码来源:Profile-Modify.php

示例12: shd_prepare_reply_context

function shd_prepare_reply_context()
{
    global $settings, $txt, $modSettings, $scripturl, $options, $user_info, $smcFunc;
    global $memberContext, $context, $reply_request;
    if (empty($reply_request)) {
        return false;
    }
    $message = $smcFunc['db_fetch_assoc']($reply_request);
    if (!$message) {
        $smcFunc['db_free_result']($reply_request);
        return false;
    }
    if (!loadMemberContext($message['id_member'], true)) {
        // Notice this information isn't used anywhere else....
        $memberContext[$message['id_member']]['name'] = $message['poster_name'];
        $memberContext[$message['id_member']]['id'] = 0;
        $memberContext[$message['id_member']]['group'] = $txt['guest_title'];
        $memberContext[$message['id_member']]['link'] = $message['poster_name'];
        $memberContext[$message['id_member']]['email'] = $message['poster_email'];
        $memberContext[$message['id_member']]['show_email'] = showEmailAddress(true, 0);
        $memberContext[$message['id_member']]['is_guest'] = true;
        $memberContext[$message['id_member']]['group_stars'] = '';
    }
    $memberContext[$message['id_member']]['ip'] = $message['poster_ip'];
    censorText($message['body']);
    $message['body'] = shd_format_text($message['body'], $message['smileys_enabled'], 'shd_reply_' . $message['id_msg']);
    $output = array('id' => $message['id_msg'], 'member' => &$memberContext[$message['id_member']], 'time' => timeformat($message['poster_time']), 'timestamp' => forum_time(true, $message['poster_time']), 'body' => $message['body'], 'is_staff' => !empty($context['shd_is_staff'][$message['id_member']]), 'can_edit' => shd_allowed_to('shd_edit_reply_any', $context['ticket_form']['dept']) || $message['id_member'] == $user_info['id'] && shd_allowed_to('shd_edit_reply_own', $context['ticket_form']['dept']), 'ip_address' => $message['poster_ip']);
    if (!empty($message['modified_time'])) {
        $output['modified'] = array('time' => timeformat($message['modified_time']), 'timestamp' => forum_time(true, $message['modified_time']), 'id' => !empty($user_profile[$message['modified_member']]) ? $message['modified_member'] : 0, 'name' => !empty($user_profile[$message['modified_member']]) ? $user_profile[$message['modified_member']]['real_name'] : $message['modified_name']);
        $output['modified']['link'] = shd_profile_link($output['modified']['name'], $output['modified']['id']);
    }
    return $output;
}
开发者ID:wintstar,项目名称:Testing,代码行数:33,代码来源:SimpleDesk-Post.php

示例13: template_boardindex_outer_below

function template_boardindex_outer_below()
{
    global $modSettings;
    // Info center collapse object.
    echo '</td></tr></tbody></table>';
    if (!empty($modSettings['sideright'])) {
        echo '<td valign="top" id="upshrinkRightBarTD">
				<div id="upshrinkRightBar" style="width:', $modSettings['siderightwidth'] ? $modSettings['siderightwidth'] : '200px', '; overflow:hidden;">
				', empty($modSettings['sideright1']) ? '' : '<div class="cat_bar"><h3 class="catbg">' . $modSettings['righthtmlbaslik'] . '</h3></div>' . $modSettings['sideright1'] . '', '
				', empty($modSettings['siderightphp']) ? '' : '<div class="cat_bar"><h3 class="catbg">' . $modSettings['rightphpbaslik'] . '</h3></div>';
        eval($modSettings['siderightphp']);
        if (!empty($modSettings['siderighthaberetkin'])) {
            $array = ssi_boardNews($modSettings['siderighthaber'], $modSettings['siderightsay'], null, 1000, 'array');
            echo '<div class="cat_bar">
							<h3 class="catbg">', $modSettings['rbaslik'], '</h3>
						</div>';
            global $memberContext;
            foreach ($array as $news) {
                loadMemberData($news['poster']['id']);
                loadMemberContext($news['poster']['id']);
                echo '<div class="sidehaber">
								<div class="sideBaslik">
								
								<h3><a href="', $news['href'], '"><span class="generic_icons sort_up"></span> ', shorten_subject($news['subject'], 30), '</a></h3>
								</div>
								<div class="snrj"> ', $memberContext[$news['poster']['id']]['avatar']['image'], ' 
								<p>', $txt['by'], '', $news['poster']['link'], '</p>
								</div>
								</div>';
            }
        }
        echo '</div>
			</td>
			<td valign="top">
			<button type="button" onclick="rightPanel.toggle();" id="teknoright"></button>
			</td>';
    }
    echo '</td>
		</tr></tbody></table>';
    template_info_center();
}
开发者ID:CeeMoo,项目名称:pisi,代码行数:41,代码来源:BoardIndex.template.php

示例14: printMemberListRows

function printMemberListRows($request)
{
    global $scripturl, $txt, $user_info, $modSettings;
    global $context, $settings, $memberContext, $smcFunc;
    // Get the most posts.
    $result = $smcFunc['db_query']('', '
		SELECT MAX(posts)
		FROM {db_prefix}members', array());
    list($MOST_POSTS) = $smcFunc['db_fetch_row']($result);
    $smcFunc['db_free_result']($result);
    // Avoid division by zero...
    if ($MOST_POSTS == 0) {
        $MOST_POSTS = 1;
    }
    $members = array();
    while ($row = $smcFunc['db_fetch_assoc']($request)) {
        $members[] = $row['id_member'];
    }
    // Load all the members for display.
    loadMemberData($members);
    $context['members'] = array();
    foreach ($members as $member) {
        if (!loadMemberContext($member)) {
            continue;
        }
        $context['members'][$member] = $memberContext[$member];
        $context['members'][$member]['post_percent'] = round($context['members'][$member]['real_posts'] * 100 / $MOST_POSTS);
        $context['members'][$member]['registered_date'] = strftime('%Y-%m-%d', $context['members'][$member]['registered_timestamp']);
    }
}
开发者ID:abdulhadikaryana,项目名称:kebudayaan,代码行数:30,代码来源:Memberlist.php

示例15: prepareDisplayContext_callback

 /**
  * Callback for the message display.
  * It actually gets and prepares the message context.
  * This method will start over from the beginning if reset is set to true, which is
  * useful for showing an index before or after the posts.
  *
  * @param bool $reset default false.
  */
 public function prepareDisplayContext_callback($reset = false)
 {
     global $settings, $txt, $modSettings, $scripturl, $options, $user_info;
     global $memberContext, $context, $messages_request, $topic;
     static $counter = null;
     // If the query returned false, bail.
     if ($messages_request == false) {
         return false;
     }
     // Remember which message this is.  (ie. reply #83)
     if ($counter === null || $reset) {
         $counter = $context['start'];
     }
     // Start from the beginning...
     if ($reset) {
         return currentContext($messages_request, $reset);
     }
     // Attempt to get the next message.
     $message = currentContext($messages_request);
     if (!$message) {
         return false;
     }
     // $context['icon_sources'] says where each icon should come from - here we set up the ones which will always exist!
     if (empty($context['icon_sources'])) {
         require_once SUBSDIR . '/MessageIndex.subs.php';
         $context['icon_sources'] = MessageTopicIcons();
     }
     // Message Icon Management... check the images exist.
     if (empty($modSettings['messageIconChecks_disable'])) {
         // If the current icon isn't known, then we need to do something...
         if (!isset($context['icon_sources'][$message['icon']])) {
             $context['icon_sources'][$message['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $message['icon'] . '.png') ? 'images_url' : 'default_images_url';
         }
     } elseif (!isset($context['icon_sources'][$message['icon']])) {
         $context['icon_sources'][$message['icon']] = 'images_url';
     }
     // If you're a lazy bum, you probably didn't give a subject...
     $message['subject'] = $message['subject'] != '' ? $message['subject'] : $txt['no_subject'];
     // Are you allowed to remove at least a single reply?
     $context['can_remove_post'] |= allowedTo('delete_own') && (empty($modSettings['edit_disable_time']) || $message['poster_time'] + $modSettings['edit_disable_time'] * 60 >= time()) && $message['id_member'] == $user_info['id'];
     // Have you liked this post, can you?
     $message['you_liked'] = !empty($context['likes'][$message['id_msg']]['member']) && isset($context['likes'][$message['id_msg']]['member'][$user_info['id']]);
     $message['use_likes'] = allowedTo('like_posts') && ($message['id_member'] != $user_info['id'] || !empty($modSettings['likeAllowSelf'])) && (empty($modSettings['likeMinPosts']) ? true : $modSettings['likeMinPosts'] <= $user_info['posts']);
     $message['like_count'] = !empty($context['likes'][$message['id_msg']]['count']) ? $context['likes'][$message['id_msg']]['count'] : 0;
     // If it couldn't load, or the user was a guest.... someday may be done with a guest table.
     if (!loadMemberContext($message['id_member'], true)) {
         // Notice this information isn't used anywhere else....
         $memberContext[$message['id_member']]['name'] = $message['poster_name'];
         $memberContext[$message['id_member']]['id'] = 0;
         $memberContext[$message['id_member']]['group'] = $txt['guest_title'];
         $memberContext[$message['id_member']]['link'] = $message['poster_name'];
         $memberContext[$message['id_member']]['email'] = $message['poster_email'];
         $memberContext[$message['id_member']]['show_email'] = showEmailAddress(true, 0);
         $memberContext[$message['id_member']]['is_guest'] = true;
     } else {
         $memberContext[$message['id_member']]['can_view_profile'] = allowedTo('profile_view_any') || $message['id_member'] == $user_info['id'] && allowedTo('profile_view_own');
         $memberContext[$message['id_member']]['is_topic_starter'] = $message['id_member'] == $context['topic_starter_id'];
         $memberContext[$message['id_member']]['can_see_warning'] = !isset($context['disabled_fields']['warning_status']) && $memberContext[$message['id_member']]['warning_status'] && ($context['user']['can_mod'] || !$user_info['is_guest'] && !empty($modSettings['warning_show']) && ($modSettings['warning_show'] > 1 || $message['id_member'] == $user_info['id']));
     }
     $memberContext[$message['id_member']]['ip'] = $message['poster_ip'];
     $memberContext[$message['id_member']]['show_profile_buttons'] = $settings['show_profile_buttons'] && (!empty($memberContext[$message['id_member']]['can_view_profile']) || !empty($memberContext[$message['id_member']]['website']['url']) && !isset($context['disabled_fields']['website']) || in_array($memberContext[$message['id_member']]['show_email'], array('yes', 'yes_permission_override', 'no_through_forum')) || $context['can_send_pm']);
     // Do the censor thang.
     censorText($message['body']);
     censorText($message['subject']);
     // Run BBC interpreter on the message.
     $message['body'] = parse_bbc($message['body'], $message['smileys_enabled'], $message['id_msg']);
     // Compose the memory eat- I mean message array.
     require_once SUBSDIR . '/Attachments.subs.php';
     $output = array('attachment' => loadAttachmentContext($message['id_msg']), 'alternate' => $counter % 2, 'id' => $message['id_msg'], 'href' => $scripturl . '?topic=' . $topic . '.msg' . $message['id_msg'] . '#msg' . $message['id_msg'], 'link' => '<a href="' . $scripturl . '?topic=' . $topic . '.msg' . $message['id_msg'] . '#msg' . $message['id_msg'] . '" rel="nofollow">' . $message['subject'] . '</a>', 'member' => &$memberContext[$message['id_member']], 'icon' => $message['icon'], 'icon_url' => $settings[$context['icon_sources'][$message['icon']]] . '/post/' . $message['icon'] . '.png', 'subject' => $message['subject'], 'time' => standardTime($message['poster_time']), 'html_time' => htmlTime($message['poster_time']), 'timestamp' => forum_time(true, $message['poster_time']), 'counter' => $counter, 'modified' => array('time' => standardTime($message['modified_time']), 'html_time' => htmlTime($message['modified_time']), 'timestamp' => forum_time(true, $message['modified_time']), 'name' => $message['modified_name']), 'body' => $message['body'], 'new' => empty($message['is_read']), 'approved' => $message['approved'], 'first_new' => isset($context['start_from']) && $context['start_from'] == $counter, 'is_ignored' => !empty($modSettings['enable_buddylist']) && in_array($message['id_member'], $context['user']['ignoreusers']), 'is_message_author' => $message['id_member'] == $user_info['id'], 'can_approve' => !$message['approved'] && $context['can_approve'], 'can_unapprove' => !empty($modSettings['postmod_active']) && $context['can_approve'] && $message['approved'], 'can_modify' => (!$context['is_locked'] || allowedTo('moderate_board')) && (allowedTo('modify_any') || allowedTo('modify_replies') && $context['user']['started'] || allowedTo('modify_own') && $message['id_member'] == $user_info['id'] && (empty($modSettings['edit_disable_time']) || !$message['approved'] || $message['poster_time'] + $modSettings['edit_disable_time'] * 60 > time())), 'can_remove' => allowedTo('delete_any') || allowedTo('delete_replies') && $context['user']['started'] || allowedTo('delete_own') && $message['id_member'] == $user_info['id'] && (empty($modSettings['edit_disable_time']) || $message['poster_time'] + $modSettings['edit_disable_time'] * 60 > time()), 'can_see_ip' => allowedTo('moderate_forum') || $message['id_member'] == $user_info['id'] && !empty($user_info['id']), 'can_like' => $message['use_likes'] && !$message['you_liked'], 'can_unlike' => $message['use_likes'] && $message['you_liked'], 'like_counter' => $message['like_count'], 'likes_enabled' => !empty($modSettings['likes_enabled']) && ($message['use_likes'] || $message['like_count'] != 0));
     if (!empty($output['modified']['name'])) {
         $output['modified']['last_edit_text'] = sprintf($txt['last_edit_by'], $output['modified']['time'], $output['modified']['name'], standardTime($output['modified']['timestamp']));
     }
     if (!empty($output['member']['karma']['allow'])) {
         $output['member']['karma'] += array('applaud_url' => $scripturl . '?action=karma;sa=applaud;uid=' . $output['member']['id'] . ';topic=' . $context['current_topic'] . '.' . $context['start'] . ';m=' . $output['id'] . ';' . $context['session_var'] . '=' . $context['session_id'], 'smite_url' => $scripturl . '?action=karma;sa=smite;uid=' . $output['member']['id'] . ';topic=' . $context['current_topic'] . '.' . $context['start'] . ';m=' . $output['id'] . ';' . $context['session_var'] . '=' . $context['session_id']);
     }
     call_integration_hook('integrate_prepare_display_context', array(&$output, &$message));
     $counter++;
     return $output;
 }
开发者ID:scripple,项目名称:Elkarte,代码行数:87,代码来源:Display.controller.php


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