Project

General

Profile

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