コード例 #1
0
 /**
  * Main output function
  *
  * @param	bool	Return finished output instead of printing
  * @return	@e void 
  */
 public function sendOutput($return = false)
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $_NOW = IPSDebug::getMemoryDebugFlag();
     $this->_sendOutputSetUp('normal');
     //-----------------------------------------
     // Ad Code
     //-----------------------------------------
     $adCodeData = array();
     if ($this->registry->getClass('IPSAdCode')->userCanViewAds()) {
         $adCodeData['adHeaderCode'] = $this->registry->getClass('IPSAdCode')->getGobalCode('header');
         $adCodeData['adFooterCode'] = $this->registry->getClass('IPSAdCode')->getGobalCode('footer');
         $adCodeData['adHeaderCode'] = $adCodeData['adHeaderCode'] ? $adCodeData['adHeaderCode'] : $this->registry->getClass('IPSAdCode')->getAdCode('ad_code_global_header');
         $adCodeData['adFooterCode'] = $adCodeData['adFooterCode'] ? $adCodeData['adFooterCode'] : $this->registry->getClass('IPSAdCode')->getAdCode('ad_code_global_footer');
     }
     //-----------------------------------------
     // Meta Tags
     //-----------------------------------------
     /* What's the page URL? */
     $currentUrl = !$_SERVER['HTTPS'] || $_SERVER['HTTPS'] == 'off' ? 'http://' : 'https://';
     $currentUrl .= $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
     $currentUrl = str_replace(array(ipsRegistry::$settings['board_url'], '/index.php?', '/index.php'), '', $currentUrl);
     /* @link http://community.invisionpower.com/resources/bugs.html/_/ip-board/add-meta-tags-not-working-with-urls-containing-a-special-character-r41497 */
     $encUrl = urldecode($currentUrl);
     /* Add em in */
     $metaTags = array();
     $meta = $this->cache->getCache('meta_tags');
     if (is_array($meta) && count($meta)) {
         foreach ($meta as $page => $tags) {
             if (is_array($tags) && count($tags)) {
                 $match = str_replace('/', '\\/', $page);
                 $match = str_replace('-', '\\-', $match);
                 $match = str_replace('_', '\\_', $match);
                 $match = str_replace('.', '\\.', $match);
                 $match = str_replace('*', '(.*)?', $match);
                 if (preg_match('/^' . $match . '$/', $currentUrl) or preg_match('/^' . $match . '$/', $encUrl)) {
                     foreach ($tags as $tag => $val) {
                         if ($tag == 'title') {
                             $this->setTitle($val);
                         } else {
                             $this->addMetaTag($tag, $val);
                         }
                         $metaTags[$tag] = $val;
                     }
                 }
             }
         }
     }
     //-----------------------------------------
     // Gather output
     //-----------------------------------------
     $output = $this->outputFormatClass->fetchOutput($this->_html, $this->_title, $this->_navigation, $this->_documentHeadItems, $this->_jsLoader, $adCodeData);
     $output = $this->templateHooks($output);
     $output = $this->replaceMacros($output);
     /* Live editing meta tags? */
     if ($this->memberData['g_access_cp'] && !empty($this->memberData['_cache']['ipseo_live_meta_edit'])) {
         $output = str_replace("<body id='ipboard_body'>", $this->registry->output->getTemplate('global')->metaEditor($metaTags, $currentUrl) . "<body id='ipboard_body'>", $output);
     }
     /* Gooooogle analytics?! */
     if (!empty($this->settings['ipseo_ga'])) {
         $output = preg_replace("#</head>#", $this->settings['ipseo_ga'] . '</head>', $output, 1);
     }
     //-----------------------------------------
     // Check for SQL Debug
     //-----------------------------------------
     $this->_checkSQLDebug();
     //-----------------------------------------
     // Print it...
     //-----------------------------------------
     $this->outputFormatClass->printHeader();
     /* Remove unused hook comments */
     $output = preg_replace('#<!--hook\\.([^\\>]+?)-->#', '', $output);
     /* Insert stats */
     $output = str_replace('<!--DEBUG_STATS-->', $this->outputFormatClass->html_showDebugInfo(), $output);
     /* Return output instead of printing? */
     if ($return) {
         IPSDebug::setMemoryDebugFlag("Output sent", $_NOW);
         $this->outputFormatClass->finishUp();
         return $output;
     }
     print $output;
     IPSDebug::setMemoryDebugFlag("Output sent", $_NOW);
     $this->outputFormatClass->finishUp();
     exit;
 }
コード例 #2
0
 /**
  * Execute a direct database query
  *
  * @param	string		Database query
  * @param	boolean		[Optional] Do not convert table prefix
  * @return	@e resource
  */
 public function query($the_query, $bypass = false)
 {
     //-----------------------------------------
     // Debug?
     //-----------------------------------------
     if ($this->obj['debug'] or $this->obj['use_debug_log'] and $this->obj['debug_log'] or $this->obj['use_bad_log'] and $this->obj['bad_log']) {
         IPSDebug::startTimer();
         $_MEMORY = IPSDebug::getMemoryDebugFlag();
     }
     //-----------------------------------------
     // Stop sub selects? (UNION)
     //-----------------------------------------
     if (!IPS_DB_ALLOW_SUB_SELECTS) {
         # On the spot allowance?
         if (!$this->allow_sub_select) {
             $_tmp = strtolower($this->_removeAllQuotes($the_query));
             if (preg_match("#(?:/\\*|\\*/)#i", $_tmp)) {
                 $this->throwFatalError("You are not allowed to use comments in your SQL query.\nAdd \\ipsRegistry::DB()->allow_sub_select=1; before any query construct to allow them");
                 return false;
             }
             if (preg_match("#[^_a-zA-Z]union[^_a-zA-Z]#s", $_tmp)) {
                 $this->throwFatalError("UNION query joins are not allowed.\nAdd \\ipsRegistry::DB()->allow_sub_select=1; before any query construct to allow them");
                 return false;
             } else {
                 if (preg_match_all("#[^_a-zA-Z](select)[^_a-zA-Z]#s", $_tmp, $matches)) {
                     if (count($matches) > 1) {
                         $this->throwFatalError("SUB SELECT query joins are not allowed.\nAdd \\ipsRegistry::DB()->allow_sub_select=1; before any query construct to allow them");
                         return false;
                     }
                 }
             }
         }
     }
     //-----------------------------------------
     // Run the query
     //-----------------------------------------
     $this->_tmpQ = substr($the_query, 0, 100) . '...';
     $this->query_id = mysqli_query($this->connection_id, $the_query);
     //-----------------------------------------
     // Reset array...
     //-----------------------------------------
     $this->resetDataTypes();
     $this->allow_sub_select = false;
     if (!$this->query_id) {
         $this->throwFatalError("mySQL query error: {$the_query}");
     }
     //-----------------------------------------
     // Logging?
     //-----------------------------------------
     if ($this->obj['use_debug_log'] and $this->obj['debug_log'] or $this->obj['use_bad_log'] and $this->obj['bad_log'] or $this->obj['use_slow_log'] and $this->obj['slow_log']) {
         $endtime = IPSDebug::endTimer();
         $_data = '';
         if (preg_match("/^(?:\\()?select/i", $the_query)) {
             $eid = mysqli_query($this->connection_id, "EXPLAIN {$the_query}");
             $_bad = false;
             while ($array = mysqli_fetch_array($eid)) {
                 $array['extra'] = isset($array['extra']) ? $array['extra'] : '';
                 $_data .= "\n+------------------------------------------------------------------------------+";
                 $_data .= "\n|Table: " . $array['table'];
                 $_data .= "\n|Type: " . $array['type'];
                 $_data .= "\n|Possible Keys: " . $array['possible_keys'];
                 $_data .= "\n|Key: " . $array['key'];
                 $_data .= "\n|Key Len: " . $array['key_len'];
                 $_data .= "\n|Ref: " . $array['ref'];
                 $_data .= "\n|Rows: " . $array['rows'];
                 $_data .= "\n|Extra: " . $array['Extra'];
                 //$_data .= "\n+------------------------------------------------------------------------------+";
                 if ($this->obj['use_bad_log'] and $this->obj['bad_log'] and (stristr($array['Extra'], 'filesort') or stristr($array['Extra'], 'temporary'))) {
                     $this->writeDebugLog($the_query, $_data, $endtime, $this->obj['bad_log'], TRUE);
                 }
                 if ($this->obj['use_slow_log'] and $this->obj['slow_log'] and $endtime >= $this->obj['use_slow_log']) {
                     $this->writeDebugLog($the_query, $_data, $endtime, $this->obj['slow_log'], TRUE);
                 }
             }
             if ($this->obj['use_debug_log'] and $this->obj['debug_log']) {
                 $this->writeDebugLog($the_query, $_data, $endtime);
             }
         } else {
             if ($this->obj['use_debug_log'] and $this->obj['debug_log']) {
                 $this->writeDebugLog($the_query, $_data, $endtime);
             }
         }
     }
     //-----------------------------------------
     // Debugging?
     //-----------------------------------------
     if ($this->obj['debug']) {
         $endtime = IPSDebug::endTimer();
         $memoryUsed = IPSDebug::setMemoryDebugFlag('', $_MEMORY);
         $memory = '';
         $shutdown = $this->is_shutdown ? 'SHUTDOWN QUERY: ' : '';
         if (preg_match("/^(?:\\()?select/i", $the_query)) {
             $eid = mysqli_query($this->connection_id, "EXPLAIN {$the_query}");
             $this->debug_html .= "<table width='95%' border='1' cellpadding='6' cellspacing='0' bgcolor='#FFE8F3' align='center'>\r\n\t\t\t\t\t\t\t\t\t\t   <tr>\r\n\t\t\t\t\t\t\t\t\t\t   \t <td colspan='8' style='font-size:14px' bgcolor='#FFC5Cb'><b>{$shutdown}Select Query</b></td>\r\n\t\t\t\t\t\t\t\t\t\t   </tr>\r\n\t\t\t\t\t\t\t\t\t\t   <tr>\r\n\t\t\t\t\t\t\t\t\t\t    <td colspan='8' style='font-family:courier, monaco, arial;font-size:14px;color:black'>{$the_query}</td>\r\n\t\t\t\t\t\t\t\t\t\t   </tr>\r\n\t\t\t\t\t\t\t\t\t\t   <tr bgcolor='#FFC5Cb'>\r\n\t\t\t\t\t\t\t\t\t\t\t <td><b>table</b></td><td><b>type</b></td><td><b>possible_keys</b></td>\r\n\t\t\t\t\t\t\t\t\t\t\t <td><b>key</b></td><td><b>key_len</b></td><td><b>ref</b></td>\r\n\t\t\t\t\t\t\t\t\t\t\t <td><b>rows</b></td><td><b>Extra</b></td>\r\n\t\t\t\t\t\t\t\t\t\t   </tr>\n";
             while ($array = mysqli_fetch_array($eid)) {
                 $type_col = '#FFFFFF';
                 if ($array['type'] == 'ref' or $array['type'] == 'eq_ref' or $array['type'] == 'const') {
                     $type_col = '#D8FFD4';
                 } else {
                     if ($array['type'] == 'ALL') {
                         $type_col = '#FFEEBA';
                     }
                 }
                 $this->debug_html .= "<tr bgcolor='#FFFFFF'>\r\n\t\t\t\t\t\t\t\t\t\t\t <td>{$array['table']}&nbsp;</td>\r\n\t\t\t\t\t\t\t\t\t\t\t <td bgcolor='{$type_col}'>{$array['type']}&nbsp;</td>\r\n\t\t\t\t\t\t\t\t\t\t\t <td>{$array['possible_keys']}&nbsp;</td>\r\n\t\t\t\t\t\t\t\t\t\t\t <td>{$array['key']}&nbsp;</td>\r\n\t\t\t\t\t\t\t\t\t\t\t <td>{$array['key_len']}&nbsp;</td>\r\n\t\t\t\t\t\t\t\t\t\t\t <td>{$array['ref']}&nbsp;</td>\r\n\t\t\t\t\t\t\t\t\t\t\t <td>{$array['rows']}&nbsp;</td>\r\n\t\t\t\t\t\t\t\t\t\t\t <td>{$array['Extra']}&nbsp;</td>\r\n\t\t\t\t\t\t\t\t\t\t   </tr>\n";
             }
             $this->sql_time += $endtime;
             if ($endtime > 0.1) {
                 $endtime = "<span style='color:red'><b>{$endtime}</b></span>";
             }
             if ($memoryUsed) {
                 $memory = '<br />Memory Used: ' . IPSLib::sizeFormat($memoryUsed, TRUE);
             }
             $this->debug_html .= "<tr>\r\n\t\t\t\t\t\t\t\t\t\t  <td colspan='8' bgcolor='#FFD6DC' style='font-size:14px'><b>MySQL time</b>: {$endtime}{$memory}</b></td>\r\n\t\t\t\t\t\t\t\t\t\t  </tr>\r\n\t\t\t\t\t\t\t\t\t\t  </table>\n<br />\n";
         } else {
             $this->debug_html .= "<table width='95%' border='1' cellpadding='6' cellspacing='0' bgcolor='#FEFEFE'  align='center'>\r\n\t\t\t\t\t\t\t\t\t\t <tr>\r\n\t\t\t\t\t\t\t\t\t\t  <td style='font-size:14px' bgcolor='#EFEFEF'><b>{$shutdown}Non Select Query</b></td>\r\n\t\t\t\t\t\t\t\t\t\t </tr>\r\n\t\t\t\t\t\t\t\t\t\t <tr>\r\n\t\t\t\t\t\t\t\t\t\t  <td style='font-family:courier, monaco, arial;font-size:14px'>{$the_query}</td>\r\n\t\t\t\t\t\t\t\t\t\t </tr>\r\n\t\t\t\t\t\t\t\t\t\t <tr>\r\n\t\t\t\t\t\t\t\t\t\t  <td style='font-size:14px' bgcolor='#EFEFEF'><b>MySQL time</b>: {$endtime}</span></td>\r\n\t\t\t\t\t\t\t\t\t\t </tr>\r\n\t\t\t\t\t\t\t\t\t\t</table><br />\n\n";
         }
     }
     $this->query_count++;
     $this->obj['cached_queries'][] = $the_query;
     return $this->query_id;
 }
