Esempio n. 1
0
 /**
  * Constructor
  *
  */
 public function __construct()
 {
     /* Make registry objects */
     $this->registry = ipsRegistry::instance();
     $this->DB = $this->registry->DB();
     $this->settings =& $this->registry->fetchSettings();
     $this->request =& $this->registry->fetchRequest();
     $this->lang = $this->registry->getClass('class_localization');
     $this->member = $this->registry->member();
     $this->memberData =& $this->registry->member()->fetchMemberData();
     $this->cache = $this->registry->cache();
     $this->caches =& $this->registry->cache()->fetchCaches();
     /* Check for class_forums */
     if (ipsRegistry::isClassLoaded('class_forums') !== TRUE) {
         $classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('forums') . "/sources/classes/forums/class_forums.php", 'class_forums', 'forums');
         $this->registry->setClass('class_forums', new $classToLoad($this->registry));
         $this->registry->class_forums->forumsInit();
     }
     /* Load topic class */
     if (!$this->registry->isClassLoaded('topics')) {
         $classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('forums') . "/sources/classes/topics.php", 'app_forums_classes_topics', 'forums');
         $this->registry->setClass('topics', new $classToLoad($this->registry));
     }
     /* Language class */
     $this->registry->getClass('class_localization')->loadLanguageFile(array('public_global'), 'core');
     /* Fetch engine class */
     $this->settings['archive_engine'] = $this->settings['archive_engine'] ? $this->settings['archive_engine'] : 'sql';
     /* Load up archive class */
     $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/archive/reader/' . $this->settings['archive_engine'] . '.php', 'classes_archive_reader_' . $this->settings['archive_engine']);
     $this->engine = new $classToLoad();
     $this->fields = $this->registry->topics->getPostTableFields();
 }
Esempio n. 2
0
 /**
  * Constructor
  * 
  * @return	@e void
  */
 public function __construct(ipsRegistry $registry)
 {
     /* Get class forums, used for displaying forum names on results */
     if (ipsRegistry::isClassLoaded('class_forums') !== TRUE) {
         $classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('forums') . "/sources/classes/forums/class_forums.php", 'class_forums', 'forums');
         ipsRegistry::setClass('class_forums', new $classToLoad(ipsRegistry::instance()));
         ipsRegistry::getClass('class_forums')->strip_invisible = 1;
         ipsRegistry::getClass('class_forums')->forumsInit();
     }
     /* Load tagging stuff */
     if (!$registry->isClassLoaded('tags')) {
         require_once IPS_ROOT_PATH . 'sources/classes/tags/bootstrap.php';
         /*noLibHook*/
         $registry->setClass('tags', classes_tags_bootstrap::run('forums', 'topics'));
     }
     /* Get live or archive */
     $this->searchArchives = ipsRegistry::$request['search_app_filters']['forums']['liveOrArchive'] == 'archive' ? true : false;
     if ($this->searchArchives) {
         /* Load up archive class */
         $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/archive/reader.php', 'classes_archive_reader');
         $this->archiveReader = new $classToLoad();
         $this->archiveReader->setApp('forums');
         $this->table = $this->archiveReader->getFields();
         $this->table['_table_'] = 'forums_archive_posts';
         $this->table['_prefix_'] = 'p.archive_';
     } else {
         $this->table = array('_table_' => 'posts', '_prefix_' => 'p.', 'pid' => 'pid', 'author_id' => 'author_id', 'author_name' => 'author_name', 'ip_address' => 'ip_address', 'post_date' => 'post_date', 'post' => 'post', 'queued' => 'queued', 'topic_id' => 'topic_id', 'new_topic' => 'new_topic', 'post_bwoptions' => 'post_bwoptions', 'post_key' => 'post_key', 'post_htmlstate' => 'post_htmlstate', 'use_sig' => 'use_sig', 'use_emo' => 'use_emo', 'append_edit' => 'append_edit', 'edit_time' => 'edit_time', 'edit_name' => 'edit_name', 'post_edit_reason' => 'post_edit_reason');
     }
     parent::__construct($registry);
     /* Set up wrapper */
     $this->templates = array('group' => 'search', 'template' => 'searchResultsAsForum');
 }
Esempio n. 3
0
 /**
  * Constructor
  * 
  * @return	@e void
  */
 public function __construct(ipsRegistry $registry)
 {
     /* Hard limit - not used in Sphinx but may need to revisit if we bust IN()s */
     //IPSSearchRegistry::set('set.hardLimit', ( ipsRegistry::$settings['search_hardlimit'] ) ? ipsRegistry::$settings['search_hardlimit'] : 200 );
     /* Get class forums, used for displaying forum names on results */
     if (ipsRegistry::isClassLoaded('class_forums') !== TRUE) {
         $classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('forums') . "/sources/classes/forums/class_forums.php", 'class_forums', 'forums');
         ipsRegistry::setClass('class_forums', new $classToLoad(ipsRegistry::instance()));
         ipsRegistry::getClass('class_forums')->strip_invisible = 1;
         ipsRegistry::getClass('class_forums')->forumsInit();
     }
     /* Get live or archive */
     $this->searchArchives = ipsRegistry::$request['search_app_filters']['forums']['liveOrArchive'] == 'archive' ? true : false;
     if ($this->searchArchives) {
         /* Load up archive class */
         $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/archive/reader.php', 'classes_archive_reader');
         $this->archiveReader = new $classToLoad();
         $this->archiveReader->setApp('forums');
         $this->table = $this->archiveReader->getFields();
         $this->table['_table_'] = 'forums_archive_posts';
         $this->table['_prefix_'] = 'p.archive_';
         $this->table['forums_search_posts_main'] = 'forums_search_archive_main';
         $this->table['forums_search_posts_delta'] = 'forums_search_archive_delta';
         /* disable max days search */
         $this->settings['search_ucontent_days'] = 0;
     } else {
         $this->table = array('_table_' => 'posts', '_prefix_' => 'p.', 'pid' => 'pid', 'author_id' => 'author_id', 'author_name' => 'author_name', 'ip_address' => 'ip_address', 'post_date' => 'post_date', 'post' => 'post', 'queued' => 'queued', 'topic_id' => 'topic_id', 'new_topic' => 'new_topic', 'post_bwoptions' => 'post_bwoptions', 'post_key' => 'post_key', 'post_htmlstate' => 'post_htmlstate', 'use_sig' => 'use_sig', 'use_emo' => 'use_emo', 'append_edit' => 'append_edit', 'edit_time' => 'edit_time', 'edit_name' => 'edit_name', 'post_edit_reason' => 'post_edit_reason', 'forums_search_posts_main' => 'forums_search_posts_main', 'forums_search_posts_delta' => 'forums_search_posts_delta');
     }
     parent::__construct($registry);
 }
 /**
  * Initiate this module
  *
  * @access	public
  * @return	void
  */
 public function init()
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $this->request['st'] = intval($this->request['st']);
     //-----------------------------------------
     // Make sure we have values
     //-----------------------------------------
     if ($this->settings['postpage_contents'] == "") {
         $this->settings['postpage_contents'] = '5,10,15,20,25,30,35,40';
     }
     if ($this->settings['topicpage_contents'] == "") {
         $this->settings['topicpage_contents'] = '5,10,15,20,25,30,35,40';
     }
     //-----------------------------------------
     // Grab forum class
     //-----------------------------------------
     if (ipsRegistry::isClassLoaded('class_forums') !== TRUE) {
         try {
             require_once IPSLib::getAppDir('forums') . "/sources/classes/forums/class_forums.php";
             $this->registry->setClass('class_forums', new class_forums($this->registry));
         } catch (Exception $error) {
             IPS_exception_error($error);
         }
         $this->registry->getClass('class_forums')->strip_invisible = 1;
         $this->registry->getClass('class_forums')->forumsInit();
     }
     $this->tab_name = ipsRegistry::getClass('class_localization')->words['tab__forums'];
 }
 /**
  * Constructor
  *
  * @access	public
  * @param	object	ipsRegistry
  * @return	void
  */
 public function __construct(ipsRegistry $registry)
 {
     //-----------------------------------------
     // Could potentially be setup from sessions
     //-----------------------------------------
     if (!$registry->isClassLoaded('ccsFunctions')) {
         require_once IPSLib::getAppDir('ccs') . '/sources/functions.php';
         $registry->setClass('ccsFunctions', new ccsFunctions($registry));
     }
 }
 /**
  * Constructor
  *
  * @access	public
  * @param	object		ipsRegistry reference
  * @return	void
  */
 public function __construct(ipsRegistry $registry)
 {
     parent::__construct($registry);
     /* Load and init forums */
     if (ipsRegistry::isClassLoaded('class_forums') !== TRUE) {
         try {
             require_once IPSLib::getAppDir('forums') . "/sources/classes/forums/class_forums.php";
             $this->registry->setClass('class_forums', new class_forums($registry));
         } catch (Exception $error) {
             IPS_exception_error($error);
         }
         $this->registry->getClass('class_forums')->strip_invisible = 1;
         $this->registry->getClass('class_forums')->forumsInit();
     }
 }
 /**
  * Run the plug-in
  *
  * @access	public
  * @author	Matt Mecham
  * @param	string	The initial data from the tag
  * @param	array	Array of options
  * @return	string	Processed HTML
  */
 public function runPlugin($data, $options)
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     if ($options['group'] == 'editors' && ipsRegistry::isClassLoaded('class_localization')) {
         ipsRegistry::getClass('class_localization')->loadLanguageFile(array('public_editors'), 'core');
     }
     $return = '';
     $_group = str_replace('skin_', '', $options['group']);
     $_group = str_replace('{current_app}', "'.\$this->registry->getCurrentApplication().'", $_group);
     $_params = $options['params'];
     $return = "\$this->registry->getClass('output')->getTemplate('" . $_group . "')->" . $data . "(" . $_params . ")";
     return '" . ' . $return . ' . "';
 }
