/**
  * Attempt to fetch a skin based on default settings
  *
  * @access	private
  * @return	mixed		INT skin ID or FALSE if none found
  */
 private function _fetchSkinByDefault()
 {
     $useSkinID = FALSE;
     /* Got one set by default for this gateway? */
     foreach ($this->allSkins as $data) {
         /* Can use with this output format? */
         if ($data['_gatewayExclude'] !== FALSE) {
             continue;
         }
         if ($data['set_is_default']) {
             $useSkinID = $data['set_id'];
             break;
         }
     }
     /* Did we get anything? */
     if ($useSkinID === FALSE) {
         foreach ($this->allSkins as $data) {
             /* Can use with this output format? */
             if ($data['_gatewayExclude'] !== FALSE) {
                 continue;
             }
             /* Grab the first one */
             $useSkinID = $data['set_id'];
             break;
         }
     }
     IPSDebug::addMessage("Skin set not found, setting default. Using set #" . $useSkinID);
     return $useSkinID;
 }
예제 #2
0
 /**
  * Attempt to fetch a skin based on default settings
  *
  * @access	private
  * @return	mixed		INT skin ID or FALSE if none found
  */
 protected function _fetchSkinByDefault()
 {
     $useSkinID = FALSE;
     /* Are we forcing a guest skin? */
     if (!$this->memberData['member_id'] and $this->settings['ipseo_guest_skin'] and isset($this->allSkins[$this->settings['ipseo_guest_skin']]) and $this->allSkins[$this->settings['ipseo_guest_skin']]['_gatewayExclude'] === FALSE) {
         $useSkinID = $this->settings['ipseo_guest_skin'];
     } else {
         foreach ($this->allSkins as $data) {
             /* Can use with this output format? */
             if ($data['_gatewayExclude'] !== FALSE) {
                 continue;
             }
             /* Is default for our current gateway? */
             if ($data['set_is_default'] && $this->caches['outputformats'][$data['set_output_format']]['gateway_file'] == IPS_PUBLIC_SCRIPT) {
                 $useSkinID = $data['set_id'];
                 break;
             }
         }
     }
     /* Did we get anything? */
     if ($useSkinID === FALSE) {
         foreach ($this->allSkins as $data) {
             /* Can use with this output format? */
             if ($data['_gatewayExclude'] !== FALSE) {
                 continue;
             }
             /* Grab the first HTML one */
             if ($data['set_output_format'] == 'html') {
                 $useSkinID = $data['set_id'];
                 break;
             }
         }
     }
     IPSDebug::addMessage("Skin set not found, setting default. Using set #" . $useSkinID);
     return $useSkinID;
 }
 /**
  * Find a particular row
  *
  * @access	protected
  * @param	array 		Array of data
  * @param	string		App
  * @return	array 		Array of data: core_item_marking row, effectively
  */
 protected function _findMainRowByKey($data, $app)
 {
     /* Not interested in this for the main row */
     unset($data['itemID'], $data['itemLastUpdate']);
     $_key = $this->_makeKey($data);
     if (!isset($this->_itemMarkers[$app]) or !is_array($this->_itemMarkers[$app])) {
         /* Mark markers as having changed */
         $this->_changesMade = TRUE;
         /* Add in extra items */
         $data['item_app'] = $app;
         $data['item_key'] = $_key;
         $data['item_member_id'] = $this->memberData['member_id'];
         $data['item_read_array'] = array();
         $this->_itemMarkers[$app] = array();
         $this->_itemMarkers[$app][$_key] = $data;
         IPSDebug::addMessage("Item Marking Key Created! {$_key}");
         return $_key;
     }
     if (!empty($this->_itemMarkers[$app][$_key]) and is_array($this->_itemMarkers[$app][$_key])) {
         /* Make sure it contains the app & key */
         $this->_itemMarkers[$app][$_key]['item_app'] = $app;
         $this->_itemMarkers[$app][$_key]['item_key'] = $_key;
         $this->_itemMarkers[$app][$_key]['item_member_id'] = $this->memberData['member_id'];
         /* Make sure read IDs are unserialized */
         if (isset($this->_itemMarkers[$app][$_key]['item_read_array']) and !is_array($this->_itemMarkers[$app][$_key]['item_read_array'])) {
             $this->_itemMarkers[$app][$_key]['item_read_array'] = unserialize($this->_itemMarkers[$app][$_key]['item_read_array']);
         }
         return $_key;
     } else {
         /* Mark markers as having changed */
         $this->_changesMade = TRUE;
         /* Make sure it contains the app & key */
         $this->_itemMarkers[$app][$_key]['item_app'] = $app;
         $this->_itemMarkers[$app][$_key]['item_key'] = $_key;
         $this->_itemMarkers[$app][$_key]['item_member_id'] = $this->memberData['member_id'];
         $this->_itemMarkers[$app][$_key]['item_read_array'] = array();
         $this->_itemMarkers[$app][$_key] = $data;
         IPSDebug::addMessage("Item Marking Key returned! {$_key}");
         return $_key;
     }
     /* Mark markers as having changed */
     /**
      * @todo	Matt: this code is not used anymore? We already return in the if/else above..
      */
     $this->_changesMade = TRUE;
     // Create a new key ...
     $data['item_app'] = $app;
     $data['item_key'] = $_key;
     $data['item_member_id'] = $this->memberData['member_id'];
     $data['item_read_array'] = array();
     $this->_itemMarkers[$app] = array();
     $this->_itemMarkers[$app][$_key] = $data;
     return $_key;
 }
 /**
  * Make an SEO title for use in the URL
  *
  * @access	public
  * @param	string		Raw SEO title or text
  * @return	string		Cleaned up SEO title
  */
 public static function makeSeoTitle($text)
 {
     if (!$text) {
         return '';
     }
     /**
      * SEO titles off?
      */
     if (!ipsRegistry::$settings['use_friendly_urls']) {
         /* We must still build them as things go bad when you toggle FURLs off for a few days */
         //return $text;
     }
     $_test = strtolower(str_replace(array('`', ' ', '+', '.', '?', '_'), '-', $text));
     /* Doesn't need converting? */
     if (preg_match("#^[a-z0-9\\-]+\$#", $_test)) {
         $_test = preg_replace("#-{2,}#", '-', $_test);
         $_test = trim($_test, '-');
         return $_test;
     }
     /* Strip all HTML tags first */
     $text = strip_tags($text);
     /* Preserve %data */
     $text = preg_replace('#%([a-fA-F0-9][a-fA-F0-9])#', '-xx-$1-xx-', $text);
     $text = str_replace(array('%', '`'), '', $text);
     $text = preg_replace('#-xx-([a-fA-F0-9][a-fA-F0-9])-xx-#', '%$1', $text);
     /* Convert accented chars */
     $text = self::convertAccents($text);
     /* Convert it */
     if (self::isUTF8($text)) {
         if (function_exists('mb_strtolower')) {
             $text = mb_strtolower($text, 'UTF-8');
         }
         $text = self::utf8Encode($text, 250);
     }
     /* Finish off */
     $text = strtolower($text);
     if (strtolower(IPS_DOC_CHAR_SET) == 'utf-8') {
         $text = preg_replace('#&.+?;#', '', $text);
         $text = preg_replace('#[^%a-z0-9 _-]#', '', $text);
     } else {
         /* Remove &#xx; and &#xxx; but keep &#xxxx; */
         $text = preg_replace('/&#(\\d){2,3};/', '', $text);
         $text = preg_replace('#[^%&\\#;a-z0-9 _-]#', '', $text);
         $text = str_replace(array('"', '&'), '', $text);
     }
     $text = str_replace(array('`', ' ', '+', '.', '?', '_'), '-', $text);
     $text = preg_replace("#-{2,}#", '-', $text);
     $text = trim($text, '-');
     IPSDebug::addMessage("<span style='color:red'>makeSeoTitle ({$text}) called</span>");
     return $text ? $text : '-';
 }