コード例 #3
0
 /**
  * Retreive the command
  *
  * @access	public
  * @param	object		ipsRegistry reference
  * @return	object
  */
 public function getCommand(ipsRegistry $registry)
 {
     $_NOW = IPSDebug::getMemoryDebugFlag();
     $module = ipsRegistry::$current_module;
     $section = ipsRegistry::$current_section;
     $filepath = IPSLib::getAppDir(IPS_APP_COMPONENT) . '/' . self::$modules_dir . '/' . $module . '/';
     /* Got a section? */
     if (!$section) {
         if (file_exists($filepath . 'defaultSection.php')) {
             $DEFAULT_SECTION = '';
             require $filepath . 'defaultSection.php';
             if ($DEFAULT_SECTION) {
                 $section = $DEFAULT_SECTION;
             }
         }
     }
     $classname = self::$class_dir . '_' . IPS_APP_COMPONENT . '_' . $module . '_' . $section;
     if (file_exists($filepath . 'manualResolver.php')) {
         require_once $filepath . 'manualResolver.php';
         $classname = self::$class_dir . '_' . IPS_APP_COMPONENT . '_' . $module . '_manualResolver';
     } else {
         if (file_exists($filepath . $section . '.php')) {
             require_once $filepath . $section . '.php';
         }
     }
     /* Hooks: Are we overloading this class? */
     $hooksCache = ipsRegistry::cache()->getCache('hooks');
     if (isset($hooksCache['commandHooks']) and is_array($hooksCache['commandHooks']) and count($hooksCache['commandHooks'])) {
         foreach ($hooksCache['commandHooks'] as $hook) {
             foreach ($hook as $classOverloader) {
                 /* Hooks: Do we have a hook that extends this class? */
                 if ($classOverloader['classToOverload'] == $classname) {
                     if (file_exists(DOC_IPS_ROOT_PATH . 'hooks/' . $classOverloader['filename'])) {
                         /* Hooks: Do we have the hook file? */
                         require_once DOC_IPS_ROOT_PATH . 'hooks/' . $classOverloader['filename'];
                         if (class_exists($classOverloader['className'])) {
                             /* Hooks: We have the hook file and the class exists - reset the classname to load */
                             $classname = $classOverloader['className'];
                         }
                     }
                 }
             }
         }
     }
     IPSDebug::setMemoryDebugFlag("Controller getCommand executed", $_NOW);
     if (class_exists($classname)) {
         $cmd_class = new ReflectionClass($classname);
         if ($cmd_class->isSubClassOf(self::$base_cmd)) {
             return $cmd_class->newInstance();
         } else {
             throw new Exception("{$section} in {$module} does not exist!");
         }
     }
     # Fudge it to return just the default object
     return clone self::$default_cmd;
 }
