Files
IPB/upload/upgrade/upgrade.php
T
2025-12-19 00:21:15 -08:00

1480 lines
52 KiB
PHP

<?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 1.x -> 2.0!
| > Script written by Matt Mecham
| > Date started: 21st April 2004
| > Interesting fact: Radiohead rock (Rain down, Rain down,
come on rain down. On me. From a great height)
+--------------------------------------------------------------------------
*/
/**
* Upgrade wrapper
*
* Set-up and load module to run
*
* @package InvisionPowerBoard
* @author Matt Mecham
* @version 2.1
*/
/**
* Script type
*
*/
define( 'IPB_THIS_SCRIPT', 'upgrade' );
define( 'IPB_LOAD_SQL' , 'admin_queries' );
require_once( '../init.php' );
//-----------------------------------------------
// USER CONFIGURABLE ELEMENTS
//-----------------------------------------------
define( 'THIS_PATH' , './' );
define( 'UPGRADE_DIR', 'upgrade' );
$INFO = array();
//--------------------------------
// Require our global functions
//--------------------------------
require ROOT_PATH . "conf_global.php";
require ROOT_PATH . "sources/ipsclass.php";
require KERNEL_PATH . "class_converge.php";
require THIS_PATH . "core/functions.php";
require THIS_PATH . "core/template.php";
# Initiate super-class
$ipsclass = new ipsclass();
$ipsclass->vars = $INFO;
//--------------------------------
// The clocks a' tickin'
//--------------------------------
$Debug = new Debug;
$Debug->startTimer();
//--------------------------------
// Load the DB driver and such
//--------------------------------
$ipsclass->init_db_connection();
//--------------------------------
// Set up our vars
//--------------------------------
$ipsclass->parse_incoming();
//--------------------------------
// Set converge
//--------------------------------
$ipsclass->converge = new class_converge( $ipsclass->DB );
//--------------------------------
// Initialize the FUNC
//--------------------------------
$ipsclass->initiate_ipsclass();
//--------------------------------
// Set up our vars
//--------------------------------
$ipsclass->core = new core_functions();
$ipsclass->core->ipsclass =& $ipsclass;
$ipsclass->template = new template();
$ipsclass->template->ipsclass =& $ipsclass;
$ipsclass->base_url = 'upgrade.php?';
$ipsclass->next_step = intval($ipsclass->input['step']) + 1;
//--------------------------------
// OG
//--------------------------------
$runme = new upgrade_legacy();
$runme->ipsclass =& $ipsclass;
$runme->autorun();
/**
* main core class
*
*/
class upgrade_legacy
{
var $ipsclass;
function autorun()
{
//--------------------------------
// GET QUERIES FILE (1.2 or 1.3)?
// If we have subs table, it's 1.3
//--------------------------------
if ( ! $this->ipsclass->input['version'] )
{
if ( $this->_check_for_two() )
{
$this->ipsclass->input['version'] = '200';
print "Âû, êàæåòñÿ, óæå èìååòå IPB 2.0.x &#151; îáíîâëåíèå íå òðåáóåòñÿ.";
exit();
}
else if ( $this->ipsclass->DB->field_exists( 'sub_id', 'subscriptions' ) )
{
$this->ipsclass->input['version'] = '103';
}
else if ( $this->ipsclass->DB->field_exists( 'perm_id', 'forum_perms' ) )
{
$this->ipsclass->input['version'] = '102';
}
else
{
$this->ipsclass->input['version'] = '101';
}
}
switch( $this->ipsclass->input['version'] )
{
case '103':
define( 'UPGRADE_FROM', '1.3' );
require_once( THIS_PATH.'pre_20000/10003_'.strtolower($this->ipsclass->vars['sql_driver']).'_queries.php' );
break;
case '102':
define( 'UPGRADE_FROM', '1.2' );
require_once( THIS_PATH.'pre_20000/10002_'.strtolower($this->ipsclass->vars['sql_driver']).'_queries.php' );
break;
case '101':
define( 'UPGRADE_FROM', '1.1' );
require_once( THIS_PATH.'pre_20000/10001_'.strtolower($this->ipsclass->vars['sql_driver']).'_queries.php' );
break;
}
$this->ipsclass->sql = new upgrade_sql();
$this->ipsclass->sql->ipsclass =& $this->ipsclass;
//--------------------------------
// Quitting on this step?
//--------------------------------
if ( $this->ipsclass->input['dieafterstep'] )
{
if ( $this->ipsclass->input['step'] - 1 == $this->ipsclass->input['dieafterstep'] )
{
$this->ipsclass->template->content .= "
<div class='tableborder'>
<div class='maintitle'>Âû âûáðàëè îñòàíîâêó ïåðåä øàãîì: {$this->ipsclass->input['step']}</div>
<div class='tdrow1' style='padding:6px'>Ñêðèïò îáíîâëåíèÿ áûë îñòàíîâëåí ïî çàïðîñó...
</div>
</div>
";
$this->ipsclass->template->output();
exit();
}
}
//--------------------------------
// What in gods name are we doing?
//--------------------------------
switch ($this->ipsclass->input['act'])
{
case 'work':
if ( intval( $this->ipsclass->input['step'] ) )
{
$func_to_run = 'step_'.$this->ipsclass->input['step'];
}
$this->$func_to_run();
break;
default:
$this->show_intro();
break;
}
}
/*-------------------------------------------------------------------------*/
// STEP 25: COMPLETED - YAY!!
/*-------------------------------------------------------------------------*/
function step_25()
{
//-----------------------------------------
// Tidy up old skins
//-----------------------------------------
$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'skin_sets' ) );
$this->ipsclass->DB->simple_exec();
$skins = array();
while( $r = $this->ipsclass->DB->fetch_row() )
{
$skins[] = $r['set_skin_set_id'];
}
if ( count( $skins ) )
{
$this->ipsclass->DB->simple_exec_query( array( 'delete' => 'skin_templates', 'where' => 'set_id NOT IN('.implode( ',', $skins ).')' ) );
$this->ipsclass->DB->simple_exec_query( array( 'delete' => 'skin_macro' , 'where' => 'macro_set NOT IN('.implode( ',', $skins ).')' ) );
}
$this->ipsclass->DB->do_update( 'members', array( 'skin' => '' ) );
//-----------------------------------------
// Convert major rows
//-----------------------------------------
$major_pain_in_the_ass[] = array( 'global_board_header' , 'skin_global', 'BoardHeader' );
$major_pain_in_the_ass[] = array( 'catheader_expanded' , 'skin_boards', 'CatHeader_Expanded' );
$major_pain_in_the_ass[] = array( 'pagetop' , 'skin_boards', 'PageTop' );
$major_pain_in_the_ass[] = array( 'forumrow' , 'skin_boards', 'ForumRow' );
$major_pain_in_the_ass[] = array( 'pagetop' , 'skin_forum' , 'PageTop' );
$major_pain_in_the_ass[] = array( 'tableend' , 'skin_forum' , 'TableEnd' );
$major_pain_in_the_ass[] = array( 'render_forum_row' , 'skin_forum' , 'RenderRow' );
$major_pain_in_the_ass[] = array( 'topic_page_top_new_mode', 'skin_topic' , 'PageTop' );
$major_pain_in_the_ass[] = array( 'tablefooter' , 'skin_topic' , 'TableFooter' );
$major_pain_in_the_ass[] = array( 'renderrow' , 'skin_topic' , 'RenderRow' );
foreach( $major_pain_in_the_ass as $relief => $preperation_h )
{
$this->ipsclass->DB->do_update( 'skin_templates', array( 'func_name' => $preperation_h[0] ), "group_name='{$preperation_h[1]}' and func_name='{$preperation_h[2]}'" );
}
//-----------------------------------------
// Update 'portal' skin
//-----------------------------------------
$this->ipsclass->DB->do_update( 'skin_templates', array( 'group_name' => 'skin_portal' ), "group_name='skin_csite'" );
//-----------------------------------------
// Drop old tables
//-----------------------------------------
$this->ipsclass->DB->sql_drop_table( 'templates' );
$this->ipsclass->DB->sql_drop_table( 'macro_name' );
$this->ipsclass->DB->sql_drop_table( 'skins' );
$this->ipsclass->DB->sql_drop_table( 'css' );
$this->ipsclass->template->content .= "
<div class='tableborder'>
<div class='maintitle'>Âàøå îáíîâëåíèå ïî÷òè çàâåðøåíî!</div>
<div class='tdrow1' style='padding:6px'>Ñêðèïò îáíîâëåíèÿ óñïåøíî ñäåëàë ñâîþ ðàáîòó è âû ñåé÷àñ èìååòå IPB 2.0.0</b>
<br />
<br />
<strong>Ñåé÷àñ, ïîæàëóéñòà, ïîñåòèòå <a href='index.php'>îñíîâíóþ ñèñòåìó îáíîâëåíèÿ</a> äëÿ îáíîâëåíèÿ äî ïîñëåäíåé âåðñèè</strong>
<br /><br />Âñå âàøè òåêóùèå ñòèëè ïåðåìåùåíû â 2.0. Äëÿ èñïîëüçîâàíèÿ ýòèõ ñòèëåé âàì ïåðâîå, ÷òî íåîáõîäèìî ñäåëàòü:
<ul>
<li> Âîéòè â àäìèíöåíòð âàøåãî ôîðóìà
<li> Îòêðûòü áëîê &laquo;Ñòèëè&raquo; &gt; &laquo;Óòèëèòû äëÿ ñòèëåé&raquo;
<li> Èñïîëüçîâàòü óòèëèòó &laquo;Ïåðåñòðîéêà êåø ôàéëîâ&raquo; íà êàæäîì âàøåì îðèãèíàëüíîì ñòèëå äëÿ ñîçäàíèÿ êåø ôàéëîâ.
</ul>
Ýòèì âû çàâåðøèòå èìïîðòèðîâàíèå âàøèõ ñòàðûõ ñòèëåé. Âû äîëæíû áóäåòå îòðåäàêòèðîâàòü, ÷òîáû äîáàâèòü â âàøåì íîâîì IPB 2.0.0 ñåêöèè è ïåðåèìåíîâàíèÿ íåêîòîðûõ ïðîöåäóð.<br><br>
</div>
</div>
";
$this->ipsclass->template->output();
}
/*-------------------------------------------------------------------------*/
// STEP 24: RECACHE & REBUILD
/*-------------------------------------------------------------------------*/
function step_24()
{
$this->ipsclass->sql->step_24();
if ( count($this->ipsclass->sql->error) )
{
$this->show_error( implode( "<br />", $this->ipsclass->sql->error ) );
}
else
{
$msg = "<b>Ïåðåñòðîéêà ñäåëàíà &#151; çàâåðøåíèå...</b>";
$this->ipsclass->core->redirect( "{$this->ipsclass->base_url}&act=work&version={$this->ipsclass->input['version']}&step={$this->ipsclass->next_step}&dieafterstep={$this->ipsclass->input['dieafterstep']}", $msg );
}
}
/*-------------------------------------------------------------------------*/
// STEP 23: IMPORT SETTINGS
/*-------------------------------------------------------------------------*/
function step_23()
{
global $INFO;
//-----------------------------------
// Get XML
//-----------------------------------
require_once( KERNEL_PATH.'class_xml.php' );
$xml = new class_xml();
$xml->lite_parser = 1;
//-----------------------------------
// Get XML file
//-----------------------------------
$xmlfile = ROOT_PATH.'install/installfiles/ipb_settings.xml';
$setting_content = implode( "", file($xmlfile) );
//-------------------------------
// Unpack the datafile
//-------------------------------
$xml->xml_parse_document( $setting_content );
//-------------------------------
// pArse
//-------------------------------
$fields = array( 'conf_title', 'conf_description', 'conf_group', 'conf_type', 'conf_key', 'conf_value', 'conf_default',
'conf_extra', 'conf_evalphp', 'conf_protected', 'conf_position', 'conf_start_group', 'conf_end_group', 'conf_help_key', 'conf_add_cache' );
if ( ! is_array( $xml->xml_array['settingexport']['settinggroup']['setting'] ) )
{
show_error("Error with ipb_settings.xml - could not process XML properly");
}
foreach( $xml->xml_array['settingexport']['settinggroup']['setting'] as $id => $entry )
{
if ( ! $entry['conf_key']['VALUE'] )
{
continue;
}
$newrow = array();
$entry['conf_value']['VALUE'] = "";
if ( $INFO[ $entry['conf_key']['VALUE'] ] != "" and $INFO[ $entry['conf_key']['VALUE'] ] != $entry['conf_default']['VALUE'] )
{
$entry['conf_value']['VALUE'] = $INFO[ $entry['conf_key']['VALUE'] ];
}
//-----------------------------------
// Special considerations?
//-----------------------------------
if ( $entry['conf_key']['VALUE'] == 'img_ext' )
{
$entry['conf_value']['VALUE'] = str_replace( '|', ',', $entry['conf_value']['VALUE'] );
}
else if ( $entry['conf_key']['VALUE'] == 'photo_ext' )
{
$entry['conf_value']['VALUE'] = str_replace( '|', ',', $entry['conf_value']['VALUE'] );
}
else if ( $entry['conf_key']['VALUE'] == 'avatar_ext' )
{
$entry['conf_value']['VALUE'] = str_replace( '|', ',', $entry['conf_value']['VALUE'] );
}
//-----------------------------------
// Make PHP slashes safe
//-----------------------------------
$entry['conf_evalphp']['VALUE'] = str_replace( '\\', '\\\\', $entry['conf_evalphp']['VALUE'] );
foreach( $fields as $f )
{
$newrow[$f] = $entry[ $f ]['VALUE'];
}
$db_string = $this->ipsclass->DB->compile_db_insert_string($newrow);
$query = "INSERT INTO ".SQL_PREFIX."conf_settings (" .$db_string['FIELD_NAMES']. ") VALUES (". $db_string['FIELD_VALUES'] .")";
if ( ! $this->ipsclass->DB->query($query) )
{
$this->show_error($query."<br /><br />".$DB->error);
}
}
$msg = "<b>Íàñòðîéêè èìïîðòèðîâàíû, äàëåå ïåðåñòðîåíèå è îáíîâëåíèå...</b>";
$this->ipsclass->core->redirect( "{$this->ipsclass->base_url}&act=work&version={$this->ipsclass->input['version']}&step={$this->ipsclass->next_step}&dieafterstep={$this->ipsclass->input['dieafterstep']}", $msg );
}
/*-------------------------------------------------------------------------*/
// STEP 22: IMPORT SKINS & SETTINGS
/*-------------------------------------------------------------------------*/
function step_22()
{
//-----------------------------------------
// Get old skins data
//-----------------------------------------
$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'skins' ) );
$outer = $this->ipsclass->DB->simple_exec();
while( $r = $this->ipsclass->DB->fetch_row( $outer ) )
{
//-----------------------------------------
// Get CSS
//-----------------------------------------
$css = $this->ipsclass->DB->simple_exec_query( array( 'select' => '*', 'from' => 'css', 'where' => 'cssid='.$r['css_id'] ) );
//-----------------------------------------
// Get Wrapper
//-----------------------------------------
$wrapper = $this->ipsclass->DB->simple_exec_query( array( 'select' => '*', 'from' => 'templates', 'where' => 'tmid='.$r['tmpl_id'] ) );
//-----------------------------------------
// Insert...
//-----------------------------------------
$this->ipsclass->DB->do_insert( 'skin_sets', array(
'set_name' => $r['sname'],
'set_image_dir' => $r['img_dir'],
'set_hidden' => 1,
'set_default' => 0,
'set_css_method' => 0,
'set_skin_set_parent' => 3,
'set_author_email' => '',
'set_author_name' => 'IPB 2.0 Import',
'set_author_url' => '',
'set_css' => stripslashes($css['css_text']),
'set_wrapper' => stripslashes($wrapper['template']),
'set_emoticon_folder' => 'default',
) );
$new_id = $this->ipsclass->DB->get_insert_id();
//-----------------------------------------
// Update templates
//-----------------------------------------
$this->ipsclass->DB->do_update( 'skin_templates', array( 'set_id' => $new_id ), 'set_id='.$r['set_id'] );
//-----------------------------------------
// Update macros
//-----------------------------------------
$this->ipsclass->DB->do_update( 'skin_macro', array( 'macro_set' => $new_id ), 'macro_set='.$r['set_id'] );
}
//-----------------------------------
// Get XML
//-----------------------------------
require_once( KERNEL_PATH.'class_xml.php' );
$xml = new class_xml();
$xml->lite_parser = 1;
//-----------------------------------
// Get XML file (TEMPLATES)
//-----------------------------------
$xmlfile = ROOT_PATH.'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->show_error("Îøèáêà â ôàéëå ipb_templates.xml &#151; íåâîçìîæíî âûïîëíèòü ýòîò XML ôàéë");
}
foreach( $xml->xml_array['templateexport']['templategroup']['template'] as $id => $entry )
{
$newrow = array();
$newrow['group_name'] = $entry[ 'group_name' ]['VALUE'];
$newrow['section_content'] = $entry[ 'section_content' ]['VALUE'];
$newrow['func_name'] = $entry[ 'func_name' ]['VALUE'];
$newrow['func_data'] = $entry[ 'func_data' ]['VALUE'];
$newrow['set_id'] = 1;
$newrow['updated'] = time();
$db_string = $this->ipsclass->DB->compile_db_insert_string($newrow);
$query = "INSERT INTO ".SQL_PREFIX."skin_templates (" .$db_string['FIELD_NAMES']. ") VALUES (". $db_string['FIELD_VALUES'] .")";
if ( ! $this->ipsclass->DB->query($query) )
{
$this->show_error($query."<br /><br />".$this->ipsclass->DB->error);
}
}
//-------------------------------
// GET MACRO
//-------------------------------
$xmlfile = ROOT_PATH.'install/installfiles/ipb_macro.xml';
$setting_content = implode( "", file($xmlfile) );
//-------------------------------
// Unpack the datafile (MACRO)
//-------------------------------
$xml->xml_parse_document( $setting_content );
//-------------------------------
// (MACRO)
//-------------------------------
if ( ! is_array( $xml->xml_array['macroexport']['macrogroup']['macro'] ) )
{
$this->show_error("Îøèáêà â ôàéëå ipb_templates.xml &#151; íåâîçìîæíî âûïîëíèòü ýòîò XML ôàéë");
}
foreach( $xml->xml_array['macroexport']['macrogroup']['macro'] as $id => $entry )
{
$newrow = array();
$newrow['macro_value'] = $entry[ 'macro_value' ]['VALUE'];
$newrow['macro_replace'] = $entry[ 'macro_replace' ]['VALUE'];
$newrow['macro_set'] = 1;
$db_string = $this->ipsclass->DB->compile_db_insert_string($newrow);
$query = "INSERT INTO ".SQL_PREFIX."skin_macro (" .$db_string['FIELD_NAMES']. ") VALUES (". $db_string['FIELD_VALUES'] .")";
if ( ! $this->ipsclass->DB->query($query) )
{
$this->show_error($query."<br /><br />".$this->ipsclass->DB->error);
}
}
//-------------------------------
// WRAPPER / CSS
//-------------------------------
require_once( ROOT_PATH.'install/installfiles/components.php' );
$wrapper_record = array( 'set_wrapper' => $WRAPPER,
'set_css' => $CSS,
);
$str = $this->ipsclass->DB->compile_db_update_string($wrapper_record);
$query = "UPDATE ".SQL_PREFIX."skin_sets set ".$str." where set_skin_set_id=1";
if ( ! $this->ipsclass->DB->query($query) )
{
$this->show_error($query."<br /><br />".$this->ipsclass->DB->error);
}
//-----------------------------------------
// Import XML
//-----------------------------------------
$msg = "<b>Ñòèëè èìïîðòèðîâàíû, äàëåå èìïîðòèðîâàíèå íàñòðîåê...</b>";
$this->ipsclass->core->redirect( "{$this->ipsclass->base_url}&act=work&version={$this->ipsclass->input['version']}&step={$this->ipsclass->next_step}&dieafterstep={$this->ipsclass->input['dieafterstep']}", $msg );
}
/*-------------------------------------------------------------------------*/
// STEP 21: OPTIMIZE: Part 2
/*-------------------------------------------------------------------------*/
function step_21()
{
$this->ipsclass->sql->step_21();
if ( count($this->ipsclass->sql->error) )
{
$this->show_error( implode( "<br />", $this->ipsclass->sql->error ) );
}
else
{
$msg = "<b>Îïòèìèçàöèÿ çàâåðøåíà, äàëåå èìïîðò íîâûõ ñòèëåé...</b>";
$this->ipsclass->core->redirect( "{$this->ipsclass->base_url}&act=work&version={$this->ipsclass->input['version']}&step={$this->ipsclass->next_step}&dieafterstep={$this->ipsclass->input['dieafterstep']}", $msg ."<br /><br />".intval($this->ipsclass->sql->sqlcount)." çàïðîñîâ óñïåøíî ñäåëàíî!" );
}
}
/*-------------------------------------------------------------------------*/
// STEP 20: OPTIMIZE: Part 1
/*-------------------------------------------------------------------------*/
function step_20()
{
$this->ipsclass->sql->step_20();
if ( count($this->ipsclass->sql->error) )
{
$this->show_error( implode( "<br />", $this->ipsclass->sql->error ) );
}
else
{
$msg = "<b>Îïòèìèçàöèÿ íà÷àòà...</b>";
$this->ipsclass->core->redirect( "{$this->ipsclass->base_url}&act=work&version={$this->ipsclass->input['version']}&step={$this->ipsclass->next_step}&dieafterstep={$this->ipsclass->input['dieafterstep']}", $msg ."<br /><br />".intval($this->ipsclass->sql->sqlcount)." çàïðîñîâ óñïåøíî ñäåëàíî!" );
}
}
/*-------------------------------------------------------------------------*/
// STEP 19: DROP TABLES
/*-------------------------------------------------------------------------*/
function step_19()
{
$this->ipsclass->sql->step_19();
if ( count($this->ipsclass->sql->error) )
{
$this->show_error( implode( "<br />", $this->ipsclass->sql->error ) );
}
else
{
$msg = "<b>Ñòàðûå òàáëèöû óäàëåíû, äàëåå îïòèìèçàöèÿ...</b>";
$this->ipsclass->core->redirect( "{$this->ipsclass->base_url}&act=work&version={$this->ipsclass->input['version']}&step={$this->ipsclass->next_step}&dieafterstep={$this->ipsclass->input['dieafterstep']}", $msg ."<br /><br />".intval($this->ipsclass->sql->sqlcount)." çàïðîñîâ óñïåøíî ñäåëàíî!" );
}
}
/*-------------------------------------------------------------------------*/
// STEP 18: INSERTS
/*-------------------------------------------------------------------------*/
function step_18()
{
$this->ipsclass->sql->step_18();
if ( count($this->ipsclass->sql->error) )
{
$this->show_error( implode( "<br />", $this->ipsclass->sql->error ) );
}
else
{
$msg = "<b>Âñòàâêà çàâåðøåíà, äàëåå óäàëåíèå ñòàðûõ òàáëèö...</b>";
$this->ipsclass->core->redirect( "{$this->ipsclass->base_url}&act=work&version={$this->ipsclass->input['version']}&step={$this->ipsclass->next_step}&dieafterstep={$this->ipsclass->input['dieafterstep']}", $msg ."<br /><br />".intval($this->ipsclass->sql->sqlcount)." çàïðîñîâ óñïåøíî ñäåëàíî!" );
}
}
/*-------------------------------------------------------------------------*/
// STEP 17: ALTER OTHER TABLES II
/*-------------------------------------------------------------------------*/
function step_17()
{
$this->ipsclass->sql->step_17();
if ( count($this->ipsclass->sql->error) )
{
$this->show_error( implode( "<br />", $this->ipsclass->sql->error ) );
}
else
{
$msg = "<b>Äðóãèå òàáëèöû âñòàâëåíû, äàëåå êîíâåðòèðîâàíèå ôîðóìîâ...</b>";
$this->ipsclass->core->redirect( "{$this->ipsclass->base_url}&act=work&version={$this->ipsclass->input['version']}&step={$this->ipsclass->next_step}&dieafterstep={$this->ipsclass->input['dieafterstep']}", $msg ."<br /><br />".intval($this->ipsclass->sql->sqlcount)." çàïðîñîâ óñïåøíî ñäåëàíî!" );
}
}
/*-------------------------------------------------------------------------*/
// STEP 16: ALTER MEMBERS TABLE II
/*-------------------------------------------------------------------------*/
function step_16()
{
$this->ipsclass->sql->step_16();
if ( count($this->ipsclass->sql->error) )
{
$this->show_error( implode( "<br />", $this->ipsclass->sql->error ) );
}
else
{
$msg = "<b>Òàáëèöà ñ ïîëüçîâàòåëÿìè âñòàâëåíà, äàëåå äðóãèå òàáëèöû...</b>";
$this->ipsclass->core->redirect( "{$this->ipsclass->base_url}&act=work&version={$this->ipsclass->input['version']}&step={$this->ipsclass->next_step}&dieafterstep={$this->ipsclass->input['dieafterstep']}", $msg ."<br /><br />".intval($this->ipsclass->sql->sqlcount)." çàïðîñîâ óñïåøíî ñäåëàíî!" );
}
}
/*-------------------------------------------------------------------------*/
// STEP 15: ALTER TOPIC TABLE II
/*-------------------------------------------------------------------------*/
function step_15()
{
$this->ipsclass->sql->step_15();
if ( count($this->ipsclass->sql->error) )
{
$this->show_error( implode( "<br />", $this->ipsclass->sql->error ) );
}
else
{
$msg = "<b>Òàáëèöà ñ òåìàìè âñòàâëåíà, äàëåå âñòàâêà òàáëèöû ñ ïîëüçîâàòåëÿìè...</b>";
$this->ipsclass->core->redirect( "{$this->ipsclass->base_url}&act=work&version={$this->ipsclass->input['version']}&step={$this->ipsclass->next_step}&dieafterstep={$this->ipsclass->input['dieafterstep']}", $msg ."<br /><br />".intval($this->ipsclass->sql->sqlcount)." çàïðîñîâ óñïåøíî ñäåëàíî!" );
}
}
/*-------------------------------------------------------------------------*/
// STEP 14: ALTER POST TABLE II
/*-------------------------------------------------------------------------*/
function step_14()
{
$this->ipsclass->sql->step_14();
if ( count($this->ipsclass->sql->error) )
{
$this->show_error( implode( "<br />", $this->ipsclass->sql->error ) );
}
else
{
$msg = "<b>Òàáëèöà ñ ñîîáùåíèÿìè âñòàâëåíà, äàëåå âñòàâêà òàáëèöû ñ òåìàìè...</b>";
$this->ipsclass->core->redirect( "{$this->ipsclass->base_url}&act=work&version={$this->ipsclass->input['version']}&step={$this->ipsclass->next_step}&dieafterstep={$this->ipsclass->input['dieafterstep']}", $msg ."<br /><br />".intval($this->ipsclass->sql->sqlcount)." çàïðîñîâ óñïåøíî ñäåëàíî!" );
}
}
/*-------------------------------------------------------------------------*/
// STEP 13: CONVERT TOPIC MULTI_MODS
/*-------------------------------------------------------------------------*/
function step_13()
{
$f = $this->ipsclass->DB->query("SELECT * FROM ibf_forums");
$final = array();
while ( $r = $this->ipsclass->DB->fetch_row($f) )
{
$mmids = preg_split( "/,/", $r['topic_mm_id'], -1, PREG_SPLIT_NO_EMPTY );
if ( is_array( $mmids ) )
{
foreach( $mmids as $m )
{
$final[ $m ][] = $r['id'];
}
}
}
$real_final = array();
foreach( $final as $id => $forums_ids )
{
$ff = implode( ",",$forums_ids );
$this->ipsclass->DB->do_update( 'topic_mmod', array( 'mm_forums' => $ff ), 'mm_id='.$id );
}
$msg = "<b>Ìóëüòè-ìîäåðàöèÿ òåì êîíâåðòèðîâàíà, âñòàâêà òàáëèö, ñòàäèÿ 2...</b>";
$this->ipsclass->core->redirect( "{$this->ipsclass->base_url}&act=work&version={$this->ipsclass->input['version']}&step={$this->ipsclass->next_step}&dieafterstep={$this->ipsclass->input['dieafterstep']}", $msg );
}
/*-------------------------------------------------------------------------*/
// STEP 12: CONVERT PMs
/*-------------------------------------------------------------------------*/
function step_12()
{
$start = intval($_GET['st']);
$lend = 300;
$end = $start + $lend;
//-----------------------------------------
// In steps...
//-----------------------------------------
$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'messages', 'limit' => array( $start, $lend ) ) );
$o = $this->ipsclass->DB->simple_exec();
//-----------------------------------------
// Do it...
//-----------------------------------------
if ( $this->ipsclass->DB->get_num_rows() )
{
//-----------------------------------------
// Got some to convert!
//-----------------------------------------
$this->ipsclass->next_step--;
while ( $r = $this->ipsclass->DB->fetch_row($o) )
{
if ( ! $r['msg_date'] )
{
$r['msg_date'] = $r['read_date'];
}
if ( $r['vid'] != 'sent' )
{
$this->ipsclass->DB->do_insert( 'message_text',
array( 'msg_date' => $r['msg_date'],
'msg_post' => stripslashes($r['message']),
'msg_cc_users' => $r['cc_users'],
'msg_author_id' => $r['from_id'],
'msg_sent_to_count' => 1,
'msg_deleted_count' => 0,
) );
$msg_id = $this->ipsclass->DB->get_insert_id();
$this->ipsclass->DB->do_insert( 'message_topics',
array( 'mt_msg_id' => $msg_id,
'mt_date' => $r['msg_date'],
'mt_title' => $r['title'],
'mt_from_id' => $r['from_id'],
'mt_to_id' => $r['recipient_id'],
'mt_vid_folder' => $r['vid'],
'mt_read' => $r['read_state'],
'mt_tracking' => $r['tracking'],
'mt_owner_id' => $r['recipient_id'],
) );
}
else
{
$this->ipsclass->DB->do_insert( 'message_text',
array( 'msg_date' => $r['msg_date'],
'msg_post' => stripslashes($r['message']),
'msg_cc_users' => $r['cc_users'],
'msg_author_id' => $r['from_id'],
'msg_sent_to_count' => 1,
'msg_deleted_count' => 0,
) );
$msg_id = $this->ipsclass->DB->get_insert_id();
$this->ipsclass->DB->do_insert( 'message_topics',
array( 'mt_msg_id' => $msg_id,
'mt_date' => $r['msg_date'],
'mt_title' => $r['title'],
'mt_from_id' => $r['from_id'],
'mt_to_id' => $r['recipient_id'],
'mt_vid_folder' => $r['vid'],
'mt_read' => $r['read_state'],
'mt_tracking' => $r['tracking'],
'mt_owner_id' => $r['from_id'],
) );
}
}
$msg = "<b>Ëè÷íûå ñîîáùåíèÿ: îò $start äî $end çàâåðøåíî....</b>";
$this->ipsclass->core->redirect( "{$this->ipsclass->base_url}&act=work&version={$this->ipsclass->input['version']}&step={$this->ipsclass->next_step}&dieafterstep={$this->ipsclass->input['dieafterstep']}&st={$end}", $msg );
}
else
{
$msg = "<b>Ëè÷íûå ñîîáùåíèÿ ñêîíâåðòèðîâàíû, ïðîöåññ îáíîâëåíèÿ ìóëüòè-ìîäåðàöèè òåì...</b>";
$this->ipsclass->core->redirect( "{$this->ipsclass->base_url}&act=work&version={$this->ipsclass->input['version']}&step={$this->ipsclass->next_step}&dieafterstep={$this->ipsclass->input['dieafterstep']}", $msg );
}
}
/*-------------------------------------------------------------------------*/
// STEP 11: CONVERGE
/*-------------------------------------------------------------------------*/
function step_11()
{
$start = intval($_GET['st']);
$lend = 300;
$end = $start + $lend;
//-----------------------------------------
// In steps...
//-----------------------------------------
require_once( ROOT_PATH."ips_kernel/class_converge.php" );
$converge = new class_converge($DB);
$max = 0;
$this->ipsclass->DB->query("SELECT id FROM ibf_members where id > $end");
$max = $this->ipsclass->DB->fetch_row();
$o = $this->ipsclass->DB->query( $this->ipsclass->sql->sql_members_converge( $start, $end ) );
$found = 0;
//-----------------------------------------
// Do it...
//-----------------------------------------
while ( $r = $this->ipsclass->DB->fetch_row($o) )
{
if ( ! $r['cid'] or ! $r['id'] )
{
$r['password'] = $r['password'] ? $r['password'] : $r['legacy_password'];
$salt = $converge->generate_password_salt(5);
$salt = str_replace( '\\', "\\\\", $salt );
$this->ipsclass->DB->do_insert( 'members_converge',
array( 'converge_id' => $r['id'],
'converge_email' => strtolower($r['email']),
'converge_joined' => $r['joined'],
'converge_pass_hash' => md5( md5($salt) . $r['password'] ),
'converge_pass_salt' => $salt
) );
$this->ipsclass->DB->do_update( 'members', array( 'member_login_key' => $converge->generate_auto_log_in_key(), 'email' => strtolower($r['email']) ), 'id='.$r['id'] );
}
$found++;
}
if ( ! $found and ! $max['id'] )
{
$msg = "<b>Äîáàâëåíèå ñèñòåìû àâòîðèçàöèè çàâåðøåíî, êîíâåðòèðîâàíèå ëè÷íûõ ñîîáùåíèé...</b>";
$this->ipsclass->core->redirect( "{$this->ipsclass->base_url}&act=work&version={$this->ipsclass->input['version']}&step={$this->ipsclass->next_step}&dieafterstep={$this->ipsclass->input['dieafterstep']}", $msg );
}
else
{
$this->ipsclass->next_step--;
$msg = "<b>Äîáàâëåíèå ñèñòåìû àâòîðèçàöèè: îò $start äî $end çàâåðøåíî....</b>";
$this->ipsclass->core->redirect( "{$this->ipsclass->base_url}&act=work&version={$this->ipsclass->input['version']}&step={$this->ipsclass->next_step}&dieafterstep={$this->ipsclass->input['dieafterstep']}&st={$end}", $msg );
}
}
/*-------------------------------------------------------------------------*/
// STEP 10: CHECK EMAIL ADDRESSES
/*-------------------------------------------------------------------------*/
function step_10()
{
$start = intval($_GET['st']);
$lend = 300;
$end = $start + $lend;
//-----------------------------------------
// In steps...
//-----------------------------------------
$o = $this->ipsclass->DB->query( $this->ipsclass->sql->sql_members_email( $lend ) );
//-----------------------------------------
// Do it...
//-----------------------------------------
while ( $r = $this->ipsclass->DB->fetch_row($o) )
{
if ( $r['count'] < 2 )
{
break;
}
else
{
$dupe_emails[] = $r['email'];
}
}
if ( count( $dupe_emails ) )
{
foreach( $dupe_emails as $email )
{
$first = 0;
$this->ipsclass->DB->query( "SELECT id, name, email FROM ibf_members WHERE email='{$email}' ORDER BY joined ASC" );
while( $r = $this->ipsclass->DB->fetch_row() )
{
// First?
if ( ! $first )
{
$first = 1;
continue;
}
else
{
// later dupe..
$push_auth[] = $r['id'];
}
}
}
if ( count( $push_auth ) )
{
$this->ipsclass->DB->do_update( 'member_extra', array( 'bio' => 'dupemail' ), 'id IN ('.implode(",", $push_auth).")" );
$this->ipsclass->DB->query( $this->ipsclass->sql->sql_members_email_update( $push_auth ) );
}
$this->ipsclass->next_step--;
$msg = "<b>Ïðîâåðêà e-mail àäðåñîâ: îò $start äî $end çàâåðøåíî....</b>";
$this->ipsclass->core->redirect( "{$this->ipsclass->base_url}&act=work&version={$this->ipsclass->input['version']}&step={$this->ipsclass->next_step}&dieafterstep={$this->ipsclass->input['dieafterstep']}&st={$end}", $msg );
}
else
{
$msg = "<b>E-mail àäðåñà ïîëüçîâàòåëåé ïðîâåðåíû, äîáàâëåíèå ñèñòåìû àâòîðèçàöèè...</b>";
$this->ipsclass->core->redirect( "{$this->ipsclass->base_url}&act=work&version={$this->ipsclass->input['version']}&step={$this->ipsclass->next_step}&dieafterstep={$this->ipsclass->input['dieafterstep']}", $msg );
}
}
/*-------------------------------------------------------------------------*/
// STEP 9: CONVERT MEMBERS
/*-------------------------------------------------------------------------*/
function step_9()
{
$start = intval($_GET['st']);
$lend = 300;
$end = $start + $lend;
//-----------------------------------------
// In steps...
//-----------------------------------------
$o = $this->ipsclass->DB->query( $this->ipsclass->sql->sql_members( $start, $lend ) );
//-----------------------------------------
// Do it...
//-----------------------------------------
if ( $this->ipsclass->DB->get_num_rows() )
{
//-----------------------------------------
// Got some to convert!
//-----------------------------------------
$this->ipsclass->next_step--;
while ( $r = $this->ipsclass->DB->fetch_row($o) )
{
if ( $r['mextra'] )
{
$this->ipsclass->DB->do_update( 'member_extra',
array( 'aim_name' => $r['aim_name'],
'icq_number' => $r['icq_number'],
'website' => $r['website'],
'yahoo' => $r['yahoo'],
'interests' => $r['interests'],
'msnname' => $r['msnname'],
'vdirs' => $r['vdirs'],
'location' => $r['location'],
'signature' => $r['signature'],
'avatar_location' => $r['avatar'],
'avatar_size' => $r['avatar_size'],
'avatar_type' => preg_match( "/^upload\:/", $r['avatar'] ) ? 'upload' : ( preg_match( "#^http://#", $r['avatar'] ) ? 'url' : 'local' )
), 'id='.$r['mextra'] );
}
else
{
$this->ipsclass->DB->do_insert( 'member_extra',
array( 'id' => $r['id'],
'aim_name' => $r['aim_name'],
'icq_number' => $r['icq_number'],
'website' => $r['website'],
'yahoo' => $r['yahoo'],
'interests' => $r['interests'],
'msnname' => $r['msnname'],
'vdirs' => $r['vdirs'],
'location' => $r['location'],
'signature' => $r['signature'],
'avatar_location' => $r['avatar'],
'avatar_size' => $r['avatar_size'],
'avatar_type' => preg_match( "/^upload\:/", $r['avatar'] ) ? 'upload' : ( preg_match( "#^http://#", $r['avatar'] ) ? 'url' : 'local' )
) );
}
}
$msg = "<b>Êîíâåðòèðîâàíèå ïîëüçîâàòåëåé: îò $start äî $end çàâåðøåíî....</b>";
$this->ipsclass->core->redirect( "{$this->ipsclass->base_url}&act=work&version={$this->ipsclass->input['version']}&step={$this->ipsclass->next_step}&dieafterstep={$this->ipsclass->input['dieafterstep']}&st={$end}", $msg );
}
else
{
$msg = "<b>Êîíâåðòèðîâàíèå ïîëüçîâàòåëåé çàâåðøåíî, ïðîâåðêà e-mail àäðåñîâ ïîëüçîâàòåëåé äëÿ ñèñòåìû àâòîðèçàöèè...</b>";
$this->ipsclass->core->redirect( "{$this->ipsclass->base_url}&act=work&version={$this->ipsclass->input['version']}&step={$this->ipsclass->next_step}&dieafterstep={$this->ipsclass->input['dieafterstep']}", $msg );
}
}
/*-------------------------------------------------------------------------*/
// STEP 8: CONVERT ATTACHMENTS
/*-------------------------------------------------------------------------*/
function step_8()
{
$start = intval($_GET['st']);
$lend = 300;
$end = $start + $lend;
//-----------------------------------------
// In steps...
//-----------------------------------------
$this->ipsclass->DB->simple_construct( array( "select" => '*',
'from' => 'posts',
'where' => "attach_file != ''",
'limit' => array( $start, $lend ) ) );
$outer = $this->ipsclass->DB->simple_exec();
//-----------------------------------------
// Do it...
//-----------------------------------------
if ( $this->ipsclass->DB->get_num_rows() )
{
//-----------------------------------------
// Got some to convert!
//-----------------------------------------
$this->ipsclass->next_step--;
while( $r = $this->ipsclass->DB->fetch_row( $outer ) )
{
$image = 0;
$ext = strtolower( str_replace( ".", "", substr( $r['attach_file'], strrpos( $r['attach_file'], '.' ) ) ) );
$postkey = md5( $r['post_date'].','.$r['pid'] );
if ( in_array( $ext, array( 'gif', 'jpeg', 'jpg', 'png' ) ) )
{
$image = 1;
}
$this->ipsclass->DB->do_insert( 'attachments', array( 'attach_ext' => $ext,
'attach_file' => $r['attach_file'],
'attach_location' => $r['attach_id'],
'attach_is_image' => $image,
'attach_hits' => $r['attach_hits'],
'attach_date' => $r['post_date'],
'attach_pid' => $r['pid'],
'attach_post_key' => $postkey,
'attach_member_id' => $r['author_id'],
'attach_approved' => 1,
'attach_filesize' => @filesize( ROOT_PATH.'uploads/'.$r['attach_id'] ),
) );
$this->ipsclass->DB->do_update( 'posts', array( 'post_key' => $postkey ), 'pid='.$r['pid'] );
$this->ipsclass->DB->simple_exec_query( array( 'update' => 'topics', 'set' => 'topic_hasattach=topic_hasattach+1', 'where' => 'tid='.$r['topic_id'] ) );
}
$msg = "<b>Ïðèêðåïëåííûå ôàéëû: îò $start äî $end çàâåðøåíî....</b>";
$this->ipsclass->core->redirect( "{$this->ipsclass->base_url}&act=work&version={$this->ipsclass->input['version']}&step={$this->ipsclass->next_step}&dieafterstep={$this->ipsclass->input['dieafterstep']}&st={$end}", $msg );
}
else
{
$msg = "<b>Ïðèêðåïëåííûå ôàéëû ñêîíâåðòèðîâàíû, ïåðåíîñ ïîëüçîâàòåëåé...</b>";
$this->ipsclass->core->redirect( "{$this->ipsclass->base_url}&act=work&version={$this->ipsclass->input['version']}&step={$this->ipsclass->next_step}&dieafterstep={$this->ipsclass->input['dieafterstep']}", $msg );
}
}
/*-------------------------------------------------------------------------*/
// STEP 7: CONVERT FORUMS
/*-------------------------------------------------------------------------*/
function step_7()
{
$this->ipsclass->sql->step_7();
if ( count($this->ipsclass->sql->error) )
{
$this->show_error( implode( "<br />", $this->ipsclass->sql->error ) );
}
else
{
$msg = "<b>Ôîðóìû ñêîíâåðòèðîâàíû, äàëåå êîíâåðòèðîâàíèå ïðèêðåïëåííûõ ôàéëîâ...</b>";
$this->ipsclass->core->redirect( "{$this->ipsclass->base_url}&act=work&version={$this->ipsclass->input['version']}&step={$this->ipsclass->next_step}&dieafterstep={$this->ipsclass->input['dieafterstep']}", $msg );
}
}
/*-------------------------------------------------------------------------*/
// STEP 6: ALTER OTHER TABLES
/*-------------------------------------------------------------------------*/
function step_6()
{
$this->ipsclass->sql->step_6();
if ( count($this->ipsclass->sql->error) )
{
$this->show_error( implode( "<br />", $this->ipsclass->sql->error ) );
}
else
{
$msg = "<b>Äðóãèå òàáëèöû âñòàâëåíû, äàëåå êîíâåðòèðîâàíèå ôîðóìîâ...</b>";
$this->ipsclass->core->redirect( "{$this->ipsclass->base_url}&act=work&version={$this->ipsclass->input['version']}&step={$this->ipsclass->next_step}&dieafterstep={$this->ipsclass->input['dieafterstep']}", $msg ."<br /><br />".intval($this->ipsclass->sql->sqlcount)." çàïðîñîâ óñïåøíî ñäåëàíî!" );
}
}
/*-------------------------------------------------------------------------*/
// STEP 5: ALTER MEMBERS TABLE
/*-------------------------------------------------------------------------*/
function step_5()
{
$this->ipsclass->sql->step_5();
if ( count($this->ipsclass->sql->error) )
{
$this->show_error( implode( "<br />", $this->ipsclass->sql->error ) );
}
else
{
$msg = "<b>Òàáëèöà ïîëüçîâàòåëåé âñòàâëåíà, äàëåå äðóãèå òàáëèöû...</b>";
$this->ipsclass->core->redirect( "{$this->ipsclass->base_url}&act=work&version={$this->ipsclass->input['version']}&step={$this->ipsclass->next_step}&dieafterstep={$this->ipsclass->input['dieafterstep']}", $msg ."<br /><br />".intval($this->ipsclass->sql->sqlcount)." çàïðîñîâ óñïåøíî ñäåëàíî!" );
}
}
/*-------------------------------------------------------------------------*/
// STEP 4: ALTER TOPIC TABLE
/*-------------------------------------------------------------------------*/
function step_4()
{
$this->ipsclass->sql->step_4();
if ( count($this->ipsclass->sql->error) )
{
$this->show_error( implode( "<br />", $this->ipsclass->sql->error ) );
}
else
{
$msg = "<b>Òàáëèöà ñ òåìàìè âñòàâëåíà, äàëåå âñòàâêà òàáëèöû ñ ïîëüçîâàòåëÿìè...</b>";
$this->ipsclass->core->redirect( "{$this->ipsclass->base_url}&act=work&version={$this->ipsclass->input['version']}&step={$this->ipsclass->next_step}&dieafterstep={$this->ipsclass->input['dieafterstep']}", $msg ."<br /><br />".intval($this->ipsclass->sql->sqlcount)." çàïðîñîâ óñïåøíî ñäåëàíî!" );
}
}
/*-------------------------------------------------------------------------*/
// STEP 3: ALTER POST TABLE
/*-------------------------------------------------------------------------*/
function step_3()
{
$this->ipsclass->sql->step_3();
if ( count($this->ipsclass->sql->error) )
{
$this->show_error( implode( "<br />", $this->ipsclass->sql->error ) );
}
else
{
$msg = "<b>Òàáëèöà ñ ñîîáùåíèÿìè âñòàâëåíà, äàëåå âñòàâêà òàáëèöû ñ òåìàìè...</b>";
$this->ipsclass->core->redirect( "{$this->ipsclass->base_url}&act=work&version={$this->ipsclass->input['version']}&step={$this->ipsclass->next_step}&dieafterstep={$this->ipsclass->input['dieafterstep']}", $msg ."<br /><br />".intval($this->ipsclass->sql->sqlcount)." çàïðîñîâ óñïåøíî ñäåëàíî!" );
}
}
/*-------------------------------------------------------------------------*/
// STEP 2: ADD NEW TABLES
/*-------------------------------------------------------------------------*/
function step_2()
{
$this->ipsclass->sql->step_2();
if ( count($this->ipsclass->sql->error) )
{
$this->show_error( implode( "<br />", $this->ipsclass->sql->error ) );
}
else
{
$msg = "<b>Íîâûå òàáëèöû ñîçäàíû. Âñòàâêà òàáëèö (÷àñòü 1, ñåêöèÿ 1 &#151; òàáëèöà ñ ñîîáùåíèÿìè)</b>";
$this->ipsclass->core->redirect( "{$this->ipsclass->base_url}&act=work&version={$this->ipsclass->input['version']}&step={$this->ipsclass->next_step}&dieafterstep={$this->ipsclass->input['dieafterstep']}", $msg ."<br /><br />".intval($this->ipsclass->sql->sqlcount)." çàïðîñîâ óñïåøíî ñäåëàíî!" );
}
}
/*-------------------------------------------------------------------------*/
// STEP 1: COPY FORUMS TABLE
/*-------------------------------------------------------------------------*/
function step_1()
{
$this->ipsclass->sql->step_1();
if ( count($this->ipsclass->sql->error) )
{
$this->show_error( implode( "<br />", $this->ipsclass->sql->error ) );
}
else
{
$msg = "<b>Ïîäíÿòà òàáëèöà ñ ôîðóìàìè &#151; äàëåå ñîçäàíèå íîâûõ òàáëèö....</b>";
$this->ipsclass->core->redirect( "{$this->ipsclass->base_url}&act=work&version={$this->ipsclass->input['version']}&step={$this->ipsclass->next_step}&dieafterstep={$this->ipsclass->input['dieafterstep']}", $msg ."<br /><br />".intval($this->ipsclass->sql->sqlcount)." çàïðîñîâ óñïåøíî ñäåëàíî!" );
}
}
/*-------------------------------------------------------------------------*/
// STEP 0: SHOW INTRO
/*-------------------------------------------------------------------------*/
function show_intro()
{
//-----------------------------------------
// Check for missing files
//-----------------------------------------
$this->ipsclass->template->content .= "
<div class='tableborder'>
<div class='maintitle'>Äîáðî ïîæàëîâàòü ñèñòåìó îáíîâëåíèÿ IPB ñ ".UPGRADE_FROM." â 2.0.0</div>
<div class='tdrow1' style='padding:6px'>Ýòîò ñêðèïò îáíîâëåíèÿ áóäåò îáíîâëÿòü âàøó ".UPGRADE_FROM.".x â IPB 2.0.0</b>
<br /><br />Âî âðåìÿ ïðîöåññà îáíîâëåíèÿ áóäåò íåñêîëüêî øàãîâ äëÿ îáíîâëåíèÿ âàøèõ SQL òàáëèö è êîíâåðòèðîâàíèÿ òåêóùèõ äàííûõ â íîâóþ ñèñòåìó. Åñëè âû èìååòå áîëüøîé ôîðóì, ðåêîìåíäóåì îçíàêîìèòüñÿ ñ èíñòðóêöèåé
ïî îáíîâëåíèþ áîëüøèõ ôîðóìîâ > <a href='{$this->ipsclass->vars['board_url']}/upgrade/manual_upgradekit/readme.txt'>upgrade/manual_upgradekit/readme.txt</a>.
<br /><br /><span style='color:red'><b>ÂÍÈÌÀÍÈÅ: Ýòîò ñêðèïò îáíîâëåíèÿ áóäåò îáíîâëÿòü âàøó òåêóùóþ áàçó äàííûõ è âåðíóòüñÿ íà ñòàðóþ âåðñèþ ôîðóìà óæå áóäåò íåâîçìîæíî!
<br />Ïîæàëóéñòà ñîõðàíèòå âàøó áàçó äàííûõ è ôàéëû (backup) ïåðåä òåì, êàê íà÷àòü îáíîâëåíèå. Ýòî ñäåëàåò âîçìîæíûì áûñòðî âåðíóòü ñòàðûé ôîðóì, åñëè ó âàñ âîçíèêíóò ñåðüåçíûå îøèáêè ïðè îáíîâëåíèè.
<br />Ìû íå ìîæåì ãàðàíòèðîâàòü, ÷òî ïðîöåññ îáíîâëåíèÿ ïðîéäåò áåç ïðîáëåì, èìåííî ïîýòîìó ìû ïðîñèì âàñ ñäåëàòü êîïèþ âàøèõ ôàéëîâ è áàçû ïåðåä îáíîâëåíèåì</span>
<br /><br />Ïåðâûé øàã: Êîïèðîâàíèå SQL òàáëèö äëÿ èñïîëüçîâàíèÿ â ïðîãðàììå êîíâåðòèðîâàíèÿ.
<br /><br />
";
$warnings = array();
$checkfiles = array( ROOT_PATH ."ipb_templates.xml",
ROOT_PATH ."install/installfiles/components.php",
ROOT_PATH ."install/installfiles/ipb_macro.xml",
ROOT_PATH ."install/installfiles/ipb_settings.xml",
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",
);
$writeable = array( ROOT_PATH."conf_global.php",
ROOT_PATH."cache/",
ROOT_PATH."cache/skin_cache/"
);
foreach ( $checkfiles as $cf )
{
if ( ! file_exists($cf) )
{
$warnings[] = "Íåâîçìîæíî íàéòè ôàéë '$cf'.";
}
}
foreach ( $writeable as $cf )
{
if ( ! is_writeable($cf) )
{
$warnings[] = "Íåâîçìîæíî ïðîèçâåñòè çàïèñü â ôàéë èëè ïàïêó '$cf'. Ïîæàëóéñòà ñäåëàéòå ïðàâà (CHMOD) 0777.";
}
}
$phpversion = phpversion();
//----------------------------------
// CHECK BASICS
//----------------------------------
if ($phpversion < '4.1.0')
{
$warnings[] = "<b>Âû íå ìîæåòå óñòàíàâëèâàòü Invision Power Board. Invision Power Board òðåáóåò PHP âåðñèè 4.1.0 èëè âûøå.</b>";
}
if ( ! function_exists('get_cfg_var') )
{
$warnings[] = "<b>Âû íå ìîæåòå óñòàíàâëèâàòü Invision Power Board. Âàø PHP íå äîñòàòî÷åí äëÿ çàïóñêà IPB.</b>";
}
if ( ! function_exists('xml_parse_into_struct') )
{
$warnings[] = "<b>Âû íå ìîæåòå óñòàíàâëèâàòü Invision Power Board. IPB òðåáóåò, ÷òîáû XML ôóíêöèè â PHP áûëè âêëþ÷åíû, ïîæàëóéñòà ñîîáùèòå âàøåìó õîñòèíã-ïðîâàéäåðó, ÷òîáû âêëþ÷èë âàì XML.</b>";
}
//----------------------------------
// Got error?
//----------------------------------
if ( count($warnings) > 0 )
{
$err_string = '&middot;'.implode( "<br /><br />&middot;", $warnings );
$this->ipsclass->template->content .= "<br /><br />
<div class='warnbox'>
<strong>Âíèìàíèå!</strong>
<b>Íàéäåíû îøèáêè, òðåáóþùèå óñòðàíåíèÿ. Áåç ýòîãî ïðîäîëæåíèå íåâîçìîæíî!</b>
<br><br>
$err_string
</div>";
}
else
{
$this->ipsclass->template->content .= "<div align='center'><span style='font-weight:bold;font-size:14px'>&raquo; <a href='{$this->ipsclass->base_url}&act=work&version={$this->ipsclass->input['version']}&step={$this->ipsclass->next_step}&dieafterstep={$this->ipsclass->input['dieafterstep']}'>Äàëåå...</a></span></div>";
}
$this->ipsclass->template->content .= "</div></div>";
$this->ipsclass->template->output();
}
/*-------------------------------------------------------------------------*/
// check for IPB 2
/*-------------------------------------------------------------------------*/
function _check_for_two()
{
if ( ! $this->ipsclass->DB->field_exists( 'cs_key', 'cache_store' ) )
{
return 0;
}
$r = $this->ipsclass->DB->simple_exec_query( array( 'select' => '*', 'from' => 'cache_store', 'where' => "cs_key='forum_cache'" ) );
if ( $r['cs_value'] )
{
return 1;
}
else
{
return 0;
}
}
/*-------------------------------------------------------------------------*/
// SHOW ERROR WITH CONTINUE
/*-------------------------------------------------------------------------*/
function show_error( $msg )
{
$this->ipsclass->template->content .= "
<div class='tableborder'>
<div class='maintitle'>Error!</div>
<div class='tdrow1' style='padding:6px'>Ñêðèïò âîçâðàòèë ñëåäóþùóþ îøèáêó:</b>
<br /><br />$msg
<div align='center'><span style='font-weight:bold;font-size:14px'>&raquo; <a href='{$this->ipsclass->base_url}&act=work&version={$this->ipsclass->input['version']}&step={$this->ipsclass->next_step}&dieafterstep={$this->ipsclass->input['dieafterstep']}'>Âñå ðàâíî ïðîäîëæèòü?</a></span></div>
</div>
</div>
";
$this->ipsclass->template->output();
}
}
?>