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