I read a bit around here, but as I'm a newbie I couldn't configure what to change the description to on my own, can someone help me?
I get this error:Warning: Illegal string offset 'members_seo_name' in F:\Server\xampp\htdocs\ipbwaqar\admin\sources\classes\output\publicOutput.php(3526) : eval()'d code on line 12
publicOutput.php looks something like this:
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.3.4
* Public output methods
* Last Updated: $Date: 2012-07-05 11:04:28 -0400 (Thu, 05 Jul 2012) $
* </pre>
*
* @author $Author: mmecham $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @link http://www.invisionpower.com
* @since Who knows...
* @version $Revision: 11035 $
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class output
{
/**#@+
* Registry Object Shortcuts
*
* @access public
* @var object
*/
public $registry;
public $DB;
public $settings;
public $request;
public $lang;
public $member;
public $cache;
/**#@-*/
/**
* SEO templates
*
* @access public
* @var array
*/
public $seoTemplates = array();
/**
* URLs array
*
* @access public
* @var array
*/
public $urls = array();
/**
* Compiled templates
*
* @access public
* @var array
*/
public $compiled_templates = array();
/**
* Loaded templates
*
* @access public
* @var array
*/
public $loaded_templates = array();
/**
* HTML variable
*
* @access protected
* @var string
*/
protected $_html = '';
/**
* Page title
*
* @access protected
* @var string
*/
protected $_title = '';
/**
* Basic navigation elements
*
* @access protected
* @var array
*/
protected $__navigation = array();
/**
* Is this an error page?
*
* @access protected
* @var bool
*/
protected $_isError = FALSE;
/**
* Is this a page we should use SSL for?
*
* @access public
* @var bool
*/
public $isHTTPS = FALSE;
/**
* Custom navigation elements
*
* @access protected
* @var array
*/
public $_navigation = array();
/**
* Skin array
*
* @access public
* @var array
*/
public $skin = array();
/**
* All skins
*
* @access public
* @var array
*/
public $allSkins = array();
/**
* Offline message
*
* @access public
* @var string
*/
public $offlineMessage = '';
/**
* Add content to the document <head>
*
* @access protected
* @var array
*/
protected $_documentHeadItems = array();
/**
* Holds the JS modules to be loaded
*
* @access protected
* @var array
*/
protected $_jsLoader = array();
/**
* CSS array to be passed to main library
*
* @access protected
* @var array
*/
protected $_css = array( 'import' => array(), 'inline' => array() );
/**
* Do not load skin_global
*
* @access protected
* @var boolean
*/
protected $_noLoadGlobal = FALSE;
/**
* Maintain an array of seen template bits to prevent
* infinite recursion when dealing with parse template tags
*
* @access protected
* @var array
*/
protected $_seenTemplates = array();
/**
* Output format class
*
* @access public
* @var object
*/
public $outputFormatClass;
/**
* Skin functions class, if needed
*
* @access protected
* @var object
*/
protected $_skinFunctions;
/**
* Are we using safe mode?
*
* @access protected
* @var bool
*/
protected $_usingSafeModeSkins = FALSE;
/**
* Root doc URL (no pagination)
*
* @access protected
* @var string
*/
protected $_rootDocUrl;
/**
* is mobile skin flag
*
* @access protected
* @var boolean
*/
protected $_isMobileSkin = false;
/**
* FURL cache storage.
*
* @access protected
* @var boolean
*/
protected static $furlCache = array();
/**
* If you're generating a lot of FURLs, the cache will eventually slow you down beyond
*
* @access protected
* @var boolean
*/
protected static $furlCacheEnabled = true;
/**
* Interally cache the results of isLargeTouchDevice() and isSmallTouchDevice()
* @var boolean
*/
protected $_isLargeTouchDevice = null;
protected $_isSmallTouchDevice = null;
/**
* Fetch skin generator session
* @var boolean
*/
public $skinGenSession = false;
/**
* Anti-cache hash for CSS/JS
* @var string
*/
public $antiCacheHash;
protected $_paginationProcessedData = array();
/**
* Trap skin calls that could have incorrect names
*
* @access public
* @param string
* @param mixed void, or an array of arguments
* @return mixed string, or an error
*/
public function __call( $funcName, $args )
{
/* Output format stuff.. */
switch ( $funcName )
{
case 'storeRootDocUrl':
$this->_rootDocUrl = $args[0];
return true;
break;
case 'fetchRootDocUrl':
return $this->_rootDocUrl;
break;
case 'setCacheExpirationSeconds':
if ( is_object( $this->outputFormatClass ) )
{
return $this->outputFormatClass->$funcName( $args[0] );
}
break;
case 'setHeaderCode':
if ( is_object( $this->outputFormatClass ) )
{
return $this->outputFormatClass->$funcName( $args[0], $args[1] );
}
break;
case 'addMetaTag':
if ( is_object( $this->outputFormatClass ) )
{
if ( isset( $args[3] ) )
{
return $this->outputFormatClass->$funcName( $args[0], $args[1], (boolean)$args[2], (integer)$args[3] );
}
else
{
return $this->outputFormatClass->$funcName( $args[0], $args[1], (boolean)$args[2] );
}
}
break;
case 'getMetaTags':
if ( is_object( $this->outputFormatClass ) )
{
return $this->outputFormatClass->$funcName( $args[0] );
}
break;
case 'encodeMetaTagContent':
if ( is_object( $this->outputFormatClass ) )
{
return $this->outputFormatClass->$funcName( $args[0] );
}
break;
case 'addCanonicalTag':
if ( is_object( $this->outputFormatClass ) )
{
return $this->outputFormatClass->$funcName( $args[0], $args[1], $args[2] );
}
break;
case 'getCanonicalUrl':
if ( is_object( $this->outputFormatClass ) )
{
return $this->outputFormatClass->$funcName();
}
case 'forceDownload':
if ( is_object( $this->outputFormatClass ) )
{
return $this->outputFormatClass->$funcName( $args[0] );
}
case 'parseIPSTags':
if ( is_object( $this->outputFormatClass ) )
{
return $this->outputFormatClass->$funcName( $args[0] );
}
break;
}
}
/**
* Returns the processed pagination data
*/
public function getPaginationProcessedData()
{
return $this->_paginationProcessedData;
}
/**
* Flag this skin as mobile
*
* @access public
* @param boolean
*/
public function setAsMobileSkin( $bool )
{
$this->_isMobileSkin = ( $bool ) ? true : false;
}
/**
* Flag this skin as mobile
*
* @access public
* @param boolean
*/
public function getAsMobileSkin()
{
return ( $this->_isMobileSkin ) ? true : false;
}
/**
* Is this a large touch device? ...
* Future expansion
*/
public function isLargeTouchDevice()
{
if ( $this->_isLargeTouchDevice === null )
{
$this->_isLargeTouchDevice = false;
if ( $this->memberData['userAgentKey'] == 'transformer' )
{
$this->_isLargeTouchDevice = true;
}
else if ( $this->memberData['userAgentKey'] == 'iPad' )
{
$this->_isLargeTouchDevice = true;
}
}
return $this->_isLargeTouchDevice;
}
/**
* Is this a small touch device? ...
* Future expansion
*/
public function isSmallTouchDevice()
{
if ( $this->_isSmallTouchDevice === null )
{
$this->_isSmallTouchDevice = false;
if ( $this->memberData['userAgentKey'] == 'iphone' )
{
$this->_isSmallTouchDevice = true;
}
else if ( $this->memberData['userAgentKey'] == 'ipodtouch' )
{
$this->_isSmallTouchDevice = true;
}
else if ( $this->memberData['userAgentKey'] == 'android' )
{
$this->_isSmallTouchDevice = true;
}
else if ( $this->memberData['userAgentKey'] == 'operamini' )
{
$this->_isSmallTouchDevice = true;
}
}
return $this->_isSmallTouchDevice;
}
/**
* Is this a ___ touch device? ...
* Future expansion
*/
public function isTouchDevice()
{
return ( $this->isLargeTouchDevice() || $this->isSmallTouchDevice() ) ? true : false;
}
/**
* Construct
*
* @access public
* @param object ipsRegistry reference
* @param bool Whether to init or not
* @return @e void
*/
public function __construct( ipsRegistry $registry, $initialize=FALSE )
{
/* Make object */
$this->registry = $registry;
$this->DB = $this->registry->DB();
$this->settings =& $this->registry->fetchSettings();
$this->request =& $this->registry->fetchRequest();
$this->lang = $this->registry->getClass('class_localization');
$this->member = $this->registry->member();
$this->memberData =& $this->registry->member()->fetchMemberData();
$this->cache = $this->registry->cache();
$this->caches =& $this->registry->cache()->fetchCaches();
/* Safe mode skins... */
$this->_usingSafeModeSkins = ( ( $this->settings['safe_mode_skins'] == 0 AND $this->settings['safe_mode'] == 0 ) OR IN_DEV ) ? FALSE : TRUE;
if ( $initialize === TRUE )
{
//-----------------------------------------
// INIT
//-----------------------------------------
$_outputFormat = 'html';
$_outputClassName = 'htmlOutput';
$this->allSkins = $this->_fetchAllSkins();
$skinSetID = $this->_fetchUserSkin();
$this->skin = $this->allSkins[ $skinSetID ];
/* Does it need a recache? */
if ( $this->skin['set_updated'] == -2 )
{
/* Flag skins for recache */
require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinFunctions.php' );/*noLibHook*/
require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinCaching.php' );/*noLibHook*/
$skinCaching = new skinCaching( $this->registry );
/* Set it as caching */
$skinCaching->flagSetAsRecaching( $skinSetID );
/* Just recache this one skin set */
$skinCaching->setIgnoreChildrenWhenRecaching( true );
$skinCaching->rebuildPHPTemplates( $skinSetID );
$skinCaching->rebuildCSS( $skinSetID );
IPSDebug::addMessage( "Recached skin set: " . $skinSetID );
}
//-----------------------------------------
// Get the skin caches
//-----------------------------------------
$skinCaches = $this->cache->getWithCacheLib( 'Skin_Store_' . $skinSetID );
if ( ! is_array($skinCaches) OR ! count($skinCaches) )
{
$_grab = "'css', 'replacements'";
$this->DB->build( array( 'select' => '*',
'from' => 'skin_cache',
'where' => "cache_set_id=" . $skinSetID . " AND cache_type IN (" . $_grab . ")" ) );
$this->DB->execute();
while( $row = $this->DB->fetch() )
{
$skinCaches[ $row['cache_value_2'] . '.' . $row['cache_id'] ] = $row;
}
/* Put skin cache back if needed */
$this->cache->putWithCacheLib( 'Skin_Store_' . $skinSetID, $skinCaches, 86400 );
}
/* Avoid SQL filesort */
ksort( $skinCaches );
/* Loop and build */
foreach( $skinCaches as $row )
{
switch( $row['cache_type'] )
{
default:
break;
case 'css':
$appDir = '';
$appHide = 0;
if ( strstr( $row['cache_value_4'], '-' ) )
{
list( $appDir, $appHide ) = explode( '-', $row['cache_value_4'] );
if ( ( $appDir ) AND $appDir != IPS_APP_COMPONENT AND $appHide )
{
continue;
}
/* @link http://community.invisionpower.com/tracker/issue-32175-disabled-app-css */
else if( $appDir and !IPSLib::appIsInstalled( $appDir ) )
{
continue;
}
}
/* Tied to specific modules within the app? */
if ( $row['cache_value_6'] AND $this->request['module'] )
{
if ( ! in_array( $this->request['module'], explode( ',', str_replace( ' ', '', $row['cache_value_6'] ) ) ) )
{
continue;
}
}
$skinCaches['css'][ $row['cache_value_1'] ] = array( 'content' => $row['cache_content'], 'attributes' => $row['cache_value_5'] );
break;
case 'replacements':
$skinCaches['replacements'] = $row['cache_content'];
break;
}
}
$this->skin['_css'] = is_array( $skinCaches['css'] ) ? $skinCaches['css'] : array();
$this->skin['_replacements'] = unserialize($skinCaches['replacements']);
$this->skin['_skincacheid'] = $this->skin['set_id'];
$this->skin['_csscacheid'] = 'css_' . $this->skin['set_id'];
// Set a hash we can use to prevent client caching of CSS/JS
$this->antiCacheHash = md5( IPB_VERSION . $this->settings['board_url'] . md5( $this->settings['sql_tbl_prefix'] . $this->settings['sql_pass'] ) );
/* IN_DEV Stuff */
if ( IN_DEV )
{
$this->skin['_css'] = array();
if ( is_file( DOC_IPS_ROOT_PATH . 'cache/skin_cache/masterMap.php' ) )
{
$REMAP = $this->buildRemapData();
$_setId = intval( $REMAP['inDevDefault'] );
$_dir = $REMAP['templates'][ $REMAP['inDevDefault'] ];
$_cdir = $REMAP['css'][ $REMAP['inDevDefault'] ];
/* Reset master dir */
$this->skin['set_image_dir'] = $REMAP['images'][ $REMAP['inDevDefault'] ];
$this->skin['set_key'] = $REMAP['inDevDefault'];
}
else
{
$_setId = 0;
$_dir = 'master_skin';
$_cdir = 'master_css';
}
/* Using a custom master skin */
if ( $_setId )
{
$this->skin = $this->allSkins[ $_setId ];
$this->skin['_replacements'] = unserialize( $skinCaches['replacements'] );
}
/* Sort out CSS */
if ( ! isset( $this->_skinFunctions ) || ! is_object( $this->_skinFunctions ) )
{
require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinFunctions.php' );/*noLibHook*/
require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinCaching.php' );/*noLibHook*/
$this->_skinFunctions = new skinCaching( $this->registry );
}
$css = $this->_skinFunctions->fetchDirectoryCSS( $_cdir );
$tmp = array();
$ord = array();
foreach( $css as $name => $data )
{
/* Tied to app? */
if ( ( $data['css_app'] ) AND $data['css_app'] != IPS_APP_COMPONENT AND $data['css_app_hide'] )
{
continue;
}
/* Tied to specific modules within the app? */
if ( $data['css_modules'] AND ( ! in_array( $this->request['module'], explode( ',', str_replace( ' ', '', $data['css_modules'] ) ) ) ) )
{
continue;
}
$tmp[ $data['css_position'] . '.' . $data['css_group'] ][ $name ] = array( 'content' => $data['css_content'], 'attributes' => $data['css_attributes'] );
}
ksort( $tmp );
foreach( $tmp as $blah => $data )
{
foreach( $data as $name => $data )
{
$ord[ $blah ] = array( 'css_group' => $name, 'css_position' => 1 );
$this->skin['_css'][ $name ] = $data;
}
}
/* Other data */
$this->skin['_cssGroupsArray'] = $ord;
$this->skin['_skincacheid'] = is_dir( IPS_CACHE_PATH . 'cache/skin_cache/' . $_dir ) ? $_setId : $this->skin['set_id'];
$this->skin['_csscacheid'] = $_cdir;
$this->skin['set_css_inline'] = ( is_dir( IPS_PUBLIC_PATH . 'style_css/' . $_cdir ) ) ? 1 : 0;
if ( is_file( IPS_CACHE_PATH . 'cache/skin_cache/' . $_dir . '/_replacements.inc' ) )
{
$replacements = array();
include_once( IPS_CACHE_PATH . 'cache/skin_cache/' . $_dir . '/_replacements.inc' );/*noLibHook*/
$this->skin['_replacements'] = $replacements;
}
}
/* Is this a mobile skin? */
if ( $this->skin['set_key'] == 'mobile' )
{
$this->setAsMobileSkin( true );
}
//-----------------------------------------
// Which output engine?
//-----------------------------------------
if ( $this->skin['set_output_format'] )
{
if ( file_exists( IPS_ROOT_PATH . 'sources/classes/output/formats/' . $this->skin['set_output_format'] ) )
{
$_outputFormat = $this->skin['set_output_format'];
$_outputClassName = $this->skin['set_output_format'] . 'Output';
}
}
require_once( IPS_ROOT_PATH . 'sources/classes/output/formats/coreOutput.php' );/*noLibHook*/
$outputClassToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/output/formats/' . $_outputFormat. '/' . $_outputClassName. '.php', $_outputClassName );
$this->outputFormatClass = new $outputClassToLoad( $this );
/* Build URLs */
$this->_buildUrls();
/* Special set up for mobile skin */
if ( $this->getAsMobileSkin() === true )
{
$this->_mobileSkinSetUp();
}
}
}
/**
* Reload skin set data
* Some applications need to ensure they get 'fresh' skin data not just the data loaded during INIT
*
* @access public
*/
public function reloadSkinData()
{
/* Whack the cache */
$this->caches['skinsets'] = array();
$this->allSkins = $this->_fetchAllSkins();
$skinSetID = $this->_fetchUserSkin();
$this->skin = $this->allSkins[ $skinSetID ];
}
/**
* Build URLs
*
* @access protected
* @return @e void
*/
protected function _buildUrls()
{
//-----------------------------------------
// Should we use HTTPS on this page?
//-----------------------------------------
$this->_setHTTPS();
//-----------------------------------------
// Board URLs and such
//-----------------------------------------
$this->settings['board_url'] = $this->settings['base_url'];
$this->settings['js_main'] = $this->settings['base_url'] . '/' . CP_DIRECTORY . '/js/';
$this->settings['public_dir'] = $this->settings['base_url'] . '/' . PUBLIC_DIRECTORY . '/';
$this->settings['cache_dir'] = $this->settings['ipb_cache_url'] ? $this->settings['ipb_cache_url'] . '/cache/' : $this->settings['base_url'] . '/cache/';
$this->settings['base_url'] = $this->settings['base_url'] .'/'.IPS_PUBLIC_SCRIPT.'?';
$this->settings['base_url_ns'] = $this->settings['base_url'] .'/'.IPS_PUBLIC_SCRIPT.'?';
if ( $this->member->session_type != 'cookie' AND !$this->member->is_not_human )
{
$this->settings['base_url'] .= 's='.$this->member->session_id.'&';
}
/* Create new URL */
$this->settings['base_url_with_app'] = $this->settings['base_url'] . 'app=' . IPS_APP_COMPONENT . '&';
$this->settings['js_base'] = $this->settings['_original_base_url'].'/index.'.$this->settings['php_ext'].'?s='.$this->member->session_id.'&';
$this->settings['img_url'] = $this->settings['ipb_img_url'] ? $this->settings['ipb_img_url'] . '/' . PUBLIC_DIRECTORY . '/style_images/' . $this->skin['set_image_dir'] : $this->settings['_original_base_url'] . '/' . PUBLIC_DIRECTORY . '/style_images/' . $this->skin['set_image_dir'];
$this->settings['img_url_no_dir'] = $this->settings['ipb_img_url'] ? $this->settings['ipb_img_url'] . '/' . PUBLIC_DIRECTORY . '/style_images/' : $this->settings['_original_base_url'] . '/' . PUBLIC_DIRECTORY . '/style_images/';
$this->settings['public_cdn_url'] = rtrim( $this->settings['ipb_img_url'] ? $this->settings['ipb_img_url'] : $this->settings['_original_base_url'], '/' ) . '/' . PUBLIC_DIRECTORY . '/';
$this->settings['css_base_url'] = rtrim( $this->settings['ipb_css_url'] ? $this->settings['ipb_css_url'] : $this->settings['_original_base_url'], '/' ) . '/' . PUBLIC_DIRECTORY . '/';
$this->settings['js_base_url'] = rtrim( $this->settings['ipb_js_url'] ? $this->settings['ipb_js_url'] : $this->settings['_original_base_url'], '/' ) . '/' . PUBLIC_DIRECTORY . '/';
$this->settings['emoticons_url'] = $this->settings['ipb_img_url'] ? $this->settings['ipb_img_url'] . '/' . PUBLIC_DIRECTORY . '/style_emoticons/<#EMO_DIR#>' : $this->settings['_original_base_url'] . '/' . PUBLIC_DIRECTORY . '/style_emoticons/<#EMO_DIR#>';
$this->settings['mime_img'] = $this->settings['ipb_img_url'] ? $this->settings['ipb_img_url'] . '/' . PUBLIC_DIRECTORY : $this->settings['_original_base_url'] . '/' . PUBLIC_DIRECTORY;
/* HTTPS fixes */
if( $this->isHTTPS )
{
$this->enableHTTPS();
}
}
/**
* Enable HTTPS
*
* @return @e void
*/
public function enableHTTPS()
{
$this->isHTTPS = TRUE;
$this->settings['board_url_https'] = str_replace( 'http://', 'https://', $this->settings['board_url'] );
$this->settings['base_url_https'] = str_replace( 'http://', 'https://', $this->settings['base_url'] );
$this->settings['public_dir'] = str_replace( 'http://', 'https://', $this->settings['public_dir'] );
$this->settings['cache_dir'] = str_replace( 'http://', 'https://', $this->settings['cache_dir'] );
$this->settings['img_url'] = str_replace( 'http://', 'https://', $this->settings['img_url'] );
$this->settings['css_base_url'] = str_replace( 'http://', 'https://', $this->settings['css_base_url'] );
$this->settings['js_base_url'] = str_replace( 'http://', 'https://', $this->settings['js_base_url'] );
$this->settings['img_url_no_dir'] = str_replace( 'http://', 'https://', $this->settings['img_url_no_dir'] );
$this->settings['upload_url'] = str_replace( 'http://', 'https://', $this->settings['upload_url'] );
$this->settings['fbc_xdlocation'] = str_replace( 'http://', 'https://', str_replace( 'xd_receiver.php', 'xd_receiver_ssl.php', $this->settings['fbc_xdlocation'] ) );
$this->settings['emoticons_url'] = str_replace( 'http://', 'https://', $this->settings['emoticons_url'] );
$this->settings['mime_img'] = str_replace( 'http://', 'https://', $this->settings['mime_img'] );
}
/**
* Any set up for the mobile skin
*
* @access private
*/
private function _mobileSkinSetUp()
{
/* Ensure thumbnails are small */
$this->settings['siu_width'] = 100;
$this->settings['siu_height'] = 100;
}
/**
* Sets the isHTTPS class variable
*
* @access private
* @return @e void
* @todo [Future] Explore moving the https section definitions to app coreVariables.php
*/
private function _setHTTPS()
{
$this->isHTTPS = false;
if ( !defined( 'SSL_PORT' ) )
{
define( 'SSL_PORT', 443 );
}
if ( $_SERVER['SERVER_PORT'] == SSL_PORT )
{
$this->isHTTPS = true;
return;
}
if( $this->settings['logins_over_https'] && ( in_array( ipsRegistry::$request['section'], array( 'login', 'lostpass', 'register') ) || ipsRegistry::$request['module'] == 'usercp') )
{
/* Configure where we want HTTPS */
$sectionsForHttps = array(
'core' => array(
'global' => array(
'login' => array(),
'register' => array(),
'lostpass' => array(),
),
'usercp' => array(
'core' => array( 'email', 'password', 'displayname' ),
),
),
);
foreach( $sectionsForHttps as $app => $modules )
{
if( $app == ipsRegistry::$request['app'] )
{
foreach( $modules as $module => $sections )
{
if( $module == ipsRegistry::$request['module'] )
{
foreach( $sections as $section => $areas )
{
//-----------------------------------------
// User cp is "special"
//-----------------------------------------
if( $module == 'usercp' )
{
if( ipsRegistry::$request['tab'] == $section )
{
foreach( $areas as $area )
{
if( ipsRegistry::$request['area'] == $area )
{
$this->isHTTPS = true;
break 4;
}
}
}
}
else
{
if( ipsRegistry::$request['section'] == $section )
{
$this->isHTTPS = true;
break 3;
}
}
}
}
}
}
}
}
}
/**
* Return all skin sets from the cache and expand them
*
* @access protected
* @return Array if skin (array [id] => data
*/
protected function _fetchAllSkins()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$gatewayFile = '';
//-----------------------------------------
// Check skin caches
//-----------------------------------------
if ( ! is_array( $this->caches['skinsets'] ) OR ! count( $this->caches['skinsets'] ) )
{
$this->cache->rebuildCache( 'skinsets', 'global' );
}
//-----------------------------------------
// Did we come in via a gateway file?
//-----------------------------------------
foreach( $this->caches['outputformats'] as $key => $conf )
{
if ( $conf['gateway_file'] == IPS_PUBLIC_SCRIPT )
{
IPSDebug::addMessage( "Gateway file confirmed: " . $key );
$gatewayFile = $key;
break;
}
}
if( !$gatewayFile )
{
$gatewayFile = 'html';
}
//-----------------------------------------
// Get 'em
//-----------------------------------------
$_skinSets = $this->caches['skinsets'];
if ( is_array( $_skinSets ) )
{
foreach( $_skinSets as $id => $data )
{
$_skinSets[ $id ]['_parentTree'] = unserialize( $_skinSets[ $id ]['set_parent_array'] );
$_skinSets[ $id ]['_childTree'] = unserialize( $_skinSets[ $id ]['set_child_array'] );
$_skinSets[ $id ]['_userAgents'] = unserialize( $_skinSets[ $id ]['set_locked_uagent'] );
$_skinSets[ $id ]['_cssGroupsArray'] = unserialize( $_skinSets[ $id ]['set_css_groups'] );
$_skinSets[ $id ]['_youCanUse'] = FALSE;
$_skinSets[ $id ]['_gatewayExclude'] = FALSE;
/* Can we see it? */
if ( $_skinSets[ $id ]['set_permissions'] == '*' )
{
$_skinSets[ $id ]['_youCanUse'] = TRUE;
}
else if ( $_skinSets[ $id ]['set_permissions'] )
{
$_perms = explode( ',', $_skinSets[ $id ]['set_permissions'] );
if ( isset($this->memberData['member_group_id']) AND in_array( $this->memberData['member_group_id'], $_perms ) )
{
$_skinSets[ $id ]['_youCanUse'] = TRUE;
}
else if ( !empty($this->memberData['mgroup_others']) )
{
$_others = explode( ',', $this->memberData['mgroup_others'] );
if ( count( array_intersect( $_others, $_perms ) ) )
{
$_skinSets[ $id ]['_youCanUse'] = TRUE;
}
}
}
/* Limit to output format? */
if ( $gatewayFile AND ! IN_ACP )
{
if ( $_skinSets[ $id ]['set_output_format'] != $gatewayFile )
{
$_skinSets[ $id ]['_youCanUse'] = FALSE;
$_skinSets[ $id ]['_gatewayExclude'] = TRUE;
}
}
/* Array groups */
if ( is_array( $_skinSets[ $id ]['_cssGroupsArray'] ) )
{
ksort( $_skinSets[ $id ]['_cssGroupsArray'], SORT_NUMERIC );
}
else
{
$_skinSets[ $id ]['_cssGroupsArray'] = array();
}
}
}
return $_skinSets;
}
/**
* Fetch a skin based on user's incoming data (user-agent, URL) or via other params
*
* The priority chain goes like this:
*
* Incoming Gateway file (index.php / xml.php / rss.php, etc) filters out some skins, then:
* - User Agent
* - URL Remap
* - App Specific
* - Member specific
* - Default skin
*
* @access protected
* @return int ID of skin to use
*/
protected function _fetchUserSkin()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$useSkinID = FALSE;
/* Using the skin generator */
if ( $this->memberData['g_access_cp'] && $this->memberData['bw_using_skin_gen'] )
{
/* Flag skins for recache */
require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinFunctions.php' );/*noLibHook*/
require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinCaching.php' );/*noLibHook*/
require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinGenerator.php' );/*noLibHook*/
$skinGenerator = new skinGenerator( $this->registry );
$this->skinGenSession = $skinGenerator->getUserSession( $this->memberData['member_id'] );
if ( $this->skinGenSession !== false )
{
/* Switch on live edit mode */
define( 'IPS_LIVE_EDIT', true );
return $this->skinGenSession['sg_skin_set_id'];
}
}
/* Turn this off if required */
if ( ! defined( 'IPS_LIVE_EDIT') )
{
define( 'IPS_LIVE_EDIT', false );
}
/* Force the full version */
if ( $this->memberData['userAgentType'] != 'mobileApp' && ( $this->request['forceFullVersion'] || IPSCookie::get('uagent_bypass') ) )
{
/* Set cookie */
IPSCookie::set("uagent_bypass", 1, -1);
/* Got one set by default for this gateway? */
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 )
{
return $data['set_id'];
}
}
}
//-----------------------------------------
// Ok, lets get a skin!
//-----------------------------------------
foreach( array( '_fetchByMobileApp', '_fetchSkinByUserAgent', '_fetchSkinByURLMap', '_fetchSkinByApp', '_fetchSkinByMemberPrefs', '_fetchSkinByDefault' ) as $function )
{
$useSkinID = $this->$function();
if ( $useSkinID !== FALSE )
{
break;
}
}
//-----------------------------------------
// Return it...
//-----------------------------------------
return $useSkinID;
}
/**
* Attempt to get a skin choice based on mobile app
*
* @access private
* @return mixed INT of a skin, FALSE if no skin found
*/
private function _fetchByMobileApp()
{
$key = '';
/* Detect the app */
if ( $this->memberData['userAgentType'] == 'mobileApp' )
{
$key = 'xmlskin';
}
else if ( $this->memberData['userAgentType'] == 'mobileBot' || $this->memberData['userAgentType'] == 'mobileAppLegacy' )
{
$key = 'mobile';
$this->setAsMobileSkin( true );
}
else if ( IPSCookie::get("mobileBrowser") == 1 )
{
$key = 'mobile';
$this->setAsMobileSkin( true );
}
if ( $key )
{
$useSkinID = false;
foreach( $this->allSkins as $id => $data )
{
if ( $data['set_key'] == $key )
{
$useSkinID = $data['set_id'];
}
}
if ( $useSkinID )
{
return $useSkinID;
}
}
return false;
}
/**
* Attempt to get a skin choice based on user-agent
*
* @access private
* @return mixed INT of a skin, FALSE if no skin found
*/
private function _fetchSkinByUserAgent()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$useSkinID = FALSE;
if ( $this->memberData['userAgentKey'] AND ! $this->memberData['userAgentBypass'] )
{
foreach( $this->allSkins as $id => $data )
{
/* Got perms? */
if ( $data['_youCanUse'] !== TRUE )
{
continue;
}
/* Can use with this output format? */
if ( $data['_gatewayExclude'] !== FALSE )
{
continue;
}
/* Check user agents first */
if ( is_array( $data['_userAgents']['uagents'] ) )
{
foreach( $data['_userAgents']['uagents'] as $_key => $_version )
{
if ( $this->memberData['userAgentKey'] == $_key )
{
if ( $_version )
{
$_versions = explode( ',', $_version );
foreach( $_versions as $_v )
{
if ( strstr( $_v, '+' ) )
{
if ( $this->memberData['userAgentVersion'] >= intval( $_v ) )
{
$useSkinID = $id;
break 3;
}
}
else if ( strstr( $_v, '-' ) )
{
if ( $this->memberData['userAgentVersion'] <= intval( $_v ) )
{
$useSkinID = $id;
break 3;
}
}
else
{
if ( $this->memberData['userAgentVersion'] == intval( $_v ) )
{
$useSkinID = $id;
break 3;
}
}
}
}
else
{
/* We don't care about versions.. */
$useSkinID = $id;
break 2;
}
}
}
}
/* Still here? */
if ( is_array( $data['_userAgents']['groups'] ) AND $useSkinID === FALSE )
{
foreach( $data['_userAgents']['groups'] as $groupID )
{
$_group = $this->caches['useragentgroups'][ $groupID ];
$_gData = unserialize( $_group['ugroup_array'] );
if ( is_array( $_gData ) )
{
foreach( $_gData as $__key => $__data )
{
if ( $this->memberData['userAgentKey'] == $__key )
{
if ( $__data['uagent_versions'] )
{
$_versions = explode( ',', $__data['uagent_versions'] );
foreach( $_versions as $_v )
{
if ( strstr( $_v, '+' ) )
{
if ( $this->memberData['userAgentVersion'] >= intval( $_v ) )
{
$useSkinID = $id;
break 4;
}
}
else if ( strstr( $_v, '-' ) )
{
if ( $this->memberData['userAgentVersion'] <= intval( $_v ) )
{
$useSkinID = $id;
break 4;
}
}
else
{
if ( $this->memberData['userAgentVersion'] == intval( $_v ) )
{
$useSkinID = $id;
break 4;
}
}
}
}
else
{
/* We don't care about versions.. */
$useSkinID = $id;
break 3;
}
}
}
}
}
}
}
}
/* Did we automatically get set the mobile skin?
* If so, assign cookie
*/
if ( $this->allSkins[ $useSkinID ]['set_key'] == 'mobile' )
{
IPSCookie::set("mobileBrowser", 1, -1);
}
if ( $useSkinID !== FALSE )
{
$this->memberData['userAgentLocked'] = TRUE;
IPSDebug::addMessage( "Skin set found via user agent. Using set #" . $useSkinID );
}
return $useSkinID;
}
/**
* Attempt to fetch a skin based on URL remap
*
* @access private
* @return mixed INT skin ID or FALSE if none found
*/
private function _fetchSkinByURLMap()
{
$useSkinID = FALSE;
//-----------------------------------------
// Geddit?
//-----------------------------------------
if ( $this->caches['skin_remap'] and is_array( $this->caches['skin_remap'] ) AND count( $this->caches['skin_remap'] ) )
{
foreach( $this->caches['skin_remap'] as $id => $data )
{
if ( $data['map_match_type'] == 'exactly' )
{
if ( strtolower( $data['map_url'] ) == strtolower( $this->settings['query_string_real'] ) )
{
$useSkinID = $data['map_skin_set_id'];
break;
}
if ( strtolower( $data['map_url'] ) == strtolower( $this->settings['this_url'] ) )
{
$useSkinID = $data['map_skin_set_id'];
break;
}
}
else if ( $data['map_match_type'] == 'contains' )
{
if ( stristr( $this->settings['query_string_real'], $data['map_url'] ) )
{
$useSkinID = $data['map_skin_set_id'];
break;
}
if ( stristr( $this->settings['this_url'], $data['map_url'] ) )
{
$useSkinID = $data['map_skin_set_id'];
break;
}
}
}
}
/* Can use with this output format? */
if ( $useSkinID !== FALSE )
{
if ( $this->allSkins[ $useSkinID ]['_gatewayExclude'] !== FALSE )
{
$useSkinID = FALSE;
}
}
if ( $useSkinID !== FALSE )
{
IPSDebug::addMessage( "Skin set found via URL remap. Using set #" . $useSkinID );
}
return $useSkinID;
}
/**
* Attempt to fetch a skin based on APPlication
*
* @access private
* @return mixed INT skin ID or FALSE if none found
*/
private function _fetchSkinByApp()
{
$useSkinID = FALSE;
$file = IPSLib::getAppDir( IPS_APP_COMPONENT ) . '/extensions/coreExtensions.php';
if ( is_file( $file ) )
{
$classToLoad = IPSLib::loadLibrary( $file, 'fetchSkin__' . IPS_APP_COMPONENT, IPS_APP_COMPONENT );
if ( class_exists( $classToLoad ) )
{
$_grabber = new $classToLoad( $this->registry );
$_grabber->allSkins = $this->allSkins;
$useSkinID = $_grabber->fetchSkin();
}
}
/* Can use with this output format? */
if ( $useSkinID !== FALSE )
{
if ( $this->allSkins[ $useSkinID ]['_gatewayExclude'] !== FALSE )
{
$useSkinID = FALSE;
}
}
if ( $useSkinID !== FALSE )
{
IPSDebug::addMessage( "Skin set found via APP. Using set #" . $useSkinID );
}
return $useSkinID;
}
/**
* Attempt to fetch a skin based on member's preferences
*
* @access private
* @return mixed INT skin ID or FALSE if none found
*/
private function _fetchSkinByMemberPrefs()
{
$useSkinID = ( $this->memberData['member_id'] ) ? intval( $this->memberData['skin'] ) : intval( IPSCookie::get( 'guestSkinChoice' ) );
if( !$useSkinID )
{
$useSkinID = false;
}
/* Make sure it's legal */
if ( $useSkinID )
{
$_test = $this->allSkins[ $useSkinID ];
if ( $_test['_youCanUse'] !== TRUE )
{
$useSkinID = FALSE;
}
}
if( ! $useSkinID )
{
$useSkinID = FALSE;
}
if ( $useSkinID !== FALSE )
{
IPSDebug::addMessage( "Skin set found via member's preferences. Using set #" . $useSkinID );
}
return $useSkinID;
}
/**
* 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;
/* Got one set by default for this gateway? */
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;
}
/**
* Returns a template class; loading if required
*
* @access public
* @param string template name
* @param boolean [Test only, TRUE for yes, FALSE for no]
* @return mixed Object, or null
*/
public function getTemplate( $groupName )
{
if ( ! isset( $this->compiled_templates[ 'skin_' . $groupName ] ) || ! is_object( $this->compiled_templates[ 'skin_' . $groupName ] ) )
{
//-----------------------------------------
// Using self:: so that we can load public
// skins inside ACP when necessary
//-----------------------------------------
self::loadTemplate( 'skin_' . $groupName );
}
return isset( $this->compiled_templates[ 'skin_' . $groupName ] ) ? $this->compiled_templates[ 'skin_' . $groupName ] : NULL;
}
/**
* Returns a replacement (aka macro)
*
* @access public
* @param string Replacement key
* @return string Replacement value
*/
public function getReplacement( $key )
{
if( is_array($this->skin['_replacements']) AND count($this->skin['_replacements']) )
{
if ( isset($this->skin['_replacements'][ $key ]) )
{
$value = $this->skin['_replacements'] [ $key ];
if ( strstr( $value, '{lang:' ) )
{
$value = preg_replace_callback( '#\{lang:([^\}]+?)\}#', create_function( '$key', 'return ipsRegistry::getClass(\'class_localization\')->words[$key[1]];' ), $value );
}
else if ( strstr( $value, '{time:' ) )
{
$value = preg_replace_callback( '#\{time:([^\}]+?)\}#', create_function( '$key', 'return ipsRegistry::getClass(\'class_localization\')->getDate($key[1], \'LONG\');' ), $value );
}
/**
* Using HTTPS with our link as HTTP and we have a link match?
*
* @link http://community.invisionpower.com/tracker/issue-37285-https-and-easy-logo-changer/
*/
if ( $this->isHTTPS && strpos( $this->settings['board_url'], 'http://' ) === 0 && strpos( $value, $this->settings['board_url'] ) !== FALSE )
{
$value = str_replace( $this->settings['board_url'], $this->settings['board_url_https'], $value );
}
return $value;
}
}
}
/**
* Load a normal template file from either cached PHP file or
* from the DB. Populates $this->compiled_templates[ _template_name_ ]
*
* @access public
* @param string Template name
* @param integer Template set ID
* @return @e void
*/
public function loadTemplate( $name, $id='' )
{
//-----------------------------------------
// Make sure we've not already tried to load
//-----------------------------------------
static $attempted = array();
if( in_array( md5( $name . $id ), $attempted ) )
{
return;
}
$attempted[] = md5( $name . $id );
//-----------------------------------------
// Init
//-----------------------------------------
$tags = 1;
$loaded = 0;
//-----------------------------------------
// Select ID
//-----------------------------------------
if ( ! $id )
{
$id = $this->skin['_skincacheid'];
}
//-----------------------------------------
// Full name
//-----------------------------------------
$full_name = $name.'_'.intval($id);
$skin_global_name = 'skin_global_'.$id;
$new_skin_global_name = '';
$_name = $name;
//-----------------------------------------
// Already got this template loaded?
//-----------------------------------------
if ( !empty( $this->loaded_templates[ $full_name ] ) )
{
return;
}
//-----------------------------------------
// Not running safemode skins?
//-----------------------------------------
if ( $this->_usingSafeModeSkins === FALSE )
{
//-----------------------------------------
// Simply require and return
//-----------------------------------------
if ( $name != 'skin_global')
{
if ( ! ( isset( $this->loaded_templates[ $skin_global_name ] ) && $this->loaded_templates[ $skin_global_name ] ) AND $this->_noLoadGlobal === FALSE )
{
//-----------------------------------------
// Suck in skin global..
//-----------------------------------------
if ( $this->load_template_from_php( 'skin_global', 'skin_global_'.$id, $id ) )
{
$loaded = 1;
}
//-----------------------------------------
// Suck in normal file...
//-----------------------------------------
if ( ! $this->load_template_from_php( $_name, $name.'_'.$id, $id ) )
{
$loaded = 0;
}
}
else
{
//-----------------------------------------
// Suck in normal file...
//-----------------------------------------
if ( $this->load_template_from_php( $_name, $name.'_'.$id, $id ) )
{
$loaded = 1;
}
}
}
else
{
if ( $name == 'skin_global' )
{
//-----------------------------------------
// Suck in skin global..
//-----------------------------------------
if ( $this->load_template_from_php( 'skin_global', 'skin_global_'.$id, $id ) )
{
$loaded = 1;
}
return;
}
else
{
//-----------------------------------------
// Suck in normal file...
//-----------------------------------------
if ( $this->load_template_from_php( $_name, $name.'_'.$id, $id ) )
{
$loaded = 1;
}
}
}
}
//-----------------------------------------
// safe_mode_skins OR flat file load failed
//-----------------------------------------
if ( ! $loaded )
{
//-----------------------------------------
// We're using safe mode skins, yippee
// Load the data from the DB
//-----------------------------------------
$skin_global = "";
$other_skin = "";
$this->skin['_type'] = 'Database Skins';
if ( $this->loaded_templates[ $skin_global_name ] == "" and $name != 'skin_global' AND $this->_noLoadGlobal === FALSE )
{
//-----------------------------------------
// Skin global not loaded...
//-----------------------------------------
$this->DB->build( array( 'select' => '*',
'from' => 'skin_cache',
'where' => "cache_set_id=".$id." AND cache_value_1 IN ('skin_global', '$name')" ) );
$this->DB->execute();
while ( $r = $this->DB->fetch() )
{
if ( $r['cache_value_1'] == 'skin_global' )
{
$skin_global = $r['cache_content'];
}
else
{
$other_skin = $r['cache_content'];
}
}
if ( empty( $new_skin_global_name ) OR ! class_exists( $new_skin_global_name ) )
{
eval($skin_global);
}
$new_skin_global_name = $this->_getSkinHooks( 'skin_global', $skin_global_name, $id );
$this->compiled_templates['skin_global'] = new $new_skin_global_name( $this->registry );
# Add to loaded templates
$this->loaded_templates[ $skin_global_name ] = $new_skin_global_name;
}
else
{
//-----------------------------------------
// Skin global is loaded..
//-----------------------------------------
if ( $name == 'skin_global' and in_array( $skin_global_name, $this->loaded_templates ) )
{
return;
}
//-----------------------------------------
// Load the skin, man
//-----------------------------------------
$template = $this->DB->buildAndFetch( array( 'select' => '*',
'from' => 'skin_cache',
'where' => "cache_set_id=".$id." AND cache_value_1='$name'" ) );
$other_skin = $template['cache_content'];
}
eval($other_skin);
if ( $name == 'skin_global' )
{
$new_skin_global_name = $this->_getSkinHooks( 'skin_global', $skin_global_name, $id );
$this->compiled_templates['skin_global'] = new $new_skin_global_name( $this->registry );
# Add to loaded templates
$this->loaded_templates[ $skin_global_name ] = $new_skin_global_name;
}
else
{
$new_full_name = $this->_getSkinHooks( $name, $full_name, $id );
if( class_exists( $new_full_name ) )
{
$this->compiled_templates[ $name ] = new $new_full_name( $this->registry );
# Add to loaded templates
$this->loaded_templates[ $full_name ] = $new_full_name;
}
}
}
}
/**
* Load the template bit from the PHP file
*
* @access public
* @param string Name of the PHP file (sans .php)
* @param string Name of the class
* @param int Skin ID
* @return boolean
*/
public function load_template_from_php( $name='skin_global', $full_name='skin_global_0', $id='root' )
{
$_NOW = IPSDebug::getMemoryDebugFlag();
//-----------------------------------------
// IN_DEV?
//-----------------------------------------
if ( IN_DEV )
{
//-----------------------------------------
// Load functions and cache classes
//-----------------------------------------
if ( ! isset( $this->_skinFunctions ) || ! is_object( $this->_skinFunctions ) )
{
require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinFunctions.php' );/*noLibHook*/
require_once( IPS_ROOT_PATH . 'sources/classes/skins/skinCaching.php' );/*noLibHook*/
$this->_skinFunctions = new skinCaching( $this->registry );
}
# Load the master skin template
$this->_skinFunctions->loadMasterSkinTemplate( $name, $id );
}
else
{
//-----------------------------------------
// File exist?
//-----------------------------------------