コード例 #4
0
 /**
  * Initiate the registry
  *
  * @return	mixed	false or void
  */
 public static function init()
 {
     $INFO = array();
     $_ipsPowerSettings = array();
     if (self::$initiated === TRUE) {
         return FALSE;
     }
     self::$initiated = TRUE;
     /* Load static classes */
     require IPS_ROOT_PATH . "sources/base/core.php";
     /*noLibHook*/
     require IPS_ROOT_PATH . "sources/base/ipsMember.php";
     /*noLibHook*/
     /* Debugging notices? */
     if (defined('IPS_ERROR_CAPTURE') and IPS_ERROR_CAPTURE !== FALSE) {
         @error_reporting(E_ALL | E_NOTICE);
         @set_error_handler("IPSDebug::errorHandler");
     }
     /* Load core variables */
     self::_loadCoreVariables();
     /* Load config file */
     if (is_file(DOC_IPS_ROOT_PATH . 'conf_global.php')) {
         require DOC_IPS_ROOT_PATH . 'conf_global.php';
         /*noLibHook*/
         if (is_array($INFO)) {
             foreach ($INFO as $key => $val) {
                 ipsRegistry::$settings[$key] = str_replace('&#092;', '\\', $val);
             }
         }
     }
     /* Load secret sauce */
     if (is_array($_ipsPowerSettings)) {
         ipsRegistry::$settings = array_merge($_ipsPowerSettings, ipsRegistry::$settings);
     }
     /* Make sure we're installed */
     if (empty($INFO['sql_database'])) {
         /* Quick PHP version check */
         if (!version_compare(MIN_PHP_VERS, PHP_VERSION, '<=')) {
             print "You must be using PHP " . MIN_PHP_VERS . " or better. You are currently using: " . PHP_VERSION;
             exit;
         }
         $host = $_SERVER['HTTP_HOST'] ? $_SERVER['HTTP_HOST'] : @getenv('HTTP_HOST');
         $self = $_SERVER['PHP_SELF'] ? $_SERVER['PHP_SELF'] : @getenv('PHP_SELF');
         if (IPS_AREA == 'admin') {
             @header("Location: http://" . $host . rtrim(dirname($self), '/\\') . "/install/index.php");
         } else {
             if (!defined('CP_DIRECTORY')) {
                 define('CP_DIRECTORY', 'admin');
             }
             @header("Location: http://" . $host . rtrim(dirname($self), '/\\') . "/" . CP_DIRECTORY . "/install/index.php");
         }
     }
     /* Switch off dev mode you idjit */
     if (!defined('IN_DEV')) {
         define('IN_DEV', 0);
     }
     /* Shell defined? */
     if (!defined('IPS_IS_SHELL')) {
         define('IPS_IS_SHELL', FALSE);
     }
     /* If this wasn't defined in the gateway file... */
     if (!defined('ALLOW_FURLS')) {
         define('ALLOW_FURLS', ipsRegistry::$settings['use_friendly_urls'] ? TRUE : FALSE);
     }
     if (!defined('IPS_IS_MOBILE_APP')) {
         define('IPS_IS_MOBILE_APP', false);
     }
     /**
      * File and folder permissions
      */
     if (!defined('IPS_FILE_PERMISSION')) {
         define('IPS_FILE_PERMISSION', 0777);
     }
     if (!defined('IPS_FOLDER_PERMISSION')) {
         define('IPS_FOLDER_PERMISSION', 0777);
     }
     /* Set it again incase a gateway turned it off */
     ipsRegistry::$settings['use_friendly_urls'] = ALLOW_FURLS;
     /* Start timer */
     IPSDebug::startTimer();
     /* Cookies... */
     IPSCookie::$sensitive_cookies = array('session_id', 'admin_session_id', 'member_id', 'pass_hash');
     /* INIT DB */
     self::$handles['db'] = ips_DBRegistry::instance();
     /* Set DB */
     self::$handles['db']->setDB(ipsRegistry::$settings['sql_driver']);
     /* Input set up... */
     if (is_array($_POST) and count($_POST)) {
         foreach ($_POST as $key => $value) {
             # Skip post arrays
             if (!is_array($value)) {
                 $_POST[$key] = IPSText::stripslashes($value);
             }
         }
     }
     //-----------------------------------------
     // Clean globals, first.
     //-----------------------------------------
     IPSLib::cleanGlobals($_GET);
     IPSLib::cleanGlobals($_POST);
     IPSLib::cleanGlobals($_COOKIE);
     IPSLib::cleanGlobals($_REQUEST);
     # GET first
     $input = IPSLib::parseIncomingRecursively($_GET, array());
     # Then overwrite with POST
     self::$request = IPSLib::parseIncomingRecursively($_POST, $input);
     # Fix some notices
     if (!isset(self::$request['module'])) {
         self::$request['module'] = '';
     }
     if (!isset(self::$request['section'])) {
         self::$request['section'] = '';
     }
     # Assign request method
     self::$request['request_method'] = strtolower(my_getenv('REQUEST_METHOD'));
     /* Define some constants */
     define('IPS_IS_TASK', (isset(self::$request['module']) and self::$request['module'] == 'task' and self::$request['app'] == 'core') ? TRUE : FALSE);
     define('IPS_IS_AJAX', (isset(self::$request['module']) and self::$request['module'] == 'ajax') ? TRUE : FALSE);
     /* First pass of app set up. Needs to be BEFORE caches and member are set up */
     self::_fUrlInit();
     self::_manageIncomingURLs();
     /* _manageIncomingURLs MUST be called first!!! */
     self::_setUpAppData();
     /* Load app / coreVariables.. must be called after app Data */
     self::_loadAppCoreVariables(IPS_APP_COMPONENT);
     /* Must be called after _manageIncomingURLs */
     self::$handles['db']->getDB()->setDebugMode(IPS_SQL_DEBUG_MODE ? isset($_GET['debug']) ? intval($_GET['debug']) : 0 : 0);
     /* Get caches */
     self::$handles['caches'] = ips_CacheRegistry::instance();
     /* Make sure all is well before we proceed */
     try {
         self::instance()->setUpSettings();
     } catch (Exception $e) {
         print file_get_contents(IPS_CACHE_PATH . 'cache/skin_cache/settingsEmpty.html');
         exit;
     }
     /* Reset database log file paths to cache path */
     self::$handles['db']->resetLogPaths();
     /* Just in case they copy a space in the license... */
     ipsRegistry::$settings['ipb_reg_number'] = trim(ipsRegistry::$settings['ipb_reg_number']);
     /* Bah, now let's go over any input cleaning routines that have settings *sighs* */
     self::$request = IPSLib::postParseIncomingRecursively(self::$request);
     /* Set up dummy member class to prevent errors if cache rebuild required */
     self::$handles['member'] = ips_MemberRegistryDummy::instance();
     /* Build module and application caches */
     self::instance()->checkCaches();
     /* Set up app specific redirects. Must be called before member/sessions setup */
     self::_parseAppResets();
     /* Re-assign member */
     unset(self::$handles['member']);
     self::$handles['member'] = ips_MemberRegistry::instance();
     /* Load other classes */
     $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/class_localization.php', 'class_localization');
     self::instance()->setClass('class_localization', new $classToLoad(self::instance()));
     $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/class_public_permissions.php', 'classPublicPermissions');
     self::instance()->setClass('permissions', new $classToLoad(self::instance()));
     /* Must be called before output initiated */
     self::getAppClass(IPS_APP_COMPONENT);
     if (IPS_AREA == 'admin') {
         require_once IPS_ROOT_PATH . 'sources/classes/output/publicOutput.php';
         /*noLibHook*/
         $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/output/adminOutput.php', 'adminOutput');
         self::instance()->setClass('output', new $classToLoad(self::instance()));
         $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . "sources/classes/class_admin_functions.php", 'adminFunctions');
         self::instance()->setClass('adminFunctions', new $classToLoad(self::instance()));
         $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/class_permissions.php', 'class_permissions');
         self::instance()->setClass('class_permissions', new $classToLoad(self::instance()));
         /* Do stuff that needs both adminFunctions and output initiated */
         self::instance()->getClass('adminFunctions')->postOutputInit();
     } else {
         $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/output/publicOutput.php', 'output');
         self::instance()->setClass('output', new $classToLoad(self::instance(), TRUE));
         register_shutdown_function(array('ipsRegistry', '__myDestruct'));
     }
     /* Post member processing */
     self::$handles['member']->postOutput();
     /* Add SEO templates to the output system */
     self::instance()->getClass('output')->seoTemplates = self::$_seoTemplates;
     //-----------------------------------------
     // Sort out report center early, so counts
     // and cache is right
     //-----------------------------------------
     $memberData =& self::$handles['member']->fetchMemberData();
     $memberData['showReportCenter'] = false;
     $member_group_ids = array($memberData['member_group_id']);
     $member_group_ids = array_diff(array_merge($member_group_ids, explode(',', $memberData['mgroup_others'])), array(''));
     $report_center = array_diff(explode(',', ipsRegistry::$settings['report_mod_group_access']), array(''));
     foreach ($report_center as $groupId) {
         if (in_array($groupId, $member_group_ids)) {
             $memberData['showReportCenter'] = true;
             break;
         }
     }
     if ($memberData['showReportCenter']) {
         $memberData['access_report_center'] = true;
         $memberCache = $memberData['_cache'];
         $reportsCache = self::$handles['caches']->getCache('report_cache');
         if (!$memberCache['report_last_updated'] || $memberCache['report_last_updated'] < $reportsCache['last_updated']) {
             $classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('core') . '/sources/classes/reportLibrary.php', 'reportLibrary');
             $reports = new $classToLoad(ipsRegistry::instance());
             $totalReports = $reports->rebuildMemberCacheArray();
             $memberCache['report_num'] = $totalReports;
             $memberData['_cache'] = $memberCache;
         }
     }
     /* More set up */
     self::_finalizeAppData();
     /* Finish fURL stuffs */
     self::_fUrlComplete();
     self::instance()->getClass('class_localization')->loadLanguageFile(array('public_global'), 'core');
     if (IPS_AREA == 'admin') {
         $validationStatus = self::member()->sessionClass()->getStatus();
         $validationMessage = self::member()->sessionClass()->getMessage();
         if (ipsRegistry::$request['module'] != 'login' and !$validationStatus) {
             //-----------------------------------------
             // Force log in
             //-----------------------------------------
             if (ipsRegistry::$request['module'] == 'ajax') {
                 @header("Content-type: application/json;charset=" . IPS_DOC_CHAR_SET);
                 print json_encode(array('error' => self::instance()->getClass('class_localization')->words['acp_sessiontimeout'], '__session__expired__log__out__' => 1));
                 exit;
             } elseif (ipsRegistry::$settings['logins_over_https'] && (empty($_SERVER['HTTPS']) or $_SERVER['HTTPS'] != 'on')) {
                 /* Bug 38301 */
                 ipsRegistry::getClass('output')->silentRedirect(str_replace('http://', 'https://', ipsRegistry::$settings['this_url']));
                 return;
             } else {
                 ipsRegistry::$request['module'] = 'login';
                 ipsRegistry::$request['core'] = 'login';
                 $classToLoad = IPSLib::loadActionOverloader(IPSLib::getAppDir('core') . "/modules_admin/login/manualResolver.php", 'admin_core_login_manualResolver');
                 $runme = new $classToLoad(self::instance());
                 $runme->doExecute(self::instance());
                 exit;
             }
         }
     } else {
         if (IPS_AREA == 'public') {
             /* Set up member */
             self::$handles['member']->finalizePublicMember();
             /* Proper no cache key <update:1> */
             ipsRegistry::$settings['noCacheKey'] = md5('$Rev: 12261 $');
             /* Are we banned: Via IP Address? */
             if (IPSMember::isBanned('ipAddress', self::$handles['member']->ip_address) === TRUE) {
                 self::instance()->getClass('output')->showError('you_are_banned', 2000, true, null, 403);
             }
             /* Are we banned: By DB */
             if (self::$handles['member']->getProperty('member_banned') == 1 or self::$handles['member']->getProperty('temp_ban')) {
                 /* Don't show this message if we're viewing the warn log */
                 if (ipsRegistry::$request['module'] != 'ajax' or ipsRegistry::$request['section'] != 'warnings') {
                     self::getClass('class_localization')->loadLanguageFile('public_error', 'core');
                     $message = '';
                     if (self::$handles['member']->getProperty('member_banned')) {
                         $message = self::getClass('class_localization')->words['no_view_board_b'];
                     } else {
                         $ban_arr = IPSMember::processBanEntry(self::$handles['member']->getProperty('temp_ban'));
                         /* No longer banned */
                         if (time() >= $ban_arr['date_end']) {
                             self::DB()->update('members', array('temp_ban' => ''), 'member_id=' . self::$handles['member']->getProperty('member_id'));
                         } else {
                             $message = sprintf(self::getClass('class_localization')->words['account_susp'], self::getClass('class_localization')->getDate($ban_arr['date_end'], 'LONG', 1));
                         }
                     }
                     /* Get anything? */
                     if ($message) {
                         $warn = ipsRegistry::DB()->buildAndFetch(array('select' => '*', 'from' => 'members_warn_logs', 'where' => 'wl_member=' . self::$handles['member']->getProperty('member_id') . ' AND wl_suspend<>0 AND wl_suspend<>-2', 'order' => 'wl_date DESC', 'limit' => 1));
                         if ($warn['wl_id'] and ipsRegistry::$settings['warn_show_own']) {
                             $moredetails = "<a href='javascript:void(0);' onclick='warningPopup( this, {$warn['wl_id']} );'>" . self::getClass('class_localization')->words['warnings_moreinfo'] . "</a>";
                         }
                         self::instance()->getClass('output')->showError("{$message} {$moredetails}", 1001, true, null, 403);
                     }
                 }
             }
             /* Check server load */
             if (ipsRegistry::$settings['load_limit'] > 0) {
                 $server_load = IPSDebug::getServerLoad();
                 if ($server_load) {
                     $loadinfo = explode("-", $server_load);
                     if (count($loadinfo)) {
                         self::$server_load = $loadinfo[0];
                         if (self::$server_load > ipsRegistry::$settings['load_limit']) {
                             self::instance()->getClass('output')->showError('server_too_busy', 2001);
                         }
                     }
                 }
             }
             /* Specific Ajax Check */
             if (IPS_IS_AJAX and ipsRegistry::$request['section'] != 'warnings') {
                 if (self::$handles['member']->getProperty('g_view_board') != 1 || ipsRegistry::$settings['board_offline'] && !self::$handles['member']->getProperty('g_access_offline')) {
                     @header("Content-type: application/json;charset=" . IPS_DOC_CHAR_SET);
                     print json_encode(array('error' => 'no_permission', '__board_offline__' => 1));
                     exit;
                 }
             }
             /* Other public check */
             if (IPB_THIS_SCRIPT == 'public' and IPS_ENFORCE_ACCESS === FALSE and (ipsRegistry::$request['section'] != 'login' and ipsRegistry::$request['section'] != 'lostpass' and IPS_IS_AJAX === FALSE and ipsRegistry::$request['section'] != 'rss' and ipsRegistry::$request['section'] != 'attach' and ipsRegistry::$request['module'] != 'task' and ipsRegistry::$request['section'] != 'captcha')) {
                 //-----------------------------------------
                 // Permission to see the board?
                 //-----------------------------------------
                 if (self::$handles['member']->getProperty('g_view_board') != 1) {
                     self::getClass('output')->showError('no_view_board', 1000, null, null, 403);
                 }
                 //--------------------------------
                 //  Is the board offline?
                 //--------------------------------
                 if (ipsRegistry::$settings['board_offline'] == 1 and !IPS_IS_SHELL) {
                     if (self::$handles['member']->getProperty('g_access_offline') != 1) {
                         ipsRegistry::$settings['no_reg'] = 1;
                         self::getClass('output')->showBoardOffline();
                     }
                 }
                 //-----------------------------------------
                 // Do we have a display name?
                 //-----------------------------------------
                 if (!(ipsRegistry::$request['section'] == 'register' and (ipsRegistry::$request['do'] == 'complete_login' or ipsRegistry::$request['do'] == 'complete_login_do'))) {
                     if (!self::$handles['member']->getProperty('members_display_name')) {
                         $pmember = self::DB()->buildAndFetch(array('select' => '*', 'from' => 'members_partial', 'where' => "partial_member_id=" . self::$handles['member']->getProperty('member_id')));
                         if (!$pmember['partial_member_id']) {
                             $pmember = array('partial_member_id' => self::$handles['member']->getProperty('member_id'), 'partial_date' => time(), 'partial_email_ok' => self::$handles['member']->getProperty('email') == self::$handles['member']->getProperty('name') . '@' . self::$handles['member']->getProperty('joined') ? 0 : 1);
                             self::DB()->insert('members_partial', $pmember);
                             $pmember['partial_id'] = self::DB()->getInsertId();
                         }
                         self::instance()->getClass('output')->silentRedirect(ipsRegistry::$settings['base_url'] . 'app=core&module=global&section=register&do=complete_login&mid=' . self::$handles['member']->getProperty('member_id') . '&key=' . $pmember['partial_date']);
                     }
                 }
                 //--------------------------------
                 //  Is log in enforced?
                 //--------------------------------
                 if (!(defined('IPS_IS_SHELL') && IPS_IS_SHELL === TRUE) && (!IPS_IS_MOBILE_APP && self::$handles['member']->getProperty('member_group_id') == ipsRegistry::$settings['guest_group'] and ipsRegistry::$settings['force_login'] == 1 && !in_array(ipsRegistry::$request['section'], array('register', 'privacy', 'unsubscribe')))) {
                     if (ipsRegistry::$settings['logins_over_https'] and (!$_SERVER['HTTPS'] or $_SERVER['HTTPS'] != 'on')) {
                         //-----------------------------------------
                         // Set referrer
                         //-----------------------------------------
                         if (!my_getenv('HTTP_REFERER') or stripos(my_getenv('HTTP_REFERER'), ipsRegistry::$settings['board_url']) === false) {
                             $http_referrer = (strtolower($_SERVER['HTTPS']) == 'on' ? "https://" : "http://") . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
                         } else {
                             $http_referrer = my_getenv('HTTP_REFERER');
                         }
                         self::instance()->getClass('output')->silentRedirect(str_replace('http://', 'https://', ipsRegistry::$settings['base_url']) . 'app=core&module=global&section=login&referer=' . urlencode($http_referrer));
                     }
                     ipsRegistry::$request['app'] = 'core';
                     ipsRegistry::$request['module'] = 'login';
                     ipsRegistry::$request['core'] = 'login';
                     ipsRegistry::$request['referer'] = ipsRegistry::$request['referer'] ? ipsRegistry::$request['referer'] : (strtolower($_SERVER['HTTPS']) == 'on' ? "https://" : "http://") . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
                     if (is_file(DOC_IPS_ROOT_PATH . '/' . PUBLIC_DIRECTORY . '/style_css/' . ipsRegistry::getClass('output')->skin['_csscacheid'] . '/ipb_login_register.css')) {
                         ipsRegistry::getClass('output')->addToDocumentHead('importcss', ipsRegistry::$settings['css_base_url'] . 'style_css/' . ipsRegistry::getClass('output')->skin['_csscacheid'] . '/ipb_login_register.css');
                     }
                     $classToLoad = IPSLib::loadActionOverloader(IPSLib::getAppDir('core') . "/modules_public/global/login.php", 'public_core_global_login');
                     $runme = new $classToLoad(self::instance());
                     $runme->doExecute(self::instance());
                     exit;
                 }
             }
             /* Have we entered an incorrect FURL that has no match? */
             if (ipsRegistry::$settings['use_friendly_urls'] and self::$_noFurlMatch === true) {
                 self::getClass('output')->showError('incorrect_furl', 404, null, null, 404);
             } else {
                 if (isset(ipsRegistry::$request['act']) and ipsRegistry::$request['act'] == 'rssout') {
                     self::getClass('output')->showError('incorrect_furl', 404, null, null, 404);
                 }
             }
             /* Track search engine visits */
             if (!IPS_IS_TASK and $_SERVER['HTTP_REFERER']) {
                 seoTracker::track($_SERVER['HTTP_REFERER'], self::$settings['query_string_real'], self::$handles['member']->getProperty('member_id'));
             }
         }
     }
     IPSDebug::setMemoryDebugFlag("Registry initialized");
 }