Esempio n. 8
0
 /**
  * Constructor
  *
  * @param	object		ipsRegistry reference
  * @return	@e void
  */
 public function __construct(ipsRegistry $registry)
 {
     parent::__construct($registry);
     /* Load and init forums */
     if (ipsRegistry::isClassLoaded('class_forums') !== TRUE) {
         try {
             $classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('forums') . "/sources/classes/forums/class_forums.php", 'class_forums', 'forums');
             $this->registry->setClass('class_forums', new $classToLoad($registry));
         } catch (Exception $error) {
             IPS_exception_error($error);
         }
         $this->registry->getClass('class_forums')->strip_invisible = 1;
         $this->registry->getClass('class_forums')->forumsInit();
         $this->memberData = IPSMember::setUpModerator($this->memberData);
     }
     /* Load topic class */
     if (!$this->registry->isClassLoaded('topics')) {
         $classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('forums') . "/sources/classes/topics.php", 'app_forums_classes_topics', 'forums');
         $this->registry->setClass('topics', new $classToLoad($this->registry));
     }
 }
Esempio n. 9
0
 /**
  * Main function executed automatically by the controller
  *
  * @param	object		$registry		Registry object
  * @return	@e void
  */
 public function doExecute(ipsRegistry $registry)
 {
     /* Load Skin and Lang */
     $this->html = $this->registry->output->loadTemplate('cp_skin_archive');
     $this->form_code = $this->html->form_code = 'module=archive&section=archive&';
     $this->html->form_code_js = $this->html->form_code_js = 'module=archive&section=archive&';
     $this->lang->loadLanguageFile(array('admin_archive'));
     /* Load up archive class */
     $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/archive/writer.php', 'classes_archive_writer');
     $this->archiveWriter = new $classToLoad();
     $this->archiveWriter->setApp('forums');
     /* Check for class_forums */
     if (ipsRegistry::isClassLoaded('class_forums') !== TRUE) {
         $classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('forums') . "/sources/classes/forums/class_forums.php", 'class_forums', 'forums');
         $this->registry->setClass('class_forums', new $classToLoad($registry));
         $this->registry->class_forums->forumsInit();
     }
     switch ($this->request['do']) {
         case 'toggleArchiving':
             $this->_archiveToggle();
             break;
         case 'rules':
             $this->_archiveRules();
             break;
         case 'saveRules':
             $this->_saveRules();
             break;
         case 'saveRestorePrefs':
             $this->_saveRestorePrefs();
             break;
         case 'overview':
         default:
             $this->_archiveDash();
             break;
     }
     /* Output */
     $this->registry->output->html_main .= $this->registry->output->global_template->global_frame_wrapper();
     $this->registry->output->sendOutput();
 }
Esempio n. 10
0
 /**
  * Retuns the html for displaying the forum category filter on the advanced search page
  *
  * @return	string	Filter HTML
  */
 public function getHtml()
 {
     /* Make sure class_forums is setup */
     if (ipsRegistry::isClassLoaded('class_forums') !== TRUE) {
         $classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('forums') . "/sources/classes/forums/class_forums.php", 'class_forums', 'forums');
         ipsRegistry::setClass('class_forums', new $classToLoad(ipsRegistry::instance()));
     }
     ipsRegistry::getClass('class_forums')->strip_invisible = 1;
     ipsRegistry::getClass('class_forums')->forumsInit();
     /* Got any archived content? */
     $canSearchArchives = false;
     if ($this->settings['archive_on']) {
         $canSearchArchives = true;
         if (($this->settings['search_method'] == 'traditional' || $this->settings['search_method'] == 'sql') && $this->settings['archive_remote_sql_database']) {
             $canSearchArchives = false;
         }
     }
     $topic = NULL;
     if ($this->request['cType'] == 'topic') {
         $this->request['cId'] = intval($this->request['cId']);
         $topic = ipsRegistry::DB()->buildAndFetch(array('select' => '*', 'from' => 'topics', 'where' => "tid={$this->request['cId']}"));
     }
     return array('title' => IPSLib::getAppTitle('forums'), 'html' => ipsRegistry::getClass('output')->getTemplate('search')->forumAdvancedSearchFilters(ipsRegistry::getClass('class_forums')->buildForumJump(0, 1, 0, (isset($this->request['cId']) and $this->request['cType'] == 'forum') ? array($this->request['cId']) : array()), $canSearchArchives, $topic));
 }
 /**
  * Modify the search query
  *
  * @access	public
  * @param	array 	$query			The current unmodified query
  * @param	bool 	[$count_only]	Set to true if this is a count(*) query
  * @return	array 	Search query, modified by the plugin
  **/
 public function modifySearchQuery($query, $count_only = false)
 {
     if (ipsRegistry::$settings['search_method'] == 'sphinx') {
         $query->SetFilter('approved', array(1));
         $query->SetFilter('queued', array(0));
         $query->SetFilter('password', array(0));
         if (isset(ipsRegistry::$request['search_app_filters']['forums']['forums']) && is_array(ipsRegistry::$request['search_app_filters']['forums']['forums']) && count(ipsRegistry::$request['search_app_filters']['forums']['forums'])) {
             /* Load class_forums so that we can search sub forums automatically */
             if (ipsRegistry::isClassLoaded('class_forums') !== TRUE) {
                 require_once IPSLib::getAppDir('forums') . '/sources/classes/forums/class_forums.php';
                 ipsRegistry::setClass('class_forums', new class_forums(ipsRegistry::instance()));
                 ipsRegistry::getClass('class_forums')->forumsInit();
             }
             $forum_ids = array();
             /* Get a list of child ids */
             foreach (ipsRegistry::$request['search_app_filters']['forums']['forums'] as $forum_id) {
                 if ($forum_id) {
                     $forum_ids[] = $forum_id;
                     //$children = ipsRegistry::getClass( 'class_forums' )->forumsGetChildren( $forum_id );
                     //foreach( $children as $kid )
                     //{
                     //	if( ! in_array( $kid, ipsRegistry::$request['search_app_filters']['forums'] ) )
                     //	{
                     //		 $forum_ids[]	= $kid;
                     //	}
                     //}
                 }
             }
             if (is_array($forum_ids) and count($forum_ids)) {
                 $query->SetFilter('forum_id', $forum_ids);
             }
         }
         /* Limit by forum */
         $type = ipsRegistry::$request['type'];
         $type_id = intval(ipsRegistry::$request['type_id']);
         if ($type && $type_id) {
             $query->SetFilter('forum_id', array($type_id));
         }
         /* Limit by topic */
         $type_2 = ipsRegistry::$request['type_2'];
         $type_id_2 = intval(ipsRegistry::$request['type_id_2']);
         if ($type_2 && $type_id_2) {
             $query->SetFilter('tid', array($type_id_2));
         }
     } else {
         return $query;
     }
 }
Esempio n. 12
0
 /**
  * I'm a constructor, twisted constructor
  *
  * @param	object	ipsRegistry reference
  * @return	@e void
  */
 public function __construct(ipsRegistry $registry)
 {
     /* Make objects */
     $this->registry = $registry;
     $this->DB = $this->registry->DB();
     $this->settings =& $this->registry->fetchSettings();
     $this->request =& $this->registry->fetchRequest();
     $this->lang = $this->registry->getClass('class_localization');
     $this->member = $this->registry->member();
     $this->memberData =& $this->registry->member()->fetchMemberData();
     $this->cache = $this->registry->cache();
     $this->caches =& $this->registry->cache()->fetchCaches();
     /* Check for class_forums */
     if (ipsRegistry::isClassLoaded('class_forums') !== TRUE) {
         $classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('forums') . "/sources/classes/forums/class_forums.php", 'class_forums', 'forums');
         $this->registry->setClass('class_forums', new $classToLoad($registry));
         $this->registry->class_forums->forumsInit();
     }
 }
Esempio n. 13
0
 /**
  * Class entry point
  *
  * @param	object		Registry reference
  * @return	@e void
  */
 public function __construct(ipsRegistry $registry)
 {
     /* Make objects */
     $this->registry = $registry;
     $this->DB = $this->registry->DB();
     $this->settings =& $this->registry->fetchSettings();
     $this->request =& $this->registry->fetchRequest();
     $this->lang = $this->registry->getClass('class_localization');
     $this->member = $this->registry->member();
     $this->memberData =& $this->registry->member()->fetchMemberData();
     $this->cache = $this->registry->cache();
     $this->caches =& $this->registry->cache()->fetchCaches();
     /* Check for class_forums */
     if (ipsRegistry::isClassLoaded('class_forums') !== TRUE) {
         $classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('forums') . "/sources/classes/forums/class_forums.php", 'class_forums', 'forums');
         $this->registry->setClass('class_forums', new $classToLoad($registry));
         $this->registry->class_forums->forumsInit();
     }
     /* Init */
     if (!$this->registry->isClassLoaded('topics')) {
         $classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('forums') . "/sources/classes/topics.php", 'app_forums_classes_topics', 'forums');
         $this->registry->setClass('topics', new $classToLoad($this->registry));
     }
     /* Load tagging stuff */
     if (!$this->registry->isClassLoaded('tags')) {
         require_once IPS_ROOT_PATH . 'sources/classes/tags/bootstrap.php';
         /*noLibHook*/
         $this->registry->setClass('tags', classes_tags_bootstrap::run('forums', 'topics'));
     }
 }
