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 1374 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 1409 FrankH
 *  - Adding field warn_page_leave to settings table
274
 */
275
echo "<br />Adding warn_page_leave to settings table<br />";
276
$cfg = array(
277
	'warn_page_leave' => '1'
278
);
279
280
foreach($cfg as $key=>$value) {
281
	db_add_key_value($key, $value);
282
}
283
284
/**********************************************************
285 1286 Luisehahne
 *  - install droplets
286 1226 Luisehahne
 */
287 1286 Luisehahne
    $drops = (!in_array ( "mod_droplets", $all_tables)) ? "<br />Install droplets<br />" : "<br />Upgrade droplets<br />";
288
    echo $drops;
289
290
     $file_name = (!in_array ( "mod_droplets", $all_tables)) ? "install.php" : "upgrade.php";
291
     require_once (WB_PATH."/modules/droplets/".$file_name);
292
293
// check again all tables, to get a new array
294
 if(sizeof($all_tables) < 22) { $all_tables = check_wb_tables(); }
295
/**********************************************************
296
 *  - check tables comin with WebsiteBaker
297
 */
298
    $check_text = 'total ';
299
    // $check_tables = mysqlCheckTables( DB_NAME ) ;
300
301
    if(sizeof($all_tables) == 22)
302
    {
303
        echo '<h4>NOTICE: Your database '.DB_NAME.' has '.sizeof($all_tables).' '.$check_text.' tables from '.sizeof($table_list).' included in package '.$OK.'</h4>';
304
    }
305
    else
306
    {
307
        status_msg('<strong>WARNING:</strong><br />can\'t run Upgrade, missing tables', 'warning', 'div');
308 1292 Luisehahne
    	echo '<h4>Missing required tables. You can install them in backend->addons->modules->advanced. Then again run upgrade-script.php</h4>';
309 1286 Luisehahne
        $result = array_diff ( $table_list, $all_tables );
310 1292 Luisehahne
        echo '<h4 class="warning"><br />';
311 1286 Luisehahne
        while ( list ( $key, $val ) = each ( $result ) )
312
        {
313
            echo TABLE_PREFIX.$val.' '.$FAIL.'<br>';
314
        }
315 1292 Luisehahne
        echo '<br /></h4>';
316 1286 Luisehahne
    	echo '<br /><form action="'. $_SERVER['PHP_SELF'] .'">';
317
    	echo '<input type="submit" value="kick me back" style="float:left;" />';
318
    	echo '</form>';
319
        if(defined('ADMIN_URL'))
320
        {
321
        	echo '<form action="'.ADMIN_URL.'" target="_self">';
322
        	echo '&nbsp;<input type="submit" value="kick me to the Backend" />';
323
        	echo '</form>';
324
        }
325
        echo "<br /><br /></div>
326
        </body>
327
        </html>
328
        ";
329
        exit();
330
    }
331
332
/**********************************************************
333
 *  - Adding field sec_anchor to settings table
334
 */
335
336
echo "<br />Adding sec_anchor to settings table<br />";
337 1226 Luisehahne
$cfg = array(
338 1286 Luisehahne
	'sec_anchor' => 'wb_'
339 1226 Luisehahne
);
340
foreach($cfg as $key=>$value) {
341
	db_add_key_value($key, $value);
342
}
343
344
/**********************************************************
345
 *  - Adding redirect timer to settings table
346
 */
347
echo "<br />Adding redirect timer to settings table<br />";
348
$cfg = array(
349
	'redirect_timer' => '1500'
350
);
351
foreach($cfg as $key=>$value) {
352
	db_add_key_value($key, $value);
353
}
354
355
/**********************************************************
356
 *  - Adding mediasettings to settings table
357
 */
358
echo "<br />Adding mediasettings to settings table<br />";
359
$cfg = array(
360
	'mediasettings' => ''
361
);
362
foreach($cfg as $key=>$value) {
363
	db_add_key_value($key, $value);
364
}
365
366
/**********************************************************
367
 *  - Add field "redirect_type" to table "mod_menu_link"
368
 */