コード例 #5
0
ファイル: ipsController.php プロジェクト: mover5/imobackup
 /**
  * Retreive the command
  *
  * @access	public
  * @param	object		ipsRegistry reference
  * @return	object
  */
 public function getCommand(ipsRegistry $registry)
 {
     $_NOW = IPSDebug::getMemoryDebugFlag();
     $module = ipsRegistry::$current_module;
     $section = ipsRegistry::$current_section;
     $filepath = IPSLib::getAppDir(IPS_APP_COMPONENT) . '/' . self::$modules_dir . '/' . $module . '/';
     /* Bug Fix #21009 */
     if (!ipsRegistry::$applications[IPS_APP_COMPONENT]['app_enabled']) {
         throw new Exception("The specified application has been disabled");
     }
     if (!IN_ACP and !IPSLib::moduleIsEnabled($module, IPS_APP_COMPONENT) and $module != 'ajax') {
         throw new Exception("The specified module has been disabled");
     }
     /* Got a section? */
     if (!$section) {
         if (is_file($filepath . 'defaultSection.php')) {
             $DEFAULT_SECTION = '';
             include $filepath . 'defaultSection.php';
             /*noLibHook*/
             if ($DEFAULT_SECTION) {
                 $section = $DEFAULT_SECTION;
                 ipsRegistry::$current_section = $section;
             }
         }
     }
     $_classname = self::$class_dir . '_' . IPS_APP_COMPONENT . '_' . $module . '_';
     /* Rarely used, let's leave file_exists which is faster for non-existent files */
     if (file_exists($filepath . 'manualResolver.php')) {
         $classname = IPSLib::loadActionOverloader($filepath . 'manualResolver.php', $_classname . 'manualResolver');
     } else {
         if (is_file($filepath . $section . '.php')) {
             $classname = IPSLib::loadActionOverloader($filepath . $section . '.php', $_classname . $section);
         }
     }
     IPSDebug::setMemoryDebugFlag("Controller getCommand executed");
     if (class_exists($classname)) {
         $cmd_class = new ReflectionClass($classname);
         if ($cmd_class->isSubClassOf(self::$base_cmd)) {
             return $cmd_class->newInstance();
         } else {
             throw new Exception("{$section} in {$module} does not exist!");
         }
     } else {
         throw new Exception("{$classname} does not exist!");
     }
     # Fudge it to return just the default object
     return clone self::$default_cmd;
 }
コード例 #6
0
ファイル: core.php プロジェクト: mover5/imobackup
 /**
  * This function processes the DB post before printing as output
  *
  * @access	public
  * @param	string			Raw text
  * @return	string			Converted text
  */
 public function preDisplayParse($txt = "")
 {
     $this->cache->updateCacheWithoutSaving('_tmp_bbcode_media', 0);
     $this->cache->updateCacheWithoutSaving('_tmp_bbcode_images', 0);
     if ($this->parse_html) {
         //-----------------------------------------
         // Store true line breaks first
         //-----------------------------------------
         $txt = str_replace('<br />', "~~~~~_____~~~~~", $txt);
         $txt = $this->_parseHtml($txt);
         /* We still don't want XSS thx */
         if (!$this->skipXssCheck) {
             $txt = $this->checkXss($txt, true);
         }
     }
     /* http://community.invisionpower.com/resources/bugs.html/_/ip-board/profile-quotes-in-likes-tab-does-not-appear-r42346
     		else
     		{
     			$txt = str_replace( '  ', '&nbsp;&nbsp;', $txt );
     		}*/
     //-----------------------------------------
     // Fix "{style_images_url}"
     //-----------------------------------------
     $txt = str_replace("{style_images_url}", "&#123;style_images_url&#125;", $txt);
     //-----------------------------------------
     // Custom BB code
     //-----------------------------------------
     $_NOW = IPSDebug::getMemoryDebugFlag();
     IPSDebug::setMemoryDebugFlag("PreDisplayParse - parsed BBCode", $_NOW);
     //-----------------------------------------
     // Fix line breaks
     //-----------------------------------------
     if ($this->parse_html) {
         $txt = str_replace("~~~~~_____~~~~~", '<br />', $txt);
     }
     $_memberData = array('member_group_id' => $this->parsing_mgroup, 'mgroup_others' => $this->parsing_mgroup_others);
     if ($this->parsing_mgroup) {
         $_memberData = array_merge($_memberData, $this->caches['group_cache'][$this->parsing_mgroup]);
     }
     if ($this->parsing_mgroup_others) {
         $_memberData = ips_MemberRegistry::setUpSecondaryGroups($_memberData);
     }
     /* Finish hiiiiiiiiiiiiiiim */
     $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/text/parser.php', 'classes_text_parser');
     $parser = new $classToLoad();
     $parser->set(array('memberData' => $_memberData, 'parseBBCode' => $this->parse_bbcode, 'parseArea' => $this->parsing_section, 'parseHtml' => $this->parse_html, 'parseEmoticons' => $this->parse_smilies));
     /* Convert emos back into code */
     $txt = $parser->emoticonImgtoCode($txt);
     $txt = $parser->display($txt);
     //-----------------------------------------
     // Fix images nested inside anchors
     //-----------------------------------------
     $txt = preg_replace_callback('#(\\<a[^\\>]+bbc_url[^\\>]+\\>)\\s*?(.+?)\\s*?(\\<\\/a\\>)#im', array($this, 'removeLightboxSpans'), $txt);
     return $txt;
 }