예제 #5
0
 /**
  * Fetch query file, if available
  *
  * @param	string		'public' or 'admin'
  * @param	string		App dir
  * @param	string		Key
  * @return	boolean
  */
 public static function loadQueryFile($where, $app, $key = '')
 {
     $key = $key ? $key : self::$defaultKey;
     $where = $where == 'admin' ? 'admin' : 'public';
     $driver = self::getDriverType($key);
     /* Already tried to load? */
     if (isset(self::$_queryFilesTriedToLoad[$app . '-' . $driver])) {
         return;
     } else {
         self::$_queryFilesTriedToLoad[$app . '-' . $driver] = 1;
     }
     $file = self::fetchQueryFileName($where, $app, $key);
     $class = self::fetchQueryFileClassName($where, $app, $key);
     IPSDebug::addMessage("* Checking for query cache file: " . $file);
     if (is_file($file)) {
         self::getDB($key)->loadCacheFile($file, $class, TRUE);
         return TRUE;
     } else {
         return FALSE;
     }
 }
 /**
  * Grab the user agent from the DB if required
  *
  * @access	protected
  * @param	string		Type of session (update/create)
  * @return	array 		Array of user agent info from the DB
  */
 protected function _processUserAgent($type = 'update')
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $uAgent = array('uagent_key' => '__NONE__', 'uagent_version' => 0, 'uagent_name' => '', 'uagent_type' => '', 'uagent_bypass' => 0);
     //-----------------------------------------
     // Do we need to update?
     //-----------------------------------------
     if (empty($this->session_data['uagent_key']) or $this->session_data['uagent_key'] == '__NONE__' or $this->_userAgent != $this->session_data['browser']) {
         IPSDebug::addMessage("Retreiving user agent information from the DB");
         //-----------------------------------------
         // Get useragent stuff
         //-----------------------------------------
         if (!$this->registry->isClassLoaded('userAgentFunctions')) {
             require_once IPS_ROOT_PATH . 'sources/classes/useragents/userAgentFunctions.php';
             $this->registry->setClass('userAgentFunctions', new userAgentFunctions($this->registry));
         }
         $uAgent = $this->registry->getClass('userAgentFunctions')->findUserAgentID($this->_member->user_agent);
         if ($uAgent['uagent_key'] === NULL) {
             $uAgent = array('uagent_key' => '__NONE__', 'uagent_version' => 0, 'uagent_name' => '', 'uagent_type' => '', 'uagent_bypass' => 0);
         } else {
             $uAgent['uagent_bypass'] = 0;
         }
     } else {
         $uAgent['uagent_key'] = $this->session_data['uagent_key'];
         $uAgent['uagent_version'] = $this->session_data['uagent_version'];
         $uAgent['uagent_type'] = $this->session_data['uagent_type'];
         $uAgent['uagent_bypass'] = $this->session_data['uagent_bypass'];
         /* For search engines only */
         $uAgent['uagent_name'] = $this->session_data['member_name'];
     }
     return $uAgent;
 }
 /**
  * Constructor
  * 
  * @access	public
  * @param	string	[$lang]		Language file to load, english by default
  * @return	void
  */
 public function __construct(ipsRegistry $registry)
 {
     /* Make objects */
     $this->DB = $registry->DB();
     $this->settings = $registry->fetchSettings();
     $this->member = $registry->member();
     $this->cache = $registry->cache();
     $this->caches =& $registry->cache()->fetchCaches();
     $this->request = $registry->fetchRequest();
     $this->memberData =& $registry->member()->fetchMemberData();
     /* Rebuild the cache if needed */
     if (!$this->caches['lang_data']) {
         $this->rebuildLanguagesCache();
     }
     /* Find the lang we need */
     if ($this->caches['lang_data']) {
         foreach ($this->caches['lang_data'] as $_lang) {
             $this->languages[] = $_lang;
             if ($_lang['lang_default']) {
                 $this->local = $_lang['lang_short'];
                 $this->lang_id = $_lang['lang_id'];
                 $this->language_dir = $_lang['lang_id'];
                 /* Guests get the default */
                 if (!$this->memberData['member_id']) {
                     $this->member->language_id = $this->lang_id;
                 }
             }
         }
     }
     /* Got a guest cookie? */
     if (!$this->memberData['member_id']) {
         $langCookie = IPSCookie::get('language');
         if ($langCookie) {
             $this->member->language_id = trim(IPSText::parseCleanValue($langCookie));
         }
     }
     /* Forcing Engrish? */
     if ($forceCookie = IPSCookie::get('forceEnglish')) {
         if ($forceCookie) {
             $this->_forceEnglish = true;
         }
     }
     //-----------------------------------------
     // Time options
     //-----------------------------------------
     /* 	%b is month abbr
     			%B is full month
     			%d is date 01-31
     			%Y is 4 digit year
     			%g is 2 digit year
     			%I is hour 01-12
     			%H - hour as a decimal number using a 24-hour clock (range 00 to 23) 
     			%M is min 01-59
     			%p is am/pm */
     $this->time_options = array('JOINED' => $this->settings['clock_joined'] ? $this->settings['clock_joined'] : '%d-%B %y', 'SHORT' => $this->settings['clock_short'] ? $this->settings['clock_short'] : '%b %d %Y %I:%M %p', 'LONG' => $this->settings['clock_long'] ? $this->settings['clock_long'] : '%d %B %Y - %I:%M %p', 'TINY' => $this->settings['clock_tiny'] ? $this->settings['clock_tiny'] : '%d %b %Y - %H:%M', 'DATE' => $this->settings['clock_date'] ? $this->settings['clock_date'] : '%d %b %Y', 'TIME' => 'h:i A', 'ACP' => '%d %B %Y, %H:%M', 'ACP2' => '%d %B %Y, %H:%M');
     //--------------------------------
     // Did we choose a language?
     //--------------------------------
     if (isset($this->request['setlanguage']) and $this->request['setlanguage'] and $this->request['langid']) {
         /* Forcing english? */
         if ($this->request['langid'] == '__english__') {
             IPSDebug::addMessage("forceEnglish cookie written");
             IPSCookie::set('forceEnglish', 1, 0);
             $this->_forceEnglish = true;
         } else {
             if ($this->request['k'] == $this->member->form_hash and is_array(ipsRegistry::cache()->getCache('lang_data')) and count(ipsRegistry::cache()->getCache('lang_data'))) {
                 foreach (ipsRegistry::cache()->getCache('lang_data') as $data) {
                     if ($data['lang_id'] == $this->request['langid']) {
                         if ($this->memberData['member_id']) {
                             IPSMember::save($this->memberData['member_id'], array('core' => array('language' => $data['lang_id'])));
                         } else {
                             IPSCookie::set('language', $data['lang_id']);
                         }
                         $this->member->language_id = $data['lang_id'];
                         $this->member->setProperty('language', $data['lang_id']);
                         break;
                     }
                 }
             }
         }
     }
     //--------------------------------
     // Now set it
     //--------------------------------
     if ($this->member->language_id) {
         foreach ($this->caches['lang_data'] as $_lang) {
             if ($_lang['lang_id'] == $this->member->language_id) {
                 $this->local = $_lang['lang_short'];
                 $this->lang_id = $_lang['lang_id'];
                 $this->language_dir = $_lang['lang_id'];
                 break;
             }
         }
     }
     //-----------------------------------------
     // Set locale
     //-----------------------------------------
     setlocale(LC_ALL, $this->local);
     $this->local_data = localeconv();
     //-----------------------------------------
     // Using in_dev override
     //-----------------------------------------
     if (IN_DEV and !$this->_forceEnglish) {
         if (is_dir(IPS_CACHE_PATH . 'cache/lang_cache/master_lang')) {
             $this->lang_id = 'master_lang';
         }
     }
 }
