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,20 +3,20 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.1.4
|
||||
* IP.Board v3.2.3
|
||||
* Static SETUP Classes for IP.Board 3
|
||||
*
|
||||
* These classes are not required as objects.
|
||||
* Last Updated: $Date: 2010-11-15 11:39:10 -0500 (Mon, 15 Nov 2010) $
|
||||
* Last Updated: $Date: 2011-10-12 12:19:44 -0400 (Wed, 12 Oct 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: 7185 $
|
||||
* @version $Revision: 9605 $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -41,14 +41,7 @@ class IPSSetUp
|
||||
* @var string
|
||||
*/
|
||||
const minDb_mysql = '4.1.0';
|
||||
|
||||
/**
|
||||
* Min MSSQL Version
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const minDb_mssql = '10.0.0';
|
||||
|
||||
|
||||
/**
|
||||
* Min PHP Version
|
||||
*
|
||||
@@ -62,15 +55,7 @@ class IPSSetUp
|
||||
* @var string
|
||||
*/
|
||||
const prefDb_mysql = '5.0.0';
|
||||
|
||||
/**
|
||||
* Min MSSQL Version
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const prefDb_mssql = '10.0.0';
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Doc Char Set
|
||||
*
|
||||
@@ -130,13 +115,51 @@ class IPSSetUp
|
||||
*/
|
||||
static public function is200plus()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Check for cached value first
|
||||
//-----------------------------------------
|
||||
|
||||
if( defined('MAX_UPGRADE_VERSION_ID') )
|
||||
{
|
||||
if( MAX_UPGRADE_VERSION_ID < 20000 )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ipsRegistry::DB()->checkForField( 'upgrade_id', 'upgrade_history' ) )
|
||||
{
|
||||
/* Now, this table is created in the first step between 1.3 and 2.0, so check for contents */
|
||||
$test = ipsRegistry::DB()->buildAndFetch( array( 'select' => 'MAX(upgrade_version_id) as max',
|
||||
'from' => 'upgrade_history' ) );
|
||||
|
||||
if ( $test['max'] < 20000 )
|
||||
if( $test['max'] )
|
||||
{
|
||||
$key = $test['max'];
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( self::is130plus() === TRUE )
|
||||
{
|
||||
$key = '10003';
|
||||
}
|
||||
else if ( self::is120plus() === TRUE )
|
||||
{
|
||||
$key = '10002';
|
||||
}
|
||||
else
|
||||
{
|
||||
$key = '10001';
|
||||
}
|
||||
}
|
||||
|
||||
define( 'MAX_UPGRADE_VERSION_ID', $key );
|
||||
|
||||
if ( $key < 20000 )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
@@ -300,10 +323,10 @@ class IPSSetUp
|
||||
{
|
||||
foreach( $data as $num )
|
||||
{
|
||||
if ( file_exists( IPSLib::getAppDir( $app ) . '/setup/versions/upg_' . $num . '/version_class.php' ) )
|
||||
if ( is_file( IPSLib::getAppDir( $app ) . '/setup/versions/upg_' . $num . '/version_class.php' ) )
|
||||
{
|
||||
$_class = 'version_class_' . $num;
|
||||
require_once( IPSLib::getAppDir( $app ) . '/setup/versions/upg_' . $num . '/version_class.php' );
|
||||
$_class = 'version_class_' . $app . '_' . $num;
|
||||
require_once( IPSLib::getAppDir( $app ) . '/setup/versions/upg_' . $num . '/version_class.php' );/*noLibHook*/
|
||||
|
||||
$_tmp = new $_class( ipsRegistry::instance() );
|
||||
|
||||
@@ -458,7 +481,7 @@ class IPSSetUp
|
||||
/* Try and write the file */
|
||||
if ( $sqlData AND @file_put_contents( $fileName, str_replace( "\n\n", "\n", $sqlData ) ) )
|
||||
{
|
||||
@chmod( $fileName, 0777 );
|
||||
@chmod( $fileName, IPS_FILE_PERMISSION );
|
||||
return $fileName;
|
||||
}
|
||||
else
|
||||
@@ -498,6 +521,7 @@ class IPSSetUp
|
||||
* @access public
|
||||
* @param string SQL Query
|
||||
* @param string SQL Prefix
|
||||
* @todo We're not using MSSQL anymore, we should remove those preg_replace at some point or do we leave them if someone else writes MSSQL drivers?
|
||||
*/
|
||||
static public function addPrefixToQuery( $query, $prefix )
|
||||
{
|
||||
@@ -506,7 +530,9 @@ class IPSSetUp
|
||||
/* Remove default ibf_ from < 3.0.0 files */
|
||||
if ( strstr( $query, 'ibf' ) )
|
||||
{
|
||||
$query = preg_replace("/\sibf_(\S+?)([\s\.,]|$)/", " \\1\\2", $query);
|
||||
// This strips the prefix (if it's ibf_) even when we manually add it. I checked and none of the previous upgrade routines have 'ibf_' hardcoded in them
|
||||
// so we need to not strip it automatically here otherwise anyone with ibf_ prefix will have issues.
|
||||
//$query = preg_replace("/\sibf_(\S+?)([\s\.,]|$)/", " \\1\\2", $query);
|
||||
}
|
||||
|
||||
$query = preg_replace( "#^CREATE TABLE(?:\s+?)?(\S+)#is" , "CREATE TABLE " . $prefix."\\1 ", $query );
|
||||
@@ -515,6 +541,7 @@ class IPSSetUp
|
||||
$query = preg_replace( "#^TRUNCATE TABLE(?:\s+?)?(\S+)(\s+?)?#i", "TRUNCATE TABLE ". $prefix."\\1 ", $query );
|
||||
$query = preg_replace( "#^DELETE FROM(?:\s+?)?(\S+)(\s+?)?#i" , "DELETE FROM " . $prefix."\\1 ", $query );
|
||||
$query = preg_replace( "#^INSERT INTO(?:\s+?)?(\S+)\s+?#i" , "INSERT INTO " . $prefix."\\1 ", $query );
|
||||
//$query = preg_replace( "#^INSERT IGNORE INTO(?:\s+?)?(\S+)\s+?#i", "INSERT IGNORE INTO " . $prefix."\\1 ", $query );
|
||||
$query = preg_replace( "#^UPDATE(?:\s+?)?(\S+)\s+?#i" , "UPDATE " . $prefix."\\1 ", $query );
|
||||
$query = preg_replace( "#^REPLACE INTO(?:\s+?)?(\S+)\s+?#i" , "REPLACE INTO " . $prefix."\\1 ", $query );
|
||||
$query = preg_replace( "#^ALTER TABLE(?:\s+?)?(\S+)\s+?#i" , "ALTER TABLE " . $prefix."\\1 ", $query );
|
||||
@@ -607,7 +634,7 @@ class IPSSetUp
|
||||
|
||||
if ( $tmp > $from AND $tmp <= $to )
|
||||
{
|
||||
if ( file_exists( IPSLib::getAppDir( $app ) . '/setup/versions/' . $file . '/version_class.php' ) )
|
||||
if ( is_file( IPSLib::getAppDir( $app ) . '/setup/versions/' . $file . '/version_class.php' ) )
|
||||
{
|
||||
$classes[] = $tmp;
|
||||
}
|
||||
@@ -653,6 +680,7 @@ class IPSSetUp
|
||||
$DBVersions = self::fetchDbAppVersions( $app );
|
||||
$tmp = $DBVersions;
|
||||
$key = array_pop( $tmp );
|
||||
$coreApps = array( 'calendar', 'core' );
|
||||
|
||||
if ( ! $key OR ! count( $DBVersions ) )
|
||||
{
|
||||
@@ -664,13 +692,19 @@ class IPSSetUp
|
||||
|
||||
$key = intval( $_version['app_long_version'] );
|
||||
}
|
||||
else
|
||||
else if( in_array( $app, $coreApps ) )
|
||||
{
|
||||
if ( ipsRegistry::DB()->checkForField( 'upgrade_id', 'upgrade_history' ) )
|
||||
if( defined('MAX_UPGRADE_VERSION_ID') )
|
||||
{
|
||||
$key = MAX_UPGRADE_VERSION_ID;
|
||||
}
|
||||
else if ( ipsRegistry::DB()->checkForField( 'upgrade_id', 'upgrade_history' ) )
|
||||
{
|
||||
/* Now, this table is created in the first step between 1.3 and 2.0, so check for contents */
|
||||
$test = ipsRegistry::DB()->buildAndFetch( array( 'select' => 'MAX(upgrade_version_id) as max', 'from' => 'upgrade_history' ) );
|
||||
|
||||
define( 'MAX_UPGRADE_VERSION_ID', $test['max'] );
|
||||
|
||||
$key = ( $test['max'] ) ? $test['max'] : '10003';
|
||||
}
|
||||
else if ( self::is130plus() === TRUE )
|
||||
@@ -686,69 +720,72 @@ class IPSSetUp
|
||||
$key = '10001';
|
||||
}
|
||||
}
|
||||
|
||||
/* Blog Version Check */
|
||||
if( $app == 'blog' )
|
||||
|
||||
if ( !$key )
|
||||
{
|
||||
if ( ipsRegistry::DB()->checkForField( 'blog_upgrade_id', 'blog_upgrade_history' ) )
|
||||
/* Blog Version Check */
|
||||
if( $app == 'blog' )
|
||||
{
|
||||
$test = ipsRegistry::DB()->buildAndFetch( array( 'select' => 'MAX(blog_version_id) as max', 'from' => 'blog_upgrade_history' ) );
|
||||
$key = ( $test['max'] ) ? $test['max'] : $key;
|
||||
if ( ipsRegistry::DB()->checkForField( 'blog_upgrade_id', 'blog_upgrade_history' ) )
|
||||
{
|
||||
$test = ipsRegistry::DB()->buildAndFetch( array( 'select' => 'MAX(blog_version_id) as max', 'from' => 'blog_upgrade_history' ) );
|
||||
$key = ( $test['max'] ) ? $test['max'] : $key;
|
||||
}
|
||||
else
|
||||
{
|
||||
$key = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
/* Gallery Version Check */
|
||||
else if( $app == 'gallery' )
|
||||
{
|
||||
$key = 0;
|
||||
if ( ipsRegistry::DB()->checkForField( 'gallery_upgrade_id', 'gallery_upgrade_history' ) )
|
||||
{
|
||||
$test = ipsRegistry::DB()->buildAndFetch( array( 'select' => 'MAX(gallery_version_id) as max', 'from' => 'gallery_upgrade_history' ) );
|
||||
$key = ( $test['max'] ) ? $test['max'] : $key;
|
||||
}
|
||||
else
|
||||
{
|
||||
$key = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Gallery Version Check */
|
||||
else if( $app == 'gallery' )
|
||||
{
|
||||
if ( ipsRegistry::DB()->checkForField( 'gallery_upgrade_id', 'gallery_upgrade_history' ) )
|
||||
else if( $app == 'downloads' )
|
||||
{
|
||||
$test = ipsRegistry::DB()->buildAndFetch( array( 'select' => 'MAX(gallery_version_id) as max', 'from' => 'gallery_upgrade_history' ) );
|
||||
$key = ( $test['max'] ) ? $test['max'] : $key;
|
||||
if ( ipsRegistry::DB()->checkForField( 'idm_upgrade_id', 'idm_upgrade_history' ) )
|
||||
{
|
||||
$test = ipsRegistry::DB()->buildAndFetch( array( 'select' => 'MAX(idm_version_id) as max', 'from' => 'idm_upgrade_history' ) );
|
||||
$key = ( $test['max'] ) ? $test['max'] : $key;
|
||||
}
|
||||
else
|
||||
{
|
||||
$key = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
else if( $app == 'ipchat' )
|
||||
{
|
||||
$key = 0;
|
||||
if ( ipsRegistry::DB()->checkForTable( 'chat_log_archive' ) )
|
||||
{
|
||||
$_a = array_keys( $XMLVersions );
|
||||
$a = array_shift( $_a );
|
||||
$key = ( $a ) ? $a : '11005';
|
||||
}
|
||||
else
|
||||
{
|
||||
$key = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if( $app == 'downloads' )
|
||||
{
|
||||
if ( ipsRegistry::DB()->checkForField( 'idm_upgrade_id', 'idm_upgrade_history' ) )
|
||||
else if( $app == 'ccs' )
|
||||
{
|
||||
$test = ipsRegistry::DB()->buildAndFetch( array( 'select' => 'MAX(idm_version_id) as max', 'from' => 'idm_upgrade_history' ) );
|
||||
$key = ( $test['max'] ) ? $test['max'] : $key;
|
||||
}
|
||||
else
|
||||
{
|
||||
$key = 0;
|
||||
}
|
||||
}
|
||||
else if( $app == 'ipchat' )
|
||||
{
|
||||
if ( ipsRegistry::DB()->checkForTable( 'chat_log_archive' ) )
|
||||
{
|
||||
$_a = array_keys( $XMLVersions );
|
||||
$a = array_shift( $_a );
|
||||
$key = ( $a ) ? $a : '11005';
|
||||
}
|
||||
else
|
||||
{
|
||||
$key = 0;
|
||||
}
|
||||
}
|
||||
else if( $app == 'ccs' )
|
||||
{
|
||||
if ( ipsRegistry::DB()->checkForTable( 'ccs_pages' ) )
|
||||
{
|
||||
$_a = array_keys( $XMLVersions );
|
||||
$a = array_shift( $_a );
|
||||
$key = ( $a ) ? $a : '20006';
|
||||
}
|
||||
else
|
||||
{
|
||||
$key = 0;
|
||||
if ( ipsRegistry::DB()->checkForTable( 'ccs_pages' ) )
|
||||
{
|
||||
$_a = array_keys( $XMLVersions );
|
||||
$a = array_shift( $_a );
|
||||
$key = ( $a ) ? $a : '20006';
|
||||
}
|
||||
else
|
||||
{
|
||||
$key = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -911,12 +948,12 @@ class IPSSetUp
|
||||
$versions = array();
|
||||
|
||||
/* 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
|
||||
{
|
||||
if( !file_exists( IPSLib::getAppDir( $app ) . '/xml/versions.xml' ) )
|
||||
if( !is_file( IPSLib::getAppDir( $app ) . '/xml/versions.xml' ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -991,7 +1028,7 @@ class IPSSetUp
|
||||
{
|
||||
$_xmlFileSearch = str_replace( '{app}', $_app, $xmlFileSearch );
|
||||
|
||||
if ( ! file_exists( IPSLib::getAppDir( $_app ) . '/xml/' . $_xmlFileSearch ) )
|
||||
if ( ! is_file( IPSLib::getAppDir( $_app ) . '/xml/' . $_xmlFileSearch ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -1039,9 +1076,9 @@ class IPSSetUp
|
||||
/**
|
||||
* Custom error checker routine...
|
||||
*/
|
||||
if( file_exists( IPSLib::getAppDir( $app ) . '/setup/versions/install/installCheck.php' ) )
|
||||
if( is_file( IPSLib::getAppDir( $app ) . '/setup/versions/install/installCheck.php' ) )
|
||||
{
|
||||
require_once( IPSLib::getAppDir( $app ) . '/setup/versions/install/installCheck.php' );
|
||||
require_once( IPSLib::getAppDir( $app ) . '/setup/versions/install/installCheck.php' );/*noLibHook*/
|
||||
$checkerClass = $app . '_installCheck';
|
||||
|
||||
if( class_exists($checkerClass) )
|
||||
@@ -1052,13 +1089,13 @@ class IPSSetUp
|
||||
}
|
||||
|
||||
/* Got a file? */
|
||||
if ( ! file_exists( $file ) )
|
||||
if ( ! is_file( $file ) )
|
||||
{
|
||||
return $info;
|
||||
}
|
||||
|
||||
/* Fetch app writeable files */
|
||||
require_once( IPS_KERNEL_PATH . 'classXML.php' );
|
||||
require_once( IPS_KERNEL_PATH . 'classXML.php' );/*noLibHook*/
|
||||
$xml = new classXML( IPSSetUp::charSet );
|
||||
|
||||
try
|
||||
@@ -1077,7 +1114,7 @@ class IPSSetUp
|
||||
{
|
||||
if ( $data['dir'] )
|
||||
{
|
||||
if ( ! @mkdir( $_path, 0777, TRUE ) )
|
||||
if ( ! @mkdir( $_path, IPS_FOLDER_PERMISSION, TRUE ) )
|
||||
{
|
||||
$info['notexist'][] = $_path;
|
||||
}
|
||||
@@ -1089,7 +1126,7 @@ class IPSSetUp
|
||||
}
|
||||
else if ( ! is_writeable( $_path ) )
|
||||
{
|
||||
if ( ! @chmod( $_path, 0777 ) )
|
||||
if ( ! @chmod( $_path, is_dir( $_path ) ? IPS_FOLDER_PERMISSION : IPS_FILE_PERMISSION ) )
|
||||
{
|
||||
$info['notwrite'][] = $_path;
|
||||
}
|
||||
@@ -1120,21 +1157,22 @@ class IPSSetUp
|
||||
$info = array();
|
||||
|
||||
/* Fetch core writeable files */
|
||||
require_once( IPS_KERNEL_PATH . 'classXML.php' );
|
||||
require_once( IPS_KERNEL_PATH . 'classXML.php' );/*noLibHook*/
|
||||
$xml = new classXML( $charset ? $charset : IPSSetUp::charSet );
|
||||
|
||||
try
|
||||
{
|
||||
if( file_exists( IPSLib::getAppDir( $app ) . '/xml/information.xml' ) )
|
||||
if( is_file( IPSLib::getAppDir( $app ) . '/xml/information.xml' ) )
|
||||
{
|
||||
$xml->load( IPSLib::getAppDir( $app ) . '/xml/information.xml' );
|
||||
|
||||
/* Fetch general information */
|
||||
foreach( $xml->fetchElements( 'data' ) as $xmlelement )
|
||||
{
|
||||
$data = $xml->fetchElementsFromRecord( $xmlelement );
|
||||
|
||||
$info['name'] = $data['name'];
|
||||
//TERANOTE: remove this code below after making sure it doesn't cause issues the new way
|
||||
/*$data = $xml->fetchElementsFromRecord( $xmlelement );
|
||||
|
||||
$info['name'] = $data['name'];
|
||||
$info['title'] = $data['name'];
|
||||
$info['author'] = $data['author'];
|
||||
$info['description'] = $data['description'];
|
||||
@@ -1142,7 +1180,15 @@ class IPSSetUp
|
||||
$info['disabledatinstall'] = ( $data['disabledatinstall'] ) ? 1 : 0;
|
||||
$info['key'] = $app;
|
||||
$info['ipskey'] = $data['ipskey'];
|
||||
$info['hide_tab'] = $data['hide_tab'];
|
||||
$info['hide_tab'] = $data['hide_tab'];*/
|
||||
|
||||
$info = $xml->fetchElementsFromRecord( $xmlelement );
|
||||
|
||||
/* Sort some things */
|
||||
$info['title'] = $info['name'];
|
||||
$info['disabledatinstall'] = intval($info['disabledatinstall']);
|
||||
$info['hide_tab'] = intval($info['hide_tab']);
|
||||
$info['key'] = $app;
|
||||
}
|
||||
|
||||
/* Fetch template information */
|
||||
@@ -1181,7 +1227,7 @@ class IPSSetUp
|
||||
// No modules?
|
||||
//-----------------------------------------
|
||||
|
||||
if( !file_exists( IPSLib::getAppDir( $app ) . '/xml/' . $app . '_modules.xml' ) )
|
||||
if( !is_file( IPSLib::getAppDir( $app ) . '/xml/' . $app . '_modules.xml' ) )
|
||||
{
|
||||
return array();
|
||||
}
|
||||
@@ -1191,7 +1237,7 @@ class IPSSetUp
|
||||
|
||||
try
|
||||
{
|
||||
require_once( IPS_KERNEL_PATH . 'classXML.php' );
|
||||
require_once( IPS_KERNEL_PATH . 'classXML.php' );/*noLibHook*/
|
||||
$xml = new classXML( $charset ? $charset : IPSSetUp::charSet );
|
||||
|
||||
$xml->load( IPSLib::getAppDir( $app ) . '/xml/' . $app . '_modules.xml' );
|
||||
@@ -1251,7 +1297,7 @@ class IPSSetUp
|
||||
* @access public
|
||||
* @param string Key
|
||||
* @param string Value
|
||||
* @return void
|
||||
* @return @e void
|
||||
*/
|
||||
static function setSavedData( $key, $value )
|
||||
{
|
||||
@@ -1293,7 +1339,7 @@ class IPSSetUp
|
||||
*
|
||||
* @access public
|
||||
* @param string Raw data for thawing
|
||||
* @return void
|
||||
* @return @e void
|
||||
*/
|
||||
static function thawSavedData( $data='' )
|
||||
{
|
||||
@@ -1329,9 +1375,9 @@ class IPSSetUp
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( file_exists( DOC_IPS_ROOT_PATH . 'conf_global.php' ) )
|
||||
if ( is_file( DOC_IPS_ROOT_PATH . 'conf_global.php' ) )
|
||||
{
|
||||
require( DOC_IPS_ROOT_PATH . 'conf_global.php' );
|
||||
require( DOC_IPS_ROOT_PATH . 'conf_global.php' );/*noLibHook*/
|
||||
return trim( $VAR );
|
||||
}
|
||||
}
|
||||
@@ -1344,7 +1390,7 @@ class IPSSetUp
|
||||
*
|
||||
* @access private
|
||||
* @param string Encoded data to write
|
||||
* @return void
|
||||
* @return @e void
|
||||
*/
|
||||
private static function _writeFreezerCache( $data )
|
||||
{
|
||||
@@ -1354,7 +1400,7 @@ class IPSSetUp
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( file_exists( DOC_IPS_ROOT_PATH . 'conf_global.php' ) AND is_writeable( DOC_IPS_ROOT_PATH . 'conf_global.php' ) )
|
||||
if ( is_file( DOC_IPS_ROOT_PATH . 'conf_global.php' ) AND is_writeable( DOC_IPS_ROOT_PATH . 'conf_global.php' ) )
|
||||
{
|
||||
$_data = file_get_contents( DOC_IPS_ROOT_PATH . 'conf_global.php' );
|
||||
|
||||
|
||||
Reference in new issue
Block a user