Esempio n. 14
0
 /**
  * Class entry point
  *
  * @param	object		Registry reference
  * @return	@e void		[Outputs to screen/redirects]
  */
 public function doExecute(ipsRegistry $registry)
 {
     //-----------------------------------------
     // Get HTML and skin
     //-----------------------------------------
     $this->registry->class_localization->loadLanguageFile(array('public_list'), 'members');
     //-----------------------------------------
     // Can we access?
     //-----------------------------------------
     if (!$this->memberData['g_mem_info']) {
         $this->registry->output->showError('cannot_view_memberlist', 10221, null, null, 403);
     }
     //-----------------------------------------
     // Init variables
     //-----------------------------------------
     $see_groups = array();
     $the_filter = array('ALL' => $this->lang->words['show_all']);
     $the_members = array();
     $query = array("m.members_l_display_name !='' AND m.members_l_display_name " . $this->DB->buildIsNull(false));
     $url = array();
     $pp_rating_real = isset($this->request['pp_rating_real']) ? intval($this->request['pp_rating_real']) : 0;
     $this->first = isset($this->request['st']) ? intval($this->request['st']) : 0;
     $this->max_results = !empty($this->request['max_results']) ? $this->request['max_results'] : $this->max_results;
     $this->sort_key = !empty($this->request['sort_key']) ? $this->request['sort_key'] : 'members_display_name';
     $this->sort_order = !empty($this->request['sort_order']) ? $this->request['sort_order'] : 'asc';
     $this->filter = !empty($this->request['filter']) ? $this->request['filter'] == 'ALL' ? 'ALL' : intval($this->request['filter']) : 'ALL';
     $this->request['showall'] = isset($this->request['showall']) ? intval($this->request['showall']) : 0;
     $this->request['name_box'] = isset($this->request['name_box']) ? $this->request['name_box'] : '';
     $this->request['quickjump'] = isset($this->request['quickjump']) ? $this->request['quickjump'] : 0;
     $_queryPP = false;
     //-----------------------------------------
     // Set some of the URL params
     //-----------------------------------------
     if ($this->request['quickjump']) {
         $this->request['name_box'] = 'begins';
         $this->request['name'] = $this->request['quickjump'];
     }
     $url['app'] = "app=members&module=list";
     $url['showall'] = 'showall=' . $this->request['showall'];
     $url['sort_key'] = "sort_key={$this->sort_key}";
     $url['sort_order'] = "sort_order={$this->sort_order}";
     $url['max_results'] = "max_results={$this->max_results}";
     $url['quickjump'] = "quickjump={$this->request['quickjump']}";
     $url['name_box'] = 'name_box=' . $this->request['name_box'];
     $url['name'] = isset($this->request['name']) ? "name={$this->request['name']}" : "name=";
     //-----------------------------------------
     // Sort the member group info
     //-----------------------------------------
     foreach ($this->caches['group_cache'] as $row) {
         if ($row['g_hide_from_list']) {
             if (!($this->memberData['g_access_cp'] and $this->request['showall'])) {
                 $hide_ids[] = $row['g_id'];
                 continue;
             }
         }
         $see_groups[] = $row['g_id'];
         $this->mem_groups[$row['g_id']] = array('TITLE' => $row['g_title'], 'ICON' => $row['g_icon']);
         if ($row['g_id'] == $this->settings['guest_group']) {
             continue;
         }
         $the_filter[$row['g_id']] = $row['g_title'];
     }
     //-----------------------------------------
     // Init some arrays
     //-----------------------------------------
     $the_sort_key = array('members_l_display_name' => 'sort_by_name', 'posts' => 'pcount', 'joined' => 'sort_by_joined', 'members_profile_views' => 'm_dd_views');
     $the_max_results = array(10 => '10', 20 => '20', 40 => '40', 60 => '60');
     $the_sort_order = array('desc' => 'descending_order', 'asc' => 'ascending_order');
     $dropdowns = array('filter' => $the_filter, 'sort_key' => $the_sort_key, 'sort_order' => $the_sort_order, 'max_results' => $the_max_results);
     $defaults = array('filter' => $this->filter, 'sort_key' => $this->sort_key, 'sort_order' => $this->sort_order, 'max_results' => $this->max_results, 'photoonly' => !empty($this->request['photoonly']) ? 1 : 0);
     //-----------------------------------------
     // Final vars for query
     //-----------------------------------------
     $this->sort_key = isset($the_sort_key[$this->sort_key]) ? $this->sort_key : 'members_l_display_name';
     $this->sort_order = isset($the_sort_order[$this->sort_order]) ? $this->sort_order : 'asc';
     $this->filter = isset($the_filter[$this->filter]) ? $this->filter : 'ALL';
     $this->max_results = isset($the_max_results[$this->max_results]) ? $this->max_results : 20;
     //-----------------------------------------
     // Get custom profile information
     //-----------------------------------------
     $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/customfields/profileFields.php', 'customProfileFields');
     $this->custom_fields = new $classToLoad();
     $this->custom_fields->initData('edit', 1);
     $this->custom_fields->parseToEdit('mlist');
     //-----------------------------------------
     // Member Groups...
     //-----------------------------------------
     if ($this->filter != 'ALL') {
         if (!in_array($this->filter, $see_groups)) {
             $query[] = 'm.member_group_id IN(' . implode(',', $see_groups) . ')';
         } else {
             $query[] = 'm.member_group_id=' . $this->filter;
         }
         $url['filter'] = 'filter=' . $this->filter;
     }
     //-----------------------------------------
     // NOT IN Member Groups...
     //-----------------------------------------
     if (count($hide_ids)) {
         $query[] = "m.member_group_id NOT IN(" . implode(",", $hide_ids) . ")";
     }
     /* Not banned */
     $query[] = "m.member_banned=0";
     /* Not a spammer */
     $query[] = '( ! ' . IPSBWOptions::sql('bw_is_spammer', 'members_bitoptions', 'members', 'global', 'has') . ')';
     //-----------------------------------------
     // Build query
     //-----------------------------------------
     $dates = array('lastpost', 'lastvisit', 'joined');
     $mapit = array('posts' => 'm.posts', 'joined' => 'm.joined', 'lastpost' => 'm.last_post', 'lastvisit' => 'm.last_visit', 'signature' => 'pp.signature', 'name' => 'm.members_display_name', 'photoonly' => 'pp.pp_main_photo');
     //-----------------------------------------
     // Do search
     //-----------------------------------------
     foreach ($mapit as $in => $tbl) {
         /**
          * Leave isset && != '', can't use empty or 0 values are skipped as well
          * @link	http://community.invisionpower.com/tracker/issue-37350-sorting-members-by-post-count/
          */
         $this->request[$in] = isset($this->request[$in]) && $this->request[$in] != '' ? $this->request[$in] : '';
         $inbit = $this->request[$in] = IPSText::parseCleanValue(trim(urldecode(IPSText::stripslashes($this->request[$in]))));
         $url[$in] = $in . '=' . urlencode($this->request[$in]);
         //-----------------------------------------
         // Name...
         //-----------------------------------------
         if ($in == 'name' and $inbit != "") {
             if ($this->request['name_box'] == 'begins') {
                 $query[] = "m.members_l_display_name LIKE '" . strtolower($inbit) . "%'";
             } else {
                 $query[] = "m.members_l_display_name LIKE '%" . strtolower($inbit) . "%'";
             }
         } else {
             if ($in == 'posts' and is_numeric($inbit) and intval($inbit) > -1) {
                 $ltmt = $this->request[$in . '_ltmt'] == 'lt' ? '<' : '>';
                 $query[] = $tbl . ' ' . $ltmt . ' ' . intval($inbit);
                 $url[$in] = $in . '_ltmt=' . $this->request[$in . '_ltmt'] . '&posts=' . intval($inbit);
             } else {
                 if (in_array($in, $dates) and $inbit) {
                     if (preg_match('/\\d{2}-\\d{2}-\\d{4}/', $this->request[$in])) {
                         $_tmp = explode('-', $this->request[$in]);
                         $time_int = mktime(23, 59, 59, $_tmp[0], $_tmp[1], $_tmp[2]);
                     } else {
                         $time_int = strtotime($inbit);
                     }
                     if ($time_int) {
                         $ltmt = $this->request[$in . '_ltmt'] == 'lt' ? '<' : '>';
                         $query[] = $tbl . ' ' . $ltmt . ' ' . $time_int;
                         $url[$in . '_ltmt'] = $in . '_ltmt=' . $this->request[$in . '_ltmt'];
                     }
                 } else {
                     if ($in == 'photoonly') {
                         if ($this->request['photoonly'] == 1) {
                             $_queryPP = true;
                             $query[] = $tbl . "<> ''";
                             $url[] = 'photoonly=1';
                         }
                     } else {
                         if ($inbit != "" and $in != 'posts') {
                             $_queryPP = true;
                             $query[] = $tbl . " LIKE '%{$inbit}%'";
                         }
                     }
                 }
             }
         }
     }
     //-----------------------------------------
     // Custom fields?
     //-----------------------------------------
     if (count($this->custom_fields->out_fields)) {
         foreach ($this->custom_fields->out_fields as $id => $data) {
             if (!empty($this->request['field_' . $id])) {
                 $_queryPP = true;
                 if (is_array($this->request['field_' . $id])) {
                     foreach ($this->request['field_' . $id] as $k => $v) {
                         $this->request['field_' . $id][$k] = urldecode($v);
                         $url['field_' . $id] = "field_{$id}[{$k}]=" . $v;
                     }
                 } else {
                     $url['field_' . $id] = "field_{$id}=" . $this->request['field_' . $id];
                     $this->request['field_' . $id] = urldecode($this->request['field_' . $id]);
                 }
                 if ($this->custom_fields->cache_data[$id]['pf_type'] == 'drop') {
                     $query[] = "p.field_{$id}='" . $this->request['field_' . $id] . "'";
                 } else {
                     if ($this->custom_fields->cache_data[$id]['pf_type'] == 'cbox') {
                         if (count($this->request['field_' . $id])) {
                             foreach ($this->request['field_' . $id] as $k => $v) {
                                 $query[] = "p.field_{$id} LIKE '%|{$k}|%'";
                             }
                         }
                     } else {
                         $query[] = $this->custom_fields->cache_data[$id]['pf_search_type'] == 'loose' ? "p.field_{$id} LIKE '%" . $this->request['field_' . $id] . "%'" : "p.field_{$id} = '" . $this->request['field_' . $id] . "'";
                     }
                 }
             }
         }
     }
     //-----------------------------------------
     // Rating..
     //-----------------------------------------
     if ($pp_rating_real) {
         $_queryPP = true;
         $query[] = "pp.pp_rating_real > " . $pp_rating_real;
         $url['pp_rating_real'] = "pp_rating_real=" . $pp_rating_real;
     }
     //-----------------------------------------
     // Finish query
     //-----------------------------------------
     //$query[] = "m.members_l_display_name != ''";
     $joins = array();
     if ($_queryPP) {
         $joins[] = array('from' => array('pfields_content' => 'p'), 'where' => 'p.member_id=m.member_id', 'type' => 'left');
         $joins[] = array('from' => array('profile_portal' => 'pp'), 'where' => 'pp.pp_member_id=m.member_id', 'type' => 'left');
     }
     //-----------------------------------------
     // Reputation
     //-----------------------------------------
     if (!ipsRegistry::isClassLoaded('repCache')) {
         $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/class_reputation_cache.php', 'classReputationCache');
         ipsRegistry::setClass('repCache', new $classToLoad());
     }
     //-----------------------------------------
     // START THE LISTING
     //-----------------------------------------
     $notInMembers = 0;
     foreach ($query as $q) {
         if (!strstr($q, 'm.')) {
             $notInMembers++;
         }
     }
     /* Get the count */
     if ($notInMembers > 0 or $this->sort_key != 'members_l_display_name' or $this->request['request_method'] == 'post') {
         $_max = $this->DB->buildAndFetch(array('select' => 'COUNT( * ) as cnt', 'from' => array('members' => 'm'), 'where' => implode(" AND ", $query), 'add_join' => $joins));
         $this->DB->build(array('select' => ' m.member_id', 'from' => array('members' => 'm'), 'where' => implode(" AND ", $query), 'order' => 'm.' . $this->sort_key . ' ' . $this->sort_order, 'limit' => array($this->first, $this->max_results), 'add_join' => $joins));
     } else {
         $_max = $this->DB->buildAndFetch(array('select' => 'COUNT( * ) as cnt', 'from' => 'members m', 'where' => implode(" AND ", $query)));
         $this->DB->build(array('select' => 'm.member_id', 'from' => array('members' => 'm'), 'where' => implode(" AND ", $query), 'order' => 'm.' . $this->sort_key . ' ' . $this->sort_order, 'limit' => array($this->first, $this->max_results)));
     }
     /* Fetch IDs */
     $mids = array();
     $this->DB->execute();
     while ($m = $this->DB->fetch()) {
         if ($m['member_id']) {
             $mids[] = $m['member_id'];
         }
     }
     if (count($mids)) {
         $members = array();
         $_members = IPSMember::load($mids, 'all');
         /* Make sure that we keep the ordering from the query */
         foreach ($mids as $id) {
             $members[$id] = $_members[$id];
         }
     }
     $max = $_max['cnt'];
     if (is_array($members) and count($members)) {
         foreach ($members as $id => $member) {
             /* Damn SQL thing with member_id */
             if (!$member['member_id']) {
                 $member['member_id'] = $member['member_table_id'];
             }
             $member['members_display_name'] = $member['members_display_name'] ? $member['members_display_name'] : $member['name'];
             $member['members_seo_name'] = IPSMember::fetchSeoName($member);
             $member['group'] = $this->mem_groups[$member['member_group_id']]['TITLE'];
             $member = IPSMember::buildProfilePhoto($member);
             $member['pp_reputation_points'] = $member['pp_reputation_points'] ? $member['pp_reputation_points'] : 0;
             $member['author_reputation'] = ipsRegistry::getClass('repCache')->getReputation($member['pp_reputation_points']);
             /* Reputation */
             if ($this->settings['reputation_protected_groups']) {
                 if (in_array($member['member_group_id'], explode(",", $this->settings['reputation_protected_groups']))) {
                     $member['pp_reputation_points'] = null;
                     $member['author_reputation'] = null;
                 }
             }
             $the_members[] = $member;
         }
     }
     /* make sure URL doesn't contain empty params */
     $_url = $url;
     $url = array();
     foreach ($_url as $key => $bit) {
         if (strrpos($bit, '=') + 1 == strlen($bit)) {
             continue;
         }
         $url[] = $bit;
     }
     $pages = $this->registry->output->generatePagination(array('totalItems' => $max, 'itemsPerPage' => $this->max_results, 'currentStartValue' => $this->first, 'seoTitle' => "false", 'seoTemplate' => 'members_list', 'baseUrl' => implode('&amp;', $url)));
     //-----------------------------------------
     // Print...
     //-----------------------------------------
     $this->output .= $this->registry->getClass('output')->getTemplate('mlist')->member_list_show($the_members, $pages, $dropdowns, $defaults, $this->custom_fields, implode('&amp;', $url));
     //-----------------------------------------
     // Push to print handler
     //-----------------------------------------
     $this->registry->output->addContent($this->output);
     $this->registry->output->setTitle($this->lang->words['page_title'] . ' - ' . ipsRegistry::$settings['board_name']);
     $this->registry->output->addNavigation($this->lang->words['page_title'], 'app=members', "false", 'members_list');
     $this->registry->output->sendOutput();
 }