예제 #8
0
파일: search.php 프로젝트: mover5/imobackup
 /**
  * View new posts since your last visit
  *
  * @return	@e void
  */
 public function viewNewContent()
 {
     IPSSearchRegistry::set('in.search_app', $this->request['search_app']);
     /* Fetch member cache to see if we have a value set */
     $vncPrefs = IPSMember::getFromMemberCache($this->memberData, 'vncPrefs');
     /* Guests */
     if (!$this->memberData['member_id'] and (!$this->request['period'] or $this->request['period'] == 'unread')) {
         $this->request['period'] = 'today';
     }
     /* In period */
     if ($vncPrefs === null or !isset($vncPrefs[IPSSearchRegistry::get('in.search_app')]['view']) or !empty($this->request['period']) and isset($this->request['change'])) {
         $vncPrefs[IPSSearchRegistry::get('in.search_app')]['view'] = !empty($this->request['period']) ? $this->request['period'] : $this->settings['default_vnc_method'];
     }
     /* Follow filter enabled */
     if ($vncPrefs === null or !isset($vncPrefs[IPSSearchRegistry::get('in.search_app')]['view']) or isset($this->request['followedItemsOnly'])) {
         $vncPrefs[IPSSearchRegistry::get('in.search_app')]['vncFollowFilter'] = !empty($this->request['followedItemsOnly']) ? 1 : 0;
     }
     /* User mode */
     if ($vncPrefs === null or !isset($vncPrefs[IPSSearchRegistry::get('in.search_app')]['view']) or isset($this->request['userMode'])) {
         $vncPrefs[IPSSearchRegistry::get('in.search_app')]['userMode'] = !empty($this->request['userMode']) ? $this->request['userMode'] : '';
     }
     /* Set filters up */
     IPSSearchRegistry::set('forums.vncForumFilters', $vncPrefs['forums']['vnc_forum_filter']);
     IPSSearchRegistry::set('in.period', $vncPrefs[IPSSearchRegistry::get('in.search_app')]['view']);
     IPSSearchRegistry::set('in.vncFollowFilterOn', $vncPrefs[IPSSearchRegistry::get('in.search_app')]['vncFollowFilter']);
     IPSSearchRegistry::set('in.userMode', $vncPrefs[IPSSearchRegistry::get('in.search_app')]['userMode']);
     /* Update member cache */
     if (isset($this->request['period']) and isset($this->request['change'])) {
         IPSMember::setToMemberCache($this->memberData, array('vncPrefs' => $vncPrefs));
     }
     IPSDebug::addMessage(var_export($vncPrefs, true));
     IPSDebug::addMessage('Using: ' . IPSSearchRegistry::get('in.period'));
     /* Can we do this? */
     if (IPSLib::appIsSearchable(IPSSearchRegistry::get('in.search_app'), 'vnc') || IPSLib::appIsSearchable(IPSSearchRegistry::get('in.search_app'), 'active')) {
         /* Can't do a specific unread search, so */
         if (IPSSearchRegistry::get('in.period') == 'unread' && !IPSLib::appIsSearchable(IPSSearchRegistry::get('in.search_app'), 'vncWithUnreadContent')) {
             IPSSearchRegistry::set('in.period', 'lastvisit');
         }
         /* Perform the search */
         $this->searchController->viewNewContent();
         /* Get count */
         $count = $this->searchController->getResultCount();
         /* Get results which will be array of IDs */
         $results = $this->searchController->getResultSet();
         /* Get templates to use */
         $template = $this->searchController->fetchTemplates();
         /* Fetch sort details */
         $sortDropDown = $this->searchController->fetchSortDropDown();
         /* Fetch sort details */
         $sortIn = $this->searchController->fetchSortIn();
         /* Reset for template */
         $this->_resetRequestParameters();
         if (IPSSearchRegistry::get('in.start') > 0 and !count($results)) {
             $new_url = 'app=core&amp;module=search&amp;do=viewNewContent&amp;period=' . IPSSearchRegistry::get('in.period') . '&amp;userMode=' . IPSSearchRegistry::get('in.userMode') . '&amp;search_app=' . IPSSearchRegistry::get('in.search_app') . '&amp;sid=' . $this->request['_sid'];
             $new_url .= '&amp;st=' . (IPSSearchRegistry::get('in.start') - IPSSearchRegistry::get('opt.search_per_page')) . '&amp;search_app_filters[' . IPSSearchRegistry::get('in.search_app') . '][searchInKey]=' . $this->request['search_app_filters'][IPSSearchRegistry::get('in.search_app')]['searchInKey'];
             $this->registry->output->silentRedirect($this->settings['base_url'] . $new_url);
         }
         /* Parse result set */
         $results = $this->registry->output->getTemplate($template['group'])->{$template}['template']($results, IPSSearchRegistry::get('opt.searchType') == 'titles' || IPSSearchRegistry::get('opt.noPostPreview') ? 1 : 0);
         /* Build pagination */
         $links = $this->registry->output->generatePagination(array('totalItems' => $count, 'itemsPerPage' => IPSSearchRegistry::get('opt.search_per_page'), 'currentStartValue' => IPSSearchRegistry::get('in.start'), 'baseUrl' => 'app=core&amp;module=search&amp;do=viewNewContent&amp;period=' . IPSSearchRegistry::get('in.period') . '&amp;userMode=' . IPSSearchRegistry::get('in.userMode') . '&amp;search_app=' . IPSSearchRegistry::get('in.search_app') . '&amp;sid=' . $this->request['_sid'] . $this->_returnSearchAppFilters()));
         /* Showing */
         $showing = array('start' => IPSSearchRegistry::get('in.start') + 1, 'end' => IPSSearchRegistry::get('in.start') + IPSSearchRegistry::get('opt.search_per_page') > $count ? $count : IPSSearchRegistry::get('in.start') + IPSSearchRegistry::get('opt.search_per_page'));
     } else {
         $count = 0;
         $results = array();
     }
     /* Add Debug message */
     IPSDebug::addMessage("View New Content Matches: " . $count);
     /* Check for sortIn */
     if (count($sortIn) && !$this->request['search_app_filters'][$this->request['search_app']]['searchInKey']) {
         $this->request['search_app_filters'][$this->request['search_app']]['searchInKey'] = $sortIn[0][0];
     }
     /* Output */
     $this->title = $this->lang->words['new_posts_title'];
     $this->registry->output->addNavigation($this->lang->words['new_posts_title'], '');
     $this->output .= $this->registry->output->getTemplate('search')->newContentView($results, $links, $count, $sortDropDown, $sortIn, IPSSearchRegistry::get('set.resultCutToDate'));
 }
