241 lines
11 KiB
PHP
241 lines
11 KiB
PHP
<?php
|
|
|
|
/*
|
|
+--------------------------------------------------------------------------
|
|
| Invision Power Board v<{%dyn.down.var.human.version%}>
|
|
| ========================================
|
|
| by Matthew Mecham
|
|
| (c) 2001 - 2004 Invision Power Services
|
|
| http://www.invisionpower.com
|
|
| ========================================
|
|
| Web: http://www.invisionboard.com
|
|
| Time: <{%dyn.down.var.time%}>
|
|
| Release: <{%dyn.down.var.md5%}>
|
|
| Email: matt@invisionpower.com
|
|
| Licence Info: http://www.invisionboard.com/?license
|
|
+---------------------------------------------------------------------------
|
|
|
|
|
| > IPB UPGRADE MODULE:: IPB 2.1.5 -> 2.1.6
|
|
| > Script written by Matt Mecham
|
|
| > Date started: 23rd April 2004
|
|
| > "So what, pop is dead - it's no great loss.
|
|
So many facelifts, it's face flew off"
|
|
+--------------------------------------------------------------------------
|
|
*/
|
|
|
|
if ( ! defined( 'IN_IPB' ) )
|
|
{
|
|
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 $this_version = '21012';
|
|
var $upgrade_from = '21011';
|
|
var $first_step = 'update your database to include the new schematic modifications.';
|
|
var $md5_check = '';
|
|
var $base_url = '';
|
|
var $mod_to_run = '';
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
// CONSTRUCTOR
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
function version_upgrade()
|
|
{
|
|
|
|
}
|
|
|
|
function version_process()
|
|
{
|
|
$this->md5_check = $this->ipsclass->return_md5_check();
|
|
|
|
$this->base_url = "index.php?act=work&loginkey={$this->ipsclass->input['loginkey']}&securekey={$this->ipsclass->input['securekey']}&mid={$this->ipsclass->input['mid']}";
|
|
|
|
if ( is_array( $this->ipsclass->modules_to_run ) and count( $this->ipsclass->modules_to_run ) )
|
|
{
|
|
$tmp = array_shift( $this->ipsclass->modules_to_run );
|
|
|
|
$this->mod_to_run = implode( ', ', $this->ipsclass->modules_to_run );
|
|
}
|
|
|
|
if ( ! $this->mod_to_run )
|
|
{
|
|
$this->mod_to_run = 'None';
|
|
}
|
|
}
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
// Auto run..
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
function auto_run()
|
|
{
|
|
|
|
|
|
//--------------------------------
|
|
// What are we doing?
|
|
//--------------------------------
|
|
|
|
switch( $this->ipsclass->input['workact'] )
|
|
{
|
|
case 'skinrevert':
|
|
$this->revert_skin_changes();
|
|
break;
|
|
default:
|
|
$this->upgrade_intro();
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
// Revert Skin Changes
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
function revert_skin_changes()
|
|
{
|
|
$error_already = 0;
|
|
|
|
if(! $this->ipsclass->input['do_update'] )
|
|
{
|
|
$id = intval($this->ipsclass->input['skinid']) ? intval($this->ipsclass->input['skinid']) : 1;
|
|
|
|
$default = $this->ipsclass->DB->simple_exec_query( array( 'select' => '*', 'from' => 'skin_sets', 'where' => "set_skin_set_id>{$id}" ) );
|
|
|
|
if( !$default['set_skin_set_id'] )
|
|
{
|
|
if( $id >= 2 )
|
|
{
|
|
$this->ipsclass->core->redirect( "index.php?act=done&loginkey={$this->ipsclass->input['loginkey']}&securekey={$this->ipsclass->input['securekey']}&mid={$this->ipsclass->input['mid']}",
|
|
"No further skin sets to check...." );
|
|
}
|
|
else
|
|
{
|
|
$error_alread = 1;
|
|
|
|
$this->ipsclass->template->content .= "<div class='warnbox'><strong>Skins not found</strong><br />
|
|
This step in the upgrade process allows you to revert skin changes to your templates to ensure that new changes in this upgrade are properly inherited.
|
|
No skin sets could be found however. You will need to login to your ACP after the upgrade process has completed and manually revert changes to your skin sets in order
|
|
to see the new updates to your skin templats.</div>
|
|
<br /><br />
|
|
<div align='center'><span style='font-weight:bold;font-size:14px'>» <a href='index.php?act=done&loginkey={$this->ipsclass->input['loginkey']}&securekey={$this->ipsclass->input['securekey']}&mid={$this->ipsclass->input['mid']}'>Proceed ...</a></span></div>";
|
|
}
|
|
}
|
|
|
|
if( count( $default ) )
|
|
{
|
|
$this->ipsclass->template->content .= "
|
|
<div class='tableborder'>
|
|
<div class='maintitle'>Do you wish to revert any skin changes?</div>
|
|
<div class='tdrow1' style='padding:6px'>During upgrades there are often times changes to the Master HTML Templates that your skins inherit from. If your skin templates are not customized, they will typically inherit changes from the master skin templates. This happens for the IPB Default skin automatically.<br /><br />
|
|
Custom skins that you install generally have their own set of template files, and as such <b>you will need to manually update your custom skins</b>. If your skin templates are not updated properly, unforseen issues can arise. For example you may see javascript errors on your site, or you may not see options that are present because they are not
|
|
reflected in your skin set's templates.<br /><br />
|
|
Your Master HTML Templates will be updated automatically during the upgrade process, however in order for them to be effective on the default skin, any skin changes must also be reverted. If you wish to do this manually, you can skip this step below, and log into your Admin Control Panel after the upgrade process has completed
|
|
to revert the changes. You would need to edit your IPB Default 2.1 skin set HTML templates, and click the \"Revert\" button for any templates that it appears next to. Alternatively, the upgrader can do this for you.<br /><br />
|
|
Because of the different html possibilities present for custom skin sets, you are strongly advised to carefuly determine if you wish for the upgrader to revert your skin changes, or if you should manually update your skin templates. After your upgrade is complete, it is recommended that you run the \"Skin Differences Tool\" in the Admin Control Panel for your custom skin to determine if you need to make any updates to your
|
|
custom skin sets.
|
|
<br /><br /><b>Do you wish to revert changes to the '{$default['set_name']}' skin set?</b><br />(<i>If this is not your default skin, it is recommended that you skip this step and manually update your templates</i>)
|
|
<div align='left'><blockquote><span style='font-weight:bold;font-size:14px'>» <a href='{$this->base_url}&workact=skinrevert&do_update=1&man={$default['set_skin_set_id']}&do=all'>Yes, and revert changes to ALL skin sets ...</a><br />
|
|
<span style='font-weight:bold;font-size:14px'>» <a href='{$this->base_url}&workact=skinrevert&do_update=1&man={$default['set_skin_set_id']}'>Yes, revert changes to this skin set ...</a><br />
|
|
» <a href='{$this->base_url}&workact=skinrevert&skinid={$default['set_skin_set_id']}'>No, I want to skip this skin set ...</a></span></blockquote></div>
|
|
";
|
|
}
|
|
else if( !$error_already )
|
|
{
|
|
$this->ipsclass->template->content .= "<div class='warnbox'><strong>Skins not found</strong><br />
|
|
This step in the upgrade process allows you to revert skin changes to your templates to ensure that new changes in this upgrade are properly inherited. You will be responsible for making these skin changes manually.</div>
|
|
<br /><br />
|
|
<div align='center'><span style='font-weight:bold;font-size:14px'>» <a href='index.php?act=done&loginkey={$this->ipsclass->input['loginkey']}&securekey={$this->ipsclass->input['securekey']}&mid={$this->ipsclass->input['mid']}'>Proceed ...</a></span></div>";
|
|
}
|
|
|
|
$this->ipsclass->template->output();
|
|
}
|
|
else
|
|
{
|
|
$man = intval( $this->ipsclass->input['man'] );
|
|
$cnt = 0;
|
|
|
|
$default = $this->ipsclass->DB->simple_exec_query( array( 'select' => '*', 'from' => 'skin_sets', 'where' => "set_skin_set_id=".$man ) );
|
|
$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'skin_templates', 'where' => "set_id=".$man ) );
|
|
$outer = $this->ipsclass->DB->simple_exec();
|
|
|
|
if( $this->ipsclass->DB->get_num_rows($outer) )
|
|
{
|
|
while( $r = $this->ipsclass->DB->fetch_row($outer) )
|
|
{
|
|
if( $r['set_id'] == 1 )
|
|
{
|
|
continue;
|
|
}
|
|
else
|
|
{
|
|
$this->ipsclass->DB->simple_exec_query( array( 'delete' => 'skin_templates', 'where' => 'suid='.$r['suid'] ) );
|
|
$cnt++;
|
|
}
|
|
}
|
|
}
|
|
|
|
$next = $this->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->ipsclass->input['do'] == 'all' )
|
|
{
|
|
$this->ipsclass->core->redirect( "index.php?act=work&workact=skinrevert&do_update=1&do=all&man={$next['set_skin_set_id']}&loginkey={$this->ipsclass->input['loginkey']}&securekey={$this->ipsclass->input['securekey']}&mid={$this->ipsclass->input['mid']}",
|
|
"$cnt skin template bits from skin set '{$default['set_name']}' reverted, proceeding to next skin set...." );
|
|
}
|
|
else
|
|
{
|
|
$this->ipsclass->core->redirect( "index.php?act=work&workact=skinrevert&skinid={$man}&loginkey={$this->ipsclass->input['loginkey']}&securekey={$this->ipsclass->input['securekey']}&mid={$this->ipsclass->input['mid']}",
|
|
"$cnt skin template bits from skin set '{$default['set_name']}' reverted...." );
|
|
}
|
|
}
|
|
else
|
|
{
|
|
$this->ipsclass->core->redirect( "index.php?act=done&loginkey={$this->ipsclass->input['loginkey']}&securekey={$this->ipsclass->input['securekey']}&mid={$this->ipsclass->input['mid']}",
|
|
"$cnt skin template bits from skin set '{$default['set_name']}' reverted...." );
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
// INTRO
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
function upgrade_intro()
|
|
{
|
|
$this->ipsclass->template->content .= "
|
|
<div class='tableborder'>
|
|
<div class='maintitle'>Welcome to the IPB Upgrade System</div>
|
|
<div class='tdrow1' style='padding:6px'>This upgrade module will upgrade you from <b>{$this->ipsclass->versions[$this->upgrade_from]}</b> to <b>{$this->ipsclass->versions[$this->this_version]}</b>
|
|
<br /><br />This first step will {$this->first_step}
|
|
<br />
|
|
";
|
|
|
|
if ( ! is_writeable( CACHE_PATH . 'cache/skin_cache' ) )
|
|
{
|
|
$this->ipsclass->template->content .= "<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>";
|
|
}
|
|
else
|
|
{
|
|
$this->ipsclass->template->content .= "<div align='center'><span style='font-weight:bold;font-size:14px'>» <a href='{$this->base_url}&workact=skinrevert'>Proceed ...</a></span></div>
|
|
</div>
|
|
</div>
|
|
<br />
|
|
<div align='center'>Modules to run after this module: {$this->mod_to_run}</div>";
|
|
}
|
|
|
|
$this->ipsclass->template->output();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
?>
|