369
echo "<br />Adding field redirect_type to mod_menu_link table<br />";
370
db_add_field('redirect_type', 'mod_menu_link', "INT NOT NULL DEFAULT '302' AFTER `target_page_id`");
371
372
373
374 1286 Luisehahne
if (version_compare(WB_VERSION, '2.8.0') < 0)
375 1269 Luisehahne
{
376
    /**********************************************************
377 1286 Luisehahne
     *  - Update search no results database filed to create
378
     *  valid XHTML if search is empty
379
     */
380
    echo "<br />Updating database field `no_results` of search table: ";
381
    $search_no_results = addslashes('<tr><td><p>[TEXT_NO_RESULTS]</p></td></tr>');
382
    $sql = "UPDATE `" . TABLE_PREFIX . "search` SET `value` = '$search_no_results' WHERE `name`= 'no_results'";
383
    $database->query($sql);
384
    echo ($database->query($sql)) ? " $OK<br />" : " $FAIL<br />";
385
    /**********************************************************
386 1269 Luisehahne
     *  - Update settings of News Modul
387
     */
388
389
    // These are the default setting
390
    $header = '<table cellpadding=\"0\" cellspacing=\"0\" class=\"loop-header\">'."\n";
391
    $post_loop = '<tr class=\"post_top\">
392 1226 Luisehahne
<td class=\"post_title\"><a href=\"[LINK]\">[TITLE]</a></td>
393
<td class=\"post_date\">[PUBLISHED_TIME], [PUBLISHED_DATE]</td>
394
</tr>
395
<tr>
396
<td class=\"post_short\" colspan=\"2\">
397
[SHORT]
398
<span style=\"visibility:[SHOW_READ_MORE];\"><a href=\"[LINK]\">[TEXT_READ_MORE]</a></span>
399
</td>
400
</tr>';
401 1269 Luisehahne
    $footer = '</table>
402 1226 Luisehahne
<table cellpadding="0" cellspacing="0" class="page-header" style="display: [DISPLAY_PREVIOUS_NEXT_LINKS]">
403
<tr>
404
<td class="page-left">[PREVIOUS_PAGE_LINK]</td>
405
<td class="page-center">[OF]</td>
406
<td class="page-right">[NEXT_PAGE_LINK]</td>
407
</tr>
408
</table>';
409 1269 Luisehahne
    $post_header = addslashes('<table cellpadding="0" cellspacing="0" class="post-header">
410 1226 Luisehahne
<tr>
411
<td><h1>[TITLE]</h1></td>
412
<td rowspan="3" style="display: [DISPLAY_IMAGE]">[GROUP_IMAGE]</td>
413
</tr>
414
<tr>
415
<td class="public-info"><b>[TEXT_POSTED_BY] [DISPLAY_NAME] ([USERNAME]) [TEXT_ON] [PUBLISHED_DATE]</b></td>
416
</tr>
417
<tr style="display: [DISPLAY_GROUP]">
418
<td class="group-page"><a href="[BACK]">[PAGE_TITLE]</a> &gt;&gt; <a href="[BACK]?g=[GROUP_ID]">[GROUP_TITLE]</a></td>
419
</tr>
420
</table>');
421 1269 Luisehahne
    $post_footer = '<p>[TEXT_LAST_CHANGED]: [MODI_DATE] [TEXT_AT] [MODI_TIME]</p>
422 1226 Luisehahne
<a href=\"[BACK]\">[TEXT_BACK]</a>';
423 1269 Luisehahne
    $comments_header = addslashes('<br /><br />
424 1226 Luisehahne
<h2>[TEXT_COMMENTS]</h2>
425
<table cellpadding="2" cellspacing="0" class="comment-header">');
426 1269 Luisehahne
    $comments_loop = addslashes('<tr>
427 1226 Luisehahne
<td class="comment_title">[TITLE]</td>
428
<td class="comment_info">[TEXT_BY] [DISPLAY_NAME] [TEXT_ON] [DATE] [TEXT_AT] [TIME]</td>
429
</tr>
430
<tr>
431
<td colspan="2" class="comment_text">[COMMENT]</td>
432
</tr>');
433 1269 Luisehahne
    $comments_footer = '</table>
434 1226 Luisehahne
<br /><a href=\"[ADD_COMMENT_URL]\">[TEXT_ADD_COMMENT]</a>';
435 1269 Luisehahne
    $comments_page = '<h1>[TEXT_COMMENT]</h1>
436 1226 Luisehahne
<h2>[POST_TITLE]</h2>
437
<br />';
438
439 1286 Luisehahne
if(in_array('mod_news_settings', $all_tables))
440
{
441
   // Insert default settings into database
442
   $query_dates = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_settings where section_id != 0 and page_id != 0");
443
   if($query_dates->numRows() > 1)
444
   {
445 1269 Luisehahne
        while($result = $query_dates->fetchRow())
446
        {
447 1226 Luisehahne
448 1269 Luisehahne
        	echo "<br /><u>Add default settings to database for news section_id= ".$result['section_id']."</u><br />";
449
        	$section_id = $result['section_id'];
450 1226 Luisehahne
451 1269 Luisehahne
        	if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `header` = '$header' WHERE `section_id` = $section_id")) {
452
        		echo 'Database data header added successfully';
453
        	}
454
        	echo mysql_error().'<br />';
455 1226 Luisehahne
456 1269 Luisehahne
        	if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `post_loop` = '$post_loop' WHERE `section_id` = $section_id")) {
457
        		echo 'Database data post_loop added successfully';
458
        	}
459
        	echo mysql_error().'<br />';
460 1226 Luisehahne
461 1269 Luisehahne
        	if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `footer` = '$footer' WHERE `section_id` = $section_id")) {
462
        		echo 'Database data footer added successfully';
463
        	}
464
        	echo mysql_error().'<br />';
465 1226 Luisehahne
466 1269 Luisehahne
        	if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `post_header` = '$post_header' WHERE `section_id` = $section_id")) {
467
        		echo 'Database data post_header added successfully';
468
        	}
469
        	echo mysql_error().'<br />';
470 1226 Luisehahne
471 1269 Luisehahne
        	if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `post_footer` = '$post_footer' WHERE `section_id` = $section_id")) {
472
        		echo 'Database data post_footer added successfully';
473
        	}
474
        	echo mysql_error().'<br />';
475 1226 Luisehahne
476 1269 Luisehahne
        	if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `comments_header` = '$comments_header' WHERE `section_id` = $section_id")) {
477
        		echo 'Database data comments_header added successfully';
478
        	}
479
        	echo mysql_error().'<br />';
480 1226 Luisehahne
481 1269 Luisehahne
        	if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `comments_loop` = '$comments_loop' WHERE `section_id` = $section_id")) {
482
        		echo 'Database data comments_loop added successfully';
483
        	}
