Version 2.2.0 RC-1
This commit is contained in:
1 parent
f73f8bff6d
commit
22f1b963ee
1034 files changed
+178610
-70897
No files matched your search
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Board
|
||||
* Action controller for done page
|
||||
*/
|
||||
|
||||
class action_done
|
||||
{
|
||||
var $install;
|
||||
|
||||
function action_done( & $install )
|
||||
{
|
||||
$this->install =& $install;
|
||||
}
|
||||
|
||||
function run()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Show page
|
||||
//-----------------------------------------
|
||||
|
||||
$this->install->template->append( $this->install->template->install_done( $this->install->ipsclass->vars['board_url'].'/index.php' ) );
|
||||
$this->install->template->next_action = '';
|
||||
$this->install->template->hide_next = 1;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Board
|
||||
* Action controller for EULA page
|
||||
*/
|
||||
|
||||
class action_eula
|
||||
{
|
||||
var $install;
|
||||
|
||||
function action_eula( & $install )
|
||||
{
|
||||
$this->install =& $install;
|
||||
}
|
||||
|
||||
function run()
|
||||
{
|
||||
/* Page Output */
|
||||
$this->install->template->append( $this->install->template->eula_page( nl2br($this->install->product_license) ) );
|
||||
$this->install->template->next_action = '?p=install';
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,888 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Board
|
||||
* Action controller for install page
|
||||
*/
|
||||
|
||||
class action_install
|
||||
{
|
||||
var $install;
|
||||
|
||||
var $helpfiles = 0;
|
||||
|
||||
function action_install( & $install )
|
||||
{
|
||||
$this->install =& $install;
|
||||
}
|
||||
|
||||
// SQL > FINAL > SETTINGS > ACPPERMS / HELP FILE > DB CHECKER
|
||||
// After all sets have run: SKIN REVERT > TEMPLATES > OTHER [ Email Templates? ] > Build Caches > DB Check
|
||||
|
||||
function run()
|
||||
{
|
||||
$this->install->get_version_latest();
|
||||
|
||||
$this->install->saved_data['helpfile'] = intval($this->install->ipsclass->input['helpfile']) ? intval($this->install->ipsclass->input['helpfile']) : $this->install->saved_data['helpfile'];
|
||||
$this->install->saved_data['man'] = intval($this->install->ipsclass->input['man']) ? intval($this->install->ipsclass->input['man']) : $this->install->saved_data['man'];
|
||||
|
||||
/* Switch */
|
||||
switch( $this->install->ipsclass->input['sub'] )
|
||||
{
|
||||
case 'sql':
|
||||
$this->install_sql();
|
||||
break;
|
||||
|
||||
case 'settings':
|
||||
$this->install_settings();
|
||||
break;
|
||||
|
||||
case 'acpperms':
|
||||
$this->install_acpperms();
|
||||
break;
|
||||
|
||||
case 'finish':
|
||||
$this->install_finish();
|
||||
break;
|
||||
|
||||
case 'checkdb':
|
||||
$this->install_checkdb();
|
||||
break;
|
||||
|
||||
case 'skinrevert':
|
||||
$this->install_skinrevert();
|
||||
break;
|
||||
|
||||
case 'templates':
|
||||
$this->install_templates();
|
||||
break;
|
||||
|
||||
case 'caches':
|
||||
$this->install_caches();
|
||||
break;
|
||||
|
||||
default:
|
||||
/* Output */
|
||||
$this->install->template->append( $this->install->template->install_page() );
|
||||
$this->install->template->next_action = '?p=install&sub=sql';
|
||||
$this->install->template->hide_next = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
//----------------------------------------------
|
||||
// Log errors for tech support
|
||||
//----------------------------------------------
|
||||
|
||||
if( count($this->install->error) > 0 )
|
||||
{
|
||||
$file_name = ROOT_PATH . 'cache/sql_upgrade_log_'.date('m_d_y').'.cgi';
|
||||
|
||||
$_error_string = "\n===================================================";
|
||||
$_error_string .= "\n Date: ". date( 'r' );
|
||||
$_error_string .= "\n IP Address: " . $_SERVER['REMOTE_ADDR'];
|
||||
$_error_string .= "\n Member ID: " . $this->install->ipsclass->member['id'];
|
||||
$_error_string .= "\n Version Folder: " .$this->install->current_upgrade;
|
||||
$_error_string .= "\n Current Sub Step: " .$this->install->ipsclass->input['sub'];
|
||||
$_error_string .= "\n Current workact: " .$this->install->saved_data['workact'];
|
||||
$_error_string .= "\n\n\n ".$this->install->ipsclass->my_br2nl(implode( "\n", $this->install->error ));
|
||||
|
||||
$fh = fopen( $file_name, "a" );
|
||||
fwrite( $fh, $_error_string, strlen( $_error_string ) );
|
||||
fclose( $fh );
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Installs the SQL
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Installs SQL schematic
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function install_sql()
|
||||
{
|
||||
if ( $this->install->current_upgrade AND $this->install->current_upgrade < 20000 )
|
||||
{
|
||||
// Jump right to the finish routine for 1.x
|
||||
|
||||
$this->install_finish();
|
||||
return;
|
||||
}
|
||||
|
||||
$output = "";
|
||||
$message = array();
|
||||
$this->install->error = array();
|
||||
|
||||
$SQL = array();
|
||||
$cnt = 0;
|
||||
|
||||
if ( file_exists( INS_ROOT_PATH.'installfiles/upg_'.$this->install->current_upgrade.'/'.strtolower($this->install->ipsclass->vars['sql_driver']).'_updates.php' ) )
|
||||
{
|
||||
require_once ( INS_ROOT_PATH.'installfiles/upg_'.$this->install->current_upgrade.'/'.strtolower($this->install->ipsclass->vars['sql_driver']).'_updates.php' );
|
||||
}
|
||||
|
||||
// Create/Alter tables
|
||||
if ( count( $SQL ) > 0 )
|
||||
{
|
||||
$this->sqlcount = 0;
|
||||
|
||||
$this->install->ipsclass->DB->return_die = 1;
|
||||
|
||||
foreach( $SQL as $q )
|
||||
{
|
||||
$this->install->ipsclass->DB->allow_sub_select = 1;
|
||||
$this->install->ipsclass->DB->error = '';
|
||||
|
||||
$q = str_replace( "<%time%>", time(), $q );
|
||||
|
||||
if( $this->install->saved_data['man'] )
|
||||
{
|
||||
$output .= preg_replace("/\sibf_(\S+?)([\s\.,]|$)/", " ".$this->install->ipsclass->DB->obj['sql_tbl_prefix']."\\1\\2", preg_replace( "/\s{1,}/", " ", $q ) )."\n\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->install->ipsclass->DB->query( $q );
|
||||
|
||||
if ( $this->install->ipsclass->DB->error )
|
||||
{
|
||||
$this->install->error[] = $q."<br /><br />".$this->install->ipsclass->DB->error;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->sqlcount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$message[] = $this->sqlcount." queries run...";
|
||||
}
|
||||
else
|
||||
{
|
||||
// If there are no SQL queries to run, jump to settings
|
||||
|
||||
$this->install_finish();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if ( count( $this->install->error ) > 0 )
|
||||
{
|
||||
$this->install->message = count($message) ? implode( "<br />", $message ) : "Proceeding with update";
|
||||
|
||||
$this->install->template->warning( array_merge( array( $this->install->message ),
|
||||
array( 'Error in upgrade '.$this->install->versions[ $this->install->current_upgrade ]. ' (' . $this->install->current_upgrade . ')' ),
|
||||
array( "<span style='color:red'>".count($this->install->error).' errors found</span>' ),
|
||||
$this->install->error ) );
|
||||
$this->install->template->in_error = 1;
|
||||
|
||||
$this->install->template->next_action = '?p=install&sub=finish';
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if( $this->install->saved_data['man'] AND $output )
|
||||
{
|
||||
$output = "<h3><b>Please run these queries in your MySQL database before continuing..</b></h3><br />".nl2br(htmlspecialchars($output));
|
||||
|
||||
$this->install->template->next_action = '?p=install&sub=finish';
|
||||
$this->install->template->append( $output );
|
||||
}
|
||||
else
|
||||
{
|
||||
$output[] = count($message) ? implode( "<br />", $message ) : "No queries, settings, or permissions to import...<br /><br />Proceeding with update";
|
||||
$this->install->template->next_action = '?p=install&sub=finish';
|
||||
$this->install->template->append( $this->install->template->install_page_refresh( $output ) );
|
||||
$this->install->template->hide_next = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Installs the Settings
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Installs Partial Settings
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function install_settings()
|
||||
{
|
||||
if ( $this->install->current_upgrade AND $this->install->current_upgrade < 20000 )
|
||||
{
|
||||
// Jump right to the finish routine for 1.x
|
||||
// Reorganized - should never hit here
|
||||
|
||||
$this->install_finish();
|
||||
return;
|
||||
}
|
||||
|
||||
$message = array();
|
||||
$this->install->error = array();
|
||||
|
||||
//-------------------------------
|
||||
// Load module...
|
||||
//-------------------------------
|
||||
|
||||
require_once( ROOT_PATH . 'sources/action_admin/settings.php' );
|
||||
$settings = new ad_settings();
|
||||
$settings->ipsclass =& $this->install->ipsclass;
|
||||
|
||||
//-------------------------------
|
||||
// Set location
|
||||
//-------------------------------
|
||||
|
||||
$this->install->ipsclass->input['file_location'] = 'resources/settings.xml';
|
||||
|
||||
//-------------------------------
|
||||
// Run it
|
||||
//-------------------------------
|
||||
|
||||
$settings->settings_do_import( 1 );
|
||||
|
||||
$message[] = $this->install->ipsclass->main_msg;
|
||||
|
||||
|
||||
if ( count( $this->install->error ) > 0 )
|
||||
{
|
||||
$this->install->message = count($message) ? implode( "<br />", $message ) : "Proceeding with update";
|
||||
|
||||
$this->install->template->warning( array_merge( array( $this->install->message ),
|
||||
array( 'Error in upgrade '.$this->install->versions[ $this->install->current_upgrade ]. ' (' . $this->install->current_upgrade . ')' ),
|
||||
array( "<span style='color:red'>".count($this->install->error).' errors found</span>' ),
|
||||
$this->install->error ) );
|
||||
$this->install->template->in_error = 1;
|
||||
|
||||
$this->install->template->next_action = '?p=install&sub=acpperms';
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$output[] = count($message) ? implode( "<br />", $message ) : "No settings to import...<br /><br />Proceeding with update";
|
||||
$this->install->template->next_action = '?p=install&sub=acpperms';
|
||||
$this->install->template->append( $this->install->template->install_page_refresh( $output ) );
|
||||
$this->install->template->hide_next = 1;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Installs the ACP Permissions
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Installs ACP Permissions
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function install_acpperms()
|
||||
{
|
||||
if( $this->install->current_upgrade AND $this->install->current_upgrade < 20000 )
|
||||
{
|
||||
// Jump right to the finish routine for 1.x
|
||||
// Reorganized - should never hit here
|
||||
|
||||
$this->install_finish();
|
||||
return;
|
||||
}
|
||||
|
||||
$message = array();
|
||||
$this->install->error = array();
|
||||
|
||||
|
||||
//-------------------------------
|
||||
// Load module...
|
||||
//-------------------------------
|
||||
|
||||
require_once( ROOT_PATH . 'sources/action_admin/acppermissions.php' );
|
||||
$settings = new ad_acppermissions();
|
||||
$settings->ipsclass =& $this->install->ipsclass;
|
||||
|
||||
//-------------------------------
|
||||
// Set location
|
||||
//-------------------------------
|
||||
|
||||
$this->install->ipsclass->input['file_location'] = 'resources/acpperms.xml';
|
||||
|
||||
//-------------------------------
|
||||
// Run it
|
||||
//-------------------------------
|
||||
|
||||
$settings->acpperms_xml_import( 1 );
|
||||
|
||||
$message[] = $this->install->ipsclass->main_msg;
|
||||
|
||||
//-----------------------------------------
|
||||
// Install FAQ
|
||||
//-----------------------------------------
|
||||
$message[] = "Updating FAQ information...";
|
||||
$xml = new class_xml();
|
||||
$xml->lite_parser = 1;
|
||||
|
||||
$updatehelp = ( isset( $this->install->saved_data['helpfile'] ) && $this->install->saved_data['helpfile'] ) ? 1 : 0;
|
||||
|
||||
$content = implode( "", file( ROOT_PATH . 'resources/faq.xml' ) );
|
||||
|
||||
if ( $content )
|
||||
{
|
||||
$xml->xml_parse_document( $content );
|
||||
|
||||
foreach( $xml->xml_array['export']['group']['row'] as $id => $entry )
|
||||
{
|
||||
$newrow = array();
|
||||
foreach( $entry as $f => $data )
|
||||
{
|
||||
if ( $f == 'VALUE' or $f == 'id' )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$newrow[$f] = $entry[ $f ]['VALUE'];
|
||||
}
|
||||
|
||||
if ( $newrow['title'] )
|
||||
{
|
||||
$cur_faq = $this->install->ipsclass->DB->build_and_exec_query( array( 'select' => 'id', 'from' => 'faq', 'where' => "title = '".$this->install->ipsclass->DB->add_slashes( $newrow['title'] )."'" ) );
|
||||
|
||||
if ( $cur_faq['id'] )
|
||||
{
|
||||
if ( $updatehelp )
|
||||
{
|
||||
$this->install->ipsclass->DB->do_update( 'faq', $newrow, "id = ".$cur_faq['id'] );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->install->ipsclass->DB->do_insert( 'faq', $newrow );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( count( $this->install->error ) > 0 )
|
||||
{
|
||||
$this->install->message = count($message) ? implode( "<br />", $message ) : "Proceeding with update";
|
||||
|
||||
$this->install->template->warning( array_merge( array( $this->install->message ),
|
||||
array( 'Error in upgrade '.$this->install->versions[ $this->install->current_upgrade ]. ' (' . $this->install->current_upgrade . ')' ),
|
||||
array( "<span style='color:red'>".count($this->install->error).' errors found</span>' ),
|
||||
$this->install->error ) );
|
||||
$this->install->template->in_error = 1;
|
||||
|
||||
$this->install->template->next_action = '?p=install&sub=finish';
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$output[] = count($message) ? implode( "<br />", $message ) : "No acp permissions to import...<br /><br />Proceeding with update";
|
||||
$this->install->template->next_action = '?p=install&sub=checkdb';
|
||||
$this->install->template->append( $this->install->template->install_page_refresh( $output ) );
|
||||
$this->install->template->hide_next = 1;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Finishes the version
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Runs version upgrade script and finishes the version
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function install_finish()
|
||||
{
|
||||
$continue = 0;
|
||||
|
||||
$upg_file = INS_ROOT_PATH.'installfiles/upg_'.$this->install->current_upgrade.'/version_upgrade.php';
|
||||
|
||||
if ( file_exists( $upg_file ) )
|
||||
{
|
||||
require_once( $upg_file );
|
||||
$upgrade = new version_upgrade( $this->install );
|
||||
$result = $upgrade->auto_run();
|
||||
|
||||
if ( count( $this->install->error ) > 0 )
|
||||
{
|
||||
$this->install->template->warning( array_merge( array( $this->install->message ),
|
||||
array( 'Error in upgrade '.$this->install->versions[ $this->install->current_upgrade ]. ' (' . $this->install->current_upgrade . ')' ),
|
||||
array( "<span style='color:red'>".count($this->install->error).' errors found</span>' ),
|
||||
$this->install->error ) );
|
||||
$this->install->template->in_error = 1;
|
||||
|
||||
if ( ! $result )
|
||||
{
|
||||
$this->install->template->next_action = '?p=install&sub=finish';
|
||||
}
|
||||
elseif ( $this->install->current_upgrade >= $this->install->last_poss_id || $this->install->current_upgrade == 0 )
|
||||
{
|
||||
$this->install->template->next_action = '?p=install&sub=settings';
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->install->template->next_action = '?p=install&sub=sql';
|
||||
}
|
||||
|
||||
$in_error = 1;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// 'version_upgrade.php' is now done
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $result )
|
||||
{
|
||||
// The individual upgrade files all shoot you to 2.0...
|
||||
|
||||
if ( $this->install->current_upgrade < 20000 )
|
||||
{
|
||||
$this->install->current_upgrade = '10004';
|
||||
unset($this->install->saved_data['vid']);
|
||||
}
|
||||
|
||||
//------------------------------------------
|
||||
// Update DB
|
||||
//------------------------------------------
|
||||
|
||||
$this->install->ipsclass->DB->do_insert( 'upgrade_history', array( 'upgrade_version_id' => $this->install->current_upgrade,
|
||||
'upgrade_version_human' => $this->install->versions[ $this->install->current_upgrade ],
|
||||
'upgrade_date' => time(),
|
||||
'upgrade_mid' => $this->install->saved_data['mid'],
|
||||
'upgrade_notes' => implode( "\n", $this->install->error ),
|
||||
) );
|
||||
|
||||
if ( $in_error == 1 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ( $this->install->message )
|
||||
{
|
||||
$output[] = $this->install->message;
|
||||
}
|
||||
|
||||
$output[] = "Succesfully upgraded to version {$this->install->versions[ $this->install->current_upgrade ]}";
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( $in_error == 1 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ( $this->install->message )
|
||||
{
|
||||
$output[] = $this->install->message;
|
||||
}
|
||||
else
|
||||
{
|
||||
$output[] = "Proceeding with update...";
|
||||
}
|
||||
|
||||
$continue = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//------------------------------------------
|
||||
// Update DB
|
||||
//------------------------------------------
|
||||
|
||||
if ( $this->install->current_upgrade )
|
||||
{
|
||||
$this->install->ipsclass->DB->do_insert( 'upgrade_history', array( 'upgrade_version_id' => $this->install->current_upgrade,
|
||||
'upgrade_version_human' => $this->install->versions[ $this->install->current_upgrade ],
|
||||
'upgrade_date' => time(),
|
||||
'upgrade_mid' => $this->install->saved_data['mid']
|
||||
) );
|
||||
|
||||
$output[] = "Succesfully upgraded to version {$this->install->versions[ $this->install->current_upgrade ]}";
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Next...
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $continue )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// More to do?
|
||||
//-----------------------------------------
|
||||
|
||||
$this->install->template->next_action = '?p=install&sub=finish';
|
||||
}
|
||||
elseif ( $this->install->current_upgrade >= $this->install->last_poss_id || $this->install->current_upgrade == 0 )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Last update?
|
||||
//-----------------------------------------
|
||||
|
||||
$this->install->template->next_action = '?p=install&sub=settings';
|
||||
}
|
||||
else
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Do SQL
|
||||
//-----------------------------------------
|
||||
|
||||
$this->install->template->next_action = '?p=install&sub=sql';
|
||||
}
|
||||
|
||||
if ( $this->install->do_man )
|
||||
{
|
||||
$this->install->template->append( implode( "<br />", $output ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->install->template->append( $this->install->template->install_page_refresh( $output ) );
|
||||
$this->install->template->hide_next = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Runs the DB Checker after install
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Checks DB for errors
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function install_checkdb()
|
||||
{
|
||||
$message = array();
|
||||
$this->install->error = array();
|
||||
|
||||
if ( @file_exists( ROOT_PATH."/install/sql/{$this->install->ipsclass->vars['sql_driver']}_tables.php" ) )
|
||||
{
|
||||
//-------------------------------
|
||||
// Load ACP Skin...
|
||||
//-------------------------------
|
||||
|
||||
require_once( ROOT_PATH . "sources/lib/admin_skin.php" );
|
||||
$this->install->ipsclass->skin_acp = 'IPB2_Standard';
|
||||
$this->install->ipsclass->skin_acp_url = $this->install->ipsclass->vars['board_url']."/skin_acp/".$this->install->ipsclass->skin_acp;
|
||||
|
||||
$this->install->ipsclass->adskin = new admin_skin();
|
||||
$this->install->ipsclass->adskin->ipsclass =& $this->install->ipsclass;
|
||||
$this->install->ipsclass->adskin->init_admin_skin();
|
||||
|
||||
//-------------------------------
|
||||
// Load module...
|
||||
//-------------------------------
|
||||
|
||||
require_once( ROOT_PATH."sources/action_admin/sql_{$this->install->ipsclass->vars['sql_driver']}.php" );
|
||||
|
||||
$this->sql_driver = new ad_sql_module();
|
||||
$this->sql_driver->ipsclass =& $this->install->ipsclass;
|
||||
|
||||
$output = array();
|
||||
$output = $this->sql_driver->db_table_diag( 0 );
|
||||
|
||||
$our_output = " <style type='text/css' media='all'>
|
||||
@import url('{$this->install->ipsclass->skin_acp_url}/acp_css.css');
|
||||
@import url('install.css');
|
||||
</style>
|
||||
<script type='text/javascript' src='dbchecker.js'></script>
|
||||
";
|
||||
|
||||
if( $this->sql_driver->db_has_issues )
|
||||
{
|
||||
$this->install->ipsclass->adskin->td_header[] = array( "{none}" , "50%" );
|
||||
$this->install->ipsclass->adskin->td_header[] = array( "{none}" , "50%" );
|
||||
|
||||
$our_output .= $this->install->ipsclass->adskin->start_table( "WARNING: ERRORS FOUND" );
|
||||
|
||||
$our_output .= $this->install->ipsclass->adskin->add_td_row( array( array( "<script type='text/javascript'>var save_data = '".serialize($this->install->saved_data)."';</script><span class='rss-feed-invalid'>There were errors found with your database. Please review them below, or click <a href='#' onclick='fix_all_dberrors();'>here</a> to correct these errors.", 2 ) ) );
|
||||
|
||||
$our_output .= $this->install->ipsclass->adskin->end_table();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->install->ipsclass->adskin->td_header[] = array( "{none}" , "50%" );
|
||||
$this->install->ipsclass->adskin->td_header[] = array( "{none}" , "50%" );
|
||||
|
||||
$our_output .= $this->install->ipsclass->adskin->start_table( "No Errors Found" );
|
||||
|
||||
$our_output .= $this->install->ipsclass->adskin->add_td_row( array( array( "<span class='rss-feed-valid'>There were no errors found with your database.", 2 ) ) );
|
||||
|
||||
$our_output .= $this->install->ipsclass->adskin->end_table();
|
||||
}
|
||||
|
||||
$this->install->ipsclass->adskin->td_header[] = array( "Table" , "30%" );
|
||||
$this->install->ipsclass->adskin->td_header[] = array( "Status" , "20%" );
|
||||
$this->install->ipsclass->adskin->td_header[] = array( "Fix" , "50%" );
|
||||
|
||||
$our_output .= $this->install->ipsclass->adskin->start_table( "Database Table Results" );
|
||||
|
||||
foreach( $output as $html_row )
|
||||
{
|
||||
$html_row = preg_replace( "#'&section=help&act=diag&code=dbchecker&query=(.*?)'#i", "'index.php?p=install&sub=checkdb&saved_data=".serialize($this->install->saved_data)."&query=$1'", $html_row );
|
||||
|
||||
$our_output .= $html_row;
|
||||
}
|
||||
|
||||
$our_output .= $this->install->ipsclass->adskin->end_table();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Can't run db checker as table def isn't there
|
||||
$this->install_skinrevert();
|
||||
return;
|
||||
}
|
||||
|
||||
$this->install->template->next_action = '?p=install&sub=skinrevert';
|
||||
$this->install->template->append( $our_output );
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Install: Revert Skin Changes
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Install templates
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function install_skinrevert()
|
||||
{
|
||||
$message = array();
|
||||
$this->install->error = array();
|
||||
|
||||
// First time around, we won't have this
|
||||
|
||||
$this->install->saved_data['do'] = isset($this->install->ipsclass->input['do']) ? $this->install->ipsclass->input['do'] : $this->install->saved_data['do'];
|
||||
|
||||
if( $this->install->saved_data['do'] == 'none' )
|
||||
{
|
||||
$this->install_templates();
|
||||
return;
|
||||
}
|
||||
|
||||
if( !$this->install->saved_data['do'] )
|
||||
{
|
||||
$id = intval($this->install->saved_data['skinid']) ? intval($this->install->saved_data['skinid']) : 1;
|
||||
$this->install->saved_data['new_skin'] = intval($this->install->saved_data['new_skin']);
|
||||
|
||||
$default = $this->install->ipsclass->DB->simple_exec_query( array( 'select' => '*', 'from' => 'skin_sets', 'where' => "set_skin_set_id>{$id}", 'orderby' => 'set_skin_set_id ASC', 'limit' => array(0,1) ) );
|
||||
|
||||
if( $default['set_skin_set_id'] == $this->install->saved_data['new_skin'] )
|
||||
{
|
||||
$default = $this->install->ipsclass->DB->simple_exec_query( array( 'select' => '*', 'from' => 'skin_sets', 'where' => "set_skin_set_id>{$this->install->saved_data['new_skin']}", 'orderby' => 'set_skin_set_id ASC', 'limit' => array(0,1) ) );
|
||||
}
|
||||
|
||||
if( !$default['set_skin_set_id'] )
|
||||
{
|
||||
$this->install->template->next_action = '?p=install&sub=templates';
|
||||
$this->install->template->append( $this->install->template->install_page_refresh( array( 'No further skins to revert' ) ) );
|
||||
$this->install->template->hide_next = 1;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->install->saved_data['skinid'] = $default['set_skin_set_id'];
|
||||
|
||||
$this->install->template->next_action = '?p=install&sub=skinrevert';
|
||||
$this->install->template->append( $this->install->template->install_template_skinrevert( $default['set_name'] ) );
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$man = intval( $this->install->saved_data['skinid'] );
|
||||
$cnt = 0;
|
||||
|
||||
$default = $this->install->ipsclass->DB->simple_exec_query( array( 'select' => '*', 'from' => 'skin_sets', 'where' => "set_skin_set_id=".$man ) );
|
||||
|
||||
$this->install->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'skin_templates', 'where' => "set_id=".$man ) );
|
||||
$outer = $this->install->ipsclass->DB->simple_exec();
|
||||
|
||||
if( $this->install->ipsclass->DB->get_num_rows($outer) )
|
||||
{
|
||||
while( $r = $this->install->ipsclass->DB->fetch_row($outer) )
|
||||
{
|
||||
if( $r['set_id'] == 1 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->install->ipsclass->DB->simple_exec_query( array( 'delete' => 'skin_templates', 'where' => 'suid='.$r['suid'] ) );
|
||||
$cnt++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->install->ipsclass->DB->do_update( 'skin_sets', array( 'set_css' => '', 'set_wrapper' => '' ), "set_skin_set_id=".$man );
|
||||
|
||||
$next = $this->install->ipsclass->DB->simple_exec_query( array( 'select' => '*', 'from' => 'skin_sets', 'where' => "set_skin_set_id>".$man, 'orderby' => 'set_skin_set_id ASC', 'limit' => array(0,1) ) );
|
||||
|
||||
if( $next['set_skin_set_id'] )
|
||||
{
|
||||
if( $this->install->saved_data['do'] == 'all' )
|
||||
{
|
||||
$this->install->saved_data['skinid'] = $next['set_skin_set_id'];
|
||||
$this->install->saved_data['do'] = 'all';
|
||||
$this->install->template->next_action = '?p=install&sub=skinrevert';
|
||||
$this->install->template->append( $this->install->template->install_page_refresh( array( "$cnt skin template bits from skin set '{$default['set_name']}' reverted, proceeding to next skin set...." ) ) );
|
||||
$this->install->template->hide_next = 1;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->install->saved_data['skinid'] = $next['set_skin_set_id'];
|
||||
$this->install->template->next_action = '?p=install&sub=skinrevert';
|
||||
unset($this->install->saved_data['do']);
|
||||
$this->install->template->append( $this->install->template->install_page_refresh( array( "$cnt skin template bits from skin set '{$default['set_name']}' reverted, proceeding to next skin set...." ) ) );
|
||||
$this->install->template->hide_next = 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->install->template->next_action = '?p=install&sub=templates';
|
||||
$this->install->template->append( $this->install->template->install_page_refresh( array( "$cnt skin template bits from skin set '{$default['set_name']}' reverted, proceeding to rebuild templates...." ) ) );
|
||||
$this->install->template->hide_next = 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Install: Templates
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Install templates
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function install_templates()
|
||||
{
|
||||
//-----------------------------------
|
||||
// Get XML
|
||||
//-----------------------------------
|
||||
|
||||
$xml = new class_xml();
|
||||
$xml->lite_parser = 1;
|
||||
|
||||
//-----------------------------------
|
||||
// Get XML file (TEMPLATES)
|
||||
//-----------------------------------
|
||||
|
||||
$xmlfile = ROOT_PATH.'resources/ipb_templates.xml';
|
||||
|
||||
$setting_content = implode( "", file($xmlfile) );
|
||||
|
||||
//-------------------------------
|
||||
// Unpack the datafile (TEMPLATES)
|
||||
//-------------------------------
|
||||
|
||||
$xml->xml_parse_document( $setting_content );
|
||||
|
||||
//-------------------------------
|
||||
// (TEMPLATES)
|
||||
//-------------------------------
|
||||
|
||||
if ( ! is_array( $xml->xml_array['templateexport']['templategroup']['template'] ) )
|
||||
{
|
||||
$this->install->template->in_error = 1;
|
||||
$this->install->error[] = "Error with resources/ipb_templates.xml - could not process XML properly";
|
||||
|
||||
$this->install->template->warning( $this->install->error );
|
||||
|
||||
$this->install->template->next_action = '?p=install&sub=rebuild';
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
$output[] = "Master templates rebuilt, proceeding to recache templates...";
|
||||
|
||||
foreach( $xml->xml_array['templateexport']['templategroup']['template'] as $id => $entry )
|
||||
{
|
||||
$row = $this->install->ipsclass->DB->simple_exec_query( array( 'select' => 'suid',
|
||||
'from' => 'skin_templates',
|
||||
'where' => "group_name='{$entry[ 'group_name' ]['VALUE']}' AND func_name='{$entry[ 'func_name' ]['VALUE']}' and set_id=1"
|
||||
) );
|
||||
|
||||
$this->install->ipsclass->DB->allow_sub_select = 1;
|
||||
|
||||
if ( $row['suid'] )
|
||||
{
|
||||
$this->install->ipsclass->DB->do_update( 'skin_templates', array( 'func_data' => $entry[ 'func_data' ]['VALUE'],
|
||||
'section_content' => $entry[ 'section_content' ]['VALUE'],
|
||||
'updated' => time()
|
||||
)
|
||||
, 'suid='.$row['suid'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->install->ipsclass->DB->do_insert( 'skin_templates', array( 'func_data' => $entry[ 'func_data' ]['VALUE'],
|
||||
'func_name' => $entry[ 'func_name' ]['VALUE'],
|
||||
'section_content' => $entry[ 'section_content' ]['VALUE'],
|
||||
'group_name' => $entry[ 'group_name' ]['VALUE'],
|
||||
'updated' => time(),
|
||||
'set_id' => 1
|
||||
) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Next...
|
||||
//-----------------------------------------
|
||||
|
||||
unset($xml);
|
||||
|
||||
$this->install->template->append( $this->install->template->install_page_refresh( $output ) );
|
||||
$this->install->template->next_action = '?p=install&sub=caches';
|
||||
$this->install->template->hide_next = 1;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Install: Caches
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Install Caches
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function install_caches()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Do Caches
|
||||
//-----------------------------------------
|
||||
|
||||
require_once( ROOT_PATH . 'sources/api/api_skins.php' );
|
||||
$api = new api_skins();
|
||||
$api->ipsclass =& $this->install->ipsclass;
|
||||
$api->api_init();
|
||||
|
||||
$this->install->ipsclass->DB->allow_sub_select = 1;
|
||||
|
||||
if ( isset( $this->install->ipsclass->input['sid'] ) )
|
||||
{
|
||||
if ( $this->install->ipsclass->input['sid'] == 0 )
|
||||
{
|
||||
$output = $this->install->cache_and_cleanup();
|
||||
$this->install->template->next_action = '?p=done';
|
||||
}
|
||||
else
|
||||
{
|
||||
$messages = $api->skin_rebuild_caches( intval( $this->install->ipsclass->input['sid'] ) );
|
||||
$output = $messages['messages'];
|
||||
$this->install->template->next_action = '?p=install&sub=caches&sid='.$messages['completed'];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$messages = $api->skin_rebuild_caches( 0 );
|
||||
$output = $messages['messages'];
|
||||
$this->install->template->next_action = '?p=install&sub=caches&sid='.$messages['completed'];
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Next...
|
||||
//-----------------------------------------
|
||||
|
||||
$this->install->template->hide_next = 1;
|
||||
$this->install->template->append( $this->install->template->install_page_refresh( $output ) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Board
|
||||
* Action controller for requirements page
|
||||
*/
|
||||
|
||||
class action_login
|
||||
{
|
||||
var $install;
|
||||
|
||||
function action_login( & $install )
|
||||
{
|
||||
$this->install =& $install;
|
||||
}
|
||||
|
||||
function run()
|
||||
{
|
||||
/* Page Output */
|
||||
$this->install->template->append( $this->install->template->login_page( $this->install->template->message ) );
|
||||
|
||||
$this->install->template->next_action = '?p=overview';
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,249 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Board
|
||||
* Action controller for requirements page
|
||||
*/
|
||||
|
||||
class action_overview
|
||||
{
|
||||
var $install;
|
||||
|
||||
function action_overview( & $install )
|
||||
{
|
||||
$this->install =& $install;
|
||||
}
|
||||
|
||||
function run()
|
||||
{
|
||||
//----------------------------------
|
||||
// We must have submitted the form
|
||||
// time to check some details.
|
||||
//----------------------------------
|
||||
|
||||
if ( empty($this->install->ipsclass->input['username']) )
|
||||
{
|
||||
$this->install->template->append( $this->install->template->login_page( "You must enter a username before proceeding" ) );
|
||||
$this->install->template->next_action = '?p=overview';
|
||||
return;
|
||||
}
|
||||
|
||||
if ( empty($this->install->ipsclass->input['password']) )
|
||||
{
|
||||
$this->install->template->append( $this->install->template->login_page( "You must enter a password before proceeding" ) );
|
||||
$this->install->template->next_action = '?p=overview';
|
||||
return;
|
||||
}
|
||||
|
||||
//----------------------------------
|
||||
// Attempt to get the details from the
|
||||
// DB
|
||||
//----------------------------------
|
||||
|
||||
$this->install->ipsclass->DB->query("SELECT m.*, g.* FROM ibf_members m LEFT JOIN ibf_groups g ON (g.g_id=m.mgroup) WHERE LOWER(name)='".strtolower($this->install->ipsclass->input['username'])."'");
|
||||
$mem = $this->install->ipsclass->DB->fetch_row();
|
||||
|
||||
//----------------------------------
|
||||
// Get perms
|
||||
//----------------------------------
|
||||
if ( empty($mem['id']) )
|
||||
{
|
||||
$this->install->template->append( $this->install->template->login_page( "Could not find a record matching that username, please check the spelling" ) );
|
||||
$this->install->template->next_action = '?p=overview';
|
||||
return;
|
||||
}
|
||||
|
||||
//----------------------------------
|
||||
// Load converge member
|
||||
//----------------------------------
|
||||
|
||||
if( !$this->install->ipsclass->DB->field_exists( 'converge_id', 'members_converge' ) OR
|
||||
( isset($this->install->saved_data['vid']) AND $this->install->saved_data['vid'] < 10003 ) )
|
||||
{
|
||||
$pass = md5( $this->install->ipsclass->input['password'] );
|
||||
|
||||
if ( $pass != $mem['password'] AND $pass != $mem['legacy_password'] )
|
||||
{
|
||||
$this->install->template->append( $this->install->template->login_page( "The password you entered is not correct" ) );
|
||||
$this->install->template->next_action = '?p=overview';
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($mem['g_access_cp'] != 1)
|
||||
{
|
||||
$this->install->template->append( $this->install->template->login_page( "You do not have access to the administrative CP" ) );
|
||||
$this->install->template->next_action = '?p=overview';
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->install->ipsclass->member = $mem;
|
||||
$this->install->saved_data['loginkey'] = $mem['password'] ? md5($mem['password']) : md5($mem['legacy_password']);
|
||||
$this->install->saved_data['securekey'] = $this->install->ipsclass->return_md5_check();
|
||||
$this->install->saved_data['mid'] = $mem['id'];
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->install->ipsclass->converge->converge_load_member($mem['email']);
|
||||
|
||||
if ( ! $this->install->ipsclass->converge->member['converge_id'] )
|
||||
{
|
||||
$this->install->template->append( $this->install->template->login_page( "Could not find a record matching that username, please check the spelling" ) );
|
||||
$this->install->template->next_action = '?p=overview';
|
||||
return;
|
||||
}
|
||||
|
||||
//----------------------------------
|
||||
// Check converge pass
|
||||
//----------------------------------
|
||||
|
||||
$pass = md5( $this->install->ipsclass->input['password'] );
|
||||
|
||||
if ( $this->install->ipsclass->converge->converge_authenticate_member( $pass ) != TRUE )
|
||||
{
|
||||
$this->install->template->append( $this->install->template->login_page( "The password you entered is not correct" ) );
|
||||
$this->install->template->next_action = '?p=overview';
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($mem['g_access_cp'] != 1)
|
||||
{
|
||||
$this->install->template->append( $this->install->template->login_page( "You do not have access to the administrative CP" ) );
|
||||
$this->install->template->next_action = '?p=overview';
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->install->ipsclass->member = $mem;
|
||||
$this->install->saved_data['loginkey'] = $mem['member_login_key'];
|
||||
$this->install->saved_data['securekey'] = $this->install->ipsclass->return_md5_check();
|
||||
$this->install->saved_data['mid'] = $mem['id'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
$this->install->get_version_latest();
|
||||
|
||||
$error = array();
|
||||
if ( ! $this->install->last_poss_id )
|
||||
{
|
||||
$error[] = "An error has occured, we are unable to determine the current version or if there are any required upgrade files left to run";
|
||||
}
|
||||
if ( count($this->install->versions) == 0 )
|
||||
{
|
||||
$error[] = "Could not locate the required upgrade script: 'upg_{$this->install->last_poss_id}/version_history.php'";
|
||||
}
|
||||
if ( ! $this->install->current_version )
|
||||
{
|
||||
$error[] = "An error has occured, we are unable to determine the current version or if there are any required upgrade files left to run";
|
||||
}
|
||||
if ( $this->install->last_poss_id <= $this->install->current_version )
|
||||
{
|
||||
$error[] = "Your installation is up to date; no upgrade required";
|
||||
}
|
||||
|
||||
$checkfiles = array( ROOT_PATH ."resources/ipb_templates.xml",
|
||||
ROOT_PATH ."resources/skinsets.xml",
|
||||
ROOT_PATH ."resources/macro.xml",
|
||||
ROOT_PATH ."resources/settings.xml",
|
||||
ROOT_PATH ."resources/acpperms.xml",
|
||||
ROOT_PATH ."resources/version_history.php",
|
||||
ROOT_PATH ."sources/sql",
|
||||
KERNEL_PATH ."class_converge.php",
|
||||
KERNEL_PATH ."class_xml.php",
|
||||
KERNEL_PATH ."class_db_".SQL_DRIVER.".php",
|
||||
ROOT_PATH ."conf_global.php",
|
||||
);
|
||||
|
||||
$timecheck = array(
|
||||
ROOT_PATH ."resources/ipb_templates.xml",
|
||||
ROOT_PATH ."resources/skinsets.xml",
|
||||
ROOT_PATH ."resources/macro.xml",
|
||||
ROOT_PATH ."resources/settings.xml",
|
||||
ROOT_PATH ."resources/acpperms.xml",
|
||||
ROOT_PATH ."resources/version_history.php"
|
||||
);
|
||||
|
||||
$writeable = array( #ROOT_PATH."conf_global.php",
|
||||
ROOT_PATH."cache/",
|
||||
ROOT_PATH."cache/skin_cache/",
|
||||
ROOT_PATH."style_images/"
|
||||
);
|
||||
|
||||
@filemtime( ROOT_PATH . 'sources/ipsclass.php' );
|
||||
|
||||
foreach ( $checkfiles as $cf )
|
||||
{
|
||||
if ( ! file_exists($cf) )
|
||||
{
|
||||
$error[] = "Cannot locate the file '$cf'.";
|
||||
}
|
||||
}
|
||||
|
||||
foreach ( $writeable as $cf )
|
||||
{
|
||||
if ( ! is_writeable($cf) )
|
||||
{
|
||||
$error[] = "Cannot write to the file or folder '$cf'. Please CHMOD to 0777.";
|
||||
}
|
||||
}
|
||||
|
||||
if ( count ( $error ) )
|
||||
{
|
||||
$this->install->template->warning( $error );
|
||||
$this->install->template->next_action = '';
|
||||
$this->install->template->hide_next = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
$current_version = $this->install->current_version == '00000' ? 'not installed' : $this->install->versions[ $this->install->current_version ];
|
||||
|
||||
if ( $this->install->current_version == '00000' )
|
||||
{
|
||||
$this->ipsclass->boink_it( str_replace( 'upgrade', 'install', $this->ipsclass->my_getenv( 'PHP_SELF' ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$summary .= "Upgrade from ".$this->install->versions[ $this->install->current_version ]." to ".$this->install->versions[ $this->install->last_poss_id ];
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Time check...
|
||||
//-----------------------------------------
|
||||
|
||||
$summary .= "<br /><br /><strong>Checking 'resources' directory files</strong>";
|
||||
$_flag = 0;
|
||||
|
||||
foreach ( $timecheck as $cf )
|
||||
{
|
||||
$_time = @filemtime( $cf );
|
||||
|
||||
if ( $time_to_check AND $_time AND ( ( $time_to_check - (86400 * 7) ) > $_time ) )
|
||||
{
|
||||
$_flag = 1;
|
||||
$summary .= "<div style='color:red'>·" . str_replace( ROOT_PATH, '', $cf ) . ' may be out of date</div>';
|
||||
}
|
||||
}
|
||||
|
||||
if ( $_flag )
|
||||
{
|
||||
$summary .= "<br /><div>Please check the above files to make sure they have been uploaded from the ".$this->install->versions[ $this->install->last_poss_id ]." download";
|
||||
}
|
||||
else
|
||||
{
|
||||
$summary .= "<div style='color:green'>All files checked OK</div>";
|
||||
}
|
||||
|
||||
/* Page Output */
|
||||
$this->install->template->append( $this->install->template->overview_page( $current_version, $summary ) );
|
||||
$this->install->template->next_action = '?p=eula';
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,390 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Board
|
||||
* Invision Installer Framework
|
||||
*/
|
||||
|
||||
class class_installer
|
||||
{
|
||||
var $product_name = '';
|
||||
var $product_license = '';
|
||||
var $product_version = '';
|
||||
var $product_key = '';
|
||||
|
||||
var $build_id = '';
|
||||
|
||||
var $version_php_min = '';
|
||||
var $version_mysql_min = '';
|
||||
|
||||
var $required_dirs = array();
|
||||
var $required_files = array();
|
||||
|
||||
var $writeable_dirs = array();
|
||||
var $writeable_files = array();
|
||||
|
||||
/**
|
||||
* class_installer::set_product_info
|
||||
*
|
||||
* Set basic information about the product being installed
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $license
|
||||
* @param array $versions
|
||||
* @param string $key
|
||||
* @return void
|
||||
*/
|
||||
function set_product_info( $name, $license, $versions, $key )
|
||||
{
|
||||
$this->product_name = $name;
|
||||
$this->product_license = $license;
|
||||
$this->product_versions = $versions;
|
||||
$this->product_key = $key;
|
||||
}
|
||||
|
||||
/**
|
||||
* class_installer:set_software_versions
|
||||
*
|
||||
* Set required software versions of php and mysql
|
||||
*
|
||||
* @param string $php_min Example: 3.0.0
|
||||
* @param string $mysql_min Example: 4.4.0
|
||||
*/
|
||||
function set_software_versions( $php_min, $mysql_min )
|
||||
{
|
||||
$this->version_php_min = explode( '.', $php_min );
|
||||
$this->version_mysql_min = $mysql_min;
|
||||
}
|
||||
|
||||
/**
|
||||
* class_installer::set_required
|
||||
*
|
||||
* Set what files and directories must be present for an installation
|
||||
*
|
||||
* @param array $dirs
|
||||
* @param array $files
|
||||
*/
|
||||
function set_required( $dirs, $files )
|
||||
{
|
||||
$this->required_dirs = $dirs;
|
||||
$this->required_files = $files;
|
||||
}
|
||||
|
||||
/**
|
||||
* class_installer::set_writeable
|
||||
*
|
||||
* Set what files and directories must be writeable
|
||||
*
|
||||
* @param array $dirs
|
||||
* @param array $files
|
||||
*/
|
||||
function set_writeable( $dirs=array(), $files=array() )
|
||||
{
|
||||
$this->writeable_dirs = $dirs;
|
||||
$this->writeable_files = $files;
|
||||
}
|
||||
|
||||
/**
|
||||
* class_installer::check_requirements
|
||||
*
|
||||
* Checks to make sure that all requirements are met, including software versions,
|
||||
* directories, and files.
|
||||
*
|
||||
* @return array $errors
|
||||
*/
|
||||
function check_requirements()
|
||||
{
|
||||
/* Errors Array */
|
||||
$errors = array();
|
||||
|
||||
/**
|
||||
* PHP Version Checking
|
||||
*/
|
||||
|
||||
/* Check Min PHP Version */
|
||||
$check_php = explode( '.', $this->version_php_min );
|
||||
|
||||
if ( PHP_VERSION < $this->version_php_min )
|
||||
{
|
||||
$errors[] = 'Your PHP installation is too old to run this product, please upgrade before continuing.';
|
||||
}
|
||||
|
||||
/**
|
||||
* SQL Version Checking
|
||||
*/
|
||||
|
||||
/**
|
||||
* Required Directories/Files Checking
|
||||
*/
|
||||
if( count( $this->required_dirs ) )
|
||||
{
|
||||
foreach( $this->required_dirs as $_d )
|
||||
{
|
||||
if( ! ( is_dir( $_d) && is_readable( $_d ) ) )
|
||||
{
|
||||
$errors[] = 'A required directory could not be located: "' . $_d . '"';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( count( $this->required_files ) )
|
||||
{
|
||||
foreach( $this->required_files as $_f )
|
||||
{
|
||||
if( ! ( file_exists( $_f) && is_readable( $_f ) ) )
|
||||
{
|
||||
$errors[] = 'A required file could not be located: "' . $_f . '"';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Writeable Directories/File Checking
|
||||
*/
|
||||
if( count( $this->writeable_dirs ) )
|
||||
{
|
||||
foreach( $this->writeable_dirs as $_d )
|
||||
{
|
||||
if( ! is_writeable( $_d ) )
|
||||
{
|
||||
$errors[] = 'Can not write to directory: "' . $_d . '", please CHMOD to 777';
|
||||
}
|
||||
}
|
||||
|
||||
foreach( $this->writeable_files as $_f )
|
||||
{
|
||||
if( ! is_writeable( $_f ) )
|
||||
{
|
||||
$errors[] = 'Can not write to file: "' . $_f . '", please CHMOD to 777';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $errors;
|
||||
}
|
||||
|
||||
/**
|
||||
* class_installer::unpack_config
|
||||
*
|
||||
* Reads and stores the information from the config.xml file
|
||||
*
|
||||
*/
|
||||
function read_config()
|
||||
{
|
||||
// Get Configuration File
|
||||
$config = implode( '', file( INS_ROOT_PATH . 'installfiles/config.xml' ) );
|
||||
$xml = new class_xml();
|
||||
|
||||
$config = $xml->xml_parse_document( $config );
|
||||
|
||||
// Set Info
|
||||
$this->product_name = $xml->xml_array['installdata']['package']['name']['VALUE'];
|
||||
$this->product_license = $xml->xml_array['installdata']['package']['license']['VALUE'];
|
||||
$this->product_version = $xml->xml_array['installdata']['package']['version']['VALUE'];
|
||||
$this->product_long_version = $xml->xml_array['installdata']['package']['versionlong']['VALUE'];
|
||||
$this->build_id = $xml->xml_array['installdata']['package']['build']['VALUE'];
|
||||
}
|
||||
|
||||
/**
|
||||
* class_installer::write_file
|
||||
*
|
||||
* Simple method for writing a file
|
||||
*
|
||||
* @param string $name Full name, including path, of file to write
|
||||
* @param string $data Contents of file
|
||||
*/
|
||||
function write_file( $name, $data )
|
||||
{
|
||||
$fh = @fopen( $name, "w" );
|
||||
@fwrite( $fh, $data, strlen( $data ) );
|
||||
@fclose( $fh );
|
||||
}
|
||||
|
||||
/**
|
||||
* class_installer::create_admin_converge
|
||||
*
|
||||
* Builds converge entry for admin
|
||||
*
|
||||
* @return integer $id Converge ID
|
||||
*/
|
||||
function create_admin_converge()
|
||||
{
|
||||
/* Build Entry */
|
||||
$salt = $this->ipsclass->converge->generate_password_salt( 5 );
|
||||
$passhash = $this->ipsclass->converge->generate_compiled_passhash( $salt, md5( $this->saved_data['admin_pass'] ) );
|
||||
|
||||
$converge = array( 'converge_email' => $this->saved_data['admin_email'],
|
||||
'converge_joined' => time(),
|
||||
'converge_pass_hash' => $passhash,
|
||||
'converge_pass_salt' => str_replace( '\\', "\\\\", $salt ),
|
||||
);
|
||||
|
||||
/* Insert */
|
||||
$this->ipsclass->DB->do_insert( 'members_converge', $converge );
|
||||
|
||||
/* Return ID */
|
||||
return $this->ipsclass->DB->get_insert_id();
|
||||
}
|
||||
|
||||
/**
|
||||
* class_installer::chmod_dir
|
||||
*
|
||||
* chmods all files and directories in the given path
|
||||
*
|
||||
* @param string $path
|
||||
* @param integer $mode
|
||||
*/
|
||||
function chmod_dir( $path, $mode )
|
||||
{
|
||||
/* Open directory */
|
||||
$dh = @opendir( $path );
|
||||
|
||||
while( $f = @readdir( $dh ) )
|
||||
{
|
||||
if( $f != '.' && $f != '..' )
|
||||
{
|
||||
/* Full file path */
|
||||
$_path = $path . '/'. $f;
|
||||
|
||||
/* CHMOD directory and contents */
|
||||
if( @is_dir( $_path ) )
|
||||
{
|
||||
@chmod( $_path, $mode );
|
||||
$this->chmod_dir( $_path, $mode );
|
||||
}
|
||||
/* CHMOD file */
|
||||
else
|
||||
{
|
||||
@chmod( $_path, $mode );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Close directory */
|
||||
@closedir( $dh );
|
||||
}
|
||||
|
||||
/**
|
||||
* class_installer::process
|
||||
*
|
||||
* Figures out what action to run
|
||||
*
|
||||
*/
|
||||
function process()
|
||||
{
|
||||
/* Require Action */
|
||||
require_once( INS_ROOT_PATH . 'core/actions/' . $this->template->page_current . '.php' );
|
||||
|
||||
/* Initialize */
|
||||
$class = 'action_' . $this->template->page_current;
|
||||
$this->action = new $class( $this );
|
||||
$this->action->run();
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Lock installer
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Lock Installer
|
||||
* Writes a lock file
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function lock_installer()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Write!
|
||||
//-----------------------------------------
|
||||
|
||||
$this->write_file( INS_ROOT_PATH . 'installfiles/lock.php', 'LOCKED' );
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Check lock
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Lock Installer
|
||||
* Writes a lock file
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function check_lock()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Write!
|
||||
//-----------------------------------------
|
||||
|
||||
return file_exists( INS_ROOT_PATH . 'installfiles/lock.php' ) ? 1 : 0;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Authorise da membah
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
function get_member()
|
||||
{
|
||||
$member = array( 'id' => 0 );
|
||||
|
||||
$this->loginkey = $this->check_md5( $this->saved_data['loginkey'] );
|
||||
$this->securekey = $this->check_md5( $this->saved_data['securekey'] );
|
||||
$this->member_id = trim(intval($this->saved_data['mid'] ) );
|
||||
|
||||
if ( ! $this->loginkey or ! $this->securekey )
|
||||
{
|
||||
return $member;
|
||||
}
|
||||
|
||||
if( !$this->ipsclass->DB->field_exists( 'converge_id', 'members_converge' ) OR
|
||||
( isset($this->saved_data['vid']) AND $this->saved_data['vid'] <= 10003 ) )
|
||||
{
|
||||
$this->ipsclass->DB->query( "SELECT m.*, g.* FROM ibf_members m
|
||||
LEFT JOIN ibf_groups g ON ( m.mgroup=g.g_id )
|
||||
WHERE m.id='{$this->member_id}'" );
|
||||
|
||||
$member = $this->ipsclass->DB->fetch_row();
|
||||
|
||||
if( !md5($member['password']) == $this->loginkey )
|
||||
{
|
||||
if( !md5($member['legacy_password']) == $this->loginkey )
|
||||
{
|
||||
$member = array();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->ipsclass->DB->query( "SELECT m.*, g.* FROM ibf_members m
|
||||
LEFT JOIN ibf_groups g ON ( m.mgroup=g.g_id )
|
||||
WHERE m.member_login_key='{$this->loginkey}' and m.id='{$this->member_id}'" );
|
||||
|
||||
$member = $this->ipsclass->DB->fetch_row();
|
||||
}
|
||||
|
||||
return $member;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Check to see if its a 'real' MD5
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
function check_md5($t)
|
||||
{
|
||||
$t = preg_replace( "#[^a-z0-9]#", "", trim($t) );
|
||||
|
||||
if ( strlen($t) != 32 )
|
||||
{
|
||||
return '';
|
||||
}
|
||||
else
|
||||
{
|
||||
return $t;
|
||||
}
|
||||
}
|
||||
|
||||
/* Overridden by application specific class */
|
||||
function pre_process() {}
|
||||
function post_process() {}
|
||||
function set_requirements() {}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,868 @@
|
||||
<?php
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board
|
||||
| =============================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001 - 2004 Invision Power Services, Inc.
|
||||
| http://www.invisionpower.com
|
||||
| =============================================
|
||||
| Web: http://www.invisionboard.com
|
||||
| Licence Info: http://www.invisionboard.com/?license
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > Tar creation and extraction module
|
||||
| > Module written by Matt Mecham
|
||||
| > Usage style based on the C and Perl modules
|
||||
| > Will only work with PHP 4+
|
||||
|
|
||||
| > Date started: 15th Feb 2002
|
||||
|
|
||||
| > Module Version Number: 1.0.0
|
||||
| > Module Author: Matthew Mecham
|
||||
+--------------------------------------------------------------------------
|
||||
|
|
||||
| QUOTE OF THE MODULE:
|
||||
| If you can't find a program the does what you want it to do, write your
|
||||
| own.
|
||||
|
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*************************************************************
|
||||
|
|
||||
| EXTRACTION USAGE:
|
||||
|
|
||||
| $tar = new tar();
|
||||
| $tar->new_tar("/foo/bar", "myTar.tar");
|
||||
| $files = $tar->list_files();
|
||||
| $tar->extract_files( "/extract/to/here/dir" );
|
||||
|
|
||||
| CREATION USAGE:
|
||||
|
|
||||
| $tar = new tar();
|
||||
| $tar->new_tar("/foo/bar" , "myNewTar.tar");
|
||||
| $tar->current_dir("/foo" ); //Optional - tells the script which dir we are in
|
||||
| to syncronise file creation from the tarball
|
||||
| $tar->add_files( $file_names_with_path_array );
|
||||
| (or $tar->add_directory( "/foo/bar/myDir" ); to archive a complete dir)
|
||||
| $tar->write_tar();
|
||||
|
|
||||
*************************************************************/
|
||||
|
||||
|
||||
|
||||
class tar {
|
||||
|
||||
var $tar_header_length = '512';
|
||||
var $tar_unpack_header = 'a100filename/a8mode/a8uid/a8gid/a12size/a12mtime/a8chksum/a1typeflag/a100linkname/a6magic/a2version/a32uname/a32gname/a8devmajor/a8devminor/a155/prefix';
|
||||
var $tar_pack_header = 'A100 A8 A8 A8 A12 A12 A8 A1 A100 A6 A2 A32 A32 A8 A8 A155';
|
||||
var $current_dir = "";
|
||||
var $unpack_dir = "";
|
||||
var $pack_dir = "";
|
||||
var $error = "";
|
||||
var $work_dir = array();
|
||||
var $tar_in_mem = array();
|
||||
var $tar_filename = "";
|
||||
var $filehandle = "";
|
||||
var $warnings = array();
|
||||
var $attributes = array();
|
||||
var $tarfile_name = "";
|
||||
var $tarfile_path = "";
|
||||
var $tarfile_path_name = "";
|
||||
var $workfiles = array();
|
||||
|
||||
//-----------------------------------------
|
||||
// CONSTRUCTOR: Attempt to guess the current working dir.
|
||||
//-----------------------------------------
|
||||
|
||||
function tar() {
|
||||
global $HTTP_SERVER_VARS;
|
||||
|
||||
if ($this_dir = getcwd())
|
||||
{
|
||||
$this->current_dir = $this_dir;
|
||||
}
|
||||
else if (isset($HTTP_SERVER_VARS['DOCUMENT_ROOT']))
|
||||
{
|
||||
$this->current_dir = $HTTP_SERVER_VARS['DOCUMENT_ROOT'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->current_dir = './';
|
||||
}
|
||||
|
||||
// Set some attributes, these can be overriden later
|
||||
|
||||
$this->attributes = array( 'over_write_existing' => 0,
|
||||
'over_write_newer' => 0,
|
||||
'remove_tar_file' => 0,
|
||||
'remove_original_files' => 0,
|
||||
);
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Set the tarname. If we are extracting a tarball, then it must be the
|
||||
// path to the tarball, and it's name (eg: $tar->new_tar("/foo/bar" ,'myTar.tar')
|
||||
// or if we are creating a tar, then it must be the path and name of the tar file
|
||||
// to create.
|
||||
//-----------------------------------------
|
||||
|
||||
function new_tar($tarpath, $tarname) {
|
||||
|
||||
$this->tarfile_name = $tarname;
|
||||
$this->tarfile_path = $tarpath;
|
||||
|
||||
// Make sure there isn't a trailing slash on the path
|
||||
|
||||
$this->tarfile_path = preg_replace( "#[/\\\]$#" , "" , $this->tarfile_path );
|
||||
|
||||
$this->tarfile_path_name = $this->tarfile_path .'/'. $this->tarfile_name;
|
||||
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// Easy way to overwrite defaults
|
||||
//-----------------------------------------
|
||||
|
||||
function over_write_existing() {
|
||||
$this->attributes['over_write_existing'] = 1;
|
||||
}
|
||||
function over_write_newer() {
|
||||
$this->attributes['over_write_newer'] = 1;
|
||||
}
|
||||
function remove_tar_file() {
|
||||
$this->attributes['remove_tar_file'] = 1;
|
||||
}
|
||||
function remove_original_files() {
|
||||
$this->attributes['remove_original_files'] = 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// User assigns the root directory for the tar ball creation/extraction
|
||||
//-----------------------------------------
|
||||
|
||||
function current_dir($dir = "") {
|
||||
|
||||
$this->current_dir = $dir;
|
||||
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// list files: returns an array with all the filenames in the tar file
|
||||
//-----------------------------------------
|
||||
|
||||
function list_files($advanced="") {
|
||||
|
||||
// $advanced == "" - return name only
|
||||
// $advanced == 1 - return name, size, mtime, mode
|
||||
|
||||
$data = $this->read_tar();
|
||||
|
||||
$final = array();
|
||||
|
||||
foreach($data as $d)
|
||||
{
|
||||
if ($advanced == 1)
|
||||
{
|
||||
$final[] = array ( 'name' => $d['name'],
|
||||
'size' => $d['size'],
|
||||
'mtime' => $d['mtime'],
|
||||
'mode' => substr(decoct( $d['mode'] ), -4),
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$final[] = $d['name'];
|
||||
}
|
||||
}
|
||||
|
||||
return $final;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Add a directory to the tar files.
|
||||
// $tar->add_directory( str(TO DIRECTORY) )
|
||||
// Can be used in the following methods.
|
||||
// $tar->add_directory( "/foo/bar" );
|
||||
// $tar->write_tar( "/foo/bar" );
|
||||
//-----------------------------------------
|
||||
|
||||
function add_directory( $dir ) {
|
||||
|
||||
$this->error = "";
|
||||
|
||||
// Make sure the $to_dir is pointing to a valid dir, or we error
|
||||
// and return
|
||||
|
||||
if (! is_dir($dir) )
|
||||
{
|
||||
$this->error = "Extract files error: Destination directory ($to_dir) does not exist";
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$cur_dir = getcwd();
|
||||
chdir($dir);
|
||||
|
||||
$this->get_dir_contents("./");
|
||||
|
||||
$this->add_files($this->workfiles, $dir);
|
||||
|
||||
chdir($cur_dir);
|
||||
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
|
||||
function get_dir_contents( $dir )
|
||||
{
|
||||
|
||||
$dir = preg_replace( "#/$#", "", $dir );
|
||||
|
||||
if ( file_exists($dir) )
|
||||
{
|
||||
if ( is_dir($dir) )
|
||||
{
|
||||
$handle = opendir($dir);
|
||||
|
||||
while (($filename = readdir($handle)) !== false)
|
||||
{
|
||||
if (($filename != ".") && ($filename != ".."))
|
||||
{
|
||||
if (is_dir($dir."/".$filename))
|
||||
{
|
||||
$this->get_dir_contents($dir."/".$filename);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->workfiles[] = $dir."/".$filename;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
closedir($handle);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error = "$dir is not a directory";
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error = "Could not locate $dir";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Extract the tarball
|
||||
// $tar->extract_files( str(TO DIRECTORY), [ array( FILENAMES ) ] )
|
||||
// Can be used in the following methods.
|
||||
// $tar->extract( "/foo/bar" , $files );
|
||||
// This will seek out the files in the user array and extract them
|
||||
// $tar->extract( "/foo/bar" );
|
||||
// Will extract the complete tar file into the user specified directory
|
||||
//-----------------------------------------
|
||||
|
||||
function extract_files( $to_dir, $files="" ) {
|
||||
|
||||
$this->error = "";
|
||||
|
||||
// Make sure the $to_dir is pointing to a valid dir, or we error
|
||||
// and return
|
||||
|
||||
if (! is_dir($to_dir) )
|
||||
{
|
||||
$this->error = "Extract files error: Destination directory ($to_dir) does not exist";
|
||||
return;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// change into the directory chosen by the user.
|
||||
//-----------------------------------------
|
||||
|
||||
chdir($to_dir);
|
||||
$cur_dir = getcwd();
|
||||
|
||||
$to_dir_slash = $to_dir . "/";
|
||||
|
||||
//-----------------------------------------
|
||||
// Get the file info from the tar
|
||||
//-----------------------------------------
|
||||
|
||||
$in_files = $this->read_tar();
|
||||
|
||||
if ($this->error != "") {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($in_files as $file)
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Stop any potential file traversal issues
|
||||
//-----------------------------------------
|
||||
|
||||
$file['name'] = str_replace( '..', '', $file['name'] );
|
||||
|
||||
//-----------------------------------------
|
||||
// Are we choosing which files to extract?
|
||||
//-----------------------------------------
|
||||
|
||||
if (is_array($files))
|
||||
{
|
||||
if (! in_array($file['name'], $files) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
chdir($cur_dir);
|
||||
|
||||
//-----------------------------------------
|
||||
// GNU TAR format dictates that all paths *must* be in the *nix
|
||||
// format - if this is not the case, blame the tar vendor, not me!
|
||||
//-----------------------------------------
|
||||
|
||||
if ( preg_match("#/#", $file['name']) )
|
||||
{
|
||||
$path_info = explode( "/" , $file['name'] );
|
||||
$file_name = array_pop($path_info);
|
||||
} else
|
||||
{
|
||||
$path_info = array();
|
||||
$file_name = $file['name'];
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// If we have a path, then we must build the directory tree
|
||||
//-----------------------------------------
|
||||
|
||||
|
||||
if (count($path_info) > 0)
|
||||
{
|
||||
foreach($path_info as $dir_component)
|
||||
{
|
||||
if ($dir_component == "")
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if ( (file_exists($dir_component)) && (! is_dir($dir_component)) )
|
||||
{
|
||||
$this->warnings[] = "WARNING: $dir_component exists, but is not a directory";
|
||||
continue;
|
||||
}
|
||||
if (! is_dir($dir_component))
|
||||
{
|
||||
mkdir( $dir_component, 0777);
|
||||
chmod( $dir_component, 0777);
|
||||
}
|
||||
|
||||
if (! @chdir($dir_component))
|
||||
{
|
||||
$this->warnings[] = "ERROR: CHDIR to $dir_component FAILED!";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// check the typeflags, and work accordingly
|
||||
//-----------------------------------------
|
||||
|
||||
if (($file['typeflag'] == 0) or (!$file['typeflag']) or ($file['typeflag'] == ""))
|
||||
{
|
||||
if ( $FH = fopen($file_name, "wb") )
|
||||
{
|
||||
fputs( $FH, $file['data'], strlen($file['data']) );
|
||||
fclose($FH);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->warnings[] = "Could not write data to $file_name";
|
||||
}
|
||||
}
|
||||
else if ($file['typeflag'] == 5)
|
||||
{
|
||||
if ( (file_exists($file_name)) && (! is_dir($file_name)) )
|
||||
{
|
||||
$this->warnings[] = "$file_name exists, but is not a directory";
|
||||
continue;
|
||||
}
|
||||
if (! is_dir($file_name))
|
||||
{
|
||||
@mkdir( $file_name, 0777);
|
||||
}
|
||||
}
|
||||
else if ($file['typeflag'] == 6)
|
||||
{
|
||||
$this->warnings[] = "Cannot handle named pipes";
|
||||
continue;
|
||||
}
|
||||
else if ($file['typeflag'] == 1)
|
||||
{
|
||||
$this->warnings[] = "Cannot handle system links";
|
||||
}
|
||||
else if ($file['typeflag'] == 4)
|
||||
{
|
||||
$this->warnings[] = "Cannot handle device files";
|
||||
}
|
||||
else if ($file['typeflag'] == 3)
|
||||
{
|
||||
$this->warnings[] = "Cannot handle device files";
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->warnings[] = "Unknown typeflag found";
|
||||
}
|
||||
|
||||
if (! @chmod( $file_name, $file['mode'] ) )
|
||||
{
|
||||
$this->warnings[] = "ERROR: CHMOD $mode on $file_name FAILED!";
|
||||
}
|
||||
|
||||
@touch( $file_name, $file['mtime'] );
|
||||
|
||||
}
|
||||
|
||||
// Return to the "real" directory the scripts are in
|
||||
|
||||
@chdir($this->current_dir);
|
||||
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// add files:
|
||||
// Takes an array of files, and adds them to the tar file
|
||||
// Optionally takes a path to use as root for the tar file - if omitted, it
|
||||
// assumes the current working directory is the tarball root. Be careful with
|
||||
// this, or you may get unexpected results -especially when attempting to read
|
||||
// and add files to the tarball.
|
||||
// EXAMPLE DIR STRUCTURE
|
||||
// /usr/home/somedir/forums/sources
|
||||
// BRIEF: To tar up the sources directory
|
||||
// $files = array( 'sources/somescript.php', 'sources/anothersscript.php' );
|
||||
// If CWD is 'somedir', you'll need to use $tar->add_files( $files, "/usr/home/somedir/forums" );
|
||||
// or it'll attempt to open /usr/home/somedir/sources/somescript.php - which would result
|
||||
// in an error. Either that, or use:
|
||||
// chdir("/usr/home/somedir/forums");
|
||||
// $tar->add_files( $files );
|
||||
//-----------------------------------------
|
||||
|
||||
function add_files( $files, $root_path="" )
|
||||
{
|
||||
// Do we a root path to change into?
|
||||
|
||||
if ($root_path != "")
|
||||
{
|
||||
chdir($root_path);
|
||||
}
|
||||
|
||||
$count = 0;
|
||||
|
||||
foreach ($files as $file)
|
||||
{
|
||||
// is it a Mac OS X work file?
|
||||
|
||||
if ( preg_match("/\.ds_store/i", $file ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$typeflag = 0;
|
||||
$data = "";
|
||||
$linkname = "";
|
||||
|
||||
$stat = stat($file);
|
||||
|
||||
// Did stat fail?
|
||||
|
||||
if (! is_array($stat) )
|
||||
{
|
||||
$this->warnings[] = "Error: Stat failed on $file";
|
||||
continue;
|
||||
}
|
||||
|
||||
$mode = fileperms($file);
|
||||
$uid = $stat[4];
|
||||
$gid = $stat[5];
|
||||
$rdev = $stat[6];
|
||||
$size = filesize($file);
|
||||
$mtime = filemtime($file);
|
||||
|
||||
if (is_file($file))
|
||||
{
|
||||
// It's a plain file, so lets suck it up
|
||||
|
||||
$typeflag = 0;
|
||||
|
||||
if ( $FH = fopen($file, 'rb') )
|
||||
{
|
||||
$data = @fread( $FH, filesize($file) );
|
||||
fclose($FH);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->warnings[] = "ERROR: Failed to open $file";
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if (is_link($file))
|
||||
{
|
||||
$typeflag = 1;
|
||||
$linkname = @readlink($file);
|
||||
}
|
||||
else if (is_dir($file))
|
||||
{
|
||||
$typeflag = 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Sockets, Pipes and char/block specials are not
|
||||
// supported, so - lets use a silly value to keep the
|
||||
// tar ball legitimate.
|
||||
$typeflag = 9;
|
||||
}
|
||||
|
||||
// Add this data to our in memory tar file
|
||||
|
||||
$this->tar_in_mem[] = array (
|
||||
'name' => $file,
|
||||
'mode' => $mode,
|
||||
'uid' => $uid,
|
||||
'gid' => $gid,
|
||||
'size' => strlen($data),
|
||||
'mtime' => $mtime,
|
||||
'chksum' => " ",
|
||||
'typeflag' => $typeflag,
|
||||
'linkname' => $linkname,
|
||||
'magic' => "ustar\0",
|
||||
'version' => '00',
|
||||
'uname' => 'unknown',
|
||||
'gname' => 'unknown',
|
||||
'devmajor' => "",
|
||||
'devminor' => "",
|
||||
'prefix' => "",
|
||||
'data' => $data
|
||||
);
|
||||
// Clear the stat cache
|
||||
|
||||
@clearstatcache();
|
||||
|
||||
$count++;
|
||||
}
|
||||
|
||||
@chdir($this->current_dir);
|
||||
|
||||
//Return the number of files to anyone who's interested
|
||||
|
||||
return $count;
|
||||
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// write_tar:
|
||||
// Writes the tarball into the directory specified in new_tar with a filename
|
||||
// specified in new_tar
|
||||
//-----------------------------------------
|
||||
|
||||
function write_tar() {
|
||||
|
||||
if ($this->tarfile_path_name == "") {
|
||||
$this->error = 'No filename or path was specified to create a new tar file';
|
||||
return;
|
||||
}
|
||||
|
||||
if ( count($this->tar_in_mem) < 1 ) {
|
||||
$this->error = 'No data to write to the new tar file';
|
||||
return;
|
||||
}
|
||||
|
||||
$tardata = "";
|
||||
|
||||
foreach ($this->tar_in_mem as $file) {
|
||||
|
||||
$prefix = "";
|
||||
$tmp = "";
|
||||
$last = "";
|
||||
|
||||
// make sure the filename isn't longer than 99 characters.
|
||||
|
||||
if (strlen($file['name']) > 99)
|
||||
{
|
||||
$pos = strrpos( $file['name'], "/" );
|
||||
|
||||
if (is_string($pos) && !$pos)
|
||||
{
|
||||
// filename alone is longer than 99 characters!
|
||||
$this->error[] = "Filename {$file['name']} exceeds the length allowed by GNU Tape ARchives";
|
||||
continue;
|
||||
}
|
||||
|
||||
$prefix = substr( $file['name'], 0 , $pos ); // Move the path to the prefix
|
||||
$file['name'] = substr( $file['name'], ($pos+1));
|
||||
|
||||
if (strlen($prefix) > 154)
|
||||
{
|
||||
$this->error[] = "File path exceeds the length allowed by GNU Tape ARchives";
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// BEGIN FORMATTING (a8a1a100)
|
||||
|
||||
$mode = sprintf("%6s ", decoct($file['mode']));
|
||||
$uid = sprintf("%6s ", decoct($file['uid']));
|
||||
$gid = sprintf("%6s ", decoct($file['gid']));
|
||||
$size = sprintf("%11s ", decoct($file['size']));
|
||||
$mtime = sprintf("%11s ", decoct($file['mtime']));
|
||||
|
||||
$tmp = pack("a100a8a8a8a12a12",$file['name'],$mode,$uid,$gid,$size,$mtime);
|
||||
|
||||
$last = pack("a1" , $file['typeflag']);
|
||||
$last .= pack("a100" , $file['linkname']);
|
||||
|
||||
$last .= pack("a6", "ustar"); // magic
|
||||
$last .= pack("a2", "" ); // version
|
||||
$last .= pack("a32", $file['uname']);
|
||||
$last .= pack("a32", $file['gname']);
|
||||
$last .= pack("a8", ""); // devmajor
|
||||
$last .= pack("a8", ""); // devminor
|
||||
$last .= pack("a155", $prefix);
|
||||
//$last .= pack("a12", "");
|
||||
$test_len = $tmp . $last . "12345678";
|
||||
$last .= $this->internal_build_string( "\0" , ($this->tar_header_length - strlen($test_len)) );
|
||||
|
||||
// Here comes the science bit, handling
|
||||
// the checksum.
|
||||
|
||||
$checksum = 0;
|
||||
|
||||
for ($i = 0 ; $i < 148 ; $i++ )
|
||||
{
|
||||
$checksum += ord( substr($tmp, $i, 1) );
|
||||
}
|
||||
|
||||
for ($i = 148 ; $i < 156 ; $i++)
|
||||
{
|
||||
$checksum += ord(' ');
|
||||
}
|
||||
|
||||
for ($i = 156, $j = 0 ; $i < 512 ; $i++, $j++)
|
||||
{
|
||||
$checksum += ord( substr($last, $j, 1) );
|
||||
}
|
||||
|
||||
$checksum = sprintf( "%6s ", decoct($checksum) );
|
||||
|
||||
$tmp .= pack("a8", $checksum);
|
||||
|
||||
$tmp .= $last;
|
||||
|
||||
$tmp .= $file['data'];
|
||||
|
||||
// Tidy up this chunk to the power of 512
|
||||
|
||||
if ($file['size'] > 0)
|
||||
{
|
||||
if ($file['size'] % 512 != 0)
|
||||
{
|
||||
$homer = $this->internal_build_string( "\0" , (512 - ($file['size'] % 512)) );
|
||||
$tmp .= $homer;
|
||||
}
|
||||
}
|
||||
|
||||
$tardata .= $tmp;
|
||||
}
|
||||
|
||||
// Add the footer
|
||||
|
||||
$tardata .= pack( "a512", "" );
|
||||
|
||||
// print it to the tar file
|
||||
|
||||
$FH = fopen( $this->tarfile_path_name, 'wb' );
|
||||
fputs( $FH, $tardata, strlen($tardata) );
|
||||
fclose($FH);
|
||||
|
||||
@chmod( $this->tarfile_path_name, 0777);
|
||||
|
||||
// Done..
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Read the tarball - builds an associative array
|
||||
//-----------------------------------------
|
||||
|
||||
function read_tar() {
|
||||
|
||||
$filename = $this->tarfile_path_name;
|
||||
|
||||
if ($filename == "") {
|
||||
$this->error = 'No filename specified when attempting to read a tar file';
|
||||
return array();
|
||||
}
|
||||
|
||||
if (! file_exists($filename) ) {
|
||||
$this->error = 'Cannot locate the file '.$filename;
|
||||
return array();
|
||||
}
|
||||
|
||||
$tar_info = array();
|
||||
|
||||
$this->tar_filename = $filename;
|
||||
|
||||
// Open up the tar file and start the loop
|
||||
|
||||
if (! $FH = fopen( $filename , 'rb' ) ) {
|
||||
$this->error = "Cannot open $filename for reading";
|
||||
return array();
|
||||
}
|
||||
|
||||
// Grrr, perl allows spaces, PHP doesn't. Pack strings are hard to read without
|
||||
// them, so to save my sanity, I'll create them with spaces and remove them here
|
||||
|
||||
$this->tar_unpack_header = preg_replace( "/\s/", "" , $this->tar_unpack_header);
|
||||
|
||||
while (!feof($FH)) {
|
||||
|
||||
$buffer = @fread( $FH , $this->tar_header_length );
|
||||
|
||||
// check the block
|
||||
|
||||
$checksum = 0;
|
||||
|
||||
for ($i = 0 ; $i < 148 ; $i++) {
|
||||
$checksum += ord( substr($buffer, $i, 1) );
|
||||
}
|
||||
for ($i = 148 ; $i < 156 ; $i++) {
|
||||
$checksum += ord(' ');
|
||||
}
|
||||
for ($i = 156 ; $i < 512 ; $i++) {
|
||||
$checksum += ord( substr($buffer, $i, 1) );
|
||||
}
|
||||
|
||||
$fa = unpack( $this->tar_unpack_header, $buffer);
|
||||
|
||||
$name = trim($fa[filename]);
|
||||
$mode = OctDec(trim($fa[mode]));
|
||||
$uid = OctDec(trim($fa[uid]));
|
||||
$gid = OctDec(trim($fa[gid]));
|
||||
$size = OctDec(trim($fa[size]));
|
||||
$mtime = OctDec(trim($fa[mtime]));
|
||||
$chksum = OctDec(trim($fa[chksum]));
|
||||
$typeflag = trim($fa[typeflag]);
|
||||
$linkname = trim($fa[linkname]);
|
||||
$magic = trim($fa[magic]);
|
||||
$version = trim($fa[version]);
|
||||
$uname = trim($fa[uname]);
|
||||
$gname = trim($fa[gname]);
|
||||
$devmajor = OctDec(trim($fa[devmajor]));
|
||||
$devminor = OctDec(trim($fa[devminor]));
|
||||
$prefix = trim($fa[prefix]);
|
||||
|
||||
if ( ($checksum == 256) && ($chksum == 0) ) {
|
||||
//EOF!
|
||||
break;
|
||||
}
|
||||
|
||||
if ($prefix) {
|
||||
$name = $prefix.'/'.$name;
|
||||
}
|
||||
|
||||
// Some broken tars don't set the type flag
|
||||
// correctly for directories, so we assume that
|
||||
// if it ends in / it's a directory...
|
||||
|
||||
if ( (preg_match( "#/$#" , $name)) and (! $name) ) {
|
||||
$typeflag = 5;
|
||||
}
|
||||
|
||||
// If it's the end of the tarball...
|
||||
$test = $this->internal_build_string( '\0' , 512 );
|
||||
if ($buffer == $test) {
|
||||
break;
|
||||
}
|
||||
|
||||
// Read the next chunk
|
||||
|
||||
$data = @fread( $FH, $size );
|
||||
|
||||
if (strlen($data) != $size) {
|
||||
$this->error = "Read error on tar file";
|
||||
fclose( $FH );
|
||||
return array();
|
||||
}
|
||||
|
||||
$diff = $size % 512;
|
||||
|
||||
if ($diff != 0) {
|
||||
// Padding, throw away
|
||||
$crap = @fread( $FH, (512-$diff) );
|
||||
}
|
||||
|
||||
// Protect against tarfiles with garbage at the end
|
||||
|
||||
if ($name == "") {
|
||||
break;
|
||||
}
|
||||
|
||||
$tar_info[] = array (
|
||||
'name' => $name,
|
||||
'mode' => $mode,
|
||||
'uid' => $uid,
|
||||
'gid' => $gid,
|
||||
'size' => $size,
|
||||
'mtime' => $mtime,
|
||||
'chksum' => $chksum,
|
||||
'typeflag' => $typeflag,
|
||||
'linkname' => $linkname,
|
||||
'magic' => $magic,
|
||||
'version' => $version,
|
||||
'uname' => $uname,
|
||||
'gname' => $gname,
|
||||
'devmajor' => $devmajor,
|
||||
'devminor' => $devminor,
|
||||
'prefix' => $prefix,
|
||||
'data' => $data
|
||||
);
|
||||
}
|
||||
|
||||
fclose($FH);
|
||||
|
||||
return $tar_info;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// INTERNAL FUNCTIONS - These should NOT be called outside this module
|
||||
//+------------------------------------------------------------------------------
|
||||
|
||||
//-----------------------------------------
|
||||
// build_string: Builds a repititive string
|
||||
//-----------------------------------------
|
||||
|
||||
function internal_build_string($string="", $times=0) {
|
||||
|
||||
$return = "";
|
||||
for ($i=0 ; $i < $times ; ++$i ) {
|
||||
$return .= $string;
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Board
|
||||
*
|
||||
* ROOT PATH
|
||||
*
|
||||
* If __FILE__ is not supported, try ./sitecontrol and
|
||||
* turn off "USE_SHUTDOWN" or manually add in
|
||||
* the full path
|
||||
* @since 2.0.0.2005-01-01
|
||||
*/
|
||||
define( 'INS_ROOT_PATH', str_replace( "//", "/", str_replace( "/core", "", str_replace( "\\", "/", dirname( __FILE__ ) ) ) ) . "/" );
|
||||
|
||||
/**
|
||||
* DOC ROOT PATH
|
||||
*
|
||||
* If __FILE__ is not supported, try ./sitecontrol and
|
||||
* turn off "USE_SHUTDOWN" or manually add in
|
||||
* the full path
|
||||
* @since 2.0.0.2005-01-01
|
||||
*/
|
||||
define( 'ROOT_PATH', preg_replace( "#/{1,}#", "/", str_replace( "/upgrade/core", "", str_replace( "\\", "/", dirname( __FILE__ ) ) ) ) . "/" );
|
||||
|
||||
/**
|
||||
* SQL FILE
|
||||
* Use this to add a SQL file
|
||||
*/
|
||||
define( 'INS_SQL_FILE', ROOT_PATH . '/sources/sql/<%driver%>_admin_queries.php' );
|
||||
|
||||
/**
|
||||
* SQL DEFAULT PREFIX
|
||||
*/
|
||||
define( 'INS_DEFAULT_SQL_PREFIX', 'ibf_' );
|
||||
|
||||
/**
|
||||
* IPS_KERNEL Location
|
||||
*/
|
||||
define( 'KERNEL_PATH', ROOT_PATH . "ips_kernel/" );
|
||||
|
||||
error_reporting ( E_ERROR | E_WARNING | E_PARSE );
|
||||
@ini_set('display_errors', 1);
|
||||
|
||||
if( @ini_get('memory_limit') )
|
||||
{
|
||||
@ini_set('memory_limit', '200M' );
|
||||
}
|
||||
|
||||
set_magic_quotes_runtime( 0 );
|
||||
|
||||
define ( 'IN_ACP', 1 );
|
||||
define ( 'IN_IPB', 1 );
|
||||
define ( 'IN_DEV', 0 );
|
||||
define ( 'USE_SHUTDOWN', 0 );
|
||||
define ( 'SAFE_MODE_ON', 0 );
|
||||
define ( 'IPB_THIS_SCRIPT', 'admin');
|
||||
define ( 'IPB_INIT_DONE', 1 );
|
||||
|
||||
?>
|
||||
@@ -2,23 +2,17 @@
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board 2.1.7
|
||||
| =============================================
|
||||
| Invision Power Board v<{%dyn.down.var.human.version%}>
|
||||
| ========================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001 - 2005 Invision Power Services, Inc.
|
||||
| (c) 2001 - 2004 Invision Power Services
|
||||
| http://www.invisionpower.com
|
||||
| =============================================
|
||||
| ========================================
|
||||
| Web: http://www.invisionboard.com
|
||||
| http://www.ibresource.ru/products/invisionpowerboard/
|
||||
| Time: Tuesday 18th of July 2006 05:56:00 PM
|
||||
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
|
||||
| Time: <{%dyn.down.var.time%}>
|
||||
| Release: <{%dyn.down.var.md5%}>
|
||||
| Email: matt@invisionpower.com
|
||||
| Licence Info: http://www.invisionboard.com/?license
|
||||
| http://www.ibresource.ru/license
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
|
||||
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > IPB UPGRADE LOADER
|
||||
@@ -30,7 +24,7 @@
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Íåêîððåêòíûé àäðåñ</h1>Âû íå èìååòå äîñòóïà ê ýòîìó ôàéëó íàïðÿìóþ. Åñëè âû íåäàâíî îáíîâëÿëè ôîðóì, âû äîëæíû îáíîâèòü âñå ñîîòâåòñòâóþùèå ôàéëû.";
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -53,10 +47,10 @@ class core_functions
|
||||
{
|
||||
$this->ipsclass->template->content .= "
|
||||
<div class='tableborder'>
|
||||
<div class='maintitle'>Îáíîâëåíèå IPB çàâåðøåíî!</div>
|
||||
<div class='tdrow1' style='padding:6px'>Âàø ôîðóì óñïåøíî îáíîâëåí!
|
||||
<div class='maintitle'>IPB Upgrade Complete!</div>
|
||||
<div class='tdrow1' style='padding:6px'>You have now been upgraded!
|
||||
<br /><br />
|
||||
Âû äîëæíû îòêëþ÷èòü ïðàâà íà âûïîëíåíèå ñêðèïòà /upgrade/index.php èëè ïåðåèìåíîâàòü äèðåêòîðèþ /upgrade/. Èíà÷å ó âàñ ìîãóò áûòü ïðîáëåìû ñ áåçîïàñíîñòüþ.
|
||||
You may want to disable permissions on the script 'upgrade/index.php' to increase security or rename the 'upgrade' directory.
|
||||
</div>
|
||||
</div>
|
||||
";
|
||||
@@ -64,6 +58,25 @@ class core_functions
|
||||
$this->ipsclass->template->output();
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Continue with error
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
function show_error( $msg, $nextact )
|
||||
{
|
||||
$this->ipsclass->template->content .= "
|
||||
<div class='tableborder'>
|
||||
<div class='maintitle'>Error!</div>
|
||||
<div class='tdrow1' style='padding:6px'>The following database error(s) were returned:</b>
|
||||
<br /><br />$msg
|
||||
<div align='center'><span style='font-weight:bold;font-size:14px'>» <a href='index.php?act={$nextact}&loginkey={$this->ipsclass->input['loginkey']}&securekey={$this->ipsclass->input['securekey']}&mid={$this->ipsclass->input['mid']}'>Continue regardless?</a></span></div>
|
||||
</div>
|
||||
</div>
|
||||
";
|
||||
|
||||
$this->ipsclass->template->output();
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// REBUILD TEMPLATES
|
||||
/*-------------------------------------------------------------------------*/
|
||||
@@ -106,11 +119,11 @@ class core_functions
|
||||
|
||||
$extra = implode( "<br />", $acp->messages );
|
||||
|
||||
$this->ipsclass->core->redirect( "index.php?act=templatescache&justdone={$r['set_skin_set_id']}&loginkey={$this->ipsclass->input['loginkey']}&securekey={$this->ipsclass->input['securekey']}&mid={$this->ipsclass->input['mid']}", "Ïåðåñòðîéêà êåøà äëÿ ñòèëÿ «{$r['set_name']}»<br />{$extra}<br />Äàëåå ïåðåõîäèì ê ñëåäóþùåìó ñòèëþ..." );
|
||||
$this->ipsclass->core->redirect( "index.php?act=templatescache&justdone={$r['set_skin_set_id']}&loginkey={$this->ipsclass->input['loginkey']}&securekey={$this->ipsclass->input['securekey']}&mid={$this->ipsclass->input['mid']}", "Rebuild cache for skin set {$r['set_name']}<br />{$extra}<br />Proceeding to the next skin..." );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->ipsclass->core->redirect( "index.php?act=finish&loginkey={$this->ipsclass->input['loginkey']}&securekey={$this->ipsclass->input['securekey']}&mid={$this->ipsclass->input['mid']}", "Íåò áîëüøå ñòèëåé äëÿ ïåðåñòðîéêè..." );
|
||||
$this->ipsclass->core->redirect( "index.php?act=finish&loginkey={$this->ipsclass->input['loginkey']}&securekey={$this->ipsclass->input['securekey']}&mid={$this->ipsclass->input['mid']}", "No more skins to rebuild..." );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,7 +162,7 @@ class core_functions
|
||||
|
||||
if ( ! is_array( $xml->xml_array['templateexport']['templategroup']['template'] ) )
|
||||
{
|
||||
install_error("Îøèáêà â ôàéëå ipb_templates.xml — íåâîçìîæíî âûïîëíèòü ýòîò XML ôàéë");
|
||||
install_error("Error with ipb_templates.xml - could not process XML properly");
|
||||
}
|
||||
|
||||
foreach( $xml->xml_array['templateexport']['templategroup']['template'] as $id => $entry )
|
||||
@@ -184,7 +197,7 @@ class core_functions
|
||||
// Boink..
|
||||
//-----------------------------------
|
||||
|
||||
$this->ipsclass->core->redirect( "index.php?act=templatescache&loginkey={$this->ipsclass->input['loginkey']}&securekey={$this->ipsclass->input['securekey']}&mid={$this->ipsclass->input['mid']}", "Ïåðåñòðîéêà ìàñòåð øàáëîíîâ, äàëåå ïåðåñòðîéêà îáû÷íûõ øàáëîíîâ..." );
|
||||
$this->ipsclass->core->redirect( "index.php?act=templatescache&loginkey={$this->ipsclass->input['loginkey']}&securekey={$this->ipsclass->input['securekey']}&mid={$this->ipsclass->input['mid']}", "Master templates rebuilt, proceeding to recache templates..." );
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
@@ -308,17 +321,11 @@ class core_functions
|
||||
// EMOTICONS
|
||||
//-------------------------------------------------------------
|
||||
|
||||
$this->ipsclass->cache['emoticons'] = array();
|
||||
|
||||
$this->ipsclass->DB->simple_construct( array( 'select' => 'typed,image,clickable,emo_set', 'from' => 'emoticons' ) );
|
||||
$this->ipsclass->DB->simple_exec();
|
||||
|
||||
while ( $r = $this->ipsclass->DB->fetch_row() )
|
||||
{
|
||||
$this->ipsclass->cache['emoticons'][] = $r;
|
||||
}
|
||||
require_once( ROOT_PATH . 'sources/action_admin/emoticons.php' );
|
||||
$emoticons = new ad_emoticons();
|
||||
$emoticons->ipsclass =& $this->ipsclass;
|
||||
|
||||
$this->ipsclass->update_cache( array( 'name' => 'emoticons', 'array' => 1, 'deletefirst' => 1 ) );
|
||||
$emoticons->emoticon_rebuildcache();
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// LANGUAGES
|
||||
@@ -352,7 +359,7 @@ class core_functions
|
||||
|
||||
$this->ipsclass->update_cache( array( 'name' => 'attachtypes', 'array' => 1, 'deletefirst' => 1 ) );
|
||||
|
||||
$this->ipsclass->core->redirect( "index.php?act=templates&loginkey={$this->ipsclass->input['loginkey']}&securekey={$this->ipsclass->input['securekey']}&mid={$this->ipsclass->input['mid']}", "Êåøè ïåðåñòðîåíû, äàëåå ïåðåñòðîéêà øàáëîíîâ..." );
|
||||
$this->ipsclass->core->redirect( "index.php?act=templates&loginkey={$this->ipsclass->input['loginkey']}&securekey={$this->ipsclass->input['securekey']}&mid={$this->ipsclass->input['mid']}", "Caches rebuilt, proceeding to rebuild templates..." );
|
||||
|
||||
}
|
||||
|
||||
@@ -378,7 +385,7 @@ class core_functions
|
||||
'set_cache_wrapper' => $WRAPPER,
|
||||
), 'set_skin_set_id=1' );
|
||||
|
||||
$message[] = "Øàáëîíû êîìïîíåíòîâ îáíîâëåíû...";
|
||||
$message[] = "Template components updated...";
|
||||
}
|
||||
|
||||
//--------------------------------
|
||||
@@ -456,19 +463,20 @@ class core_functions
|
||||
if ( $this->ipsclass->last_poss_id != $this->ipsclass->current_upgrade )
|
||||
{
|
||||
$this->ipsclass->core->redirect( "index.php?act=work&loginkey={$this->ipsclass->input['loginkey']}&securekey={$this->ipsclass->input['securekey']}&mid={$this->ipsclass->input['mid']}",
|
||||
implode( "<br />", $message ) . "<br />Îáíîâëåíèå ìîäóëÿ çàâåðøåíî, ïåðåìåùàåìñÿ ê îáíîâëåíèþ ñëåäóþùåãî ìîäóëÿ...." );
|
||||
implode( "<br />", $message ) . "<br />Upgrade module complete, moving on to the next upgrade module...." );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->ipsclass->template->content .= "
|
||||
<div class='tableborder'>
|
||||
<div class='maintitle'>Îáíîâëåíèå IPB çàâåðøåíî</div>
|
||||
<div class='maintitle'>IPB Upgrade Complete</div>
|
||||
<div class='tdrow1' style='padding:6px'>".implode( "<br />", $message ) . "<br />
|
||||
Âàø ôîðóì áûë óñïåøíî îáíîâëåí ñ {$this->ipsclass->versions[$this->ipsclass->current_version]} äî {$this->ipsclass->versions[$this->ipsclass->current_upgrade]}
|
||||
You have now been upgraded from {$this->ipsclass->versions[$this->ipsclass->current_version]} to {$this->ipsclass->versions[$this->ipsclass->current_upgrade]}
|
||||
<br /><br />
|
||||
Ñëåäóþùèå ôèíàëüíûå ýòàïû ïðîâåðÿò íà îáíîâëåíèÿ íàñòðîéêè è ïåðåñòðîÿò âàøè êåø äàííûå (ôîðóìû, ãðóïïû, ìîäåðàòîðû è ò.ä.), à òàêæå ïåðåñòðîÿò âàøè ìàñòåð øàáëîíû...
|
||||
The next few final steps will check for updated settings and recache your cached data (forums, groups, moderators, etc) and rebuild your master templates to ensure
|
||||
that all the template additions and modifications are updated.
|
||||
<br /><br />
|
||||
<div align='center'><span style='font-weight:bold;font-size:14px'>» <a href='index.php?act=recache&loginkey={$this->ipsclass->input['loginkey']}&securekey={$this->ipsclass->input['securekey']}&mid={$this->ipsclass->input['mid']}'>Äàëåå...</a></span></div>
|
||||
<div align='center'><span style='font-weight:bold;font-size:14px'>» <a href='index.php?act=recache&loginkey={$this->ipsclass->input['loginkey']}&securekey={$this->ipsclass->input['securekey']}&mid={$this->ipsclass->input['mid']}'>Proceed...</a></span></div>
|
||||
</div>
|
||||
</div>
|
||||
";
|
||||
@@ -486,17 +494,17 @@ class core_functions
|
||||
{
|
||||
$this->ipsclass->template->content .= "<meta http-equiv='refresh' content=\"{$time}; url={$url}\">
|
||||
<div class='tableborder'>
|
||||
<div class='maintitle'>Ïåðåàäðåñàöèÿ</div>
|
||||
<div class='maintitle'>Redirecting</div>
|
||||
<div class='tdrow1' style='padding:8px'>
|
||||
<div style='font-size:12px'>$text
|
||||
<br />
|
||||
<br />
|
||||
<center><a href='{$url}'>Íàæìèòå ñþäà, åñëè âû íå áûëè ïåðåìåùåíû...</a></center>
|
||||
<center><a href='{$url}'>Click here if not redirected...</a></center>
|
||||
</div>
|
||||
</div>
|
||||
</div>";
|
||||
|
||||
$this->ipsclass->template->output("Ïåðåàäðåñàöèÿ...");
|
||||
$this->ipsclass->template->output("Redirecting...");
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
@@ -505,23 +513,25 @@ class core_functions
|
||||
|
||||
function login_screen($msg='')
|
||||
{
|
||||
$alert = "";
|
||||
|
||||
if ( ! file_exists( ROOT_PATH.'ipb_templates.xml' ) )
|
||||
{
|
||||
$alert .= "<div class='warnbox'><b>Íåâîçìîæíî íàéòè XML øàáëîíû</b><br />Îíè äîëæíû íàõîäèòüñÿ â «ipb_templates.xml» ïîæàëóéñòà ïðîâåðüòå, ÷òîáû ýòîò ôàéë áûë çàãðóæåí. Áåç íåãî ïðîäîëæåíèå íåâîçìîæíî.
|
||||
<br /><strong>Åñëè âû íå çàãðóçèòå ýòîò ôàéë, òî âàøè øàáëîíû íå áóäóò îáíîâëåíû!</strong></div>";
|
||||
$alert .= "<div class='warnbox'><b>Cannot locate XML templates</b><br />This should be located in 'ipb_templates.xml' please ensure this file is uploaded (recreating the file structure if needed) before continuing.
|
||||
<br /><strong>Failure to upload this file will mean that your templates will not be updated.</strong></div>";
|
||||
}
|
||||
|
||||
if ( ! is_writeable( CACHE_PATH . 'cache/skin_cache' ) )
|
||||
{
|
||||
$alert .= "<div class='warnbox'><strong>ÂÍÈÌÀÍÈÅ: Ïàïêà cache/skin_cache íåäîñòóïíà äëÿ çàïèñè</strong><br />
|
||||
Ïîæàëóéñòà, ïðîâåðüòå CHMOD äëÿ ýòîé ïàïêè. Åñëè âû ïðîèãíîðèðóåòå ýòî ïðåäóïðåæäåíèå, òî ôàéëû ñòèëåé
|
||||
ìîãóò íåêîððåêòíî óñòàíîâèòüñÿ.</div>";
|
||||
$alert .= "<div class='warnbox'><strong>WARNING: cache/skin_cache is not writeable</strong><br />
|
||||
Please check the CHMOD value on this folder before continuing. Failure to do so could mean that
|
||||
your skin files will not be installed correctly.</div>";
|
||||
}
|
||||
|
||||
if ( $alert )
|
||||
{
|
||||
$this->ipsclass->template->content .= "{$alert}";
|
||||
$this->ipsclass->template->output("ÂÍÈÌÀÍÈÅ");
|
||||
$this->ipsclass->template->output("WARNING");
|
||||
exit();
|
||||
}
|
||||
|
||||
@@ -534,29 +544,29 @@ class core_functions
|
||||
<form action='index.php?act=login' method='post' name='theAdminForm'>
|
||||
{$msg}
|
||||
<div>
|
||||
<strong>Âû îáÿçàíû àâòîðèçîâàòüñÿ ñ âàøèìè äàííûìè äëÿ âõîäà â âàø ôîðóì ïîä ó÷åòíîé çàïèñüþ àäìèíèñòðàòîðà. Èíà÷å âû ïðîñòî íå ñìîæåòå âîñïîëüçîâàòüñÿ ñèñòåìîé îáíîâëåíèÿ.
|
||||
<br />Îáíîâëåíèå ñ âåðñèè {$this->ipsclass->versions[$this->ipsclass->current_version]} äî {$this->ipsclass->versions[$this->ipsclass->current_upgrade]}</strong>
|
||||
<strong>You must log in with your forums administrative log in details to access the upgrade system.
|
||||
<br />Upgrading from {$this->ipsclass->versions[$this->ipsclass->current_version]} to {$this->ipsclass->versions[$this->ipsclass->current_upgrade]}</strong>
|
||||
</div>
|
||||
<br />
|
||||
<div class='tableborder'>
|
||||
<div class='maintitle'>Òðåáóåòñÿ àâòîðèçàöèÿ</div>
|
||||
<div class='maintitle'>Verification Required - Please Log In</div>
|
||||
<table width='100%' cellspacing='0' cellpadding='5' align='center' border='0'>
|
||||
<tr>
|
||||
<td class='tdrow1' width='40%' valign='middle'>Âàøå èìÿ ïîëüçîâàòåëÿ íà ôîðóìå:</td>
|
||||
<td class='tdrow1' width='40%' valign='middle'>Your Forums Username:</td>
|
||||
<td class='tdrow2' width='60%' valign='middle'><input type='text' style='width:100%' name='username' value=''></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='tdrow1' width='40%' valign='middle'>Âàø ïàðîëü íà ôîðóìå:</td>
|
||||
<td class='tdrow1' width='40%' valign='middle'>Your Forums Password:</td>
|
||||
<td class='tdrow2' width='60%' valign='middle'><input type='password' style='width:100%' name='password' value=''></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='pformstrip' colspan='2'><div align='center'><input type='submit' value='Âîéòè' id='button' accesskey='s'></div></td>
|
||||
<td class='pformstrip' colspan='2'><div align='center'><input type='submit' value='Log in' id='button' accesskey='s'></div></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</form>";
|
||||
|
||||
$this->ipsclass->template->output("Âîéòè");
|
||||
$this->ipsclass->template->output("Log In");
|
||||
|
||||
}
|
||||
|
||||
@@ -568,18 +578,25 @@ class core_functions
|
||||
{
|
||||
$member = array( 'id' => 0 );
|
||||
|
||||
$this->ipsclass->loginkey = $this->check_md5( $this->ipsclass->input['loginkey'] );
|
||||
$this->ipsclass->securekey = $this->check_md5( $this->ipsclass->input['securekey'] );
|
||||
$this->ipsclass->member_id = trim(intval($this->ipsclass->input['mid'] ) );
|
||||
$this->ipsclass->loginkey = $this->check_md5( isset($this->ipsclass->input['loginkey']) ? $this->ipsclass->input['loginkey'] : '' );
|
||||
$this->ipsclass->securekey = $this->check_md5( isset($this->ipsclass->input['securekey']) ? $this->ipsclass->input['securekey'] : '' );
|
||||
$this->ipsclass->member_id = trim(intval( isset($this->ipsclass->input['mid']) ? $this->ipsclass->input['mid'] : 0 ) );
|
||||
|
||||
if ( ! $this->ipsclass->loginkey or ! $this->ipsclass->securekey )
|
||||
{
|
||||
return $member;
|
||||
}
|
||||
|
||||
$this->ipsclass->DB->query( "SELECT m.*, g.* FROM ibf_members m
|
||||
LEFT JOIN ibf_groups g ON ( m.mgroup=g.g_id )
|
||||
WHERE member_login_key='{$this->ipsclass->loginkey}' and id='{$this->ipsclass->member_id}'" );
|
||||
$this->ipsclass->DB->build_query( array( 'select' => 'm.*,g.*',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => "m.member_login_key='{$this->ipsclass->loginkey}' and m.id='{$this->ipsclass->member_id}'",
|
||||
'limit' => array( 0, 1 ),
|
||||
'add_join' => array( 1 => array( 'type' => 'left',
|
||||
'from' => array( 'groups' => 'g' ),
|
||||
'where' => 'g.g_id=m.mgroup',
|
||||
) )
|
||||
) );
|
||||
$this->ipsclass->DB->exec_query();
|
||||
|
||||
$member = $this->ipsclass->DB->fetch_row();
|
||||
|
||||
|
||||
+521
-132
@@ -1,133 +1,522 @@
|
||||
<?php
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board 2.1.7
|
||||
| =============================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001 - 2005 Invision Power Services, Inc.
|
||||
| http://www.invisionpower.com
|
||||
| =============================================
|
||||
| Web: http://www.invisionboard.com
|
||||
| http://www.ibresource.ru/products/invisionpowerboard/
|
||||
| Time: Tuesday 18th of July 2006 05:56:00 PM
|
||||
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
|
||||
| Licence Info: http://www.invisionboard.com/?license
|
||||
| http://www.ibresource.ru/license
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
|
||||
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > IPB UPGRADE TEMPLATE MODULES
|
||||
| > Script written by Matt Mecham
|
||||
| > Date started: 23rd April 2004
|
||||
+--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Íåêîððåêòíûé àäðåñ</h1>Âû íå èìååòå äîñòóïà ê ýòîìó ôàéëó íàïðÿìóþ. Åñëè âû íåäàâíî îáíîâëÿëè ôîðóì, âû äîëæíû îáíîâèòü âñå ñîîòâåòñòâóþùèå ôàéëû.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class template
|
||||
{
|
||||
var $content = "";
|
||||
|
||||
function output($title='')
|
||||
{
|
||||
$year = date("Y");
|
||||
print $this->print_top($title);
|
||||
print $this->content;
|
||||
print "<br><br><br><br><center><span id='copy'><a href='http://www.ibresource.ru/'>Ðóññêàÿ âåðñèÿ</a> <a href='http://www.invisionboard.com'>Invision Power Board</a> © $year <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a></span></center>
|
||||
</div></body>
|
||||
</html>";
|
||||
exit();
|
||||
}
|
||||
|
||||
//--------------------------------------
|
||||
|
||||
function print_top($title="")
|
||||
{
|
||||
|
||||
return "<html>
|
||||
<head>
|
||||
<meta http-equiv=\"content-type\" content=\"text/html; charset=windows-1251\" >
|
||||
<title>Ñêðèïò îáíîâëåíèÿ Invision Power Board :: $title </title>
|
||||
<style type='text/css'>
|
||||
|
||||
BODY
|
||||
{
|
||||
font-size: 11px;
|
||||
font-family: Verdana, Arial;
|
||||
color: #000;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
background-image: url(../install/img/fadebg.jpg);
|
||||
background-repeat: no-repeat;
|
||||
background-position: right bottom;
|
||||
}
|
||||
|
||||
TABLE, TR, TD { font-family:Verdana, Arial;font-size: 11px; color:#000 }
|
||||
|
||||
a:link, a:visited, a:active { color:#000055 }
|
||||
a:hover { color:#333377;text-decoration:underline }
|
||||
|
||||
.centerbox { margin-right:10%;margin-left:10%;text-align:left }
|
||||
|
||||
.warnbox {
|
||||
border:1px solid #F00;
|
||||
background: #FFE0E0;
|
||||
padding:6px;
|
||||
margin-right:10%;margin-left:10%;text-align:left;
|
||||
}
|
||||
|
||||
.tablepad { background-color:#F5F9FD;padding:6px }
|
||||
.description { color:gray;font-size:10px }
|
||||
.pformstrip { background-color: #D1DCEB; color:#3A4F6C;font-weight:bold;padding:7px;margin-top:1px;text-align:left }
|
||||
.pformleftw { background-color: #F5F9FD; padding:6px; margin-top:1px;width:50%; border-top:1px solid #C2CFDF; border-right:1px solid #C2CFDF; }
|
||||
.pformright { background-color: #F5F9FD; padding:6px; margin-top:1px;border-top:1px solid #C2CFDF; }
|
||||
|
||||
.tableborder { border:1px solid #345487;background-color:#FFF; padding:0px; margin:0px; width:100% }
|
||||
|
||||
.maintitle { text-align:left;vertical-align:middle;font-weight:bold; color:#FFF; letter-spacing:1px; padding:8px 0px 8px 5px; background-image: url(../install/img/tile_back.gif) }
|
||||
.maintitle a:link, .maintitle a:visited, .maintitle a:active { text-decoration: none; color: #FFF }
|
||||
.maintitle a:hover { text-decoration: underline }
|
||||
|
||||
#copy { font-size:10px }
|
||||
|
||||
#button { background-color: #4C77B6; color: #FFFFFF; font-family:Verdana, Arial; font-size:11px }
|
||||
|
||||
#textinput { background-color: #EEEEEE; color:Ê#000000; font-family:Verdana, Arial; font-size:11px; width:100% }
|
||||
|
||||
#dropdown { background-color: #EEEEEE; color:Ê#000000; font-family:Verdana, Arial; font-size:10px }
|
||||
|
||||
#multitext { background-color: #EEEEEE; color:Ê#000000; font-family:Courier, Verdana, Arial; font-size:10px }
|
||||
|
||||
#logostrip {
|
||||
padding: 0px;
|
||||
margin: 0px;
|
||||
background: #7AA3D0;
|
||||
}
|
||||
|
||||
.fade
|
||||
{
|
||||
background-image: url(../install/img/fade.jpg);
|
||||
background-repeat: repeat-x;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body marginheight='0' marginwidth='0' leftmargin='0' topmargin='0' bgcolor='#FFFFFF'>
|
||||
|
||||
<div id='logostrip'><img src='../install/img/title.gif' border='0' alt='Invision Power Board' /></div>
|
||||
<div class='fade'> </div>
|
||||
<br />
|
||||
<div style='padding:10px'>
|
||||
";
|
||||
|
||||
}
|
||||
}
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Board
|
||||
* Template Controller for installer framework
|
||||
*/
|
||||
|
||||
class install_template
|
||||
{
|
||||
var $page_title = '';
|
||||
var $page_content = '';
|
||||
var $page_current = '';
|
||||
var $message = '';
|
||||
var $hide_next = 0;
|
||||
var $in_error = 0;
|
||||
|
||||
var $install_pages = array();
|
||||
|
||||
var $ipsclass;
|
||||
|
||||
/**
|
||||
* install_template::install_template
|
||||
*
|
||||
* CONSTRUCTOR
|
||||
*
|
||||
*/
|
||||
function install_template( &$ipsclass )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$_pages = array();
|
||||
$this->ipsclass =& $ipsclass;
|
||||
|
||||
//-----------------------------------------
|
||||
// Grab XML file and check
|
||||
//-----------------------------------------
|
||||
|
||||
if ( file_exists( INS_ROOT_PATH . 'installfiles/sequence.xml' ) )
|
||||
{
|
||||
$config = implode( '', file( INS_ROOT_PATH . 'installfiles/sequence.xml' ) );
|
||||
$xml = new class_xml();
|
||||
|
||||
$config = $xml->xml_parse_document( $config );
|
||||
|
||||
//-----------------------------------------
|
||||
// Loop through and sort out settings...
|
||||
//-----------------------------------------
|
||||
|
||||
foreach( $xml->xml_array['installdata']['action'] as $id => $entry )
|
||||
{
|
||||
$_pages[ $entry['position']['VALUE'] ] = array( 'file' => $entry['file']['VALUE'],
|
||||
'menu' => $entry['menu']['VALUE'] );
|
||||
}
|
||||
|
||||
ksort( $_pages );
|
||||
|
||||
foreach( $_pages as $position => $data )
|
||||
{
|
||||
$this->install_pages[ $data['file'] ] = $data['menu'];
|
||||
}
|
||||
}
|
||||
|
||||
$this->install_pages['done'] = 'Finish';
|
||||
|
||||
/* Set Current Page */
|
||||
$this->page_current = ( $this->ipsclass->input['p'] ) ? $this->ipsclass->input['p'] : 'login';
|
||||
|
||||
if( ! $this->install_pages[$this->page_current] )
|
||||
{
|
||||
$this->page_current = 'login';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* install_template::set_title
|
||||
*
|
||||
* Sets the title for the current page
|
||||
*
|
||||
* @var string $title
|
||||
*/
|
||||
function set_title( $title )
|
||||
{
|
||||
$this->page_title = $title;
|
||||
}
|
||||
|
||||
/**
|
||||
* install_template::append
|
||||
*
|
||||
* Adds to the main body output
|
||||
*
|
||||
* @var string $add
|
||||
*/
|
||||
|
||||
function append( $add )
|
||||
{
|
||||
$this->page_content .= $add;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* install_template::output
|
||||
*
|
||||
* Builds page and sends to browser
|
||||
*
|
||||
*/
|
||||
function output()
|
||||
{
|
||||
/* Build Side Bar */
|
||||
$curr_reached = 0;
|
||||
$this->progress = array();
|
||||
|
||||
foreach( $this->install_pages as $key => $page )
|
||||
{
|
||||
if( $key == $this->page_current )
|
||||
{
|
||||
$this->progress[] = array( 'step_doing', $page );
|
||||
$curr_reached = 1;
|
||||
}
|
||||
else if( $curr_reached )
|
||||
{
|
||||
$this->progress[] = array( 'step_notdone', $page );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->progress[] = array( 'step_done', $page );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$this->page_template();
|
||||
}
|
||||
|
||||
/***************************************************************
|
||||
*
|
||||
* HTML TEMPLATE FUNCTIONS
|
||||
*
|
||||
**************************************************************/
|
||||
|
||||
// ------------------------------------------------------------
|
||||
// Main Template
|
||||
// ------------------------------------------------------------
|
||||
function page_template()
|
||||
{
|
||||
echo <<<EOF
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>IPS Upgrader</title>
|
||||
<style type='text/css' media='all'>
|
||||
@import url('install.css');
|
||||
</style>
|
||||
<script type='text/javascript'>
|
||||
//<![CDATA[
|
||||
if (top.location != self.location) { top.location = self.location }
|
||||
var use_enhanced_js = 1;
|
||||
//]]>
|
||||
</script>
|
||||
<script type="text/javascript" src='ips_xmlhttprequest.js'></script>
|
||||
</head>
|
||||
<body>
|
||||
<p> </p>
|
||||
<p> </p>
|
||||
<p> </p>
|
||||
<form id='install-form' action='index.php{$this->next_action}' method='post'>
|
||||
<input type='hidden' name='saved_data' value='{$this->saved_data}'>
|
||||
|
||||
<div id='ipswrapper'>
|
||||
<div class='main_shell'>
|
||||
|
||||
<h1><img src='images/package_icon.gif' align='absmiddle' /> Welcome to the IPB Upgrader</h1>
|
||||
<div class='content_shell'>
|
||||
<div class='package'>
|
||||
<div>
|
||||
<div class='install_info'>
|
||||
<h3>{$this->install_pages[$this->page_current]}</h3>
|
||||
|
||||
<ul id='progress'>
|
||||
|
||||
EOF;
|
||||
|
||||
foreach( $this->progress as $p )
|
||||
{
|
||||
echo "<li class='{$p[0]}'>{$p[1]}</li>";
|
||||
}
|
||||
|
||||
echo <<<EOF
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class='content_wrap'>
|
||||
<div style='border-bottom: 1px solid #939393; padding-bottom: 4px;'>
|
||||
<div class='float_img'>
|
||||
<img src='images/box.gif' />
|
||||
</div>
|
||||
|
||||
<div style='vertical-align: middle'>
|
||||
<h2>{$this->product_name} Upgrade</h2>
|
||||
<!--<strong>{$this->product_version}</strong>-->
|
||||
</div>
|
||||
</div>
|
||||
<div style='clear:both'></div>
|
||||
|
||||
{$this->page_content}
|
||||
<br />
|
||||
</div>
|
||||
</div>
|
||||
<br clear='all' />
|
||||
|
||||
<div class='hr'></div>
|
||||
<div style='padding-top: 17px; padding-right: 15px; padding-left: 15px'>
|
||||
<div style='float: left'>
|
||||
<input type='button' class='nav_button' value='Cancel Upgrade' onclick="window.location='index.php';return false;">
|
||||
</div>
|
||||
|
||||
<div style='float: right'>
|
||||
EOF;
|
||||
|
||||
if( ! $this->hide_next )
|
||||
{
|
||||
if( $this->next_action == 'disabled' )
|
||||
{
|
||||
echo <<<EOF
|
||||
<input type='submit' class='nav_button' value='Upgrade can not continue...' disabled='disabled'>
|
||||
EOF;
|
||||
}
|
||||
else if( $this->in_error == 1 )
|
||||
{
|
||||
echo <<<EOF
|
||||
<input type='submit' class='nav_button' value='Continue regardless?'>
|
||||
EOF;
|
||||
}
|
||||
else
|
||||
{
|
||||
echo <<<EOF
|
||||
<input type='submit' class='nav_button' value='Next >'>
|
||||
EOF;
|
||||
}
|
||||
}
|
||||
|
||||
echo <<<EOF
|
||||
</div>
|
||||
</div>
|
||||
<div style='clear: both;'></div>
|
||||
<div class='copyright'>
|
||||
©
|
||||
EOF;
|
||||
echo date("Y");
|
||||
echo <<<EOF
|
||||
Invision Power Services, Inc.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
EOF;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------
|
||||
// Login Page Template
|
||||
// ------------------------------------------------------------
|
||||
function login_page( $msg='' )
|
||||
{
|
||||
if ( $msg )
|
||||
{
|
||||
$extra = "<div class='warning'>
|
||||
<div style='float: left; margin-right: 7px; margin-left: 5px'><img src='images/warning.gif' /></div>
|
||||
<p>{$msg}</p>
|
||||
</div><br />";
|
||||
}
|
||||
|
||||
|
||||
return <<<EOF
|
||||
<br />
|
||||
<div>
|
||||
<div style='float: left; margin-right: 7px; margin-left: 5px;'>
|
||||
<img src='images/wizard.gif' align='absmiddle' />
|
||||
</div>
|
||||
<div>
|
||||
Welcome to the upgrade routine for {$this->product_name}. This wizard will guide you through the upgrade process.
|
||||
</div>
|
||||
</div>
|
||||
<br/>{$extra}
|
||||
<h3>Verification Required - Please Log In</h3>
|
||||
You must log in with your forums administrative log in details to access the upgrade system.<br />
|
||||
<br />
|
||||
<table width='100%' cellspacing='0' cellpadding='5' align='center' border='0'>
|
||||
<tr>
|
||||
<td width='40%' valign='middle'>Your Forum Username:</td>
|
||||
<td width='60%' valign='middle'><input type='text' style='width:100%' name='username' value='' class='sql_form'></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width='40%' valign='middle'>Your Forum Password:</td>
|
||||
<td width='60%' valign='middle'><input type='password' style='width:100%' name='password' value='' class='sql_form'></td>
|
||||
</tr>
|
||||
</table>
|
||||
EOF;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------
|
||||
// Overview Page Template
|
||||
// ------------------------------------------------------------
|
||||
function overview_page( $current_version, $summary )
|
||||
{
|
||||
return <<<EOF
|
||||
<br />
|
||||
<div>
|
||||
<div style='float: left; margin-right: 7px; margin-left: 5px;'>
|
||||
<img src='images/wizard.gif' align='absmiddle' />
|
||||
</div>
|
||||
<div>
|
||||
Welcome to the upgrader for {$this->product_name}. This wizard will guide you through the upgrade process.
|
||||
</div>
|
||||
</div>
|
||||
<br/>
|
||||
<h3>Upgrade summary</h3>
|
||||
Current version: $current_version.<br />
|
||||
This script will: $summary<br />
|
||||
<br />
|
||||
EOF;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------
|
||||
// EULA Page Template
|
||||
// ------------------------------------------------------------
|
||||
function eula_page( $eula )
|
||||
{
|
||||
return <<<EOF
|
||||
|
||||
<script language='javascript'>
|
||||
|
||||
check_eula = function()
|
||||
{
|
||||
if( document.getElementById( 'eula' ).checked == true )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
alert( 'You must agree to the license before continuing' );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
document.getElementById( 'install-form' ).onsubmit = check_eula;
|
||||
|
||||
</script>
|
||||
|
||||
Please read and agree to the End User License Agreement before continuing.<br /><br />
|
||||
|
||||
|
||||
<div class='eula'>
|
||||
$eula
|
||||
</div>
|
||||
<input type='checkbox' name='eula' id='eula'><strong> I agree to the license agreement</strong>
|
||||
|
||||
|
||||
EOF;
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------
|
||||
// Install Page Splash Template
|
||||
// ------------------------------------------------------------
|
||||
function install_page()
|
||||
{
|
||||
return <<<EOF
|
||||
<br />
|
||||
The upgrader is now ready to complete the upgrade of your {$this->product_name}. Click <strong>Start</strong> to
|
||||
begin the automatic process!<br /><br />
|
||||
<ul id='links'>
|
||||
<li><img src='images/link.gif' align='absmiddle' /> <input type='checkbox' name='helpfile' id='helpfile' value='1' checked='checked' /> Update my help files if changes are found</li>
|
||||
<li><img src='images/link.gif' align='absmiddle' /> <input type='checkbox' name='man' id='man' value='1' /> Show me manual upgrade steps for SQL queries to prevent timeouts</li>
|
||||
</ul>
|
||||
|
||||
<br /><br />
|
||||
|
||||
<div style='float: right'>
|
||||
<input type='submit' class='nav_button' value='Start upgrade...'>
|
||||
</div>
|
||||
EOF;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------
|
||||
// Install Page Refresh Template
|
||||
// ------------------------------------------------------------
|
||||
function install_page_refresh( $output=array() )
|
||||
{
|
||||
$HTML = <<<EOF
|
||||
<script type='text/javascript'>
|
||||
//<![CDATA[
|
||||
setTimeout("form_redirect()",2000);
|
||||
|
||||
function form_redirect()
|
||||
{
|
||||
document.getElementById( 'install-form' ).submit();
|
||||
}
|
||||
//]]>
|
||||
</script>
|
||||
<ul id='auto_progress'>
|
||||
EOF;
|
||||
|
||||
foreach( $output as $l )
|
||||
{
|
||||
$HTML .= <<<EOF
|
||||
<li><img src='images/check.gif' align='absmiddle' /> $l</li>
|
||||
EOF;
|
||||
}
|
||||
|
||||
$HTML .= <<<EOF
|
||||
</ul>
|
||||
<br />
|
||||
<div style='float: right'>
|
||||
<input type='submit' class='nav_button' value='Click here if not forwarded' />
|
||||
</div>
|
||||
EOF;
|
||||
|
||||
return $HTML;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------
|
||||
// Install Progress Screen
|
||||
// ------------------------------------------------------------
|
||||
function install_progress( $line )
|
||||
{
|
||||
$HTML = <<<EOF
|
||||
<ul id='auto_progress'>
|
||||
EOF;
|
||||
|
||||
foreach( $line as $l )
|
||||
{
|
||||
$HTML .= <<<EOF
|
||||
<li><img src='images/check.gif' align='absmiddle' /> $l</li>
|
||||
EOF;
|
||||
}
|
||||
|
||||
$HTML .= <<<EOF
|
||||
</ul>
|
||||
EOF;
|
||||
|
||||
return $HTML;
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------
|
||||
// Install Skin Revert
|
||||
// ------------------------------------------------------------
|
||||
function install_template_skinrevert( $skin_name="" )
|
||||
{
|
||||
$HTML = <<<EOF
|
||||
<br /><h3><b>Revert skin changes?</b></h3><br />
|
||||
During upgrades, there are often changes to the skin templates to fix bugs or add new features.<br /><br />
|
||||
If you do not revert changes you have made to your skin templates, you will not see the changes we have made, however if you have modified
|
||||
your skin templates reverting the skin changes will cause you to <i><b>lose</b></i> the customizations you have made.<br /><br />
|
||||
If you have not made many customizations to your skins, it is recommended that you choose to revert your skin changes.<br /><br />
|
||||
If you have custom skins installed, or have heavily modified your skin templates, it is recommended that you use the skin difference tool
|
||||
available in your admin control panel after the upgrade is complete to apply new changes to your templates instead.<br /><br />
|
||||
|
||||
<h3>Do you wish to revert changes made to '<b>{$skin_name}</b>'?</h3>
|
||||
<ul id='links'>
|
||||
<li><img src='images/link.gif' align='absmiddle' /> <input type='radio' name='do' value='all' /> Revert changes to all of my skins</li>
|
||||
<li><img src='images/link.gif' align='absmiddle' /> <input type='radio' name='do' value='1' /> Revert changes to '{$skin_name}'</li>
|
||||
<li><img src='images/link.gif' align='absmiddle' /> <input type='radio' name='do' value='none' /> Do not revert changes to any of my skins</li>
|
||||
<li><img src='images/link.gif' align='absmiddle' /> <input type='radio' name='do' value='0' /> Do not revert changes to '{$skin_name}'</li>
|
||||
</ul>
|
||||
EOF;
|
||||
|
||||
return $HTML;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------
|
||||
// Install Done Screen
|
||||
// ------------------------------------------------------------
|
||||
function install_done( $url )
|
||||
{
|
||||
$HTML .= <<<EOF
|
||||
<br />
|
||||
<img src='images/install_done.gif' align='absmiddle' /> <span class='done_text'>Upgrade complete!</span><br /><br />
|
||||
Congratulations, your <a href='$url'>{$this->product_name}</a> is now up to date and ready to use! Below are some
|
||||
links you may find useful.<br /><br /><br />
|
||||
<h3>Useful Links</h3>
|
||||
<ul id='links'>
|
||||
<li><img src='images/link.gif' align='absmiddle' /> <a href='http://www.invisionpower.com/landing/?p=clientarea'>Client area</a></li>
|
||||
<li><img src='images/link.gif' align='absmiddle' /> <a href='http://www.invisionpower.com/landing/?p=docs-ipd'>Documentation</a></li>
|
||||
<li><img src='images/link.gif' align='absmiddle' /> <a href='http://www.invisionpower.com/landing/?p=forums'>IPS Company Forum</a></li>
|
||||
</ul>
|
||||
EOF;
|
||||
return $HTML;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------
|
||||
// Warning Message Template
|
||||
// ------------------------------------------------------------
|
||||
function warning( $messages )
|
||||
{
|
||||
$HTML = <<<EOF
|
||||
<br />
|
||||
<div class='warning'>
|
||||
<div style='float: left; margin-right: 7px; margin-left: 5px'><img src='images/warning.gif' /></div>
|
||||
EOF;
|
||||
|
||||
foreach( $messages as $msg )
|
||||
{
|
||||
$HTML .= "<p>$msg</p>";
|
||||
}
|
||||
|
||||
$HTML .= <<<EOF
|
||||
</div><br />
|
||||
|
||||
EOF;
|
||||
|
||||
$this->append( $HTML );
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in new issue
Block a user