コード例 #7
0
 /**
  * Topic set up ya'll
  *
  * @return	@e void
  */
 public function topicSetUp($topicData)
 {
     /* Init */
     $topicData = $topicData['tid'] ? $topicData : $this->registry->getClass('topics')->getTopicData();
     $forumData = $this->forumClass->getForumById($topicData['forum_id']);
     $permissionData = $this->registry->getClass('topics')->getPermissionData();
     //-----------------------------------------
     // Memory...
     //-----------------------------------------
     $_before = IPSDebug::getMemoryDebugFlag();
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $this->request['start'] = !empty($this->request['start']) ? intval($this->request['start']) : '';
     $this->request['page'] = !empty($this->request['page']) ? intval($this->request['page']) : '';
     $this->settings['post_order_column'] = $this->settings['post_order_column'] != 'post_date' ? 'pid' : 'post_date';
     $this->settings['post_order_sort'] = $this->settings['post_order_sort'] != 'desc' ? 'asc' : 'desc';
     $this->settings['au_cutoff'] = empty($this->settings['au_cutoff']) ? 15 : $this->settings['au_cutoff'];
     //-----------------------------------------
     // Compile the language file
     //-----------------------------------------
     $this->registry->class_localization->loadLanguageFile(array('public_boards', 'public_topic'));
     $this->registry->class_localization->loadLanguageFile(array('public_editors'), 'core');
     //-----------------------------------------
     // Get all the member groups and
     // member title info
     //-----------------------------------------
     if (!is_array($this->cache->getCache('ranks'))) {
         $this->cache->rebuildCache('ranks', 'global');
     }
     //-----------------------------------------
     // Are we actually a moderator for this forum?
     //-----------------------------------------
     if (!$this->memberData['g_is_supmod']) {
         $moderator = $this->memberData['forumsModeratorData'];
         if (!isset($moderator[$forumData['id']]) or !is_array($moderator[$forumData['id']])) {
             $this->memberData['is_mod'] = 0;
         }
     }
     $this->settings['_base_url'] = $this->settings['base_url'];
     $this->first = $this->registry->getClass('topics')->pageToSt($this->request['page']);
     $this->request['view'] = !empty($this->request['view']) ? $this->request['view'] : NULL;
     //-----------------------------------------
     // Check viewing permissions, private forums,
     // password forums, etc
     //-----------------------------------------
     if (!$this->memberData['g_other_topics'] and $topicData['starter_id'] != $this->memberData['member_id']) {
         $this->registry->output->showError('topics_not_yours', 10359, null, null, 403);
     } else {
         if (!$forumData['can_view_others'] and !$this->memberData['is_mod'] and $topicData['starter_id'] != $this->memberData['member_id']) {
             $this->registry->output->showError('topics_not_yours2', 10360, null, null, 403);
         } else {
             if ($forumData['redirect_on'] and $forumData['redirect_url']) {
                 $this->registry->output->silentRedirect($forumData['redirect_url']);
             }
         }
     }
     //-----------------------------------------
     // Update the topic views counter
     //-----------------------------------------
     if (!$this->request['view'] and $topicData['state'] != 'link') {
         if ($this->settings['update_topic_views_immediately']) {
             $this->DB->update('topics', 'views=views+1', "tid=" . $topicData['tid'], true, true);
         } else {
             $this->DB->insert('topic_views', array('views_tid' => $topicData['tid']), true);
         }
     }
     //-----------------------------------------
     // Need to update this topic?
     //-----------------------------------------
     if ($topicData['state'] == 'open') {
         if (!$topicData['topic_open_time'] or $topicData['topic_open_time'] < $topicData['topic_close_time']) {
             if ($topicData['topic_close_time'] and ($topicData['topic_close_time'] <= time() and (time() >= $topicData['topic_open_time'] or !$topicData['topic_open_time']))) {
                 $topicData['state'] = 'closed';
                 $this->DB->update('topics', array('state' => 'closed'), 'tid=' . $topicData['tid'], true);
             }
         } else {
             if ($topicData['topic_open_time'] or $topicData['topic_open_time'] > $topicData['topic_close_time']) {
                 if ($topicData['topic_close_time'] and ($topicData['topic_close_time'] <= time() and time() <= $topicData['topic_open_time'])) {
                     $topicData['state'] = 'closed';
                     $this->DB->update('topics', array('state' => 'closed'), 'tid=' . $topicData['tid'], true);
                 }
             }
         }
     } else {
         if ($topicData['state'] == 'closed') {
             if (!$topicData['topic_close_time'] or $topicData['topic_close_time'] < $topicData['topic_open_time']) {
                 if ($topicData['topic_open_time'] and ($topicData['topic_open_time'] <= time() and (time() >= $topicData['topic_close_time'] or !$topicData['topic_close_time']))) {
                     $topicData['state'] = 'open';
                     $this->DB->update('topics', array('state' => 'open'), 'tid=' . $topicData['tid'], true);
                 }
             } else {
                 if ($topicData['topic_close_time'] or $topicData['topic_close_time'] > $topicData['topic_open_time']) {
                     if ($topicData['topic_open_time'] and ($topicData['topic_open_time'] <= time() and time() <= $topicData['topic_close_time'])) {
                         $topicData['state'] = 'open';
                         $this->DB->update('topics', array('state' => 'open'), 'tid=' . $topicData['tid'], true);
                     }
                 }
             }
         }
     }
     //-----------------------------------------
     // Current topic rating value
     //-----------------------------------------
     $topicData['_rate_show'] = 0;
     $topicData['_rate_int'] = 0;
     $topicData['_rate_img'] = '';
     if ($topicData['state'] != 'open') {
         $topicData['_allow_rate'] = 0;
     } else {
         $topicData['_allow_rate'] = $this->can_rate;
     }
     if ($forumData['forum_allow_rating']) {
         $rating = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'topic_ratings', 'where' => "rating_tid={$topicData['tid']} and rating_member_id=" . $this->memberData['member_id']));
         if ($rating['rating_value'] and $this->memberData['g_topic_rate_setting'] != 2) {
             $topicData['_allow_rate'] = 0;
         }
         $topicData['_rate_id'] = 0;
         $topicData['_rating_value'] = $rating['rating_value'] ? $rating['rating_value'] : -1;
         if ($topicData['topic_rating_total']) {
             $topicData['_rate_int'] = round($topicData['topic_rating_total'] / $topicData['topic_rating_hits']);
         }
         //-----------------------------------------
         // Show image?
         //-----------------------------------------
         if ($topicData['topic_rating_hits'] >= $this->settings['topic_rating_needed'] and $topicData['_rate_int']) {
             $topicData['_rate_id'] = $topicData['_rate_int'];
             $topicData['_rate_show'] = 1;
         }
     } else {
         $topicData['_allow_rate'] = 0;
     }
     //-----------------------------------------
     // If this forum is a link, then
     // redirect them to the new location
     //-----------------------------------------
     if ($topicData['state'] == 'link' and $topicData['moved_to']) {
         $f_stuff = explode("&", $topicData['moved_to']);
         $_topic = $this->DB->buildAndFetch(array('select' => 'title_seo', 'from' => 'topics', 'where' => 'tid=' . $f_stuff[0]));
         /**
          * Mark redirect links as read too
          * 
          * @link	http://community.invisionpower.com/tracker/issue-36985-linked-topics-readunread-status/
          */
         $this->registry->getClass('classItemMarking')->markRead(array('forumID' => $forumData['id'], 'itemID' => $topicData['tid']), 'forums');
         $this->registry->output->silentRedirect($this->settings['base_url'] . "showtopic={$f_stuff[0]}", $_topic['title_seo'], true, 'showtopic');
     }
     //-----------------------------------------
     // If this is a sub forum, we need to get
     // the cat details, and parent details
     //-----------------------------------------
     $this->nav = $this->registry->class_forums->forumsBreadcrumbNav($forumData['id']);
     //-----------------------------------------
     // Hi! Light?
     //-----------------------------------------
     $hl = !empty($this->request['hl']) ? '&amp;hl=' . $this->request['hl'] : '';
     //-----------------------------------------
     // If we can see queued topics, add count
     //-----------------------------------------
     if ($this->registry->class_forums->canQueuePosts($forumData['id'])) {
         if (isset($this->request['modfilter']) and $this->request['modfilter'] == 'invisible_posts') {
             $topicData['posts'] = intval($topicData['topic_queuedposts']);
         } else {
             $topicData['posts'] += intval($topicData['topic_queuedposts']);
         }
     }
     if ($permissionData['softDeleteSee'] and $topicData['topic_deleted_posts']) {
         $topicData['posts'] += intval($topicData['topic_deleted_posts']);
     }
     //-----------------------------------------
     // Generate the forum page span links
     //-----------------------------------------
     if ($this->request['modfilter']) {
         $hl .= "&amp;modfilter=" . $this->request['modfilter'];
     }
     $topicData['SHOW_PAGES'] = $this->registry->output->generatePagination(array('totalItems' => $topicData['posts'] + 1, 'itemsPerPage' => $this->settings['display_max_posts'], 'currentPage' => intval($this->request['page']), 'seoTitle' => $topicData['title_seo'], 'realTitle' => $topicData['title'], 'isPagesMode' => true, 'seoTemplate' => 'showtopic', 'baseUrl' => "showtopic=" . $topicData['tid'] . $hl));
     //-----------------------------------------
     // Fix up some of the words
     //-----------------------------------------
     $topicData['TOPIC_START_DATE'] = $this->registry->class_localization->getDate($topicData['start_date'], 'LONG');
     $this->lang->words['topic_stats'] = str_replace("<#START#>", $topicData['TOPIC_START_DATE'], $this->lang->words['topic_stats']);
     $this->lang->words['topic_stats'] = str_replace("<#POSTS#>", $topicData['posts'], $this->lang->words['topic_stats']);
     //-----------------------------------------
     // Multi Quoting?
     //-----------------------------------------
     $this->qpids = IPSCookie::get('mqtids');
     //-----------------------------------------
     // Multi PIDS?
     //-----------------------------------------
     $this->request['selectedpids'] = !empty($this->request['selectedpids']) ? $this->request['selectedpids'] : IPSCookie::get('modpids');
     $this->request['selectedpidcount'] = 0;
     IPSCookie::set('modpids', '', 0);
     IPSDebug::setMemoryDebugFlag("TOPIC: topics.php::topicSetUp", $_before);
     return $topicData;
 }
 /**
  * Parses the bbcode to be shown in the browser.  Expects preDbParse has already been done before the save.
  * If all bbcodes are parse on save, this method does nothing really
  *
  * @access	public
  * @param 	string			Raw input text to parse
  * @return	string			Parsed text ready to be displayed
  */
 public function preDisplayParse($text)
 {
     $_NOW = IPSDebug::getMemoryDebugFlag();
     $this->_passSettings();
     //-----------------------------------------
     // Parse
     //-----------------------------------------
     $text = $this->bbclass->preDisplayParse($text);
     IPSDebug::setMemoryDebugFlag("PreDisplayParse completed", $_NOW);
     return $text;
 }
コード例 #9
0
 /**
  * This function processes the DB post before printing as output
  *
  * @access	public
  * @param	string			Raw text
  * @return	string			Converted text
  */
 public function preDisplayParse($txt = "")
 {
     if ($this->parse_html) {
         $txt = $this->_parseHtml($txt);
     }
     //-----------------------------------------
     // Fix "{style_images_url}"
     //-----------------------------------------
     $txt = str_replace("{style_images_url}", "&#123;style_images_url&#125;", $txt);
     //-----------------------------------------
     // Custom BB code
     //-----------------------------------------
     $_NOW = IPSDebug::getMemoryDebugFlag();
     if ($this->parse_bbcode) {
         $txt = $this->parseBbcode($txt, 'display');
     }
     IPSDebug::setMemoryDebugFlag("PreDisplayParse - parsed BBCode", $_NOW);
     $_NOW = IPSDebug::getMemoryDebugFlag();
     if ($this->parse_wordwrap > 0) {
         $txt = $this->applyWordwrap($txt, $this->parse_wordwrap);
     }
     IPSDebug::setMemoryDebugFlag("PreDisplayParse - applied wordwrap", $_NOW);
     //-----------------------------------------
     // Protect against XSS
     //-----------------------------------------
     $txt = $this->checkXss($txt);
     //-----------------------------------------
     // And fix old youtube embedded videos..
     //-----------------------------------------
     /*if( stripos( $txt, "<object" ) AND stripos( $txt, "<embed" ) )
     		{
     			//$txt = preg_replace( "#<object(.+?)<embed(.+?)></embed></object>#i", "<embed\\2</embed>", $txt );
     			$txt = preg_replace( "#<object(.+?)<embed.+?></embed></object>#i", "<object\\1</object>", $txt );
     		}*/
     return $txt;
 }
