| 1 |
1457
|
Luisehahne
|
<?php
|
| 2 |
|
|
/**
|
| 3 |
|
|
*
|
| 4 |
|
|
* @category backend
|
| 5 |
|
|
* @package installation
|
| 6 |
|
|
* @author WebsiteBaker Project
|
| 7 |
1688
|
Luisehahne
|
* @copyright 2009-2012, WebsiteBaker Org. e.V.
|
| 8 |
1684
|
Luisehahne
|
* @link http://www.websitebaker2.org/
|
| 9 |
1457
|
Luisehahne
|
* @license http://www.gnu.org/licenses/gpl.html
|
| 10 |
|
|
* @platform WebsiteBaker 2.8.x
|
| 11 |
|
|
* @requirements PHP 5.2.2 and higher
|
| 12 |
|
|
* @version $Id$
|
| 13 |
|
|
* @filesource $HeadURL$
|
| 14 |
|
|
* @lastmodified $Date$
|
| 15 |
|
|
*
|
| 16 |
|
|
*/
|
| 17 |
|
|
|
| 18 |
1677
|
Luisehahne
|
require_once('config.php');
|
| 19 |
1457
|
Luisehahne
|
|
| 20 |
1484
|
Luisehahne
|
require_once(WB_PATH.'/framework/functions.php');
|
| 21 |
|
|
require_once(WB_PATH.'/framework/class.admin.php');
|
| 22 |
1684
|
Luisehahne
|
// require_once(WB_PATH.'/framework/Database.php');
|
| 23 |
1484
|
Luisehahne
|
$admin = new admin('Addons', 'modules', false, false);
|
| 24 |
|
|
|
| 25 |
1677
|
Luisehahne
|
$oldVersion = 'Version '.WB_VERSION;
|
| 26 |
1689
|
darkviper
|
$oldVersion .= (defined('WB_SP') ? WB_SP : '');
|
| 27 |
1688
|
Luisehahne
|
$oldRevision = (defined('WB_REVISION') ? ' Revision ['.WB_REVISION.'] ' : '') ;
|
| 28 |
1677
|
Luisehahne
|
$newVersion = 'Version '.VERSION;
|
| 29 |
1689
|
darkviper
|
$newVersion .= (defined('SP') ? SP : '');
|
| 30 |
1688
|
Luisehahne
|
$newRevision = (defined('REVISION') ? ' Revision ['.REVISION.'] ' : '');
|
| 31 |
1457
|
Luisehahne
|
|
| 32 |
1677
|
Luisehahne
|
// set addition settings if not exists, otherwise upgrade will be breaks
|
| 33 |
|
|
if(!defined('WB_SP')) { define('WB_SP',''); }
|
| 34 |
|
|
if(!defined('WB_REVISION')) { define('WB_REVISION',''); }
|
| 35 |
|
|
|
| 36 |
1457
|
Luisehahne
|
// database tables including in WB package
|
| 37 |
1677
|
Luisehahne
|
$aTable = array (
|
| 38 |
1457
|
Luisehahne
|
'settings','groups','addons','pages','sections','search','users',
|
| 39 |
|
|
'mod_captcha_control','mod_code','mod_droplets','mod_form_fields',
|
| 40 |
|
|
'mod_form_settings','mod_form_submissions','mod_jsadmin','mod_menu_link',
|
| 41 |
|
|
'mod_news_comments','mod_news_groups','mod_news_posts','mod_news_settings',
|
| 42 |
|
|
'mod_output_filter','mod_wrapper','mod_wysiwyg'
|
| 43 |
|
|
);
|
| 44 |
|
|
|
| 45 |
1484
|
Luisehahne
|
$OK = ' <span class="ok">OK</span> ';
|
| 46 |
|
|
$FAIL = ' <span class="error">FAILED</span> ';
|
| 47 |
|
|
$DEFAULT_THEME = 'wb_theme';
|
| 48 |
1677
|
Luisehahne
|
|
| 49 |
1671
|
Luisehahne
|
$stepID = 0;
|
| 50 |
1532
|
Luisehahne
|
$dirRemove = array(
|
| 51 |
1484
|
Luisehahne
|
/*
|
| 52 |
|
|
'[TEMPLATE]/allcss/',
|
| 53 |
|
|
'[TEMPLATE]/blank/',
|
| 54 |
|
|
'[TEMPLATE]/round/',
|
| 55 |
|
|
'[TEMPLATE]/simple/',
|
| 56 |
|
|
*/
|
| 57 |
1641
|
Luisehahne
|
'[ADMIN]/themes/',
|
| 58 |
1484
|
Luisehahne
|
);
|
| 59 |
|
|
|
| 60 |
1532
|
Luisehahne
|
$filesRemove['0'] = array(
|
| 61 |
1484
|
Luisehahne
|
|
| 62 |
1525
|
Luisehahne
|
'[ADMIN]/preferences/details.php',
|
| 63 |
|
|
'[ADMIN]/preferences/email.php',
|
| 64 |
1666
|
Luisehahne
|
'[ADMIN]/preferences/password.php',
|
| 65 |
1684
|
Luisehahne
|
'[ADMIN]/pages/settings2.php',
|
| 66 |
1525
|
Luisehahne
|
|
| 67 |
1684
|
Luisehahne
|
'[FRAMEWORK]/class.msg_queue.php',
|
| 68 |
1689
|
darkviper
|
'[FRAMEWORK]/class.logfile.php',
|
| 69 |
|
|
// '[FRAMEWORK]/class.database.php',
|
| 70 |
1684
|
Luisehahne
|
|
| 71 |
1532
|
Luisehahne
|
);
|
| 72 |
|
|
|
| 73 |
1684
|
Luisehahne
|
if(version_compare(WB_REVISION, '1681', '<'))
|
| 74 |
1671
|
Luisehahne
|
{
|
| 75 |
|
|
$filesRemove['1'] = array(
|
| 76 |
1532
|
Luisehahne
|
|
| 77 |
1529
|
Luisehahne
|
'[TEMPLATE]/argos_theme/templates/access.htt',
|
| 78 |
|
|
'[TEMPLATE]/argos_theme/templates/addons.htt',
|
| 79 |
|
|
'[TEMPLATE]/argos_theme/templates/admintools.htt',
|
| 80 |
|
|
'[TEMPLATE]/argos_theme/templates/error.htt',
|
| 81 |
|
|
'[TEMPLATE]/argos_theme/templates/groups.htt',
|
| 82 |
|
|
'[TEMPLATE]/argos_theme/templates/groups_form.htt',
|
| 83 |
|
|
'[TEMPLATE]/argos_theme/templates/languages.htt',
|
| 84 |
|
|
'[TEMPLATE]/argos_theme/templates/languages_details.htt',
|
| 85 |
1671
|
Luisehahne
|
/*
|
| 86 |
1529
|
Luisehahne
|
'[TEMPLATE]/argos_theme/templates/login.htt',
|
| 87 |
|
|
'[TEMPLATE]/argos_theme/templates/login_forgot.htt',
|
| 88 |
1671
|
Luisehahne
|
*/
|
| 89 |
1529
|
Luisehahne
|
'[TEMPLATE]/argos_theme/templates/media.htt',
|
| 90 |
|
|
'[TEMPLATE]/argos_theme/templates/media_browse.htt',
|
| 91 |
|
|
'[TEMPLATE]/argos_theme/templates/media_rename.htt',
|
| 92 |
|
|
'[TEMPLATE]/argos_theme/templates/modules.htt',
|
| 93 |
|
|
'[TEMPLATE]/argos_theme/templates/modules_details.htt',
|
| 94 |
|
|
'[TEMPLATE]/argos_theme/templates/pages.htt',
|
| 95 |
|
|
'[TEMPLATE]/argos_theme/templates/pages_modify.htt',
|
| 96 |
|
|
'[TEMPLATE]/argos_theme/templates/pages_sections.htt',
|
| 97 |
|
|
'[TEMPLATE]/argos_theme/templates/pages_settings.htt',
|
| 98 |
|
|
'[TEMPLATE]/argos_theme/templates/preferences.htt',
|
| 99 |
|
|
'[TEMPLATE]/argos_theme/templates/setparameter.htt',
|
| 100 |
|
|
'[TEMPLATE]/argos_theme/templates/settings.htt',
|
| 101 |
|
|
'[TEMPLATE]/argos_theme/templates/start.htt',
|
| 102 |
|
|
'[TEMPLATE]/argos_theme/templates/success.htt',
|
| 103 |
|
|
'[TEMPLATE]/argos_theme/templates/templates.htt',
|
| 104 |
|
|
'[TEMPLATE]/argos_theme/templates/templates_details.htt',
|
| 105 |
|
|
'[TEMPLATE]/argos_theme/templates/users.htt',
|
| 106 |
|
|
'[TEMPLATE]/argos_theme/templates/users_form.htt',
|
| 107 |
|
|
|
| 108 |
|
|
'[TEMPLATE]/wb_theme/templates/access.htt',
|
| 109 |
|
|
'[TEMPLATE]/wb_theme/templates/addons.htt',
|
| 110 |
|
|
'[TEMPLATE]/wb_theme/templates/admintools.htt',
|
| 111 |
|
|
'[TEMPLATE]/wb_theme/templates/error.htt',
|
| 112 |
|
|
'[TEMPLATE]/wb_theme/templates/groups.htt',
|
| 113 |
|
|
'[TEMPLATE]/wb_theme/templates/groups_form.htt',
|
| 114 |
|
|
'[TEMPLATE]/wb_theme/templates/languages.htt',
|
| 115 |
|
|
'[TEMPLATE]/wb_theme/templates/languages_details.htt',
|
| 116 |
1625
|
Luisehahne
|
|
| 117 |
1671
|
Luisehahne
|
/*
|
| 118 |
1529
|
Luisehahne
|
'[TEMPLATE]/wb_theme/templates/login.htt',
|
| 119 |
|
|
'[TEMPLATE]/wb_theme/templates/login_forgot.htt',
|
| 120 |
1671
|
Luisehahne
|
*/
|
| 121 |
1625
|
Luisehahne
|
|
| 122 |
1529
|
Luisehahne
|
'[TEMPLATE]/wb_theme/templates/media.htt',
|
| 123 |
|
|
'[TEMPLATE]/wb_theme/templates/media_browse.htt',
|
| 124 |
|
|
'[TEMPLATE]/wb_theme/templates/media_rename.htt',
|
| 125 |
|
|
'[TEMPLATE]/wb_theme/templates/modules.htt',
|
| 126 |
|
|
'[TEMPLATE]/wb_theme/templates/modules_details.htt',
|
| 127 |
|
|
'[TEMPLATE]/wb_theme/templates/pages.htt',
|
| 128 |
|
|
'[TEMPLATE]/wb_theme/templates/pages_modify.htt',
|
| 129 |
|
|
'[TEMPLATE]/wb_theme/templates/pages_sections.htt',
|
| 130 |
|
|
'[TEMPLATE]/wb_theme/templates/pages_settings.htt',
|
| 131 |
|
|
'[TEMPLATE]/wb_theme/templates/preferences.htt',
|
| 132 |
|
|
'[TEMPLATE]/wb_theme/templates/setparameter.htt',
|
| 133 |
|
|
'[TEMPLATE]/wb_theme/templates/settings.htt',
|
| 134 |
|
|
'[TEMPLATE]/wb_theme/templates/start.htt',
|
| 135 |
|
|
'[TEMPLATE]/wb_theme/templates/success.htt',
|
| 136 |
|
|
'[TEMPLATE]/wb_theme/templates/templates.htt',
|
| 137 |
|
|
'[TEMPLATE]/wb_theme/templates/templates_details.htt',
|
| 138 |
|
|
'[TEMPLATE]/wb_theme/templates/users.htt',
|
| 139 |
|
|
'[TEMPLATE]/wb_theme/templates/users_form.htt',
|
| 140 |
1525
|
Luisehahne
|
);
|
| 141 |
1671
|
Luisehahne
|
}
|
| 142 |
1525
|
Luisehahne
|
|
| 143 |
1677
|
Luisehahne
|
/* display a status message on the screen **************************************
|
| 144 |
|
|
* @param string $message: the message to show
|
| 145 |
|
|
* @param string $class: kind of message as a css-class
|
| 146 |
|
|
* @param string $element: witch HTML-tag use to cover the message
|
| 147 |
|
|
* @return void
|
| 148 |
|
|
*/
|
| 149 |
|
|
function status_msg($message, $class='check', $element='span')
|
| 150 |
|
|
{
|
| 151 |
|
|
// returns a status message
|
| 152 |
|
|
$msg = '<'.$element.' class="'.$class.'">';
|
| 153 |
|
|
$msg .= '<strong>'.strtoupper(strtok($class, ' ')).'</strong>';
|
| 154 |
|
|
$msg .= $message.'</'.$element.'>';
|
| 155 |
|
|
echo $msg;
|
| 156 |
|
|
}
|
| 157 |
|
|
|
| 158 |
1457
|
Luisehahne
|
// analyze/check database tables
|
| 159 |
|
|
function mysqlCheckTables( $dbName )
|
| 160 |
|
|
{
|
| 161 |
1677
|
Luisehahne
|
global $aTable;
|
| 162 |
1457
|
Luisehahne
|
$table_prefix = TABLE_PREFIX;
|
| 163 |
|
|
$sql = "SHOW TABLES FROM " . $dbName;
|
| 164 |
|
|
$result = @mysql_query( $sql );
|
| 165 |
|
|
$data = array();
|
| 166 |
|
|
$x = 0;
|
| 167 |
|
|
|
| 168 |
1677
|
Luisehahne
|
while( ( $row = mysql_fetch_array( $result, MYSQL_NUM ) ) == true )
|
| 169 |
1457
|
Luisehahne
|
{
|
| 170 |
|
|
$tmp = str_replace($table_prefix, '', $row[0]);
|
| 171 |
|
|
|
| 172 |
1677
|
Luisehahne
|
if( stristr( $row[0], $table_prefix )&& in_array($tmp,$aTable) )
|
| 173 |
1457
|
Luisehahne
|
{
|
| 174 |
|
|
$sql = "CHECK TABLE " . $dbName . '.' . $row[0];
|
| 175 |
1677
|
Luisehahne
|
$analyze = mysql_query( $sql );
|
| 176 |
|
|
$rowFetch = mysql_fetch_array( $analyze, MYSQL_ASSOC );
|
| 177 |
1457
|
Luisehahne
|
$data[$x]['Op'] = $rowFetch["Op"];
|
| 178 |
|
|
$data[$x]['Msg_type'] = $rowFetch["Msg_type"];
|
| 179 |
|
|
$msgColor = '<span class="error">';
|
| 180 |
|
|
$data[$x]['Table'] = $row[0];
|
| 181 |
|
|
// print " ";
|
| 182 |
|
|
$msgColor = ($rowFetch["Msg_text"] == 'OK') ? '<span class="ok">' : '<span class="error">';
|
| 183 |
|
|
$data[$x]['Msg_text'] = $msgColor.$rowFetch["Msg_text"].'</span>';
|
| 184 |
|
|
// print "<br />";
|
| 185 |
|
|
$x++;
|
| 186 |
|
|
}
|
| 187 |
|
|
}
|
| 188 |
|
|
return $data;
|
| 189 |
|
|
}
|
| 190 |
|
|
|
| 191 |
|
|
// check existings tables for upgrade or install
|
| 192 |
|
|
function check_wb_tables()
|
| 193 |
|
|
{
|
| 194 |
1677
|
Luisehahne
|
global $database,$aTable;
|
| 195 |
1457
|
Luisehahne
|
|
| 196 |
|
|
// if prefix inludes '_' or '%'
|
| 197 |
|
|
$search_for = addcslashes ( TABLE_PREFIX, '%_' );
|
| 198 |
|
|
$get_result = $database->query( 'SHOW TABLES LIKE "'.$search_for.'%"');
|
| 199 |
|
|
|
| 200 |
|
|
// $get_result = $database->query( "SHOW TABLES FROM ".DB_NAME);
|
| 201 |
|
|
$all_tables = array();
|
| 202 |
|
|
if($get_result->numRows() > 0)
|
| 203 |
|
|
{
|
| 204 |
|
|
while ($data = $get_result->fetchRow())
|
| 205 |
|
|
{
|
| 206 |
|
|
$tmp = str_replace(TABLE_PREFIX, '', $data[0]);
|
| 207 |
1677
|
Luisehahne
|
if(in_array($tmp,$aTable))
|
| 208 |
1457
|
Luisehahne
|
{
|
| 209 |
|
|
$all_tables[] = $tmp;
|
| 210 |
|
|
}
|
| 211 |
|
|
}
|
| 212 |
|
|
}
|
| 213 |
|
|
return $all_tables;
|
| 214 |
|
|
}
|
| 215 |
|
|
|
| 216 |
|
|
// check existing tables
|
| 217 |
|
|
$all_tables = check_wb_tables();
|
| 218 |
|
|
|
| 219 |
1671
|
Luisehahne
|
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
| 220 |
1457
|
Luisehahne
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
| 221 |
|
|
<head>
|
| 222 |
|
|
<title>Upgrade script</title>
|
| 223 |
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
| 224 |
|
|
<style type="text/css">
|
| 225 |
1684
|
Luisehahne
|
html { overflow-y: scroll; /* Force firefox to always show room for a vertical scrollbar */ }
|
| 226 |
1457
|
Luisehahne
|
|
| 227 |
|
|
body {
|
| 228 |
|
|
margin:0;
|
| 229 |
|
|
padding:0;
|
| 230 |
|
|
border:0;
|
| 231 |
|
|
background: #EBF7FC;
|
| 232 |
|
|
color:#000;
|
| 233 |
|
|
font-family: 'Trebuchet MS', Verdana, Arial, Helvetica, Sans-Serif;
|
| 234 |
|
|
font-size: small;
|
| 235 |
|
|
height:101%;
|
| 236 |
|
|
}
|
| 237 |
|
|
|
| 238 |
|
|
#container {
|
| 239 |
|
|
width:85%;
|
| 240 |
|
|
background: #A8BCCB url(templates/wb_theme/images/background.png) repeat-x;
|
| 241 |
|
|
border:1px solid #000;
|
| 242 |
|
|
color:#000;
|
| 243 |
|
|
margin:2em auto;
|
| 244 |
|
|
padding:0 15px;
|
| 245 |
|
|
min-height: 500px;
|
| 246 |
|
|
text-align:left;
|
| 247 |
|
|
}
|
| 248 |
|
|
|
| 249 |
|
|
p { line-height:1.5em; }
|
| 250 |
|
|
|
| 251 |
1532
|
Luisehahne
|
form {
|
| 252 |
|
|
display: inline-block;
|
| 253 |
|
|
line-height: 20px;
|
| 254 |
|
|
vertical-align: baseline;
|
| 255 |
|
|
}
|
| 256 |
|
|
input[type="submit"].restart {
|
| 257 |
|
|
background-color: #FFDBDB;
|
| 258 |
|
|
font-weight: bold;
|
| 259 |
|
|
}
|
| 260 |
|
|
|
| 261 |
1457
|
Luisehahne
|
h1,h2,h3,h4,h5,h6 {
|
| 262 |
|
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
| 263 |
|
|
color: #369;
|
| 264 |
|
|
margin-top: 1.0em;
|
| 265 |
|
|
margin-bottom: 0.1em;
|
| 266 |
|
|
}
|
| 267 |
|
|
|
| 268 |
|
|
h1 { font-size:150%; }
|
| 269 |
|
|
h2 { font-size: 130%; border-bottom: 1px #CCC solid; }
|
| 270 |
1671
|
Luisehahne
|
h3 { font-size: 110%; font-weight: bold;; }
|
| 271 |
1457
|
Luisehahne
|
|
| 272 |
|
|
.ok, .error { font-weight:bold; }
|
| 273 |
|
|
.ok { color:green; }
|
| 274 |
|
|
.error { color:red; }
|
| 275 |
|
|
.check { color:#555; }
|
| 276 |
|
|
|
| 277 |
|
|
.warning {
|
| 278 |
|
|
width: 98%;
|
| 279 |
|
|
background:#FFDBDB;
|
| 280 |
|
|
padding:0.2em;
|
| 281 |
|
|
margin-top:0.5em;
|
| 282 |
|
|
border: 1px solid black;
|
| 283 |
|
|
}
|
| 284 |
|
|
.info {
|
| 285 |
|
|
width: 98%;
|
| 286 |
|
|
background:#99CC99;
|
| 287 |
|
|
padding:0.2em;
|
| 288 |
|
|
margin-top:0.5em;
|
| 289 |
|
|
border: 1px solid black;
|
| 290 |
|
|
}
|
| 291 |
|
|
|
| 292 |
|
|
</style>
|
| 293 |
|
|
</head>
|
| 294 |
|
|
<body>
|
| 295 |
|
|
<div id="container">
|
| 296 |
|
|
<img src="templates/wb_theme/images/logo.png" alt="WebsiteBaker Project" />
|
| 297 |
|
|
<h1>WebsiteBaker Upgrade</h1>
|
| 298 |
|
|
<?php
|
| 299 |
1525
|
Luisehahne
|
if( version_compare( WB_VERSION, '2.7', '<' )) {
|
| 300 |
1529
|
Luisehahne
|
status_msg('<strong>Warning:</strong><br />It is not possible to upgrade from WebsiteBaker Versions before 2.7.<br />For upgrading to version '.VERSION.' you must upgrade first to v.2.7 at least!!!', 'warning', 'div');
|
| 301 |
1457
|
Luisehahne
|
echo '<br /><br />';
|
| 302 |
|
|
echo "</div>
|
| 303 |
|
|
</body>
|
| 304 |
|
|
</html>
|
| 305 |
|
|
";
|
| 306 |
|
|
exit();
|
| 307 |
|
|
}
|
| 308 |
1532
|
Luisehahne
|
|
| 309 |
1457
|
Luisehahne
|
?>
|
| 310 |
1688
|
Luisehahne
|
<p>This script upgrades an existing WebsiteBaker <strong> <?php echo $oldRevision; ?></strong> installation to the <strong> <?php echo $newRevision ?> </strong>.<br />The upgrade script alters the existing WB database to reflect the changes introduced with WB 2.8.x</p>
|
| 311 |
1457
|
Luisehahne
|
|
| 312 |
|
|
<?php
|
| 313 |
|
|
/**
|
| 314 |
|
|
* Check if disclaimer was accepted
|
| 315 |
|
|
*/
|
| 316 |
|
|
if (!(isset($_POST['backup_confirmed']) && $_POST['backup_confirmed'] == 'confirmed')) { ?>
|
| 317 |
|
|
<h2>Step 1: Backup your files</h2>
|
| 318 |
|
|
<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>
|
| 319 |
|
|
|
| 320 |
1532
|
Luisehahne
|
<form name="send" action="<?php echo $_SERVER['SCRIPT_NAME'];?>" method="post">
|
| 321 |
1457
|
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>
|
| 322 |
|
|
<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.
|
| 323 |
|
|
<br /><br /><input name="send" type="submit" value="Start upgrade script" />
|
| 324 |
|
|
</form>
|
| 325 |
|
|
<br />
|
| 326 |
|
|
|
| 327 |
|
|
<?php
|
| 328 |
|
|
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');
|
| 329 |
|
|
echo '<br /><br />';
|
| 330 |
|
|
echo "</div>
|
| 331 |
|
|
</body>
|
| 332 |
|
|
</html>
|
| 333 |
|
|
";
|
| 334 |
|
|
exit();
|
| 335 |
|
|
}
|
| 336 |
|
|
|
| 337 |
1671
|
Luisehahne
|
echo '<h3>Step '.(++$stepID).': Setting default_theme</h3>';
|
| 338 |
1532
|
Luisehahne
|
|
| 339 |
1457
|
Luisehahne
|
/**********************************************************
|
| 340 |
|
|
* - Adding field default_theme to settings table
|
| 341 |
|
|
*/
|
| 342 |
1671
|
Luisehahne
|
echo "<br />Adding default_theme to settings table";
|
| 343 |
|
|
// db_update_key_value('settings', 'default_theme', $DEFAULT_THEME);
|
| 344 |
|
|
echo (db_update_key_value( 'settings', 'default_theme', $DEFAULT_THEME ) ? " $OK<br />" : " $FAIL!<br />");
|
| 345 |
1457
|
Luisehahne
|
|
| 346 |
|
|
// check again all tables, to get a new array
|
| 347 |
|
|
if(sizeof($all_tables) < 22) { $all_tables = check_wb_tables(); }
|
| 348 |
|
|
/**********************************************************
|
| 349 |
|
|
* - check tables comin with WebsiteBaker
|
| 350 |
|
|
*/
|
| 351 |
|
|
$check_text = 'total ';
|
| 352 |
|
|
// $check_tables = mysqlCheckTables( DB_NAME ) ;
|
| 353 |
|
|
|
| 354 |
|
|
if(sizeof($all_tables) == 22)
|
| 355 |
|
|
{
|
| 356 |
1688
|
Luisehahne
|
echo '<h4>NOTICE: Your database '.DB_NAME.' has '.sizeof($all_tables).' '.$check_text.' tables from '.sizeof($aTable).' included in package '.$OK.'</h4>';
|
| 357 |
1457
|
Luisehahne
|
}
|
| 358 |
|
|
else
|
| 359 |
|
|
{
|
| 360 |
|
|
status_msg('<strong>WARNING:</strong><br />can\'t run Upgrade, missing tables', 'warning', 'div');
|
| 361 |
|
|
echo '<h4>Missing required tables. You can install them in backend->addons->modules->advanced. Then again run upgrade-script.php</h4>';
|
| 362 |
1677
|
Luisehahne
|
$result = array_diff ( $aTable, $all_tables );
|
| 363 |
1457
|
Luisehahne
|
echo '<h4 class="warning"><br />';
|
| 364 |
|
|
while ( list ( $key, $val ) = each ( $result ) )
|
| 365 |
|
|
{
|
| 366 |
|
|
echo TABLE_PREFIX.$val.' '.$FAIL.'<br>';
|
| 367 |
|
|
}
|
| 368 |
|
|
echo '<br /></h4>';
|
| 369 |
|
|
echo '<br /><form action="'. $_SERVER['PHP_SELF'] .'">';
|
| 370 |
|
|
echo '<input type="submit" value="kick me back" style="float:left;" />';
|
| 371 |
|
|
echo '</form>';
|
| 372 |
|
|
if(defined('ADMIN_URL'))
|
| 373 |
|
|
{
|
| 374 |
|
|
echo '<form action="'.ADMIN_URL.'" target="_self">';
|
| 375 |
|
|
echo ' <input type="submit" value="kick me to the Backend" />';
|
| 376 |
|
|
echo '</form>';
|
| 377 |
|
|
}
|
| 378 |
|
|
echo "<br /><br /></div>
|
| 379 |
|
|
</body>
|
| 380 |
|
|
</html>
|
| 381 |
|
|
";
|
| 382 |
|
|
exit();
|
| 383 |
|
|
}
|
| 384 |
|
|
|
| 385 |
1671
|
Luisehahne
|
|
| 386 |
|
|
echo '<h3>Step '.(++$stepID).': Updating settings</h3>';
|
| 387 |
1457
|
Luisehahne
|
/**********************************************************
|
| 388 |
|
|
* - Adding field sec_anchor to settings table
|
| 389 |
|
|
*/
|
| 390 |
1671
|
Luisehahne
|
echo "<br />Adding sec_anchor to settings table";
|
| 391 |
1457
|
Luisehahne
|
$cfg = array(
|
| 392 |
1684
|
Luisehahne
|
'sec_anchor' => defined('SEC_ANCHOR') ? SEC_ANCHOR : 'wb_'
|
| 393 |
1457
|
Luisehahne
|
);
|
| 394 |
|
|
|
| 395 |
1671
|
Luisehahne
|
echo (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
|
| 396 |
|
|
|
| 397 |
|
|
|
| 398 |
1457
|
Luisehahne
|
/**********************************************************
|
| 399 |
|
|
* - Adding redirect timer to settings table
|
| 400 |
|
|
*/
|
| 401 |
1671
|
Luisehahne
|
echo "Adding redirect timer to settings table";
|
| 402 |
1457
|
Luisehahne
|
$cfg = array(
|
| 403 |
1684
|
Luisehahne
|
'redirect_timer' => defined('Redirect_Timer') ? Redirect_Timer : '1500'
|
| 404 |
1457
|
Luisehahne
|
);
|
| 405 |
1671
|
Luisehahne
|
echo (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
|
| 406 |
1457
|
Luisehahne
|
|
| 407 |
|
|
/**********************************************************
|
| 408 |
1532
|
Luisehahne
|
* - Adding rename_files_on_upload to settings table
|
| 409 |
|
|
*/
|
| 410 |
1671
|
Luisehahne
|
echo "Updating rename_files_on_upload to settings table";
|
| 411 |
1532
|
Luisehahne
|
$cfg = array(
|
| 412 |
1684
|
Luisehahne
|
'rename_files_on_upload' => (defined('RENAME_FILES_ON_UPLOAD') ? RENAME_FILES_ON_UPLOAD : 'ph.*?,cgi,pl,pm,exe,com,bat,pif,cmd,src,asp,aspx,js')
|
| 413 |
1532
|
Luisehahne
|
);
|
| 414 |
1671
|
Luisehahne
|
echo (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
|
| 415 |
1532
|
Luisehahne
|
|
| 416 |
|
|
/**********************************************************
|
| 417 |
1457
|
Luisehahne
|
* - Adding mediasettings to settings table
|
| 418 |
|
|
*/
|
| 419 |
1671
|
Luisehahne
|
echo "Adding mediasettings to settings table";
|
| 420 |
1457
|
Luisehahne
|
$cfg = array(
|
| 421 |
1684
|
Luisehahne
|
'mediasettings' => (defined('MEDIASETTINGS') ? MEDIASETTINGS : ''),
|
| 422 |
1457
|
Luisehahne
|
);
|
| 423 |
1484
|
Luisehahne
|
|
| 424 |
1671
|
Luisehahne
|
echo (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
|
| 425 |
1457
|
Luisehahne
|
|
| 426 |
|
|
/**********************************************************
|
| 427 |
|
|
* - Adding fingerprint_with_ip_octets to settings table
|
| 428 |
|
|
*/
|
| 429 |
1671
|
Luisehahne
|
echo "Adding fingerprint_with_ip_octets to settings table";
|
| 430 |
1457
|
Luisehahne
|
$cfg = array(
|
| 431 |
1684
|
Luisehahne
|
'fingerprint_with_ip_octets' => (defined('FINGERPRINT_WITH_IP_OCTETS') ? FINGERPRINT_WITH_IP_OCTETS : '2'),
|
| 432 |
|
|
'secure_form_module' => (defined('SECURE_FORM_MODULE') ? SECURE_FORM_MODULE : '')
|
| 433 |
1457
|
Luisehahne
|
);
|
| 434 |
1671
|
Luisehahne
|
|
| 435 |
|
|
echo (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
|
| 436 |
|
|
|
| 437 |
1666
|
Luisehahne
|
/**********************************************************
|
| 438 |
|
|
* - Adding page_icon_dir to settings table
|
| 439 |
|
|
*/
|
| 440 |
1671
|
Luisehahne
|
echo "Adding page_icon_dir to settings table";
|
| 441 |
1666
|
Luisehahne
|
$cfg = array(
|
| 442 |
1684
|
Luisehahne
|
'page_icon_dir' => (defined('PAGE_ICON_DIR') ? PAGE_ICON_DIR : '/templates/*/title_images'),
|
| 443 |
1666
|
Luisehahne
|
);
|
| 444 |
1671
|
Luisehahne
|
|
| 445 |
|
|
echo (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
|
| 446 |
|
|
|
| 447 |
1666
|
Luisehahne
|
/**********************************************************
|
| 448 |
|
|
* - Adding dev_infos to settings table
|
| 449 |
|
|
*/
|
| 450 |
1671
|
Luisehahne
|
echo "Adding dev_infos to settings table";
|
| 451 |
1666
|
Luisehahne
|
$cfg = array(
|
| 452 |
1684
|
Luisehahne
|
'dev_infos' => (defined('DEV_INFOS') ? DEV_INFOS : 'false')
|
| 453 |
1666
|
Luisehahne
|
);
|
| 454 |
1457
|
Luisehahne
|
|
| 455 |
1671
|
Luisehahne
|
echo (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
|
| 456 |
|
|
|
| 457 |
1689
|
darkviper
|
if(version_compare(WB_REVISION, REVISION, '<'))
|
| 458 |
1671
|
Luisehahne
|
{
|
| 459 |
|
|
echo '<h3>Step '.(++$stepID).': Updating core tables</h3>';
|
| 460 |
|
|
|
| 461 |
|
|
/**********************************************************
|
| 462 |
|
|
* - Update search no results database filed to create
|
| 463 |
|
|
* valid XHTML if search is empty
|
| 464 |
|
|
*/
|
| 465 |
|
|
if (version_compare(WB_VERSION, '2.8', '<'))
|
| 466 |
|
|
{
|
| 467 |
|
|
echo "<br />Updating database field `no_results` of search table: ";
|
| 468 |
|
|
$search_no_results = addslashes('<tr><td><p>[TEXT_NO_RESULTS]</p></td></tr>');
|
| 469 |
|
|
$sql = 'UPDATE `'.TABLE_PREFIX.'search` ';
|
| 470 |
|
|
$sql .= 'SET `value`=\''.$search_no_results.'\' ';
|
| 471 |
|
|
$sql .= 'WHERE `name`=\'no_results\'';
|
| 472 |
|
|
echo ($database->query($sql)) ? ' $OK<br />' : ' $FAIL<br />';
|
| 473 |
|
|
}
|
| 474 |
|
|
/**********************************************************
|
| 475 |
1457
|
Luisehahne
|
* - Add field "redirect_type" to table "mod_menu_link"
|
| 476 |
1696
|
Luisehahne
|
* has to be moved later to upgrade.php in modul menu_link, because modul can be removed
|
| 477 |
1457
|
Luisehahne
|
*/
|
| 478 |
1671
|
Luisehahne
|
$table_name = TABLE_PREFIX.'mod_menu_link';
|
| 479 |
|
|
$field_name = 'redirect_type';
|
| 480 |
1696
|
Luisehahne
|
$description = "INT NOT NULL DEFAULT '301' AFTER `target_page_id`";
|
| 481 |
1671
|
Luisehahne
|
if(!$database->field_exists($table_name,$field_name)) {
|
| 482 |
|
|
echo "<br />Adding field redirect_type to mod_menu_link table";
|
| 483 |
|
|
echo ($database->field_add($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
|
| 484 |
|
|
} else {
|
| 485 |
|
|
echo "<br />Modify field redirect_type to mod_menu_link table";
|
| 486 |
|
|
echo ($database->field_modify($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
|
| 487 |
|
|
}
|
| 488 |
1457
|
Luisehahne
|
|
| 489 |
1671
|
Luisehahne
|
/**********************************************************
|
| 490 |
|
|
* - Add field "page_trail" to table "pages"
|
| 491 |
|
|
*/
|
| 492 |
|
|
$table_name = TABLE_PREFIX.'pages';
|
| 493 |
|
|
$field_name = 'page_trail';
|
| 494 |
|
|
$description = "VARCHAR( 255 ) NOT NULL DEFAULT ''";
|
| 495 |
|
|
echo "Modify field page_trail to pages table";
|
| 496 |
|
|
echo ($database->field_modify($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
|
| 497 |
|
|
|
| 498 |
|
|
/**********************************************************
|
| 499 |
1666
|
Luisehahne
|
* - Add field "page_icon" to table "pages"
|
| 500 |
|
|
*/
|
| 501 |
1671
|
Luisehahne
|
$table_name = TABLE_PREFIX.'pages';
|
| 502 |
|
|
$field_name = 'page_icon';
|
| 503 |
1684
|
Luisehahne
|
$description = "VARCHAR( 512 ) NOT NULL DEFAULT '' AFTER `page_title`";
|
| 504 |
1671
|
Luisehahne
|
if(!$database->field_exists($table_name,$field_name)) {
|
| 505 |
|
|
echo "Adding field page_icon to pages table";
|
| 506 |
|
|
echo ($database->field_add($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
|
| 507 |
|
|
} else {
|
| 508 |
|
|
echo "Modify field page_icon to pages table";
|
| 509 |
|
|
echo ($database->field_modify($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
|
| 510 |
|
|
}
|
| 511 |
1666
|
Luisehahne
|
|
| 512 |
1671
|
Luisehahne
|
/**********************************************************
|
| 513 |
1688
|
Luisehahne
|
* - Add field "tooltip" to table "pages"
|
| 514 |
1686
|
darkviper
|
*/
|
| 515 |
|
|
$table_name = TABLE_PREFIX.'pages';
|
| 516 |
|
|
$field_name = 'tooltip';
|
| 517 |
|
|
$description = "VARCHAR( 512 ) NOT NULL DEFAULT '' AFTER `page_icon`";
|
| 518 |
1688
|
Luisehahne
|
if(!$database->field_exists($table_name,$field_name)) {
|
| 519 |
|
|
echo "Adding field tooltip to pages table";
|
| 520 |
|
|
echo ($database->field_add($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
|
| 521 |
|
|
} else {
|
| 522 |
1686
|
darkviper
|
echo "Modify field tooltip to pages table";
|
| 523 |
|
|
echo ($database->field_modify($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
|
| 524 |
1688
|
Luisehahne
|
}
|
| 525 |
1686
|
darkviper
|
|
| 526 |
|
|
/**********************************************************
|
| 527 |
1671
|
Luisehahne
|
* - Add field "page_code" to table "pages"
|
| 528 |
|
|
*/
|
| 529 |
|
|
$table_name = TABLE_PREFIX.'pages';
|
| 530 |
|
|
$field_name = 'page_code';
|
| 531 |
|
|
$description = "INT NOT NULL DEFAULT '0' AFTER `language`";
|
| 532 |
|
|
if(!$database->field_exists($table_name,$field_name)) {
|
| 533 |
|
|
echo "Adding field page_code to pages table";
|
| 534 |
|
|
echo ($database->field_add($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
|
| 535 |
|
|
} else {
|
| 536 |
|
|
echo "Modify field page_code to pages table";
|
| 537 |
|
|
echo ($database->field_modify($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
|
| 538 |
|
|
}
|
| 539 |
|
|
|
| 540 |
|
|
/**********************************************************
|
| 541 |
1666
|
Luisehahne
|
* - Add field "menu_icon_0" to table "pages"
|
| 542 |
|
|
*/
|
| 543 |
1671
|
Luisehahne
|
$table_name = TABLE_PREFIX.'pages';
|
| 544 |
|
|
$field_name = 'menu_icon_0';
|
| 545 |
1684
|
Luisehahne
|
$description = "VARCHAR( 512 ) NOT NULL DEFAULT '' AFTER `menu_title`";
|
| 546 |
1671
|
Luisehahne
|
if(!$database->field_exists($table_name,$field_name)) {
|
| 547 |
|
|
echo "Adding field menu_icon_0 to pages table";
|
| 548 |
|
|
echo ($database->field_add($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
|
| 549 |
|
|
} else {
|
| 550 |
|
|
echo "Modify field menu_icon_0 to pages table";
|
| 551 |
|
|
echo ($database->field_modify($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
|
| 552 |
|
|
}
|
| 553 |
1666
|
Luisehahne
|
|
| 554 |
1671
|
Luisehahne
|
/**********************************************************
|
| 555 |
|
|
* - Add field "menu_icon_1" to table "pages"
|
| 556 |
1666
|
Luisehahne
|
*/
|
| 557 |
1671
|
Luisehahne
|
$table_name = TABLE_PREFIX.'pages';
|
| 558 |
|
|
$field_name = 'menu_icon_1';
|
| 559 |
1684
|
Luisehahne
|
$description = "VARCHAR( 512 ) NOT NULL DEFAULT '' AFTER `menu_icon_0`";
|
| 560 |
1671
|
Luisehahne
|
if(!$database->field_exists($table_name,$field_name)) {
|
| 561 |
|
|
echo "Adding field menu_icon_1 to pages table";
|
| 562 |
|
|
echo ($database->field_add($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
|
| 563 |
|
|
} else {
|
| 564 |
|
|
echo "Modify field menu_icon_1 to pages table";
|
| 565 |
|
|
echo ($database->field_modify($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
|
| 566 |
|
|
}
|
| 567 |
1666
|
Luisehahne
|
|
| 568 |
1671
|
Luisehahne
|
/**********************************************************
|
| 569 |
1684
|
Luisehahne
|
* - Add field "tooltip" to table "pages"
|
| 570 |
|
|
*/
|
| 571 |
|
|
$table_name = TABLE_PREFIX.'pages';
|
| 572 |
|
|
$field_name = 'tooltip';
|
| 573 |
|
|
$description = "VARCHAR( 512 ) NOT NULL DEFAULT '' AFTER `menu_icon_1`";
|
| 574 |
|
|
if(!$database->field_exists($table_name,$field_name)) {
|
| 575 |
|
|
echo "Adding field tooltip to pages table";
|
| 576 |
|
|
echo ($database->field_add($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
|
| 577 |
|
|
} else {
|
| 578 |
|
|
echo "Modify field tooltip to pages table";
|
| 579 |
|
|
echo ($database->field_modify($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
|
| 580 |
|
|
}
|
| 581 |
|
|
|
| 582 |
|
|
/**********************************************************
|
| 583 |
1671
|
Luisehahne
|
* - Add field "admin_groups" to table "pages"
|
| 584 |
1588
|
darkviper
|
*/
|
| 585 |
1671
|
Luisehahne
|
$table_name = TABLE_PREFIX.'pages';
|
| 586 |
|
|
$field_name = 'admin_groups';
|
| 587 |
|
|
$description = "VARCHAR( 512 ) NOT NULL DEFAULT '1'";
|
| 588 |
|
|
echo "Modify field admin_groups to pages table";
|
| 589 |
|
|
echo ($database->field_modify($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
|
| 590 |
|
|
|
| 591 |
|
|
/**********************************************************
|
| 592 |
|
|
* - Add field "admin_users" to table "pages"
|
| 593 |
|
|
*/
|
| 594 |
|
|
$table_name = TABLE_PREFIX.'pages';
|
| 595 |
|
|
$field_name = 'admin_users';
|
| 596 |
|
|
$description = "VARCHAR( 512 ) NOT NULL DEFAULT ''";
|
| 597 |
|
|
echo "Modify field admin_users to pages table";
|
| 598 |
|
|
echo ($database->field_modify($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
|
| 599 |
|
|
|
| 600 |
|
|
/**********************************************************
|
| 601 |
|
|
* - Add field "viewing_groups" to table "pages"
|
| 602 |
|
|
*/
|
| 603 |
|
|
$table_name = TABLE_PREFIX.'pages';
|
| 604 |
|
|
$field_name = 'viewing_groups';
|
| 605 |
|
|
$description = "VARCHAR( 512 ) NOT NULL DEFAULT '1'";
|
| 606 |
|
|
echo "Modify field viewing_groups to pages table";
|
| 607 |
|
|
echo ($database->field_modify($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
|
| 608 |
|
|
|
| 609 |
|
|
/**********************************************************
|
| 610 |
|
|
* - Add field "viewing_users" to table "pages"
|
| 611 |
|
|
*/
|
| 612 |
|
|
$table_name = TABLE_PREFIX.'pages';
|
| 613 |
|
|
$field_name = 'viewing_users';
|
| 614 |
|
|
$description = "VARCHAR( 512 ) NOT NULL DEFAULT ''";
|
| 615 |
|
|
echo "Modify field viewing_users to pages table";
|
| 616 |
|
|
echo ($database->field_modify($table_name, $field_name, $description) ? " $OK<br />" : " $FAIL!<br />");
|
| 617 |
1457
|
Luisehahne
|
}
|
| 618 |
1671
|
Luisehahne
|
|
| 619 |
1457
|
Luisehahne
|
/**********************************************************
|
| 620 |
|
|
* upgrade media folder index protect files
|
| 621 |
1671
|
Luisehahne
|
ALTER TABLE `wb_pages` CHANGE `page_icon` `page_icon` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT ''
|
| 622 |
1457
|
Luisehahne
|
*/
|
| 623 |
1588
|
darkviper
|
$dir = (WB_PATH.MEDIA_DIRECTORY);
|
| 624 |
|
|
echo '<h4>Upgrade '.MEDIA_DIRECTORY.'/ index.php protect files</h4><br />';
|
| 625 |
|
|
$array = rebuildFolderProtectFile($dir);
|
| 626 |
|
|
if( sizeof( $array ) ){
|
| 627 |
|
|
print '<br /><strong>Upgrade '.sizeof( $array ).' '.MEDIA_DIRECTORY.'/ protect files</strong>'." $OK<br />";
|
| 628 |
|
|
} else {
|
| 629 |
|
|
print '<br /><strong>Upgrade '.MEDIA_DIRECTORY.'/ protect files</strong>'." $FAIL!<br />";
|
| 630 |
|
|
print implode ('<br />',$array);
|
| 631 |
1457
|
Luisehahne
|
}
|
| 632 |
1677
|
Luisehahne
|
|
| 633 |
1593
|
Luisehahne
|
/**********************************************************
|
| 634 |
1677
|
Luisehahne
|
* upgrade pages folder index access files
|
| 635 |
|
|
*/
|
| 636 |
|
|
echo '<h4>Upgrade /pages/ index.php access files</h4><br />';
|
| 637 |
1688
|
Luisehahne
|
|
| 638 |
1677
|
Luisehahne
|
///**********************************************************
|
| 639 |
1688
|
Luisehahne
|
// * - try to remove access files
|
| 640 |
|
|
// */
|
| 641 |
|
|
$sTempDir = (defined('PAGES_DIRECTORY') && (PAGES_DIRECTORY != '') ? PAGES_DIRECTORY : '');
|
| 642 |
|
|
if(($sTempDir!='') && is_readable(WB_PATH.$sTempDir)==true) {
|
| 643 |
|
|
if(rm_full_dir (WB_PATH.$sTempDir, true )==false) {
|
| 644 |
|
|
$msg[] = '<strong>Could not delete existing access files</strong><br />';
|
| 645 |
|
|
} else {
|
| 646 |
|
|
$msg[] = createFolderProtectFile(rtrim( WB_PATH.$sTempDir,'/') );
|
| 647 |
|
|
}
|
| 648 |
|
|
}
|
| 649 |
|
|
|
| 650 |
|
|
///**********************************************************
|
| 651 |
1677
|
Luisehahne
|
// * - Reformat/rebuild all existing access files
|
| 652 |
|
|
// */
|
| 653 |
|
|
$msg[] = "All existing access files anew format";
|
| 654 |
|
|
$sql = 'SELECT `page_id`,`link`, `level` FROM `'.TABLE_PREFIX.'pages` ORDER BY `link`';
|
| 655 |
|
|
if (($res_pages = $database->query($sql)))
|
| 656 |
|
|
{
|
| 657 |
|
|
$x = 0;
|
| 658 |
|
|
while (($rec_page = $res_pages->fetchRow()))
|
| 659 |
|
|
{
|
| 660 |
|
|
$filename = WB_PATH.PAGES_DIRECTORY.$rec_page['link'].PAGE_EXTENSION;
|
| 661 |
|
|
$msg = create_access_file($filename, $rec_page['page_id'], $rec_page['level']);
|
| 662 |
|
|
$x++;
|
| 663 |
|
|
}
|
| 664 |
|
|
$msg[] = '<strong>Number of the anew formatted access files: '.$x.'</strong><br />';
|
| 665 |
|
|
}
|
| 666 |
|
|
|
| 667 |
|
|
print implode ('<br />',$msg);
|
| 668 |
|
|
|
| 669 |
|
|
/*
|
| 670 |
|
|
if( sizeof( $msg ) ){
|
| 671 |
|
|
|
| 672 |
|
|
print '<br /><strong>Upgrade '.sizeof( $msg ).' /pages/ access files</strong>'." $OK<br />";
|
| 673 |
|
|
} else {
|
| 674 |
|
|
print '<br /><strong>Upgrade /pages/ access files</strong>'." $FAIL!<br />";
|
| 675 |
|
|
print implode ('<br />',$msg);
|
| 676 |
|
|
}
|
| 677 |
|
|
*/
|
| 678 |
|
|
/**********************************************************
|
| 679 |
1593
|
Luisehahne
|
* upgrade posts folder index protect files
|
| 680 |
|
|
*/
|
| 681 |
|
|
$sPostsPath = WB_PATH.PAGES_DIRECTORY.'/posts';
|
| 682 |
|
|
echo '<h4>Upgrade /posts/ index.php protect files</h4><br />';
|
| 683 |
|
|
$array = rebuildFolderProtectFile($sPostsPath);
|
| 684 |
|
|
if( sizeof( $array ) ){
|
| 685 |
|
|
print '<br /><strong>Upgrade '.sizeof( $array ).' /posts/ protect files</strong>'." $OK<br />";
|
| 686 |
|
|
} else {
|
| 687 |
|
|
print '<br /><strong>Upgrade /posts/ protect files</strong>'." $FAIL!<br />";
|
| 688 |
|
|
print implode ('<br />',$array);
|
| 689 |
|
|
}
|
| 690 |
1677
|
Luisehahne
|
|
| 691 |
1484
|
Luisehahne
|
/* *****************************************************************************
|
| 692 |
|
|
* - check for deprecated / never needed files
|
| 693 |
|
|
*/
|
| 694 |
1588
|
darkviper
|
if(sizeof($filesRemove)) {
|
| 695 |
1671
|
Luisehahne
|
echo '<h3>Step '.(++$stepID).': Remove deprecated and old files</h3>';
|
| 696 |
1588
|
darkviper
|
}
|
| 697 |
1484
|
Luisehahne
|
$searches = array(
|
| 698 |
|
|
'[ADMIN]',
|
| 699 |
|
|
'[MEDIA]',
|
| 700 |
1525
|
Luisehahne
|
'[PAGES]',
|
| 701 |
1533
|
Luisehahne
|
'[FRAMEWORK]',
|
| 702 |
|
|
'[MODULES]',
|
| 703 |
1525
|
Luisehahne
|
'[TEMPLATE]'
|
| 704 |
1484
|
Luisehahne
|
);
|
| 705 |
|
|
$replacements = array(
|
| 706 |
1525
|
Luisehahne
|
substr(ADMIN_PATH, strlen(WB_PATH)+1),
|
| 707 |
1484
|
Luisehahne
|
MEDIA_DIRECTORY,
|
| 708 |
1525
|
Luisehahne
|
PAGES_DIRECTORY,
|
| 709 |
1533
|
Luisehahne
|
'/framework',
|
| 710 |
|
|
'/modules',
|
| 711 |
|
|
'/templates'
|
| 712 |
1484
|
Luisehahne
|
);
|
| 713 |
|
|
|
| 714 |
1532
|
Luisehahne
|
foreach( $filesRemove as $filesId )
|
| 715 |
1484
|
Luisehahne
|
{
|
| 716 |
1532
|
Luisehahne
|
$msg = '';
|
| 717 |
|
|
foreach( $filesId as $file )
|
| 718 |
|
|
{
|
| 719 |
|
|
$file = str_replace($searches, $replacements, $file);
|
| 720 |
|
|
$file = WB_PATH.'/'.$file;
|
| 721 |
1588
|
darkviper
|
if( file_exists($file) ) {
|
| 722 |
|
|
// try to unlink file
|
| 723 |
|
|
if(!is_writable( $file ) || !unlink($file)) {
|
| 724 |
|
|
// save in err-list, if failed
|
| 725 |
1532
|
Luisehahne
|
$msg .= $file.'<br />';
|
| 726 |
|
|
}
|
| 727 |
1484
|
Luisehahne
|
}
|
| 728 |
|
|
}
|
| 729 |
1532
|
Luisehahne
|
|
| 730 |
|
|
if($msg != '')
|
| 731 |
|
|
{
|
| 732 |
|
|
$msg = '<br /><br />Following files are deprecated, outdated or a security risk and
|
| 733 |
|
|
can not be removed automatically.<br /><br />Please delete them
|
| 734 |
|
|
using FTP and restart upgrade-script!<br /><br />'.$msg.'<br />';
|
| 735 |
|
|
status_msg($msg, 'error warning', 'div');
|
| 736 |
|
|
echo '<p style="font-size:120%;"><strong>WARNING: The upgrade script failed ...</strong></p>';
|
| 737 |
|
|
|
| 738 |
|
|
echo '<form action="'.$_SERVER['SCRIPT_NAME'].'">';
|
| 739 |
|
|
echo ' <input name="send" type="submit" value="Restart upgrade script" />';
|
| 740 |
|
|
echo '</form>';
|
| 741 |
|
|
echo '<br /><br /></div></body></html>';
|
| 742 |
|
|
exit;
|
| 743 |
|
|
}
|
| 744 |
1484
|
Luisehahne
|
}
|
| 745 |
|
|
|
| 746 |
1532
|
Luisehahne
|
|
| 747 |
1457
|
Luisehahne
|
/**********************************************************
|
| 748 |
1525
|
Luisehahne
|
* - check for deprecated / never needed files
|
| 749 |
|
|
*/
|
| 750 |
1588
|
darkviper
|
if(sizeof($dirRemove)) {
|
| 751 |
1671
|
Luisehahne
|
echo '<h3>Step '.(++$stepID).': Remove deprecated and old folders</h3>';
|
| 752 |
1588
|
darkviper
|
$searches = array(
|
| 753 |
|
|
'[ADMIN]',
|
| 754 |
|
|
'[MEDIA]',
|
| 755 |
|
|
'[PAGES]',
|
| 756 |
|
|
'[TEMPLATE]'
|
| 757 |
|
|
);
|
| 758 |
|
|
$replacements = array(
|
| 759 |
|
|
substr(ADMIN_PATH, strlen(WB_PATH)+1),
|
| 760 |
|
|
MEDIA_DIRECTORY,
|
| 761 |
|
|
PAGES_DIRECTORY,
|
| 762 |
|
|
'/templates',
|
| 763 |
|
|
);
|
| 764 |
|
|
$msg = '';
|
| 765 |
|
|
foreach( $dirRemove as $dir ) {
|
| 766 |
|
|
$dir = str_replace($searches, $replacements, $dir);
|
| 767 |
|
|
$dir = WB_PATH.'/'.$dir;
|
| 768 |
|
|
if( is_dir( $dir )) {
|
| 769 |
|
|
// try to delete dir
|
| 770 |
1641
|
Luisehahne
|
if(!is_writable( $dir ) || !rm_full_dir($dir)) {
|
| 771 |
1588
|
darkviper
|
// save in err-list, if failed
|
| 772 |
1641
|
Luisehahne
|
$msg .= str_replace(WB_PATH,'',$dir).'<br />';
|
| 773 |
1588
|
darkviper
|
}
|
| 774 |
1525
|
Luisehahne
|
}
|
| 775 |
|
|
}
|
| 776 |
1588
|
darkviper
|
if($msg != '') {
|
| 777 |
1641
|
Luisehahne
|
$msg = '<br /><br />Following directories are deprecated, outdated or a security risk and
|
| 778 |
1588
|
darkviper
|
can not be removed automatically.<br /><br />Please delete them
|
| 779 |
|
|
using FTP and restart upgrade-script!<br /><br />'.$msg.'<br />';
|
| 780 |
|
|
status_msg($msg, 'error warning', 'div');
|
| 781 |
|
|
echo '<p style="font-size:120%;"><strong>WARNING: The upgrade script failed ...</strong></p>';
|
| 782 |
|
|
echo '<form action="'.$_SERVER['SCRIPT_NAME'].'">';
|
| 783 |
|
|
echo ' <input name="send" type="submit" value="Restart upgrade script" />';
|
| 784 |
|
|
echo '</form>';
|
| 785 |
|
|
echo '<br /><br /></div></body></html>';
|
| 786 |
|
|
exit;
|
| 787 |
|
|
}
|
| 788 |
1525
|
Luisehahne
|
}
|
| 789 |
1532
|
Luisehahne
|
|
| 790 |
1588
|
darkviper
|
/**********************************************************
|
| 791 |
|
|
* upgrade modules if newer version is available
|
| 792 |
|
|
*/
|
| 793 |
|
|
$aModuleList = array('news');
|
| 794 |
|
|
foreach($aModuleList as $sModul) {
|
| 795 |
|
|
if(file_exists(WB_PATH.'/modules/'.$sModul.'/upgrade.php')) {
|
| 796 |
|
|
$currModulVersion = get_modul_version ($sModul, false);
|
| 797 |
|
|
$newModulVersion = get_modul_version ($sModul, true);
|
| 798 |
|
|
if((version_compare($currModulVersion, $newModulVersion) <= 0)) {
|
| 799 |
1671
|
Luisehahne
|
echo '<h3>Step '.(++$stepID).' : Upgrade module \''.$sModul.'\' to version '.$newModulVersion.'</h3>';
|
| 800 |
1588
|
darkviper
|
require_once(WB_PATH.'/modules/'.$sModul.'/upgrade.php');
|
| 801 |
|
|
}
|
| 802 |
|
|
}
|
| 803 |
1525
|
Luisehahne
|
}
|
| 804 |
|
|
/**********************************************************
|
| 805 |
1457
|
Luisehahne
|
* - Reload all addons
|
| 806 |
|
|
*/
|
| 807 |
|
|
|
| 808 |
1671
|
Luisehahne
|
echo '<h3>Step '.(++$stepID).' : Reload all addons database entry (no upgrade)</h3>';
|
| 809 |
1588
|
darkviper
|
////delete modules
|
| 810 |
|
|
//$database->query("DELETE FROM ".TABLE_PREFIX."addons WHERE type = 'module'");
|
| 811 |
|
|
// Load all modules
|
| 812 |
|
|
if( ($handle = opendir(WB_PATH.'/modules/')) ) {
|
| 813 |
|
|
while(false !== ($file = readdir($handle))) {
|
| 814 |
|
|
if($file != '' AND substr($file, 0, 1) != '.' AND $file != 'admin.php' AND $file != 'index.php') {
|
| 815 |
|
|
load_module(WB_PATH.'/modules/'.$file );
|
| 816 |
|
|
// upgrade_module($file, true);
|
| 817 |
|
|
}
|
| 818 |
1457
|
Luisehahne
|
}
|
| 819 |
1588
|
darkviper
|
closedir($handle);
|
| 820 |
1457
|
Luisehahne
|
}
|
| 821 |
1588
|
darkviper
|
echo '<br />Modules reloaded<br />';
|
| 822 |
1457
|
Luisehahne
|
|
| 823 |
1588
|
darkviper
|
////delete templates
|
| 824 |
|
|
//$database->query("DELETE FROM ".TABLE_PREFIX."addons WHERE type = 'template'");
|
| 825 |
|
|
// Load all templates
|
| 826 |
|
|
if( ($handle = opendir(WB_PATH.'/templates/')) ) {
|
| 827 |
|
|
while(false !== ($file = readdir($handle))) {
|
| 828 |
|
|
if($file != '' AND substr($file, 0, 1) != '.' AND $file != 'index.php') {
|
| 829 |
|
|
load_template(WB_PATH.'/templates/'.$file);
|
| 830 |
|
|
}
|
| 831 |
1457
|
Luisehahne
|
}
|
| 832 |
1588
|
darkviper
|
closedir($handle);
|
| 833 |
1457
|
Luisehahne
|
}
|
| 834 |
1588
|
darkviper
|
echo '<br />Templates reloaded<br />';
|
| 835 |
1457
|
Luisehahne
|
|
| 836 |
1588
|
darkviper
|
////delete languages
|
| 837 |
|
|
//$database->query("DELETE FROM ".TABLE_PREFIX."addons WHERE type = 'language'");
|
| 838 |
|
|
// Load all languages
|
| 839 |
|
|
if( ($handle = opendir(WB_PATH.'/languages/')) ) {
|
| 840 |
|
|
while(false !== ($file = readdir($handle))) {
|
| 841 |
|
|
if($file != '' AND substr($file, 0, 1) != '.' AND $file != 'index.php') {
|
| 842 |
|
|
load_language(WB_PATH.'/languages/'.$file);
|
| 843 |
|
|
}
|
| 844 |
1457
|
Luisehahne
|
}
|
| 845 |
1588
|
darkviper
|
closedir($handle);
|
| 846 |
1457
|
Luisehahne
|
}
|
| 847 |
1588
|
darkviper
|
echo '<br />Languages reloaded<br />';
|
| 848 |
1457
|
Luisehahne
|
|
| 849 |
|
|
/**********************************************************
|
| 850 |
1671
|
Luisehahne
|
* - install new droplets
|
| 851 |
|
|
$drops = (!in_array ( "mod_droplets", $all_tables)) ? "<br />Install droplets<br />" : "<br />Upgrade droplets<br />";
|
| 852 |
|
|
echo $drops;
|
| 853 |
|
|
$file_name = (!in_array ( "mod_droplets", $all_tables) ? "install.php" : "upgrade.php");
|
| 854 |
|
|
require_once (WB_PATH."/modules/droplets/".$file_name);
|
| 855 |
|
|
********************************************************** */
|
| 856 |
|
|
|
| 857 |
|
|
/**********************************************************
|
| 858 |
1457
|
Luisehahne
|
* - End of upgrade script
|
| 859 |
|
|
*/
|
| 860 |
1588
|
darkviper
|
if(!defined('DEFAULT_THEME')) { define('DEFAULT_THEME', $DEFAULT_THEME); }
|
| 861 |
|
|
if(!defined('THEME_PATH')) { define('THEME_PATH', WB_PATH.'/templates/'.DEFAULT_THEME);}
|
| 862 |
1532
|
Luisehahne
|
/**********************************************************
|
| 863 |
|
|
* - Set Version to new Version
|
| 864 |
|
|
*/
|
| 865 |
1671
|
Luisehahne
|
echo '<br />Update database version number to '.VERSION.' '.SP.' '.' Revision ['.REVISION.'] : ';
|
| 866 |
1457
|
Luisehahne
|
|
| 867 |
1671
|
Luisehahne
|
$cfg = array(
|
| 868 |
|
|
'wb_version' => VERSION,
|
| 869 |
|
|
'wb_revision' => REVISION,
|
| 870 |
|
|
'wb_sp' => SP
|
| 871 |
|
|
);
|
| 872 |
|
|
|
| 873 |
|
|
echo (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
|
| 874 |
|
|
|
| 875 |
1588
|
darkviper
|
echo '<p style="font-size:120%;"><strong>Congratulations: The upgrade script is finished ...</strong></p>';
|
| 876 |
|
|
status_msg('<strong>Warning:</strong><br />Please delete the file <strong>upgrade-script.php</strong> via FTP before proceeding.', 'warning', 'div');
|
| 877 |
|
|
// show buttons to go to the backend or frontend
|
| 878 |
|
|
echo '<br />';
|
| 879 |
1532
|
Luisehahne
|
|
| 880 |
1588
|
darkviper
|
if(defined('WB_URL')) {
|
| 881 |
|
|
echo '<form action="'.WB_URL.'/">';
|
| 882 |
|
|
echo ' <input type="submit" value="kick me to the Frontend" />';
|
| 883 |
|
|
echo '</form>';
|
| 884 |
|
|
}
|
| 885 |
|
|
if(defined('ADMIN_URL')) {
|
| 886 |
|
|
echo '<form action="'.ADMIN_URL.'/">';
|
| 887 |
|
|
echo ' <input type="submit" value="kick me to the Backend" />';
|
| 888 |
|
|
echo '</form>';
|
| 889 |
|
|
}
|
| 890 |
1457
|
Luisehahne
|
|
| 891 |
1588
|
darkviper
|
echo '<br /><br /></div></body></html>';
|