예제 #9
0
 /**
  * Make an SEO title for use in the URL
  * We parse them even if friendly urls are off so that the data is there when you do switch it on
  *
  * @param	string		Raw SEO title or text
  * @return	string		Cleaned up SEO title
  */
 public static function makeSeoTitle($text)
 {
     if (!$text) {
         return '';
     }
     /* Strip all HTML tags first */
     $text = strip_tags($text);
     /* Remove specific hex characters (/,<,>,#) as it confuses redirect engine */
     $text = preg_replace('#%(2f|3c|3e|23)#i', '', $text);
     /* Preserve other %data */
     $text = preg_replace('#%([a-fA-F0-9][a-fA-F0-9])#', '-xx-$1-xx-', $text);
     $text = str_replace(array('%', '`'), '', $text);
     $text = preg_replace('#-xx-([a-fA-F0-9][a-fA-F0-9])-xx-#', '%$1', $text);
     /* Convert accented chars */
     if (IPS_DOC_CHAR_SET != 'UTF-8') {
         /* http://community.invisionpower.com/resources/bugs.html/_/ip-board/i-broke-furls-urls-with-accents-r41236 */
         /* AJAX requests have HTML entities, so convert to accents then romanize */
         if (strstr($text, '&#')) {
             $text = html_entity_decode($text, ENT_NOQUOTES, 'UTF-8');
         }
         $text = self::convertAccents($text);
     }
     /* Convert it */
     if (self::isUTF8($text)) {
         if (function_exists('mb_strtolower')) {
             $text = mb_strtolower($text, 'UTF-8');
         }
         $text = self::utf8Encode($text, 250);
     }
     /* Finish off */
     $text = strtolower($text);
     if (strtolower(IPS_DOC_CHAR_SET) == 'utf-8') {
         $text = preg_replace('#&.+?;#', '', $text);
         $text = preg_replace('#[^%a-z0-9 _-]#', '', $text);
     } else {
         $text = str_replace(array('&quot;', '&amp;'), '', $text);
         $text = preg_replace('#\\&[\\#a-z0-9]{2,6};#i', '', $text);
         $text = preg_replace('#[^%&\\#;a-z0-9 _-]#', '', $text);
     }
     $text = str_replace(array('`', ' ', '+', '.', '?', '_', '#', '&'), '-', $text);
     $text = preg_replace("#-{2,}#", '-', $text);
     $text = trim($text, '-');
     IPSDebug::addMessage("<span style='color:red'>makeSeoTitle ({$text}) called</span>");
     return $text ? $text : '-';
 }