コード例 #10
0
 /**
  * Topic set up ya'll
  *
  * @access	public
  * @return	void
  **/
 public function topicSetUp()
 {
     //-----------------------------------------
     // Memory...
     //-----------------------------------------
     $_before = IPSDebug::getMemoryDebugFlag();
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $this->request['start'] = !empty($this->request['start']) ? intval($this->request['start']) : '';
     $this->request['st'] = !empty($this->request['st']) ? intval($this->request['st']) : '';
     //-----------------------------------------
     // Compile the language file
     //-----------------------------------------
     $this->registry->class_localization->loadLanguageFile(array('public_boards', 'public_topic'));
     $this->registry->class_localization->loadLanguageFile(array('public_editors'), 'core');
     //-----------------------------------------
     // Get all the member groups and
     // member title info
     //-----------------------------------------
     if (!is_array($this->cache->getCache('ranks'))) {
         $this->cache->rebuildCache('ranks', 'global');
     }
     //-----------------------------------------
     // Are we actually a moderator for this forum?
     //-----------------------------------------
     if (!$this->memberData['g_is_supmod']) {
         $moderator = $this->memberData['forumsModeratorData'];
         if (!isset($moderator[$this->forum['id']]) or !is_array($moderator[$this->forum['id']])) {
             $this->memberData['is_mod'] = 0;
         }
     }
     $this->settings['_base_url'] = $this->settings['base_url'];
     $this->forum['FORUM_JUMP'] = $this->registry->getClass('class_forums')->buildForumJump();
     $this->first = intval($this->request['st']) > 0 ? intval($this->request['st']) : 0;
     $this->request['view'] = !empty($this->request['view']) ? $this->request['view'] : NULL;
     //-----------------------------------------
     // Check viewing permissions, private forums,
     // password forums, etc
     //-----------------------------------------
     if (!$this->memberData['g_other_topics'] and $this->topic['starter_id'] != $this->memberData['member_id']) {
         $this->registry->output->showError('topics_not_yours', 10359);
     } else {
         if (!$this->forum['can_view_others'] and !$this->memberData['is_mod'] and $this->topic['starter_id'] != $this->memberData['member_id']) {
             $this->registry->output->showError('topics_not_yours2', 10360);
         }
     }
     //-----------------------------------------
     // Update the topic views counter
     //-----------------------------------------
     if (!$this->request['view'] and $this->topic['state'] != 'link') {
         if ($this->settings['update_topic_views_immediately']) {
             $this->DB->update('topics', 'views=views+1', "tid=" . $this->topic['tid'], true, true);
         } else {
             $this->DB->insert('topic_views', array('views_tid' => $this->topic['tid']), true);
         }
     }
     //-----------------------------------------
     // Need to update this topic?
     //-----------------------------------------
     if ($this->topic['state'] == 'open') {
         if (!$this->topic['topic_open_time'] or $this->topic['topic_open_time'] < $this->topic['topic_close_time']) {
             if ($this->topic['topic_close_time'] and ($this->topic['topic_close_time'] <= time() and (time() >= $this->topic['topic_open_time'] or !$this->topic['topic_open_time']))) {
                 $this->topic['state'] = 'closed';
                 $this->DB->update('topics', array('state' => 'closed'), 'tid=' . $this->topic['tid'], true);
             }
         } else {
             if ($this->topic['topic_open_time'] or $this->topic['topic_open_time'] > $this->topic['topic_close_time']) {
                 if ($this->topic['topic_close_time'] and ($this->topic['topic_close_time'] <= time() and time() <= $this->topic['topic_open_time'])) {
                     $this->topic['state'] = 'closed';
                     $this->DB->update('topics', array('state' => 'closed'), 'tid=' . $this->topic['tid'], true);
                 }
             }
         }
     } else {
         if ($this->topic['state'] == 'closed') {
             if (!$this->topic['topic_close_time'] or $this->topic['topic_close_time'] < $this->topic['topic_open_time']) {
                 if ($this->topic['topic_open_time'] and ($this->topic['topic_open_time'] <= time() and (time() >= $this->topic['topic_close_time'] or !$this->topic['topic_close_time']))) {
                     $this->topic['state'] = 'open';
                     $this->DB->update('topics', array('state' => 'open'), 'tid=' . $this->topic['tid'], true);
                 }
             } else {
                 if ($this->topic['topic_close_time'] or $this->topic['topic_close_time'] > $this->topic['topic_open_time']) {
                     if ($this->topic['topic_open_time'] and ($this->topic['topic_open_time'] <= time() and time() <= $this->topic['topic_close_time'])) {
                         $this->topic['state'] = 'open';
                         $this->DB->update('topics', array('state' => 'open'), 'tid=' . $this->topic['tid'], true);
                     }
                 }
             }
         }
     }
     //-----------------------------------------
     // Current topic rating value
     //-----------------------------------------
     $this->topic['_rate_show'] = 0;
     $this->topic['_rate_int'] = 0;
     $this->topic['_rate_img'] = '';
     if ($this->topic['state'] != 'open') {
         $this->topic['_allow_rate'] = 0;
     } else {
         $this->topic['_allow_rate'] = $this->can_rate;
     }
     if ($this->forum['forum_allow_rating']) {
         $rating = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'topic_ratings', 'where' => "rating_tid={$this->topic['tid']} and rating_member_id=" . $this->memberData['member_id']));
         if ($rating['rating_value'] and $this->memberData['g_topic_rate_setting'] != 2) {
             $this->topic['_allow_rate'] = 0;
         }
         $this->topic['_rate_id'] = 0;
         $this->topic['_rating_value'] = $rating['rating_value'] ? $rating['rating_value'] : -1;
         if ($this->topic['topic_rating_total']) {
             $this->topic['_rate_int'] = round($this->topic['topic_rating_total'] / $this->topic['topic_rating_hits']);
         }
         //-----------------------------------------
         // Show image?
         //-----------------------------------------
         if ($this->topic['topic_rating_hits'] >= $this->settings['topic_rating_needed'] and $this->topic['_rate_int']) {
             $this->topic['_rate_id'] = $this->topic['_rate_int'];
             $this->topic['_rate_show'] = 1;
         }
     } else {
         $this->topic['_allow_rate'] = 0;
     }
     //-----------------------------------------
     // Update the item marker
     //-----------------------------------------
     if (!$this->request['view']) {
         $this->registry->getClass('classItemMarking')->markRead(array('forumID' => $this->forum['id'], 'itemID' => $this->topic['tid']));
     }
     //-----------------------------------------
     // If this forum is a link, then
     // redirect them to the new location
     //-----------------------------------------
     if ($this->topic['state'] == 'link') {
         $f_stuff = explode("&", $this->topic['moved_to']);
         $this->registry->output->redirectScreen($this->lang->words['topic_moved'], $this->settings['base_url'] . "showtopic={$f_stuff[0]}");
     }
     //-----------------------------------------
     // If this is a sub forum, we need to get
     // the cat details, and parent details
     //-----------------------------------------
     $this->nav = $this->registry->class_forums->forumsBreadcrumbNav($this->forum['id']);
     //-----------------------------------------
     // Are we a moderator?
     //-----------------------------------------
     if ($this->memberData['member_id'] and $this->memberData['g_is_supmod'] != 1) {
         $other_mgroups = array();
         if ($this->memberData['mgroup_others']) {
             $other_mgroups = explode(",", IPSText::cleanPermString($this->memberData['mgroup_others']));
         }
         $other_mgroups[] = $this->memberData['member_group_id'];
         $member_group_ids = implode(",", $other_mgroups);
         $this->moderator = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'moderators', 'where' => "forum_id LIKE '%,{$this->forum['id']},%' AND (member_id={$this->memberData['member_id']} OR (is_group=1 AND group_id IN({$member_group_ids})))"));
     }
     //-----------------------------------------
     // Hi! Light?
     //-----------------------------------------
     $hl = (isset($this->request['hl']) and $this->request['hl']) ? '&amp;hl=' . $this->request['hl'] : '';
     //-----------------------------------------
     // If we can see queued topics, add count
     //-----------------------------------------
     if ($this->registry->class_forums->canQueuePosts($this->forum['id'])) {
         if (isset($this->request['modfilter']) and $this->request['modfilter'] == 'invisible_posts') {
             $this->topic['posts'] = intval($this->topic['topic_queuedposts']);
         } else {
             $this->topic['posts'] += intval($this->topic['topic_queuedposts']);
         }
     }
     //-----------------------------------------
     // Generate the forum page span links
     //-----------------------------------------
     $this->topic['SHOW_PAGES'] = $this->registry->output->generatePagination(array('totalItems' => $this->topic['posts'] + 1, 'itemsPerPage' => $this->settings['display_max_posts'], 'currentStartValue' => $this->first, 'seoTitle' => $this->topic['title_seo'], 'seoTemplate' => 'showtopic', 'baseUrl' => "showtopic=" . $this->topic['tid'] . $hl));
     if ($this->topic['posts'] + 1 > $this->settings['display_max_posts']) {
         //	$this->topic['go_new'] = $this->registry->output->getTemplate('topic')->golastpost_link($this->forum['id'], $this->topic['tid'] );
     }
     //-----------------------------------------
     // Fix up some of the words
     //-----------------------------------------
     $this->topic['TOPIC_START_DATE'] = $this->registry->class_localization->getDate($this->topic['start_date'], 'LONG');
     $this->lang->words['topic_stats'] = str_replace("<#START#>", $this->topic['TOPIC_START_DATE'], $this->lang->words['topic_stats']);
     $this->lang->words['topic_stats'] = str_replace("<#POSTS#>", $this->topic['posts'], $this->lang->words['topic_stats']);
     //-----------------------------------------
     // Multi Quoting?
     //-----------------------------------------
     $this->qpids = IPSCookie::get('mqtids');
     //-----------------------------------------
     // Multi PIDS?
     //-----------------------------------------
     $this->request['selectedpids'] = !empty($this->request['selectedpids']) ? $this->request['selectedpids'] : IPSCookie::get('modpids');
     $this->request['selectedpidcount'] = 0;
     IPSCookie::set('modpids', '', 0);
     IPSDebug::setMemoryDebugFlag("TOPIC: topics.php::topicSetUp", $_before);
 }
 /**
  * Loads the language file, also loads the global lang file if not loaded
  * 
  * @access	public
  * @param	array 	[$load]		Array of lang files to load
  * @param	string	[$app]		Specify application to use
  * @param	string	[$lang]		Language pack to use
  * @return	void
  */
 public function loadLanguageFile($load = array(), $app = '', $lang = '')
 {
     $_MASTER2 = IPSDebug::getMemoryDebugFlag();
     /* App */
     $app = $app ? $app : IPS_APP_COMPONENT;
     $load = $load ? $load : array();
     $global = IPS_AREA == 'admin' ? 'core_admin_global' : 'core_public_global';
     $_global = str_replace('core_', '', $global);
     if ($lang and !IN_DEV) {
         $tempLangId = $this->lang_id;
         $this->lang_id = $lang;
     }
     /* Some older calls may still think $load is a string... */
     if (is_string($load)) {
         $load = array($load);
     }
     /* Has the global language file been loaded? */
     if (!in_array($global, $this->loaded_lang_files) and ($app == 'core' and !in_array($_global, $load))) {
         $load[] = $global;
     }
     /* Load the language file */
     $errors = '';
     if ($this->load_from_db or $this->_forceEnglish) {
         if (is_array($load) and count($load)) {
             /* Reformat for query and make sure we're not loading something twice */
             $_load = array();
             foreach ($load as $l) {
                 /* Already loaded? */
                 if (!in_array($app . $l, $this->loaded_lang_files)) {
                     /* Reformat */
                     $_load[] = "'{$l}'";
                 }
                 /* Add to the loaded array */
                 $this->loaded_lang_files[] = $app . '_' . $l;
             }
             /* Query the lang entries */
             $this->DB->build(array('select' => 'word_key, word_default, word_custom', 'from' => 'core_sys_lang_words', 'where' => "lang_id={$this->lang_id} AND word_app='{$app}' AND word_pack IN ( " . implode(',', $_load) . " )"));
             $this->DB->execute();
             /* Add to the language array */
             while ($r = $this->DB->fetch()) {
                 $this->words[$r['word_key']] = $this->_forceEnglish ? $r['word_default'] : ($r['word_custom'] ? $r['word_custom'] : $r['word_default']);
             }
         }
     } else {
         if (is_array($load) and count($load)) {
             foreach ($load as $l) {
                 /* Load global from the core app */
                 if ($l == $global) {
                     $_file = IPS_CACHE_PATH . 'cache/lang_cache/' . $this->lang_id . '/' . $l . '.php';
                     $_test = $l;
                 } else {
                     $_file = IPS_CACHE_PATH . 'cache/lang_cache/' . $this->lang_id . '/' . $app . '_' . $l . '.php';
                     $_test = $app . '_' . $l;
                 }
                 if (!in_array($_test, $this->loaded_lang_files)) {
                     if (file_exists($_file)) {
                         require $_file;
                         foreach ($lang as $k => $v) {
                             $this->words[$k] = $v;
                         }
                         $this->loaded_lang_files[] = $_test;
                         IPSDebug::setMemoryDebugFlag("Loaded Language File: " . str_replace(IPS_CACHE_PATH, '', $_file), $_MASTER2);
                     } else {
                         $errors .= "<li>Missing Language File: " . $_file;
                         IPSDebug::setMemoryDebugFlag("NO SUCH Language File: " . str_replace(IPS_CACHE_PATH, '', $_file), $_MASTER2);
                     }
                 } else {
                     IPSDebug::setMemoryDebugFlag("ALREADY LOADED Language File: " . str_replace(IPS_CACHE_PATH, '', $_file), $_MASTER2);
                 }
             }
         }
     }
     if (isset($tempLangId) and $tempLangId) {
         $this->lang_id = $tempLangId;
     }
     if ($errors && IN_ACP) {
         return "<ul>{$errors}</ul>";
     }
 }
コード例 #12
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;
 }