Esempio n. 15
0
 /**
  * Check access to report the topic
  *
  * @param 	integer 	Topic id
  * @return	@e void
  */
 protected function _checkAccess($tid)
 {
     //-----------------------------------------
     // Needs silly a. alias to keep oracle
     // happy
     //-----------------------------------------
     $this->topic = $this->DB->buildAndFetch(array('select' => 'a.*,a.title as topic_title', 'from' => 'topics a', 'where' => "a.tid=" . $tid));
     if (ipsRegistry::isClassLoaded('class_forums') !== TRUE) {
         $classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('forums') . "/sources/classes/forums/class_forums.php", 'class_forums', 'forums');
         $this->registry->setClass('class_forums', new $classToLoad($this->registry));
         $this->registry->getClass('class_forums')->forumsInit();
     }
     $this->registry->getClass('class_forums')->forumsCheckAccess($this->topic['forum_id'], 0, 'topic', $this->topic);
 }
 /**
  * Check access to report the topic
  *
  * @access	private
  * @param 	integer 	Topic id
  * @return	void
  */
 private function _checkAccess($tid)
 {
     if (!$this->memberData['member_id']) {
         $this->registry->output->showError('reports_must_be_member', 10169);
     }
     //-----------------------------------------
     // Needs silly a. alias to keep oracle
     // happy
     //-----------------------------------------
     $this->topic = $this->DB->buildAndFetch(array('select' => 'a.*,a.title as topic_title', 'from' => 'topics a', 'where' => "a.tid=" . $tid));
     if (ipsRegistry::isClassLoaded('class_forums') !== TRUE) {
         require_once IPSLib::getAppDir('forums') . "/sources/classes/forums/class_forums.php";
         $this->registry->setClass('class_forums', new class_forums($this->registry));
         $this->registry->getClass('class_forums')->forumsInit();
     }
     $this->registry->getClass('class_forums')->forumsCheckAccess($this->topic['forum_id'], 0, 'topic', $this->topic);
 }
 /**
  * Retrieve the last x entries of a Blog
  * Only public publishes entries are returned
  *
  * @param	string	Either 'member' or 'blog'
  * @param	int		Blog ID or Member ID
  * @param	int		Number of entries (to return)
  * @return 	array	Array of last X entries
  */
 public function lastXEntries($type, $id, $number_of_entries = 10)
 {
     /* INIT */
     $id = intval($id);
     //-----------------------------------------
     // Load the Blog functions library
     //-----------------------------------------
     if (!ipsRegistry::isClassLoaded('blog_std')) {
         /* Load the Blog functions library */
         require_once IPSLib::getAppDir('blog') . '/sources/lib/lib_blogfunctions.php';
         $this->registry->setClass('blog_std', new blogFunctions($this->registry));
     }
     //-----------------------------------------
     // Build the permissions
     //-----------------------------------------
     $this->registry->blog_std->buildPerms();
     if ($this->memberData['g_blog_settings']['g_blog_allowview']) {
         //-----------------------------------------
         // Private Club Authed?
         //-----------------------------------------
         $extra = "";
         $allowguests = "";
         if (!$this->memberData['member_id']) {
             $allowguests .= " AND b.blog_allowguests = 1";
         }
         if (!$this->memberData['_blogmod']['moderate_can_view_private']) {
             $extra = " AND ( ( ( p.owner_only=1 AND b.member_id={$this->memberData['member_id']} ) OR p.owner_only=0 ) AND ( p.authorized_users LIKE '%,{$this->memberData['member_id']},%' OR p.authorized_users IS NULL ) ) ";
         }
         $qtype = $type == 'member' ? "b.member_id={$id}" : "b.blog_id={$id}";
         $this->DB->build(array('select' => "e.*", 'from' => array('blog_entries' => 'e'), 'add_join' => array(array('select' => 'b.blog_name', 'from' => array('blog_blogs' => 'b'), 'where' => "e.blog_id=b.blog_id", 'type' => 'left'), array('from' => array('permission_index' => 'p'), 'where' => "p.perm_type_id=b.blog_id AND p.perm_type='blog'", 'type' => 'left')), 'where' => "{$qtype} AND b.blog_type='local' AND e.entry_status='published'" . $allowguests . $extra, 'order' => 'e.entry_date DESC', 'limit' => array(0, intval($number_of_entries))));
         $outer = $this->DB->execute();
         $return_array = array();
         while ($entry = $this->DB->fetch($outer)) {
             $entry['blog_url'] = $this->registry->blog_std->getBlogUrl($entry['blog_id'], $entry['blog_friendly_url']);
             $entry['entry_url'] = $entry['blog_url'] . 'showentry=' . $entry['entry_id'];
             $return_array[] = $entry;
         }
         return $return_array;
     } else {
         return array();
     }
 }
