本文整理汇总了PHP中loadMemberData函数的典型用法代码示例。如果您正苦于以下问题:PHP loadMemberData函数的具体用法?PHP loadMemberData怎么用?PHP loadMemberData使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了loadMemberData函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: currentMemberID
/**
* Find the ID of the "current" member
*
* @param boolean $fatal if the function ends in a fatal error in case of problems (default true)
* @param boolean $reload_id if true the already set value is ignored (default false)
*
* @return mixed and integer if no error, false in case of problems if $fatal is false
*/
function currentMemberID($fatal = true, $reload_id = false)
{
global $user_info;
static $memID;
// If we already know who we're dealing with
if (isset($memID) && !$reload_id) {
return $memID;
}
// Did we get the user by name...
if (isset($_REQUEST['user'])) {
$memberResult = loadMemberData($_REQUEST['user'], true, 'profile');
} elseif (!empty($_REQUEST['u'])) {
$memberResult = loadMemberData((int) $_REQUEST['u'], false, 'profile');
} else {
$memberResult = loadMemberData($user_info['id'], false, 'profile');
}
// Check if loadMemberData() has returned a valid result.
if (!is_array($memberResult)) {
// Members only...
is_not_guest('', $fatal);
if ($fatal) {
fatal_lang_error('not_a_user', false);
} else {
return false;
}
}
// If all went well, we have a valid member ID!
list($memID) = $memberResult;
return $memID;
}
开发者ID:scripple,项目名称:Elkarte,代码行数:38,代码来源:Profile.subs.php
示例2: 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
示例3: LikesByUser
/**
* @param $memID int id_member
*
* fetch all likes received by the given user and display them
* part of the profile -> show content area.
*/
function LikesByUser($memID)
{
global $context, $user_info, $scripturl, $memberContext, $txt, $modSettings, $options;
if ($memID != $user_info['id']) {
isAllowedTo('can_view_ratings');
}
// let us use the same value as for topics per page here.
$perpage = empty($modSettings['disableCustomPerPage']) && !empty($options['topics_per_page']) ? $options['topics_per_page'] : $modSettings['defaultMaxTopics'];
$out = $_GET['sa'] === 'likesout';
// display likes *given* instead of received ones
$is_owner = $user_info['id'] == $memID;
// we are the owner of this profile, this is important for proper formatting (you/yours etc.)
$boards_like_see = boardsAllowedTo('like_see');
// respect permissions
$start = isset($_REQUEST['start']) ? (int) $_REQUEST['start'] : 0;
if (!($user_info['is_admin'] || allowedTo('moderate_forum'))) {
// admins and global mods can see everything
$bq = ' AND b.id_board IN({array_int:boards})';
} else {
$bq = '';
}
$q = $out ? 'l.id_user = {int:id_user}' : 'l.id_receiver = {int:id_user}';
$request = smf_db_query('SELECT count(l.id_msg) FROM {db_prefix}likes AS l
INNER JOIN {db_prefix}messages AS m ON (m.id_msg = l.id_msg)
INNER JOIN {db_prefix}topics AS t ON (t.id_topic = m.id_topic)
INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
WHERE ' . $q . ' AND {query_see_board}' . $bq, array('id_user' => $memID, 'boards' => $boards_like_see));
list($context['total_likes']) = mysql_fetch_row($request);
mysql_free_result($request);
$request = smf_db_query('SELECT m.subject, m.id_topic, l.id_user, l.id_receiver, l.updated, l.id_msg, l.rtype, mfirst.subject AS first_subject, SUBSTRING(m.body, 1, 150) AS body FROM {db_prefix}likes AS l
INNER JOIN {db_prefix}messages AS m ON (m.id_msg = l.id_msg)
INNER JOIN {db_prefix}topics AS t ON (t.id_topic = m.id_topic)
INNER JOIN {db_prefix}messages AS mfirst ON (mfirst.id_msg = t.id_first_msg)
INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
WHERE ' . $q . ' AND {query_see_board} ' . $bq . ' ORDER BY l.id_like DESC LIMIT {int:startwith}, {int:perpage}', array('id_user' => $memID, 'startwith' => $start, 'perpage' => $perpage, 'boards' => $boards_like_see));
$context['results_count'] = 0;
$context['likes'] = array();
$context['displaymode'] = $out ? true : false;
$context['pages'] = '';
if ($context['total_likes'] > $perpage) {
$context['pages'] = constructPageIndex($scripturl . '?action=profile;area=showposts;sa=' . $_GET['sa'] . ';u=' . trim($memID), $start, $context['total_likes'], $perpage);
}
$users = array();
while ($row = mysql_fetch_assoc($request)) {
$context['results_count']++;
$thref = URL::topic($row['id_topic'], $row['first_subject'], 0);
$phref = URL::topic($row['id_topic'], $row['subject'], 0, false, '.msg' . $row['id_msg'], '#msg' . $row['id_msg']);
$users[] = $out ? $row['id_receiver'] : $row['id_user'];
$context['likes'][] = array('id_user' => $out ? $row['id_receiver'] : $row['id_user'], 'time' => timeformat($row['updated']), 'topic' => array('href' => $thref, 'link' => '<a href="' . $thref . '">' . $row['first_subject'] . '</a>', 'subject' => $row['first_subject']), 'post' => array('href' => $phref, 'link' => '<a href="' . $phref . '">' . $row['subject'] . '</a>', 'subject' => $row['subject'], 'id' => $row['id_msg']), 'rtype' => $row['rtype'], 'teaser' => strip_tags(preg_replace('~[[\\/\\!]*?[^\\[\\]]*?]~si', '', $row['body'])) . '...', 'morelink' => URL::parse('?msg=' . $row['id_msg'] . ';perma'));
}
loadMemberData(array_unique($users));
foreach ($context['likes'] as &$like) {
loadMemberContext($like['id_user']);
$like['member'] =& $memberContext[$like['id_user']];
$like['text'] = $out ? $is_owner ? sprintf($txt['liked_a_post'], $is_owner ? $txt['you_liker'] : $memberContext[$memID]['name'], $memberContext[$like['id_user']]['link'], $like['post']['href'], $like['topic']['link'], $modSettings['ratings'][$like['rtype']]['text']) : sprintf($txt['liked_a_post'], $is_owner ? $txt['you_liker'] : $memberContext[$memID]['name'], $memberContext[$like['id_user']]['link'], $like['post']['href'], $like['topic']['link'], $modSettings['ratings'][$like['rtype']]['text']) : ($is_owner ? sprintf($txt['liked_your_post'], $like['id_user'] == $user_info['id'] ? $txt['you_liker'] : $like['member']['link'], $like['post']['href'], $like['topic']['link'], $modSettings['ratings'][$like['rtype']]['text']) : sprintf($txt['liked_a_post'], $like['id_user'] == $user_info['id'] ? $txt['you_liker'] : $like['member']['link'], $memberContext[$memID]['name'], $like['post']['href'], $like['topic']['link'], $modSettings['ratings'][$like['rtype']]['text']));
}
mysql_free_result($request);
EoS_Smarty::getConfigInstance()->registerHookTemplate('profile_content_area', 'ratings/profile_display');
}
开发者ID:norv,项目名称:EosAlpha,代码行数:65,代码来源:Ratings.php
示例4: MessageSettings
/**
* Allows to edit Personal Message Settings.
*
* @uses Profile.php
* @uses Profile-Modify.php
* @uses Profile template.
* @uses Profile language file.
*/
function MessageSettings()
{
global $txt, $user_settings, $user_info, $context, $sourcedir, $smcFunc;
global $scripturl, $profile_vars, $cur_profile, $user_profile;
// Need this for the display.
require_once $sourcedir . '/Profile.php';
require_once $sourcedir . '/Profile-Modify.php';
// We want them to submit back to here.
$context['profile_custom_submit_url'] = $scripturl . '?action=pm;sa=settings;save';
loadMemberData($user_info['id'], false, 'profile');
$cur_profile = $user_profile[$user_info['id']];
loadLanguage('Profile');
loadTemplate('Profile');
$context['page_title'] = $txt['pm_settings'];
$context['user']['is_owner'] = true;
$context['id_member'] = $user_info['id'];
$context['require_password'] = false;
$context['menu_item_selected'] = 'settings';
$context['submit_button_text'] = $txt['pm_settings'];
$context['profile_header_text'] = $txt['personal_messages'];
// Add our position to the linktree.
$context['linktree'][] = array('url' => $scripturl . '?action=pm;sa=settings', 'name' => $txt['pm_settings']);
// Are they saving?
if (isset($_REQUEST['save'])) {
checkSession('post');
// Mimic what profile would do.
$_POST = htmltrim__recursive($_POST);
$_POST = htmlspecialchars__recursive($_POST);
// Save the fields.
saveProfileFields();
if (!empty($profile_vars)) {
updateMemberData($user_info['id'], $profile_vars);
}
}
// Load up the fields.
pmprefs($user_info['id']);
}
开发者ID:Glyph13,项目名称:SMF2.1,代码行数:45,代码来源:PersonalMessage.php
示例5: template_main
function template_main()
{
global $scripturl, $context, $txt, $settings, $modSettings, $user_profile, $memberContext;
// Check if the user is an Admin
$manage_staff = allowedTo('admin_forum');
$bbc_check = function_exists('parse_bbc');
echo '<div class="tborder">';
echo '<br />';
$totalcols = 1;
if ($modSettings['smfstaff_showavatar']) {
$totalcols++;
}
if ($modSettings['smfstaff_showlastactive']) {
$totalcols++;
}
if ($modSettings['smfstaff_showdateregistered']) {
$totalcols++;
}
if ($modSettings['smfstaff_showcontactinfo']) {
$totalcols++;
}
foreach ($context['smfstaff_groups'] as $id => $data) {
$count_users = count(@$context['smfstaff_users'][$data['id']]);
if ($count_users == 0) {
continue;
}
echo '<table border="0" cellspacing="0" cellpadding="2" width="100%">';
echo '<tr>';
echo '<td class="catbg2" width="30%">', $data['name'], '</td>';
if ($modSettings['smfstaff_showavatar']) {
echo '<td class="catbg2" width="25%">', $txt['smfstaff_avatar'], '</td>';
}
if ($modSettings['smfstaff_showlastactive']) {
echo '<td class="catbg2" width="25%">', $txt['smfstaff_lastactive'], '</td>';
}
if ($modSettings['smfstaff_showdateregistered']) {
echo '<td class="catbg2" width="25%">', $txt['smfstaff_dateregistered'], '</td>';
}
if ($modSettings['smfstaff_showcontactinfo']) {
echo '<td class="catbg2" width="30%">', $txt['smfstaff_contact'], '</td>';
}
echo '</tr>';
foreach (@$context['smfstaff_users'][$data['id']] as $id => $row2) {
echo '<tr>';
echo '<td class="windowbg"><a href="' . $scripturl . '?action=profile;u=' . $row2['ID_MEMBER'] . '"><font color="' . $data['color'] . '">' . $row2['realName'] . '</font></a></td>';
if ($modSettings['smfstaff_showavatar']) {
echo '<td class="windowbg">';
// Display the users avatar
$memCommID = $row2['ID_MEMBER'];
loadMemberData($memCommID);
loadMemberContext($memCommID);
echo $memberContext[$memCommID]['avatar']['image'];
echo '</td>';
}
if ($modSettings['smfstaff_showlastactive']) {
echo '<td class="windowbg">' . timeformat($row2['lastLogin']) . '</td>';
}
if ($modSettings['smfstaff_showdateregistered']) {
echo '<td class="windowbg">' . timeformat($row2['dateRegistered']) . '</td>';
}
if ($modSettings['smfstaff_showcontactinfo']) {
echo '<td class="windowbg">';
//Send email row
if ($row2['hideEmail'] == 0) {
echo '<a href="mailto:', $row2['emailAddress'], '"><img src="' . $settings['images_url'] . '/email_sm.gif" alt="email" /></a> ';
}
if ($row2['ICQ'] != '') {
echo '<a href="http://www.icq.com/whitepages/about_me.php?uin=' . $row2['ICQ'] . '" target="_blank"><img src="http://status.icq.com/online.gif?img=5&icq=' . $row2['ICQ'] . '" alt="' . $row2['ICQ'] . '" width="18" height="18" border="0" /></a> ';
}
if ($row2['AIM'] != '') {
echo '<a href="aim:goim?screenname=' . urlencode(strtr($row2['AIM'], array(' ' => '%20'))) . '&message=' . $txt['aim_default_message'] . '"><img src="' . $settings['images_url'] . '/aim.gif" alt="' . $row2['AIM'] . '" border="0" /></a> ';
}
if ($row2['YIM'] != '') {
echo '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . urlencode($row2['YIM']) . '"><img src="http://opi.yahoo.com/online?u=' . urlencode($row2['YIM']) . '&m=g&t=0" alt="' . $row2['YIM'] . '" border="0" /></a> ';
}
if ($row2['MSN'] != '') {
echo '<a href="http://members.msn.com/' . $row2['MSN'] . '" target="_blank"><img src="' . $settings['images_url'] . '/msntalk.gif" alt="' . $row2['MSN'] . '" border="0" /></a> ';
}
// Send PM row
echo '<a href="' . $scripturl . '?action=pm;sa=send;u=' . $row2['ID_MEMBER'] . '">' . $txt['smfstaff_sendpm'] . '</a>';
echo '</td>';
}
// End Contact Information
echo '</tr>';
}
// If they are allowed to manage the staff page give them the option
if ($manage_staff) {
echo '<tr>
<td align="center" colspan="', $totalcols, '" class="windowbg">
<a href="' . $scripturl . '?action=staff;sa=catdown&id=' . $data['id'] . '">' . $txt['smfstaff_down'] . '</a> | <a href="' . $scripturl . '?action=staff;sa=catup&id=' . $data['id'] . '">' . $txt['smfstaff_up'] . '</a> | <a href="' . $scripturl . '?action=staff;sa=delete&id=' . $data['id'] . ';ret">' . $txt['smfstaff_delgroup'] . '</a></td></tr>';
}
echo '</table>';
// Seperate the groups from the local mods.
echo '<br />';
}
// End of Main staff listing
if ($modSettings['smfstaff_showlocalmods']) {
$localcount = count($context['smfstaff_localmods']);
if ($localcount > 0) {
echo '<table border="0" cellspacing="0" cellpadding="2" width="100%">';
//.........这里部分代码省略.........
开发者ID:VBGAMER45,项目名称:SMFMods,代码行数:101,代码来源:Staff.template.php
示例6: shd_create_ticket_post
/**
* Creates a new ticket or reply in the database.
*
* This function handles all of the creation of posts and tickets within SimpleDesk, even with respect to managing tickets spawned
* from forum topics being moved. New tickets' contents as well as replies to tickets generally hold the same format.
*
* All three parameters are by <b>reference</b> meaning they WILL be updated if things change. Note that this function
* is not validating that they are sensible values; it is up to the calling function to ascertain that.
*
* @param array &$msgOptions A hash array by reference, containing details of the post you wish to add.
* <ul>
* <li>id: Not required on input (and is ignored) - and will be overwritten with the new message id when the function completes.</li>
* <li>body: Required string, the principle body content of the message to post. Assumed to have been cleaned already (with $smcFunc['htmlspecialchars'] and preparsecode)</li>
* <li>smileys_enabled: Optional, boolean denoting whether smileys should be active on this post; defaults to false</li>
* <li>time: Optional, timestamp of the post. If omitted, time() will be used instead (for "now" based on server clock)</li>
* <li>modified: Optional, hash array containing items relating to modification (if 'modified' key exists, all of these should be set)
* <ul>
* <li> time: Unsigned int timestamp of the change</li>
* <li> name: String; user name of the user making the change; if omitted, modified will be ignored</li>
* <li> id: Unsigned int user id of the user making the change; if not provided, id MUST be. If id isn't, or it doesn't exist, modified will be ignored entirely</li>
* </ul>
* </li>
* <li> attachments: Optional, array of attachment ids that need attaching to this message; if omitted no changes will occur
* </ul>
*
* @param array &$ticketOptions A hash array by reference, containing details of the ticket as a whole.
* <ul>
* <li>id: Required if replying to a ticket, 0 if a new ticket (will default to 0 if not specified)</li>
* <li>mark_as_read: Optional boolean, whether to mark the ticket as read by the person posting it ($posterOptions['id'] is required to use this)</li>
* <li>mark_as_read_proxy: Optional integer for proxy tickets, if $ticketOptions['mark_as_read'] is true. Mark the ticket as read for the user with this id.</li>
* <li>subject: Semi-optional string with the new subject in; required for a new ticket, ignored if adding a reply. If set, assumed to have been cleaned already (with $smcFunc['htmlspecialchars'] and strtr)</li>
* <li>private: Semi-optional boolean with ticket privacy (true = private); required for a new ticket, ignored if adding a reply.</li>
* <li>status: Integer to denote new status of the ticket, defaults to TICKET_STATUS_NEW. Calling function to determine new status.</li>
* <li>urgency: Semi-optional integer with the ticket urgency; required for a new ticket, ignored if adding a reply. If not stated on a new ticket, TICKET_URGENCY_LOW will be used.</li>
* <li>assigned: Optional integer of user id, used to create a ticket with assignment, ignored if not a new ticket.</li>
* <li>dept: Required if creating a new ticket, to indicate which department the ticket should belong to.</li>
* </ul>
*
* @param array &$posterOptions A hash array by reference, containing details of the person the reply is written by.
* <ul>
* <li>id: User id to credit the post to. Uses 0 if not specified.</li>
* <li>ip: IP address the post came from. Uses the current user's IP address if not specified.</li>
* <li>name: Name to credit against the post. If not specified, and a user id was supplied, look that up in the member table, otherwise just use 'Guest'.</li>
* <li>email: Email address to list against the post. If not specified, and a user id was supplied, look that up in the member table, otherwise just use ''.</li>
* </ul>
* @return bool True on success, false on failure.
* @since 1.0
*/
function shd_create_ticket_post(&$msgOptions, &$ticketOptions, &$posterOptions)
{
global $user_info, $txt, $modSettings, $smcFunc, $context, $user_profile;
// Clean them incoming vars up good 'n' proper
$msgOptions['smileys_enabled'] = !empty($msgOptions['smileys_enabled']);
$msgOptions['attachments'] = empty($msgOptions['attachments']) ? array() : $msgOptions['attachments'];
$msgOptions['time'] = empty($msgOptions['time']) ? time() : (int) $msgOptions['time'];
$ticketOptions['id'] = empty($ticketOptions['id']) ? 0 : (int) $ticketOptions['id'];
$ticketOptions['private'] = !empty($ticketOptions['private']);
$ticketOptions['urgency'] = empty($ticketOptions['urgency']) ? TICKET_URGENCY_LOW : (int) $ticketOptions['urgency'];
$ticketOptions['assigned'] = empty($ticketOptions['assigned']) ? 0 : (int) $ticketOptions['assigned'];
$ticketOptions['status'] = empty($ticketOptions['status']) ? TICKET_STATUS_NEW : (int) $ticketOptions['status'];
$posterOptions['id'] = empty($posterOptions['id']) ? 0 : (int) $posterOptions['id'];
$posterOptions['ip'] = empty($posterOptions['ip']) ? $user_info['ip'] : $posterOptions['ip'];
// If nothing was filled in as name/e-mail address, try the member table.
if (!isset($posterOptions['name']) || $posterOptions['name'] == '' || empty($posterOptions['email']) && !empty($posterOptions['id'])) {
if (empty($posterOptions['id'])) {
$posterOptions['id'] = 0;
$posterOptions['name'] = $txt['guest_title'];
$posterOptions['email'] = '';
} elseif ($posterOptions['id'] != $user_info['id']) {
if (empty($user_profile[$posterOptions['id']])) {
loadMemberData($posterOptions['id'], false, 'minimal');
}
// Couldn't find the current poster?
if (empty($user_profile[$posterOptions['id']])) {
trigger_error('shd_create_ticket_post(): Invalid member id ' . $posterOptions['id'], E_USER_NOTICE);
$posterOptions['id'] = 0;
$posterOptions['name'] = $txt['guest_title'];
$posterOptions['email'] = '';
} else {
$posterOptions['name'] = $user_profile[$posterOptions['id']]['real_name'];
$posterOptions['email'] = $user_profile[$posterOptions['id']]['email_address'];
}
} else {
$posterOptions['name'] = $user_info['name'];
$posterOptions['email'] = $user_info['email'];
}
}
// Is there modified name data? (For topic->ticket)
$modified = true;
if (isset($msgOptions['modified'])) {
$msgOptions['modified']['time'] = empty($msgOptions['modified']['time']) ? 0 : (int) $msgOptions['modified']['time'];
$msgOptions['modified']['id'] = empty($msgOptions['modified']['id']) ? 0 : (int) $msgOptions['modified']['id'];
$msgOptions['modified']['name'] = empty($msgOptions['modified']['name']) ? '' : $msgOptions['modified']['name'];
$cancel = false;
if (empty($msgOptions['modified']['time']) || empty($msgOptions['modified']['name']) && empty($msgOptions['modified']['id'])) {
$modified = false;
}
if ($modified) {
// So they have a time, and name or id (or even both). Let's see what we need.
if (empty($msgOptions['modified']['name'])) {
//.........这里部分代码省略.........
开发者ID:jdarwood007,项目名称:SimpleDesk,代码行数:101,代码来源:Subs-SimpleDeskPost.php
示例7: Who
function Who()
{
global $context, $scripturl, $user_info, $txt, $modSettings, $memberContext, $smcFunc;
// 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');
loadLanguage('Who');
// Sort out... the column sorting.
$sort_methods = array('user' => 'mem.real_name', 'time' => 'lo.log_time');
$show_methods = array('members' => '(lo.id_member != 0)', 'guests' => '(lo.id_member = 0)', 'all' => '1=1');
// Store the sort methods and the show types for use in the template.
$context['sort_methods'] = array('user' => $txt['who_user'], 'time' => $txt['who_time']);
$context['show_methods'] = array('all' => $txt['who_show_all'], 'members' => $txt['who_show_members_only'], 'guests' => $txt['who_show_guests_only']);
// Can they see spiders too?
if (!empty($modSettings['show_spider_online']) && ($modSettings['show_spider_online'] == 2 || allowedTo('admin_forum')) && !empty($modSettings['spider_name_cache'])) {
$show_methods['spiders'] = '(lo.id_member = 0 AND lo.id_spider > 0)';
$show_methods['guests'] = '(lo.id_member = 0 AND lo.id_spider = 0)';
$context['show_methods']['spiders'] = $txt['who_show_spiders_only'];
} elseif (empty($modSettings['show_spider_online']) && isset($_SESSION['who_online_filter']) && $_SESSION['who_online_filter'] == 'spiders') {
unset($_SESSION['who_online_filter']);
}
// Does the user prefer a different sort direction?
if (isset($_REQUEST['sort']) && isset($sort_methods[$_REQUEST['sort']])) {
$context['sort_by'] = $_SESSION['who_online_sort_by'] = $_REQUEST['sort'];
$sort_method = $sort_methods[$_REQUEST['sort']];
} elseif (isset($_SESSION['who_online_sort_by'])) {
$context['sort_by'] = $_SESSION['who_online_sort_by'];
$sort_method = $sort_methods[$_SESSION['who_online_sort_by']];
} else {
$context['sort_by'] = $_SESSION['who_online_sort_by'] = 'time';
$sort_method = 'lo.log_time';
}
$context['sort_direction'] = isset($_REQUEST['asc']) || isset($_REQUEST['sort_dir']) && $_REQUEST['sort_dir'] == 'asc' ? 'up' : 'down';
$conditions = array();
if (!allowedTo('moderate_forum')) {
$conditions[] = '(IFNULL(mem.show_online, 1) = 1)';
}
// Fallback to top filter?
if (isset($_REQUEST['submit_top']) && isset($_REQUEST['show_top'])) {
$_REQUEST['show'] = $_REQUEST['show_top'];
}
// Does the user wish to apply a filter?
if (isset($_REQUEST['show']) && isset($show_methods[$_REQUEST['show']])) {
$context['show_by'] = $_SESSION['who_online_filter'] = $_REQUEST['show'];
$conditions[] = $show_methods[$_REQUEST['show']];
} elseif (isset($_SESSION['who_online_filter'])) {
$context['show_by'] = $_SESSION['who_online_filter'];
$conditions[] = $show_methods[$_SESSION['who_online_filter']];
} else {
$context['show_by'] = $_SESSION['who_online_filter'] = 'all';
}
// Get the total amount of members online.
$request = $smcFunc['db_query']('', '
SELECT COUNT(*)
FROM {db_prefix}log_online AS lo
LEFT JOIN {db_prefix}members AS mem ON (lo.id_member = mem.id_member)' . (!empty($conditions) ? '
WHERE ' . implode(' AND ', $conditions) : ''), array());
list($totalMembers) = $smcFunc['db_fetch_row']($request);
$smcFunc['db_free_result']($request);
// Prepare some page index variables.
$context['page_index'] = constructPageIndex($scripturl . '?action=who;sort=' . $context['sort_by'] . ($context['sort_direction'] == 'up' ? ';asc' : '') . ';show=' . $context['show_by'], $_REQUEST['start'], $totalMembers, $modSettings['defaultMaxMembers']);
$context['start'] = $_REQUEST['start'];
// Look for people online, provided they don't mind if you see they are.
$request = $smcFunc['db_query']('', '
SELECT
lo.log_time, lo.id_member, lo.url, INET_NTOA(lo.ip) AS ip, mem.real_name,
lo.session, mg.online_color, IFNULL(mem.show_online, 1) AS show_online,
lo.id_spider
FROM {db_prefix}log_online AS lo
LEFT JOIN {db_prefix}members AS mem ON (lo.id_member = mem.id_member)
LEFT JOIN {db_prefix}membergroups AS mg ON (mg.id_group = CASE WHEN mem.id_group = {int:regular_member} THEN mem.id_post_group ELSE mem.id_group END)' . (!empty($conditions) ? '
WHERE ' . implode(' AND ', $conditions) : '') . '
ORDER BY {raw:sort_method} {raw:sort_direction}
LIMIT {int:offset}, {int:limit}', array('regular_member' => 0, 'sort_method' => $sort_method, 'sort_direction' => $context['sort_direction'] == 'up' ? 'ASC' : 'DESC', 'offset' => $context['start'], 'limit' => $modSettings['defaultMaxMembers']));
$context['members'] = array();
$member_ids = array();
$url_data = array();
while ($row = $smcFunc['db_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['log_time']), array($txt['today'] => '', $txt['yesterday'] => '')), 'timestamp' => forum_time(true, $row['log_time']), 'query' => $actions, 'is_hidden' => $row['show_online'] == 0, 'id_spider' => $row['id_spider'], 'color' => empty($row['online_color']) ? '' : $row['online_color']);
$url_data[$row['session']] = array($row['url'], $row['id_member']);
$member_ids[] = $row['id_member'];
}
$smcFunc['db_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['guest_title'], 'group' => $txt['guest_title'], 'href' => '', 'link' => $txt['guest_title'], 'email' => $txt['guest_title'], 'is_guest' => true);
// Are we showing spiders?
$spiderContext = array();
if (!empty($modSettings['show_spider_online']) && ($modSettings['show_spider_online'] == 2 || allowedTo('admin_forum')) && !empty($modSettings['spider_name_cache'])) {
//.........这里部分代码省略.........
开发者ID:abdulhadikaryana,项目名称:kebudayaan,代码行数:101,代码来源:Who.php
示例8: showActivitiesProfileSettings
/**
* @param $memID int member ID
*
* show the settings to customize opt-outs for activity entries and notifications
* to receive.
*
* todo: we need to find a way to filter out notifications that are for
* admins/mods only. probably needs a db scheme change...
*/
function showActivitiesProfileSettings($memID)
{
global $modSettings, $context, $user_info, $txt, $user_profile, $scripturl;
loadLanguage('Activities-Profile');
if (empty($modSettings['astream_active']) || $user_info['id'] != $memID && !$user_info['is_admin']) {
fatal_lang_error('no_access');
}
Eos_Smarty::getConfigInstance()->registerHookTemplate('profile_content_area', 'profile/astream_settings');
$context['submiturl'] = $scripturl . '?action=profile;area=activities;sa=settings;save;u=' . $memID;
$context['page_title'] = $txt['showActivities'] . ' - ' . $user_profile[$memID]['real_name'];
$context[$context['profile_menu_name']]['tab_data'] = array('title' => $txt['showActivitiesSettings'], 'description' => $txt['showActivitiesSettings_desc'], 'tabs' => array());
$result = smf_db_query('SELECT * FROM {db_prefix}activity_types ORDER BY id_type ASC');
if ($user_info['id'] == $memID) {
$my_act_optout = empty($user_info['act_optout']) ? array(0) : explode(',', $user_info['act_optout']);
$my_notify_optout = empty($user_info['notify_optout']) ? array(0) : explode(',', $user_info['notify_optout']);
} else {
loadMemberData($memID, false, 'minimal');
$my_act_optout = empty($user_profile[$memID]['act_optout']) ? array(0) : explode(',', $user_profile[$memID]['act_optout']);
$my_notify_optout = empty($user_profile[$memID]['notify_optout']) ? array(0) : explode(',', $user_profile[$memID]['notify_optout']);
}
$context['activity_types'] = array();
while ($row = mysql_fetch_assoc($result)) {
$context['activity_types'][] = array('id' => $row['id_type'], 'shortdesc' => $row['id_desc'], 'longdesc_act' => $txt['actdesc_' . trim($row['id_desc'])], 'longdesc_not' => isset($txt['ndesc_' . trim($row['id_desc'])]) ? $txt['ndesc_' . trim($row['id_desc'])] : '', 'act_optout' => in_array($row['id_type'], $my_act_optout), 'notify_optout' => in_array($row['id_type'], $my_notify_optout));
}
mysql_free_result($result);
if (isset($_GET['save'])) {
$new_not_optout = array();
$new_act_optout = array();
$update_array = array();
foreach ($context['activity_types'] as $t) {
$_id = trim($t['id']);
if (!empty($t['longdesc_act']) && (!isset($_REQUEST['act_check_' . $_id]) || empty($_REQUEST['act_check_' . $_id]))) {
$new_act_optout[] = $_id;
}
if (!empty($t['longdesc_not']) && (!isset($_REQUEST['not_check_' . $_id]) || empty($_REQUEST['not_check_' . $_id]))) {
$new_not_optout[] = $_id;
}
}
//if(count(array_unique($new_act_optout)) > 0)
$update_array['act_optout'] = implode(',', array_unique($new_act_optout));
//if(count(array_unique($new_not_optout)) > 0)
$update_array['notify_optout'] = implode(',', array_unique($new_not_optout));
if (count($update_array)) {
updateMemberData($memID, $update_array);
}
redirectexit($scripturl . '?action=profile;area=activities;sa=settings;u=' . $memID);
}
}
开发者ID:norv,项目名称:EosAlpha,代码行数:57,代码来源:Activities.php
示例9: ssi_topPoster
$return = ssi_topPoster($topNumber, 'array');
cache_put_data('bk_top_poster', $return, 1800);
} else {
$return = cache_get_data('bk_top_poster', 1800);
}
} else {
$return = ssi_topPoster($topNumber, 'array');
}
// Make a quick array to list the links in.
echo '
<table style="border-spacing:5px;width:100%;" border="0" cellspacing="1" cellpadding="3">
';
$count = 0;
foreach ($return as $member) {
//load member data
loadMemberData($member['id']);
loadMemberContext($member['id']);
//end load member data...
$count++;
echo '
<tr>
<td align="left">';
if (!empty($memberContext[$member['id']]['avatar']['href'])) {
echo '<img src="' . $memberContext[$member['id']]['avatar']['href'] . '"
style="-moz-box-shadow: 0px 0px 5px #444;
-webkit-box-shadow: 0px 0px 5px #444;
box-shadow: 0px 0px 5px #444;" width="50px;" alt="" />';
}
echo '</td>
<td width="100%" valign="middle">
', $count == 1 ? '<img src="' . $settings['default_images_url'] . '/ultimate-portal/icons/1.gif" width="22px" alt="" />' : '', '
开发者ID:4kstore,项目名称:UltimatePortal-0.4,代码行数:31,代码来源:bk-top-poster.php
示例10: PlushSearch2
//.........这里部分代码省略.........
}
if (!empty($indexedResults) || empty($modSettings['search_index'])) {
$relevance = '1000 * (';
$new_weight_total = 0;
foreach ($main_query['weights'] as $type => $value) {
$relevance .= $weight[$type] . ' * ' . $value . ' + ';
$new_weight_total += $weight[$type];
}
$main_query['select']['relevance'] = substr($relevance, 0, -3) . ") / {$new_weight_total} AS relevance";
db_query("\n\t\t\t\t\tINSERT IGNORE INTO {$db_prefix}log_search_results\n\t\t\t\t\t\t(" . implode(', ', array_keys($main_query['select'])) . ")\n\t\t\t\t\tSELECT\n\t\t\t\t\t\t" . implode(',
', $main_query['select']) . "\n\t\t\t\t\tFROM (" . implode(', ', $main_query['from']) . ')' . (empty($main_query['left_join']) ? '' : "\n\t\t\t\t\t\tLEFT JOIN " . implode("\n\t\t\t\t\t\tLEFT JOIN ", $main_query['left_join'])) . "\n\t\t\t\t\tWHERE " . implode("\n\t\t\t\t\t\tAND ", $main_query['where']) . (empty($main_query['group_by']) ? '' : "\n\t\t\t\t\tGROUP BY " . implode(', ', $main_query['group_by'])) . (empty($modSettings['search_max_results']) ? '' : "\n\t\t\t\t\tLIMIT {$modSettings['search_max_results']}"), __FILE__, __LINE__);
$_SESSION['search_cache']['num_results'] = db_affected_rows();
}
// Insert subject-only matches.
if ($_SESSION['search_cache']['num_results'] < $modSettings['search_max_results'] && $numSubjectResults !== 0) {
db_query("\n\t\t\t\t\tINSERT IGNORE INTO {$db_prefix}log_search_results\n\t\t\t\t\t\t(ID_SEARCH, ID_TOPIC, relevance, ID_MSG, num_matches)\n\t\t\t\t\tSELECT\n\t\t\t\t\t\t" . $_SESSION['search_cache']['ID_SEARCH'] . ",\n\t\t\t\t\t\tt.ID_TOPIC,\n\t\t\t\t\t\t1000 * (\n\t\t\t\t\t\t\t{$weight['frequency']} / (t.numReplies + 1) +\n\t\t\t\t\t\t\t{$weight['age']} * IF(t.ID_FIRST_MSG < {$minMsg}, 0, (t.ID_FIRST_MSG - {$minMsg}) / {$recentMsg}) +\n\t\t\t\t\t\t\t{$weight['length']} * IF(t.numReplies < {$humungousTopicPosts}, t.numReplies / {$humungousTopicPosts}, 1) +\n\t\t\t\t\t\t\t{$weight['subject']} +\n\t\t\t\t\t\t\t{$weight['sticky']} * t.isSticky\n\t\t\t\t\t\t) / {$weight_total} AS relevance,\n\t\t\t\t\t\tt.ID_FIRST_MSG,\n\t\t\t\t\t\t1\n\t\t\t\t\tFROM ({$db_prefix}topics AS t, {$db_prefix}" . ($createTemporary ? 'tmp_' : '') . "log_search_topics AS lst)\n\t\t\t\t\tWHERE lst.ID_TOPIC = t.ID_TOPIC" . (empty($modSettings['search_max_results']) ? '' : "\n\t\t\t\t\tLIMIT " . ($modSettings['search_max_results'] - $_SESSION['search_cache']['num_results'])), __FILE__, __LINE__);
$_SESSION['search_cache']['num_results'] += db_affected_rows();
} elseif ($_SESSION['search_cache']['num_results'] == -1) {
$_SESSION['search_cache']['num_results'] = 0;
}
}
}
// *** Retrieve the results to be shown on the page
$participants = array();
$request = db_query("\n\t\tSELECT " . (empty($search_params['topic']) ? 'lsr.ID_TOPIC' : $search_params['topic'] . ' AS ID_TOPIC') . ", lsr.ID_MSG, lsr.relevance, lsr.num_matches\n\t\tFROM ({$db_prefix}log_search_results AS lsr" . ($search_params['sort'] == 'numReplies' ? ", {$db_prefix}topics AS t" : '') . ")\n\t\tWHERE ID_SEARCH = " . $_SESSION['search_cache']['ID_SEARCH'] . ($search_params['sort'] == 'numReplies' ? "\n\t\t\tAND t.ID_TOPIC = lsr.ID_TOPIC" : '') . "\n\t\tORDER BY {$search_params['sort']} {$search_params['sort_dir']}\n\t\tLIMIT " . (int) $_REQUEST['start'] . ", {$modSettings['search_results_per_page']}", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($request)) {
$context['topics'][$row['ID_MSG']] = array('id' => $row['ID_TOPIC'], 'relevance' => round($row['relevance'] / 10, 1) . '%', 'num_matches' => $row['num_matches'], 'matches' => array());
// By default they didn't participate in the topic!
$participants[$row['ID_TOPIC']] = false;
}
mysql_free_result($request);
// Now that we know how many results to expect we can start calculating the page numbers.
$context['page_index'] = constructPageIndex($scripturl . '?action=search2;params=' . $context['params'], $_REQUEST['start'], $_SESSION['search_cache']['num_results'], $modSettings['search_results_per_page'], false);
if (!empty($context['topics'])) {
// Create an array for the permissions.
$boards_can = array('post_reply_own' => boardsAllowedTo('post_reply_own'), 'post_reply_any' => boardsAllowedTo('post_reply_any'), 'mark_any_notify' => boardsAllowedTo('mark_any_notify'));
// How's about some quick moderation?
if (!empty($options['display_quick_mod']) && !empty($context['topics'])) {
$boards_can['lock_any'] = boardsAllowedTo('lock_any');
$boards_can['lock_own'] = boardsAllowedTo('lock_own');
$boards_can['make_sticky'] = boardsAllowedTo('make_sticky');
$boards_can['move_any'] = boardsAllowedTo('move_any');
$boards_can['move_own'] = boardsAllowedTo('move_own');
$boards_can['remove_any'] = boardsAllowedTo('remove_any');
$boards_can['remove_own'] = boardsAllowedTo('remove_own');
$boards_can['merge_any'] = boardsAllowedTo('merge_any');
$context['can_lock'] = in_array(0, $boards_can['lock_any']);
$context['can_sticky'] = in_array(0, $boards_can['make_sticky']) && !empty($modSettings['enableStickyTopics']);
$context['can_move'] = in_array(0, $boards_can['move_any']);
$context['can_remove'] = in_array(0, $boards_can['remove_any']);
$context['can_merge'] = in_array(0, $boards_can['merge_any']);
}
// Load the posters...
$request = db_query("\n\t\t\tSELECT ID_MEMBER\n\t\t\tFROM {$db_prefix}messages\n\t\t\tWHERE ID_MEMBER != 0\n\t\t\t\tAND ID_MSG IN (" . implode(', ', array_keys($context['topics'])) . ")\n\t\t\tLIMIT " . count($context['topics']), __FILE__, __LINE__);
$posters = array();
while ($row = mysql_fetch_assoc($request)) {
$posters[] = $row['ID_MEMBER'];
}
mysql_free_result($request);
if (!empty($posters)) {
loadMemberData(array_unique($posters));
}
// Get the messages out for the callback - select enough that it can be made to look just like Display.
$messages_request = db_query("\n\t\t\tSELECT\n\t\t\t\tm.ID_MSG, m.subject, m.posterName, m.posterEmail, m.posterTime, m.ID_MEMBER,\n\t\t\t\tm.icon, m.posterIP, m.body, m.smileysEnabled, m.modifiedTime, m.modifiedName,\n\t\t\t\tfirst_m.ID_MSG AS first_msg, first_m.subject AS first_subject, first_m.icon AS firstIcon, first_m.posterTime AS first_posterTime,\n\t\t\t\tfirst_mem.ID_MEMBER AS first_member_id, IFNULL(first_mem.realName, first_m.posterName) AS first_member_name,\n\t\t\t\tlast_m.ID_MSG AS last_msg, last_m.posterTime AS last_posterTime, last_mem.ID_MEMBER AS last_member_id,\n\t\t\t\tIFNULL(last_mem.realName, last_m.posterName) AS last_member_name, last_m.icon AS lastIcon, last_m.subject AS last_subject,\n\t\t\t\tt.ID_TOPIC, t.isSticky, t.locked, t.ID_POLL, t.numReplies, t.numViews,\n\t\t\t\tb.ID_BOARD, b.name AS bName, c.ID_CAT, c.name AS cName\n\t\t\tFROM ({$db_prefix}messages AS m, {$db_prefix}topics AS t, {$db_prefix}boards AS b, {$db_prefix}categories AS c, {$db_prefix}messages AS first_m, {$db_prefix}messages AS last_m)\n\t\t\t\tLEFT JOIN {$db_prefix}members AS first_mem ON (first_mem.ID_MEMBER = first_m.ID_MEMBER)\n\t\t\t\tLEFT JOIN {$db_prefix}members AS last_mem ON (last_mem.ID_MEMBER = first_m.ID_MEMBER)\n\t\t\tWHERE m.ID_MSG IN (" . implode(', ', array_keys($context['topics'])) . ")\n\t\t\t\tAND t.ID_TOPIC = m.ID_TOPIC\n\t\t\t\tAND b.ID_BOARD = t.ID_BOARD\n\t\t\t\tAND c.ID_CAT = b.ID_CAT\n\t\t\t\tAND first_m.ID_MSG = t.ID_FIRST_MSG\n\t\t\t\tAND last_m.ID_MSG = t.ID_LAST_MSG\n\t\t\tORDER BY FIND_IN_SET(m.ID_MSG, '" . implode(',', array_keys($context['topics'])) . "')\n\t\t\tLIMIT " . count($context['topics']), __FILE__, __LINE__);
// Note that the reg-exp slows things alot, but makes things make a lot more sense.
// If we want to know who participated in what then load this now.
if (!empty($modSettings['enableParticipation']) && !$user_info['is_guest']) {
$result = db_query("\n\t\t\t\tSELECT ID_TOPIC\n\t\t\t\tFROM {$db_prefix}messages\n\t\t\t\tWHERE ID_TOPIC IN (" . implode(', ', array_keys($participants)) . ")\n\t\t\t\t\tAND ID_MEMBER = {$ID_MEMBER}\n\t\t\t\tGROUP BY ID_TOPIC\n\t\t\t\tLIMIT " . count($participants), __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($result)) {
$participants[$row['ID_TOPIC']] = true;
}
mysql_free_result($result);
}
}
// Consider the search complete!
if (!empty($modSettings['cache_enable']) && $modSettings['cache_enable'] >= 2) {
cache_put_data('search_start:' . ($user_info['is_guest'] ? $user_info['ip'] : $ID_MEMBER), null, 90);
}
$context['key_words'] =& $searchArray;
// Set the basic stuff for the template.
$context['allow_hide_email'] = !empty($modSettings['allow_hideEmail']);
// Setup the default topic icons... for checking they exist and the like!
$stable_icons = array('xx', 'thumbup', 'thumbdown', 'exclamation', 'question', 'lamp', 'smiley', 'angry', 'cheesy', 'grin', 'sad', 'wink', 'moved', 'recycled', 'wireless');
$context['icon_sources'] = array();
foreach ($stable_icons as $icon) {
$context['icon_sources'][$icon] = 'images_url';
}
$context['sub_template'] = 'results';
$context['page_title'] = $txt[166];
$context['get_topics'] = 'prepareSearchContext';
$context['can_send_pm'] = allowedTo('pm_send');
loadJumpTo();
if (!empty($options['display_quick_mod']) && !empty($_SESSION['move_to_topic'])) {
foreach ($context['jump_to'] as $id => $cat) {
if (isset($context['jump_to'][$id]['boards'][$_SESSION['move_to_topic']])) {
$context['jump_to'][$id]['boards'][$_SESSION['move_to_topic']]['selected'] = true;
}
}
}
}
开发者ID:VBGAMER45,项目名称:SMFMods,代码行数:101,代码来源:Search.php
示例11: ModifyProfile
function ModifyProfile($post_errors = array())
{
global $txt, $scripturl, $user_info, $context, $sourcedir, $user_profile, $cur_profile;
global $modSettings, $memberContext, $profile_vars, $smcFunc, $post_errors, $options, $user_settings;
// Don't reload this as we may have processed error strings.
if (empty($post_errors)) {
loadLanguage('Profile');
}
loadTemplate('Profile');
require_once $sourcedir . '/Subs-Menu.php';
// Did we get the user by name...
if (isset($_REQUEST['user'])) {
$memberResult = loadMemberData($_REQUEST['user'], true, 'profile');
} elseif (!empty($_REQUEST['u'])) {
$memberResult = loadMemberData((int) $_REQUEST['u'], false, 'profile');
} else {
$memberResult = loadMemberData($user_info['id'], false, 'profile');
}
// Check if loadMemberData() has returned a valid result.
if (!is_array($memberResult)) {
fatal_lang_error('not_a_user', false);
}
// If all went well, we have a valid member ID!
list($memID) = $memberResult;
$context['id_member'] = $memID;
$cur_profile = $user_profile[$memID];
// Let's have some information about this member ready, too.
loadMemberContext($memID);
$context['member'] = $memberContext[$memID];
// Is this the profile of the user himself or herself?
$context['user']['is_owner'] = $memID == $user_info['id'];
/* Define all the sections within the profile area!
We start by defining the permission required - then SMF takes this and turns it into the relevant context ;)
Possible fields:
For Section:
string $title: Section title.
array $areas: Array of areas within this section
|
请发表评论