484
        	echo mysql_error().'<br />';
485 1226 Luisehahne
486 1269 Luisehahne
        	if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `comments_footer` = '$comments_footer' WHERE `section_id` = $section_id")) {
487
        		echo 'Database data comments_footer added successfully';
488
        	}
489
        	echo mysql_error().'<br />';
490 1226 Luisehahne
491 1269 Luisehahne
        	if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `comments_page` = '$comments_page' WHERE `section_id` = $section_id")) {
492
        		echo 'Database data comments_page added successfully';
493
        	}
494
        	echo mysql_error().'<br />';
495 1226 Luisehahne
496 1269 Luisehahne
        }
497 1286 Luisehahne
498
499 1349 Luisehahne
      if ((version_compare(WB_VERSION, '2.8.1') <= 0) && file_exists(WB_PATH."/modules/news/upgrade.php"))
500 1286 Luisehahne
      {
501
              echo '<h4>Upgrade existings postfiles to new format</h4><br />';
502
              // change old postfiles to new postfiles
503
              require_once(WB_PATH."/modules/news/upgrade.php");
504
      }
505 1226 Luisehahne
    }
506 1269 Luisehahne
507 1286 Luisehahne
   }
508
509 1226 Luisehahne
}
510
511
/**********************************************************
512 1349 Luisehahne
 *  - Set Version to WB 2.8.2
513 1226 Luisehahne
 */
