Version 3.2.3
This commit is contained in:
1 parent
ae5c01cc78
commit
78706903a2
2641 files changed
+228363
-201264
No files matched your search
@@ -3,18 +3,18 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.1.4
|
||||
* IP.Board v3.2.3
|
||||
* Registry class for setup
|
||||
* Last Updated: $Date: 2010-09-15 17:14:23 -0400 (Wed, 15 Sep 2010) $
|
||||
* Last Updated: $Date: 2011-08-26 11:38:16 -0400 (Fri, 26 Aug 2011) $
|
||||
* </pre>
|
||||
*
|
||||
* @author Matt Mecham
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/community/board/license.html
|
||||
* @license This is NULLED!
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @link http://hatynka.in
|
||||
* @since 1st December 2008
|
||||
* @version $Revision: 6881 $
|
||||
* @version $Revision: 9420 $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -171,7 +171,7 @@ class ipsRegistry
|
||||
* Custom destructor
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
* @return @e void
|
||||
*/
|
||||
static public function __myDestruct()
|
||||
{
|
||||
@@ -188,7 +188,7 @@ class ipsRegistry
|
||||
* Initiate the registry
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
* @return @e void
|
||||
*/
|
||||
public static function init()
|
||||
{
|
||||
@@ -198,15 +198,19 @@ class ipsRegistry
|
||||
}
|
||||
|
||||
self::$initiated = TRUE;
|
||||
|
||||
/* Log current upgrade step */
|
||||
self::logUpgradeStep();
|
||||
|
||||
/* Load static classes */
|
||||
require IPS_ROOT_PATH . "sources/base/core.php";
|
||||
require IPS_ROOT_PATH . "setup/sources/base/setup.php";
|
||||
require( IPS_ROOT_PATH . "sources/base/core.php" );/*noLibHook*/
|
||||
require( IPS_ROOT_PATH . "sources/base/ipsMember.php" );/*noLibHook*/
|
||||
require( IPS_ROOT_PATH . "setup/sources/base/setup.php" );/*noLibHook*/
|
||||
|
||||
/* Load conf global and set up DB */
|
||||
if ( IPS_IS_UPGRADER )
|
||||
{
|
||||
if ( ! file_exists( DOC_IPS_ROOT_PATH . "conf_global.php" ) )
|
||||
if ( ! is_file( DOC_IPS_ROOT_PATH . "conf_global.php" ) )
|
||||
{
|
||||
print "Файл " . DOC_IPS_ROOT_PATH . "conf_global.php не найден!";
|
||||
exit();
|
||||
@@ -236,7 +240,7 @@ class ipsRegistry
|
||||
define( 'IPS_CACHE_PATH', DOC_IPS_ROOT_PATH );
|
||||
}
|
||||
|
||||
require IPS_ROOT_PATH . "setup/sources/base/install.php";
|
||||
require IPS_ROOT_PATH . "setup/sources/base/install.php";/*noLibHook*/
|
||||
}
|
||||
|
||||
/* Input set up... */
|
||||
@@ -299,7 +303,7 @@ class ipsRegistry
|
||||
$file = '1xx.php';
|
||||
}
|
||||
|
||||
require_once( IPS_ROOT_PATH . 'setup/sources/legacy/' . $file );
|
||||
require_once( IPS_ROOT_PATH . 'setup/sources/legacy/' . $file );/*noLibHook*/
|
||||
self::instance()->setClass( 'legacy', new upgradeLegacy( self::instance() ) );
|
||||
}
|
||||
|
||||
@@ -310,7 +314,7 @@ class ipsRegistry
|
||||
IPSSetUp::thawSavedData();
|
||||
|
||||
/* Gather other classes */
|
||||
require_once( IPS_ROOT_PATH . 'setup/sources/classes/output/output.php' );
|
||||
require_once( IPS_ROOT_PATH . 'setup/sources/classes/output/output.php' );/*noLibHook*/
|
||||
|
||||
self::instance()->setClass( 'output', new output( self::instance(), TRUE ) );
|
||||
|
||||
@@ -339,7 +343,7 @@ class ipsRegistry
|
||||
else
|
||||
{
|
||||
# Installer locked?
|
||||
if ( file_exists( DOC_IPS_ROOT_PATH . 'cache/installer_lock.php' ) )
|
||||
if ( is_file( DOC_IPS_ROOT_PATH . 'cache/installer_lock.php' ) )
|
||||
{
|
||||
self::getClass('output')->setTitle( "Установка: Ошибка" );
|
||||
self::getClass('output')->setNextAction( '' );
|
||||
@@ -349,20 +353,33 @@ class ipsRegistry
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Log the step we are in the upgrade routine
|
||||
*/
|
||||
static public function logUpgradeStep()
|
||||
{
|
||||
$_log = date('r') . "\n";
|
||||
$_log .= $_SERVER['REQUEST_URI'] . "\n";
|
||||
|
||||
$_filename = "UPGRADE_LOG_" . date('d_m_Y') . '.cgi';
|
||||
|
||||
file_put_contents( DOC_IPS_ROOT_PATH . 'cache/' . $_filename, $_log, FILE_APPEND );
|
||||
}
|
||||
|
||||
/**
|
||||
* Load conf_global
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
* @return @e void
|
||||
*/
|
||||
static public function loadConfGlobal()
|
||||
{
|
||||
/* Load config file */
|
||||
if ( file_exists( DOC_IPS_ROOT_PATH . "conf_global.php" ) )
|
||||
if ( is_file( DOC_IPS_ROOT_PATH . 'conf_global.php' ) )
|
||||
{
|
||||
$INFO = array();
|
||||
require DOC_IPS_ROOT_PATH . "conf_global.php";
|
||||
require( DOC_IPS_ROOT_PATH . 'conf_global.php' );/*noLibHook*/
|
||||
|
||||
if ( is_array( $INFO ) && count( $INFO ) )
|
||||
{
|
||||
@@ -378,7 +395,7 @@ class ipsRegistry
|
||||
* Set database handle
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
* @return @e void
|
||||
*/
|
||||
static public function setDBHandle()
|
||||
{
|
||||
@@ -391,7 +408,7 @@ class ipsRegistry
|
||||
*
|
||||
* @access public
|
||||
* @param string Section key
|
||||
* @return void
|
||||
* @return @e void
|
||||
*/
|
||||
static public function autoLoadNextAction( $section )
|
||||
{
|
||||
@@ -400,7 +417,7 @@ class ipsRegistry
|
||||
|
||||
$_class = IPS_APP_COMPONENT . '_' . $section;
|
||||
|
||||
require_once( IPS_ROOT_PATH . 'setup/applications/' . IPS_APP_COMPONENT . '/sections/' . $section . '.php' );
|
||||
require_once( IPS_ROOT_PATH . 'setup/applications/' . IPS_APP_COMPONENT . '/sections/' . $section . '.php' );/*noLibHook*/
|
||||
$action = new $_class();
|
||||
$action->makeRegistryShortcuts( self::instance() );
|
||||
$action->doExecute( self::instance() );
|
||||
@@ -416,7 +433,7 @@ class ipsRegistry
|
||||
static public function readGlobalConfig()
|
||||
{
|
||||
/* Fetch core writeable files */
|
||||
require_once( IPS_KERNEL_PATH . 'classXML.php' );
|
||||
require_once( IPS_KERNEL_PATH . 'classXML.php' );/*noLibHook*/
|
||||
$xml = new classXML( IPSSetUp::charSet );
|
||||
|
||||
try
|
||||
@@ -480,18 +497,50 @@ class ipsRegistry
|
||||
return isset( self::$_config[ $key ] ) ? self::$_config[ $key ] : FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Grab the app class file
|
||||
*
|
||||
* @param string $app Application to check for app class
|
||||
* @return mixed Null if invalid or no app passed, otherwise app class object
|
||||
*/
|
||||
public static function getAppClass( $app='' )
|
||||
{
|
||||
if( !$app OR !is_string($app) )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
# Load app class
|
||||
if ( ! isset( self::$app_class[ $app ] ) )
|
||||
{
|
||||
self::$app_class[ $app ] = null;
|
||||
|
||||
$_file = IPSLib::getAppDir( $app ) . '/app_class_' . $app . '.php';
|
||||
$_name = 'app_class_' . $app;
|
||||
|
||||
if ( is_file( $_file ) )
|
||||
{
|
||||
$classToLoad = IPSLib::loadLibrary( $_file, $_name, $app );
|
||||
|
||||
self::$app_class[ $app ] = new $classToLoad( self::instance() );
|
||||
}
|
||||
}
|
||||
|
||||
return self::$app_class[ $app ];
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads application's core variables (if required)
|
||||
*
|
||||
* @access public
|
||||
* @param string App key (dir.. that's directory, not duuhr)
|
||||
* @return void
|
||||
* @return @e void
|
||||
*/
|
||||
static public function _loadCoreVariables()
|
||||
{
|
||||
if ( ! is_object( self::$_masterCoreVariables['__CLASS__'] ) )
|
||||
{
|
||||
require_once( IPS_ROOT_PATH . 'extensions/coreVariables.php' );
|
||||
require_once( IPS_ROOT_PATH . 'extensions/coreVariables.php' );/*noLibHook*/
|
||||
|
||||
/* Add handle */
|
||||
self::$_masterCoreVariables['__CLASS__'] = new coreVariables();
|
||||
@@ -542,15 +591,15 @@ class ipsRegistry
|
||||
*
|
||||
* @access private
|
||||
* @param string App key (dir.. that's directory, not duuhr)
|
||||
* @return void
|
||||
* @return @e void
|
||||
*/
|
||||
static private function _loadAppCoreVariables( $appDir )
|
||||
{
|
||||
if ( ! isset( self::$_coreVariables[ $appDir ] ) )
|
||||
{
|
||||
if( file_exists( IPSLib::getAppDir( $appDir ) . '/extensions/coreVariables.php' ) )
|
||||
if( is_file( IPSLib::getAppDir( $appDir ) . '/extensions/coreVariables.php' ) )
|
||||
{
|
||||
require( IPSLib::getAppDir( $appDir ) . '/extensions/coreVariables.php' );
|
||||
require( IPSLib::getAppDir( $appDir ) . '/extensions/coreVariables.php' );/*noLibHook*/
|
||||
|
||||
/* Add caches */
|
||||
self::$_coreVariables[ $appDir ]['cache'] = is_array( $CACHE ) ? $CACHE : array();
|
||||
@@ -589,7 +638,7 @@ class ipsRegistry
|
||||
* @access public
|
||||
* @param string Key
|
||||
* @param object Value
|
||||
* @return void
|
||||
* @return @e void
|
||||
*/
|
||||
static public function setClass( $key='', $value='' )
|
||||
{
|
||||
@@ -632,24 +681,24 @@ class ipsRegistry
|
||||
throw new Exception( "$key не является объектом" );
|
||||
break;
|
||||
case 'class_captcha':
|
||||
require_once( IPS_KERNEL_PATH . 'classCaptcha.php' );
|
||||
require_once( IPS_KERNEL_PATH . 'classCaptcha.php' );/*noLibHook*/
|
||||
self::$classes['class_captcha'] = new classCaptcha( self::instance() );
|
||||
break;
|
||||
case 'templateEngine':
|
||||
require_once( IPS_KERNEL_PATH . 'classTemplateEngine.php' );
|
||||
require_once( IPS_KERNEL_PATH . 'classTemplateEngine.php' );/*noLibHook*/
|
||||
self::$classes['templateEngine'] = new classTemplate( IPS_ROOT_PATH . 'sources/template_plugins' );
|
||||
break;
|
||||
case 'class_localization':
|
||||
require_once( IPS_ROOT_PATH . 'sources/classes/class_localization.php' );
|
||||
require_once( IPS_ROOT_PATH . 'sources/classes/class_localization.php' );/*noLibHook*/
|
||||
self::$classes['class_localization'] = new class_localization( self::instance() );
|
||||
break;
|
||||
case 'permissions':
|
||||
require_once( IPS_ROOT_PATH . 'sources/classes/class_public_permissions.php' );
|
||||
require_once( IPS_ROOT_PATH . 'sources/classes/class_public_permissions.php' );/*noLibHook*/
|
||||
self::$classes['permissions'] = new classPublicPermissions( self::instance() );
|
||||
break;
|
||||
/* Yes I know this is forums app and not global, but it's still called so much this is a good idea */
|
||||
case 'class_forums':
|
||||
require_once( IPSLib::getAppDir( 'forums' ) . "/sources/classes/forums/class_forums.php" );
|
||||
require_once( IPSLib::getAppDir( 'forums' ) . "/sources/classes/forums/class_forums.php" );/*noLibHook*/
|
||||
self::$classes['class_forums'] = new class_forums( self::instance() );
|
||||
self::$classes['class_forums']->strip_invisible = true;
|
||||
self::$classes['class_forums']->forumsInit();
|
||||
@@ -846,7 +895,7 @@ class ipsRegistry
|
||||
* Check to see if we are initialized
|
||||
*
|
||||
* @access protected
|
||||
* @return void
|
||||
* @return @e void
|
||||
*/
|
||||
protected function checkForInit()
|
||||
{
|
||||
@@ -861,7 +910,7 @@ class ipsRegistry
|
||||
/**
|
||||
* Set up request redirect stuff
|
||||
*
|
||||
* @return void
|
||||
* @return @e void
|
||||
* @author MattMecham
|
||||
* @access protected
|
||||
*/
|
||||
@@ -879,7 +928,7 @@ class ipsRegistry
|
||||
/**
|
||||
* Set up settings
|
||||
*
|
||||
* @return void
|
||||
* @return @e void
|
||||
* @author MattMecham
|
||||
* @access protected
|
||||
*/
|
||||
@@ -957,7 +1006,7 @@ class ipsRegistry
|
||||
/**
|
||||
* Check caches
|
||||
*
|
||||
* @return void
|
||||
* @return @e void
|
||||
* @author MattMecham
|
||||
* @access protected
|
||||
*/
|
||||
@@ -1000,13 +1049,49 @@ class ipsRegistry
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$app_cache = self::$handles['caches']->getCache('app_cache');
|
||||
|
||||
//-----------------------------------------
|
||||
// Build app data and APP specific load requests
|
||||
//-----------------------------------------
|
||||
|
||||
if( is_array($app_cache) AND count($app_cache) )
|
||||
{
|
||||
foreach( $app_cache as $_app_dir => $_app_data )
|
||||
{
|
||||
if ( !IPS_IS_TASK AND ( IPS_AREA == 'public' && ! $_app_data['app_public_title'] ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$_app_data['app_public_title'] = ( $_app_data['app_public_title'] ) ? $_app_data['app_public_title'] : $_app_data['app_title'];
|
||||
self::$applications[ $_app_dir ] = $_app_data;
|
||||
}
|
||||
}
|
||||
|
||||
/* Sort by position */
|
||||
uasort( self::$applications, 'ipsRegistry::_appPositionSort' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort by position
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
protected static function _appPositionSort( $a, $b )
|
||||
{
|
||||
$a['app_position'] = ( isset( $a['app_position'] ) ) ? $a['app_position'] : 0;
|
||||
$b['app_position'] = ( isset( $b['app_position'] ) ) ? $b['app_position'] : 0;
|
||||
|
||||
return ( $a['app_position'] > $b['app_position'] ) ? +1 : -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ips_base_Registry
|
||||
*
|
||||
**/
|
||||
*/
|
||||
abstract class ips_base_Registry
|
||||
{
|
||||
/**
|
||||
@@ -1014,7 +1099,7 @@ abstract class ips_base_Registry
|
||||
*
|
||||
* @access protected
|
||||
* @var array
|
||||
**/
|
||||
*/
|
||||
protected $data_store = array();
|
||||
|
||||
/**
|
||||
@@ -1025,7 +1110,7 @@ abstract class ips_base_Registry
|
||||
* @access public
|
||||
* @param mixed $key
|
||||
* @return mixed
|
||||
**/
|
||||
*/
|
||||
protected function get( $key )
|
||||
{
|
||||
if( isset( $this->data_store[ $key ] ) )
|
||||
@@ -1047,7 +1132,7 @@ abstract class ips_base_Registry
|
||||
* @param mixed $key
|
||||
* @param mixed $val
|
||||
* @return mixed
|
||||
**/
|
||||
*/
|
||||
protected function set( $key, $val )
|
||||
{
|
||||
$this->data_store[ $key ] = $val;
|
||||
@@ -1187,7 +1272,7 @@ class ips_DBRegistry extends ips_base_Registry
|
||||
* @access public
|
||||
* @param object $db_driver DB instance
|
||||
* @param string $key Key of the db connection to check
|
||||
* @return void
|
||||
* @return @e void
|
||||
*/
|
||||
|
||||
static function setDB( $db_driver, $key='' )
|
||||
@@ -1200,7 +1285,7 @@ class ips_DBRegistry extends ips_base_Registry
|
||||
/* Fix up settings */
|
||||
if ( ! class_exists( 'dbMain' ) )
|
||||
{
|
||||
require_once ( IPS_KERNEL_PATH . 'classDb' . ucwords($db_driver) . ".php" );
|
||||
require_once ( IPS_KERNEL_PATH . 'classDb' . ucwords($db_driver) . ".php" );/*noLibHook*/
|
||||
}
|
||||
|
||||
$classname = "db_driver_" . $db_driver;
|
||||
@@ -1290,7 +1375,7 @@ class ips_DBRegistry extends ips_base_Registry
|
||||
|
||||
IPSDebug::addMessage( "* Checking for query cache file: " . $file );
|
||||
|
||||
if ( file_exists( $file ) )
|
||||
if ( is_file( $file ) )
|
||||
{
|
||||
self::getDB( $key )->loadCacheFile( $file, $class, TRUE );
|
||||
return TRUE;
|
||||
@@ -1409,7 +1494,7 @@ class ips_CacheRegistry extends ips_base_Registry
|
||||
* Initialize class
|
||||
*
|
||||
* @access private
|
||||
* @return void
|
||||
* @return @e void
|
||||
*/
|
||||
private function init()
|
||||
{
|
||||
@@ -1423,8 +1508,8 @@ class ips_CacheRegistry extends ips_base_Registry
|
||||
|
||||
if( function_exists('eaccelerator_get') AND ipsRegistry::$settings['use_eaccelerator'] == 1 )
|
||||
{
|
||||
require IPS_KERNEL_PATH.'interfaces/interfaceCache.php';
|
||||
require IPS_KERNEL_PATH.'classCacheEaccelerator.php';
|
||||
require IPS_KERNEL_PATH.'interfaces/interfaceCache.php';/*noLibHook*/
|
||||
require IPS_KERNEL_PATH.'classCacheEaccelerator.php';/*noLibHook*/
|
||||
self::$cacheLib = new classCacheEaccelerator( ipsRegistry::$settings['board_url'] );
|
||||
}
|
||||
|
||||
@@ -1434,8 +1519,8 @@ class ips_CacheRegistry extends ips_base_Registry
|
||||
|
||||
else if( function_exists('memcache_connect') AND ipsRegistry::$settings['use_memcache'] == 1 )
|
||||
{
|
||||
require IPS_KERNEL_PATH.'interfaces/interfaceCache.php';
|
||||
require IPS_KERNEL_PATH.'classCacheMemcache.php';
|
||||
require IPS_KERNEL_PATH.'interfaces/interfaceCache.php';/*noLibHook*/
|
||||
require IPS_KERNEL_PATH.'classCacheMemcache.php';/*noLibHook*/
|
||||
self::$cacheLib = new classCacheMemcache( ipsRegistry::$settings['board_url'], ipsRegistry::$settings );
|
||||
}
|
||||
|
||||
@@ -1445,8 +1530,8 @@ class ips_CacheRegistry extends ips_base_Registry
|
||||
|
||||
else if( function_exists('xcache_get') AND ipsRegistry::$settings['use_xcache'] == 1 )
|
||||
{
|
||||
require IPS_KERNEL_PATH.'interfaces/interfaceCache.php';
|
||||
require IPS_KERNEL_PATH.'classCacheXcache.php';
|
||||
require IPS_KERNEL_PATH.'interfaces/interfaceCache.php';/*noLibHook*/
|
||||
require IPS_KERNEL_PATH.'classCacheXcache.php';/*noLibHook*/
|
||||
self::$cacheLib = new classCacheXcache( ipsRegistry::$settings['board_url'] );
|
||||
}
|
||||
|
||||
@@ -1456,8 +1541,8 @@ class ips_CacheRegistry extends ips_base_Registry
|
||||
|
||||
else if( function_exists('apc_fetch') AND ipsRegistry::$settings['use_apc'] == 1 )
|
||||
{
|
||||
require IPS_KERNEL_PATH.'interfaces/interfaceCache.php';
|
||||
require IPS_KERNEL_PATH.'classCacheApc.php';
|
||||
require IPS_KERNEL_PATH.'interfaces/interfaceCache.php';/*noLibHook*/
|
||||
require IPS_KERNEL_PATH.'classCacheApc.php';/*noLibHook*/
|
||||
self::$cacheLib = new classCacheApc( ipsRegistry::$settings['board_url'] );
|
||||
}
|
||||
|
||||
@@ -1467,8 +1552,8 @@ class ips_CacheRegistry extends ips_base_Registry
|
||||
|
||||
else if( ipsRegistry::$settings['use_diskcache'] == 1 )
|
||||
{
|
||||
require IPS_KERNEL_PATH.'interfaces/interfaceCache.php';
|
||||
require IPS_KERNEL_PATH.'classCacheDiskcache.php';
|
||||
require IPS_KERNEL_PATH.'interfaces/interfaceCache.php';/*noLibHook*/
|
||||
require IPS_KERNEL_PATH.'classCacheDiskcache.php';/*noLibHook*/
|
||||
self::$cacheLib = new classCacheDiskcache( ipsRegistry::$settings['board_url'] );
|
||||
}
|
||||
|
||||
@@ -1617,7 +1702,7 @@ class ips_CacheRegistry extends ips_base_Registry
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( strstr( $temp_cache[$key], "a:" ) )
|
||||
if ( is_string($temp_cache[$key]) AND strstr( $temp_cache[$key], "a:" ) !== false )
|
||||
{
|
||||
self::instance()->data_store[ $key ] = unserialize( $temp_cache[$key] );
|
||||
}
|
||||
@@ -1700,7 +1785,7 @@ class ips_CacheRegistry extends ips_base_Registry
|
||||
* @access protected
|
||||
* @param string Cache Key
|
||||
* @param mixed Cache value (typically an array)
|
||||
* @return void
|
||||
* @return @e void
|
||||
*/
|
||||
protected function cacheSet( $key, $val )
|
||||
{
|
||||
@@ -1738,7 +1823,7 @@ class ips_CacheRegistry extends ips_base_Registry
|
||||
}
|
||||
}
|
||||
|
||||
ipsRegistry::DB()->no_escape_fields['cs_key'] = 1;
|
||||
ipsRegistry::DB()->preventAddSlashes( array( 'cs_key' => 1 ) );
|
||||
|
||||
if ( $this->save_options['donow'] )
|
||||
{
|
||||
@@ -1803,16 +1888,22 @@ class ips_CacheRegistry extends ips_base_Registry
|
||||
{
|
||||
if ( ! in_array( $key, array_keys( self::instance()->data_store ) ) )
|
||||
{
|
||||
if ( IPS_IS_UPGRADER )
|
||||
{
|
||||
self::_loadCaches( array( $key ) );
|
||||
}
|
||||
|
||||
$cache = self::instance()->data_store[ $key ];
|
||||
}
|
||||
else
|
||||
{
|
||||
$cache = self::instance()->get( $key );
|
||||
$cache = self::instance()->data_store[ $key ];
|
||||
}
|
||||
|
||||
return $cache;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fetch all the caches as a reference
|
||||
*
|
||||
@@ -1830,7 +1921,7 @@ class ips_CacheRegistry extends ips_base_Registry
|
||||
* @access public
|
||||
* @param string Cache key
|
||||
* @param mixed Cache value
|
||||
* @return void
|
||||
* @return @e void
|
||||
*/
|
||||
static public function updateCacheWithoutSaving( $key, $value )
|
||||
{
|
||||
@@ -1877,86 +1968,81 @@ class ips_CacheRegistry extends ips_base_Registry
|
||||
* @access public
|
||||
* @param string Cache key
|
||||
* @param string Application
|
||||
* @return void
|
||||
* @return @e void
|
||||
*/
|
||||
static public function rebuildCache( $key, $app='' )
|
||||
{
|
||||
$app = IPSText::alphanumericalClean( $app );
|
||||
|
||||
/* INIT */
|
||||
$app = IPSText::alphanumericalClean( $app );
|
||||
$_caches = array();
|
||||
|
||||
if( $app )
|
||||
{
|
||||
if ( $app == 'global' )
|
||||
{
|
||||
$CACHE = ipsRegistry::_fetchCoreVariables( 'cache' );
|
||||
$_caches = ipsRegistry::_fetchCoreVariables( 'cache' );
|
||||
}
|
||||
else
|
||||
{
|
||||
$CACHE = ipsRegistry::_fetchAppCoreVariables( $app, 'cache' );
|
||||
}
|
||||
|
||||
if ( $CACHE[ $key ] )
|
||||
{
|
||||
$file_to_check = $CACHE[ $key ]['recache_file'];
|
||||
|
||||
if ( $file_to_check AND is_file($file_to_check) AND file_exists( $file_to_check ) )
|
||||
/* isset there is needed to prevent issues on applications installation */
|
||||
if( isset( ipsRegistry::$applications[$app] ) && !IPSLib::appIsInstalled($app) )
|
||||
{
|
||||
$_class = $CACHE[ $key ]['recache_class'];
|
||||
$_func = $CACHE[ $key ]['recache_function'];
|
||||
|
||||
require_once( $file_to_check );
|
||||
|
||||
if( class_exists( $_class ) )
|
||||
{
|
||||
$recache = new $_class( ipsRegistry::instance() );
|
||||
|
||||
if( method_exists( $recache, 'makeRegistryShortcuts' ) )
|
||||
{
|
||||
$recache->makeRegistryShortcuts( ipsRegistry::instance() );
|
||||
}
|
||||
|
||||
$recache->$_func();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
$_caches = ipsRegistry::_fetchAppCoreVariables( $app, 'cache' );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
/* Get all caches from all apps */
|
||||
$_caches = ipsRegistry::_fetchCoreVariables( 'cache' );
|
||||
|
||||
foreach( ipsRegistry::$applications as $appDir => $appData )
|
||||
{
|
||||
foreach( new DirectoryIterator( IPS_ROOT_PATH . 'applications' ) as $application )
|
||||
$CACHE = ipsRegistry::_fetchAppCoreVariables( $appDir, 'cache' );
|
||||
|
||||
if ( is_array( $CACHE ) )
|
||||
{
|
||||
if( $application->isDir() AND !$application->isDot() )
|
||||
{
|
||||
$CACHE = ipsRegistry::_fetchAppCoreVariables( IPS_APP_COMPONENT, 'cache' );
|
||||
|
||||
if ( is_array( $CACHE ) )
|
||||
{
|
||||
if ( $CACHE[ $key ] )
|
||||
{
|
||||
$file_to_check = $CACHE[ $key ]['recache_file'];
|
||||
|
||||
if ( $file_to_check AND file_exists( $file_to_check ) )
|
||||
{
|
||||
$_class = $CACHE[ $key ]['recache_class'];
|
||||
$_func = $CACHE[ $key ]['recache_function'];
|
||||
|
||||
require_once( $file_to_check );
|
||||
$recache = new $_class( ipsRegistry::instance() );
|
||||
|
||||
if( method_exists( $recache, 'makeRegistryShortcuts' ) )
|
||||
{
|
||||
$recache->makeRegistryShortcuts( ipsRegistry::instance() );
|
||||
}
|
||||
|
||||
$recache->$_func();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
$_caches = array_merge( $_caches, $CACHE );
|
||||
}
|
||||
} catch ( Exception $e ) {}
|
||||
}
|
||||
}
|
||||
|
||||
/* Rebuild the cache, if found */
|
||||
if( isset( $_caches[ $key ] ) )
|
||||
{
|
||||
$file_to_check = $_caches[ $key ]['recache_file'];
|
||||
|
||||
if ( $file_to_check AND is_file( $file_to_check ) )
|
||||
{
|
||||
$_func = $_caches[ $key ]['recache_function'];
|
||||
|
||||
/* Hackish way to check for action overloader */
|
||||
if ( strpos( $file_to_check, '/modules_' ) !== FALSE )
|
||||
{
|
||||
$_class = IPSLib::loadActionOverloader( $file_to_check, $_caches[ $key ]['recache_class'] );
|
||||
}
|
||||
elseif ( $app )
|
||||
{
|
||||
$_class = IPSLib::loadLibrary( $file_to_check, $_caches[ $key ]['recache_class'], ($app == 'global') ? 'core' : $app );
|
||||
}
|
||||
|
||||
/* Fallback */
|
||||
if ( !$_class )
|
||||
{
|
||||
$_class = $_caches[ $key ]['recache_class'];
|
||||
}
|
||||
|
||||
$recache = new $_class( ipsRegistry::instance() );
|
||||
|
||||
if( method_exists( $recache, 'makeRegistryShortcuts' ) )
|
||||
{
|
||||
$recache->makeRegistryShortcuts( ipsRegistry::instance() );
|
||||
}
|
||||
|
||||
$recache->$_func();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2171,7 +2257,7 @@ class ips_MemberRegistry extends ips_base_Registry
|
||||
* Destructor
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
* @return @e void
|
||||
*/
|
||||
public function __myDestruct()
|
||||
{
|
||||
@@ -2181,7 +2267,7 @@ class ips_MemberRegistry extends ips_base_Registry
|
||||
* Our singleton INIT function
|
||||
*
|
||||
* @access protected
|
||||
* @return void
|
||||
* @return @e void
|
||||
*/
|
||||
protected static function init()
|
||||
{
|
||||
@@ -2195,12 +2281,7 @@ class ips_MemberRegistry extends ips_base_Registry
|
||||
{
|
||||
foreach( array_reverse( explode( ',', my_getenv('HTTP_X_FORWARDED_FOR') ) ) as $x_f )
|
||||
{
|
||||
$x_f = trim($x_f);
|
||||
|
||||
if ( preg_match( '/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/', $x_f ) )
|
||||
{
|
||||
$addrs[] = $x_f;
|
||||
}
|
||||
$addrs[] = trim($x_f);
|
||||
}
|
||||
|
||||
$addrs[] = my_getenv('HTTP_CLIENT_IP');
|
||||
@@ -2216,16 +2297,24 @@ class ips_MemberRegistry extends ips_base_Registry
|
||||
|
||||
foreach ( $addrs as $ip )
|
||||
{
|
||||
if ( $ip )
|
||||
//-----------------------------------------
|
||||
// IP v4
|
||||
//-----------------------------------------
|
||||
|
||||
if ( IPSLib::validateIPv4( $ip ) )
|
||||
{
|
||||
preg_match( "/^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/", $ip, $match );
|
||||
|
||||
self::instance()->ip_address = $match[1].'.'.$match[2].'.'.$match[3].'.'.$match[4];
|
||||
|
||||
if ( self::instance()->ip_address AND self::instance()->ip_address != '...' )
|
||||
{
|
||||
break;
|
||||
}
|
||||
self::instance()->ip_address = $ip;
|
||||
break;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// IP v6
|
||||
//-----------------------------------------
|
||||
|
||||
else if ( IPSLib::validateIPv6( $ip ) )
|
||||
{
|
||||
self::instance()->ip_address = $ip;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2233,7 +2322,7 @@ class ips_MemberRegistry extends ips_base_Registry
|
||||
// Make sure we take a valid IP address
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ( ! self::instance()->ip_address OR self::instance()->ip_address == '...' ) AND ! isset( $_SERVER['SHELL'] ) AND $_SERVER['SESSIONNAME'] != 'Console' )
|
||||
if ( !self::instance()->ip_address AND ! isset( $_SERVER['SHELL'] ) AND $_SERVER['SESSIONNAME'] != 'Console' )
|
||||
{
|
||||
print "Невозможно определить ваш IPv4 адрес";
|
||||
exit();
|
||||
@@ -2241,7 +2330,7 @@ class ips_MemberRegistry extends ips_base_Registry
|
||||
|
||||
if ( IPS_IS_UPGRADER )
|
||||
{
|
||||
require_once( IPS_ROOT_PATH . "setup/sources/classes/session/sessions.php" );
|
||||
require_once( IPS_ROOT_PATH . "setup/sources/classes/session/sessions.php" );/*noLibHook*/
|
||||
|
||||
self::$session_class = new sessions();
|
||||
}
|
||||
@@ -2281,7 +2370,7 @@ class ips_MemberRegistry extends ips_base_Registry
|
||||
* @access public
|
||||
* @param string Key
|
||||
* @param mixed Value
|
||||
* @return void
|
||||
* @return @e void
|
||||
*/
|
||||
static public function setProperty( $key, $value )
|
||||
{
|
||||
@@ -2300,11 +2389,10 @@ class ips_MemberRegistry extends ips_base_Registry
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the current member
|
||||
* Set current member to the member ID specified
|
||||
*
|
||||
* @access public
|
||||
* @param int Member ID
|
||||
* @return void
|
||||
* @param integer Member ID
|
||||
* @return @e void
|
||||
*/
|
||||
static public function setMember( $member_id )
|
||||
{
|
||||
@@ -2322,8 +2410,10 @@ class ips_MemberRegistry extends ips_base_Registry
|
||||
if ( $member_id )
|
||||
{
|
||||
self::instance()->data_store = IPSMember::load( $member_id, 'extendedProfile,customFields,groups,itemMarkingStorage' );
|
||||
}
|
||||
|
||||
if ( self::instance()->data_store['member_id'] )
|
||||
/* Got a member ID? */
|
||||
if ( !empty($member_id) && self::instance()->data_store['member_id'] )
|
||||
{
|
||||
self::setUpMember();
|
||||
|
||||
@@ -2334,22 +2424,11 @@ class ips_MemberRegistry extends ips_base_Registry
|
||||
{
|
||||
self::instance()->data_store = IPSMember::setUpGuest();
|
||||
|
||||
self::instance()->perm_id = ( isset(self::instance()->data_store['org_perm_id']) AND self::instance()->data_store['org_perm_id'] ) ? self::instance()->data_store['org_perm_id'] : self::instance()->data_store['g_perm_id'];
|
||||
self::instance()->perm_id_array = explode( ",", self::instance()->perm_id );
|
||||
|
||||
# Form hash
|
||||
self::instance()->form_hash = md5("этой строчки здесь нет");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
self::instance()->data_store = IPSMember::setUpGuest();
|
||||
|
||||
self::instance()->perm_id = ( isset(self::instance()->data_store['org_perm_id']) AND self::instance()->data_store['org_perm_id'] ) ? self::instance()->data_store['org_perm_id'] : self::instance()->data_store['g_perm_id'];
|
||||
self::instance()->perm_id_array = explode( ",", self::instance()->perm_id );
|
||||
self::instance()->perm_id = !empty(self::instance()->data_store['org_perm_id']) ? self::instance()->data_store['org_perm_id'] : self::instance()->data_store['g_perm_id'];
|
||||
self::instance()->perm_id_array = explode( ',', self::instance()->perm_id );
|
||||
|
||||
# Form hash
|
||||
self::instance()->form_hash = md5("этой строчки здесь нет");
|
||||
self::instance()->form_hash = md5("this is only here to prevent it breaking on guests");
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
@@ -2469,7 +2548,7 @@ class ips_MemberRegistry extends ips_base_Registry
|
||||
* Set up a member
|
||||
*
|
||||
* @access private
|
||||
* @return void
|
||||
* @return @e void
|
||||
*/
|
||||
static public function setUpMember()
|
||||
{
|
||||
@@ -2494,4 +2573,4 @@ class ips_MemberRegistry extends ips_base_Registry
|
||||
self::instance()->perm_id = ( isset(self::instance()->data_store['org_perm_id']) AND self::instance()->data_store['org_perm_id'] ) ? self::instance()->data_store['org_perm_id'] : self::instance()->data_store['g_perm_id'];
|
||||
self::instance()->perm_id_array = explode( ",", self::instance()->perm_id );
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user