| 
      1
     | 
    
      <?php
 
     | 
  
  
    | 
      2
     | 
    
      /**
 
     | 
  
  
    | 
      3
     | 
    
       *
 
     | 
  
  
    | 
      4
     | 
    
       * @category        backend
 
     | 
  
  
    | 
      5
     | 
    
       * @package         installation
 
     | 
  
  
    | 
      6
     | 
    
       * @author          WebsiteBaker Project
 
     | 
  
  
    | 
      7
     | 
    
       * @copyright       2004-2009, Ryan Djurovich
 
     | 
  
  
    | 
      8
     | 
    
       * @copyright       2009-2010, Website Baker Org. e.V.
 
     | 
  
  
    | 
      9
     | 
    
       * @link			http://www.websitebaker2.org/
 
     | 
  
  
    | 
      10
     | 
    
       * @license         http://www.gnu.org/licenses/gpl.html
 
     | 
  
  
    | 
      11
     | 
    
       * @platform        WebsiteBaker 2.8.x
 
     | 
  
  
    | 
      12
     | 
    
       * @requirements    PHP 4.3.4 and higher
 
     | 
  
  
    | 
      13
     | 
    
       * @version         $Id: upgrade-script.php 1289 2010-02-10 15:13:21Z kweitzel $
 
     | 
  
  
    | 
      14
     | 
    
       * @filesource		$HeadURL: svn://isteam.dynxs.de/wb-archiv/trunk/wb/upgrade-script.php $
 
     | 
  
  
    | 
      15
     | 
    
       * @lastmodified    $Date: 2010-02-10 16:13:21 +0100 (Wed, 10 Feb 2010) $
 
     | 
  
  
    | 
      16
     | 
    
       *
 
     | 
  
  
    | 
      17
     | 
    
       */
 
     | 
  
  
    | 
      18
     | 
    
      
 
     | 
  
  
    | 
      19
     | 
    
      @require_once('config.php');
     | 
  
  
    | 
      20
     | 
    
      
 
     | 
  
  
    | 
      21
     | 
    
      // this function checks the basic configurations of an existing WB intallation
 
     | 
  
  
    | 
      22
     | 
    
      function status_msg($message, $class='check', $element='span') {
     | 
  
  
    | 
      23
     | 
    
      	// returns a status message
 
     | 
  
  
    | 
      24
     | 
    
      	echo '<'.$element .' class="' .$class .'">' .$message .'</' .$element.'>';
 
     | 
  
  
    | 
      25
     | 
    
      }
 
     | 
  
  
    | 
      26
     | 
    
      
 
     | 
  
  
    | 
      27
     | 
    
      $version = '2.8.1';
 
     | 
  
  
    | 
      28
     | 
    
      // database tables including in WB package
 
     | 
  
  
    | 
      29
     | 
    
      $table_list = array (
 
     | 
  
  
    | 
      30
     | 
    
          'settings','groups','addons','pages','sections','search','users',
 
     | 
  
  
    | 
      31
     | 
    
          'mod_captcha_control','mod_code','mod_droplets','mod_form_fields',
 
     | 
  
  
    | 
      32
     | 
    
          'mod_form_settings','mod_form_submissions','mod_jsadmin','mod_menu_link',
 
     | 
  
  
    | 
      33
     | 
    
          'mod_news_comments','mod_news_groups','mod_news_posts','mod_news_settings',
 
     | 
  
  
    | 
      34
     | 
    
          'mod_output_filter','mod_wrapper','mod_wysiwyg'
 
     | 
  
  
    | 
      35
     | 
    
      );
 
     | 
  
  
    | 
      36
     | 
    
      
 
     | 
  
  
    | 
      37
     | 
    
      // analyze/check database tables
 
     | 
  
  
    | 
      38
     | 
    
      function mysqlCheckTables( $dbName )
 
     | 
  
  
    | 
      39
     | 
    
      {
     | 
  
  
    | 
      40
     | 
    
          global $table_list;
 
     | 
  
  
    | 
      41
     | 
    
          $table_prefix = TABLE_PREFIX;
 
     | 
  
  
    | 
      42
     | 
    
          $sql = "SHOW TABLES FROM " . $dbName;
 
     | 
  
  
    | 
      43
     | 
    
          $result = @mysql_query( $sql );
 
     | 
  
  
    | 
      44
     | 
    
          $data = array();
 
     | 
  
  
    | 
      45
     | 
    
          $x = 0;
 
     | 
  
  
    | 
      46
     | 
    
      
 
     | 
  
  
    | 
      47
     | 
    
          while( ( $row = @mysql_fetch_array( $result, MYSQL_NUM ) ) == true )
 
     | 
  
  
    | 
      48
     | 
    
          {
     | 
  
  
    | 
      49
     | 
    
              $tmp = str_replace($table_prefix, '', $row[0]);
 
     | 
  
  
    | 
      50
     | 
    
      
 
     | 
  
  
    | 
      51
     | 
    
              if( stristr( $row[0], $table_prefix )&& in_array($tmp,$table_list) )
 
     | 
  
  
    | 
      52
     | 
    
              {
     | 
  
  
    | 
      53
     | 
    
                  $sql = "CHECK TABLE " . $dbName . '.' . $row[0];
 
     | 
  
  
    | 
      54
     | 
    
                  $analyze = @mysql_query( $sql );
 
     | 
  
  
    | 
      55
     | 
    
                  $rowFetch = @mysql_fetch_array( $analyze, MYSQL_ASSOC );
 
     | 
  
  
    | 
      56
     | 
    
                  $data[$x]['Op'] = $rowFetch["Op"];
 
     | 
  
  
    | 
      57
     | 
    
                  $data[$x]['Msg_type'] = $rowFetch["Msg_type"];
 
     | 
  
  
    | 
      58
     | 
    
                  $msgColor = '<span class="error">';
 
     | 
  
  
    | 
      59
     | 
    
                  $data[$x]['Table'] = $row[0];
 
     | 
  
  
    | 
      60
     | 
    
                 // print  " ";
 
     | 
  
  
    | 
      61
     | 
    
                  $msgColor = ($rowFetch["Msg_text"] == 'OK') ? '<span class="ok">' : '<span class="error">';
 
     | 
  
  
    | 
      62
     | 
    
                  $data[$x]['Msg_text'] = $msgColor.$rowFetch["Msg_text"].'</span>';
 
     | 
  
  
    | 
      63
     | 
    
                 // print  "<br />";
 
     | 
  
  
    | 
      64
     | 
    
                  $x++;
 
     | 
  
  
    | 
      65
     | 
    
              }
 
     | 
  
  
    | 
      66
     | 
    
          }
 
     | 
  
  
    | 
      67
     | 
    
      
 
     | 
  
  
    | 
      68
     | 
    
      
 
     | 
  
  
    | 
      69
     | 
    
      
 
     | 
  
  
    | 
      70
     | 
    
      
 
     | 
  
  
    | 
      71
     | 
    
          return $data;
 
     | 
  
  
    | 
      72
     | 
    
      }
 
     | 
  
  
    | 
      73
     | 
    
      
 
     | 
  
  
    | 
      74
     | 
    
      
 
     | 
  
  
    | 
      75
     | 
    
      // check existings tables for upgrade or install
 
     | 
  
  
    | 
      76
     | 
    
      function check_wb_tables()
 
     | 
  
  
    | 
      77
     | 
    
      {
     | 
  
  
    | 
      78
     | 
    
          global $database,$table_list;
 
     | 
  
  
    | 
      79
     | 
    
              $get_result = $database->query( "SHOW TABLES FROM ".DB_NAME);
 
     | 
  
  
    | 
      80
     | 
    
              $all_tables = array();
 
     | 
  
  
    | 
      81
     | 
    
              if($get_result->numRows() > 0)
 
     | 
  
  
    | 
      82
     | 
    
              {
     | 
  
  
    | 
      83
     | 
    
                  while ($data = $get_result->fetchRow())
 
     | 
  
  
    | 
      84
     | 
    
                  {
     | 
  
  
    | 
      85
     | 
    
                      $tmp = str_replace(TABLE_PREFIX, '', $data[0]);
 
     | 
  
  
    | 
      86
     | 
    
                      if(in_array($tmp,$table_list))
 
     | 
  
  
    | 
      87
     | 
    
                      {
     | 
  
  
    | 
      88
     | 
    
                          $all_tables[] = $tmp;
 
     | 
  
  
    | 
      89
     | 
    
                      }
 
     | 
  
  
    | 
      90
     | 
    
                  }
 
     | 
  
  
    | 
      91
     | 
    
              }
 
     | 
  
  
    | 
      92
     | 
    
           return $all_tables;
 
     | 
  
  
    | 
      93
     | 
    
      }
 
     | 
  
  
    | 
      94
     | 
    
      
 
     | 
  
  
    | 
      95
     | 
    
      // check existing tables
 
     | 
  
  
    | 
      96
     | 
    
      $all_tables = check_wb_tables();
 
     | 
  
  
    | 
      97
     | 
    
      
 
     | 
  
  
    | 
      98
     | 
    
      // only for array tests
 
     | 
  
  
    | 
      99
     | 
    
      function show_array($array=array())
 
     | 
  
  
    | 
      100
     | 
    
      {
     | 
  
  
    | 
      101
     | 
    
          print '<pre>';
 
     | 
  
  
    | 
      102
     | 
    
          print_r ($array);
 
     | 
  
  
    | 
      103
     | 
    
          print '</pre>';
 
     | 
  
  
    | 
      104
     | 
    
      }
 
     | 
  
  
    | 
      105
     | 
    
      
 
     | 
  
  
    | 
      106
     | 
    
      ?>
 
     | 
  
  
    | 
      107
     | 
    
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
     | 
  
  
    | 
      108
     | 
    
      <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 
     | 
  
  
    | 
      109
     | 
    
      <head>
 
     | 
  
  
    | 
      110
     | 
    
      <title>Upgrade script</title>
 
     | 
  
  
    | 
      111
     | 
    
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 
     | 
  
  
    | 
      112
     | 
    
      <style type="text/css">
 
     | 
  
  
    | 
      113
     | 
    
      html { overflow: -moz-scrollbars-vertical; /* Force firefox to always show room for a vertical scrollbar */ }
     | 
  
  
    | 
      114
     | 
    
      
 
     | 
  
  
    | 
      115
     | 
    
      body {
     | 
  
  
    | 
      116
     | 
    
      	margin:0;
 
     | 
  
  
    | 
      117
     | 
    
      	padding:0;
 
     | 
  
  
    | 
      118
     | 
    
      	border:0;
 
     | 
  
  
    | 
      119
     | 
    
      	background: #EBF7FC;
 
     | 
  
  
    | 
      120
     | 
    
      	color:#000;
 
     | 
  
  
    | 
      121
     | 
    
      	font-family: 'Trebuchet MS', Verdana, Arial, Helvetica, Sans-Serif;
 
     | 
  
  
    | 
      122
     | 
    
      	font-size: small;
 
     | 
  
  
    | 
      123
     | 
    
      	height:101%;
 
     | 
  
  
    | 
      124
     | 
    
      }
 
     | 
  
  
    | 
      125
     | 
    
      
 
     | 
  
  
    | 
      126
     | 
    
      #container {
     | 
  
  
    | 
      127
     | 
    
      	width:85%;
 
     | 
  
  
    | 
      128
     | 
    
      	background: #A8BCCB url(templates/wb_theme/images/background.png) repeat-x;
 
     | 
  
  
    | 
      129
     | 
    
      	border:1px solid #000;
 
     | 
  
  
    | 
      130
     | 
    
      	color:#000;
 
     | 
  
  
    | 
      131
     | 
    
      	margin:2em auto;
 
     | 
  
  
    | 
      132
     | 
    
      	padding:0 15px;
 
     | 
  
  
    | 
      133
     | 
    
      	min-height: 500px;
 
     | 
  
  
    | 
      134
     | 
    
      	text-align:left;
 
     | 
  
  
    | 
      135
     | 
    
      }
 
     | 
  
  
    | 
      136
     | 
    
      
 
     | 
  
  
    | 
      137
     | 
    
      p { line-height:1.5em; }
     | 
  
  
    | 
      138
     | 
    
      
 
     | 
  
  
    | 
      139
     | 
    
      h1,h2,h3,h4,h5,h6 {
     | 
  
  
    | 
      140
     | 
    
      	font-family: Verdana, Arial, Helvetica, sans-serif;
 
     | 
  
  
    | 
      141
     | 
    
      	color: #369;
 
     | 
  
  
    | 
      142
     | 
    
      	margin-top: 1.0em;
 
     | 
  
  
    | 
      143
     | 
    
      	margin-bottom: 0.1em;
 
     | 
  
  
    | 
      144
     | 
    
      }
 
     | 
  
  
    | 
      145
     | 
    
      
 
     | 
  
  
    | 
      146
     | 
    
      h1 { font-size:150%; }
     | 
  
  
    | 
      147
     | 
    
      h2 { font-size: 130%; border-bottom: 1px #CCC solid; }
     | 
  
  
    | 
      148
     | 
    
      h3 { font-size: 120%; }
     | 
  
  
    | 
      149
     | 
    
      
 
     | 
  
  
    | 
      150
     | 
    
      .ok, .error { font-weight:bold; }
     | 
  
  
    | 
      151
     | 
    
      .ok { color:green; }
     | 
  
  
    | 
      152
     | 
    
      .error { color:red; }
     | 
  
  
    | 
      153
     | 
    
      .check { color:#555; }
     | 
  
  
    | 
      154
     | 
    
      
 
     | 
  
  
    | 
      155
     | 
    
      .warning {
     | 
  
  
    | 
      156
     | 
    
      	width: 98%;
 
     | 
  
  
    | 
      157
     | 
    
      	background:#FFDBDB;
 
     | 
  
  
    | 
      158
     | 
    
      	padding:0.2em;
 
     | 
  
  
    | 
      159
     | 
    
      	margin-top:0.5em;
 
     | 
  
  
    | 
      160
     | 
    
      	border: 1px solid black;
 
     | 
  
  
    | 
      161
     | 
    
      }
 
     | 
  
  
    | 
      162
     | 
    
      .info {
     | 
  
  
    | 
      163
     | 
    
      	width: 98%;
 
     | 
  
  
    | 
      164
     | 
    
      	background:#99CC99;
 
     | 
  
  
    | 
      165
     | 
    
      	padding:0.2em;
 
     | 
  
  
    | 
      166
     | 
    
      	margin-top:0.5em;
 
     | 
  
  
    | 
      167
     | 
    
      	border: 1px solid black;
 
     | 
  
  
    | 
      168
     | 
    
      }
 
     | 
  
  
    | 
      169
     | 
    
      
 
     | 
  
  
    | 
      170
     | 
    
      </style>
 
     | 
  
  
    | 
      171
     | 
    
      </head>
 
     | 
  
  
    | 
      172
     | 
    
      <body>
 
     | 
  
  
    | 
      173
     | 
    
      <div id="container">
 
     | 
  
  
    | 
      174
     | 
    
      <img src="templates/wb_theme/images/logo.png" alt="WebsiteBaker Project" />
 
     | 
  
  
    | 
      175
     | 
    
      
 
     | 
  
  
    | 
      176
     | 
    
      <h1>WebsiteBaker Upgrade</h1>
 
     | 
  
  
    | 
      177
     | 
    
      <p>This script upgrades an existing WebsiteBaker <strong>Version 2.7 and higher</strong> installation to the <strong>Version <?php echo $version ?></strong>. The upgrade script alters the existing WB database to reflect the changes introduced with WB 2.8.x</p>
 
     | 
  
  
    | 
      178
     | 
    
      
 
     | 
  
  
    | 
      179
     | 
    
      <?php
 
     | 
  
  
    | 
      180
     | 
    
      /**
 
     | 
  
  
    | 
      181
     | 
    
       * Check if disclaimer was accepted
 
     | 
  
  
    | 
      182
     | 
    
       */
 
     | 
  
  
    | 
      183
     | 
    
      if (!(isset($_POST['backup_confirmed']) && $_POST['backup_confirmed'] == 'confirmed')) { ?>
     | 
  
  
    | 
      184
     | 
    
      <h2>Step 1: Backup your files</h2>
 
     | 
  
  
    | 
      185
     | 
    
      <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>
 
     | 
  
  
    | 
      186
     | 
    
      
 
     | 
  
  
    | 
      187
     | 
    
      <form name="send" action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">
 
     | 
  
  
    | 
      188
     | 
    
      <textarea cols="80" rows="5">DISCLAIMER: The WebsiteBaker 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 WebsiteBaker MySQL database was created before you can proceed.</textarea>
 
     | 
  
  
    | 
      189
     | 
    
      <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.
 
     | 
  
  
    | 
      190
     | 
    
      <br /><br /><input name="send" type="submit" value="Start upgrade script" />
 
     | 
  
  
    | 
      191
     | 
    
      </form>
 
     | 
  
  
    | 
      192
     | 
    
      <br />
 
     | 
  
  
    | 
      193
     | 
    
      
 
     | 
  
  
    | 
      194
     | 
    
      <?php
 
     | 
  
  
    | 
      195
     | 
    
      	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');
     | 
  
  
    | 
      196
     | 
    
      	echo '<br /><br />';
 
     | 
  
  
    | 
      197
     | 
    
          echo "</div>
 
     | 
  
  
    | 
      198
     | 
    
          </body>
 
     | 
  
  
    | 
      199
     | 
    
          </html>
 
     | 
  
  
    | 
      200
     | 
    
          ";
 
     | 
  
  
    | 
      201
     | 
    
      	exit();
 
     | 
  
  
    | 
      202
     | 
    
      }
 
     | 
  
  
    | 
      203
     | 
    
      
 
     | 
  
  
    | 
      204
     | 
    
      echo '<h2>Step 2: Updating database entries</h2>';
 
     | 
  
  
    | 
      205
     | 
    
      
 
     | 
  
  
    | 
      206
     | 
    
      require_once(WB_PATH.'/framework/functions.php');
 
     | 
  
  
    | 
      207
     | 
    
      require_once(WB_PATH.'/framework/class.admin.php');
 
     | 
  
  
    | 
      208
     | 
    
      $admin = new admin('Addons', 'modules', false, false);
     | 
  
  
    | 
      209
     | 
    
      
 
     | 
  
  
    | 
      210
     | 
    
      $OK   = '<span class="ok">OK</span>';
 
     | 
  
  
    | 
      211
     | 
    
      $FAIL = '<span class="error">FAILED</span>';
 
     | 
  
  
    | 
      212
     | 
    
      
 
     | 
  
  
    | 
      213
     | 
    
      // function to add a var/value-pair into settings-table
 
     | 
  
  
    | 
      214
     | 
    
      function db_add_key_value($key, $value) {
     | 
  
  
    | 
      215
     | 
    
      	global $database; global $OK; global $FAIL;
 
     | 
  
  
    | 
      216
     | 
    
      	$table = TABLE_PREFIX.'settings';
 
     | 
  
  
    | 
      217
     | 
    
      	$query = $database->query("SELECT value FROM $table WHERE name = '$key' LIMIT 1");
     | 
  
  
    | 
      218
     | 
    
      	if($query->numRows() > 0) {
     | 
  
  
    | 
      219
     | 
    
      		echo "$key: already exists. $OK.<br />";
 
     | 
  
  
    | 
      220
     | 
    
      		return true;
 
     | 
  
  
    | 
      221
     | 
    
      	} else {
     | 
  
  
    | 
      222
     | 
    
      		$database->query("INSERT INTO $table (name,value) VALUES ('$key', '$value')");
     | 
  
  
    | 
      223
     | 
    
      		echo (mysql_error()?mysql_error().'<br />':'');
 
     | 
  
  
    | 
      224
     | 
    
      		$query = $database->query("SELECT value FROM $table WHERE name = '$key' LIMIT 1");
     | 
  
  
    | 
      225
     | 
    
      		if($query->numRows() > 0) {
     | 
  
  
    | 
      226
     | 
    
      			echo "$key: $OK.<br />";
 
     | 
  
  
    | 
      227
     | 
    
      			return true;
 
     | 
  
  
    | 
      228
     | 
    
      		} else {
     | 
  
  
    | 
      229
     | 
    
      			echo "$key: $FAIL!<br />";
 
     | 
  
  
    | 
      230
     | 
    
      			return false;
 
     | 
  
  
    | 
      231
     | 
    
      		}
 
     | 
  
  
    | 
      232
     | 
    
      	}
 
     | 
  
  
    | 
      233
     | 
    
      }
 
     | 
  
  
    | 
      234
     | 
    
      
 
     | 
  
  
    | 
      235
     | 
    
      // function to add a new field into a table
 
     | 
  
  
    | 
      236
     | 
    
      function db_add_field($field, $table, $desc) {
     | 
  
  
    | 
      237
     | 
    
      	global $database; global $OK; global $FAIL;
 
     | 
  
  
    | 
      238
     | 
    
      	$table = TABLE_PREFIX.$table;
 
     | 
  
  
    | 
      239
     | 
    
      	$query = $database->query("DESCRIBE $table '$field'");
     | 
  
  
    | 
      240
     | 
    
      	if($query->numRows() == 0) { // add field
     | 
  
  
    | 
      241
     | 
    
      		$query = $database->query("ALTER TABLE $table ADD $field $desc");
     | 
  
  
    | 
      242
     | 
    
      		echo (mysql_error()?mysql_error().'<br />':'');
 
     | 
  
  
    | 
      243
     | 
    
      		$query = $database->query("DESCRIBE $table '$field'");
     | 
  
  
    | 
      244
     | 
    
      		echo (mysql_error()?mysql_error().'<br />':'');
 
     | 
  
  
    | 
      245
     | 
    
      		if($query->numRows() > 0) {
     | 
  
  
    | 
      246
     | 
    
      			echo "'$field' added. $OK.<br />";
 
     | 
  
  
    | 
      247
     | 
    
      		} else {
     | 
  
  
    | 
      248
     | 
    
      			echo "adding '$field' $FAIL!<br />";
 
     | 
  
  
    | 
      249
     | 
    
      		}
 
     | 
  
  
    | 
      250
     | 
    
      	} else {
     | 
  
  
    | 
      251
     | 
    
      		echo "'$field' already exists. $OK.<br />";
 
     | 
  
  
    | 
      252
     | 
    
      	}
 
     | 
  
  
    | 
      253
     | 
    
      }
 
     | 
  
  
    | 
      254
     | 
    
      
 
     | 
  
  
    | 
      255
     | 
    
      /**********************************************************
 
     | 
  
  
    | 
      256
     | 
    
       *  - Adding field default_theme to settings table
 
     | 
  
  
    | 
      257
     | 
    
       */
 
     | 
  
  
    | 
      258
     | 
    
      echo "<br />Adding default_theme to settings table<br />";
 
     | 
  
  
    | 
      259
     | 
    
      $cfg = array(
 
     | 
  
  
    | 
      260
     | 
    
      	'default_theme' => 'wb_theme'
 
     | 
  
  
    | 
      261
     | 
    
      );
 
     | 
  
  
    | 
      262
     | 
    
      
 
     | 
  
  
    | 
      263
     | 
    
      foreach($cfg as $key=>$value) {
     | 
  
  
    | 
      264
     | 
    
      	db_add_key_value($key, $value);
 
     | 
  
  
    | 
      265
     | 
    
      }
 
     | 
  
  
    | 
      266
     | 
    
      
 
     | 
  
  
    | 
      267
     | 
    
      /**********************************************************
 
     | 
  
  
    | 
      268
     | 
    
       *  - install droplets
 
     | 
  
  
    | 
      269
     | 
    
       */
 
     | 
  
  
    | 
      270
     | 
    
          $drops = (!in_array ( "mod_droplets", $all_tables)) ? "<br />Install droplets<br />" : "<br />Upgrade droplets<br />";
 
     | 
  
  
    | 
      271
     | 
    
          echo $drops;
 
     | 
  
  
    | 
      272
     | 
    
      
 
     | 
  
  
    | 
      273
     | 
    
           $file_name = (!in_array ( "mod_droplets", $all_tables)) ? "install.php" : "upgrade.php";
 
     | 
  
  
    | 
      274
     | 
    
           require_once (WB_PATH."/modules/droplets/".$file_name);
 
     | 
  
  
    | 
      275
     | 
    
      
 
     | 
  
  
    | 
      276
     | 
    
      // check again all tables, to get a new array
 
     | 
  
  
    | 
      277
     | 
    
       if(sizeof($all_tables) < 22) { $all_tables = check_wb_tables(); }
     | 
  
  
    | 
      278
     | 
    
      /**********************************************************
 
     | 
  
  
    | 
      279
     | 
    
       *  - check tables comin with WebsiteBaker
 
     | 
  
  
    | 
      280
     | 
    
       */
 
     | 
  
  
    | 
      281
     | 
    
          $check_text = 'total ';
 
     | 
  
  
    | 
      282
     | 
    
          // $check_tables = mysqlCheckTables( DB_NAME ) ;
 
     | 
  
  
    | 
      283
     | 
    
      
 
     | 
  
  
    | 
      284
     | 
    
          if(sizeof($all_tables) == 22)
 
     | 
  
  
    | 
      285
     | 
    
          {
     | 
  
  
    | 
      286
     | 
    
              echo '<h4>NOTICE: Your database '.DB_NAME.' has '.sizeof($all_tables).' '.$check_text.' tables from '.sizeof($table_list).' included in package '.$OK.'</h4>';
 
     | 
  
  
    | 
      287
     | 
    
          }
 
     | 
  
  
    | 
      288
     | 
    
          else
 
     | 
  
  
    | 
      289
     | 
    
          {
     | 
  
  
    | 
      290
     | 
    
              status_msg('<strong>WARNING:</strong><br />can\'t run Upgrade, missing tables', 'warning', 'div');
     | 
  
  
    | 
      291
     | 
    
          	echo '<h4>Install missing tables, you can install them in backend->addons->modules->advanced. Then again run upgrade-script.php</h4>';
 
     | 
  
  
    | 
      292
     | 
    
              $result = array_diff ( $table_list, $all_tables );
 
     | 
  
  
    | 
      293
     | 
    
              echo '<h4 class="warning">';
 
     | 
  
  
    | 
      294
     | 
    
              while ( list ( $key, $val ) = each ( $result ) )
 
     | 
  
  
    | 
      295
     | 
    
              {
     | 
  
  
    | 
      296
     | 
    
                  echo TABLE_PREFIX.$val.' '.$FAIL.'<br>';
 
     | 
  
  
    | 
      297
     | 
    
              }
 
     | 
  
  
    | 
      298
     | 
    
              echo '</h4>';
 
     | 
  
  
    | 
      299
     | 
    
          	echo '<br /><form action="'. $_SERVER['PHP_SELF'] .'">';
 
     | 
  
  
    | 
      300
     | 
    
          	echo '<input type="submit" value="kick me back" style="float:left;" />';
 
     | 
  
  
    | 
      301
     | 
    
          	echo '</form>';
 
     | 
  
  
    | 
      302
     | 
    
              if(defined('ADMIN_URL'))
     | 
  
  
    | 
      303
     | 
    
              {
     | 
  
  
    | 
      304
     | 
    
              	echo '<form action="'.ADMIN_URL.'" target="_self">';
 
     | 
  
  
    | 
      305
     | 
    
              	echo ' <input type="submit" value="kick me to the Backend" />';
 
     | 
  
  
    | 
      306
     | 
    
              	echo '</form>';
 
     | 
  
  
    | 
      307
     | 
    
              }
 
     | 
  
  
    | 
      308
     | 
    
              echo "<br /><br /></div>
 
     | 
  
  
    | 
      309
     | 
    
              </body>
 
     | 
  
  
    | 
      310
     | 
    
              </html>
 
     | 
  
  
    | 
      311
     | 
    
              ";
 
     | 
  
  
    | 
      312
     | 
    
              exit();
 
     | 
  
  
    | 
      313
     | 
    
          }
 
     | 
  
  
    | 
      314
     | 
    
      
 
     | 
  
  
    | 
      315
     | 
    
      /**********************************************************
 
     | 
  
  
    | 
      316
     | 
    
       *  - Adding field sec_anchor to settings table
 
     | 
  
  
    | 
      317
     | 
    
       */
 
     | 
  
  
    | 
      318
     | 
    
      
 
     | 
  
  
    | 
      319
     | 
    
      echo "<br />Adding sec_anchor to settings table<br />";
 
     | 
  
  
    | 
      320
     | 
    
      $cfg = array(
 
     | 
  
  
    | 
      321
     | 
    
      	'sec_anchor' => 'wb_'
 
     | 
  
  
    | 
      322
     | 
    
      );
 
     | 
  
  
    | 
      323
     | 
    
      foreach($cfg as $key=>$value) {
     | 
  
  
    | 
      324
     | 
    
      	db_add_key_value($key, $value);
 
     | 
  
  
    | 
      325
     | 
    
      }
 
     | 
  
  
    | 
      326
     | 
    
      
 
     | 
  
  
    | 
      327
     | 
    
      /**********************************************************
 
     | 
  
  
    | 
      328
     | 
    
       *  - Adding redirect timer to settings table
 
     | 
  
  
    | 
      329
     | 
    
       */
 
     | 
  
  
    | 
      330
     | 
    
      echo "<br />Adding redirect timer to settings table<br />";
 
     | 
  
  
    | 
      331
     | 
    
      $cfg = array(
 
     | 
  
  
    | 
      332
     | 
    
      	'redirect_timer' => '1500'
 
     | 
  
  
    | 
      333
     | 
    
      );
 
     | 
  
  
    | 
      334
     | 
    
      foreach($cfg as $key=>$value) {
     | 
  
  
    | 
      335
     | 
    
      	db_add_key_value($key, $value);
 
     | 
  
  
    | 
      336
     | 
    
      }
 
     | 
  
  
    | 
      337
     | 
    
      
 
     | 
  
  
    | 
      338
     | 
    
      /**********************************************************
 
     | 
  
  
    | 
      339
     | 
    
       *  - Adding mediasettings to settings table
 
     | 
  
  
    | 
      340
     | 
    
       */
 
     | 
  
  
    | 
      341
     | 
    
      echo "<br />Adding mediasettings to settings table<br />";
 
     | 
  
  
    | 
      342
     | 
    
      $cfg = array(
 
     | 
  
  
    | 
      343
     | 
    
      	'mediasettings' => ''
 
     | 
  
  
    | 
      344
     | 
    
      );
 
     | 
  
  
    | 
      345
     | 
    
      foreach($cfg as $key=>$value) {
     | 
  
  
    | 
      346
     | 
    
      	db_add_key_value($key, $value);
 
     | 
  
  
    | 
      347
     | 
    
      }
 
     | 
  
  
    | 
      348
     | 
    
      
 
     | 
  
  
    | 
      349
     | 
    
      /**********************************************************
 
     | 
  
  
    | 
      350
     | 
    
       *  - Add field "redirect_type" to table "mod_menu_link"
 
     | 
  
  
    | 
      351
     | 
    
       */
 
     | 
  
  
    | 
      352
     | 
    
      echo "<br />Adding field redirect_type to mod_menu_link table<br />";
 
     | 
  
  
    | 
      353
     | 
    
      db_add_field('redirect_type', 'mod_menu_link', "INT NOT NULL DEFAULT '302' AFTER `target_page_id`");
     | 
  
  
    | 
      354
     | 
    
      
 
     | 
  
  
    | 
      355
     | 
    
      
 
     | 
  
  
    | 
      356
     | 
    
      
 
     | 
  
  
    | 
      357
     | 
    
      if (version_compare(WB_VERSION, '2.8.0') < 0)
 
     | 
  
  
    | 
      358
     | 
    
      {
     | 
  
  
    | 
      359
     | 
    
          /**********************************************************
 
     | 
  
  
    | 
      360
     | 
    
           *  - Update search no results database filed to create
 
     | 
  
  
    | 
      361
     | 
    
           *  valid XHTML if search is empty
 
     | 
  
  
    | 
      362
     | 
    
           */
 
     | 
  
  
    | 
      363
     | 
    
          echo "<br />Updating database field `no_results` of search table: ";
 
     | 
  
  
    | 
      364
     | 
    
          $search_no_results = addslashes('<tr><td><p>[TEXT_NO_RESULTS]</p></td></tr>');
     | 
  
  
    | 
      365
     | 
    
          $sql = "UPDATE `" . TABLE_PREFIX . "search` SET `value` = '$search_no_results' WHERE `name`= 'no_results'";
 
     | 
  
  
    | 
      366
     | 
    
          $database->query($sql);
 
     | 
  
  
    | 
      367
     | 
    
          echo ($database->query($sql)) ? " $OK<br />" : " $FAIL<br />";
 
     | 
  
  
    | 
      368
     | 
    
          /**********************************************************
 
     | 
  
  
    | 
      369
     | 
    
           *  - Update settings of News Modul
 
     | 
  
  
    | 
      370
     | 
    
           */
 
     | 
  
  
    | 
      371
     | 
    
      
 
     | 
  
  
    | 
      372
     | 
    
          // These are the default setting
 
     | 
  
  
    | 
      373
     | 
    
          $header = '<table cellpadding=\"0\" cellspacing=\"0\" class=\"loop-header\">'."\n";
 
     | 
  
  
    | 
      374
     | 
    
          $post_loop = '<tr class=\"post_top\">
 
     | 
  
  
    | 
      375
     | 
    
      <td class=\"post_title\"><a href=\"[LINK]\">[TITLE]</a></td>
 
     | 
  
  
    | 
      376
     | 
    
      <td class=\"post_date\">[PUBLISHED_TIME], [PUBLISHED_DATE]</td>
 
     | 
  
  
    | 
      377
     | 
    
      </tr>
 
     | 
  
  
    | 
      378
     | 
    
      <tr>
 
     | 
  
  
    | 
      379
     | 
    
      <td class=\"post_short\" colspan=\"2\">
 
     | 
  
  
    | 
      380
     | 
    
      [SHORT]
 
     | 
  
  
    | 
      381
     | 
    
      <span style=\"visibility:[SHOW_READ_MORE];\"><a href=\"[LINK]\">[TEXT_READ_MORE]</a></span>
 
     | 
  
  
    | 
      382
     | 
    
      </td>
 
     | 
  
  
    | 
      383
     | 
    
      </tr>';
 
     | 
  
  
    | 
      384
     | 
    
          $footer = '</table>
 
     | 
  
  
    | 
      385
     | 
    
      <table cellpadding="0" cellspacing="0" class="page-header" style="display: [DISPLAY_PREVIOUS_NEXT_LINKS]">
 
     | 
  
  
    | 
      386
     | 
    
      <tr>
 
     | 
  
  
    | 
      387
     | 
    
      <td class="page-left">[PREVIOUS_PAGE_LINK]</td>
 
     | 
  
  
    | 
      388
     | 
    
      <td class="page-center">[OF]</td>
 
     | 
  
  
    | 
      389
     | 
    
      <td class="page-right">[NEXT_PAGE_LINK]</td>
 
     | 
  
  
    | 
      390
     | 
    
      </tr>
 
     | 
  
  
    | 
      391
     | 
    
      </table>';
 
     | 
  
  
    | 
      392
     | 
    
          $post_header = addslashes('<table cellpadding="0" cellspacing="0" class="post-header">
     | 
  
  
    | 
      393
     | 
    
      <tr>
 
     | 
  
  
    | 
      394
     | 
    
      <td><h1>[TITLE]</h1></td>
 
     | 
  
  
    | 
      395
     | 
    
      <td rowspan="3" style="display: [DISPLAY_IMAGE]">[GROUP_IMAGE]</td>
 
     | 
  
  
    | 
      396
     | 
    
      </tr>
 
     | 
  
  
    | 
      397
     | 
    
      <tr>
 
     | 
  
  
    | 
      398
     | 
    
      <td class="public-info"><b>[TEXT_POSTED_BY] [DISPLAY_NAME] ([USERNAME]) [TEXT_ON] [PUBLISHED_DATE]</b></td>
 
     | 
  
  
    | 
      399
     | 
    
      </tr>
 
     | 
  
  
    | 
      400
     | 
    
      <tr style="display: [DISPLAY_GROUP]">
 
     | 
  
  
    | 
      401
     | 
    
      <td class="group-page"><a href="[BACK]">[PAGE_TITLE]</a> >> <a href="[BACK]?g=[GROUP_ID]">[GROUP_TITLE]</a></td>
 
     | 
  
  
    | 
      402
     | 
    
      </tr>
 
     | 
  
  
    | 
      403
     | 
    
      </table>');
 
     | 
  
  
    | 
      404
     | 
    
          $post_footer = '<p>[TEXT_LAST_CHANGED]: [MODI_DATE] [TEXT_AT] [MODI_TIME]</p>
 
     | 
  
  
    | 
      405
     | 
    
      <a href=\"[BACK]\">[TEXT_BACK]</a>';
 
     | 
  
  
    | 
      406
     | 
    
          $comments_header = addslashes('<br /><br />
     | 
  
  
    | 
      407
     | 
    
      <h2>[TEXT_COMMENTS]</h2>
 
     | 
  
  
    | 
      408
     | 
    
      <table cellpadding="2" cellspacing="0" class="comment-header">');
 
     | 
  
  
    | 
      409
     | 
    
          $comments_loop = addslashes('<tr>
     | 
  
  
    | 
      410
     | 
    
      <td class="comment_title">[TITLE]</td>
 
     | 
  
  
    | 
      411
     | 
    
      <td class="comment_info">[TEXT_BY] [DISPLAY_NAME] [TEXT_ON] [DATE] [TEXT_AT] [TIME]</td>
 
     | 
  
  
    | 
      412
     | 
    
      </tr>
 
     | 
  
  
    | 
      413
     | 
    
      <tr>
 
     | 
  
  
    | 
      414
     | 
    
      <td colspan="2" class="comment_text">[COMMENT]</td>
 
     | 
  
  
    | 
      415
     | 
    
      </tr>');
 
     | 
  
  
    | 
      416
     | 
    
          $comments_footer = '</table>
 
     | 
  
  
    | 
      417
     | 
    
      <br /><a href=\"[ADD_COMMENT_URL]\">[TEXT_ADD_COMMENT]</a>';
 
     | 
  
  
    | 
      418
     | 
    
          $comments_page = '<h1>[TEXT_COMMENT]</h1>
 
     | 
  
  
    | 
      419
     | 
    
      <h2>[POST_TITLE]</h2>
 
     | 
  
  
    | 
      420
     | 
    
      <br />';
 
     | 
  
  
    | 
      421
     | 
    
      
 
     | 
  
  
    | 
      422
     | 
    
      if(in_array('mod_news_settings', $all_tables))
     | 
  
  
    | 
      423
     | 
    
      {
     | 
  
  
    | 
      424
     | 
    
         // Insert default settings into database
 
     | 
  
  
    | 
      425
     | 
    
         $query_dates = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_settings where section_id != 0 and page_id != 0");
     | 
  
  
    | 
      426
     | 
    
         if($query_dates->numRows() > 1)
 
     | 
  
  
    | 
      427
     | 
    
         {
     | 
  
  
    | 
      428
     | 
    
              while($result = $query_dates->fetchRow())
 
     | 
  
  
    | 
      429
     | 
    
              {
     | 
  
  
    | 
      430
     | 
    
      
 
     | 
  
  
    | 
      431
     | 
    
              	echo "<br /><u>Add default settings to database for news section_id= ".$result['section_id']."</u><br />";
 
     | 
  
  
    | 
      432
     | 
    
              	$section_id = $result['section_id'];
 
     | 
  
  
    | 
      433
     | 
    
      
 
     | 
  
  
    | 
      434
     | 
    
              	if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `header` = '$header' WHERE `section_id` = $section_id")) {
     | 
  
  
    | 
      435
     | 
    
              		echo 'Database data header added successfully';
 
     | 
  
  
    | 
      436
     | 
    
              	}
 
     | 
  
  
    | 
      437
     | 
    
              	echo mysql_error().'<br />';
 
     | 
  
  
    | 
      438
     | 
    
      
 
     | 
  
  
    | 
      439
     | 
    
              	if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `post_loop` = '$post_loop' WHERE `section_id` = $section_id")) {
     | 
  
  
    | 
      440
     | 
    
              		echo 'Database data post_loop added successfully';
 
     | 
  
  
    | 
      441
     | 
    
              	}
 
     | 
  
  
    | 
      442
     | 
    
              	echo mysql_error().'<br />';
 
     | 
  
  
    | 
      443
     | 
    
      
 
     | 
  
  
    | 
      444
     | 
    
              	if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `footer` = '$footer' WHERE `section_id` = $section_id")) {
     | 
  
  
    | 
      445
     | 
    
              		echo 'Database data footer added successfully';
 
     | 
  
  
    | 
      446
     | 
    
              	}
 
     | 
  
  
    | 
      447
     | 
    
              	echo mysql_error().'<br />';
 
     | 
  
  
    | 
      448
     | 
    
      
 
     | 
  
  
    | 
      449
     | 
    
              	if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `post_header` = '$post_header' WHERE `section_id` = $section_id")) {
     | 
  
  
    | 
      450
     | 
    
              		echo 'Database data post_header added successfully';
 
     | 
  
  
    | 
      451
     | 
    
              	}
 
     | 
  
  
    | 
      452
     | 
    
              	echo mysql_error().'<br />';
 
     | 
  
  
    | 
      453
     | 
    
      
 
     | 
  
  
    | 
      454
     | 
    
              	if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `post_footer` = '$post_footer' WHERE `section_id` = $section_id")) {
     | 
  
  
    | 
      455
     | 
    
              		echo 'Database data post_footer added successfully';
 
     | 
  
  
    | 
      456
     | 
    
              	}
 
     | 
  
  
    | 
      457
     | 
    
              	echo mysql_error().'<br />';
 
     | 
  
  
    | 
      458
     | 
    
      
 
     | 
  
  
    | 
      459
     | 
    
              	if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `comments_header` = '$comments_header' WHERE `section_id` = $section_id")) {
     | 
  
  
    | 
      460
     | 
    
              		echo 'Database data comments_header added successfully';
 
     | 
  
  
    | 
      461
     | 
    
              	}
 
     | 
  
  
    | 
      462
     | 
    
              	echo mysql_error().'<br />';
 
     | 
  
  
    | 
      463
     | 
    
      
 
     | 
  
  
    | 
      464
     | 
    
              	if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `comments_loop` = '$comments_loop' WHERE `section_id` = $section_id")) {
     | 
  
  
    | 
      465
     | 
    
              		echo 'Database data comments_loop added successfully';
 
     | 
  
  
    | 
      466
     | 
    
              	}
 
     | 
  
  
    | 
      467
     | 
    
              	echo mysql_error().'<br />';
 
     | 
  
  
    | 
      468
     | 
    
      
 
     | 
  
  
    | 
      469
     | 
    
              	if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `comments_footer` = '$comments_footer' WHERE `section_id` = $section_id")) {
     | 
  
  
    | 
      470
     | 
    
              		echo 'Database data comments_footer added successfully';
 
     | 
  
  
    | 
      471
     | 
    
              	}
 
     | 
  
  
    | 
      472
     | 
    
              	echo mysql_error().'<br />';
 
     | 
  
  
    | 
      473
     | 
    
      
 
     | 
  
  
    | 
      474
     | 
    
              	if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `comments_page` = '$comments_page' WHERE `section_id` = $section_id")) {
     | 
  
  
    | 
      475
     | 
    
              		echo 'Database data comments_page added successfully';
 
     | 
  
  
    | 
      476
     | 
    
              	}
 
     | 
  
  
    | 
      477
     | 
    
              	echo mysql_error().'<br />';
 
     | 
  
  
    | 
      478
     | 
    
      
 
     | 
  
  
    | 
      479
     | 
    
              }
 
     | 
  
  
    | 
      480
     | 
    
      
 
     | 
  
  
    | 
      481
     | 
    
      
 
     | 
  
  
    | 
      482
     | 
    
            if ((version_compare(WB_VERSION, '2.8.0') <= 0) && file_exists(WB_PATH."/modules/news/upgrade.php"))
 
     | 
  
  
    | 
      483
     | 
    
            {
     | 
  
  
    | 
      484
     | 
    
                    echo '<h4>Upgrade existings postfiles to new format</h4><br />';
 
     | 
  
  
    | 
      485
     | 
    
                    // change old postfiles to new postfiles
 
     | 
  
  
    | 
      486
     | 
    
                    require_once(WB_PATH."/modules/news/upgrade.php");
 
     | 
  
  
    | 
      487
     | 
    
            }
 
     | 
  
  
    | 
      488
     | 
    
          }
 
     | 
  
  
    | 
      489
     | 
    
      
 
     | 
  
  
    | 
      490
     | 
    
         }
 
     | 
  
  
    | 
      491
     | 
    
      
 
     | 
  
  
    | 
      492
     | 
    
      }
 
     | 
  
  
    | 
      493
     | 
    
      
 
     | 
  
  
    | 
      494
     | 
    
      /**********************************************************
 
     | 
  
  
    | 
      495
     | 
    
       *  - Set Version to WB 2.8.1
 
     | 
  
  
    | 
      496
     | 
    
       */
 
     | 
  
  
    | 
      497
     | 
    
      echo "<br />Update database version number to 2.8.1 : ";
 
     | 
  
  
    | 
      498
     | 
    
      echo ($database->query("UPDATE `".TABLE_PREFIX."settings` SET `value` = '$version' WHERE `name` = 'wb_version'")) ? " $OK<br />" : " $FAIL<br />";
     | 
  
  
    | 
      499
     | 
    
      
 
     | 
  
  
    | 
      500
     | 
    
      /**********************************************************
 
     | 
  
  
    | 
      501
     | 
    
       *  - Reload all addons
 
     | 
  
  
    | 
      502
     | 
    
       */
 
     | 
  
  
    | 
      503
     | 
    
      
 
     | 
  
  
    | 
      504
     | 
    
      //delete modules
 
     | 
  
  
    | 
      505
     | 
    
      $database->query("DELETE FROM ".TABLE_PREFIX."addons WHERE type = 'module'");
     | 
  
  
    | 
      506
     | 
    
      // Load all modules
 
     | 
  
  
    | 
      507
     | 
    
      if($handle = opendir(WB_PATH.'/modules/')) {
     | 
  
  
    | 
      508
     | 
    
      	while(false !== ($file = readdir($handle))) {
     | 
  
  
    | 
      509
     | 
    
      		if($file != '' AND substr($file, 0, 1) != '.' AND $file != 'admin.php' AND $file != 'index.php') {
     | 
  
  
    | 
      510
     | 
    
      			load_module(WB_PATH.'/modules/'.$file);
 
     | 
  
  
    | 
      511
     | 
    
      		}
 
     | 
  
  
    | 
      512
     | 
    
      	}
 
     | 
  
  
    | 
      513
     | 
    
      	closedir($handle);
 
     | 
  
  
    | 
      514
     | 
    
      }
 
     | 
  
  
    | 
      515
     | 
    
      echo '<br />Modules reloaded<br />';
 
     | 
  
  
    | 
      516
     | 
    
      
 
     | 
  
  
    | 
      517
     | 
    
      //delete templates		
 
     | 
  
  
    | 
      518
     | 
    
      $database->query("DELETE FROM ".TABLE_PREFIX."addons WHERE type = 'template'");
     | 
  
  
    | 
      519
     | 
    
      // Load all templates
 
     | 
  
  
    | 
      520
     | 
    
      if($handle = opendir(WB_PATH.'/templates/')) {
     | 
  
  
    | 
      521
     | 
    
      	while(false !== ($file = readdir($handle))) {
     | 
  
  
    | 
      522
     | 
    
      		if($file != '' AND substr($file, 0, 1) != '.' AND $file != 'index.php') {
     | 
  
  
    | 
      523
     | 
    
      			load_template(WB_PATH.'/templates/'.$file);
 
     | 
  
  
    | 
      524
     | 
    
      		}
 
     | 
  
  
    | 
      525
     | 
    
      	}
 
     | 
  
  
    | 
      526
     | 
    
      	closedir($handle);
 
     | 
  
  
    | 
      527
     | 
    
      }
 
     | 
  
  
    | 
      528
     | 
    
      echo '<br />Templates reloaded<br />';
 
     | 
  
  
    | 
      529
     | 
    
      
 
     | 
  
  
    | 
      530
     | 
    
      //delete languages
 
     | 
  
  
    | 
      531
     | 
    
      $database->query("DELETE FROM ".TABLE_PREFIX."addons WHERE type = 'language'");
     | 
  
  
    | 
      532
     | 
    
      // Load all languages
 
     | 
  
  
    | 
      533
     | 
    
      if($handle = opendir(WB_PATH.'/languages/')) {
     | 
  
  
    | 
      534
     | 
    
      	while(false !== ($file = readdir($handle))) {
     | 
  
  
    | 
      535
     | 
    
      		if($file != '' AND substr($file, 0, 1) != '.' AND $file != 'index.php') {
     | 
  
  
    | 
      536
     | 
    
      			load_language(WB_PATH.'/languages/'.$file);
 
     | 
  
  
    | 
      537
     | 
    
      		}
 
     | 
  
  
    | 
      538
     | 
    
      	}
 
     | 
  
  
    | 
      539
     | 
    
      	closedir($handle);
 
     | 
  
  
    | 
      540
     | 
    
      }
 
     | 
  
  
    | 
      541
     | 
    
      echo '<br />Languages reloaded<br />';
 
     | 
  
  
    | 
      542
     | 
    
      
 
     | 
  
  
    | 
      543
     | 
    
      
 
     | 
  
  
    | 
      544
     | 
    
      /**********************************************************
 
     | 
  
  
    | 
      545
     | 
    
       *  - End of upgrade script
 
     | 
  
  
    | 
      546
     | 
    
       */
 
     | 
  
  
    | 
      547
     | 
    
      
 
     | 
  
  
    | 
      548
     | 
    
      // require(WB_PATH.'/framework/initialize.php');
 
     | 
  
  
    | 
      549
     | 
    
      
 
     | 
  
  
    | 
      550
     | 
    
      if(!defined('DEFAULT_THEME')) { define('DEFAULT_THEME', 'wb_theme'); }
     | 
  
  
    | 
      551
     | 
    
      if(!defined('THEME_PATH')) { define('THEME_PATH', WB_PATH.'/templates/'.DEFAULT_THEME);}
     | 
  
  
    | 
      552
     | 
    
      
 
     | 
  
  
    | 
      553
     | 
    
      echo '<p style="font-size:120%;"><strong>Congratulations: The upgrade script is finished ...</strong></p>';
 
     | 
  
  
    | 
      554
     | 
    
      status_msg('<strong>Warning:</strong><br />Please delete the file <strong>upgrade-script.php</strong> via FTP before proceeding.', 'warning', 'div');
     | 
  
  
    | 
      555
     | 
    
      // show buttons to go to the backend or frontend
 
     | 
  
  
    | 
      556
     | 
    
      echo '<br />';
 
     | 
  
  
    | 
      557
     | 
    
      if(defined('WB_URL')) {
     | 
  
  
    | 
      558
     | 
    
      	echo '<form action="'.WB_URL.'">';
 
     | 
  
  
    | 
      559
     | 
    
      	echo '<input type="submit" value="kick me to the Frontend" style="float:left;" />';
 
     | 
  
  
    | 
      560
     | 
    
      	echo '</form>';
 
     | 
  
  
    | 
      561
     | 
    
      }
 
     | 
  
  
    | 
      562
     | 
    
      if(defined('ADMIN_URL')) {
     | 
  
  
    | 
      563
     | 
    
      	echo '<form action="'.ADMIN_URL.'">';
 
     | 
  
  
    | 
      564
     | 
    
      	echo ' <input type="submit" value="kick me to the Backend" />';
 
     | 
  
  
    | 
      565
     | 
    
      	echo '</form>';
 
     | 
  
  
    | 
      566
     | 
    
      }
 
     | 
  
  
    | 
      567
     | 
    
      echo '<p> </p>';
 
     | 
  
  
    | 
      568
     | 
    
      
 
     | 
  
  
    | 
      569
     | 
    
      ?>
 
     | 
  
  
    | 
      570
     | 
    
      </div>
 
     | 
  
  
    | 
      571
     | 
    
      </body>
 
     | 
  
  
    | 
      572
     | 
    
      </html>
 
     |