514 1349 Luisehahne
echo "<br />Update database version number to 2.8.2 : ";
515 1226 Luisehahne
echo ($database->query("UPDATE `".TABLE_PREFIX."settings` SET `value` = '$version' WHERE `name` = 'wb_version'")) ? " $OK<br />" : " $FAIL<br />";
516
517
/**********************************************************
518
 *  - Reload all addons
519
 */
520
521
//delete modules
522
$database->query("DELETE FROM ".TABLE_PREFIX."addons WHERE type = 'module'");
523
// Load all modules
524
if($handle = opendir(WB_PATH.'/modules/')) {
525
	while(false !== ($file = readdir($handle))) {
526
		if($file != '' AND substr($file, 0, 1) != '.' AND $file != 'admin.php' AND $file != 'index.php') {
527
			load_module(WB_PATH.'/modules/'.$file);
528
		}
529
	}
530
	closedir($handle);
531
}
532
echo '<br />Modules reloaded<br />';
533
534
//delete templates
535
$database->query("DELETE FROM ".TABLE_PREFIX."addons WHERE type = 'template'");
536
// Load all templates
537
if($handle = opendir(WB_PATH.'/templates/')) {
538
	while(false !== ($file = readdir($handle))) {
539
		if($file != '' AND substr($file, 0, 1) != '.' AND $file != 'index.php') {
540
			load_template(WB_PATH.'/templates/'.$file);
541
		}
542
	}
543
	closedir($handle);
544
}
545
echo '<br />Templates reloaded<br />';
546
547
//delete languages
548
$database->query("DELETE FROM ".TABLE_PREFIX."addons WHERE type = 'language'");
549
// Load all languages
550
if($handle = opendir(WB_PATH.'/languages/')) {
551
	while(false !== ($file = readdir($handle))) {
552
		if($file != '' AND substr($file, 0, 1) != '.' AND $file != 'index.php') {
553
			load_language(WB_PATH.'/languages/'.$file);
554
		}
555
	}
556
	closedir($handle);
557
}
558
echo '<br />Languages reloaded<br />';
559
560
561
/**********************************************************
562
 *  - End of upgrade script
563
 */
564 1286 Luisehahne
565
// require(WB_PATH.'/framework/initialize.php');
566
567
if(!defined('DEFAULT_THEME')) { define('DEFAULT_THEME', 'wb_theme'); }
568
if(!defined('THEME_PATH')) { define('THEME_PATH', WB_PATH.'/templates/'.DEFAULT_THEME);}
569
570 1226 Luisehahne
echo '<p style="font-size:120%;"><strong>Congratulations: The upgrade script is finished ...</strong></p>';
571
status_msg('<strong>Warning:</strong><br />Please delete the file <strong>upgrade-script.php</strong> via FTP before proceeding.', 'warning', 'div');
572
// show buttons to go to the backend or frontend
573
echo '<br />';
574
if(defined('WB_URL')) {
575 1286 Luisehahne
	echo '<form action="'.WB_URL.'">';
576 1226 Luisehahne
	echo '<input type="submit" value="kick me to the Frontend" style="float:left;" />';
577
	echo '</form>';
578
}
579
if(defined('ADMIN_URL')) {
580 1286 Luisehahne
	echo '<form action="'.ADMIN_URL.'">';
581 1226 Luisehahne
	echo '&nbsp;<input type="submit" value="kick me to the Backend" />';
582
	echo '</form>';
583
}
584
echo '<p>&nbsp;</p>';
585
586
?>
587
</div>
588
</body>
589 714 Ruebenwurz
</html>