Version 2.3.6
This commit is contained in:
1 parent
a3bb603c96
commit
19b38c7c74
764 files changed
+143731
-118164
No files matched your search
@@ -23,23 +23,23 @@
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
class version_upgrade
|
||||
{
|
||||
var $install;
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// CONSTRUCTOR
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
function version_upgrade( & $install )
|
||||
{
|
||||
$this->install = & $install;
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Auto run..
|
||||
/*-------------------------------------------------------------------------*/
|
||||
@@ -75,13 +75,13 @@ class version_upgrade
|
||||
break;
|
||||
case 'skin':
|
||||
$this->add_skin();
|
||||
break;
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
$this->upgrade_sql(1);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if ( $this->install->saved_data['workact'] )
|
||||
{
|
||||
return false;
|
||||
@@ -91,12 +91,12 @@ class version_upgrade
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// SQL: 0
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
function upgrade_sql( $id=1 )
|
||||
{
|
||||
$man = 0; // Manual upgrade ? intval( $this->install->ipsclass->input['man'] );
|
||||
@@ -104,32 +104,32 @@ class version_upgrade
|
||||
$SQL = array();
|
||||
$file = '_updates_'.$id.'.php';
|
||||
$output = "";
|
||||
|
||||
|
||||
if ( file_exists( ROOT_PATH . 'upgrade/installfiles/upg_21003/' . strtolower($this->install->ipsclass->vars['sql_driver']) . $file ) )
|
||||
{
|
||||
require_once( ROOT_PATH . 'upgrade/installfiles/upg_21003/' . strtolower($this->install->ipsclass->vars['sql_driver']) . $file );
|
||||
|
||||
|
||||
$this->install->error = array();
|
||||
$this->sqlcount = 0;
|
||||
$output = "";
|
||||
|
||||
|
||||
$this->install->ipsclass->DB->return_die = 1;
|
||||
|
||||
|
||||
foreach( $SQL as $query )
|
||||
{
|
||||
$this->install->ipsclass->DB->allow_sub_select = 1;
|
||||
$this->install->ipsclass->DB->error = '';
|
||||
|
||||
|
||||
$query = str_replace( "<%time%>", time(), $query );
|
||||
|
||||
|
||||
if( $this->install->saved_data['man'] AND !in_array( $id, array(3,4) ) )
|
||||
{
|
||||
$output .= preg_replace("/\sibf_(\S+?)([\s\.,]|$)/", " ".$this->install->ipsclass->DB->obj['sql_tbl_prefix']."\\1\\2", preg_replace( "/\s{1,}/", " ", $query ) )."\n\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
$this->install->ipsclass->DB->query( $query );
|
||||
|
||||
|
||||
if ( $this->install->ipsclass->DB->error )
|
||||
{
|
||||
$this->install->error[] = $query."<br /><br />".$this->install->ipsclass->DB->error;
|
||||
@@ -140,38 +140,38 @@ class version_upgrade
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->install->message = "Âûïîëíåíî $this->sqlcount çàïðîñîâ...";
|
||||
|
||||
$this->install->message = "$this->sqlcount queries run....";
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------
|
||||
// Next page...
|
||||
//--------------------------------
|
||||
|
||||
|
||||
$this->install->saved_data['st'] = 0;
|
||||
|
||||
|
||||
if ( $id != 4 )
|
||||
{
|
||||
$nextid = $id + 1;
|
||||
$this->install->saved_data['workact'] = 'sql'.$nextid;
|
||||
$this->install->saved_data['workact'] = 'sql'.$nextid;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->install->saved_data['workact'] = 'polls';
|
||||
$this->install->saved_data['workact'] = 'polls';
|
||||
}
|
||||
|
||||
|
||||
if( $this->install->saved_data['man'] AND $output )
|
||||
{
|
||||
$this->install->message .= "<br /><br /><h3><b>Äëÿ ïðîäîëæåíèÿ îáíîâëåíèÿ íåîáõîäèìî âûïîëíèòü ñëåäóþùèå MySQL çàïðîñû:</b></h3><br />".nl2br(htmlspecialchars($output));
|
||||
$this->install->message .= "<br /><br /><h3><b>Please run these queries in your MySQL database before continuing..</b></h3><br />".nl2br(htmlspecialchars($output));
|
||||
$this->install->do_man = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// POLLS
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
function convert_polls()
|
||||
{
|
||||
$start = intval($this->install->saved_data['st']) > 0 ? intval($this->install->saved_data['st']) : 0;
|
||||
@@ -179,55 +179,55 @@ class version_upgrade
|
||||
$end = $start + $lend;
|
||||
$max = intval($this->install->saved_data['max']);
|
||||
$converted = intval($this->install->saved_data['conv']);
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// First off.. grab number of polls to convert
|
||||
//-----------------------------------------
|
||||
|
||||
|
||||
if ( ! $max )
|
||||
{
|
||||
$total = $this->install->ipsclass->DB->build_and_exec_query( array( 'select' => 'COUNT(*) as max',
|
||||
'from' => 'topics',
|
||||
'where' => "poll_state IN ('open', 'close', 'closed')" ) );
|
||||
|
||||
|
||||
$max = $total['max'];
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// In steps...
|
||||
//-----------------------------------------
|
||||
|
||||
|
||||
$this->install->ipsclass->DB->simple_construct( array( 'select' => '*',
|
||||
'from' => 'topics',
|
||||
'where' => "poll_state IN ('open', 'close', 'closed' )",
|
||||
'limit' => array( 0, $lend ) ) );
|
||||
$o = $this->install->ipsclass->DB->simple_exec();
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// Do it...
|
||||
//-----------------------------------------
|
||||
|
||||
|
||||
if ( $this->install->ipsclass->DB->get_num_rows($o) )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Got some to convert!
|
||||
//-----------------------------------------
|
||||
|
||||
|
||||
while ( $r = $this->install->ipsclass->DB->fetch_row($o) )
|
||||
{
|
||||
$converted++;
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// All done?
|
||||
//-----------------------------------------
|
||||
|
||||
|
||||
if ( $converted >= $max )
|
||||
{
|
||||
$done = 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$new_poll = array( 1 => array() );
|
||||
|
||||
|
||||
$poll_data = $this->install->ipsclass->DB->build_and_exec_query( array( 'select' => '*',
|
||||
'from' => 'polls',
|
||||
'where' => "tid=".$r['tid']
|
||||
@@ -236,47 +236,47 @@ class version_upgrade
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if ( ! $poll_data['poll_question'] )
|
||||
{
|
||||
$poll_data['poll_question'] = $r['title'];
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// Kick start new poll
|
||||
//-----------------------------------------
|
||||
|
||||
|
||||
$new_poll[1]['question'] = $poll_data['poll_question'];
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// Get OLD polls
|
||||
//-----------------------------------------
|
||||
|
||||
|
||||
$poll_answers = unserialize( stripslashes( $poll_data['choices'] ) );
|
||||
|
||||
|
||||
reset($poll_answers);
|
||||
|
||||
|
||||
foreach ( $poll_answers as $entry )
|
||||
{
|
||||
$id = $entry[0];
|
||||
$choice = $entry[1];
|
||||
$votes = $entry[2];
|
||||
|
||||
|
||||
$total_votes += $votes;
|
||||
|
||||
|
||||
if ( strlen($choice) < 1 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
$new_poll[ 1 ]['choice'][ $id ] = $choice;
|
||||
$new_poll[ 1 ]['votes'][ $id ] = $votes;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// Got something?
|
||||
//-----------------------------------------
|
||||
|
||||
|
||||
if ( count( $new_poll[1]['choice'] ) )
|
||||
{
|
||||
$this->install->ipsclass->DB->do_update( 'polls' , array( 'choices' => serialize( $new_poll ) ), 'tid='.$r['tid'] );
|
||||
@@ -288,84 +288,84 @@ class version_upgrade
|
||||
{
|
||||
$done = 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if ( ! $done )
|
||||
{
|
||||
$this->install->message = "Îïðîñû: $start èç $end îáíîâëåíû...";
|
||||
$this->install->saved_data['workact'] = 'polls';
|
||||
$this->install->message = "Polls: $start to $end completed....";
|
||||
$this->install->saved_data['workact'] = 'polls';
|
||||
$this->install->saved_data['st'] = $end;
|
||||
$this->install->saved_data['max'] = $max;
|
||||
$this->install->saved_data['conv'] = $converted;
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->install->message = "Îïðîñû îáíîâëåíû, ïåðåõîäèì ê îáíîâëåíèþ êàëåíäàðíûõ ñîáûòèé...";
|
||||
$this->install->saved_data['workact'] = 'calevents';
|
||||
$this->install->saved_data['st'] = '0';
|
||||
return FALSE;
|
||||
$this->install->message = "Polls converted, proceeding to calendar events...";
|
||||
$this->install->saved_data['workact'] = 'calevents';
|
||||
$this->install->saved_data['st'] = '0';
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// CALENDAR EVENTS
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
function convert_calevents()
|
||||
{
|
||||
$start = intval($this->install->saved_data['st']) > 0 ? intval($this->install->saved_data['st']) : 0;
|
||||
$lend = 50;
|
||||
$end = $start + $lend;
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// In steps...
|
||||
//-----------------------------------------
|
||||
|
||||
|
||||
$this->install->ipsclass->DB->simple_construct( array( 'select' => '*',
|
||||
'from' => 'calendar_events',
|
||||
'limit' => array( $start, $lend ) ) );
|
||||
$o = $this->install->ipsclass->DB->simple_exec();
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// Do it...
|
||||
//-----------------------------------------
|
||||
|
||||
|
||||
if ( $this->install->ipsclass->DB->get_num_rows($o) )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Got some to convert!
|
||||
//-----------------------------------------
|
||||
|
||||
|
||||
while ( $r = $this->install->ipsclass->DB->fetch_row($o) )
|
||||
{
|
||||
$recur_remap = array( 'w' => 1,
|
||||
'm' => 2,
|
||||
'y' => 3 );
|
||||
|
||||
|
||||
$begin_date = $this->install->ipsclass->date_getgmdate( $r['unix_stamp'] );
|
||||
$end_date = $this->install->ipsclass->date_getgmdate( $r['end_unix_stamp'] );
|
||||
|
||||
|
||||
if ( ! $begin_date OR ! $end_date )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
$day = $begin_date['mday'];
|
||||
$month = $begin_date['mon'];
|
||||
$year = $begin_date['year'];
|
||||
|
||||
|
||||
$end_day = $end_date['mday'];
|
||||
$end_month = $end_date['mon'];
|
||||
$end_year = $end_date['year'];
|
||||
|
||||
|
||||
$_final_unix_from = gmmktime(0, 0, 0, $month, $day, $year );
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// Recur or ranged...
|
||||
//-----------------------------------------
|
||||
|
||||
|
||||
if ( $r['event_repeat'] OR $r['event_ranged'] )
|
||||
{
|
||||
$_final_unix_to = gmmktime(11, 59, 59, $end_month, $end_day, $end_year);
|
||||
@@ -374,7 +374,7 @@ class version_upgrade
|
||||
{
|
||||
$_final_unix_to = 0;
|
||||
}
|
||||
|
||||
|
||||
$new_event = array( 'event_calendar_id' => 1,
|
||||
'event_member_id' => $r['userid'],
|
||||
'event_content' => $r['event_text'],
|
||||
@@ -388,36 +388,36 @@ class version_upgrade
|
||||
'event_tz' => 0,
|
||||
'event_unix_from' => $_final_unix_from,
|
||||
'event_unix_to' => $_final_unix_to );
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// INSERT
|
||||
//-----------------------------------------
|
||||
|
||||
|
||||
$this->install->ipsclass->DB->do_insert( 'cal_events', $new_event );
|
||||
}
|
||||
|
||||
$this->install->message = "Êàëåíäàðíûå ñîáûòèÿ: $start èç $end îáíîâëåíû...";
|
||||
$this->install->saved_data['workact'] = 'calevents';
|
||||
|
||||
$this->install->message = "Calendar events: $start to $end completed....";
|
||||
$this->install->saved_data['workact'] = 'calevents';
|
||||
$this->install->saved_data['st'] = $end;
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->install->message = "Êàëåíäàðíûå ñîáûòèÿ îáíîâëåíÿ, ïåðåõîäèì ê ñîçäàíèþ ãëàâíîåãî ñòèëÿ IPB 2.1 ...";
|
||||
$this->install->saved_data['workact'] = 'skin';
|
||||
return FALSE;
|
||||
$this->install->message = "Calendar events converted, Creating new IPB 2.1 skin...";
|
||||
$this->install->saved_data['workact'] = 'skin';
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// CALENDAR EVENTS
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
function add_skin()
|
||||
{
|
||||
$this->install->message = "Ïðîïóñêàåì ñîçäàíèå ñòèëÿ äëÿ âåðñèè 2.1 (îí áóäåò ñîçäàí ïîçæå)...";
|
||||
$this->install->message = "Skipping 2.1 skin creation (latest skin will be inserted later)...";
|
||||
unset($this->install->saved_data['workact']);
|
||||
unset($this->install->saved_data['vid']);
|
||||
return TRUE;
|
||||
@@ -425,27 +425,27 @@ class version_upgrade
|
||||
//-----------------------------------------
|
||||
// Get default wrapper
|
||||
//-----------------------------------------
|
||||
|
||||
|
||||
if ( file_exists( ROOT_PATH.'upgrade/installfiles/upg_21003/components.php' ) )
|
||||
{
|
||||
require_once( ROOT_PATH.'upgrade/installfiles/upg_21003/components.php' );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// Turn off all other skins
|
||||
//-----------------------------------------
|
||||
|
||||
|
||||
$this->install->ipsclass->DB->do_update( 'skin_sets', array( 'set_default' => 0 ) );
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// Insert new skin...
|
||||
//-----------------------------------------
|
||||
|
||||
|
||||
$this->install->ipsclass->DB->return_die = 1;
|
||||
$this->install->ipsclass->DB->allow_sub_select = 1;
|
||||
|
||||
|
||||
$this->install->ipsclass->DB->do_insert( 'skin_sets', array(
|
||||
'set_name' => 'IPB Ãëàâíûé ñòèëü',
|
||||
'set_name' => 'IPB 2.1 Default',
|
||||
'set_image_dir' => 1,
|
||||
'set_hidden' => 0,
|
||||
'set_default' => 1,
|
||||
@@ -460,31 +460,31 @@ class version_upgrade
|
||||
'set_cache_wrapper' => $WRAPPER,
|
||||
'set_emoticon_folder' => 'default',
|
||||
) );
|
||||
|
||||
|
||||
$new_id = $this->install->ipsclass->DB->get_insert_id();
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// Remove member's choice
|
||||
//-----------------------------------------
|
||||
|
||||
$this->install->ipsclass->DB->do_update( 'members', array( 'skin' => '' ) );
|
||||
|
||||
|
||||
$this->install->ipsclass->DB->do_update( 'members', array( 'skin' => '' ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Done...
|
||||
//-----------------------------------------
|
||||
|
||||
$this->install->message = "Ãëàâíûé ñòèëü IPB 2.1 ñîçäàí...";
|
||||
|
||||
$this->install->message = "2.1 skin created...";
|
||||
unset($this->install->saved_data['workact']);
|
||||
unset($this->install->saved_data['vid']);
|
||||
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
Reference in new issue
Block a user