Esempio n. 18
0
 /**
  * Destructor
  *
  * @return	@e void
  */
 public function __myDestruct()
 {
     /* Item marking clean up */
     if (ipsRegistry::isClassLoaded('classItemMarking')) {
         ipsRegistry::getClass('classItemMarking')->__myDestruct();
     }
     /* Session clean up */
     self::sessionClass()->__myDestruct();
 }
 /**
  * Parse a member for display
  *
  * @access	public
  * @param	mixed	Either array of member data, or member ID to self load
  * @param	array 	Array of flags to parse: 'signature', 'customFields', 'avatar', 'warn'
  * @return	array 	Parsed member data
  */
 public static function buildDisplayData($member, $_parseFlags = array())
 {
     $_NOW = IPSDebug::getMemoryDebugFlag();
     //-----------------------------------------
     // Figure out parse flags
     //-----------------------------------------
     $parseFlags = array('signature' => isset($_parseFlags['signature']) ? $_parseFlags['signature'] : 0, 'customFields' => isset($_parseFlags['customFields']) ? $_parseFlags['customFields'] : 0, 'avatar' => isset($_parseFlags['avatar']) ? $_parseFlags['avatar'] : 1, 'warn' => isset($_parseFlags['warn']) ? $_parseFlags['warn'] : 1, 'cfSkinGroup' => isset($_parseFlags['cfSkinGroup']) ? $_parseFlags['cfSkinGroup'] : '', 'cfGetGroupData' => isset($_parseFlags['cfGetGroupData']) ? $_parseFlags['cfGetGroupData'] : '', 'cfLocation' => isset($_parseFlags['cfLocation']) ? $_parseFlags['cfLocation'] : '', 'checkFormat' => isset($_parseFlags['checkFormat']) ? $_parseFlags['checkFormat'] : 0);
     if (isset($_parseFlags['__all__'])) {
         foreach ($parseFlags as $k => $v) {
             $parseFlags[$k] = 1;
         }
         $parseFlags['cfSkinGroup'] = '';
     }
     //-----------------------------------------
     // Load the member?
     //-----------------------------------------
     if (!is_array($member) and ($member == intval($member) and $member > 0)) {
         $member = self::load($member, 'all');
     }
     if (!$member['member_group_id']) {
         $member['member_group_id'] = ipsRegistry::$settings['guest_group'];
     }
     /* Unpack bitwise if required */
     if (!isset($member['bw_is_spammer'])) {
         $member = self::buildBitWiseOptions($member);
     }
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $rank_cache = ipsRegistry::cache()->getCache('ranks');
     $group_cache = ipsRegistry::cache()->getCache('group_cache');
     $group_name = IPSLib::makeNameFormatted($group_cache[$member['member_group_id']]['g_title'], $member['member_group_id']);
     $pips = 0;
     $topic_id = intval(isset(ipsRegistry::$request['t']) ? ipsRegistry::$request['t'] : 0);
     $forum_id = intval(isset(ipsRegistry::$request['f']) ? ipsRegistry::$request['f'] : 0);
     //-----------------------------------------
     // SEO Name
     //-----------------------------------------
     $member['members_seo_name'] = self::fetchSeoName($member);
     //-----------------------------------------
     // Avatar
     //-----------------------------------------
     if ($parseFlags['avatar']) {
         $member['avatar'] = self::buildAvatar($member);
     }
     $member['_group_formatted'] = $group_name;
     //-----------------------------------------
     // Ranks
     //-----------------------------------------
     if (is_array($rank_cache) and count($rank_cache)) {
         foreach ($rank_cache as $k => $v) {
             if ($member['posts'] >= $v['POSTS']) {
                 if (!isset($member['title']) || $member['title'] === '' || is_null($member['title'])) {
                     $member['title'] = $v['TITLE'];
                 }
                 $pips = $v['PIPS'];
                 break;
             }
         }
     }
     //-----------------------------------------
     // Group image
     //-----------------------------------------
     $member['member_rank_img'] = '';
     $member['member_rank_img_i'] = '';
     if ($group_cache[$member['member_group_id']]['g_icon']) {
         $_img = $group_cache[$member['member_group_id']]['g_icon'];
         if (substr($_img, 0, 4) != 'http') {
             $_img = ipsRegistry::$settings['_original_base_url'] . '/' . ltrim($_img, '/');
         }
         $member['member_rank_img_i'] = 'img';
         $member['member_rank_img'] = $_img;
     } else {
         if ($pips) {
             if (is_numeric($pips)) {
                 for ($i = 1; $i <= $pips; ++$i) {
                     $member['member_rank_img_i'] = 'pips';
                     $member['member_rank_img'] .= ipsRegistry::getClass('output')->getReplacement('pip_pip');
                 }
             } else {
                 $member['member_rank_img_i'] = 'img';
                 $member['member_rank_img'] = ipsRegistry::$settings['public_dir'] . 'style_extra/team_icons/' . $pips;
             }
         }
     }
     //-----------------------------------------
     // Spammer status
     //-----------------------------------------
     $member['spamStatus'] = NULL;
     $member['spamImage'] = NULL;
     $moderator = ipsRegistry::member()->getProperty('forumsModeratorData');
     if (isset($moderator[$forum_id]['bw_flag_spammers']) and $moderator[$forum_id]['bw_flag_spammers'] or ipsRegistry::member()->getProperty('g_is_supmod') == 1) {
         if (!ipsRegistry::$settings['warn_on'] or !strstr(',' . ipsRegistry::$settings['warn_protected'] . ',', ',' . $member['member_group_id'] . ',')) {
             if ($member['bw_is_spammer']) {
                 $member['spamStatus'] = TRUE;
             } else {
                 $member['spamStatus'] = FALSE;
             }
         }
     }
     //-----------------------------------------
     // Warny porny?
     //-----------------------------------------
     if ($parseFlags['warn'] and $member['member_id']) {
         $member['warn_percent'] = NULL;
         $member['can_edit_warn'] = false;
         $member['warn_img'] = NULL;
         if (ipsRegistry::$settings['warn_on'] and !strstr(',' . ipsRegistry::$settings['warn_protected'] . ',', ',' . $member['member_group_id'] . ',')) {
             /* Warnings */
             if (isset($moderator[$forum_id]['allow_warn']) and $moderator[$forum_id]['allow_warn'] or ipsRegistry::member()->getProperty('g_is_supmod') == 1 or ipsRegistry::$settings['warn_show_own'] and ipsRegistry::member()->getProperty('member_id') == $member['member_id']) {
                 // Work out which image to show.
                 if ($member['warn_level'] <= ipsRegistry::$settings['warn_min']) {
                     $member['warn_img'] = '{parse replacement="warn_0"}';
                     $member['warn_percent'] = 0;
                 } else {
                     if ($member['warn_level'] >= ipsRegistry::$settings['warn_max']) {
                         $member['warn_img'] = '{parse replacement="warn_5"}';
                         $member['warn_percent'] = 100;
                     } else {
                         $member['warn_percent'] = $member['warn_level'] ? sprintf("%.0f", $member['warn_level'] / ipsRegistry::$settings['warn_max'] * 100) : 0;
                         if ($member['warn_percent'] > 100) {
                             $member['warn_percent'] = 100;
                         }
                         if ($member['warn_percent'] >= 81) {
                             $member['warn_img'] = '{parse replacement="warn_5"}';
                         } else {
                             if ($member['warn_percent'] >= 61) {
                                 $member['warn_img'] = '{parse replacement="warn_4"}';
                             } else {
                                 if ($member['warn_percent'] >= 41) {
                                     $member['warn_img'] = '{parse replacement="warn_3"}';
                                 } else {
                                     if ($member['warn_percent'] >= 21) {
                                         $member['warn_img'] = '{parse replacement="warn_2"}';
                                     } else {
                                         if ($member['warn_percent'] >= 1) {
                                             $member['warn_img'] = '{parse replacement="warn_1"}';
                                         } else {
                                             $member['warn_img'] = '{parse replacement="warn_0"}';
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
                 if ($member['warn_percent'] < 1) {
                     $member['warn_percent'] = 0;
                 }
                 /* Bug 14770 - Change so you can't warn yourself */
                 if ((isset($moderator[$forum_id]['allow_warn']) and $moderator[$forum_id]['allow_warn'] or ipsRegistry::member()->getProperty('g_is_supmod') == 1) and $member['member_id'] != ipsRegistry::member()->getProperty('member_id')) {
                     $member['can_edit_warn'] = true;
                 }
             }
         }
     }
     //-----------------------------------------
     // Profile fields stuff
     //-----------------------------------------
     $member['custom_fields'] = "";
     if ($parseFlags['customFields'] == 1 and $member['member_id']) {
         if (isset(self::$_parsedCustomFields[$member['member_id']])) {
             $member['custom_fields'] = self::$_parsedCustomFields[$member['member_id']];
             if ($parseFlags['cfGetGroupData'] and isset(self::$_parsedCustomGroups[$member['member_id']]) and is_array(self::$_parsedCustomGroups[$member['member_id']])) {
                 $member['custom_field_groups'] = self::$_parsedCustomGroups[$member['member_id']];
             }
         } else {
             if (!is_object(self::$custom_fields_class)) {
                 require_once IPS_ROOT_PATH . 'sources/classes/customfields/profileFields.php';
                 self::$custom_fields_class = new customProfileFields();
             }
             if (self::$custom_fields_class) {
                 self::$custom_fields_class->member_data = $member;
                 self::$custom_fields_class->skinGroup = $parseFlags['cfSkinGroup'];
                 self::$custom_fields_class->initData();
                 self::$custom_fields_class->parseToView($parseFlags['checkFormat'], $parseFlags['cfLocation']);
                 $member['custom_fields'] = self::$custom_fields_class->out_fields;
                 self::$_parsedCustomFields[$member['member_id']] = $member['custom_fields'];
                 if ($parseFlags['cfGetGroupData']) {
                     $member['custom_field_groups'] = self::$custom_fields_class->fetchGroupTitles();
                     self::$_parsedCustomGroups[$member['member_id']] = $member['custom_field_groups'];
                 }
             }
         }
     }
     //-----------------------------------------
     // Profile photo
     //-----------------------------------------
     $member = self::buildProfilePhoto($member);
     //-----------------------------------------
     // Personal statement 'bbcode'
     //-----------------------------------------
     if (stripos($member['pp_bio_content'], '[b]') !== false) {
         if (stripos($member['pp_bio_content'], '[/b]') > stripos($member['pp_bio_content'], '[b]')) {
             $member['pp_bio_content'] = str_ireplace('[b]', '<strong>', $member['pp_bio_content']);
             $member['pp_bio_content'] = str_ireplace('[/b]', '</strong>', $member['pp_bio_content']);
         }
     }
     if (stripos($member['pp_bio_content'], '[i]') !== false) {
         if (stripos($member['pp_bio_content'], '[/i]') > stripos($member['pp_bio_content'], '[i]')) {
             $member['pp_bio_content'] = str_ireplace('[i]', '<em>', $member['pp_bio_content']);
             $member['pp_bio_content'] = str_ireplace('[/i]', '</em>', $member['pp_bio_content']);
         }
     }
     if (stripos($member['pp_bio_content'], '[u]') !== false) {
         if (stripos($member['pp_bio_content'], '[/u]') > stripos($member['pp_bio_content'], '[u]')) {
             $member['pp_bio_content'] = str_ireplace('[u]', '<span class="underscore">', $member['pp_bio_content']);
             $member['pp_bio_content'] = str_ireplace('[/u]', '</span>', $member['pp_bio_content']);
         }
     }
     //-----------------------------------------
     // Signature bbcode
     //-----------------------------------------
     if (isset($member['signature']) and $member['signature'] and $parseFlags['signature']) {
         if (isset(self::$_parsedSignatures[$member['member_id']])) {
             $member['signature'] = self::$_parsedSignatures[$member['member_id']];
         } else {
             if ($member['cache_content']) {
                 $member['signature'] = '<!--cached-' . gmdate('r', $member['cache_updated']) . '-->' . $member['cache_content'];
             } else {
                 IPSText::getTextClass('bbcode')->parse_bbcode = ipsRegistry::$settings['sig_allow_ibc'];
                 IPSText::getTextClass('bbcode')->parse_smilies = 1;
                 IPSText::getTextClass('bbcode')->parse_html = ipsRegistry::$settings['sig_allow_html'];
                 IPSText::getTextClass('bbcode')->parse_nl2br = 1;
                 IPSText::getTextClass('bbcode')->parsing_section = 'signatures';
                 IPSText::getTextClass('bbcode')->parsing_mgroup = $member['member_group_id'];
                 IPSText::getTextClass('bbcode')->parsing_mgroup_others = $member['mgroup_others'];
                 $member['signature'] = IPSText::getTextClass('bbcode')->preDisplayParse($member['signature']);
                 IPSContentCache::update($member['member_id'], 'sig', $member['signature']);
             }
             self::$_parsedSignatures[$member['member_id']] = $member['signature'];
         }
     }
     //-----------------------------------------
     // If current session, reset last_activity
     //-----------------------------------------
     if (!empty($member['running_time'])) {
         $member['last_activity'] = $member['running_time'] > $member['last_activity'] ? $member['running_time'] : $member['last_activity'];
     }
     //-----------------------------------------
     // Online?
     //-----------------------------------------
     $time_limit = time() - ipsRegistry::$settings['au_cutoff'] * 60;
     $member['_online'] = 0;
     if (!ipsRegistry::$settings['disable_anonymous'] and isset($member['login_anonymous'])) {
         list($be_anon, $loggedin) = explode('&', $member['login_anonymous']);
     } else {
         $be_anon = 0;
         $loggedin = $member['last_activity'] > $time_limit ? 1 : 0;
     }
     $bypass_anon = 0;
     $our_mgroups = array();
     if (ipsRegistry::member()->getProperty('mgroup_others')) {
         $our_mgroups = explode(",", IPSText::cleanPermString(ipsRegistry::member()->getProperty('mgroup_others')));
     }
     $our_mgroups[] = ipsRegistry::member()->getProperty('member_group_id');
     if (ipsRegistry::member()->getProperty('g_access_cp') and !ipsRegistry::$settings['disable_admin_anon']) {
         $bypass_anon = 1;
     }
     if (($member['last_visit'] > $time_limit or $member['last_activity'] > $time_limit) and ($be_anon != 1 or $bypass_anon == 1) and $loggedin == 1) {
         $member['_online'] = 1;
     }
     //-----------------------------------------
     // Last Active
     //-----------------------------------------
     $member['_last_active'] = ipsRegistry::getClass('class_localization')->getDate($member['last_activity'], 'SHORT');
     if ($be_anon == 1) {
         // Member last logged in anonymous
         if (!ipsRegistry::member()->getProperty('g_access_cp') or ipsRegistry::$settings['disable_admin_anon']) {
             $member['_last_active'] = ipsRegistry::getClass('class_localization')->words['private'];
         }
     }
     //-----------------------------------------
     // Rating
     //-----------------------------------------
     $member['_pp_rating_real'] = intval($member['pp_rating_real']);
     //-----------------------------------------
     // Long display names
     //-----------------------------------------
     $member['members_display_name_short'] = IPSText::truncate($member['members_display_name'], 16);
     //-----------------------------------------
     // Reputation
     //-----------------------------------------
     if (!ipsRegistry::isClassLoaded('repCache')) {
         require_once IPS_ROOT_PATH . 'sources/classes/class_reputation_cache.php';
         ipsRegistry::setClass('repCache', new classReputationCache());
     }
     $member['pp_reputation_points'] = $member['pp_reputation_points'] ? $member['pp_reputation_points'] : 0;
     $member['author_reputation'] = ipsRegistry::getClass('repCache')->getReputation($member['pp_reputation_points']);
     //-----------------------------------------
     // Other stuff not worthy of individual comments
     //-----------------------------------------
     $member['members_profile_views'] = isset($member['members_profile_views']) ? $member['members_profile_views'] : 0;
     $member['_pp_profile_views'] = ipsRegistry::getClass('class_localization')->formatNumber($member['members_profile_views']);
     IPSDebug::setMemoryDebugFlag("IPSMember::buildDisplayData: " . $member['member_id'] . " - Completed", $_NOW);
     return $member;
 }
Esempio n. 20
0
 /**
  * Parse a member for display
  *
  * @param	mixed	Either array of member data, or member ID to self load
  * @param	array 	Array of flags to parse: 'signature', 'customFields', 'warn'
  * @return	array 	Parsed member data
  */
 public static function buildDisplayData($member, $_parseFlags = array())
 {
     $_NOW = IPSDebug::getMemoryDebugFlag();
     /* test to see if member_title has been passed */
     if (isset($member['member_title'])) {
         $member['title'] = $member['member_title'];
     }
     //-----------------------------------------
     // Figure out parse flags
     //-----------------------------------------
     $parseFlags = array('signature' => isset($_parseFlags['signature']) ? $_parseFlags['signature'] : 0, 'customFields' => isset($_parseFlags['customFields']) ? $_parseFlags['customFields'] : 0, 'reputation' => isset($_parseFlags['reputation']) ? $_parseFlags['reputation'] : 1, 'warn' => isset($_parseFlags['warn']) ? $_parseFlags['warn'] : 1, 'cfSkinGroup' => isset($_parseFlags['cfSkinGroup']) ? $_parseFlags['cfSkinGroup'] : '', 'cfGetGroupData' => isset($_parseFlags['cfGetGroupData']) ? $_parseFlags['cfGetGroupData'] : '', 'cfLocation' => isset($_parseFlags['cfLocation']) ? $_parseFlags['cfLocation'] : '', 'checkFormat' => isset($_parseFlags['checkFormat']) ? $_parseFlags['checkFormat'] : 0, 'photoTagSize' => isset($_parseFlags['photoTagSize']) ? $_parseFlags['photoTagSize'] : false, 'spamStatus' => isset($_parseFlags['spamStatus']) ? $_parseFlags['spamStatus'] : 0);
     if (isset($_parseFlags['__all__'])) {
         foreach ($parseFlags as $k => $v) {
             if (in_array($k, array('cfSkinGroup', 'cfGetGroupData', 'photoTagSize'))) {
                 continue;
             }
             $parseFlags[$k] = 1;
         }
         $parseFlags['spamStatus'] = !empty($parseFlags['spamStatus']) ? 1 : 0;
     }
     //-----------------------------------------
     // Load the member?
     //-----------------------------------------
     if (!is_array($member) and ($member == intval($member) and $member > 0)) {
         $member = self::load($member, 'all');
     }
     //-----------------------------------------
     // Caching
     //-----------------------------------------
     static $buildMembers = array();
     $_key = $member['member_id'];
     $_arr = serialize($member);
     foreach ($parseFlags as $_flag => $_value) {
         $_key .= $_flag . $_value;
     }
     $_key = md5($_key . $_arr);
     if (isset($buildMembers[$_key])) {
         IPSDebug::setMemoryDebugFlag("IPSMember::buildDisplayData: " . $member['member_id'] . " - CACHED", $_NOW);
         return $buildMembers[$_key];
     }
     //-----------------------------------------
     // Basics
     //-----------------------------------------
     if (!$member['member_group_id']) {
         $member['member_group_id'] = ipsRegistry::$settings['guest_group'];
     }
     /* Unpack bitwise if required */
     if (!isset($member['bw_is_spammer'])) {
         $member = self::buildBitWiseOptions($member);
     }
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $rank_cache = ipsRegistry::cache()->getCache('ranks');
     $group_cache = ipsRegistry::cache()->getCache('group_cache');
     $group_name = self::makeNameFormatted($group_cache[$member['member_group_id']]['g_title'], $member['member_group_id']);
     $pips = 0;
     $topic_id = intval(isset(ipsRegistry::$request['t']) ? ipsRegistry::$request['t'] : 0);
     $forum_id = intval(isset(ipsRegistry::$request['f']) ? ipsRegistry::$request['f'] : 0);
     //-----------------------------------------
     // SEO Name
     //-----------------------------------------
     $member['members_seo_name'] = self::fetchSeoName($member);
     $member['_group_formatted'] = $group_name;
     //-----------------------------------------
     // Ranks
     //-----------------------------------------
     if (is_array($rank_cache) and count($rank_cache)) {
         foreach ($rank_cache as $k => $v) {
             if ($member['posts'] >= $v['POSTS']) {
                 if (empty($member['title'])) {
                     $member['title'] = $v['TITLE'];
                 }
                 $pips = $v['PIPS'];
                 break;
             }
         }
     }
     //-----------------------------------------
     // Group image
     //-----------------------------------------
     $member['member_rank_img'] = '';
     $member['member_rank_img_i'] = '';
     if ($group_cache[$member['member_group_id']]['g_icon']) {
         $_img = $group_cache[$member['member_group_id']]['g_icon'];
         if (substr($_img, 0, 4) != 'http' and strpos($_img, '{style_images_url}') === false) {
             $_img = ipsRegistry::$settings['_original_base_url'] . '/' . ltrim($_img, '/');
         }
         $member['member_rank_img_i'] = 'img';
         $member['member_rank_img'] = $_img;
     } else {
         if ($pips and $member['member_id']) {
             if (is_numeric($pips)) {
                 for ($i = 1; $i <= $pips; ++$i) {
                     $member['member_rank_img_i'] = 'pips';
                     $member['member_rank_img'] = $member['member_rank_img'] . ipsRegistry::getClass('output')->getReplacement('pip_pip');
                 }
             } else {
                 $member['member_rank_img_i'] = 'img';
                 $member['member_rank_img'] = ipsRegistry::$settings['public_dir'] . 'style_extra/team_icons/' . $pips;
             }
         }
     }
     //-----------------------------------------
     // Moderator data
     //-----------------------------------------
     if (($parseFlags['spamStatus'] or $parseFlags['warn']) and $member['member_id']) {
         /* Possible forums class isn't init at this point */
         if (!ipsRegistry::isClassLoaded('class_forums')) {
             try {
                 $viewingMember = IPSMember::setUpModerator(ipsRegistry::member()->fetchMemberData());
                 ipsRegistry::member()->setProperty('forumsModeratorData', $viewingMember['forumsModeratorData']);
             } catch (Exception $error) {
                 IPS_exception_error($error);
             }
         }
         $moderator = ipsRegistry::member()->getProperty('forumsModeratorData');
     }
     $forum_id = isset(ipsRegistry::$request['f']) ? intval(ipsRegistry::$request['f']) : 0;
     //-----------------------------------------
     // Spammer status
     //-----------------------------------------
     if ($parseFlags['spamStatus'] and $member['member_id'] and ipsRegistry::member()->getProperty('member_id')) {
         /* Defaults */
         $member['spamStatus'] = NULL;
         $member['spamImage'] = NULL;
         if (!empty($moderator[$forum_id]['bw_flag_spammers']) or ipsRegistry::member()->getProperty('g_is_supmod')) {
             if (!ipsRegistry::$settings['warn_on'] or !IPSMember::isInGroup($member, explode(',', ipsRegistry::$settings['warn_protected']))) {
                 if ($member['bw_is_spammer']) {
                     $member['spamStatus'] = TRUE;
                 } else {
                     $member['spamStatus'] = FALSE;
                 }
             }
         }
     }
     //-----------------------------------------
     // Warny porny?
     //-----------------------------------------
     $member['show_warn'] = FALSE;
     if ($parseFlags['warn'] and $member['member_id']) {
         if (ipsRegistry::$settings['warn_on'] and !IPSMember::isInGroup($member, explode(',', ipsRegistry::$settings['warn_protected']))) {
             /* Warnings */
             if (!empty($moderator[$forum_id]['allow_warn']) or ipsRegistry::member()->getProperty('g_is_supmod') or ipsRegistry::$settings['warn_show_own'] and ipsRegistry::member()->getProperty('member_id') == $member['member_id']) {
                 $member['show_warn'] = TRUE;
             } else {
                 if (is_array($moderator) && count($moderator) && !$forum_id) {
                     foreach ($moderator as $forum) {
                         if ($forum['allow_warn']) {
                             $member['show_warn'] = TRUE;
                             break;
                         }
                     }
                 }
             }
         }
     }
     //-----------------------------------------
     // Profile fields stuff
     //-----------------------------------------
     $member['custom_fields'] = "";
     if ($parseFlags['customFields'] == 1 and $member['member_id']) {
         if (isset(self::$_parsedCustomFields[$member['member_id']])) {
             $member['custom_fields'] = self::$_parsedCustomFields[$member['member_id']];
             if ($parseFlags['cfGetGroupData'] and isset(self::$_parsedCustomGroups[$member['member_id']]) and is_array(self::$_parsedCustomGroups[$member['member_id']])) {
                 $member['custom_field_groups'] = self::$_parsedCustomGroups[$member['member_id']];
             } else {
                 if ($parseFlags['cfGetGroupData']) {
                     $member['custom_field_groups'] = self::$custom_fields_class->fetchGroupTitles();
                     self::$_parsedCustomGroups[$member['member_id']] = $member['custom_field_groups'];
                 }
             }
         } else {
             if (!is_object(self::$custom_fields_class)) {
                 $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/customfields/profileFields.php', 'customProfileFields');
                 self::$custom_fields_class = new $classToLoad();
             }
             if (self::$custom_fields_class) {
                 self::$custom_fields_class->member_data = $member;
                 self::$custom_fields_class->skinGroup = $parseFlags['cfSkinGroup'];
                 self::$custom_fields_class->initData();
                 self::$custom_fields_class->parseToView($parseFlags['checkFormat'], $parseFlags['cfLocation']);
                 $member['custom_fields'] = self::$custom_fields_class->out_fields;
                 self::$_parsedCustomFields[$member['member_id']] = $member['custom_fields'];
                 if ($parseFlags['cfGetGroupData']) {
                     $member['custom_field_groups'] = self::$custom_fields_class->fetchGroupTitles();
                     self::$_parsedCustomGroups[$member['member_id']] = $member['custom_field_groups'];
                 }
             }
         }
     }
     //-----------------------------------------
     // Profile photo
     //-----------------------------------------
     $member = self::buildProfilePhoto($member);
     if (!empty($parseFlags['photoTagSize'])) {
         $parseFlags['photoTagSize'] = is_array($parseFlags['photoTagSize']) ? $parseFlags['photoTagSize'] : array($parseFlags['photoTagSize']);
         foreach ($parseFlags['photoTagSize'] as $size) {
             $member['photoTag' . ucfirst($size)] = self::buildPhotoTag($member, $size);
         }
     }
     //-----------------------------------------
     // Signature bbcode
     //-----------------------------------------
     if (!empty($member['signature']) and $parseFlags['signature']) {
         if (isset(self::$_parsedSignatures[$member['member_id']])) {
             $member['signature'] = self::$_parsedSignatures[$member['member_id']];
         } else {
             if ($member['cache_content']) {
                 $member['signature'] = '<!--signature-cached-' . gmdate('r', $member['cache_updated']) . '-->' . $member['cache_content'];
             } else {
                 /* Grab the parser file */
                 if (self::$_sigParser === null) {
                     /* Load parser */
                     $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/text/parser.php', 'classes_text_parser');
                     self::$_sigParser = new $classToLoad();
                 }
                 /* set up parser */
                 self::$_sigParser->set(array('memberData' => $member, 'parseBBCode' => 1, 'parseHtml' => $group_cache[$member['member_group_id']]['g_dohtml'] && $member['bw_html_sig'], 'parseEmoticons' => 1, 'parseArea' => 'signatures'));
                 $member['signature'] = self::$_sigParser->display($member['signature']);
                 IPSContentCache::update($member['member_id'], 'sig', $member['signature']);
             }
             self::$_parsedSignatures[$member['member_id']] = $member['signature'];
         }
     }
     //-----------------------------------------
     // If current session, reset last_activity
     //-----------------------------------------
     if (!empty($member['running_time'])) {
         $member['last_activity'] = $member['running_time'] > $member['last_activity'] ? $member['running_time'] : $member['last_activity'];
     }
     //-----------------------------------------
     // Online?
     //-----------------------------------------
     $time_limit = time() - ipsRegistry::$settings['au_cutoff'] * 60;
     $member['_online'] = 0;
     $bypass_anon = ipsRegistry::member()->getProperty('g_access_cp') ? 1 : 0;
     list($be_anon, $loggedin) = explode('&', empty($member['login_anonymous']) ? '0&0' : $member['login_anonymous']);
     /* Is not anon but the group might be forced to? */
     if (empty($be_anon) && self::isLoggedInAnon($member)) {
         $be_anon = 1;
     }
     /* Finally set the online flag */
     if (($member['last_visit'] > $time_limit or $member['last_activity'] > $time_limit) and ($be_anon != 1 or $bypass_anon == 1) and $loggedin == 1) {
         $member['_online'] = 1;
     }
     //-----------------------------------------
     // Last Active
     //-----------------------------------------
     $member['_last_active'] = ipsRegistry::getClass('class_localization')->getDate($member['last_activity'], 'SHORT');
     // Member last logged in anonymous ?
     if ($be_anon == 1 && !ipsRegistry::member()->getProperty('g_access_cp')) {
         $member['_last_active'] = ipsRegistry::getClass('class_localization')->words['private'];
     }
     //-----------------------------------------
     // Rating
     //-----------------------------------------
     $member['_pp_rating_real'] = intval($member['pp_rating_real']);
     //-----------------------------------------
     // Display name formatted
     //-----------------------------------------
     $member['members_display_name_formatted'] = self::makeNameFormatted($member['members_display_name'], $member['member_id'] ? $member['member_group_id'] : ipsRegistry::$settings['guest_group']);
     //-----------------------------------------
     // Long display names
     //-----------------------------------------
     $member['members_display_name_short'] = IPSText::truncate($member['members_display_name'], 16);
     //-----------------------------------------
     // Reputation
     //-----------------------------------------
     $member['pp_reputation_points'] = $member['pp_reputation_points'] ? $member['pp_reputation_points'] : 0;
     if ($parseFlags['reputation'] and $member['member_id']) {
         if (!ipsRegistry::isClassLoaded('repCache')) {
             $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/class_reputation_cache.php', 'classReputationCache');
             ipsRegistry::setClass('repCache', new $classToLoad());
         }
         $member['author_reputation'] = ipsRegistry::getClass('repCache')->getReputation($member['pp_reputation_points']);
     }
     //-----------------------------------------
     // Other stuff not worthy of individual comments
     //-----------------------------------------
     $member['members_profile_views'] = isset($member['members_profile_views']) ? $member['members_profile_views'] : 0;
     /* BG customization */
     if ($member['pp_customization'] and !empty($member['gbw_allow_customization']) and !$member['bw_disable_customization']) {
         $member['customization'] = IPSLib::safeUnserialize($member['pp_customization']);
         if (is_array($member['customization'])) {
             /* Figure out BG URL */
             if ($member['customization']['type'] == 'url' and $member['customization']['bg_url'] and $member['gbw_allow_url_bgimage']) {
                 $member['customization']['_bgUrl'] = $member['customization']['bg_url'];
             } else {
                 if ($member['customization']['type'] == 'upload' and $member['customization']['bg_url'] and $member['gbw_allow_upload_bgimage']) {
                     $member['customization']['_bgUrl'] = ipsRegistry::$settings['upload_url'] . '/' . $member['customization']['bg_url'];
                 } else {
                     if ($member['customization']['bg_color']) {
                         $member['customization']['type'] = 'bgColor';
                     }
                 }
             }
         }
     }
     /* Title is ambigious */
     $member['member_title'] = $member['title'];
     IPSDebug::setMemoryDebugFlag("IPSMember::buildDisplayData: " . $member['member_id'] . " - Completed", $_NOW);
     $buildMembers[$_key] = $member;
     return $member;
 }
 /**
  * Execute the plugin and return the HTML to show on the page.  
  * Can be called from ACP or front end, so the plugin needs to setup any appropriate lang files, skin files, etc.
  *
  * @access	public
  * @param	array 				Block data
  * @return	string				Block HTML to display or cache
  */
 public function executePlugin($block)
 {
     $data = array();
     //-----------------------------------------
     // Reset login form lang if needed
     //-----------------------------------------
     if (!$this->memberData['member_id']) {
         $uses_name = $uses_email = false;
         foreach ($this->cache->getCache('login_methods') as $method) {
             if ($method['login_user_id'] == 'username') {
                 $uses_name = true;
             }
             if ($method['login_user_id'] == 'email') {
                 $uses_email = true;
             }
         }
         if ($uses_name and $uses_email) {
             $this->lang->words['enter_name'] = $this->lang->words['welcome_name_and_email'];
         } else {
             if ($uses_email) {
                 $this->lang->words['enter_name'] = $this->lang->words['welcome_useremail'];
             }
         }
     } else {
         $topics = $this->DB->buildAndFetch(array('select' => 'COUNT(*) as total', 'from' => 'topics', 'where' => 'starter_id=' . $this->memberData['member_id']));
         $posts = $this->DB->buildAndFetch(array('select' => 'COUNT(*) as total', 'from' => 'posts', 'where' => 'author_id=' . $this->memberData['member_id']));
         $newTopics = $this->DB->buildAndFetch(array('select' => 'COUNT(*) as total', 'from' => 'topics', 'where' => 'start_date > ' . $this->memberData['last_visit']));
         $newPosts = $this->DB->buildAndFetch(array('select' => 'COUNT(*) as total', 'from' => 'posts', 'where' => 'post_date > ' . $this->memberData['last_visit']));
         $newFriends = $this->DB->buildAndFetch(array('select' => 'COUNT(*) as total', 'from' => 'profile_friends', 'where' => 'friends_approved=0 AND friends_friend_id=' . $this->memberData['member_id']));
         $newComments = $this->DB->buildAndFetch(array('select' => 'COUNT(*) as total', 'from' => 'profile_comments', 'where' => 'comment_approved=0 AND comment_for_member_id=' . $this->memberData['member_id']));
         $board_posts = $this->caches['stats']['total_topics'] + $this->caches['stats']['total_replies'];
         $_posts_day = 0;
         if ($posts['total'] and $board_posts) {
             $_posts_day = round($posts['total'] / ((time() - $this->memberData['joined']) / 86400), 2);
             # Fix the issue when there is less than one day
             $_posts_day = $_posts_day > $posts['total'] ? $posts['total'] : $_posts_day;
         }
         $_posts_day = floatval($_posts_day);
         //-----------------------------------------
         // Get the data not already available...
         //-----------------------------------------
         $data = array('topics' => $topics['total'], 'posts' => $posts['total'], 'avg_posts' => $_posts_day, 'new_topics' => $newTopics['total'], 'new_posts' => $newPosts['total'], 'new_friends' => $newFriends['total'], 'new_comments' => $newComments['total']);
     }
     $group_cache = $this->cache->getCache('group_cache');
     $data['group'] = IPSLib::makeNameFormatted($group_cache[$this->memberData['member_group_id']]['g_title'], $this->memberData['member_group_id']);
     //-----------------------------------------
     // Reputation
     //-----------------------------------------
     if (!ipsRegistry::isClassLoaded('repCache')) {
         require_once IPS_ROOT_PATH . 'sources/classes/class_reputation_cache.php';
         ipsRegistry::setClass('repCache', new classReputationCache());
     }
     $this->memberData['pp_reputation_points'] = $this->memberData['pp_reputation_points'] ? $this->memberData['pp_reputation_points'] : 0;
     $this->memberData['author_reputation'] = ipsRegistry::getClass('repCache')->getReputation($this->memberData['pp_reputation_points']);
     $pluginConfig = $this->returnPluginInfo();
     $templateBit = $pluginConfig['templateBit'] . '_' . $block['block_id'];
     return $this->registry->output->getTemplate('ccs')->{$templateBit}($block['block_name'], $data);
 }