本文整理匯總了PHP中IPSMember::getLocation方法的典型用法代碼示例。如果您正苦於以下問題:PHP IPSMember::getLocation方法的具體用法?PHP IPSMember::getLocation怎麽用?PHP IPSMember::getLocation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類IPSMember
的用法示例。
在下文中一共展示了IPSMember::getLocation方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: doExecute
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen]
*/
public function doExecute(ipsRegistry $registry)
{
$this->registry->class_localization->loadLanguageFile(array('public_profile'));
/* INIT */
$member_id = intval($this->request['mid']);
//-----------------------------------------
// Can we access?
//-----------------------------------------
if (!$this->memberData['g_mem_info']) {
$this->returnString('error');
}
if (!$member_id) {
$this->returnString('error');
}
$member = IPSMember::load($member_id, 'profile_portal,pfields_content,sessions,groups,basic', 'id');
if (!$member['member_id']) {
$this->returnString('error');
}
$this->registry->class_localization->loadLanguageFile(array('public_online'), 'members');
$member = IPSMember::buildDisplayData($member, array('customFields' => 1, 'cfSkinGroup' => 'profile'));
$member = IPSMember::getLocation($member);
$board_posts = $this->caches['stats']['total_topics'] + $this->caches['stats']['total_replies'];
if ($member['posts'] and $board_posts) {
$member['_posts_day'] = round($member['posts'] / ((time() - $member['joined']) / 86400), 2);
# Fix the issue when there is less than one day
$member['_posts_day'] = $member['_posts_day'] > $member['posts'] ? $member['posts'] : $member['_posts_day'];
$member['_total_pct'] = sprintf('%.2f', $member['posts'] / $board_posts * 100);
}
$member['_posts_day'] = floatval($member['_posts_day']);
$this->returnHtml($this->registry->getClass('output')->getTemplate('profile')->showCard($member));
}
示例2: doExecute
/**
* Class entry point
*
* @param object Registry reference
* @return @e void [Outputs to screen]
*/
public function doExecute(ipsRegistry $registry)
{
//-----------------------------------------
// Can we access?
//-----------------------------------------
if (!$this->memberData['g_mem_info']) {
$this->returnString('error');
}
$this->registry->class_localization->loadLanguageFile(array('public_profile', 'public_online'), 'members');
/* Got a valid member? */
$member_id = intval($this->request['mid']);
if (empty($member_id)) {
$this->returnString('error');
}
$member = IPSMember::load($member_id, 'profile_portal,pfields_content,sessions,groups,basic', 'id');
if (empty($member['member_id'])) {
$this->returnString('error');
}
$member = IPSMember::buildDisplayData($member, array('customFields' => 1, 'cfSkinGroup' => 'profile', 'spamStatus' => 1));
$member = IPSMember::getLocation($member);
$board_posts = $this->caches['stats']['total_topics'] + $this->caches['stats']['total_replies'];
if ($member['posts'] and $board_posts) {
$member['_posts_day'] = round($member['posts'] / ((time() - $member['joined']) / 86400), 2);
# Fix the issue when there is less than one day
$member['_posts_day'] = $member['_posts_day'] > $member['posts'] ? $member['posts'] : $member['_posts_day'];
$member['_total_pct'] = sprintf('%.2f', $member['posts'] / $board_posts * 100);
}
$member['_posts_day'] = floatval($member['_posts_day']);
/* Load status class */
if (!$this->registry->isClassLoaded('memberStatus')) {
$classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/member/status.php', 'memberStatus');
$this->registry->setClass('memberStatus', new $classToLoad(ipsRegistry::instance()));
}
/* Fetch */
$member['_status'] = $this->registry->getClass('memberStatus')->fetch($this->memberData, array('member_id' => $member['member_id'], 'limit' => 1));
if (is_array($member['_status']) and count($member['_status'])) {
$member['_status'] = array_pop($member['_status']);
}
/* Reputation */
if ($this->settings['reputation_protected_groups']) {
if (in_array($member['member_group_id'], explode(",", $this->settings['reputation_protected_groups']))) {
$this->settings['reputation_show_profile'] = false;
}
}
$this->returnHtml($this->registry->getClass('output')->getTemplate('profile')->showCard($member));
}
示例3: _viewModern
//.........這裏部分代碼省略.........
$_visitor_info[$_id] = IPSMember::setUpGuest();
}
$_visitor_info[$_id]['_visited_date'] = ipsRegistry::getClass('class_localization')->getDate($_time, 'TINY');
$_visitor_info[$_id]['members_display_name_short'] = $_visitor_info[$_id]['members_display_name_short'] ? $_visitor_info[$_id]['members_display_name_short'] : $this->lang->words['global_guestname'];
$visitors[] = $_visitor_info[$_id];
}
}
}
//-----------------------------------------
// Friends
//-----------------------------------------
# Get random number from member's friend cache... grab 10 random. array_rand( array, no.)
# also fall back on last 10 if no cache
if ($member['pp_setting_count_friends'] > 0 && $this->settings['friends_enabled']) {
$member['_cache'] = IPSMember::unpackMemberCache($member['members_cache']);
if (is_array($member['_cache']['friends']) and count($member['_cache']['friends'])) {
foreach ($member['_cache']['friends'] as $id => $approved) {
$id = intval($id);
if ($approved and $id) {
$_member_ids[] = $id;
}
}
$member['_total_approved_friends'] = count($_member_ids);
if (is_array($_member_ids) and count($_member_ids)) {
$_max = count($_member_ids) > 50 ? 50 : count($_member_ids);
$_rand = array_rand($_member_ids, $_max);
$_final = array();
# If viewing member is in list, let's show em
if (in_array($this->memberData['member_id'], $_member_ids)) {
$_final[] = $this->memberData['member_id'];
$new_mids = array();
foreach ($_member_ids as $mid) {
if ($mid == $this->memberData['member_id']) {
continue;
}
$new_mids[] = $mid;
}
$_member_ids = $new_mids;
unset($new_mids);
if (is_array($_rand)) {
if (count($_rand) >= 50) {
array_pop($_rand);
}
}
}
if (is_array($_rand) and count($_rand)) {
foreach ($_rand as $_id) {
$_final[] = $_member_ids[$_id];
}
}
if (count($_final)) {
$sql_extra = ' AND pf.friends_friend_id IN (' . IPSText::cleanPermString(implode(',', $_final)) . ')';
}
}
}
$this->DB->build(array('select' => 'pf.*', 'from' => array('profile_friends' => 'pf'), 'where' => 'pf.friends_member_id=' . $member_id . ' AND pf.friends_approved=1' . $sql_extra, 'limit' => array(0, 50), 'order' => 'm.members_display_name ASC', 'add_join' => array(array('select' => 'm.*', 'from' => array('members' => 'm'), 'where' => 'm.member_id=pf.friends_friend_id', 'type' => 'left'), array('select' => 'pp.*', 'from' => array('profile_portal' => 'pp'), 'where' => 'pp.pp_member_id=m.member_id', 'type' => 'left'))));
$outer = $this->DB->execute();
while ($row = $this->DB->fetch($outer)) {
$row['_friends_added'] = ipsRegistry::getClass('class_localization')->getDate($row['friends_added'], 'SHORT');
$row['_location'] = $row['location'] ? $row['location'] : $this->lang->words['no_info'];
$row = IPSMember::buildProfilePhoto($row);
$row['members_display_name_short'] = IPSText::truncate($row['members_display_name'], 13);
$friends[] = $row;
}
}
$member['_total_displayed_friends'] = count($friends);
//-----------------------------------------
// Online location
//-----------------------------------------
$member = IPSMember::getLocation($member);
//-----------------------------------------
// Add profile view
//-----------------------------------------
$this->DB->insert('profile_portal_views', array('views_member_id' => $member['member_id']), true);
//-----------------------------------------
// Grab default tab...
//-----------------------------------------
$tab_html = '';
if ($tab != 'comments' and $tab != 'settings') {
if (file_exists($custom_path . '/' . $tab . '.php')) {
require $custom_path . '/pluginParentClass.php';
require $custom_path . '/' . $tab . '.php';
$_func_name = 'profile_' . $tab;
$plugin = new $_func_name($this->registry);
$tab_html = $plugin->return_html_block($member);
}
}
//-----------------------------------------
// Set description tag
//-----------------------------------------
$_desc = $member['pp_about_me'] ? $member['pp_about_me'] : $member['signature'];
if ($_desc) {
$this->registry->output->addMetaTag('description', $member['members_display_name'] . ': ' . IPSText::getTextClass('bbcode')->stripAllTags($_desc));
}
//-----------------------------------------
// Add to output
//-----------------------------------------
$this->member_name = $member['members_display_name'];
$this->output = $this->registry->getClass('output')->getTemplate('profile')->profileModern($tabs, $member, $comment_html, $friends, $visitors, $tab, $tab_html, $fields);
}
示例4: _viewModern
//.........這裏部分代碼省略.........
}
}
$member['_local_time'] = $member['time_offset'] != "" ? gmstrftime($this->settings['clock_long'], time() + $member['time_offset'] * 3600 + $time_adjust * 60) : '';
$member['g_title'] = IPSMember::makeNameFormatted($member['g_title'], $member['g_id'], $member['prefix'], $member['suffix']);
$member['_bday_month'] = $member['bday_month'] ? $this->lang->words['M_' . $member['bday_month']] : 0;
//-----------------------------------------
// Visitors
//-----------------------------------------
if ($member['pp_setting_count_visitors']) {
$_pp_last_visitors = unserialize($member['pp_last_visitors']);
$_visitor_info = array();
if (is_array($_pp_last_visitors)) {
krsort($_pp_last_visitors);
$_members = IPSMember::load(array_values($_pp_last_visitors), 'extendedProfile');
foreach ($_members as $_id => $_member) {
$_visitor_info[$_id] = IPSMember::buildDisplayData($_member, array('reputation' => 0, 'warn' => 0));
}
foreach ($_pp_last_visitors as $_time => $_id) {
if (!$_visitor_info[$_id]['members_display_name_short']) {
$_visitor_info[$_id] = IPSMember::buildDisplayData(IPSMember::setUpGuest(), array('reputation' => 0, 'warn' => 0));
}
$_visitor_info[$_id]['_visited_date'] = ipsRegistry::getClass('class_localization')->getDate($_time, 'TINY');
$_visitor_info[$_id]['members_display_name_short'] = $_visitor_info[$_id]['members_display_name_short'] ? $_visitor_info[$_id]['members_display_name_short'] : $this->lang->words['global_guestname'];
$visitors[] = $_visitor_info[$_id];
if (count($visitors) == 5) {
break;
}
}
}
}
//-----------------------------------------
// Online location
//-----------------------------------------
$member = IPSMember::getLocation($member);
//-----------------------------------------
// Add profile view
//-----------------------------------------
$this->DB->insert('profile_portal_views', array('views_member_id' => $member['member_id']), true);
//-----------------------------------------
// Grab default tab...
//-----------------------------------------
$tab_html = '';
if ($tab) {
if (@is_file(IPSLib::getAppDir($tabs[$tab]['app']) . '/extensions/profileTabs/' . $tab . '.php')) {
require IPSLib::getAppDir('members') . '/sources/tabs/pluginParentClass.php';
/*noLibHook*/
$classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir($tabs[$tab]['app']) . '/extensions/profileTabs/' . $tab . '.php', 'profile_' . $tab, $tabs[$tab]['app']);
$plugin = new $classToLoad($this->registry);
$tab_html = $plugin->return_html_block($member);
}
}
//-----------------------------------------
// Set description tag
//-----------------------------------------
$_desc = $member['pp_about_me'] ? $member['pp_about_me'] : $member['signature'];
if ($_desc) {
$this->registry->output->addMetaTag('description', $member['members_display_name'] . ': ' . IPSText::xssMakeJavascriptSafe(IPSText::getTextClass('bbcode')->stripAllTags($_desc)));
}
/* Reputation */
if ($this->settings['reputation_protected_groups']) {
if (in_array($member['member_group_id'], explode(",", $this->settings['reputation_protected_groups']))) {
$this->settings['reputation_show_profile'] = false;
}
}
//-----------------------------------------
// Try to "fix" empty custom field groups
示例5: _showLeaders
/**
* Show the forum leaders
*
* @return @e void [Outputs to screen]
*/
protected function _showLeaders()
{
/* Load language */
$this->lang->loadLanguageFile(array('public_online', 'public_profile'), 'members');
/* Init */
$st = intval($this->request['st']);
$perpage = 25;
$group_ids = array();
$member_ids = array();
$members = array();
$forumsMembers = array();
$pagination = '';
$mids = array();
$location_info = array();
$whereClause = array();
/* Work out who our super mods / mods aer */
foreach ($this->cache->getCache('group_cache') as $i) {
if ($i['g_is_supmod']) {
$group_ids[$i['g_id']] = '*';
} elseif ($i['g_access_cp']) {
$group_ids[$i['g_id']] = array();
}
}
$modCache = $this->cache->getCache('moderators');
$modCache = is_array($modCache) && count($modCache) ? $modCache : array();
foreach ($modCache as $i) {
if ($i['is_group'] && !$this->caches['group_cache'][$i['group_id']]['gbw_hide_leaders_page']) {
if (isset($group_ids[$i['group_id']])) {
if (is_array($group_ids[$i['group_id']])) {
$group_ids[$i['group_id']][$i['forum_id']] = ipsRegistry::getClass('class_forums')->forum_by_id[$i['forum_id']]['name'];
}
} else {
$group_ids[$i['group_id']] = array($i['forum_id'] => ipsRegistry::getClass('class_forums')->forum_by_id[$i['forum_id']]['name']);
}
} else {
if ($i['member_id']) {
$member_ids[$i['member_id']] = $i['member_id'];
$forumsMembers[$i['member_id']][$i['forum_id']] = ipsRegistry::getClass('class_forums')->forum_by_id[$i['forum_id']]['name'];
}
}
}
/* Custom Fields */
$classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/customfields/profileFields.php', 'customProfileFields');
$custom_fields_class = new $classToLoad();
//-----------------------------------------
// Get em
//-----------------------------------------
/* Got groups? */
if (count($group_ids)) {
$whereClause[] = $this->DB->buildWherePermission(array_keys($group_ids), 'm.member_group_id', FALSE);
}
/* Got members? */
if (count($member_ids)) {
$whereClause[] = $this->DB->buildWherePermission(array_keys($member_ids), 'm.member_id', FALSE);
}
/* So we got something? If not skip the whole thing.. */
if (count($whereClause)) {
/* Get a count */
$count = $this->DB->buildAndFetch(array('select' => 'count(*) as dracula', 'from' => array('members' => 'm'), 'where' => implode(' OR ', $whereClause)));
if ($count['dracula']) {
/* Sort out pagination */
$pagination = $this->registry->output->generatePagination(array('totalItems' => $count['dracula'], 'itemsPerPage' => $perpage, 'currentStartValue' => $st, 'baseUrl' => "app=forums&module=extras§ion=stats&do=leaders"));
/* Fetch the ones we want */
$this->DB->build(array('select' => 'm.*, m.member_id as my_member_id', 'from' => array('members' => 'm'), 'add_join' => array(array('select' => 'pp.*', 'from' => array('profile_portal' => 'pp'), 'where' => 'pp.pp_member_id=m.member_id', 'type' => 'left'), array('select' => 'pf.*', 'from' => array('pfields_content' => 'pf'), 'where' => 'pf.member_id=m.member_id', 'type' => 'left')), 'where' => implode(' OR ', $whereClause), 'order' => 'm.members_display_name', 'limit' => array($st, $perpage)));
$e = $this->DB->execute();
while ($r = $this->DB->fetch($e)) {
/* Reset member ID just in case.. */
$r['member_id'] = $r['my_member_id'];
$members[$r['member_id']] = IPSMember::buildDisplayData($r);
}
/* Now fetch session data */
$this->DB->build(array('select' => '*', 'from' => 'sessions', 'where' => 'member_id IN (' . implode(',', array_keys($members)) . ')'));
$this->DB->execute();
while ($r = $this->DB->fetch()) {
if (!$r['id'] or IPSMember::isLoggedInAnon($members[$r['member_id']])) {
$location_info[$r['member_id']] = '';
} else {
$location_info[$r['member_id']] = IPSMember::getLocation($r);
}
}
//-----------------------------------------
// Display
//-----------------------------------------
foreach ($members as $k => $member) {
$forums = isset($member_ids[$member['member_id']]) ? $member_ids[$member['member_id']] : array();
if ($forums == '*') {
$forums = $this->lang->words['leader_all_forums'];
} else {
$forums = array();
foreach ($group_ids as $gid => $fs) {
if (IPSMember::isInGroup($member, $gid)) {
if ($fs == '*') {
$forums = $this->lang->words['leader_all_forums'];
break;
} else {
//.........這裏部分代碼省略.........
示例6: _showLeaders
/**
* Show the forum leaders
*
* @access private
* @return void [Outputs to screen]
*/
private function _showLeaders()
{
//-----------------------------------------
// Load online lang file
//-----------------------------------------
$this->lang->loadLanguageFile(array('public_online'), 'members');
//-----------------------------------------
// Work out who our super mods / mods aer
//-----------------------------------------
$group_ids = array();
$member_ids = array();
$used_ids = array();
$members = array();
$moderators = array();
foreach ($this->cache->getCache('group_cache') as $i) {
if ($i['g_is_supmod']) {
$group_ids[$i['g_id']] = $i['g_id'];
}
if ($i['g_access_cp']) {
$group_ids[$i['g_id']] = $i['g_id'];
}
}
foreach ($this->cache->getCache('moderators') as $i) {
if ($i['is_group']) {
$group_ids[$i['group_id']] = $i['group_id'];
} else {
$member_ids[$i['member_id']] = $i['member_id'];
}
}
/* Custom Fields */
require_once IPS_ROOT_PATH . 'sources/classes/customfields/profileFields.php';
$custom_fields_class = new customProfileFields();
//-----------------------------------------
// Get all members.. (two is more eff. than 1)
//-----------------------------------------
if (count($member_ids)) {
$this->DB->build(array('select' => 'm.*, m.member_id as user_member_id', 'from' => array('members' => 'm'), 'where' => "m.member_id IN(" . implode(',', $member_ids) . ")", 'order' => 'm.members_l_display_name', 'add_join' => array(array('select' => 'pp.*', 'from' => array('profile_portal' => 'pp'), 'where' => 'pp.pp_member_id=m.member_id', 'type' => 'left'), array('select' => 's.*', 'from' => array('sessions' => 's'), 'where' => 's.member_id=m.member_id', 'type' => 'left'), array('select' => 'pf.*', 'from' => array('pfields_content' => 'pf'), 'where' => 'pf.member_id=m.member_id', 'type' => 'left'))));
$outer = $this->DB->execute();
while ($r = $this->DB->fetch($outer)) {
$r['member_id'] = $r['user_member_id'];
$r = IPSMember::buildDisplayData($r);
$r = IPSMember::getLocation($r);
$members[strtolower($r['members_display_name'])] = $r;
}
}
//-----------------------------------------
// Get all groups.. (two is more eff. than 1)
//-----------------------------------------
$this->DB->build(array('select' => 'm.*, m.member_id as user_member_id', 'from' => array('members' => 'm'), 'where' => "m.member_group_id IN(" . implode(',', $group_ids) . ")", 'add_join' => array(array('select' => 'pp.*', 'from' => array('profile_portal' => 'pp'), 'where' => 'pp.pp_member_id=m.member_id', 'type' => 'left'), array('select' => 's.*', 'from' => array('sessions' => 's'), 'where' => 's.member_id=m.member_id', 'type' => 'left'), array('select' => 'pf.*', 'from' => array('pfields_content' => 'pf'), 'where' => 'pf.member_id=m.member_id', 'type' => 'left'))));
$outer = $this->DB->execute();
while ($r = $this->DB->fetch($outer)) {
$r['member_id'] = $r['user_member_id'];
$r = IPSMember::buildDisplayData($r);
if (substr($r['login_anonymous'], 0, 1)) {
$r['online_extra'] = '';
} else {
$r = IPSMember::getLocation($r);
}
$members[strtolower($r['members_display_name'])] = $r;
}
ksort($members);
//-----------------------------------------
// PRINT: Admins
//-----------------------------------------
$admins = array();
$supmods = array();
foreach ($members as $member) {
if ($this->caches['group_cache'][$member['member_group_id']]['g_access_cp']) {
$member['forums'] = $this->lang->words['leader_all_forums'];
//-----------------------------------------
// Used...
//-----------------------------------------
$used_ids[] = $member['member_id'];
$admins[] = $member;
}
}
$this->output .= $this->registry->getClass('output')->getTemplate('stats')->group_strip($this->lang->words['leader_admins'], $admins);
//-----------------------------------------
// PRINT: Super Moderators
//-----------------------------------------
foreach ($members as $member) {
if ($this->caches['group_cache'][$member['member_group_id']]['g_is_supmod'] and !in_array($member['member_id'], $used_ids)) {
$member['forums'] = $this->lang->words['leader_all_forums'];
//-----------------------------------------
// Used...
//-----------------------------------------
$used_ids[] = $member['member_id'];
$supmods[] = $member;
}
}
if (count($supmods)) {
$this->output .= $this->registry->getClass('output')->getTemplate('stats')->group_strip($this->lang->words['leader_global'], $supmods);
}
//-----------------------------------------
//.........這裏部分代碼省略.........