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