예제 #10
0
 /**
  * Grab the user agent from the DB if required
  *
  * @access	protected
  * @param	string		Type of session (update/create)
  * @return	array 		Array of user agent info from the DB
  */
 protected function _processUserAgent($type = 'update')
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $uAgent = array('uagent_key' => '__NONE__', 'uagent_version' => 0, 'uagent_name' => '', 'uagent_type' => '', 'uagent_bypass' => 0);
     //-----------------------------------------
     // Do we need to update?
     //-----------------------------------------
     if (IPSCookie::get('mobileApp') == 'true') {
         $uAgent = array('uagent_id' => -1, 'uagent_key' => 'ipsMobileLegacy', 'uagent_name' => 'IPS Mobile Legacy', 'uagent_type' => 'mobileAppLegacy', 'uagent_version' => 1);
     } else {
         if (empty($this->session_data['uagent_key']) or $this->session_data['uagent_key'] == '__NONE__' or $this->_userAgent != $this->session_data['browser']) {
             IPSDebug::addMessage("Retreiving user agent information from the DB");
             //-----------------------------------------
             // Get useragent stuff
             //-----------------------------------------
             if (!$this->registry->isClassLoaded('userAgentFunctions')) {
                 $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/useragents/userAgentFunctions.php', 'userAgentFunctions');
                 $this->registry->setClass('userAgentFunctions', new $classToLoad($this->registry));
             }
             $uAgent = $this->registry->getClass('userAgentFunctions')->findUserAgentID($this->_member->user_agent);
             if ($uAgent['uagent_key'] === NULL) {
                 $uAgent = array('uagent_key' => '__NONE__', 'uagent_version' => 0, 'uagent_name' => '', 'uagent_type' => '', 'uagent_bypass' => 0);
             } else {
                 $uAgent['uagent_bypass'] = 0;
             }
             /* Update browser */
             $uAgent['_browser'] = $this->_userAgent;
         } else {
             $uAgent['uagent_key'] = $this->session_data['uagent_key'];
             $uAgent['uagent_version'] = $this->session_data['uagent_version'];
             $uAgent['uagent_type'] = $this->session_data['uagent_type'];
             $uAgent['uagent_bypass'] = $this->session_data['uagent_bypass'];
             /* For search engines only */
             $uAgent['uagent_name'] = $this->session_data['member_name'];
         }
     }
     return $uAgent;
 }