| 
      1
     | 
    
      <?php
 
     | 
  
  
    | 
      2
     | 
    
      
 
     | 
  
  
    | 
      3
     | 
    
      // $Id: upgrade-script.php 995 2009-06-17 10:20:13Z aldus $
 
     | 
  
  
    | 
      4
     | 
    
      
 
     | 
  
  
    | 
      5
     | 
    
      /*
 
     | 
  
  
    | 
      6
     | 
    
      
 
     | 
  
  
    | 
      7
     | 
    
       Website Baker Project <http://www.websitebaker.org/>
 
     | 
  
  
    | 
      8
     | 
    
       Copyright (C) 2004-2009, Ryan Djurovich
 
     | 
  
  
    | 
      9
     | 
    
      
 
     | 
  
  
    | 
      10
     | 
    
       Website Baker is free software; you can redistribute it and/or modify
 
     | 
  
  
    | 
      11
     | 
    
       it under the terms of the GNU General Public License as published by
 
     | 
  
  
    | 
      12
     | 
    
       the Free Software Foundation; either version 2 of the License, or
 
     | 
  
  
    | 
      13
     | 
    
       (at your option) any later version.
 
     | 
  
  
    | 
      14
     | 
    
      
 
     | 
  
  
    | 
      15
     | 
    
       Website Baker is distributed in the hope that it will be useful,
 
     | 
  
  
    | 
      16
     | 
    
       but WITHOUT ANY WARRANTY; without even the implied warranty of
 
     | 
  
  
    | 
      17
     | 
    
       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
     | 
  
  
    | 
      18
     | 
    
       GNU General Public License for more details.
 
     | 
  
  
    | 
      19
     | 
    
      
 
     | 
  
  
    | 
      20
     | 
    
       You should have received a copy of the GNU General Public License
 
     | 
  
  
    | 
      21
     | 
    
       along with Website Baker; if not, write to the Free Software
 
     | 
  
  
    | 
      22
     | 
    
       Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
     | 
  
  
    | 
      23
     | 
    
      
 
     | 
  
  
    | 
      24
     | 
    
      */
 
     | 
  
  
    | 
      25
     | 
    
      
 
     | 
  
  
    | 
      26
     | 
    
      @include_once('config.php');
     | 
  
  
    | 
      27
     | 
    
      
 
     | 
  
  
    | 
      28
     | 
    
      // this function checks the basic configurations of an existing WB intallation
 
     | 
  
  
    | 
      29
     | 
    
      function status_msg($message, $class='check', $element='span') {
     | 
  
  
    | 
      30
     | 
    
      	// returns a status message
 
     | 
  
  
    | 
      31
     | 
    
      	echo '<'.$element .' class="' .$class .'">' .$message .'</' .$element.'>';
 
     | 
  
  
    | 
      32
     | 
    
      }
 
     | 
  
  
    | 
      33
     | 
    
      
 
     | 
  
  
    | 
      34
     | 
    
      
 
     | 
  
  
    | 
      35
     | 
    
      ?>
 
     | 
  
  
    | 
      36
     | 
    
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
     | 
  
  
    | 
      37
     | 
    
      <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 
     | 
  
  
    | 
      38
     | 
    
      <head>
 
     | 
  
  
    | 
      39
     | 
    
      <title>Upgrade script</title>
 
     | 
  
  
    | 
      40
     | 
    
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 
     | 
  
  
    | 
      41
     | 
    
      <style type="text/css">
 
     | 
  
  
    | 
      42
     | 
    
      body {
     | 
  
  
    | 
      43
     | 
    
      	margin:0;
 
     | 
  
  
    | 
      44
     | 
    
      	padding:0;
 
     | 
  
  
    | 
      45
     | 
    
      	border:0;
 
     | 
  
  
    | 
      46
     | 
    
      	background: #EBF7FC;
 
     | 
  
  
    | 
      47
     | 
    
      	color:#000;
 
     | 
  
  
    | 
      48
     | 
    
      	font-family: 'Trebuchet MS', Verdana, Arial, Helvetica, Sans-Serif;
 
     | 
  
  
    | 
      49
     | 
    
      	font-size: small;
 
     | 
  
  
    | 
      50
     | 
    
      	height:101%;
 
     | 
  
  
    | 
      51
     | 
    
      }
 
     | 
  
  
    | 
      52
     | 
    
      
 
     | 
  
  
    | 
      53
     | 
    
      #container {
     | 
  
  
    | 
      54
     | 
    
      	width:85%;
 
     | 
  
  
    | 
      55
     | 
    
      	background: #A8BCCB url(templates/wb_theme/images/background.png) repeat-x;
 
     | 
  
  
    | 
      56
     | 
    
      	border:1px solid #000;
 
     | 
  
  
    | 
      57
     | 
    
      	color:#000;
 
     | 
  
  
    | 
      58
     | 
    
      	margin:2em auto;
 
     | 
  
  
    | 
      59
     | 
    
      	padding:0 15px;
 
     | 
  
  
    | 
      60
     | 
    
      	min-height: 500px;
 
     | 
  
  
    | 
      61
     | 
    
      	text-align:left;
 
     | 
  
  
    | 
      62
     | 
    
      }
 
     | 
  
  
    | 
      63
     | 
    
      
 
     | 
  
  
    | 
      64
     | 
    
      p { line-height:1.5em; }
     | 
  
  
    | 
      65
     | 
    
      
 
     | 
  
  
    | 
      66
     | 
    
      h1,h2,h3,h4,h5,h6 {
     | 
  
  
    | 
      67
     | 
    
      	font-family: Verdana, Arial, Helvetica, sans-serif;
 
     | 
  
  
    | 
      68
     | 
    
      	color: #369;
 
     | 
  
  
    | 
      69
     | 
    
      	margin-top: 1.0em;
 
     | 
  
  
    | 
      70
     | 
    
      	margin-bottom: 0.1em;
 
     | 
  
  
    | 
      71
     | 
    
      }
 
     | 
  
  
    | 
      72
     | 
    
      
 
     | 
  
  
    | 
      73
     | 
    
      h1 { font-size:150%; }
     | 
  
  
    | 
      74
     | 
    
      h2 { font-size: 130%; border-bottom: 1px #CCC solid; }
     | 
  
  
    | 
      75
     | 
    
      h3 { font-size: 120%; }
     | 
  
  
    | 
      76
     | 
    
      
 
     | 
  
  
    | 
      77
     | 
    
      .ok, .error { font-weight:bold; }
     | 
  
  
    | 
      78
     | 
    
      .ok { color:green; }
     | 
  
  
    | 
      79
     | 
    
      .error { color:red; }
     | 
  
  
    | 
      80
     | 
    
      .check { color:#555; }
     | 
  
  
    | 
      81
     | 
    
      
 
     | 
  
  
    | 
      82
     | 
    
      .warning {
     | 
  
  
    | 
      83
     | 
    
      	width: 98%;
 
     | 
  
  
    | 
      84
     | 
    
      	background:#FFDBDB;
 
     | 
  
  
    | 
      85
     | 
    
      	padding:0.2em;
 
     | 
  
  
    | 
      86
     | 
    
      	margin-top:0.5em;
 
     | 
  
  
    | 
      87
     | 
    
      	border: 1px solid black;
 
     | 
  
  
    | 
      88
     | 
    
      }
 
     | 
  
  
    | 
      89
     | 
    
      </style>
 
     | 
  
  
    | 
      90
     | 
    
      </head>
 
     | 
  
  
    | 
      91
     | 
    
      <body>
 
     | 
  
  
    | 
      92
     | 
    
      <div id="container">
 
     | 
  
  
    | 
      93
     | 
    
      <img src="templates/wb_theme/images/logo.png" alt="Website Baker Logo" />
 
     | 
  
  
    | 
      94
     | 
    
      
 
     | 
  
  
    | 
      95
     | 
    
      <h1>Website Baker Upgrade</h1>
 
     | 
  
  
    | 
      96
     | 
    
      <p>This script upgrades an existing Website Baker <strong>Version 2.7</strong> installation to the <strong>Version 2.8</strong>. The upgrade script alters the existing WB database to reflect the changes introduced with WB 2.8.</p>
 
     | 
  
  
    | 
      97
     | 
    
      
 
     | 
  
  
    | 
      98
     | 
    
      <?php
 
     | 
  
  
    | 
      99
     | 
    
      /**
 
     | 
  
  
    | 
      100
     | 
    
       * Check if disclaimer was accepted
 
     | 
  
  
    | 
      101
     | 
    
       */
 
     | 
  
  
    | 
      102
     | 
    
      if (!(isset($_POST['backup_confirmed']) && $_POST['backup_confirmed'] == 'confirmed')) { ?>
     | 
  
  
    | 
      103
     | 
    
      <h2>Step 1: Backup your files</h2>
 
     | 
  
  
    | 
      104
     | 
    
      <p>It is highly recommended to <strong>create a manual backup</strong> of the entire <strong>/pages folder</strong> and the <strong>MySQL database</strong> before proceeding.<br /><strong class="error">Note: </strong>The upgrade script alters some settings of your existing database!!! You need to confirm the disclaimer before proceeding.</p>
 
     | 
  
  
    | 
      105
     | 
    
      
 
     | 
  
  
    | 
      106
     | 
    
      <form name="send" action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">
 
     | 
  
  
    | 
      107
     | 
    
      <textarea cols="80" rows="5">DISCLAIMER: The Website Baker upgrade script is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. One needs to confirm that a manual backup of the /pages folder (including all files and subfolders contained in it) and backup of the entire Website Baker MySQL database was created before you can proceed.</textarea>
 
     | 
  
  
    | 
      108
     | 
    
      <br /><br /><input name="backup_confirmed" type="checkbox" value="confirmed" /> I confirm that a manual backup of the /pages folder and the MySQL database was created.
 
     | 
  
  
    | 
      109
     | 
    
      <br /><br /><input name="send" type="submit" value="Start upgrade script" />
 
     | 
  
  
    | 
      110
     | 
    
      </form>
 
     | 
  
  
    | 
      111
     | 
    
      <br />
 
     | 
  
  
    | 
      112
     | 
    
      
 
     | 
  
  
    | 
      113
     | 
    
      <?php
 
     | 
  
  
    | 
      114
     | 
    
      	status_msg('<strong>Notice:</strong><br />You need to confirm that you have created a manual backup of the /pages directory and the MySQL database before you can proceed.', 'warning', 'div');
     | 
  
  
    | 
      115
     | 
    
      	echo '<br /><br />';
 
     | 
  
  
    | 
      116
     | 
    
      	exit;
 
     | 
  
  
    | 
      117
     | 
    
      }
 
     | 
  
  
    | 
      118
     | 
    
      
 
     | 
  
  
    | 
      119
     | 
    
      echo '<h2>Step 2: Updating database entries</h2>';
 
     | 
  
  
    | 
      120
     | 
    
      
 
     | 
  
  
    | 
      121
     | 
    
      require_once('config.php');
     | 
  
  
    | 
      122
     | 
    
      require_once(WB_PATH.'/framework/functions.php');
 
     | 
  
  
    | 
      123
     | 
    
      
 
     | 
  
  
    | 
      124
     | 
    
      $OK   = '<span class="ok">OK</span>';
 
     | 
  
  
    | 
      125
     | 
    
      $FAIL = '<span class="error">FAILED</span>';
 
     | 
  
  
    | 
      126
     | 
    
      
 
     | 
  
  
    | 
      127
     | 
    
      // function to add a var/value-pair into settings-table
 
     | 
  
  
    | 
      128
     | 
    
      function db_add_key_value($key, $value) {
     | 
  
  
    | 
      129
     | 
    
      	global $database; global $OK; global $FAIL;
 
     | 
  
  
    | 
      130
     | 
    
      	$table = TABLE_PREFIX.'settings';
 
     | 
  
  
    | 
      131
     | 
    
      	$query = $database->query("SELECT value FROM $table WHERE name = '$key' LIMIT 1");
     | 
  
  
    | 
      132
     | 
    
      	if($query->numRows() > 0) {
     | 
  
  
    | 
      133
     | 
    
      		echo "$key: already exists. $OK.<br />";
 
     | 
  
  
    | 
      134
     | 
    
      		return true;
 
     | 
  
  
    | 
      135
     | 
    
      	} else {
     | 
  
  
    | 
      136
     | 
    
      		$database->query("INSERT INTO $table (name,value) VALUES ('$key', '$value')");
     | 
  
  
    | 
      137
     | 
    
      		echo (mysql_error()?mysql_error().'<br />':'');
 
     | 
  
  
    | 
      138
     | 
    
      		$query = $database->query("SELECT value FROM $table WHERE name = '$key' LIMIT 1");
     | 
  
  
    | 
      139
     | 
    
      		if($query->numRows() > 0) {
     | 
  
  
    | 
      140
     | 
    
      			echo "$key: $OK.<br />";
 
     | 
  
  
    | 
      141
     | 
    
      			return true;
 
     | 
  
  
    | 
      142
     | 
    
      		} else {
     | 
  
  
    | 
      143
     | 
    
      			echo "$key: $FAIL!<br />";
 
     | 
  
  
    | 
      144
     | 
    
      			return false;
 
     | 
  
  
    | 
      145
     | 
    
      		}
 
     | 
  
  
    | 
      146
     | 
    
      	}
 
     | 
  
  
    | 
      147
     | 
    
      }
 
     | 
  
  
    | 
      148
     | 
    
      
 
     | 
  
  
    | 
      149
     | 
    
      // function to add a new field into a table
 
     | 
  
  
    | 
      150
     | 
    
      function db_add_field($field, $table, $desc) {
     | 
  
  
    | 
      151
     | 
    
      	global $database; global $OK; global $FAIL;
 
     | 
  
  
    | 
      152
     | 
    
      	$table = TABLE_PREFIX.$table;
 
     | 
  
  
    | 
      153
     | 
    
      	$query = $database->query("DESCRIBE $table '$field'");
     | 
  
  
    | 
      154
     | 
    
      	if($query->numRows() == 0) { // add field
     | 
  
  
    | 
      155
     | 
    
      		$query = $database->query("ALTER TABLE $table ADD $field $desc");
     | 
  
  
    | 
      156
     | 
    
      		echo (mysql_error()?mysql_error().'<br />':'');
 
     | 
  
  
    | 
      157
     | 
    
      		$query = $database->query("DESCRIBE $table '$field'");
     | 
  
  
    | 
      158
     | 
    
      		echo (mysql_error()?mysql_error().'<br />':'');
 
     | 
  
  
    | 
      159
     | 
    
      		if($query->numRows() > 0) {
     | 
  
  
    | 
      160
     | 
    
      			echo "'$field' added. $OK.<br />";
 
     | 
  
  
    | 
      161
     | 
    
      		} else {
     | 
  
  
    | 
      162
     | 
    
      			echo "adding '$field' $FAIL!<br />";
 
     | 
  
  
    | 
      163
     | 
    
      		}
 
     | 
  
  
    | 
      164
     | 
    
      	} else {
     | 
  
  
    | 
      165
     | 
    
      		echo "'$field' already exists. $OK.<br />";
 
     | 
  
  
    | 
      166
     | 
    
      	}
 
     | 
  
  
    | 
      167
     | 
    
      }
 
     | 
  
  
    | 
      168
     | 
    
      
 
     | 
  
  
    | 
      169
     | 
    
      
 
     | 
  
  
    | 
      170
     | 
    
      /**********************************************************
 
     | 
  
  
    | 
      171
     | 
    
       *  - Adding field sec_anchor to settings table
 
     | 
  
  
    | 
      172
     | 
    
       */
 
     | 
  
  
    | 
      173
     | 
    
      echo "<br />Adding sec_anchor to settings table<br />";
 
     | 
  
  
    | 
      174
     | 
    
      $cfg = array(
 
     | 
  
  
    | 
      175
     | 
    
      	'sec_anchor' => 'wb_'
 
     | 
  
  
    | 
      176
     | 
    
      );
 
     | 
  
  
    | 
      177
     | 
    
      foreach($cfg as $key=>$value) {
     | 
  
  
    | 
      178
     | 
    
      	db_add_key_value($key, $value);
 
     | 
  
  
    | 
      179
     | 
    
      }
 
     | 
  
  
    | 
      180
     | 
    
      
 
     | 
  
  
    | 
      181
     | 
    
      
 
     | 
  
  
    | 
      182
     | 
    
      /**********************************************************
 
     | 
  
  
    | 
      183
     | 
    
       *  - Adding field default_theme to settings table
 
     | 
  
  
    | 
      184
     | 
    
       */
 
     | 
  
  
    | 
      185
     | 
    
      echo "<br />Adding default_theme to settings table<br />";
 
     | 
  
  
    | 
      186
     | 
    
      $cfg = array(
 
     | 
  
  
    | 
      187
     | 
    
      	'default_theme' => 'wb_theme'
 
     | 
  
  
    | 
      188
     | 
    
      );
 
     | 
  
  
    | 
      189
     | 
    
      foreach($cfg as $key=>$value) {
     | 
  
  
    | 
      190
     | 
    
      	db_add_key_value($key, $value);
 
     | 
  
  
    | 
      191
     | 
    
      }
 
     | 
  
  
    | 
      192
     | 
    
      
 
     | 
  
  
    | 
      193
     | 
    
      
 
     | 
  
  
    | 
      194
     | 
    
      /**********************************************************
 
     | 
  
  
    | 
      195
     | 
    
       *  - Adding redirect timer to settings table
 
     | 
  
  
    | 
      196
     | 
    
       */
 
     | 
  
  
    | 
      197
     | 
    
      echo "<br />Adding redirect timer to settings table<br />";
 
     | 
  
  
    | 
      198
     | 
    
      $cfg = array(
 
     | 
  
  
    | 
      199
     | 
    
      	'redirect_timer' => '1500'
 
     | 
  
  
    | 
      200
     | 
    
      );
 
     | 
  
  
    | 
      201
     | 
    
      foreach($cfg as $key=>$value) {
     | 
  
  
    | 
      202
     | 
    
      	db_add_key_value($key, $value);
 
     | 
  
  
    | 
      203
     | 
    
      }
 
     | 
  
  
    | 
      204
     | 
    
      
 
     | 
  
  
    | 
      205
     | 
    
      
 
     | 
  
  
    | 
      206
     | 
    
      /**********************************************************
 
     | 
  
  
    | 
      207
     | 
    
       *  - Add field "redirect_type" to table "mod_menu_link"
 
     | 
  
  
    | 
      208
     | 
    
       */
 
     | 
  
  
    | 
      209
     | 
    
      echo "<br />Adding field redirect_type to mod_menu_link table<br />";
 
     | 
  
  
    | 
      210
     | 
    
      db_add_field('redirect_type', 'mod_menu_link', "INT NOT NULL DEFAULT '302' AFTER `target_page_id`");
     | 
  
  
    | 
      211
     | 
    
      
 
     | 
  
  
    | 
      212
     | 
    
      
 
     | 
  
  
    | 
      213
     | 
    
      /**********************************************************
 
     | 
  
  
    | 
      214
     | 
    
       *  - Update search no results database filed to create
 
     | 
  
  
    | 
      215
     | 
    
       *  valid XHTML if search is empty
 
     | 
  
  
    | 
      216
     | 
    
       */
 
     | 
  
  
    | 
      217
     | 
    
      echo "<br />Updating database field `no_results` of search table: ";
 
     | 
  
  
    | 
      218
     | 
    
      $search_no_results = addslashes('<tr><td><p>[TEXT_NO_RESULTS]</p></td></tr>');
     | 
  
  
    | 
      219
     | 
    
      $sql = "UPDATE `" . TABLE_PREFIX . "search` SET `value` = '$search_no_results' WHERE `name`= 'no_results'";
 
     | 
  
  
    | 
      220
     | 
    
      $database->query($sql);
 
     | 
  
  
    | 
      221
     | 
    
      echo ($database->query($sql)) ? " $OK<br />" : " $FAIL<br />";
 
     | 
  
  
    | 
      222
     | 
    
      
 
     | 
  
  
    | 
      223
     | 
    
      
 
     | 
  
  
    | 
      224
     | 
    
      /**********************************************************
 
     | 
  
  
    | 
      225
     | 
    
       *  - Set Version to WB 2.8 BETA
 
     | 
  
  
    | 
      226
     | 
    
       */
 
     | 
  
  
    | 
      227
     | 
    
      echo "<br />Update database version number to 2.8 BETA : ";
 
     | 
  
  
    | 
      228
     | 
    
      $version = '2.8 BETA';
 
     | 
  
  
    | 
      229
     | 
    
      echo ($database->query("UPDATE `".TABLE_PREFIX."settings` SET `value` = '$version' WHERE `name` = 'wb_version'")) ? " $OK<br />" : " $FAIL<br />";
     | 
  
  
    | 
      230
     | 
    
      
 
     | 
  
  
    | 
      231
     | 
    
      
 
     | 
  
  
    | 
      232
     | 
    
      /**********************************************************
 
     | 
  
  
    | 
      233
     | 
    
       *  - install droplets
 
     | 
  
  
    | 
      234
     | 
    
       */
 
     | 
  
  
    | 
      235
     | 
    
      echo "<br />Install droplets<br />";
 
     | 
  
  
    | 
      236
     | 
    
      
 
     | 
  
  
    | 
      237
     | 
    
      $result = mysql_list_tables( DB_NAME );
 
     | 
  
  
    | 
      238
     | 
    
      $all_tables = array();
 
     | 
  
  
    | 
      239
     | 
    
      for($i=0; $i < mysql_num_rows($result); $i++) $all_tables[] = mysql_table_name($result, $i);
 
     | 
  
  
    | 
      240
     | 
    
      
 
     | 
  
  
    | 
      241
     | 
    
       $file_name = (!in_array ( TABLE_PREFIX."mod_droplets", $all_tables)) ? "install.php" : "upgrade.php";
 
     | 
  
  
    | 
      242
     | 
    
       require_once (WB_PATH."/modules/droplets/".$file_name);
 
     | 
  
  
    | 
      243
     | 
    
      
 
     | 
  
  
    | 
      244
     | 
    
      /**********************************************************
 
     | 
  
  
    | 
      245
     | 
    
       *  - Reload all addons
 
     | 
  
  
    | 
      246
     | 
    
       */
 
     | 
  
  
    | 
      247
     | 
    
      
 
     | 
  
  
    | 
      248
     | 
    
      //delete modules
 
     | 
  
  
    | 
      249
     | 
    
      $database->query("DELETE FROM ".TABLE_PREFIX."addons WHERE type = 'module'");
     | 
  
  
    | 
      250
     | 
    
      // Load all modules
 
     | 
  
  
    | 
      251
     | 
    
      if($handle = opendir(WB_PATH.'/modules/')) {
     | 
  
  
    | 
      252
     | 
    
      	while(false !== ($file = readdir($handle))) {
     | 
  
  
    | 
      253
     | 
    
      		if($file != '' AND substr($file, 0, 1) != '.' AND $file != 'admin.php' AND $file != 'index.php') {
     | 
  
  
    | 
      254
     | 
    
      			load_module(WB_PATH.'/modules/'.$file);
 
     | 
  
  
    | 
      255
     | 
    
      		}
 
     | 
  
  
    | 
      256
     | 
    
      	}
 
     | 
  
  
    | 
      257
     | 
    
      	closedir($handle);
 
     | 
  
  
    | 
      258
     | 
    
      }
 
     | 
  
  
    | 
      259
     | 
    
      echo '<br />Modules reloaded<br />';
 
     | 
  
  
    | 
      260
     | 
    
      
 
     | 
  
  
    | 
      261
     | 
    
      //delete templates		
 
     | 
  
  
    | 
      262
     | 
    
      $database->query("DELETE FROM ".TABLE_PREFIX."addons WHERE type = 'template'");
     | 
  
  
    | 
      263
     | 
    
      // Load all templates
 
     | 
  
  
    | 
      264
     | 
    
      if($handle = opendir(WB_PATH.'/templates/')) {
     | 
  
  
    | 
      265
     | 
    
      	while(false !== ($file = readdir($handle))) {
     | 
  
  
    | 
      266
     | 
    
      		if($file != '' AND substr($file, 0, 1) != '.' AND $file != 'index.php') {
     | 
  
  
    | 
      267
     | 
    
      			load_template(WB_PATH.'/templates/'.$file);
 
     | 
  
  
    | 
      268
     | 
    
      		}
 
     | 
  
  
    | 
      269
     | 
    
      	}
 
     | 
  
  
    | 
      270
     | 
    
      	closedir($handle);
 
     | 
  
  
    | 
      271
     | 
    
      }
 
     | 
  
  
    | 
      272
     | 
    
      echo '<br />Templates reloaded<br />';
 
     | 
  
  
    | 
      273
     | 
    
      
 
     | 
  
  
    | 
      274
     | 
    
      //delete languages
 
     | 
  
  
    | 
      275
     | 
    
      $database->query("DELETE FROM ".TABLE_PREFIX."addons WHERE type = 'language'");
     | 
  
  
    | 
      276
     | 
    
      // Load all languages
 
     | 
  
  
    | 
      277
     | 
    
      if($handle = opendir(WB_PATH.'/languages/')) {
     | 
  
  
    | 
      278
     | 
    
      	while(false !== ($file = readdir($handle))) {
     | 
  
  
    | 
      279
     | 
    
      		if($file != '' AND substr($file, 0, 1) != '.' AND $file != 'index.php') {
     | 
  
  
    | 
      280
     | 
    
      			load_language(WB_PATH.'/languages/'.$file);
 
     | 
  
  
    | 
      281
     | 
    
      		}
 
     | 
  
  
    | 
      282
     | 
    
      	}
 
     | 
  
  
    | 
      283
     | 
    
      	closedir($handle);
 
     | 
  
  
    | 
      284
     | 
    
      }
 
     | 
  
  
    | 
      285
     | 
    
      echo '<br />Languages reloaded<br />';
 
     | 
  
  
    | 
      286
     | 
    
      
 
     | 
  
  
    | 
      287
     | 
    
      
 
     | 
  
  
    | 
      288
     | 
    
      /**********************************************************
 
     | 
  
  
    | 
      289
     | 
    
       *  - End of upgrade script
 
     | 
  
  
    | 
      290
     | 
    
       */
 
     | 
  
  
    | 
      291
     | 
    
      echo '<p style="font-size:120%;"><strong>Congratulations: The upgrade script is finished ...</strong></p>';
 
     | 
  
  
    | 
      292
     | 
    
      status_msg('<strong>Warning:</strong><br />Please delete the file <strong>upgrade-script.php</strong> via FTP before proceeding.', 'warning', 'div');
     | 
  
  
    | 
      293
     | 
    
      // show buttons to go to the backend or frontend
 
     | 
  
  
    | 
      294
     | 
    
      echo '<br />';
 
     | 
  
  
    | 
      295
     | 
    
      if(defined('WB_URL')) {
     | 
  
  
    | 
      296
     | 
    
      	echo '<form action="'.WB_URL.'" target="_self">';
 
     | 
  
  
    | 
      297
     | 
    
      	echo '<input type="submit" value="kick me to the Frontend" style="float:left;" />';
 
     | 
  
  
    | 
      298
     | 
    
      	echo '</form>';
 
     | 
  
  
    | 
      299
     | 
    
      }
 
     | 
  
  
    | 
      300
     | 
    
      if(defined('ADMIN_URL')) {
     | 
  
  
    | 
      301
     | 
    
      	echo '<form action="'.ADMIN_URL.'" target="_self">';
 
     | 
  
  
    | 
      302
     | 
    
      	echo ' <input type="submit" value="kick me to the Backend" />';
 
     | 
  
  
    | 
      303
     | 
    
      	echo '</form>';
 
     | 
  
  
    | 
      304
     | 
    
      }
 
     | 
  
  
    | 
      305
     | 
    
      echo '<p> </p>';
 
     | 
  
  
    | 
      306
     | 
    
      
 
     | 
  
  
    | 
      307
     | 
    
      ?>
 
     | 
  
  
    | 
      308
     | 
    
      	
 
     | 
  
  
    | 
      309
     | 
    
      </div>
 
     | 
  
  
    | 
      310
     | 
    
      </body>
 
     | 
  
  
    | 
      311
     | 
    
      </html>
 
     |