1 |
1457
|
Luisehahne
|
<?php
|
2 |
|
|
/**
|
3 |
1866
|
Luisehahne
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
4 |
1457
|
Luisehahne
|
*
|
5 |
1866
|
Luisehahne
|
* This program is free software: you can redistribute it and/or modify
|
6 |
|
|
* it under the terms of the GNU General Public License as published by
|
7 |
|
|
* the Free Software Foundation, either version 3 of the License, or
|
8 |
|
|
* (at your option) any later version.
|
9 |
1457
|
Luisehahne
|
*
|
10 |
1866
|
Luisehahne
|
* This program is distributed in the hope that it will be useful,
|
11 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
|
|
* GNU General Public License for more details.
|
14 |
|
|
*
|
15 |
|
|
* You should have received a copy of the GNU General Public License
|
16 |
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
1457
|
Luisehahne
|
*/
|
18 |
|
|
|
19 |
1866
|
Luisehahne
|
/**
|
20 |
|
|
*
|
21 |
|
|
*
|
22 |
1875
|
Luisehahne
|
* @category Core
|
23 |
|
|
* @package Core_package
|
24 |
|
|
* @subpackage upgrade-script
|
25 |
|
|
* @author Dietmar Wöllbrink <dietmar.woellbrink@websitebaker.org>
|
26 |
1866
|
Luisehahne
|
* @author Werner v.d.Decken <wkl@isteam.de>
|
27 |
|
|
* @copyright Werner v.d.Decken <wkl@isteam.de>
|
28 |
|
|
* @license http://www.gnu.org/licenses/gpl.html GPL License
|
29 |
|
|
* @version 0.0.1
|
30 |
|
|
* @revision $Revision$
|
31 |
|
|
* @link $HeadURL$
|
32 |
|
|
* @lastmodified $Date$
|
33 |
|
|
* @since File available since 17.01.2013
|
34 |
|
|
* @deprecated
|
35 |
|
|
* @description xyz
|
36 |
|
|
*/
|
37 |
1785
|
Luisehahne
|
// Include config file
|
38 |
|
|
$config_file = realpath('config.php');
|
39 |
|
|
if(file_exists($config_file) && !defined('WB_URL'))
|
40 |
|
|
{
|
41 |
1813
|
Luisehahne
|
require($config_file);
|
42 |
1870
|
Luisehahne
|
|
43 |
1785
|
Luisehahne
|
}
|
44 |
1920
|
Luisehahne
|
//require_once(WB_PATH.'/framework/class.admin.php');
|
45 |
|
|
if(!class_exists('admin', false)){ include(WB_PATH.'/framework/class.admin.php'); }
|
46 |
|
|
$admin = new admin('Addons', 'modules', false, false);
|
47 |
|
|
|
48 |
1870
|
Luisehahne
|
// solved wrong pages_directory value before creating access files
|
49 |
1871
|
Luisehahne
|
$sql = 'SELECT `value` FROM `'.TABLE_PREFIX.'settings` '
|
50 |
|
|
. 'WHERE `name`=\'pages_directory\'';
|
51 |
|
|
$sPagesDirectory = WbDatabase::getInstance()->get_one($sql);
|
52 |
|
|
$sTmp = trim($sPagesDirectory, '/');
|
53 |
|
|
$sTmp = ($sTmp == '' ? '' : '/'.$sTmp);
|
54 |
|
|
if($sTmp != $sPagesDirectory) {
|
55 |
|
|
$sql = 'UPDATE `'.TABLE_PREFIX.'settings` '
|
56 |
|
|
. 'SET `value` = \''.$sTmpDir.'\' '
|
57 |
|
|
. 'WHERE `name`=\'pages_directory\' ';
|
58 |
|
|
WbDatabase::getInstance()->query($sql);
|
59 |
1870
|
Luisehahne
|
}
|
60 |
1484
|
Luisehahne
|
require_once(WB_PATH.'/framework/functions.php');
|
61 |
1684
|
Luisehahne
|
// require_once(WB_PATH.'/framework/Database.php');
|
62 |
1484
|
Luisehahne
|
|
63 |
1677
|
Luisehahne
|
$oldVersion = 'Version '.WB_VERSION;
|
64 |
1689
|
darkviper
|
$oldVersion .= (defined('WB_SP') ? WB_SP : '');
|
65 |
1688
|
Luisehahne
|
$oldRevision = (defined('WB_REVISION') ? ' Revision ['.WB_REVISION.'] ' : '') ;
|
66 |
1677
|
Luisehahne
|
$newVersion = 'Version '.VERSION;
|
67 |
1689
|
darkviper
|
$newVersion .= (defined('SP') ? SP : '');
|
68 |
1688
|
Luisehahne
|
$newRevision = (defined('REVISION') ? ' Revision ['.REVISION.'] ' : '');
|
69 |
1457
|
Luisehahne
|
|
70 |
1765
|
Luisehahne
|
$bDebugModus = false;
|
71 |
|
|
|
72 |
1677
|
Luisehahne
|
// set addition settings if not exists, otherwise upgrade will be breaks
|
73 |
|
|
if(!defined('WB_SP')) { define('WB_SP',''); }
|
74 |
|
|
if(!defined('WB_REVISION')) { define('WB_REVISION',''); }
|
75 |
1457
|
Luisehahne
|
// database tables including in WB package
|
76 |
1765
|
Luisehahne
|
$aPackage = array (
|
77 |
1457
|
Luisehahne
|
'settings','groups','addons','pages','sections','search','users',
|
78 |
1889
|
Luisehahne
|
'mod_captcha_control','mod_jsadmin','mod_menu_link','mod_output_filter','mod_wrapper','mod_wysiwyg'
|
79 |
1457
|
Luisehahne
|
);
|
80 |
|
|
|
81 |
1484
|
Luisehahne
|
$OK = ' <span class="ok">OK</span> ';
|
82 |
|
|
$FAIL = ' <span class="error">FAILED</span> ';
|
83 |
|
|
$DEFAULT_THEME = 'wb_theme';
|
84 |
1677
|
Luisehahne
|
|
85 |
1671
|
Luisehahne
|
$stepID = 0;
|
86 |
1883
|
Luisehahne
|
$filesRemove = array();
|
87 |
1765
|
Luisehahne
|
$aFilesToRemove = array();
|
88 |
1532
|
Luisehahne
|
$dirRemove = array(
|
89 |
1484
|
Luisehahne
|
/*
|
90 |
|
|
'[TEMPLATE]/allcss/',
|
91 |
|
|
'[TEMPLATE]/blank/',
|
92 |
|
|
'[TEMPLATE]/round/',
|
93 |
|
|
'[TEMPLATE]/simple/',
|
94 |
|
|
*/
|
95 |
1641
|
Luisehahne
|
'[ADMIN]/themes/',
|
96 |
1484
|
Luisehahne
|
);
|
97 |
1866
|
Luisehahne
|
//
|
98 |
|
|
$filesRemove['0'] = array(
|
99 |
1484
|
Luisehahne
|
|
100 |
1525
|
Luisehahne
|
'[ADMIN]/preferences/details.php',
|
101 |
|
|
'[ADMIN]/preferences/email.php',
|
102 |
1666
|
Luisehahne
|
'[ADMIN]/preferences/password.php',
|
103 |
1684
|
Luisehahne
|
'[ADMIN]/pages/settings2.php',
|
104 |
1813
|
Luisehahne
|
'[ADMIN]/users/users.php',
|
105 |
1883
|
Luisehahne
|
'[ADMIN]/groups/add.php',
|
106 |
|
|
'[ADMIN]/groups/groups.php',
|
107 |
|
|
'[ADMIN]/groups/save.php',
|
108 |
1866
|
Luisehahne
|
'[ADMIN]/skel/themes/htt/groups.htt',
|
109 |
1525
|
Luisehahne
|
|
110 |
1684
|
Luisehahne
|
'[FRAMEWORK]/class.msg_queue.php',
|
111 |
1689
|
darkviper
|
'[FRAMEWORK]/class.logfile.php',
|
112 |
1785
|
Luisehahne
|
'[MODULES]/droplets/js/mdcr.js',
|
113 |
1684
|
Luisehahne
|
|
114 |
1532
|
Luisehahne
|
);
|
115 |
1866
|
Luisehahne
|
$aFilesToRemove = array_merge($filesRemove['0']);
|
116 |
1532
|
Luisehahne
|
|
117 |
1866
|
Luisehahne
|
// deleting files below only from less 2.8.4 stable
|
118 |
1883
|
Luisehahne
|
if(version_compare(WB_VERSION, '2.8.4', '<'))
|
119 |
1866
|
Luisehahne
|
{
|
120 |
1671
|
Luisehahne
|
$filesRemove['1'] = array(
|
121 |
1532
|
Luisehahne
|
|
122 |
1529
|
Luisehahne
|
'[TEMPLATE]/argos_theme/templates/access.htt',
|
123 |
|
|
'[TEMPLATE]/argos_theme/templates/addons.htt',
|
124 |
|
|
'[TEMPLATE]/argos_theme/templates/admintools.htt',
|
125 |
|
|
'[TEMPLATE]/argos_theme/templates/error.htt',
|
126 |
|
|
'[TEMPLATE]/argos_theme/templates/groups.htt',
|
127 |
|
|
'[TEMPLATE]/argos_theme/templates/groups_form.htt',
|
128 |
|
|
'[TEMPLATE]/argos_theme/templates/languages.htt',
|
129 |
|
|
'[TEMPLATE]/argos_theme/templates/languages_details.htt',
|
130 |
|
|
'[TEMPLATE]/argos_theme/templates/login.htt',
|
131 |
|
|
'[TEMPLATE]/argos_theme/templates/login_forgot.htt',
|
132 |
|
|
'[TEMPLATE]/argos_theme/templates/media.htt',
|
133 |
|
|
'[TEMPLATE]/argos_theme/templates/media_browse.htt',
|
134 |
|
|
'[TEMPLATE]/argos_theme/templates/media_rename.htt',
|
135 |
|
|
'[TEMPLATE]/argos_theme/templates/modules.htt',
|
136 |
|
|
'[TEMPLATE]/argos_theme/templates/modules_details.htt',
|
137 |
|
|
'[TEMPLATE]/argos_theme/templates/pages.htt',
|
138 |
|
|
'[TEMPLATE]/argos_theme/templates/pages_modify.htt',
|
139 |
|
|
'[TEMPLATE]/argos_theme/templates/pages_sections.htt',
|
140 |
|
|
'[TEMPLATE]/argos_theme/templates/pages_settings.htt',
|
141 |
|
|
'[TEMPLATE]/argos_theme/templates/preferences.htt',
|
142 |
|
|
'[TEMPLATE]/argos_theme/templates/setparameter.htt',
|
143 |
|
|
'[TEMPLATE]/argos_theme/templates/settings.htt',
|
144 |
|
|
'[TEMPLATE]/argos_theme/templates/start.htt',
|
145 |
|
|
'[TEMPLATE]/argos_theme/templates/success.htt',
|
146 |
|
|
'[TEMPLATE]/argos_theme/templates/templates.htt',
|
147 |
|
|
'[TEMPLATE]/argos_theme/templates/templates_details.htt',
|
148 |
|
|
'[TEMPLATE]/argos_theme/templates/users.htt',
|
149 |
|
|
'[TEMPLATE]/argos_theme/templates/users_form.htt',
|
150 |
|
|
|
151 |
|
|
'[TEMPLATE]/wb_theme/templates/access.htt',
|
152 |
|
|
'[TEMPLATE]/wb_theme/templates/addons.htt',
|
153 |
|
|
'[TEMPLATE]/wb_theme/templates/admintools.htt',
|
154 |
|
|
'[TEMPLATE]/wb_theme/templates/error.htt',
|
155 |
|
|
'[TEMPLATE]/wb_theme/templates/groups.htt',
|
156 |
|
|
'[TEMPLATE]/wb_theme/templates/groups_form.htt',
|
157 |
|
|
'[TEMPLATE]/wb_theme/templates/languages.htt',
|
158 |
|
|
'[TEMPLATE]/wb_theme/templates/languages_details.htt',
|
159 |
|
|
'[TEMPLATE]/wb_theme/templates/login.htt',
|
160 |
|
|
'[TEMPLATE]/wb_theme/templates/login_forgot.htt',
|
161 |
|
|
'[TEMPLATE]/wb_theme/templates/media.htt',
|
162 |
|
|
'[TEMPLATE]/wb_theme/templates/media_browse.htt',
|
163 |
|
|
'[TEMPLATE]/wb_theme/templates/media_rename.htt',
|
164 |
|
|
'[TEMPLATE]/wb_theme/templates/modules.htt',
|
165 |
|
|
'[TEMPLATE]/wb_theme/templates/modules_details.htt',
|
166 |
|
|
'[TEMPLATE]/wb_theme/templates/pages.htt',
|
167 |
|
|
'[TEMPLATE]/wb_theme/templates/pages_modify.htt',
|
168 |
|
|
'[TEMPLATE]/wb_theme/templates/pages_sections.htt',
|
169 |
|
|
'[TEMPLATE]/wb_theme/templates/pages_settings.htt',
|
170 |
|
|
'[TEMPLATE]/wb_theme/templates/preferences.htt',
|
171 |
|
|
'[TEMPLATE]/wb_theme/templates/setparameter.htt',
|
172 |
|
|
'[TEMPLATE]/wb_theme/templates/settings.htt',
|
173 |
|
|
'[TEMPLATE]/wb_theme/templates/start.htt',
|
174 |
|
|
'[TEMPLATE]/wb_theme/templates/success.htt',
|
175 |
|
|
'[TEMPLATE]/wb_theme/templates/templates.htt',
|
176 |
|
|
'[TEMPLATE]/wb_theme/templates/templates_details.htt',
|
177 |
|
|
'[TEMPLATE]/wb_theme/templates/users.htt',
|
178 |
1866
|
Luisehahne
|
'[TEMPLATE]/wb_theme/templates/users_form.htt'
|
179 |
1525
|
Luisehahne
|
);
|
180 |
1765
|
Luisehahne
|
|
181 |
1866
|
Luisehahne
|
$aFilesToRemove = array_merge($aFilesToRemove,$filesRemove['1']);
|
182 |
1765
|
Luisehahne
|
|
183 |
1671
|
Luisehahne
|
}
|
184 |
1677
|
Luisehahne
|
/* display a status message on the screen **************************************
|
185 |
|
|
* @param string $message: the message to show
|
186 |
|
|
* @param string $class: kind of message as a css-class
|
187 |
|
|
* @param string $element: witch HTML-tag use to cover the message
|
188 |
|
|
* @return void
|
189 |
|
|
*/
|
190 |
1765
|
Luisehahne
|
function status_msg($message, $class='check', $element='div')
|
191 |
1677
|
Luisehahne
|
{
|
192 |
|
|
// returns a status message
|
193 |
|
|
$msg = '<'.$element.' class="'.$class.'">';
|
194 |
|
|
$msg .= '<strong>'.strtoupper(strtok($class, ' ')).'</strong>';
|
195 |
|
|
$msg .= $message.'</'.$element.'>';
|
196 |
|
|
echo $msg;
|
197 |
|
|
}
|
198 |
|
|
|
199 |
1772
|
Luisehahne
|
/**
|
200 |
|
|
* add_modify_field_in_database()
|
201 |
|
|
*
|
202 |
|
|
* @param mixed $sTable
|
203 |
|
|
* @param mixed $sField
|
204 |
|
|
* @param mixed $sDescription
|
205 |
|
|
* @return
|
206 |
|
|
*/
|
207 |
|
|
function add_modify_field_in_database($sTable,$sField,$sDescription){
|
208 |
1889
|
Luisehahne
|
global $OK,$FAIL,$bDebugModus;
|
209 |
|
|
$database=WbDatabase::getInstance();
|
210 |
1866
|
Luisehahne
|
$aDebugMessage = array();
|
211 |
1772
|
Luisehahne
|
if(!$database->field_exists($sTable,$sField)) {
|
212 |
|
|
$aDebugMessage[] = "<span>Adding field $sField to $sTable table</span>";
|
213 |
|
|
$aDebugMessage[] = ($database->field_add($sTable, $sField, $sDescription) ? " $OK<br />" : " $FAIL!<br />");
|
214 |
|
|
} else {
|
215 |
|
|
$aDebugMessage[] = "<span>Modify field $sField to $sTable table</span>";
|
216 |
|
|
$aDebugMessage[] = ($database->field_modify($sTable, $sField, $sDescription) ? " $OK<br />" : " $FAIL!<br />");
|
217 |
|
|
}
|
218 |
1866
|
Luisehahne
|
if($bDebugModus) {
|
219 |
|
|
echo implode(PHP_EOL,$aDebugMessage);
|
220 |
|
|
}
|
221 |
|
|
return;
|
222 |
1457
|
Luisehahne
|
}
|
223 |
|
|
|
224 |
1671
|
Luisehahne
|
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
225 |
1457
|
Luisehahne
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
226 |
|
|
<head>
|
227 |
|
|
<title>Upgrade script</title>
|
228 |
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
229 |
|
|
<style type="text/css">
|
230 |
1684
|
Luisehahne
|
html { overflow-y: scroll; /* Force firefox to always show room for a vertical scrollbar */ }
|
231 |
1457
|
Luisehahne
|
|
232 |
|
|
body {
|
233 |
|
|
margin:0;
|
234 |
|
|
padding:0;
|
235 |
|
|
border:0;
|
236 |
|
|
background: #EBF7FC;
|
237 |
|
|
color:#000;
|
238 |
|
|
font-family: 'Trebuchet MS', Verdana, Arial, Helvetica, Sans-Serif;
|
239 |
|
|
font-size: small;
|
240 |
|
|
height:101%;
|
241 |
|
|
}
|
242 |
|
|
|
243 |
|
|
#container {
|
244 |
1765
|
Luisehahne
|
min-width:48em;
|
245 |
|
|
width: 70%;
|
246 |
1866
|
Luisehahne
|
background: #A8BCCB url(<?php echo WB_URL; ?>/templates/wb_theme/images/background.png) repeat-x;
|
247 |
1457
|
Luisehahne
|
border:1px solid #000;
|
248 |
|
|
color:#000;
|
249 |
|
|
margin:2em auto;
|
250 |
1765
|
Luisehahne
|
padding:0 20px;
|
251 |
1457
|
Luisehahne
|
min-height: 500px;
|
252 |
|
|
text-align:left;
|
253 |
|
|
}
|
254 |
1765
|
Luisehahne
|
.page {
|
255 |
|
|
width:100%;
|
256 |
|
|
overflow: hidden;
|
257 |
|
|
}
|
258 |
|
|
.content {
|
259 |
|
|
padding: 10px;
|
260 |
|
|
}
|
261 |
1457
|
Luisehahne
|
p { line-height:1.5em; }
|
262 |
|
|
|
263 |
1532
|
Luisehahne
|
form {
|
264 |
|
|
display: inline-block;
|
265 |
|
|
line-height: 20px;
|
266 |
|
|
vertical-align: baseline;
|
267 |
|
|
}
|
268 |
|
|
input[type="submit"].restart {
|
269 |
|
|
background-color: #FFDBDB;
|
270 |
|
|
font-weight: bold;
|
271 |
|
|
}
|
272 |
|
|
|
273 |
1457
|
Luisehahne
|
h1,h2,h3,h4,h5,h6 {
|
274 |
|
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
275 |
1765
|
Luisehahne
|
color: #26527D;
|
276 |
1457
|
Luisehahne
|
margin-top: 1.0em;
|
277 |
|
|
margin-bottom: 0.1em;
|
278 |
|
|
}
|
279 |
|
|
|
280 |
|
|
h1 { font-size:150%; }
|
281 |
|
|
h2 { font-size: 130%; border-bottom: 1px #CCC solid; }
|
282 |
1765
|
Luisehahne
|
h3 { font-size: 110%; font-weight: bold; }
|
283 |
1457
|
Luisehahne
|
|
284 |
1765
|
Luisehahne
|
textarea {
|
285 |
|
|
width:100%;
|
286 |
1866
|
Luisehahne
|
border: 2px groove #0F1D44;
|
287 |
|
|
padding: 2px;
|
288 |
|
|
color: #000;
|
289 |
|
|
font-weight: normal;
|
290 |
1765
|
Luisehahne
|
}
|
291 |
1457
|
Luisehahne
|
.ok, .error { font-weight:bold; }
|
292 |
|
|
.ok { color:green; }
|
293 |
|
|
.error { color:red; }
|
294 |
|
|
.check { color:#555; }
|
295 |
|
|
|
296 |
1765
|
Luisehahne
|
span.ok,
|
297 |
|
|
span.error {
|
298 |
|
|
margin-left: 0em;
|
299 |
|
|
}
|
300 |
|
|
|
301 |
1457
|
Luisehahne
|
.warning {
|
302 |
|
|
background:#FFDBDB;
|
303 |
1765
|
Luisehahne
|
padding:1em;
|
304 |
1457
|
Luisehahne
|
margin-top:0.5em;
|
305 |
1765
|
Luisehahne
|
border: 1px solid #DB0909;
|
306 |
1457
|
Luisehahne
|
}
|
307 |
|
|
.info {
|
308 |
1765
|
Luisehahne
|
background:#C7F4C7;
|
309 |
|
|
padding:1em;
|
310 |
1457
|
Luisehahne
|
margin-top:0.5em;
|
311 |
1765
|
Luisehahne
|
border: 1px solid #277A29;
|
312 |
1457
|
Luisehahne
|
}
|
313 |
|
|
|
314 |
|
|
</style>
|
315 |
|
|
</head>
|
316 |
|
|
<body>
|
317 |
|
|
<div id="container">
|
318 |
1765
|
Luisehahne
|
<div class="page">
|
319 |
1866
|
Luisehahne
|
<img src="<?php echo WB_URL; ?>/templates/wb_theme/images/logo.png" alt="WebsiteBaker Project" />
|
320 |
1765
|
Luisehahne
|
<div class="content">
|
321 |
1457
|
Luisehahne
|
<h1>WebsiteBaker Upgrade</h1>
|
322 |
|
|
<?php
|
323 |
1525
|
Luisehahne
|
if( version_compare( WB_VERSION, '2.7', '<' )) {
|
324 |
1920
|
Luisehahne
|
status_msg('<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');
|
325 |
1457
|
Luisehahne
|
echo "</div>
|
326 |
1866
|
Luisehahne
|
</div>
|
327 |
|
|
</div>
|
328 |
1457
|
Luisehahne
|
</body>
|
329 |
|
|
</html>
|
330 |
|
|
";
|
331 |
|
|
exit();
|
332 |
|
|
}
|
333 |
1920
|
Luisehahne
|
if($admin->get_user_id()!=1){
|
334 |
|
|
status_msg('<br /><h3>WebsiteBaker upgrading is not possible!<br />Before upgrading to Revision '.REVISION.' you have to login as System-Administrator!</h3>', 'warning', 'div');
|
335 |
|
|
echo '<br /><br />';
|
336 |
|
|
// delete remember key of current user from database
|
337 |
|
|
//if (isset($_SESSION['USER_ID']) && isset($database)) {
|
338 |
|
|
// $table = TABLE_PREFIX . 'users';
|
339 |
|
|
// $sql = "UPDATE `$table` SET `remember_key` = '' WHERE `user_id` = '" . (int) $_SESSION['USER_ID'] . "'";
|
340 |
|
|
// $database->query($sql);
|
341 |
|
|
//}
|
342 |
1532
|
Luisehahne
|
|
343 |
1920
|
Luisehahne
|
// delete remember key cookie if set
|
344 |
|
|
if (isset($_COOKIE['REMEMBER_KEY'])) {
|
345 |
|
|
setcookie('REMEMBER_KEY', '', time() - 3600, '/');
|
346 |
|
|
}
|
347 |
|
|
|
348 |
|
|
// delete most critical session variables manually
|
349 |
|
|
$_SESSION['USER_ID'] = null;
|
350 |
|
|
$_SESSION['GROUP_ID'] = null;
|
351 |
|
|
$_SESSION['GROUPS_ID'] = null;
|
352 |
|
|
$_SESSION['USERNAME'] = null;
|
353 |
|
|
$_SESSION['PAGE_PERMISSIONS'] = null;
|
354 |
|
|
$_SESSION['SYSTEM_PERMISSIONS'] = null;
|
355 |
|
|
// overwrite session array
|
356 |
|
|
$_SESSION = array();
|
357 |
|
|
// delete session cookie if set
|
358 |
|
|
if (isset($_COOKIE[session_name()])) {
|
359 |
|
|
setcookie(session_name(), '', time() - 42000, '/');
|
360 |
|
|
}
|
361 |
|
|
// delete the session itself
|
362 |
|
|
session_destroy();
|
363 |
|
|
status_msg('<br /><h3>After login as System-Adminstrator you have to start upgrade-script.php again!</h3>', 'info', 'div');
|
364 |
|
|
echo '<br /><br />';
|
365 |
|
|
if(defined('ADMIN_URL')) {
|
366 |
|
|
echo '<form action="'.ADMIN_URL.'/index.php" method="post">';
|
367 |
|
|
echo ' <input name="backend_send" type="submit" value="Kick me to the Login" />';
|
368 |
|
|
echo '</form>';
|
369 |
|
|
}
|
370 |
|
|
echo "<br /><br /></div>
|
371 |
|
|
</div>
|
372 |
|
|
</div>
|
373 |
|
|
</body>
|
374 |
|
|
</html>
|
375 |
|
|
";
|
376 |
|
|
exit();
|
377 |
|
|
}
|
378 |
|
|
|
379 |
1457
|
Luisehahne
|
?>
|
380 |
1765
|
Luisehahne
|
<p class="info">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>
|
381 |
1457
|
Luisehahne
|
|
382 |
|
|
<?php
|
383 |
1870
|
Luisehahne
|
|
384 |
1457
|
Luisehahne
|
/**
|
385 |
|
|
* Check if disclaimer was accepted
|
386 |
|
|
*/
|
387 |
1765
|
Luisehahne
|
$bDebugModus = false;
|
388 |
|
|
$bDebugModus = ( (isset($_POST['debug_confirmed']) && $_POST['debug_confirmed'] == 'debug') ? true : false);
|
389 |
1457
|
Luisehahne
|
if (!(isset($_POST['backup_confirmed']) && $_POST['backup_confirmed'] == 'confirmed')) { ?>
|
390 |
|
|
<h2>Step 1: Backup your files</h2>
|
391 |
1785
|
Luisehahne
|
<h5 class="warning">It is highly recommended to <strong>create a manual backup</strong> of the entire <strong class="error"><?php echo PAGES_DIRECTORY ?>/</strong> folder and the <strong>MySQL database</strong> before proceeding.</h5>
|
392 |
|
|
<p><strong class="error">Note: </strong>The upgrade script alters some settings of your existing database!!! You need to confirm the disclaimer before proceeding.</p>
|
393 |
1457
|
Luisehahne
|
|
394 |
1866
|
Luisehahne
|
<form action="<?php echo $_SERVER['SCRIPT_NAME'];?>" method="post">
|
395 |
1765
|
Luisehahne
|
<textarea cols="92" 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 <?php echo PAGES_DIRECTORY ?>/ folder (including all files and subfolders contained in it) and backup of the entire WebsiteBaker MySQL database was created before you can proceed.</textarea>
|
396 |
|
|
<br /><br /><input name="backup_confirmed" type="checkbox" value="confirmed" /> <strong>I confirm that a manual backup of the <?php echo PAGES_DIRECTORY ?>/ folder and the MySQL database was created.</strong>
|
397 |
|
|
<br /><br /><input name="debug_confirmed" type="checkbox" value="debug" /> <strong>Here you can get more details during running upgrade.</strong>
|
398 |
1457
|
Luisehahne
|
<br /><br /><input name="send" type="submit" value="Start upgrade script" />
|
399 |
|
|
</form>
|
400 |
|
|
<br />
|
401 |
|
|
|
402 |
|
|
<?php
|
403 |
1765
|
Luisehahne
|
status_msg('<strong> Notice:</strong><br />You need to confirm that you have created a manual backup of the '.PAGES_DIRECTORY.'/ directory and the MySQL database before you can proceed.', 'warning', 'div');
|
404 |
1866
|
Luisehahne
|
echo "<br /><br /></div>
|
405 |
|
|
</div>
|
406 |
|
|
</div>
|
407 |
|
|
</body>
|
408 |
|
|
</html>";
|
409 |
1457
|
Luisehahne
|
exit();
|
410 |
|
|
}
|
411 |
|
|
|
412 |
|
|
/**********************************************************
|
413 |
1765
|
Luisehahne
|
* - check tables coming with WebsiteBaker
|
414 |
1457
|
Luisehahne
|
*/
|
415 |
1889
|
Luisehahne
|
$aMissingTables = UpgradeHelper::existsAllTables($aPackage);
|
416 |
|
|
if( sizeof($aMissingTables) == 0){
|
417 |
1894
|
Luisehahne
|
echo '<h4 style="margin-left:0;">NOTICE: '.sizeof($aPackage).' total tables included in package are successfully installed into your database `'.$database->DbName.'` '.$OK.'</h4>';
|
418 |
1889
|
Luisehahne
|
} else {
|
419 |
1765
|
Luisehahne
|
status_msg('<strong>:</strong><br />can\'t run Upgrade, missing tables', 'warning', 'div');
|
420 |
|
|
echo '<h4>Missing required tables. You can install them in backend->addons->modules.<br />';
|
421 |
|
|
echo 'Or if you uploaded per FTP install possible by backend->addons->modules->advanced.<br />';
|
422 |
1866
|
Luisehahne
|
echo 'First rename or delete the upgrade-script.php, so the script can\'t start automatically by backend<br />';
|
423 |
1889
|
Luisehahne
|
echo 'After installing missing tables upload and run again upgrade-script.php<br /><br /></h4>';
|
424 |
|
|
echo '<h4 class="warning">';
|
425 |
|
|
echo 'Missing required tables.<br /><br />';
|
426 |
|
|
echo 'TABLE `'.implode('` missing! '.$FAIL.'<br />TABLE `',$aMissingTables).'` missing! '.$FAIL;
|
427 |
|
|
echo '<br /><br /></h4>';
|
428 |
1765
|
Luisehahne
|
echo '<br /><br />';
|
429 |
|
|
if(isset($_SERVER['SCRIPT_NAME'])) {
|
430 |
|
|
echo '<form action="'.$_SERVER['SCRIPT_NAME'].'/">';
|
431 |
|
|
echo ' <input type="submit" value="Start upgrade again" />';
|
432 |
|
|
echo '</form>';
|
433 |
|
|
}
|
434 |
|
|
if(defined('ADMIN_URL')) {
|
435 |
1866
|
Luisehahne
|
echo '<form action="'.ADMIN_URL.'/index.php" method="post">';
|
436 |
|
|
echo ' <input name="backend_send" type="submit" value="kick me to the Backend" />';
|
437 |
1457
|
Luisehahne
|
echo '</form>';
|
438 |
|
|
}
|
439 |
|
|
echo "<br /><br /></div>
|
440 |
1765
|
Luisehahne
|
</div>
|
441 |
|
|
</div>
|
442 |
1457
|
Luisehahne
|
</body>
|
443 |
1866
|
Luisehahne
|
</html>";
|
444 |
1765
|
Luisehahne
|
|
445 |
1894
|
Luisehahne
|
exit();
|
446 |
|
|
}
|
447 |
1457
|
Luisehahne
|
|
448 |
1765
|
Luisehahne
|
echo '<h3>Step '.(++$stepID).': Setting default_theme</h3>';
|
449 |
1768
|
Luisehahne
|
$aDebugMessage = array();
|
450 |
1894
|
Luisehahne
|
/**********************************************************
|
451 |
|
|
* - Adding field default_theme to settings table
|
452 |
|
|
*/
|
453 |
|
|
$aDebugMessage[] = '<div style="margin-left:2em;">';
|
454 |
|
|
$aDebugMessage[] = "<br /><span><strong>Adding default_theme to settings table</strong></span>";
|
455 |
|
|
// db_update_key_value('settings', 'default_theme', $DEFAULT_THEME);
|
456 |
|
|
$cfg = array(
|
457 |
1920
|
Luisehahne
|
'default_theme' => $DEFAULT_THEME
|
458 |
1894
|
Luisehahne
|
);
|
459 |
|
|
$aDebugMessage[] = (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
|
460 |
|
|
$aDebugMessage[] = '</div>';
|
461 |
1457
|
Luisehahne
|
|
462 |
1768
|
Luisehahne
|
if($bDebugModus) {
|
463 |
1894
|
Luisehahne
|
echo implode(PHP_EOL,$aDebugMessage);
|
464 |
1765
|
Luisehahne
|
}
|
465 |
1768
|
Luisehahne
|
$aDebugMessage = array();
|
466 |
1889
|
Luisehahne
|
echo'<h3>Step '.(++$stepID).': Updating core table included in package</h3>';
|
467 |
1894
|
Luisehahne
|
/**********************************************************
|
468 |
|
|
* - Adding field sec_anchor to settings table
|
469 |
|
|
*/
|
470 |
|
|
echo '<div style="margin-left:2em;">';
|
471 |
|
|
echo "<h4>Adding/updating entries on table settings</h4>";
|
472 |
|
|
$aDebugMessage[] = "<span>Adding/updating sec_anchor to settings table</span>";
|
473 |
|
|
$cfg = array(
|
474 |
1920
|
Luisehahne
|
'sec_anchor' => defined( 'SEC_ANCHOR' )&& (SEC_ANCHOR!='') ? SEC_ANCHOR : 'Sec'
|
475 |
1894
|
Luisehahne
|
);
|
476 |
|
|
$aDebugMessage[] = (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
|
477 |
1457
|
Luisehahne
|
|
478 |
1894
|
Luisehahne
|
/**********************************************************
|
479 |
|
|
* - Adding redirect timer to settings table
|
480 |
|
|
*/
|
481 |
|
|
$aDebugMessage[] = "<span>Adding/updating redirect timer to settings table</span>";
|
482 |
|
|
$cfg = array(
|
483 |
|
|
'redirect_timer' => defined('REDIRECT_TIMER')&& (REDIRECT_TIMER!='') ? REDIRECT_TIMER : '1500'
|
484 |
|
|
);
|
485 |
|
|
$aDebugMessage[] = (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
|
486 |
1484
|
Luisehahne
|
|
487 |
1894
|
Luisehahne
|
/**********************************************************
|
488 |
|
|
* - Adding default_time_formatr to settings table
|
489 |
|
|
*/
|
490 |
|
|
$aDebugMessage[] = "<span>Adding/updating default_time_format to settings table</span>";
|
491 |
|
|
$cfg = array(
|
492 |
|
|
'default_time_format' => defined('DEFAULT_TIME_FORMAT')&& (DEFAULT_TIME_FORMAT!='') ? DEFAULT_TIME_FORMAT : 'h:i A'
|
493 |
|
|
);
|
494 |
|
|
$aDebugMessage[] = (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
|
495 |
1889
|
Luisehahne
|
|
496 |
1894
|
Luisehahne
|
/**********************************************************
|
497 |
|
|
* - Adding rename_files_on_upload to settings table
|
498 |
|
|
*/
|
499 |
|
|
$aDebugMessage[] = "<span>Adding/Updating rename_files_on_upload to settings table</span>";
|
500 |
|
|
$cfg = array(
|
501 |
|
|
'rename_files_on_upload' => (defined('RENAME_FILES_ON_UPLOAD')&& (RENAME_FILES_ON_UPLOAD!='') ? RENAME_FILES_ON_UPLOAD : 'ph.*?,cgi,pl,pm,exe,com,bat,pif,cmd,src,asp,aspx,js')
|
502 |
|
|
);
|
503 |
|
|
if( version_compare( WB_VERSION, '2.8.2', '<' )) {
|
504 |
|
|
$cfg = array(
|
505 |
|
|
'rename_files_on_upload' => 'ph.*?,cgi,pl,pm,exe,com,bat,pif,cmd,src,asp,aspx,js'
|
506 |
|
|
);
|
507 |
|
|
}
|
508 |
|
|
$aDebugMessage[] = (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
|
509 |
1457
|
Luisehahne
|
|
510 |
1894
|
Luisehahne
|
/**********************************************************
|
511 |
|
|
* - Adding mediasettings to settings table
|
512 |
|
|
*/
|
513 |
|
|
$aDebugMessage[] = "<span>Adding/updating mediasettings to settings table</span>";
|
514 |
|
|
$cfg = array(
|
515 |
|
|
'mediasettings' => (defined('MEDIASETTINGS')&& (MEDIASETTINGS!='') ? MEDIASETTINGS : ''),
|
516 |
|
|
);
|
517 |
1671
|
Luisehahne
|
|
518 |
1894
|
Luisehahne
|
$aDebugMessage[] = (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
|
519 |
1671
|
Luisehahne
|
|
520 |
1894
|
Luisehahne
|
/**********************************************************
|
521 |
|
|
* - Adding fingerprint_with_ip_octets to settings table
|
522 |
|
|
*/
|
523 |
|
|
$aDebugMessage[] = "<span>Adding/updating fingerprint_with_ip_octets to settings table</span>";
|
524 |
|
|
$cfg = array(
|
525 |
|
|
'fingerprint_with_ip_octets' => (defined('FINGERPRINT_WITH_IP_OCTETS') ? FINGERPRINT_WITH_IP_OCTETS : '2'),
|
526 |
|
|
'secure_form_module' => (defined('SECURE_FORM_MODULE') ? SECURE_FORM_MODULE : '')
|
527 |
|
|
);
|
528 |
1671
|
Luisehahne
|
|
529 |
1894
|
Luisehahne
|
$aDebugMessage[] = (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
|
530 |
1671
|
Luisehahne
|
|
531 |
1894
|
Luisehahne
|
/**********************************************************
|
532 |
|
|
* - Adding page_icon_dir to settings table
|
533 |
|
|
*/
|
534 |
|
|
$aDebugMessage[] = "<span>Adding/updating page_icon_dir to settings table</span>";
|
535 |
|
|
$cfg = array(
|
536 |
|
|
'page_icon_dir' => (defined('PAGE_ICON_DIR')&& (PAGE_ICON_DIR!='') ? PAGE_ICON_DIR : '/templates/*/title_images'),
|
537 |
|
|
);
|
538 |
1731
|
Luisehahne
|
|
539 |
1894
|
Luisehahne
|
$aDebugMessage[] = (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
|
540 |
|
|
/**********************************************************
|
541 |
|
|
* - Adding page_extended to settings table
|
542 |
|
|
*/
|
543 |
|
|
$aDebugMessage[] = "<span>Adding/updating page_extendet to settings table</span>";
|
544 |
|
|
$cfg = array(
|
545 |
|
|
'page_extendet' => (defined('PAGE_EXTENDET') ? PAGE_EXTENDET : 'true'),
|
546 |
|
|
);
|
547 |
1745
|
Luisehahne
|
|
548 |
1894
|
Luisehahne
|
$aDebugMessage[] = (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
|
549 |
1457
|
Luisehahne
|
|
550 |
1894
|
Luisehahne
|
/**********************************************************
|
551 |
|
|
* - Adding wbmail_signature to settings table
|
552 |
|
|
*/
|
553 |
|
|
$aDebugMessage[] = "<span>Adding/updating wbmail_signature to settings table</span>";
|
554 |
|
|
$cfg = array(
|
555 |
|
|
'wbmail_signature' => (defined('WBMAIL_SIGNATURE')&& (WBMAIL_SIGNATURE!='') ? WBMAIL_SIGNATURE : '')
|
556 |
|
|
);
|
557 |
1671
|
Luisehahne
|
|
558 |
1894
|
Luisehahne
|
$aDebugMessage[] = (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
|
559 |
1765
|
Luisehahne
|
|
560 |
1894
|
Luisehahne
|
/**********************************************************
|
561 |
|
|
* - Adding confirmed_registration to settings table
|
562 |
|
|
*/
|
563 |
|
|
$aDebugMessage[] = "<span>Adding/updating confirmed_registration to settings table</span>";
|
564 |
|
|
$cfg = array(
|
565 |
|
|
'confirmed_registration' => (defined('CONFIRMED_REGISTRATION') ? CONFIRMED_REGISTRATION : '0')
|
566 |
|
|
);
|
567 |
1765
|
Luisehahne
|
|
568 |
1894
|
Luisehahne
|
$aDebugMessage[] = (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
|
569 |
1765
|
Luisehahne
|
|
570 |
1894
|
Luisehahne
|
/**********************************************************
|
571 |
|
|
* - Adding dev_infos to settings table
|
572 |
|
|
*/
|
573 |
|
|
$aDebugMessage[] = "<span>Adding/updating dev_infos to settings table</span>";
|
574 |
|
|
$cfg = array(
|
575 |
|
|
'dev_infos' => (defined('DEV_INFOS') ? DEV_INFOS : 'false')
|
576 |
|
|
);
|
577 |
1765
|
Luisehahne
|
|
578 |
1768
|
Luisehahne
|
$aDebugMessage[] = (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
|
579 |
1765
|
Luisehahne
|
|
580 |
1768
|
Luisehahne
|
if($bDebugModus) {
|
581 |
|
|
echo implode(PHP_EOL,$aDebugMessage);
|
582 |
1765
|
Luisehahne
|
}
|
583 |
1768
|
Luisehahne
|
echo '</div>';
|
584 |
1765
|
Luisehahne
|
|
585 |
1768
|
Luisehahne
|
$aDebugMessage = array();
|
586 |
1772
|
Luisehahne
|
if(version_compare(WB_REVISION, REVISION, '<='))
|
587 |
1671
|
Luisehahne
|
{
|
588 |
1894
|
Luisehahne
|
echo '<div style="margin-left:2em;">';
|
589 |
1671
|
Luisehahne
|
/**********************************************************
|
590 |
|
|
* - Update search no results database filed to create
|
591 |
|
|
* valid XHTML if search is empty
|
592 |
|
|
*/
|
593 |
|
|
if (version_compare(WB_VERSION, '2.8', '<'))
|
594 |
|
|
{
|
595 |
1894
|
Luisehahne
|
echo "<h4>Adding/updating fields on table search</h4>";
|
596 |
|
|
echo "Updating database field `no_results` on search table: ";
|
597 |
|
|
$search_no_results = addslashes('<tr><td><p>[TEXT_NO_RESULTS]</p></td></tr>');
|
598 |
|
|
$sql = 'UPDATE `'.TABLE_PREFIX.'search` ';
|
599 |
1671
|
Luisehahne
|
$sql .= 'SET `value`=\''.$search_no_results.'\' ';
|
600 |
|
|
$sql .= 'WHERE `name`=\'no_results\'';
|
601 |
1894
|
Luisehahne
|
echo ($database->query($sql)) ? " $OK<br />" : " $FAIL!<br />";
|
602 |
1671
|
Luisehahne
|
}
|
603 |
1760
|
Luisehahne
|
|
604 |
1894
|
Luisehahne
|
$aDebugMessage = array();
|
605 |
|
|
echo "<h4>Adding/updating field on table pages</h4>";
|
606 |
1671
|
Luisehahne
|
/**********************************************************
|
607 |
|
|
* - Add field "page_trail" to table "pages"
|
608 |
|
|
*/
|
609 |
|
|
$table_name = TABLE_PREFIX.'pages';
|
610 |
|
|
$field_name = 'page_trail';
|
611 |
|
|
$description = "VARCHAR( 255 ) NOT NULL DEFAULT ''";
|
612 |
1889
|
Luisehahne
|
add_modify_field_in_database($table_name,$field_name,$description);
|
613 |
1671
|
Luisehahne
|
|
614 |
|
|
/**********************************************************
|
615 |
1894
|
Luisehahne
|
* - Add field "page_icon" to table "pages"
|
616 |
|
|
*/
|
617 |
1671
|
Luisehahne
|
$table_name = TABLE_PREFIX.'pages';
|
618 |
|
|
$field_name = 'page_icon';
|
619 |
1684
|
Luisehahne
|
$description = "VARCHAR( 512 ) NOT NULL DEFAULT '' AFTER `page_title`";
|
620 |
1894
|
Luisehahne
|
add_modify_field_in_database($table_name,$field_name,$description);
|
621 |
1666
|
Luisehahne
|
|
622 |
1671
|
Luisehahne
|
/**********************************************************
|
623 |
|
|
* - Add field "page_code" to table "pages"
|
624 |
|
|
*/
|
625 |
|
|
$table_name = TABLE_PREFIX.'pages';
|
626 |
|
|
$field_name = 'page_code';
|
627 |
|
|
$description = "INT NOT NULL DEFAULT '0' AFTER `language`";
|
628 |
1894
|
Luisehahne
|
add_modify_field_in_database($table_name,$field_name,$description);
|
629 |
1671
|
Luisehahne
|
|
630 |
|
|
/**********************************************************
|
631 |
1894
|
Luisehahne
|
* - Add field "menu_icon_0" to table "pages"
|
632 |
|
|
*/
|
633 |
1671
|
Luisehahne
|
$table_name = TABLE_PREFIX.'pages';
|
634 |
|
|
$field_name = 'menu_icon_0';
|
635 |
1684
|
Luisehahne
|
$description = "VARCHAR( 512 ) NOT NULL DEFAULT '' AFTER `menu_title`";
|
636 |
1894
|
Luisehahne
|
add_modify_field_in_database($table_name,$field_name,$description);
|
637 |
1666
|
Luisehahne
|
|
638 |
1671
|
Luisehahne
|
/**********************************************************
|
639 |
|
|
* - Add field "menu_icon_1" to table "pages"
|
640 |
1894
|
Luisehahne
|
*/
|
641 |
1671
|
Luisehahne
|
$table_name = TABLE_PREFIX.'pages';
|
642 |
|
|
$field_name = 'menu_icon_1';
|
643 |
1684
|
Luisehahne
|
$description = "VARCHAR( 512 ) NOT NULL DEFAULT '' AFTER `menu_icon_0`";
|
644 |
1894
|
Luisehahne
|
add_modify_field_in_database($table_name,$field_name,$description);
|
645 |
1666
|
Luisehahne
|
|
646 |
1671
|
Luisehahne
|
/**********************************************************
|
647 |
1684
|
Luisehahne
|
* - Add field "tooltip" to table "pages"
|
648 |
1894
|
Luisehahne
|
*/
|
649 |
1684
|
Luisehahne
|
$table_name = TABLE_PREFIX.'pages';
|
650 |
|
|
$field_name = 'tooltip';
|
651 |
|
|
$description = "VARCHAR( 512 ) NOT NULL DEFAULT '' AFTER `menu_icon_1`";
|
652 |
1894
|
Luisehahne
|
add_modify_field_in_database($table_name,$field_name,$description);
|
653 |
1684
|
Luisehahne
|
|
654 |
|
|
/**********************************************************
|
655 |
1671
|
Luisehahne
|
* - Add field "admin_groups" to table "pages"
|
656 |
1894
|
Luisehahne
|
*/
|
657 |
1671
|
Luisehahne
|
$table_name = TABLE_PREFIX.'pages';
|
658 |
|
|
$field_name = 'admin_groups';
|
659 |
|
|
$description = "VARCHAR( 512 ) NOT NULL DEFAULT '1'";
|
660 |
1894
|
Luisehahne
|
add_modify_field_in_database($table_name,$field_name,$description);
|
661 |
1671
|
Luisehahne
|
|
662 |
|
|
/**********************************************************
|
663 |
|
|
* - Add field "admin_users" to table "pages"
|
664 |
|
|
*/
|
665 |
|
|
$table_name = TABLE_PREFIX.'pages';
|
666 |
|
|
$field_name = 'admin_users';
|
667 |
|
|
$description = "VARCHAR( 512 ) NOT NULL DEFAULT ''";
|
668 |
1894
|
Luisehahne
|
add_modify_field_in_database($table_name,$field_name,$description);
|
669 |
1671
|
Luisehahne
|
|
670 |
|
|
/**********************************************************
|
671 |
|
|
* - Add field "viewing_groups" to table "pages"
|
672 |
|
|
*/
|
673 |
|
|
$table_name = TABLE_PREFIX.'pages';
|
674 |
|
|
$field_name = 'viewing_groups';
|
675 |
|
|
$description = "VARCHAR( 512 ) NOT NULL DEFAULT '1'";
|
676 |
1894
|
Luisehahne
|
add_modify_field_in_database($table_name,$field_name,$description);
|
677 |
1671
|
Luisehahne
|
|
678 |
|
|
/**********************************************************
|
679 |
|
|
* - Add field "viewing_users" to table "pages"
|
680 |
|
|
*/
|
681 |
|
|
$table_name = TABLE_PREFIX.'pages';
|
682 |
|
|
$field_name = 'viewing_users';
|
683 |
|
|
$description = "VARCHAR( 512 ) NOT NULL DEFAULT ''";
|
684 |
1894
|
Luisehahne
|
add_modify_field_in_database($table_name,$field_name,$description);
|
685 |
1755
|
Luisehahne
|
|
686 |
1768
|
Luisehahne
|
/**********************************************************
|
687 |
1894
|
Luisehahne
|
* - Add field "custom01" to table "pages"
|
688 |
|
|
*/
|
689 |
1768
|
Luisehahne
|
$table_name = TABLE_PREFIX.'pages';
|
690 |
|
|
$field_name = 'custom01';
|
691 |
|
|
$description = "VARCHAR( 255 ) NOT NULL DEFAULT '' ";
|
692 |
1894
|
Luisehahne
|
add_modify_field_in_database($table_name,$field_name,$description);
|
693 |
1760
|
Luisehahne
|
|
694 |
1768
|
Luisehahne
|
/**********************************************************
|
695 |
1894
|
Luisehahne
|
* - Add field "custom02" to table "pages"
|
696 |
|
|
*/
|
697 |
1768
|
Luisehahne
|
$table_name = TABLE_PREFIX.'pages';
|
698 |
|
|
$field_name = 'custom02';
|
699 |
|
|
$description = "VARCHAR( 255 ) NOT NULL DEFAULT '' ";
|
700 |
1894
|
Luisehahne
|
add_modify_field_in_database($table_name,$field_name,$description);
|
701 |
1768
|
Luisehahne
|
|
702 |
1894
|
Luisehahne
|
if($bDebugModus) {
|
703 |
|
|
echo implode(PHP_EOL,$aDebugMessage);
|
704 |
|
|
}
|
705 |
1772
|
Luisehahne
|
|
706 |
1866
|
Luisehahne
|
$aDebugMessage = array();
|
707 |
|
|
/**********************************************************
|
708 |
1894
|
Luisehahne
|
* modify wrong strucre on table sections
|
709 |
|
|
* wrong structure let crash wb
|
710 |
|
|
*/
|
711 |
1765
|
Luisehahne
|
echo "<h4>Change field structure on table sections</h4>";
|
712 |
|
|
$table_name = TABLE_PREFIX.'sections';
|
713 |
|
|
$description = "VARCHAR( 255 ) NOT NULL DEFAULT ''";
|
714 |
1772
|
Luisehahne
|
$aDebugMessage[] = "<span>Modify field module on sections table</span>";
|
715 |
|
|
$aDebugMessage[] = ($database->field_modify($table_name, 'module', $description) ? " $OK<br />" : " $FAIL!<br />");
|
716 |
|
|
$aDebugMessage[] = "<span>Modify field block on sections table</span>";
|
717 |
1889
|
Luisehahne
|
$description = "int(11) NOT NULL DEFAULT '1'";
|
718 |
1772
|
Luisehahne
|
$aDebugMessage[] = ($database->field_modify($table_name, 'block', $description) ? " $OK<br />" : " $FAIL!<br />");
|
719 |
1889
|
Luisehahne
|
$description = "int(11) NOT NULL DEFAULT '0'";
|
720 |
1772
|
Luisehahne
|
$aDebugMessage[] = "<span>Modify field publ_start on sections table</span>";
|
721 |
|
|
$aDebugMessage[] = ($database->field_modify($table_name, 'publ_start', $description) ? " $OK<br />" : " $FAIL!<br />");
|
722 |
|
|
$aDebugMessage[] = "<span>Modify field publ_end on sections table</span>";
|
723 |
|
|
$aDebugMessage[] = ($database->field_modify($table_name, 'publ_end', $description) ? " $OK<br />" : " $FAIL!<br />");
|
724 |
1755
|
Luisehahne
|
|
725 |
1894
|
Luisehahne
|
if($bDebugModus) {
|
726 |
|
|
echo implode(PHP_EOL,$aDebugMessage);
|
727 |
|
|
}
|
728 |
|
|
echo '</div>';
|
729 |
1890
|
Luisehahne
|
}
|
730 |
1772
|
Luisehahne
|
|
731 |
1890
|
Luisehahne
|
if(version_compare(WB_REVISION, REVISION, '<='))
|
732 |
|
|
{
|
733 |
1894
|
Luisehahne
|
$aDebugMessage = array();
|
734 |
|
|
echo '<h3>Step '.(++$stepID).': Updating structure in table users/groups</h3>';
|
735 |
1789
|
Luisehahne
|
/**********************************************************
|
736 |
1890
|
Luisehahne
|
* Modify Administrator on groups table
|
737 |
|
|
*/
|
738 |
|
|
echo '<div style="margin-left:2em;">';
|
739 |
1893
|
Luisehahne
|
echo "<h4>Updating Administrator group permissions on table groups</h4>";
|
740 |
1789
|
Luisehahne
|
$aDebugMessage[] = "<span>Modify Administrator on groups table</span>";
|
741 |
1866
|
Luisehahne
|
$sModulePermissions = '';
|
742 |
|
|
$sTemplatePermissions = '';
|
743 |
1789
|
Luisehahne
|
$sSystemPermissions = 'access,addons,admintools,admintools_view,groups,groups_add,groups_delete,groups_modify,groups_view,';
|
744 |
|
|
$sSystemPermissions .= 'languages,languages_install,languages_uninstall,languages_view,media,media_create,media_delete,media_rename,media_upload,media_view,';
|
745 |
|
|
$sSystemPermissions .= 'modules,modules_advanced,modules_install,modules_uninstall,modules_view,pages,pages_add,pages_add_l0,pages_delete,pages_intro,pages_modify,pages_settings,pages_view,';
|
746 |
|
|
$sSystemPermissions .= 'preferences,preferences_view,settings,settings_advanced,settings_basic,settings_view,templates,templates_install,templates_uninstall,templates_view,users,users_add,users_delete,users_modify,users_view';
|
747 |
|
|
|
748 |
|
|
$sql = 'UPDATE `'.TABLE_PREFIX.'groups` ';
|
749 |
|
|
$sql .= 'SET `name` = \'Administrators\', ';
|
750 |
|
|
$sql .= '`system_permissions` = \''.$sSystemPermissions.'\', ';
|
751 |
|
|
$sql .= '`module_permissions` = \''.$sModulePermissions.'\', ';
|
752 |
|
|
$sql .= '`template_permissions` = \''.$sTemplatePermissions.'\' ';
|
753 |
|
|
$sql .= 'WHERE `group_id` = \'1\' ';
|
754 |
1894
|
Luisehahne
|
$aDebugMessage[] = ($database->query($sql)) ? " $OK<br />" : " $FAIL!<br />";
|
755 |
|
|
if( ($admin->is_authenticated() == true) && ($admin->ami_group_member('1') ) ) {
|
756 |
|
|
$_SESSION['SYSTEM_PERMISSIONS'] = array_merge($_SESSION['SYSTEM_PERMISSIONS'], explode(',', $sSystemPermissions));
|
757 |
|
|
}
|
758 |
1789
|
Luisehahne
|
|
759 |
1894
|
Luisehahne
|
if($bDebugModus) {
|
760 |
|
|
echo implode(PHP_EOL,$aDebugMessage);
|
761 |
|
|
}
|
762 |
|
|
echo '</div>';
|
763 |
1890
|
Luisehahne
|
$aDebugMessage = array();
|
764 |
|
|
/**********************************************************
|
765 |
1894
|
Luisehahne
|
* `confirm_code` VARCHAR(32) NOT NULL DEFAULT '',
|
766 |
|
|
* `confirm_timeout` INT(11) NOT NULL DEFAULT '0',
|
767 |
|
|
*/
|
768 |
1890
|
Luisehahne
|
echo '<div style="margin-left:2em;">';
|
769 |
|
|
echo "<h4>Change field structure on table users</h4>";
|
770 |
|
|
$table_name = TABLE_PREFIX.'users';
|
771 |
|
|
$field_name = 'confirm_code';
|
772 |
|
|
$description = "VARCHAR( 32 ) NOT NULL DEFAULT '' AFTER `password` ";
|
773 |
1894
|
Luisehahne
|
add_modify_field_in_database($table_name,$field_name,$description);
|
774 |
1671
|
Luisehahne
|
|
775 |
1890
|
Luisehahne
|
$table_name = TABLE_PREFIX.'users';
|
776 |
|
|
$field_name = 'confirm_timeout';
|
777 |
|
|
$description = "INT(11) NOT NULL DEFAULT '0' AFTER `confirm_code` ";
|
778 |
1894
|
Luisehahne
|
add_modify_field_in_database($table_name,$field_name,$description);
|
779 |
1890
|
Luisehahne
|
|
780 |
1894
|
Luisehahne
|
if($bDebugModus) {
|
781 |
|
|
echo implode(PHP_EOL,$aDebugMessage);
|
782 |
|
|
}
|
783 |
|
|
echo '</div>';
|
784 |
1893
|
Luisehahne
|
|
785 |
1894
|
Luisehahne
|
$aDebugMessage = array();
|
786 |
|
|
/**********************************************************
|
787 |
|
|
* Updating group_id in table users
|
788 |
|
|
*/
|
789 |
1890
|
Luisehahne
|
echo '<div style="margin-left:2em;">';
|
790 |
1893
|
Luisehahne
|
echo "<h4>Updating users groups permissions on table groups</h4>";
|
791 |
1894
|
Luisehahne
|
$aUsers = array();
|
792 |
1813
|
Luisehahne
|
// Get existing values
|
793 |
|
|
$sql = 'SELECT * FROM `'.TABLE_PREFIX.'users` ' ;
|
794 |
|
|
$sql .= 'WHERE `user_id` != 1 ';
|
795 |
|
|
if($oUser = $database->query($sql)){
|
796 |
|
|
$iTotalUsers = $oUser->numRows();
|
797 |
|
|
while($Users = $oUser->fetchRow(MYSQL_ASSOC)) {
|
798 |
|
|
$aUsers[$Users['user_id']]['groups_id'] = $Users['groups_id'];
|
799 |
|
|
$aUsers[$Users['user_id']]['display_name'] = $Users['display_name'];
|
800 |
|
|
}
|
801 |
|
|
} else {
|
802 |
|
|
$aDebugMessage[] = $database->is_error()==false ? " $OK<br />" : " $FAIL!<br />";
|
803 |
|
|
}
|
804 |
|
|
foreach($aUsers AS $user_id => $value){
|
805 |
|
|
// choose group_id from groups_id - workaround for still remaining calls to group_id (to be cleaned-up)
|
806 |
1815
|
Luisehahne
|
$aGroups_id = explode(',', $aUsers[$user_id]['groups_id']);
|
807 |
|
|
$groups_id = $aUsers[$user_id]['groups_id'];
|
808 |
1813
|
Luisehahne
|
$group_id = 0;
|
809 |
|
|
//if user is in administrator-group, get this group else just get the first one
|
810 |
1815
|
Luisehahne
|
if($admin->is_group_match($aGroups_id,'1')) { $group_id = 1; $groups_id = '1'; } else { $group_id = intval($aGroups_id[0]); }
|
811 |
1813
|
Luisehahne
|
$sMessage = "<span>Updating group_id ".$TEXT['DISPLAY_NAME']." " .$aUsers[$user_id]['display_name']."</span>";
|
812 |
|
|
$sql = 'UPDATE `'.TABLE_PREFIX.'users` ';
|
813 |
1815
|
Luisehahne
|
$sql .= 'SET `group_id` = '.$group_id.', ';
|
814 |
1817
|
Luisehahne
|
$sql .= '`groups_id` = \''.$groups_id.'\' ';
|
815 |
1813
|
Luisehahne
|
$sql .= 'WHERE `user_id` = '.intval($user_id);
|
816 |
|
|
if($oRes = $database->query($sql)){ }
|
817 |
|
|
$aDebugMessage[] = $database->is_error()==false ? $sMessage." $OK<br />" : $sMessage." $FAIL!<br />";
|
818 |
|
|
}
|
819 |
|
|
unset($aUsers);
|
820 |
1894
|
Luisehahne
|
$aDebugMessage[] = '</div>';
|
821 |
1813
|
Luisehahne
|
|
822 |
1894
|
Luisehahne
|
if($bDebugModus) {
|
823 |
|
|
// $aDebugMessage[] =
|
824 |
|
|
echo implode(PHP_EOL,$aDebugMessage);
|
825 |
|
|
}else {
|
826 |
|
|
echo '<span><strong>'.$iTotalUsers.' users updating the groups</strong></span>'." $OK<br />";
|
827 |
|
|
echo '</div>';
|
828 |
|
|
}
|
829 |
1813
|
Luisehahne
|
}
|
830 |
|
|
|
831 |
|
|
$aDebugMessage = array();
|
832 |
1866
|
Luisehahne
|
echo '<h3>Step '.(++$stepID).': Updating access and protected files in folders</h3>';
|
833 |
1765
|
Luisehahne
|
|
834 |
|
|
echo '<div style="margin-left:2em;">';
|
835 |
1894
|
Luisehahne
|
/**********************************************************
|
836 |
|
|
* upgrade media directory index protect files
|
837 |
|
|
*/
|
838 |
|
|
$dir = (WB_PATH.MEDIA_DIRECTORY);
|
839 |
|
|
echo '<h4>Upgrade media directory '.MEDIA_DIRECTORY.'/ index.php protect files</h4>';
|
840 |
|
|
$aDebugMessage = rebuildFolderProtectFile($dir);
|
841 |
|
|
if( sizeof( $aDebugMessage ) ){
|
842 |
|
|
echo '<span><strong>Upgrade '.sizeof( $aDebugMessage ).' directory '.MEDIA_DIRECTORY.'/ protect files</strong></span>'." $OK<br />";
|
843 |
|
|
} else {
|
844 |
|
|
echo '<span><strong>Upgrade directory '.MEDIA_DIRECTORY.'/ protect files</strong></span>'." $FAIL!<br />";
|
845 |
|
|
echo implode ('<br />',$aDebugMessage);
|
846 |
|
|
}
|
847 |
1677
|
Luisehahne
|
|
848 |
1866
|
Luisehahne
|
$aDebugMessage = array();
|
849 |
1765
|
Luisehahne
|
/**********************************************************
|
850 |
|
|
* upgrade pages directory index access files
|
851 |
|
|
*/
|
852 |
|
|
echo '<h4>Upgrade pages directory '.PAGES_DIRECTORY.'/ protect and access files</h4>';
|
853 |
1677
|
Luisehahne
|
|
854 |
1765
|
Luisehahne
|
/**********************************************************
|
855 |
|
|
* - Reformat/rebuild all existing access files
|
856 |
|
|
*/
|
857 |
|
|
$sPagePath = (defined('PAGES_DIRECTORY') && (PAGES_DIRECTORY != '') ? PAGES_DIRECTORY : '');
|
858 |
|
|
$msg = rebuild_all_accessfiles();
|
859 |
1920
|
Luisehahne
|
$dir = (WB_PATH.PAGES_DIRECTORY);
|
860 |
|
|
// $aDebugMessage = rebuildFolderProtectFile($dir);
|
861 |
1866
|
Luisehahne
|
echo '<strong>'.implode ('<br />',$msg).'</strong>';
|
862 |
1765
|
Luisehahne
|
echo '</div>';
|
863 |
1866
|
Luisehahne
|
|
864 |
1883
|
Luisehahne
|
/* *****************************************************************************
|
865 |
|
|
* - check for deprecated / never needed files
|
866 |
|
|
*/
|
867 |
|
|
$iLoaded = sizeof($aFilesToRemove);
|
868 |
|
|
if($iLoaded) {
|
869 |
|
|
echo '<h3>Step '.(++$stepID).': Remove deprecated and outdated files</h3>';
|
870 |
|
|
$iFailed = 0;
|
871 |
|
|
$iFound = 0;
|
872 |
|
|
$searches = array(
|
873 |
|
|
'[ADMIN]',
|
874 |
|
|
'[MEDIA]',
|
875 |
|
|
'[PAGES]',
|
876 |
|
|
'[FRAMEWORK]',
|
877 |
|
|
'[MODULES]',
|
878 |
|
|
'[TEMPLATE]'
|
879 |
|
|
);
|
880 |
|
|
$replacements = array(
|
881 |
|
|
'/'.substr(ADMIN_PATH, strlen(WB_PATH)+1),
|
882 |
|
|
MEDIA_DIRECTORY,
|
883 |
|
|
PAGES_DIRECTORY,
|
884 |
|
|
'/framework',
|
885 |
|
|
'/modules',
|
886 |
|
|
'/templates'
|
887 |
|
|
);
|
888 |
1677
|
Luisehahne
|
|
889 |
1532
|
Luisehahne
|
$msg = '';
|
890 |
1883
|
Luisehahne
|
echo '<div style="margin-left:2em;">';
|
891 |
|
|
echo '<h4>Search '.$iLoaded.' deprecated and outdated files</h4>';
|
892 |
|
|
foreach( $aFilesToRemove as $file )
|
893 |
|
|
{
|
894 |
1532
|
Luisehahne
|
$file = str_replace($searches, $replacements, $file);
|
895 |
1765
|
Luisehahne
|
if( is_writable(WB_PATH.'/'.$file) ) {
|
896 |
1883
|
Luisehahne
|
$iFound++;
|
897 |
1588
|
darkviper
|
// try to unlink file
|
898 |
1765
|
Luisehahne
|
if(!unlink(WB_PATH.$file)) {
|
899 |
1883
|
Luisehahne
|
$iFailed++;
|
900 |
1801
|
Luisehahne
|
}
|
901 |
1484
|
Luisehahne
|
}
|
902 |
1883
|
Luisehahne
|
if( is_readable(WB_PATH.'/'.$file) ) {
|
903 |
|
|
// save in err-list, if failed
|
904 |
|
|
$msg .= $file.'<br />';
|
905 |
|
|
}
|
906 |
|
|
}
|
907 |
|
|
$iRemove = $iFound-$iFailed;
|
908 |
|
|
echo '<strong>Remove '.$iRemove.' from '.$iFound.' founded</strong> ';
|
909 |
|
|
echo ($iFailed == 0) ? $OK : $FAIL;
|
910 |
|
|
echo '</div>';
|
911 |
1532
|
Luisehahne
|
|
912 |
|
|
if($msg != '')
|
913 |
|
|
{
|
914 |
|
|
$msg = '<br /><br />Following files are deprecated, outdated or a security risk and
|
915 |
|
|
can not be removed automatically.<br /><br />Please delete them
|
916 |
|
|
using FTP and restart upgrade-script!<br /><br />'.$msg.'<br />';
|
917 |
1889
|
Luisehahne
|
status_msg($msg, 'error warning', 'div');
|
918 |
1532
|
Luisehahne
|
echo '<p style="font-size:120%;"><strong>WARNING: The upgrade script failed ...</strong></p>';
|
919 |
|
|
|
920 |
|
|
echo '<form action="'.$_SERVER['SCRIPT_NAME'].'">';
|
921 |
|
|
echo ' <input name="send" type="submit" value="Restart upgrade script" />';
|
922 |
|
|
echo '</form>';
|
923 |
1866
|
Luisehahne
|
echo "<br /><br /></div>
|
924 |
|
|
</div>
|
925 |
|
|
</div>
|
926 |
|
|
</body>
|
927 |
|
|
</html>";
|
928 |
1532
|
Luisehahne
|
exit;
|
929 |
|
|
}
|
930 |
1889
|
Luisehahne
|
}
|
931 |
1484
|
Luisehahne
|
|
932 |
1532
|
Luisehahne
|
|
933 |
1883
|
Luisehahne
|
/**********************************************************
|
934 |
|
|
* - check for deprecated / never needed files
|
935 |
|
|
*/
|
936 |
|
|
$iLoaded = sizeof($dirRemove);
|
937 |
|
|
if($iLoaded) {
|
938 |
|
|
echo '<h3>Step '.(++$stepID).': Remove deprecated and outdated folders</h3>';
|
939 |
|
|
$iFailed = 0;
|
940 |
|
|
$iFound = 0;
|
941 |
1588
|
darkviper
|
$searches = array(
|
942 |
|
|
'[ADMIN]',
|
943 |
|
|
'[MEDIA]',
|
944 |
|
|
'[PAGES]',
|
945 |
|
|
'[TEMPLATE]'
|
946 |
|
|
);
|
947 |
|
|
$replacements = array(
|
948 |
|
|
substr(ADMIN_PATH, strlen(WB_PATH)+1),
|
949 |
|
|
MEDIA_DIRECTORY,
|
950 |
|
|
PAGES_DIRECTORY,
|
951 |
|
|
'/templates',
|
952 |
|
|
);
|
953 |
|
|
$msg = '';
|
954 |
1883
|
Luisehahne
|
echo '<div style="margin-left:2em;">';
|
955 |
|
|
echo '<h4>Search '.$iLoaded.' deprecated and outdated folders</h4>';
|
956 |
1588
|
darkviper
|
foreach( $dirRemove as $dir ) {
|
957 |
|
|
$dir = str_replace($searches, $replacements, $dir);
|
958 |
|
|
$dir = WB_PATH.'/'.$dir;
|
959 |
|
|
if( is_dir( $dir )) {
|
960 |
1883
|
Luisehahne
|
$iFound++;
|
961 |
1588
|
darkviper
|
// try to delete dir
|
962 |
1641
|
Luisehahne
|
if(!is_writable( $dir ) || !rm_full_dir($dir)) {
|
963 |
1588
|
darkviper
|
// save in err-list, if failed
|
964 |
1883
|
Luisehahne
|
$iFailed++;
|
965 |
1588
|
darkviper
|
}
|
966 |
1525
|
Luisehahne
|
}
|
967 |
1883
|
Luisehahne
|
if( is_readable(WB_PATH.'/'.$dir) ) {
|
968 |
|
|
$msg .= str_replace(WB_PATH,'',$dir).'<br />';
|
969 |
|
|
}
|
970 |
1525
|
Luisehahne
|
}
|
971 |
1883
|
Luisehahne
|
|
972 |
|
|
$iRemove = $iFound-$iFailed;
|
973 |
|
|
echo '<strong>Remove '.$iRemove.' from '.$iFound.' founded</strong> ';
|
974 |
|
|
echo ($iFailed == 0) ? $OK : $FAIL;
|
975 |
|
|
echo '</div>';
|
976 |
1765
|
Luisehahne
|
|
977 |
1588
|
darkviper
|
if($msg != '') {
|
978 |
1641
|
Luisehahne
|
$msg = '<br /><br />Following directories are deprecated, outdated or a security risk and
|
979 |
1588
|
darkviper
|
can not be removed automatically.<br /><br />Please delete them
|
980 |
|
|
using FTP and restart upgrade-script!<br /><br />'.$msg.'<br />';
|
981 |
|
|
status_msg($msg, 'error warning', 'div');
|
982 |
|
|
echo '<p style="font-size:120%;"><strong>WARNING: The upgrade script failed ...</strong></p>';
|
983 |
|
|
echo '<form action="'.$_SERVER['SCRIPT_NAME'].'">';
|
984 |
|
|
echo ' <input name="send" type="submit" value="Restart upgrade script" />';
|
985 |
|
|
echo '</form>';
|
986 |
1866
|
Luisehahne
|
echo "<br /><br /></div>
|
987 |
|
|
</div>
|
988 |
|
|
</div>
|
989 |
|
|
</body>
|
990 |
|
|
</html>";
|
991 |
1588
|
darkviper
|
exit;
|
992 |
|
|
}
|
993 |
1883
|
Luisehahne
|
|
994 |
|
|
|
995 |
1525
|
Luisehahne
|
}
|
996 |
1532
|
Luisehahne
|
|
997 |
1883
|
Luisehahne
|
/**********************************************************
|
998 |
|
|
* upgrade modules if newer version is available
|
999 |
|
|
* $aModuleList list of proofed modules
|
1000 |
|
|
*/
|
1001 |
1894
|
Luisehahne
|
$aModuleList = array(
|
1002 |
1920
|
Luisehahne
|
'captcha_control','code','droplets','form','jsadmin',
|
1003 |
|
|
'menu_link','news','output_filter','wrapper','wysiwyg','MultiLingual');
|
1004 |
1866
|
Luisehahne
|
if(sizeof($aModuleList))
|
1005 |
|
|
{
|
1006 |
1890
|
Luisehahne
|
echo '<h3>Step '.(++$stepID).': Upgrade proofed modules</h3>';
|
1007 |
1866
|
Luisehahne
|
foreach($aModuleList as $sModul) {
|
1008 |
|
|
if(file_exists(WB_PATH.'/modules/'.$sModul.'/upgrade.php')) {
|
1009 |
|
|
$currModulVersion = get_modul_version ($sModul, false);
|
1010 |
|
|
$newModulVersion = get_modul_version ($sModul, true);
|
1011 |
|
|
if((version_compare($currModulVersion, $newModulVersion) <= 0)) {
|
1012 |
1883
|
Luisehahne
|
echo '<div style="margin-left:2em;">';
|
1013 |
1866
|
Luisehahne
|
echo '<h4>'.'Upgrade module \''.$sModul.'\' version '.$newModulVersion.'</h4>';
|
1014 |
|
|
require(WB_PATH.'/modules/'.$sModul.'/upgrade.php');
|
1015 |
1883
|
Luisehahne
|
echo '</div>';
|
1016 |
1866
|
Luisehahne
|
}
|
1017 |
1588
|
darkviper
|
}
|
1018 |
|
|
}
|
1019 |
1525
|
Luisehahne
|
}
|
1020 |
1765
|
Luisehahne
|
|
1021 |
1883
|
Luisehahne
|
/**********************************************************
|
1022 |
|
|
* Reformat/rebuild all existing moules access files
|
1023 |
|
|
* $aModuleList list of modules
|
1024 |
|
|
*/
|
1025 |
|
|
$aModuleList = array('bakery','topics','news');
|
1026 |
1866
|
Luisehahne
|
if(sizeof($aModuleList))
|
1027 |
|
|
{
|
1028 |
|
|
echo '<h3>Step '.(++$stepID).': Create/Reorg Accessfiles from modules</h3>';
|
1029 |
|
|
foreach($aModuleList as $sModul) {
|
1030 |
|
|
$aReturnMsg = array();
|
1031 |
|
|
$sModulReorg = 'm_'.$sModul.'_Reorg';
|
1032 |
|
|
if(class_exists($sModulReorg)) {
|
1033 |
|
|
$sModulVersion = get_modul_version ($sModul, true);
|
1034 |
|
|
echo '<div style="margin-left:2em;">';
|
1035 |
|
|
echo '<h4>'.'Create/Reorg Accesfiles for module \''.$sModul.'\' version '.$sModulVersion.'</h4>';
|
1036 |
|
|
$oReorg = new $sModulReorg();
|
1037 |
|
|
$aReturnMsg = $oReorg->execute(); // show details
|
1038 |
1881
|
Luisehahne
|
if(is_array($aReturnMsg)) {
|
1039 |
1866
|
Luisehahne
|
foreach($aReturnMsg as $title) {
|
1040 |
|
|
echo '<strong>'.$title.'</strong><br />';
|
1041 |
|
|
}
|
1042 |
|
|
}
|
1043 |
|
|
echo '</div>';
|
1044 |
|
|
}
|
1045 |
|
|
}
|
1046 |
|
|
}
|
1047 |
1525
|
Luisehahne
|
/**********************************************************
|
1048 |
1457
|
Luisehahne
|
* - Reload all addons
|
1049 |
|
|
*/
|
1050 |
|
|
|
1051 |
1765
|
Luisehahne
|
echo '<h3>Step '.(++$stepID).' : Reload all addons database entry (no upgrade)</h3><br />';
|
1052 |
1883
|
Luisehahne
|
echo '<div style="margin-left:2em;">';
|
1053 |
|
|
$iFound = 0;
|
1054 |
|
|
$iLoaded = 0;
|
1055 |
1588
|
darkviper
|
////delete modules
|
1056 |
|
|
//$database->query("DELETE FROM ".TABLE_PREFIX."addons WHERE type = 'module'");
|
1057 |
|
|
// Load all modules
|
1058 |
|
|
if( ($handle = opendir(WB_PATH.'/modules/')) ) {
|
1059 |
|
|
while(false !== ($file = readdir($handle))) {
|
1060 |
1769
|
Luisehahne
|
if($file != '' && substr($file, 0, 1) != '.' && is_dir(WB_PATH.'/modules/'.$file) ) {
|
1061 |
1889
|
Luisehahne
|
$iFound++;
|
1062 |
1765
|
Luisehahne
|
$iLoaded = load_module(WB_PATH.'/modules/'.$file ) ? $iLoaded+1 : $iLoaded;
|
1063 |
1889
|
Luisehahne
|
// upgrade_module($file, true);
|
1064 |
1588
|
darkviper
|
}
|
1065 |
1457
|
Luisehahne
|
}
|
1066 |
1588
|
darkviper
|
closedir($handle);
|
1067 |
1457
|
Luisehahne
|
}
|
1068 |
1866
|
Luisehahne
|
echo '<strong><span>'.$iLoaded.' Modules reloaded,</span> found '.$iFound.' directories in folder /modules/</strong><br />';
|
1069 |
1457
|
Luisehahne
|
|
1070 |
1889
|
Luisehahne
|
$iFound = 0;
|
1071 |
|
|
$iLoaded = 0;
|
1072 |
1588
|
darkviper
|
////delete templates
|
1073 |
|
|
//$database->query("DELETE FROM ".TABLE_PREFIX."addons WHERE type = 'template'");
|
1074 |
|
|
// Load all templates
|
1075 |
|
|
if( ($handle = opendir(WB_PATH.'/templates/')) ) {
|
1076 |
|
|
while(false !== ($file = readdir($handle))) {
|
1077 |
|
|
if($file != '' AND substr($file, 0, 1) != '.' AND $file != 'index.php') {
|
1078 |
1769
|
Luisehahne
|
|
1079 |
1889
|
Luisehahne
|
$iFound++;
|
1080 |
1765
|
Luisehahne
|
$iLoaded = (load_template(WB_PATH.'/templates/'.$file)==true) ? $iLoaded+1 : $iLoaded;
|
1081 |
1769
|
Luisehahne
|
|
1082 |
1588
|
darkviper
|
}
|
1083 |
1457
|
Luisehahne
|
}
|
1084 |
1588
|
darkviper
|
closedir($handle);
|
1085 |
1457
|
Luisehahne
|
}
|
1086 |
1866
|
Luisehahne
|
echo '<strong><span>'.$iLoaded.' Templates reloaded,</span> found '.$iFound.' directories in folder /templates/</strong><br />';
|
1087 |
1457
|
Luisehahne
|
|
1088 |
1889
|
Luisehahne
|
$iFound = 0;
|
1089 |
|
|
$iLoaded = 0;
|
1090 |
1588
|
darkviper
|
////delete languages
|
1091 |
|
|
//$database->query("DELETE FROM ".TABLE_PREFIX."addons WHERE type = 'language'");
|
1092 |
|
|
// Load all languages
|
1093 |
|
|
if( ($handle = opendir(WB_PATH.'/languages/')) ) {
|
1094 |
|
|
while(false !== ($file = readdir($handle))) {
|
1095 |
1769
|
Luisehahne
|
if($file != '' AND (preg_match('#^([A-Z]{2}.php)#', basename($file)))) {
|
1096 |
1889
|
Luisehahne
|
$iFound++;
|
1097 |
1765
|
Luisehahne
|
$iLoaded = load_language(WB_PATH.'/languages/'.$file) ? $iLoaded+1 : $iLoaded;
|
1098 |
1588
|
darkviper
|
}
|
1099 |
1457
|
Luisehahne
|
}
|
1100 |
1588
|
darkviper
|
closedir($handle);
|
1101 |
1457
|
Luisehahne
|
}
|
1102 |
1866
|
Luisehahne
|
echo '<strong><span>'.$iLoaded.' Languages reloaded,</span> found '.$iFound.' files in folder /languages/</strong><br />';
|
1103 |
1889
|
Luisehahne
|
echo '</div>';
|
1104 |
1457
|
Luisehahne
|
|
1105 |
|
|
/**********************************************************
|
1106 |
1671
|
Luisehahne
|
* - install new droplets
|
1107 |
|
|
$drops = (!in_array ( "mod_droplets", $all_tables)) ? "<br />Install droplets<br />" : "<br />Upgrade droplets<br />";
|
1108 |
|
|
echo $drops;
|
1109 |
|
|
$file_name = (!in_array ( "mod_droplets", $all_tables) ? "install.php" : "upgrade.php");
|
1110 |
|
|
require_once (WB_PATH."/modules/droplets/".$file_name);
|
1111 |
|
|
********************************************************** */
|
1112 |
|
|
|
1113 |
|
|
/**********************************************************
|
1114 |
1457
|
Luisehahne
|
* - End of upgrade script
|
1115 |
|
|
*/
|
1116 |
1588
|
darkviper
|
if(!defined('DEFAULT_THEME')) { define('DEFAULT_THEME', $DEFAULT_THEME); }
|
1117 |
|
|
if(!defined('THEME_PATH')) { define('THEME_PATH', WB_PATH.'/templates/'.DEFAULT_THEME);}
|
1118 |
1532
|
Luisehahne
|
/**********************************************************
|
1119 |
|
|
* - Set Version to new Version
|
1120 |
|
|
*/
|
1121 |
1765
|
Luisehahne
|
echo '<h3>Step '.(++$stepID).': Update database version number </h3>';
|
1122 |
|
|
echo '<div style="margin-left:2em;">';
|
1123 |
1457
|
Luisehahne
|
|
1124 |
1671
|
Luisehahne
|
$cfg = array(
|
1125 |
|
|
'wb_version' => VERSION,
|
1126 |
|
|
'wb_revision' => REVISION,
|
1127 |
|
|
'wb_sp' => SP
|
1128 |
|
|
);
|
1129 |
1883
|
Luisehahne
|
echo '<br /><span><strong>Set WebsiteBaker version number to '.VERSION.' '.SP.' '.' Revision ['.REVISION.'] : </strong></span>';
|
1130 |
1671
|
Luisehahne
|
echo (db_update_key_value( 'settings', $cfg ) ? " $OK<br />" : " $FAIL!<br />");
|
1131 |
1765
|
Luisehahne
|
echo '</div>';
|
1132 |
1671
|
Luisehahne
|
|
1133 |
1765
|
Luisehahne
|
echo '<p style="font-size:140%;"><strong>Congratulations: The upgrade script is finished ...</strong></p>';
|
1134 |
|
|
status_msg('<strong>:</strong><br />Please delete the file <strong>upgrade-script.php</strong> via FTP before proceeding.', 'warning', 'div');
|
1135 |
|
|
// show buttons to go to the backend or frontend
|
1136 |
|
|
echo '<br />';
|
1137 |
1532
|
Luisehahne
|
|
1138 |
1765
|
Luisehahne
|
if(defined('WB_URL')) {
|
1139 |
|
|
echo '<form action="'.WB_URL.'/">';
|
1140 |
|
|
echo ' <input type="submit" value="kick me to the Frontend" />';
|
1141 |
|
|
echo '</form>';
|
1142 |
|
|
}
|
1143 |
|
|
if(defined('ADMIN_URL')) {
|
1144 |
|
|
echo '<form action="'.ADMIN_URL.'/">';
|
1145 |
|
|
echo ' <input type="submit" value="kick me to the Backend" />';
|
1146 |
|
|
echo '</form>';
|
1147 |
|
|
}
|
1148 |
1457
|
Luisehahne
|
|
1149 |
1765
|
Luisehahne
|
echo "<br /><br /></div>
|
1150 |
|
|
</div>
|
1151 |
|
|
</div>
|
1152 |
|
|
</body>
|
1153 |
|
|
</html>
|
1154 |
|
|
";
|
1155 |
|
|
exit();
|