/** * 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)); }
/** * Show the form * * @return @e void [Outputs to screen] */ protected function show() { //----------------------------------------- // INIT //----------------------------------------- $name = trim(IPSText::alphanumericalClean(ipsRegistry::$request['name'])); $member_id = intval(ipsRegistry::$request['member_id']); $output = ''; //----------------------------------------- // Get member data //----------------------------------------- $member = IPSMember::load($member_id, 'extendedProfile,customFields'); //----------------------------------------- // Got a member? //----------------------------------------- if (!$member['member_id']) { $this->returnJsonError($this->lang->words['t_noid']); } //----------------------------------------- // Return the form //----------------------------------------- if (method_exists($this->html, $name)) { $output = $this->html->{$name}($member); } //----------------------------------------- // Print... //----------------------------------------- $this->returnHtml($output); }
/** * Process Results * * @param array Row from database using query specified in fetch() * @return array Same data with any additional processing necessary */ public function process($row) { /* Build poster's display data */ $member = $row['author_id'] ? IPSMember::load($row['author_id'], 'profile_portal,pfields_content,sessions,groups', 'id') : IPSMember::setUpGuest(); $row = array_merge($row, IPSMember::buildDisplayData($member, array('reputation' => 0, 'warn' => 0))); /* Get forum data (damn HTML >.<) */ $forumData = ipsRegistry::getClass('class_forums')->getForumById($row['forum_id']); /* Parse BBCode */ IPSText::getTextClass('bbcode')->parse_smilies = $row['use_emo']; IPSText::getTextClass('bbcode')->parse_html = ($forumData['use_html'] and $member['g_dohtml'] and $row['post_htmlstate']) ? 1 : 0; IPSText::getTextClass('bbcode')->parse_nl2br = $row['post_htmlstate'] == 2 ? 1 : 0; IPSText::getTextClass('bbcode')->parse_bbcode = 1; IPSText::getTextClass('bbcode')->parsing_section = 'topics'; IPSText::getTextClass('bbcode')->parsing_mgroup = $member['member_group_id']; IPSText::getTextClass('bbcode')->parsing_mgroup_others = $member['mgroup_others']; $row['post'] = IPSText::getTextClass('bbcode')->preDisplayParse($row['post']); /* Parse attachments */ $messageHTML = array($row['pid'] => $row['post']); $attachHTML = $this->class_attach->renderAttachments($messageHTML, array($row['pid'])); if (is_array($attachHTML) and count($attachHTML)) { /* Get rid of any lingering attachment tags */ if (stristr($attachHTML[$row['pid']]['html'], "[attachment=")) { $attachHTML[$row['pid']]['html'] = IPSText::stripAttachTag($attachHTML[$row['pid']]['html']); } $row['post'] = $attachHTML[$row['pid']]['html'] . $attachHTML[$row['pid']]['attachmentHtml']; } /* Get rep buttons */ if ($row['repUserGiving'] == ipsRegistry::member()->getProperty('member_id')) { $row['has_given_rep'] = $row['rep_rating']; } $row['rep_points'] = ipsRegistry::getClass('repCache')->getRepPoints(array('app' => 'forums', 'type' => 'pid', 'type_id' => $row['pid'], 'rep_points' => $row['rep_points'])); $row['repButtons'] = ipsRegistry::getClass('repCache')->getLikeFormatted(array('app' => 'forums', 'type' => 'pid', 'id' => $row['pid'], 'rep_like_cache' => $row['rep_like_cache'])); /* Return */ return $row; }
/** * Displays reputation popup * * @return @e void */ protected function _viewRep() { $this->lang->loadLanguageFile(array('public_topic'), 'forums'); if (!$this->memberData['gbw_view_reps']) { $this->returnJsonError('no_permission'); } $repApp = $this->request['repApp']; $repType = $this->request['repType']; $repId = intval($this->request['repId']); /* Get data */ $reps = array(); $members = array(); $this->DB->build(array('select' => 'member_id, rep_rating', 'from' => 'reputation_index', 'where' => "app='{$repApp}' AND type='{$repType}' AND type_id='{$repId}'", 'order' => 'rep_date')); $q = $this->DB->execute(); while ($r = $this->DB->fetch($q)) { $reps[$r['member_id']] = $r; $members[$r['member_id']] = $r['member_id']; } if (count($members) and count($reps)) { $_members = IPSMember::load($members); foreach ($reps as $memId => $repData) { $reps[$memId]['member'] = $_members[$memId]; } } return $this->returnHtml($this->registry->output->getTemplate('global_other')->reputationPopup($reps)); }
/** * Get Content URL * * @param array $warning Row from members_warn_logs * @return @e array array( url => URL to the content the warning came from, title => Title ) */ public function getContentUrl($warning) { ipsRegistry::getClass('class_localization')->loadLanguageFile(array('public_profile'), 'members'); if ($warning['wl_content_id1']) { $post = ipsRegistry::DB()->buildAndFetch(array('select' => '*', 'from' => 'message_posts', 'where' => "msg_id=" . intval($warning['wl_content_id1']))); if (!empty($post['msg_topic_id'])) { $topic = ipsRegistry::DB()->buildAndFetch(array('select' => '*', 'from' => 'message_topics', 'where' => "mt_id={$post['msg_topic_id']}")); if (!empty($topic['mt_id'])) { ipsRegistry::DB()->build(array('select' => '*', 'from' => 'message_topic_user_map', 'where' => "map_topic_id={$post['msg_topic_id']}")); ipsRegistry::DB()->execute(); while ($row = ipsRegistry::DB()->fetch()) { if ($row['map_user_id'] == ipsRegistry::member()->getProperty('member_id')) { return array('url' => ipsRegistry::getClass('output')->buildUrl("app=members&module=messaging&section=view&do=findMessage&topicID={$topic['mt_id']}&msgID={$post['msg_id']}"), 'title' => $topic['mt_title']); } } return array('url' => ipsRegistry::getClass('output')->buildUrl("app=core&module=reports§ion=reports&do=showMessage&topicID={$topic['mt_id']}&msg={$post['msg_id']}"), 'title' => $topic['mt_title']); } } } else { $member = IPSMember::load($warning['wl_member']); if (!empty($member['member_id'])) { return array('url' => ipsRegistry::getClass('output')->buildSEOUrl("showuser={$member['member_id']}", 'public', $member['members_seo_name'], 'showuser'), 'title' => ipsRegistry::getClass('class_localization')->words['warnings_profile']); } } }
/** * Class entry point * * @access public * @param object Registry reference * @return void [Outputs to screen/redirects] */ public function doExecute(ipsRegistry $registry) { //----------------------------------------- // INIT //----------------------------------------- $info = array(); $id = intval($this->request['id']); //----------------------------------------- // Get HTML and skin //----------------------------------------- $this->registry->class_localization->loadLanguageFile(array('public_profile'), 'members'); //----------------------------------------- // Can we access? //----------------------------------------- if (!$this->memberData['g_mem_info']) { $this->registry->output->showError('photos_profiles_off', 10242); } if (!$id) { $this->registry->output->showError('photos_no_id', 10243); } $member = IPSMember::load($id); $member = IPSMember::buildDisplayData($member); $html = $this->registry->getClass('output')->getTemplate('profile')->showPhoto($member); //----------------------------------------- // Push to print handler //----------------------------------------- $this->registry->getClass('output')->setTitle($this->lang->words['photo_title']); $this->registry->getClass('output')->popUpWindow($html); }
/** * @param string key * @param string value */ public function setMemberData($k, $v = '') { if (is_integer($k)) { $this->_memberData = empty($k) ? IPSMember::setUpGuest() : IPSMember::load($k, 'all'); } else { if (is_string($k) && $k == intval($k)) { $this->_memberData = empty($k) ? IPSMember::setUpGuest() : IPSMember::load($k, 'all'); } else { if (is_array($k)) { $this->_memberData = $k; } else { if (!empty($k)) { $this->_memberData[$k] = $v; } } } } /* Set perm ids and that */ if ($this->memberData['member_id'] == $this->_memberData['member_id']) { $this->_memberData['_perm_id_array'] = $this->member->perm_id_array; } else { /* Force to guest for now */ $permId = !empty($this->_memberData['org_perm_id']) ? $this->_memberData['org_perm_id'] : $this->_memberData['g_perm_id']; $this->_memberData['_perm_id_array'] = array_unique(explode(",", $permId)); } }
/** * Class entry point * * @param object Registry reference * @return @e void [Outputs to screen] */ public function doExecute(ipsRegistry $registry) { //----------------------------------------- // INIT //----------------------------------------- $member_id = intval(ipsRegistry::$request['member_id']); $md5check = IPSText::md5Clean($this->request['md5check']); $CONFIG = array(); $tab = explode(':', ipsRegistry::$request['tab']); $app = substr(IPSText::alphanumericalClean(str_replace('..', '', trim($tab[0]))), 0, 20); $tab = substr(IPSText::alphanumericalClean(str_replace('..', '', trim($tab[1]))), 0, 20); $this->registry->class_localization->loadLanguageFile(array('public_profile'), 'members'); //----------------------------------------- // MD5 check //----------------------------------------- if ($md5check != $this->member->form_hash) { $this->returnString('error'); } //----------------------------------------- // Load member //----------------------------------------- $member = IPSMember::load($member_id); //----------------------------------------- // Check //----------------------------------------- if (!$member['member_id']) { $this->returnString('error'); } //----------------------------------------- // Load config //----------------------------------------- if (!is_file(IPSLib::getAppDir($app) . '/extensions/profileTabs/' . $tab . '.conf.php')) { $this->returnString('error'); } require IPSLib::getAppDir($app) . '/extensions/profileTabs/' . $tab . '.conf.php'; /*noLibHook*/ //----------------------------------------- // Active? //----------------------------------------- if (!$CONFIG['plugin_enabled']) { $this->returnString('error'); } //----------------------------------------- // Load main class... //----------------------------------------- if (!is_file(IPSLib::getAppDir($app) . '/extensions/profileTabs/' . $tab . '.php')) { $this->returnString('error'); } require IPSLib::getAppDir('members') . '/sources/tabs/pluginParentClass.php'; /*noLibHook*/ $classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir($app) . '/extensions/profileTabs/' . $tab . '.php', 'profile_' . $tab, $app); $plugin = new $classToLoad($this->registry); $html = $plugin->return_html_block($member); //----------------------------------------- // Return it... //----------------------------------------- $this->returnHtml($html); }
/** * Main function executed automatically by the controller * * @param object $registry Registry object * @return @e void */ public function doExecute(ipsRegistry $registry) { $member = IPSMember::load(intval($this->request['member']), 'none', 'id'); if ($member['member_id'] and $this->request['key'] == md5($member['email'] . ':' . $member['members_pass_hash'])) { IPSMember::save($member['member_id'], array('members' => array('allow_admin_mails' => 0))); $this->registry->getClass('output')->addContent($this->registry->output->getTemplate('ucp')->unsubscribed()); $this->registry->getClass('output')->sendOutput(); } $this->registry->output->showError('email_no_unsubscribe'); }
/** * Class entry point * * @param object Registry reference * @return @e void [Outputs to screen/redirects] */ public function doExecute(ipsRegistry $registry) { //----------------------------------------- // INIT //----------------------------------------- $info = array(); $id = intval($this->request['id']); //----------------------------------------- // Get HTML and skin //----------------------------------------- $this->registry->class_localization->loadLanguageFile(array('public_profile'), 'members'); //----------------------------------------- // Can we access? //----------------------------------------- if (!$this->memberData['g_mem_info']) { $this->registry->output->showError('dname_profiles_off', 10233.22, null, null, 403); } if (!$this->settings['auth_allow_dnames']) { $this->registry->output->showError('dnames_off', 10234, null, null, 403); } if (!$id) { $this->registry->output->showError('dnames_no_id', 10235, null, null, 404); } $member = IPSMember::load($id); //----------------------------------------- // Get Dname history //----------------------------------------- $this->DB->build(array('select' => 'd.*', 'from' => array('dnames_change' => 'd'), 'where' => 'dname_member_id=' . $id, 'add_join' => array(0 => array('select' => 'm.members_display_name', 'from' => array('members' => 'm'), 'where' => 'm.member_id=d.dname_member_id', 'type' => 'inner')), 'order' => 'dname_date DESC')); $this->DB->execute(); while ($row = $this->DB->fetch()) { $records[] = $row; } /* Stop Google indexing soft 404s */ if (!count($records) && !$this->memberData['member_id']) { $this->registry->output->showError('404_soft', 10235.1, null, null, 404); } //----------------------------------------- // Print the pop-up window //----------------------------------------- $html = $this->registry->getClass('output')->getTemplate('profile')->dnameWrapper($member['members_display_name'], $records); //----------------------------------------- // Push to print handler //----------------------------------------- $this->registry->getClass('output')->setTitle($this->lang->words['dname_title'] . ' - ' . ipsRegistry::$settings['board_name']); $this->registry->getClass('output')->addNavigation($this->lang->words['dname_title'], ''); $this->registry->getClass('output')->addContent($html); $this->registry->output->sendOutput(); }
/** * Main class entry point * * @param object ipsRegistry reference * @return @e void [Outputs to screen] */ public function doExecute(ipsRegistry $registry) { //----------------------------------------- // Get member data and format //----------------------------------------- $user = intval($this->request['user']); $id = intval($this->request['id']); if (!$user) { $this->returnString("no"); } if ($id) { $member = IPSMember::buildDisplayData(IPSMember::load($id)); } else { $member = IPSMember::buildDisplayData(IPSMember::setUpGuest($this->lang->words['global_guestname'] . "_" . $user)); } //----------------------------------------- // Mod permissions //----------------------------------------- $my_groups = array($this->memberData['member_group_id']); if ($this->memberData['mgroup_others']) { $my_groups = array_merge($my_groups, explode(",", IPSText::cleanPermString($this->memberData['mgroup_others']))); } $permissions = 0; $private = 0; if ($this->settings['ipschat_mods']) { $mod_groups = explode(",", $this->settings['ipschat_mods']); foreach ($my_groups as $group_id) { if (in_array($group_id, $mod_groups)) { $permissions = 1; break; } } } if ($this->settings['ipschat_private']) { $mod_groups = explode(",", $this->settings['ipschat_private']); foreach ($my_groups as $group_id) { if (in_array($group_id, $mod_groups)) { $private = 1; break; } } } //----------------------------------------- // Return output //----------------------------------------- $this->returnJsonArray(array('html' => ipsRegistry::getClass('output')->replaceMacros($this->registry->getClass('output')->getTemplate('ipchat')->ajaxNewUser(array('user_id' => $user, 'moderator' => $permissions, 'private' => $private, 'member' => $member))), 'prefix' => $this->settings['ipschat_format_names'] ? str_replace('"', '__DBQ__', $member['prefix']) : '', 'suffix' => $this->settings['ipschat_format_names'] ? str_replace('"', '__DBQ__', $member['suffix']) : '', 'pp_small_photo' => $member['pp_small_photo'], 'name' => $member['members_display_name'], '_canBeIgnored' => $member['member_id'] ? $member['_canBeIgnored'] : 1, 'g_id' => $member['g_id'])); }
/** * 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)); }
/** * Returns HTML tabs content for the page * * @param array $member Member data * @return @e array Array of 'tabs' (HTML for the tabs), 'content' (HTML for the content) */ public function getDisplayContent($member = array()) { //----------------------------------------- // Load skin //----------------------------------------- $html = ipsRegistry::getClass('output')->loadTemplate('cp_skin_chat', 'ipchat'); //----------------------------------------- // Load lang //----------------------------------------- ipsRegistry::getClass('class_localization')->loadLanguageFile(array('admin_chat'), 'ipchat'); //----------------------------------------- // Get member data //----------------------------------------- $member = IPSMember::load($member['member_id'], 'extendedProfile'); //----------------------------------------- // Show... //----------------------------------------- return array('tabs' => $html->acp_member_form_tabs($member), 'content' => $html->acp_member_form_main($member)); }
/** * Main class entry point * * @param object ipsRegistry reference * @return @e void [Outputs to screen] */ public function doExecute(ipsRegistry $registry) { //----------------------------------------- // Got sess ID and mem ID? //----------------------------------------- if (!$this->member->getProperty('member_id')) { $this->returnString("no"); } //----------------------------------------- // Get data //----------------------------------------- $block = $this->request['block'] ? true : false; $id = intval($this->request['id']); if (!$id) { $this->returnString("no"); } //----------------------------------------- // Get member record and verify we can ignore //----------------------------------------- $member = IPSMember::load($id, 'core'); if ($member['_canBeIgnored'] !== TRUE) { $this->returnString("no"); } //----------------------------------------- // Get ignore record //----------------------------------------- $_ignore = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'ignored_users', 'where' => "ignore_owner_id=" . $this->memberData['member_id'] . ' AND ignore_ignore_id=' . $id)); if ($_ignore['ignore_id']) { $this->DB->update('ignored_users', array('ignore_chats' => $block ? 1 : 0), 'ignore_id=' . $_ignore['ignore_id']); } else { $_ignore = array('ignore_owner_id' => $this->memberData['member_id'], 'ignore_ignore_id' => $id, 'ignore_chats' => 1); $this->DB->insert('ignored_users', $_ignore); } //----------------------------------------- // Update cache //----------------------------------------- IPSMember::rebuildIgnoredUsersCache($this->memberData); //----------------------------------------- // Something to return //----------------------------------------- $this->returnString("ok"); }
/** * Checks a display name * * @return @e void [Outputs JSON to browser AJAX call] */ protected function displayNameCheck() { //----------------------------------------- // INIT //----------------------------------------- $name = strtolower($this->convertAndMakeSafe($this->request['name'], 0)); $name = str_replace("+", "+", $name); $member = array(); $return = TRUE; $id = intval($this->request['member_id']); # Set member ID $id = $this->memberData['member_id'] ? $this->memberData['member_id'] : $id; //----------------------------------------- // Load member if required //----------------------------------------- if ($id != $this->memberData['member_id']) { $member = IPSMember::load($id, 'all'); } else { $member = $this->member->fetchMemberData(); } //----------------------------------------- // Test name //----------------------------------------- try { $return = IPSMember::getFunction()->checkNameExists($name, $member); } catch (Exception $error) { $_msg = $error->getMessage(); if ($_msg == 'NO_MORE_CHANGES') { $this->returnString('nomorechanges'); return; } # Really, we're not very interested why it didn't work at this point, so # just return with a 'found' string which will make a nice red cross and # force the user to choose another. $this->returnString('found'); return; } //----------------------------------------- // So, what's it to be? //----------------------------------------- $this->returnString($return === TRUE ? 'found' : 'notfound'); }
/** * Set a member for the scope of this class * @param mixed */ public function setMember($member) { if (is_numeric($member)) { $this->Member = IPSMember::load($member); } else { if (is_array($member) && !empty($member['member_id'])) { $this->Member = $member; } else { trigger_error("Member data incorrect", E_USER_ERROR); } } /* Load bookmarks */ $bookmarks = array(); $this->DB->build(array('select' => '*', 'from' => 'core_sys_bookmarks', 'where' => 'bookmark_member_id=' . intval($this->Member['member_id']), 'order' => 'bookmark_pos ASC')); $b = $this->DB->execute(); while ($row = $this->DB->fetch($b)) { $bookmarks[$row['bookmark_id']] = $row; } $this->Bookmarks = $bookmarks; }
/** * Class entry point * * @param object Registry reference * @return @e void [Outputs to screen] */ public function doExecute(ipsRegistry $registry) { //----------------------------------------- // INIT //----------------------------------------- $info = array(); $id = intval($this->request['id']); //----------------------------------------- // Get HTML and skin //----------------------------------------- $this->registry->class_localization->loadLanguageFile(array('public_profile'), 'members'); //----------------------------------------- // Can we access? //----------------------------------------- if (!$this->memberData['g_mem_info']) { $this->returnJsonError($this->lang->words['dname_profiles_off']); } if (!$this->settings['auth_allow_dnames']) { $this->returnJsonError($this->lang->words['dnames_off']); } if (!$id) { $this->returnJsonError($this->lang->words['dnames_no_id']); } $member = IPSMember::load($id); //----------------------------------------- // Get Dname history //----------------------------------------- $this->DB->build(array('select' => 'd.*', 'from' => array('dnames_change' => 'd'), 'where' => 'dname_member_id=' . $id, 'add_join' => array(0 => array('select' => 'm.members_display_name', 'from' => array('members' => 'm'), 'where' => 'm.member_id=d.dname_member_id', 'type' => 'inner')), 'order' => 'dname_date DESC')); $this->DB->execute(); while ($row = $this->DB->fetch()) { $records[] = $row; } //----------------------------------------- // Print the pop-up window //----------------------------------------- $html = $this->registry->getClass('output')->getTemplate('profile')->dnameWrapper($member['members_display_name'], $records); //----------------------------------------- // Push to print handler //----------------------------------------- $this->returnHtml($html); }
/** * Returns content for the page. * * @access public * @author Matt Mecham * @param array Member data * @return array Array of tabs, content */ public function getDisplayContent($member = array()) { //----------------------------------------- // Load skin //----------------------------------------- $this->html = ipsRegistry::getClass('output')->loadTemplate('cp_skin_member_form', 'forums'); //----------------------------------------- // Load lang //----------------------------------------- ipsRegistry::getClass('class_localization')->loadLanguageFile(array('admin_forums'), 'forums'); ipsRegistry::getClass('class_localization')->loadLanguageFile(array('admin_member_form'), 'forums'); //----------------------------------------- // Get member data //----------------------------------------- $member = IPSMember::load($member['member_id'], 'extendedProfile'); $member['_avatar'] = str_replace('<img ', '<img id="MF__avatar" ', IPSMember::buildAvatar($member)); //----------------------------------------- // Show... //----------------------------------------- return array('tabs' => $this->html->acp_member_form_tabs($member), 'content' => $this->html->acp_member_form_main($member)); }
/** * Loads the content for the friends tab * * @access private * @return void [Prints to screen] * @since IPB 2.2.0.2006-08-15 */ private function _iframeList() { //----------------------------------------- // INIT //----------------------------------------- $member_id = intval($this->request['member_id']); $content = ''; $friends = array(); //----------------------------------------- // Load member //----------------------------------------- $member = IPSMember::load($member_id); //----------------------------------------- // Check //----------------------------------------- if (!$member['member_id']) { $this->returnString($this->lang->words['nofriendid']); } //----------------------------------------- // Grab the friends //----------------------------------------- $this->DB->build(array('select' => 'f.*', 'from' => array('profile_friends' => 'f'), 'where' => 'f.friends_member_id=' . $member_id . ' AND f.friends_approved=1', 'order' => 'm.members_display_name ASC', 'add_join' => array(1 => array('select' => 'pp.*', 'from' => array('profile_portal' => 'pp'), 'where' => 'pp.pp_member_id=f.friends_friend_id', 'type' => 'left'), 2 => array('select' => 'm.*', 'from' => array('members' => 'm'), 'where' => 'm.member_id=f.friends_friend_id', 'type' => 'left')))); $outer = $this->DB->execute(); //----------------------------------------- // Get and store... //----------------------------------------- while ($row = $this->DB->fetch($outer)) { $row['members_display_name_short'] = IPSText::truncate($row['members_display_name'], 13); $friends[] = IPSMember::buildDisplayData($row, 0); } //----------------------------------------- // Ok.. show the friends //----------------------------------------- $content = $this->registry->getClass('output')->getTemplate('profile')->friendsIframe($member, $friends); $this->returnHtml($content); }
/** * Returns the editor for viewing ... * @param unknown_type $member */ public function getEditorHtml(array $member) { /* Fetch member data */ $member = IPSMember::buildDisplayData(IPSMember::load($member['member_id'], 'all')); $p_w = ""; $p_h = ""; $cur_photo = ""; $rand = urlencode(microtime()); $data = array('currentPhoto' => array('tag' => ''), 'custom' => array('tag' => ''), 'gravatar' => array('tag' => ''), 'twitter' => array('tag' => '')); /* Photo type */ $data['type'] = $member['pp_photo_type'] = $this->getPhotoType($member); /* Got gravatar? */ $member['pp_gravatar'] = $member['pp_gravatar'] ? $member['pp_gravatar'] : $member['email']; /* Quick permission check */ if (!IPSMember::canUploadPhoto($member, TRUE)) { return false; } /* Set the current photo */ $data['currentPhoto']['tag'] = IPSMember::buildProfilePhoto($member, 'full', IPS_MEMBER_PHOTO_NO_CACHE); /* Set up custom */ $data['custom']['tag'] = $member['pp_photo_type'] != 'custom' ? IPSMember::buildNoPhoto($member, 'thumb', false, true) : "<img src='" . $member['pp_thumb_photo'] . '?__rand=' . $rand . "' width='" . $member['pp_thumb_width'] . "' height='" . $member['pp_thumb_height'] . "' />"; /* Set up Gravatar */ $data['gravatar']['tag'] = "<img src='http://www.gravatar.com/avatar/" . md5($member['pp_gravatar']) . "?s=100' alt='' />"; /* Twitter linked? */ if (IPSLib::twitter_enabled() && $member['twitter_token'] && $member['twitter_secret']) { $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/twitter/connect.php', 'twitter_connect'); $twitter = new $classToLoad($this->registry, $member['twitter_token'], $member['twitter_secret']); $userData = $twitter->fetchUserData(); if ($userData['profile_image_url']) { $data['twitter']['tag'] = "<img src='" . str_replace('_normal.', '.', $userData['profile_image_url']) . "' />"; } } /* Facebook linked? */ if (IPSLib::fbc_enabled() && $member['fb_uid']) { $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/facebook/connect.php', 'facebook_connect'); $facebook = new $classToLoad($this->registry); /* Now get the linked user */ $linkedMemberData = IPSMember::load(intval($member['fb_uid']), 'all', 'fb_uid'); $userData = $facebook->fetchUserData(); if ($userData['pic_big']) { $data['facebook']['tag'] = "<img src='" . $userData['pic_big'] . "' />"; } else { if ($userData['pic']) { $data['facebook']['tag'] = "<img src='" . $userData['pic'] . "' />"; } } } $this->uploadFormMax = 5000 * 1024; return $this->registry->getClass('output')->getTemplate('profile')->photoEditor($data, $member); }
/** * Load a member * * @access public * @param string Username * @return @e void */ public function loadMember($username) { $member = $this->DB->buildAndFetch(array('select' => 'member_id', 'from' => 'members', 'where' => "members_l_username='******'")); if ($member['member_id']) { $this->_memberData = IPSMember::load($member['member_id'], 'extendedProfile,groups'); } }
/** * Show a single event based on eventid * * @return @e void */ public function calendarShowEvent() { //----------------------------------------- // Init //----------------------------------------- $event_id = intval($this->request['event_id']); if (!$event_id) { $this->registry->output->showError('calendar_event_not_found', 10429, null, null, 404); } //----------------------------------------- // Get the event data //----------------------------------------- $_joins = array(array('select' => 'm.*', 'from' => array('members' => 'm'), 'where' => 'm.member_id=e.event_member_id', 'type' => 'left'), array('select' => 'pp.*', 'from' => array('profile_portal' => 'pp'), 'where' => 'm.member_id=pp.pp_member_id', 'type' => 'left')); if ($this->settings['reputation_enabled']) { $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/class_reputation_cache.php', 'classReputationCache'); $this->registry->setClass('repCache', new $classToLoad()); $_joins[] = $this->registry->getClass('repCache')->getTotalRatingJoin('event_id', $event_id, 'calendar'); $_joins[] = $this->registry->getClass('repCache')->getUserHasRatedJoin('event_id', $event_id, 'calendar'); } $event = $this->DB->buildAndFetch(array('select' => 'e.*', 'from' => array('cal_events' => 'e'), 'where' => 'e.event_id=' . $event_id, 'add_join' => $_joins)); if (!$event['event_id']) { $this->registry->output->showError('calendar_event_not_found', 10430, null, null, 404); } //----------------------------------------- // Reset calendar //----------------------------------------- $this->calendar = $this->functions->getCalendar($event['event_calendar_id']); if ($this->calendar['cal_id'] != $event['event_calendar_id']) { $this->registry->output->showError('cal_no_perm', 1040.22, null, null, 403); } //----------------------------------------- // Check permissions //----------------------------------------- if ($event['event_private'] and $this->memberData['member_id'] != $event['event_member_id']) { $this->registry->output->showError('calendar_event_not_found', 10431, null, null, 403); } if (!$this->memberData['g_is_supmod'] and !$event['event_approved']) { $this->registry->output->showError('calendar_event_not_found', 10432.1, null, null, 404); } if ($event['event_perms'] != '*') { $permissionGroups = explode(',', IPSText::cleanPermString($event['event_perms'])); if (!IPSMember::isInGroup($this->memberData, $permissionGroups)) { $this->registry->output->showError('calendar_event_not_found', 10432, null, null, 404); } } //----------------------------------------- // Are we RSVPing? //----------------------------------------- if ($this->request['_rsvp'] and $event['event_rsvp']) { if ($this->registry->permissions->check('rsvp', $this->calendar) and $this->memberData['member_id']) { //----------------------------------------- // Make sure we aren't already RSVPed //----------------------------------------- $_check = $this->DB->buildAndFetch(array('select' => 'rsvp_id', 'from' => 'cal_event_rsvp', 'where' => 'rsvp_event_id=' . $event['event_id'] . ' AND rsvp_member_id=' . $this->memberData['member_id'])); if (!$_check['rsvp_id']) { $_insert = array('rsvp_event_id' => $event['event_id'], 'rsvp_member_id' => $this->memberData['member_id'], 'rsvp_date' => time()); $this->DB->insert('cal_event_rsvp', $_insert); $this->registry->output->redirectScreen($this->lang->words['rsvp_saved_im'], $this->settings['base_url'] . "app=calendar&module=calendar&section=view&do=showevent&event_id=" . $event['event_id'], $event['event_title_seo'], 'cal_event'); } } } //----------------------------------------- // Comments class //----------------------------------------- require_once IPS_ROOT_PATH . 'sources/classes/comments/bootstrap.php'; /*noLibHook*/ $this->_comments = classes_comments_bootstrap::controller('calendar-events'); $comments = array('html' => $this->_comments->fetchFormatted($event, array('offset' => intval($this->request['st']))), 'count' => $this->_comments->count($event)); //----------------------------------------- // Highlight... //----------------------------------------- if ($this->request['hl']) { $event['event_content'] = IPSText::searchHighlight($event['event_content'], $this->request['hl']); $event['event_title'] = IPSText::searchHighlight($event['event_title'], $this->request['hl']); } //----------------------------------------- // Can we report? //----------------------------------------- $classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('core') . '/sources/classes/reportLibrary.php', 'reportLibrary', 'core'); $reports = new $classToLoad($this->registry); $event['_canReport'] = $reports->canReport('calendar'); //----------------------------------------- // Output //----------------------------------------- $member = IPSMember::load($event['event_member_id'], 'all'); $this->registry->output->addNavigation($this->calendar['cal_title'], "app=calendar&module=calendar&section=view&cal_id={$this->calendar['cal_id']}", $this->calendar['cal_title_seo'], 'cal_calendar'); //----------------------------------------- // Try to match out and improve navigation //----------------------------------------- $_referrer = $_SERVER['HTTP_REFERER']; if ($_referrer) { //----------------------------------------- // Came from add form? //----------------------------------------- if (preg_match("#/add\$#", $_referrer)) { $_data = $this->calendarMakeEventHTML($event, true); $_dateBits = explode('-', gmstrftime('%Y-%m-%d-%B', $_data['event']['_start_time'])); $this->registry->output->addNavigation($_dateBits[3] . ' ' . $_dateBits[0], "app=calendar&module=calendar&section=view&cal_id={$this->calendar['cal_id']}&m={$_dateBits[1]}&y={$_dateBits[0]}", $this->calendar['cal_title_seo'], 'cal_month'); $this->registry->output->addNavigation($_dateBits[3] . ' ' . $_dateBits[2] . ', ' . $_dateBits[0], "app=calendar&module=calendar&section=view&cal_id={$this->calendar['cal_id']}&do=showday&y={$_dateBits[0]}&m={$_dateBits[1]}&d={$_dateBits[2]}", $this->calendar['cal_title_seo'], 'cal_day'); } else { if (preg_match("#/day\\-(\\d{4})\\-(\\d{1,2})\\-(\\d{1,2})\$#i", $_referrer, $matches)) { $_dateBits = explode('-', gmstrftime('%Y-%m-%d-%B', gmmktime(0, 0, 0, $matches[2], $matches[3], $matches[1]))); $this->registry->output->addNavigation($_dateBits[3] . ' ' . $_dateBits[0], "app=calendar&module=calendar&section=view&cal_id={$this->calendar['cal_id']}&m={$_dateBits[1]}&y={$_dateBits[0]}", $this->calendar['cal_title_seo'], 'cal_month'); $this->registry->output->addNavigation($_dateBits[3] . ' ' . $_dateBits[2] . ', ' . $_dateBits[0], "app=calendar&module=calendar&section=view&cal_id={$this->calendar['cal_id']}&do=showday&y={$_dateBits[0]}&m={$_dateBits[1]}&d={$_dateBits[2]}", $this->calendar['cal_title_seo'], 'cal_day'); } else { if (preg_match("#/week\\-(\\d+?)\$#i", $_referrer, $matches)) { $_dateBits = explode('-', gmstrftime('%Y-%m-%d-%B', $matches[1])); $this->registry->output->addNavigation($_dateBits[3] . ' ' . $_dateBits[0], "app=calendar&module=calendar&section=view&cal_id={$this->calendar['cal_id']}&m={$_dateBits[1]}&y={$_dateBits[0]}", $this->calendar['cal_title_seo'], 'cal_month'); $this->registry->output->addNavigation("{$this->lang->words['week_beginning']} " . gmstrftime('%B %d, %Y', $matches[1]), "app=calendar&module=calendar&section=view&cal_id={$this->calendar['cal_id']}&do=showweek&week={$matches[1]}", $this->calendar['cal_title_seo'], 'cal_week'); } else { if (preg_match("#/(\\d{1,2})\\-(\\d{4})\$#i", $_referrer, $matches)) { $_dateBits = explode('-', gmstrftime('%Y-%m-%d-%B', gmmktime(0, 0, 0, $matches[1], 15, $matches[2]))); $this->registry->output->addNavigation($_dateBits[3] . " " . $_dateBits[0], "app=calendar&module=calendar&section=view&cal_id={$this->calendar['cal_id']}&m={$_dateBits[1]}&y={$_dateBits[0]}", $this->calendar['cal_title_seo'], 'cal_month'); } else { if (preg_match("#/(\\d+?)\\-(.+?)\$#i", $_referrer, $matches)) { $_data = $this->calendarMakeEventHTML($event, true); $_dateBits = explode('-', gmstrftime('%Y-%m-%d-%B', $_data['event']['_start_time'])); $this->registry->output->addNavigation($_dateBits[3] . " " . $_dateBits[0], "app=calendar&module=calendar&section=view&cal_id={$this->calendar['cal_id']}&m={$_dateBits[1]}&y={$_dateBits[0]}", $this->calendar['cal_title_seo'], 'cal_month'); } else { $_data = $this->calendarMakeEventHTML($event, true); $_dateBits = explode('-', gmstrftime('%Y-%m-%d-%B', $_data['event']['_start_time'])); $this->registry->output->addNavigation($_dateBits[3] . ' ' . $_dateBits[0], "app=calendar&module=calendar&section=view&cal_id={$this->calendar['cal_id']}&m={$_dateBits[1]}&y={$_dateBits[0]}", $this->calendar['cal_title_seo'], 'cal_month'); $this->registry->output->addNavigation($_dateBits[3] . ' ' . $_dateBits[2] . ', ' . $_dateBits[0], "app=calendar&module=calendar&section=view&cal_id={$this->calendar['cal_id']}&do=showday&y={$_dateBits[0]}&m={$_dateBits[1]}&d={$_dateBits[2]}", $this->calendar['cal_title_seo'], 'cal_day'); } } } } } } //----------------------------------------- // Finish output //----------------------------------------- $this->registry->output->addNavigation($event['event_title']); $this->registry->output->addMetaTag('keywords', $this->chosen_date['month_name'] . ' ' . $_dateBits[2] . ' events event calendar ' . $event['event_title'] . ' ' . IPSText::getTextClass('bbcode')->stripAllTags($event['event_content']), TRUE); $this->registry->output->addMetaTag('description', str_replace("\n", " ", str_replace("\r", "", IPSText::getTextClass('bbcode')->stripAllTags($event['event_content']))), FALSE, 155); $this->registry->output->addToDocumentHead('raw', "<link rel='up' href='" . $this->registry->output->buildSEOUrl('app=calendar&module=calendar&section=view&cal_id=' . $event['event_calendar_id'], 'publicNoSession', $this->calendar['cal_title_seo'], 'cal_calendar') . "' />"); $this->registry->output->addToDocumentHead('raw', "<link rel='author' href='" . $this->registry->output->buildSEOUrl('showuser='******'event_member_id'], 'publicNoSession', $member['members_seo_name'], 'showuser') . "' />"); $this->registry->getClass('output')->addCanonicalTag('app=calendar&module=calendar&section=view&do=showevent&event_id=' . $event['event_id'], $event['event_title_seo'], 'cal_event'); $this->page_title = $event['event_title']; $this->output .= $this->registry->output->getTemplate('calendar')->calendarShowEvent($this->calendarMakeEventHTML($event), $comments); }
/** * Converge_Server::__create_user_account() * * Routine to create a local user account * * @access public * @param string $email_address Email address of user logged in * @param string $md5_once_password The plain text password, hashed once * @param string $ip_address IP Address of registree * @param string $unix_join_date The member's join date in unix format * @param string $timezone The member's timezone * @param string $dst_autocorrect The member's DST autocorrect settings * @param string $username The member's username * @return array $member Newly created member array * * @deprecated Doesn't seem to be used anymore, need to verify properly for the next major revision */ protected function __create_user_account($email_address = '', $md5_once_password, $ip_address, $unix_join_date, $timezone = 0, $dst_autocorrect = 0, $username = '') { //----------------------------------------- // Check to make sure there's not already // a member registered. //----------------------------------------- $member = IPSMember::load($email_address); if ($member['member_id']) { return $member; } //----------------------------------------- // INIT //----------------------------------------- $unix_join_date = $unix_join_date ? $unix_join_date : time(); $ip_address = $ip_address ? $ip_address : $this->member->ip_address; //----------------------------------------- // Create member //----------------------------------------- $member = IPSMember::create(array('members' => array('email' => $email_address, 'password' => $md5_once_password, 'name' => $username, 'members_display_name' => $username, 'joined' => $unix_join_date, 'ip_address' => $ip_address, 'members_created_remote' => true)), false, true, false); return $member; }
/** * Add a friend * * @return @e void [Prints to screen] * @since IPB 2.2.0.2006-08-09 */ protected function _addFriend() { /* INIT */ $friend_id = intval($this->request['member_id']); $_friend = IPSMember::load($friend_id, 'core'); /* Check the secure key */ $this->request['secure_key'] = $this->request['secure_key'] ? $this->request['secure_key'] : $this->request['md5check']; if ($this->request['secure_key'] != $this->member->form_hash) { $this->registry->output->showError('no_permission', 10273, null, null, 403); } /* Add the friend */ $result = $this->friend_lib->addFriend($friend_id); /* Add to other user as well, but only if not pending */ if (!$this->friend_lib->pendingApproval) { $result2 = $this->friend_lib->addFriend($this->memberData['member_id'], $friend_id, true); } if ($result) { $this->registry->output->showError($result, 10241); } else { $this->registry->output->redirectScreen($this->lang->words['friend_added_ok'], $this->settings['base_url'] . 'showuser='******'showuser', $_friend['members_seo_name']); } }
/** * Account is validated * * @param int ID number * @param string md5( IPS Connect Key (see login method) . ID number ) */ public function validate($id, $key) { if ($key != md5($this->masterKey . $id)) { $this->_return(base64_encode($this->settings['board_url']), array('status' => 'BAD_KEY')); } $member = IPSMember::load(intval($id), 'none', 'id'); if (!$member['member_id']) { $this->_return($redirect, array('status' => 'NO_USER')); } if ($member['member_group_id'] == ipsRegistry::$settings['auth_group']) { IPSMember::save($member['member_id'], array('members' => array('member_group_id' => ipsRegistry::$settings['member_group'], 'ipsconnect_revalidate_url' => ''))); } ipsRegistry::DB()->delete('validating', "member_id={$member['member_id']} and new_reg=1"); $this->_return($redirect, array('status' => 'SUCCESS')); }
/** * Check if a member exists * * @param string $api_key Authentication Key * @param string $api_module Module * @param string $search_type Member field to check (valid: "id", "email", "username", "displayname") * @param string $search_string String to search for * @return string xml */ public function checkMemberExists($api_key, $api_module, $search_type, $search_string) { //----------------------------------------- // INIT //----------------------------------------- $api_key = IPSText::md5Clean($api_key); $api_module = IPSText::parseCleanValue($api_module); $search_type = IPSText::parseCleanValue($search_type); $search_string = IPSText::parseCleanValue($search_string); //----------------------------------------- // Authenticate //----------------------------------------- if ($this->__authenticate($api_key, $api_module, 'checkMemberExists') !== FALSE) { //----------------------------------------- // Add log //----------------------------------------- $this->addLogging($api_key); $member = IPSMember::load($search_string, 'all', $search_type); //----------------------------------------- // Return the data //----------------------------------------- $this->classApiServer->apiSendReply(array('memberExists' => $member['member_id'] ? true : false)); exit; } }
/** * Load a member * * @access protected * @param string Username * @return @e void */ protected function _loadMember($username) { $member = $this->DB->buildAndFetch(array('select' => 'member_id', 'from' => 'members', 'where' => "members_l_username='******'")); if ($member['member_id']) { $this->member_data = IPSMember::load($member['member_id'], 'extendedProfile,groups'); } }
/** * Load a member from an identity url and then try by email * * @access private * @param string Identity URL * @param string Email Address * @return void */ private function _loadMember($url, $email) { $check = $this->DB->buildAndFetch(array('select' => 'email', 'from' => 'members', 'where' => "identity_url='" . $this->DB->addSlashes($this->data_store['fullurl']) . "'")); if ($check['email']) { $this->member_data = IPSMember::load($check['email'], 'extendedProfile,groups'); } else { $this->member_data = array('member_id' => 0); //IPSMember::load( $email, 'extendedProfile,groups' ); } }
/** * Show the online list * * @return @e void [Stores HTML in $this->output] */ protected function _listAll() { //----------------------------------------- // INIT //----------------------------------------- $this->first = intval($this->request['st']) > 0 ? intval($this->request['st']) : 0; $final = array(); $modules = array(); $memberIDs = array(); if (!$this->settings['au_cutoff']) { $this->settings['au_cutoff'] = 15; } $defaults = array('show_mem' => ($this->request['show_mem'] and in_array($this->request['show_mem'], array('reg', 'guest', 'all'))) ? $this->request['show_mem'] : 'all', 'sort_order' => ($this->request['sort_order'] and in_array($this->request['sort_order'], array('desc', 'asc'))) ? $this->request['sort_order'] : 'asc', 'sort_key' => ($this->request['sort_key'] and in_array($this->request['sort_key'], array('click', 'name'))) ? $this->request['sort_key'] : 'click'); //----------------------------------------- // Sort the db query //----------------------------------------- $cut_off = $this->settings['au_cutoff'] * 60; $t_time = time() - $cut_off; $db_order = $defaults['sort_order'] == 'asc' ? 'asc' : 'desc'; $db_key = $defaults['sort_key'] == 'click' ? 'running_time' : 'member_name'; $wheres = array('running_time > ' . $t_time); switch ($defaults['show_mem']) { case 'reg': $wheres[] = "member_id > 0"; $wheres[] = "member_group != " . $this->settings['guest_group']; break; case 'guest': $wheres[] = "member_group = " . $this->settings['guest_group']; break; } if (!$this->settings['spider_active'] and !$this->memberData['g_access_cp']) { $wheres[] = $this->DB->buildRight('id', 8) . " != '_session'"; } if (!$this->memberData['g_access_cp']) { $wheres[] = "login_type != 1"; } //----------------------------------------- // Grab all the current sessions. //----------------------------------------- $this->DB->build(array('select' => '*', 'from' => 'sessions', 'where' => implode(' AND ', $wheres), 'calcRows' => TRUE, 'order' => $db_key . ' ' . $db_order, 'limit' => array($this->first, $this->perpage))); $outer = $this->DB->execute(); $max = $this->DB->fetchCalculatedRows(); if (!$this->DB->getTotalRows($outer) && $this->first > 0) { // We are request page 2 - but there is no page 2 now... $this->registry->output->silentRedirect($this->settings['base_url'] . "app=members&section=online&module=online&sortkey={$defaults['sort_key']}&show_mem={$defaults['show_mem']}&sort_order={$defaults['sort_order']}"); } //----------------------------------------- // Put results into array //----------------------------------------- while ($r = $this->DB->fetch($outer)) { if (strstr($r['id'], '_session')) { $r['is_bot'] = 1; } $r['where_line'] = ''; $r['where_link'] = ''; //----------------------------------------- // Sessions aren't updated until shutdown // so reset our session now //----------------------------------------- if ($this->memberData['member_id'] and $r['member_id'] == $this->memberData['member_id']) { $r['current_appcomponent'] = 'members'; $r['current_module'] = 'online'; $r['current_section'] = 'online'; } //----------------------------------------- // Is this a member? //----------------------------------------- if ($r['member_id']) { $memberIDs[] = $r['member_id']; } //----------------------------------------- // Don't parse if in an error //----------------------------------------- if ($r['in_error']) { $r['current_appcomponent'] = 'core'; } $final[$r['id']] = $r; //----------------------------------------- // Module? //----------------------------------------- $modules[$r['current_section']] = array('app' => $r['current_appcomponent']); } $links = $this->registry->output->generatePagination(array('totalItems' => $max, 'itemsPerPage' => $this->perpage, 'currentStartValue' => $this->first, 'baseUrl' => "app=members&section=online&module=online&sort_key={$defaults['sort_key']}&sort_order={$defaults['sort_order']}&show_mem={$defaults['show_mem']}")); //----------------------------------------- // Pass off entries to modules.. //----------------------------------------- if (count($modules)) { foreach ($modules as $module_array) { if (IPSLib::appIsInstalled($module_array['app'])) { $module_array['app'] = IPSText::alphanumericalClean($module_array['app']); $filename = IPSLib::getAppDir($module_array['app']) . '/extensions/coreExtensions.php'; if (is_file($filename)) { $classToLoad = IPSLib::loadLibrary($filename, 'publicSessions__' . $module_array['app'], $module_array['app']); $loader = new $classToLoad(); if (method_exists($loader, 'parseOnlineEntries')) { $final = $loader->parseOnlineEntries($final); } } } } } //----------------------------------------- // Finally, members... //----------------------------------------- if (count($memberIDs)) { $members = IPSMember::load($memberIDs, 'all'); } $newFinal = array(); if (is_array($final) and count($final)) { foreach ($final as $id => $data) { if ($data['member_id']) { $newFinal['member-' . $data['member_id']] = $data; $newFinal['member-' . $data['member_id']]['memberData'] = $members[$data['member_id']]; $newFinal['member-' . $data['member_id']]['_memberData'] = IPSMember::buildProfilePhoto($members[$data['member_id']]); } else { $newFinal[$data['id']] = $data; $newFinal[$data['id']]['memberData'] = array(); $newFinal[$data['id']]['_memberData'] = IPSMember::buildProfilePhoto(0); } } } //----------------------------------------- // Set defaults //----------------------------------------- foreach (array('sort_key', 'sort_order', 'show_mem') as $k) { if (!$this->request[$k]) { $this->request[$k] = $defaults[$k]; } } //----------------------------------------- // Output //----------------------------------------- $this->output .= $this->registry->getClass('output')->getTemplate('online')->showOnlineList($newFinal, $links, $defaults); }
/** * handshake_server::handshake_start() * * Returns all data... * * @access public * @param integer $reg_id Converge reg ID * @param string $reg_code Converge API Code (MUST BE PRESENT IN ALL RETURNED API REQUESTS). * @param integer $reg_date Unix stamp of converge request start time * @param integer $reg_product_id Converge product ID (MUST BE PRESENT IN ALL RETURNED API REQUESTS) * @param string $converge_url Converge application base url (no slashes or paths) * @return mixed xml / boolean false **/ public function handshakeStart($reg_id = '', $reg_code = '', $reg_date = '', $reg_product_id = '', $converge_url = '', $acp_email = '', $acp_md5_password = '', $http_user = '', $http_pass = '') { //----------------------------------------- // INIT //----------------------------------------- $reg_id = intval($reg_id); $reg_code = IPSText::md5Clean($reg_code); $reg_date = intval($reg_date); $reg_product_id = intval($reg_product_id); $converge_url = IPSText::parseCleanValue($converge_url); $acp_email = IPSText::parseCleanValue($acp_email); $acp_md5_password = IPSText::md5Clean($acp_md5_password); $this->registry->getClass('class_localization')->loadLanguageFile(array('api_langbits'), 'core'); //----------------------------------------- // Check ACP user //----------------------------------------- if (!$acp_email and !$acp_md5_password) { $this->classApiServer->apiSendError(500, $this->lang->words['missing_email']); return false; } else { $member = IPSMember::load($acp_email, 'extendedProfile,groups'); if (!$member['member_id']) { $this->classApiServer->apiSendError(501, $this->lang->words['bad_email']); return false; } else { //----------------------------------------- // Are we an admin? //----------------------------------------- if ($member['g_access_cp'] != 1) { $this->classApiServer->apiSendError(501, $this->lang->words['no_acp_access']); return false; } //----------------------------------------- // Check password... //----------------------------------------- if (IPSMember::authenticateMember($member['member_id'], $acp_md5_password) != true) { $this->classApiServer->apiSendError(501, $this->lang->words['bad_email']); return false; } } } //----------------------------------------- // Just send it all back and start // A row in the converge_local table with // the info, but don't flag as active... //----------------------------------------- $reply = array('master_response' => 1, 'reg_id' => $reg_id, 'reg_code' => $reg_code, 'reg_date' => $reg_date, 'reg_product_id' => $reg_product_id, 'converge_url' => $converge_url); //----------------------------------------- // Add into DB //----------------------------------------- $this->registry->DB()->insert('converge_local', array('converge_api_code' => $reg_code, 'converge_product_id' => $reg_product_id, 'converge_added' => $reg_date, 'converge_ip_address' => my_getenv('REMOTE_ADDR'), 'converge_url' => $converge_url, 'converge_active' => 0, 'converge_http_user' => $http_user, 'converge_http_pass' => $http_pass)); //----------------------------------------- // Send reply... //----------------------------------------- $this->classApiServer->apiSendReply($reply); }