コード例 #13
0
 /**
  * Initializes cache, loads kernel class, and formats data for kernel class
  *
  * @param	string	$type	Set to view for displaying the field normally or edit for displaying in a form
  * @param	bool	$mlist	Whether this is the memberlist or not
  * @return	@e void
  */
 public function initData($type = 'view', $mlist = 0, $attributes = array())
 {
     /* Store Type */
     $this->type = $type;
     /* Get Member */
     if (!count($this->member_data) and $this->mem_data_id && !$mlist) {
         $this->member_data = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'pfields_content', 'where' => 'member_id=' . intval($this->mem_data_id)));
     }
     if (count($this->member_data)) {
         $this->mem_data_id = isset($this->member_data['member_id']) ? $this->member_data['member_id'] : 0;
     }
     if (!$this->init) {
         /* Cache data... */
         if (!is_array($this->cache_data)) {
             $this->DB->build(array('select' => '*', 'from' => 'pfields_data', 'order' => 'pf_group_id,pf_position'));
             $this->DB->execute();
             while ($r = $this->DB->fetch()) {
                 $this->cache_data[$r['pf_id']] = $r;
             }
         }
     }
     /* Get names... */
     if (is_array($this->cache_data) and count($this->cache_data)) {
         foreach ($this->cache_data as $id => $data) {
             /* Field names and descriptions */
             $this->field_names[$id] = $data['pf_title'];
             $this->field_desc[$id] = $data['pf_desc'];
             /* In Fields */
             foreach ($this->cache_data as $id => $data) {
                 $data['pf_key'] = !empty($data['pf_key']) ? $data['pf_key'] : '_key_' . $data['pf_id'];
                 $data['pf_group_key'] = $data['pf_group_key'] ? $data['pf_group_key'] : '_other';
                 if ($mlist) {
                     $this->in_fields[$id] = '';
                     if (!empty(ipsRegistry::$request['field_' . $id])) {
                         if (is_string(ipsRegistry::$request['field_' . $id])) {
                             $this->in_fields[$id] = urldecode(ipsRegistry::$request['field_' . $id]);
                         } else {
                             if (is_array(ipsRegistry::$request['field_' . $id])) {
                                 foreach (ipsRegistry::$request['field_' . $id] as $k => $v) {
                                     $this->in_fields[$id][$k] = urldecode($v);
                                 }
                             }
                         }
                     }
                 } else {
                     $_val = '';
                     if (is_string(ipsRegistry::$request['field_' . $id])) {
                         $_val = urldecode(ipsRegistry::$request['field_' . $id]);
                     } else {
                         if (is_array(ipsRegistry::$request['field_' . $id])) {
                             foreach (ipsRegistry::$request['field_' . $id] as $k => $v) {
                                 $_val[$k] = urldecode($v);
                             }
                         }
                     }
                     $this->in_fields[$id] = isset($this->member_data['field_' . $id]) ? $this->member_data['field_' . $id] : $_val;
                 }
             }
         }
     }
     /* Clean up on aisle #4 */
     $this->out_fields = array();
     $this->out_chosen = array();
     /* Format data for kernel class */
     foreach ($this->cache_data as $k => $v) {
         /* Add any option to dropdown */
         if ($v['pf_type'] == 'drop' && $mlist) {
             $v['pf_content'] = '0=|' . $v['pf_content'];
         }
         /* Field Info */
         $this->cache_data[$k]['id'] = $v['pf_id'];
         $this->cache_data[$k]['type'] = $v['pf_type'];
         $this->cache_data[$k]['data'] = $v['pf_content'];
         $this->cache_data[$k]['value'] = $this->in_fields[$k];
         /* Field Restrictions */
         $this->cache_data[$k]['restrictions'] = array('max_size' => isset($v['pf_max_input']) ? $v['pf_max_input'] : '', 'min_size' => isset($v['pf_min_input']) ? $v['pf_min_input'] : '', 'not_null' => isset($v['pf_not_null']) ? $v['pf_not_null'] : '', 'format' => isset($v['pf_input_format']) ? $v['pf_input_format'] : '', 'urlfilter' => isset($v['pf_filtering']) ? $v['pf_filtering'] : '');
         if (!empty($attributes)) {
             if (!isset($this->cache_data[$k]['attributes'])) {
                 $this->cache_data[$k]['attributes'] = $attributes;
             } else {
                 $this->cache_data[$k]['attributes'] = array_merge($this->cache_data[$k]['attributes'], $attributes);
             }
         }
     }
     /* Kernel profile field class */
     $_NOW = IPSDebug::getMemoryDebugFlag();
     $classToLoad = IPSLib::loadLibrary(IPS_KERNEL_PATH . 'classCustomFields.php', 'classCustomFields');
     IPSDebug::setMemoryDebugFlag("Get CustomFields Kernel Class", $_NOW);
     $this->cfields_obj = new $classToLoad($this->cache_data, $type, $attributes);
     $this->cfields = $this->cfields_obj->cfields;
     $this->init = 1;
 }
コード例 #14
0
 /**
  * Builds an array of post data for output
  *
  * @param	array	$row	Array of post data
  * @return	array
  */
 public function parsePost(array $post)
 {
     /* Init */
     $topicData = $this->getTopicData();
     $forumData = $this->registry->getClass('class_forums')->getForumById($topicData['forum_id']);
     $permissionData = $this->getPermissionData();
     /* Start memory debug */
     $_NOW = IPSDebug::getMemoryDebugFlag();
     $poster = array();
     /* Bitwise options */
     $_tmp = IPSBWOptions::thaw($post['post_bwoptions'], 'posts', 'forums');
     if (count($_tmp)) {
         foreach ($_tmp as $k => $v) {
             $post[$k] = $v;
         }
     }
     /* Is this a member? */
     if ($post['author_id'] != 0) {
         $poster = $this->parseMember($post);
     } else {
         /* Sort out guest */
         $post['author_name'] = $this->settings['guest_name_pre'] . $post['author_name'] . $this->settings['guest_name_suf'];
         $poster = IPSMember::setUpGuest($post['author_name']);
         $poster['members_display_name'] = $post['author_name'];
         $poster['_members_display_name'] = $post['author_name'];
         $poster['custom_fields'] = "";
         $poster['warn_img'] = "";
         $poster = IPSMember::buildProfilePhoto($poster);
     }
     /* Memory debug */
     IPSDebug::setMemoryDebugFlag("PID: " . $post['pid'] . " - Member Parsed", $_NOW);
     /* Update permission */
     $this->registry->getClass('class_forums')->setMemberData($this->getMemberData());
     $permissionData['softDelete'] = $this->registry->getClass('class_forums')->canSoftDeletePosts($topicData['forum_id'], $post);
     /* Soft delete */
     $post['_softDelete'] = $post['pid'] != $topicData['topic_firstpost'] ? $permissionData['softDelete'] : FALSE;
     $post['_softDeleteRestore'] = $permissionData['softDeleteRestore'];
     $post['_softDeleteSee'] = $permissionData['softDeleteSee'];
     $post['_softDeleteReason'] = $permissionData['softDeleteReason'];
     $post['_softDeleteContent'] = $permissionData['softDeleteContent'];
     $post['_isVisible'] = $this->registry->getClass('class_forums')->fetchHiddenType($post) == 'visible' ? true : false;
     $post['_isHidden'] = $this->registry->getClass('class_forums')->fetchHiddenType($post) == 'hidden' ? true : false;
     $post['_isDeleted'] = $this->registry->getClass('class_forums')->fetchHiddenType($post) == 'sdelete' ? true : false;
     /* Answered post */
     try {
         $post['_isMarkedAnswered'] = $this->postIsAnswer($post, $topicData) ? true : false;
     } catch (Exception $e) {
         $post['_isMarkedAnswered'] = false;
     }
     $post['_canMarkUnanswered'] = $post['_isMarkedAnswered'] === true && $this->canUnanswerTopic($topicData) ? true : false;
     $post['_canAnswer'] = $post['_isMarkedAnswered'] === false && $this->canAnswerTopic($topicData) ? true : false;
     $post['PermalinkUrlBit'] = '';
     /* Queued */
     if ($topicData['topic_firstpost'] == $post['pid'] and ($post['_isHidden'] or $topicData['_isHidden'])) {
         $post['queued'] = 1;
         $post['_isHidden'] = true;
     }
     if ($topicData['topic_queuedposts'] || $topicData['topic_deleted_posts']) {
         if ($topicData['topic_queuedposts'] && $topicData['Perms']['canQueuePosts']) {
             /* We have hidden data that is viewable */
             $post['PermalinkUrlBit'] = '&amp;p=' . $post['pid'];
         }
         if ($topicData['topic_deleted_posts'] && $post['_softDeleteSee']) {
             /* We have hidden data that is viewable */
             $post['PermalinkUrlBit'] = '&amp;p=' . $post['pid'];
         }
     }
     /* Edited stuff */
     $post['edit_by'] = "";
     if ($post['append_edit'] == 1 and $post['edit_time'] != "" and $post['edit_name'] != "") {
         $e_time = $this->registry->class_localization->getDate($post['edit_time'], 'LONG');
         $post['edit_by'] = sprintf($this->lang->words['edited_by'], $post['edit_name'], $e_time);
     }
     /* Now parse the post */
     if (!isset($post['cache_content']) or !$post['cache_content']) {
         $_NOW2 = IPSDebug::getMemoryDebugFlag();
         /* Grab the parser file */
         if ($this->_parser === null) {
             /* Load parser */
             $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/text/parser.php', 'classes_text_parser');
             $this->_parser = new $classToLoad();
         }
         /* set up parser */
         $this->_parser->set(array('memberData' => array('member_id' => $post['member_id'], 'member_group_id' => $post['member_group_id'], 'mgroup_others' => $post['mgroup_others']), 'parseBBCode' => $forumData['use_ibc'], 'parseHtml' => ($forumData['use_html'] and $poster['g_dohtml'] and $post['post_htmlstate']) ? 1 : 0, 'parseEmoticons' => $post['use_emo'], 'parseArea' => 'topics'));
         $post['post'] = $this->_parser->display($post['post']);
         IPSDebug::setMemoryDebugFlag("topics::parsePostRow - bbcode parse - Completed", $_NOW2);
         IPSContentCache::update($post['pid'], 'post', $post['post']);
     } else {
         $post['post'] = '<!--cached-' . gmdate('r', $post['cache_updated']) . '-->' . $post['cache_content'];
     }
     /* Buttons */
     $post['_can_delete'] = $post['pid'] != $topicData['topic_firstpost'] ? $this->canDeletePost($post) : FALSE;
     $post['_can_edit'] = $this->canEditPost($post);
     $post['_show_ip'] = $this->canSeeIp();
     $post['_canReply'] = $this->getReplyStatus() == 'reply' ? true : false;
     /* Signatures */
     $post['signature'] = "";
     if (!empty($poster['signature'])) {
         if ($post['use_sig'] == 1) {
             if (!$this->memberData['view_sigs'] || $poster['author_id'] && $this->memberData['member_id'] && !empty($this->member->ignored_users[$poster['author_id']]['ignore_signatures']) && IPSMember::isIgnorable($poster['member_group_id'], $poster['mgroup_others'])) {
                 $post['signature'] = '<!--signature.hidden.' . $post['pid'] . '-->';
             } else {
                 $post['signature'] = $this->registry->output->getTemplate('global')->signature_separator($poster['signature'], $poster['author_id'], IPSMember::isIgnorable($poster['member_group_id'], $poster['mgroup_others']));
             }
         }
     }
     $post['forum_id'] = $topicData['forum_id'];
     /* Reputation */
     if ($this->settings['reputation_enabled'] and !$this->isArchived($topicData)) {
         /* Load the class */
         if (!$this->registry->isClassLoaded('repCache')) {
             $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/class_reputation_cache.php', 'classReputationCache');
             $this->registry->setClass('repCache', new $classToLoad());
         }
         $this->memberData['_members_cache']['rep_filter'] = isset($this->memberData['_members_cache']['rep_filter']) ? $this->memberData['_members_cache']['rep_filter'] : '*';
         $post['pp_reputation_points'] = $post['pp_reputation_points'] ? $post['pp_reputation_points'] : 0;
         $post['has_given_rep'] = $post['has_given_rep'] ? $post['has_given_rep'] : 0;
         $post['rep_points'] = $this->registry->repCache->getRepPoints(array('app' => 'forums', 'type' => 'pid', 'type_id' => $post['pid'], 'rep_points' => $post['rep_points']));
         $post['_repignored'] = 0;
         if (!($this->settings['reputation_protected_groups'] && in_array($this->memberData['member_group_id'], explode(',', $this->settings['reputation_protected_groups']))) && $this->memberData['_members_cache']['rep_filter'] !== '*') {
             if ($this->settings['reputation_show_content'] && $post['rep_points'] < $this->memberData['_members_cache']['rep_filter'] && $this->settings['reputation_point_types'] != 'like') {
                 $post['_repignored'] = 1;
             }
         }
         if ($this->registry->repCache->isLikeMode()) {
             $post['like'] = $this->registry->repCache->getLikeFormatted(array('app' => 'forums', 'type' => 'pid', 'id' => $post['pid'], 'rep_like_cache' => $post['rep_like_cache']));
         }
     }
     /* Ignore stuff */
     $post['_ignored'] = 0;
     if ($post['author_id'] && isset($topicData['ignoredUsers']) && is_array($topicData['ignoredUsers']) && count($topicData['ignoredUsers'])) {
         if (in_array($post['author_id'], $topicData['ignoredUsers'])) {
             if (!strstr($this->settings['cannot_ignore_groups'], ',' . $post['member_group_id'] . ',')) {
                 $post['_ignored'] = 1;
             }
         }
     }
     /* AD Code */
     $post['_adCode'] = '';
     if ($this->registry->getClass('IPSAdCode')->userCanViewAds() && !$this->getTopicData('adCodeSet') && !IPS_IS_AJAX) {
         $post['_adCode'] = $this->registry->getClass('IPSAdCode')->getAdCode('ad_code_topic_view_code');
         if ($post['_adCode']) {
             $this->setTopicData('adCodeSet', true);
         }
     }
     /* Memory debug */
     IPSDebug::setMemoryDebugFlag("PID: " . $post['pid'] . " - Completed", $_NOW);
     /* Excerpt */
     $post['_excerpt'] = IPSText::truncate(str_replace(array('<br />', '<br>', "\n", '</p>', '<p>'), ' ', $post['post']), 500);
     return array('post' => $post, 'author' => $poster);
 }
