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