IPB UPGRADE MODULE:: IPB 2.1.2 -> 2.1.3 | > 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 "

Incorrect access

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 = '21009'; var $upgrade_from = '21008'; var $first_step = 'update your database to include the new schematic'; 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? // sql => DONE //-------------------------------- switch( $this->ipsclass->input['workact'] ) { case 'sql': $this->upgrade_sql(); break; case 'cal': $this->upgrade_cal(); break; case 'helpfiles': $this->upgrade_helpfiles(); break; case 'skinrevert': $this->revert_skin_changes(); break; default: $this->upgrade_intro(); break; } } /*-------------------------------------------------------------------------*/ // SQL: 0 /*-------------------------------------------------------------------------*/ function upgrade_sql() { $man = intval( $this->ipsclass->input['man'] ); $SQL = array(); $file = '_updates.php'; $cnt = 0; if ( file_exists( THIS_PATH . 'upg_' . $this->ipsclass->current_upgrade . '/' . strtolower($this->ipsclass->vars['sql_driver']) . $file ) ) { require_once( THIS_PATH . 'upg_' . $this->ipsclass->current_upgrade . '/' . strtolower($this->ipsclass->vars['sql_driver']) . $file ); foreach( $SQL as $q ) { $q = str_replace( "<%time%>", time(), $q ); $this->ipsclass->DB->query( $q ); $cnt++; } } $this->ipsclass->core->redirect( "{$this->base_url}&workact=cal", "$cnt queries run...." ); } /*-------------------------------------------------------------------------*/ // Update Old Calendar Events /*-------------------------------------------------------------------------*/ function upgrade_cal() { $cnt = 0; $outer = $this->ipsclass->DB->query( "SELECT * FROM ibf_cal_events ORDER BY event_id ASC" ); if( $this->ipsclass->DB->get_num_rows($outer) ) { while( $event = $this->ipsclass->DB->fetch_row( $outer ) ) { if( $event['event_tz'] ) { $this->ipsclass->DB->query( "UPDATE ibf_cal_events SET event_tz=0 WHERE event_id='{$event['event_id']}'" ); $cnt++; } } } $this->ipsclass->core->redirect( "{$this->base_url}&workact=helpfiles", "$cnt calendar events updated...." ); } /*-------------------------------------------------------------------------*/ // Update help files /*-------------------------------------------------------------------------*/ function upgrade_helpfiles() { if(! $this->ipsclass->input['do_update'] ) { $this->ipsclass->template->content .= "
Do you wish to update your help files?
Some of the help files have changed from previous versions. If you are running a board that has been upgraded from a version prior to 2.1.0, you may optionally wish to update your help files to reflect changes in the location of certain configuration settings and board features. If you have customized your help files, proceeding with this step WILL overwrite those changes. This step will update the first 16 help files in your database, and the changes can not be undone. If you have not customized the default help files and/or you would like to update them now, proceed with this step. Otherwise skip this step.

Do you wish to update your help files at this time?
» Upgrade Help Files ...
» Skip This Step ...
"; $this->ipsclass->template->output(); } else { $man = intval( $this->ipsclass->input['man'] ); $UPDATES = array(); $file = '_updates.php'; $cnt = 0; if ( file_exists( THIS_PATH . 'upg_' . $this->ipsclass->current_upgrade . '/' . strtolower($this->ipsclass->vars['sql_driver']) . $file ) ) { require_once( THIS_PATH . 'upg_' . $this->ipsclass->current_upgrade . '/' . strtolower($this->ipsclass->vars['sql_driver']) . $file ); foreach( $UPDATES as $q ) { $this->ipsclass->DB->query( $q ); $cnt++; } } $this->ipsclass->core->redirect( "index.php?act=work&workact=skinrevert&loginkey={$this->ipsclass->input['loginkey']}&securekey={$this->ipsclass->input['securekey']}&mid={$this->ipsclass->input['mid']}", "$cnt help files updated...." ); } } /*-------------------------------------------------------------------------*/ // Revert Skin Changes /*-------------------------------------------------------------------------*/ function revert_skin_changes() { if(! $this->ipsclass->input['do_update'] ) { $id = intval($this->ipsclass->input['skinid']) ? intval($this->ipsclass->input['skinid']) : 2; $default = $this->ipsclass->DB->simple_exec_query( array( 'select' => '*', 'from' => 'skin_sets', 'where' => "set_skin_set_id={$id}" ) ); if( !$default['set_skin_set_id'] ) { // Didn't find id 2, let's try by name $default = $this->ipsclass->DB->simple_exec_query( array( 'select' => '*', 'from' => 'skin_sets', 'where' => "set_name='IPB Default Skin'" ) ); if( !$default['set_skin_set_id'] ) { // Didn't find by name either $default = array(); } } if( count( $default ) ) { $this->ipsclass->template->content .= "
Do you wish to revert any skin changes?
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.

Custom skins that you install generally have their own set of template files, and as such may need to be manually updated. 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.

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.

Because of the different html possibilities present for custom skin sets, the upgrader will not alter these skin sets for you. 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.

Do you wish to revert changes to the '{$default['set_name']}' skin set?
(If this is not your default skin, it is recommended that you skip this step and manually update your templates)
» Yes, revert these skin changes ...
» ipsclass->input['securekey']}&mid={$this->ipsclass->input['mid']}'>No, I want to skip this step ...
"; } else { $this->ipsclass->template->content .= "
IPB Default Skin not found
This step in the upgrade process allows you to revert skin changes to the default IPB skin, to ensure that the skin updates will inherit to the default skin properly. Your IPB Default Skin was not found. You will be responsible for ensuring that you update your skin templates to ensure that the changed template bits are applied properly.


» ipsclass->input['securekey']}&mid={$this->ipsclass->input['mid']}'>Proceed ...
"; } $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'] ) { $this->ipsclass->core->redirect( "index.php?act=work&workact=skinrevert&skinid={$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...." ); } 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 .= "
Welcome to the IPB Upgrade System
This upgrade module will upgrade you from {$this->ipsclass->versions[$this->upgrade_from]} to {$this->ipsclass->versions[$this->this_version]}

This first step will {$this->first_step}
"; if ( ! is_writeable( CACHE_PATH . 'cache/skin_cache' ) ) { $this->ipsclass->template->content .= "
WARNING: cache/skin_cache is not writeable
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.
"; } else { $this->ipsclass->template->content .= "

Modules to run after this module: {$this->mod_to_run}
"; } $this->ipsclass->template->output(); } } ?>