コード例 #15
0
 /**
  * Load a template file
  *
  * @access	public
  * @param	string		Template name
  * @param	string		Application [defaults to current application]
  * @return	object
  */
 public function loadTemplate($template, $app = '')
 {
     $app = $app ? $app : IPS_APP_COMPONENT;
     /* Skin file exists? */
     if (file_exists(IPSLib::getAppDir($app) . "/skin_cp/" . $template . ".php")) {
         $_pre_load = IPSDebug::getMemoryDebugFlag();
         require_once IPSLib::getAppDir($app) . "/skin_cp/" . $template . ".php";
         IPSDebug::setMemoryDebugFlag("CORE: Template Loaded ({$template})", $_pre_load);
         return new $template($this->registry);
     } else {
         $this->showError("Could not locate template: {$template}", 4100, true);
     }
 }
コード例 #16
0
ファイル: adminOutput.php プロジェクト: mover5/imobackup
 /**
  * Load a template file
  *
  * @param	string		Template name
  * @param	string		Application [defaults to current application]
  * @return	object
  */
 public function loadTemplate($template, $app = '')
 {
     $app = $app ? $app : IPS_APP_COMPONENT;
     /* Skin file exists? */
     if (is_file(IPSLib::getAppDir($app) . "/skin_cp/" . $template . ".php")) {
         $_pre_load = IPSDebug::getMemoryDebugFlag();
         $classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir($app) . '/skin_cp/' . $template . '.php', $template, $app);
         IPSDebug::setMemoryDebugFlag("CORE: Template Loaded ({$classToLoad})", $_pre_load);
         $class = new $classToLoad($this->registry);
         $this->compiled_templates[$app . '.' . $template] = $class;
         return $class;
     } else {
         $this->showError(sprintf($this->lang->words['notemplatefiletoload'], $template), 4100, true);
     }
 }
コード例 #17
0
 /**
  * Method constructor
  *
  * @access	public
  * @param	object		Registry Object
  * @return	@e void
  */
 public function __construct(ipsRegistry $registry)
 {
     $_NOW = IPSDebug::getMemoryDebugFlag();
     /* Make object */
     $this->registry = $registry;
     $this->DB = $this->registry->DB();
     $this->settings =& $this->registry->fetchSettings();
     $this->request =& $this->registry->fetchRequest();
     $this->member = $this->registry->member();
     $this->memberData =& $this->registry->member()->fetchMemberData();
     $this->cache = $this->registry->cache();
     $this->caches =& $this->registry->cache()->fetchCaches();
     /* Task? */
     if (IPS_IS_TASK === TRUE) {
         return;
     }
     /* Search engine? */
     if ($this->member->is_not_human === TRUE) {
         return;
     }
     /* Track markers for guests? */
     $this->_noGuestMarking = $this->settings['topic_marking_guests'] ? 0 : 1;
     /* Use cookie marking for guests */
     if (!$this->memberData['member_id']) {
         $this->settings['topic_marking_enable'] = 0;
         if ($this->_noGuestMarking) {
             return;
         }
     }
     /* Switch off cookies for members */
     if ($this->memberData['member_id']) {
         /* If we've disabled DB marking, best use cookies anyway */
         $this->_useCookies = $this->settings['topic_marking_enable'] ? false : true;
     }
     /* Build */
     $this->memberData['item_markers'] = $this->_generateIncomingItemMarkers();
     /* Set Up */
     if (is_array($this->memberData['item_markers'])) {
         foreach ($this->memberData['item_markers'] as $app => $key) {
             foreach ($this->memberData['item_markers'][$app] as $key => $data) {
                 if ($app and $key) {
                     if ($data['item_last_saved']) {
                         $data['item_last_saved'] = intval($data['item_last_saved']);
                     }
                     $this->_itemMarkers[$app][$key] = $data;
                 }
             }
         }
     }
     /* Fetch cookies */
     if ($this->_useCookies) {
         /* Test for cookie compression */
         if (function_exists('gzdeflate') and function_exists('gzinflate')) {
             $this->_canCompressCookies = true;
         }
         foreach (IPSLib::getEnabledApplications() as $_app => $data) {
             $_value = $this->_inflateCookie(IPSCookie::get('itemMarking_' . $_app));
             $_value2 = $this->_inflateCookie(IPSCookie::get('itemMarking_' . $_app . '_items'));
             $this->_cookie['itemMarking_' . $_app] = is_array($_value) ? $_value : array();
             $this->_cookie['itemMarking_' . $_app . '_items'] = is_array($_value2) ? $_value2 : array();
             /* Clean up  */
             if ($this->_cookie['itemMarking_' . $_app . '_items']) {
                 $_items = is_array($this->_cookie['itemMarking_' . $_app . '_items']) ? $this->_cookie['itemMarking_' . $_app . '_items'] : json_decode($this->_cookie['itemMarking_' . $_app . '_items'], true);
                 $this->_cookieCounter = 0;
                 arsort($_items, SORT_NUMERIC);
                 $_newData = array_filter($_items, array($this, 'arrayFilterCookieItems'));
                 $this->_cookie['itemMarking_' . $_app . '_items'] = $_newData;
                 IPSDebug::addMessage('Cookie loaded: itemMarking_' . $_app . '_items' . ' - ' . serialize($_newData));
                 IPSDebug::addMessage('Cookie loaded: itemMarking_' . $_app . ' - ' . serialize($_value));
             }
         }
     }
     IPSDebug::setMemoryDebugFlag("Topic markers initialized", $_NOW);
 }
コード例 #18
0
 /**
  * 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;
 }
コード例 #19
0
 /**
  * Main output function
  *
  * @access	public
  * @return	void 
  */
 public function sendOutput()
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $_NOW = IPSDebug::getMemoryDebugFlag();
     $this->_sendOutputSetUp('normal');
     //-----------------------------------------
     // Gather output
     //-----------------------------------------
     $output = $this->outputFormatClass->fetchOutput($this->_html, $this->_title, $this->_navigation, $this->_documentHeadItems, $this->_jsLoader);
     $output = $this->templateHooks($output);
     //-----------------------------------------
     // Check for SQL Debug
     //-----------------------------------------
     $this->_checkSQLDebug();
     //-----------------------------------------
     // Print it...
     //-----------------------------------------
     $this->outputFormatClass->printHeader();
     /* Remove unused hook comments */
     $output = preg_replace("#<!--hook\\.([^\\>]+?)-->#", '', $output);
     /* Insert stats */
     $output = str_replace('<!--DEBUG_STATS-->', $this->outputFormatClass->html_showDebugInfo(), $output);
     print $output;
     IPSDebug::setMemoryDebugFlag("Output sent", $_NOW);
     $this->outputFormatClass->finishUp();
     exit;
 }
 /**
  * Method constructor
  *
  * @access	public
  * @param	object		Registry Object
  * @return	void
  */
 public function __construct(ipsRegistry $registry)
 {
     $_NOW = IPSDebug::getMemoryDebugFlag();
     /* Make object */
     $this->registry = $registry;
     $this->DB = $this->registry->DB();
     $this->settings =& $this->registry->fetchSettings();
     $this->request =& $this->registry->fetchRequest();
     $this->member = $this->registry->member();
     $this->memberData =& $this->registry->member()->fetchMemberData();
     $this->cache = $this->registry->cache();
     $this->caches =& $this->registry->cache()->fetchCaches();
     /* Task? */
     if (IPS_IS_TASK === TRUE) {
         return;
     }
     /* Search engine? */
     if ($this->member->is_not_human === TRUE) {
         return;
     }
     /* Use cookie marking for guests */
     if (!$this->memberData['member_id']) {
         $this->settings['topic_marking_enable'] = 0;
     }
     /* Build */
     $this->memberData['item_markers'] = $this->_generateIncomingItemMarkers();
     /* Generate last saved time */
     $this->_lastSaved = time();
     /* Set Up */
     if (is_array($this->memberData['item_markers'])) {
         foreach ($this->memberData['item_markers'] as $app => $key) {
             foreach ($this->memberData['item_markers'][$app] as $key => $data) {
                 if ($app and $key) {
                     if ($data['item_last_saved']) {
                         $data['item_last_saved'] = intval($data['item_last_saved']);
                         if ($data['item_last_saved'] < $this->_lastSaved) {
                             $this->_lastSaved = $data['item_last_saved'];
                         }
                     }
                     $this->_itemMarkers[$app][$key] = $data;
                 }
             }
         }
     }
     /* Fetch cookies */
     $apps = new IPSApplicationsIterator();
     foreach ($apps as $app) {
         if ($apps->isActive()) {
             $_app = $apps->fetchAppDir();
             $_value = IPSCookie::get('itemMarking_' . $_app);
             $_value2 = IPSCookie::get('itemMarking_' . $_app . '_items');
             $this->_cookie['itemMarking_' . $_app] = is_array($_value) ? $_value : array();
             $this->_cookie['itemMarking_' . $_app . '_items'] = is_array($_value2) ? $_value2 : array();
             /* Clean up  */
             if (is_array($this->_cookie['itemMarking_' . $_app . '_items'])) {
                 $_items = is_array($this->_cookie['itemMarking_' . $_app . '_items']) ? $this->_cookie['itemMarking_' . $_app . '_items'] : unserialize($this->_cookie['itemMarking_' . $_app . '_items']);
                 $this->_cookieCounter = 0;
                 arsort($_items, SORT_NUMERIC);
                 $_newData = array_filter($_items, array($this, 'arrayFilterCookieItems'));
                 $this->_cookie['itemMarking_' . $_app . '_items'] = $_newData;
                 IPSDebug::addMessage('Cookie loaded: itemMarking_' . $_app . '_items' . ' - ' . serialize($_newData));
                 IPSDebug::addMessage('Cookie loaded: itemMarking_' . $_app . ' - ' . serialize($_value));
             }
         }
     }
     IPSDebug::setMemoryDebugFlag("Topic markers initialized", $_NOW);
 }