1 |
552
|
thorn
|
<?php
|
2 |
|
|
|
3 |
554
|
Ruebenwurz
|
// $Id$
|
4 |
552
|
thorn
|
|
5 |
|
|
/*
|
6 |
|
|
|
7 |
|
|
Website Baker Project <http://www.websitebaker.org/>
|
8 |
|
|
Copyright (C) 2004-2008, Ryan Djurovich
|
9 |
|
|
|
10 |
|
|
Website Baker is free software; you can redistribute it and/or modify
|
11 |
|
|
it under the terms of the GNU General Public License as published by
|
12 |
|
|
the Free Software Foundation; either version 2 of the License, or
|
13 |
|
|
(at your option) any later version.
|
14 |
|
|
|
15 |
|
|
Website Baker is distributed in the hope that it will be useful,
|
16 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
|
|
GNU General Public License for more details.
|
19 |
|
|
|
20 |
|
|
You should have received a copy of the GNU General Public License
|
21 |
|
|
along with Website Baker; if not, write to the Free Software
|
22 |
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
23 |
|
|
|
24 |
|
|
*/
|
25 |
|
|
|
26 |
715
|
doc
|
/**
|
27 |
|
|
PHP ROUTINES FOR THE UPGRADE SCRIPT
|
28 |
|
|
**/
|
29 |
|
|
// this function checks the basic configurations of an existing WB intallation
|
30 |
|
|
function status_msg($message, $class='check', $element='span') {
|
31 |
|
|
// returns a status message
|
32 |
|
|
echo '<'.$element .' class="' .$class .'">' .$message .'</' .$element.'>';
|
33 |
|
|
}
|
34 |
552
|
thorn
|
|
35 |
715
|
doc
|
function check_baseline_configuration() {
|
36 |
|
|
// check if config.php file exists and contains values
|
37 |
|
|
status_msg('config.php: ');
|
38 |
719
|
doc
|
@include_once('config.php');
|
39 |
715
|
doc
|
if(defined('WB_PATH')) {
|
40 |
|
|
status_msg('OK', 'ok');
|
41 |
|
|
} else {
|
42 |
|
|
// output error message and return error status
|
43 |
|
|
status_msg('FAILED', 'error');
|
44 |
|
|
status_msg('<strong>Error:</strong><br />No valid config.php found in: "<em>'
|
45 |
|
|
.dirname(__FILE__).'</em>"<br />Please check if this script is placed in the WB root directory '
|
46 |
|
|
.'and check/correct the config.php file before proceeding.<br /><br />You can not proceed before this error is fixed!!!'
|
47 |
|
|
, 'warning', 'div');
|
48 |
|
|
return -1;
|
49 |
|
|
}
|
50 |
552
|
thorn
|
|
51 |
715
|
doc
|
// check if the WB 2.7 installation files were already uploaded via FTP
|
52 |
|
|
status_msg(', WB 2.7 core files uploaded: ');
|
53 |
719
|
doc
|
@include_once(WB_PATH .'/framework/functions.php');
|
54 |
|
|
@include_once(WB_PATH .'/admin/interface/version.php');
|
55 |
715
|
doc
|
if(defined('VERSION') && VERSION == '2.7'
|
56 |
|
|
&& function_exists('get_variable_content')
|
57 |
|
|
&& file_exists(WB_PATH .'/modules/menu_link/languages/DE.php')
|
58 |
|
|
&& file_exists(WB_PATH .'/modules/output_filter/filter-routines.php')
|
59 |
|
|
&& file_exists(WB_PATH .'/modules/captcha_control/languages/DE.php')
|
60 |
|
|
&& file_exists(WB_PATH .'/modules/jsadmin/jsadmin_backend_include.php')
|
61 |
|
|
&& file_exists(WB_PATH .'/admin/admintools/tool.php')
|
62 |
|
|
&& file_exists(WB_PATH .'/admin/interface/er_levels.php')) {
|
63 |
|
|
status_msg('OK','ok');
|
64 |
|
|
} else {
|
65 |
|
|
// output a warning and return error status
|
66 |
|
|
status_msg('FAILED','error');
|
67 |
|
|
status_msg('<strong>Error:</strong><br />Some of the Website Baker 2.7 core files were not found.'
|
68 |
|
|
.'<br />Please upload all core files (except config.php and folder /install) contained in the WB 2.7 installation package first.'
|
69 |
|
|
.'<br /><br />You can not proceed before this error is fixed!!!'
|
70 |
|
|
, 'warning', 'div');
|
71 |
|
|
return -1;
|
72 |
|
|
}
|
73 |
|
|
|
74 |
719
|
doc
|
// check database connection (try to extract a single value which should always exist)
|
75 |
722
|
doc
|
$matches = '';
|
76 |
715
|
doc
|
status_msg(', Database connection: ');
|
77 |
|
|
if(class_exists('database')) {
|
78 |
719
|
doc
|
$table = TABLE_PREFIX .'groups';
|
79 |
722
|
doc
|
//$result = $database->query("SELECT group_id FROM $table WHERE group_id = '1' LIMIT 1");
|
80 |
|
|
$result = $database->query("SELECT name FROM $table WHERE group_id = '1' LIMIT 1");
|
81 |
|
|
$matches = ($result->numRows() > 0) ? $result->numRows() : '';
|
82 |
715
|
doc
|
}
|
83 |
722
|
doc
|
if($matches == '1') {
|
84 |
715
|
doc
|
status_msg('OK', 'ok');
|
85 |
|
|
} else {
|
86 |
|
|
// output error message and return error status
|
87 |
|
|
status_msg('FAILED', 'error');
|
88 |
719
|
doc
|
status_msg('<strong>Error:</strong><br />Unable to connect to your existing Website Baker database.'
|
89 |
715
|
doc
|
.'<br />Make sure that the database class is available and the connection data in the config.php file is correct '
|
90 |
719
|
doc
|
.'and your database is not corrupt.<br />To check if your database is corrupt, you can use a tool like '
|
91 |
715
|
doc
|
.'<a href="http://www.phpmyadmin.net/" target="_blank">phpMyAdmin</a>.'
|
92 |
|
|
.'<br /><br />You can not proceed before this error is fixed!!!'
|
93 |
|
|
, 'warning', 'div');
|
94 |
|
|
return -1;
|
95 |
|
|
}
|
96 |
|
|
return 0;
|
97 |
|
|
}
|
98 |
|
|
|
99 |
552
|
thorn
|
?>
|
100 |
|
|
|
101 |
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
102 |
|
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
103 |
|
|
<head>
|
104 |
715
|
doc
|
<title>Upgrade script from Website Baker v2.6.7 to Website Baker v2.7</title>
|
105 |
719
|
doc
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
106 |
692
|
doc
|
<style type="text/css">
|
107 |
715
|
doc
|
body {
|
108 |
|
|
margin:0;
|
109 |
|
|
padding:0;
|
110 |
|
|
border:0;
|
111 |
|
|
background: #EBF7FC;
|
112 |
|
|
color:#000;
|
113 |
|
|
font-family: 'Trebuchet MS', Verdana, Arial, Helvetica, Sans-Serif;
|
114 |
|
|
font-size: small;
|
115 |
|
|
height:101%;
|
116 |
|
|
}
|
117 |
692
|
doc
|
|
118 |
715
|
doc
|
#container {
|
119 |
|
|
width:85%;
|
120 |
|
|
background: #9ACBF1 url(admin/interface/background.png) repeat-x;
|
121 |
|
|
border:1px solid #000;
|
122 |
|
|
color:#000;
|
123 |
|
|
margin:2em auto;
|
124 |
|
|
padding:0 15px;
|
125 |
|
|
min-height: 500px;
|
126 |
|
|
text-align:left;
|
127 |
692
|
doc
|
}
|
128 |
|
|
|
129 |
|
|
p { line-height:1.5em; }
|
130 |
|
|
|
131 |
715
|
doc
|
h1,h2,h3,h4,h5,h6 {
|
132 |
|
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
133 |
|
|
color: #369;
|
134 |
|
|
margin-top: 1.0em;
|
135 |
|
|
margin-bottom: 0.1em;
|
136 |
|
|
}
|
137 |
|
|
|
138 |
|
|
h1 { font-size:150%; }
|
139 |
|
|
h2 { font-size: 130%; border-bottom: 1px #CCC solid; }
|
140 |
|
|
h3 { font-size: 120%; }
|
141 |
|
|
|
142 |
|
|
.ok, .error { font-weight:bold; }
|
143 |
|
|
.ok { color:green; }
|
144 |
|
|
.error { color:red; }
|
145 |
|
|
.check { color:#555; }
|
146 |
|
|
|
147 |
|
|
.warning {
|
148 |
|
|
width: 98%;
|
149 |
|
|
background:#FFDBDB;
|
150 |
|
|
padding:0.2em;
|
151 |
|
|
margin-top:0.5em;
|
152 |
|
|
border: 1px solid black;
|
153 |
|
|
}
|
154 |
692
|
doc
|
</style>
|
155 |
552
|
thorn
|
</head>
|
156 |
|
|
<body>
|
157 |
715
|
doc
|
<div id="container">
|
158 |
|
|
<img src="admin/interface/logo.png" alt="Website Baker Logo" />
|
159 |
|
|
|
160 |
|
|
<h1>Website Baker Upgrade</h1>
|
161 |
|
|
<p>This script is for <strong>upgrading an existing v2.6.7</strong> installation to the latest Website Baker <strong>version 2.7</strong>. The upgrade script checks the configuration of your installed Website Baker system and alters the existing WB database to reflect the changes introduced with WB 2.7.</p>
|
162 |
|
|
|
163 |
692
|
doc
|
<?php
|
164 |
715
|
doc
|
if(!isset($_POST['backup_confirmed'])) {
|
165 |
|
|
?>
|
166 |
724
|
doc
|
<h2>Step 1: Check existing installation</h2>
|
167 |
|
|
<p>Checking the configuration of your existing Website Baker installation:<br />
|
168 |
|
|
<?php
|
169 |
|
|
// check the basic Website Baker installation before proceeding
|
170 |
|
|
if(check_baseline_configuration() != 0) {
|
171 |
|
|
echo <<< EOT
|
172 |
|
|
<h3>Checklist before upgrading:</h3>
|
173 |
722
|
doc
|
<p>To upgrade from an existing WB 2.6.7 version, please perform the following steps in advance:
|
174 |
|
|
<ol>
|
175 |
|
|
<li>Backup the entire <strong>/pages</strong> folder (including all subfolder and files) of your existing WB installation</li>
|
176 |
|
|
<li>Backup the entire <strong>Database</strong> of your existing WB installation (e.g. by the WB admin tool)</li>
|
177 |
|
|
<li>Download the WB 2.7 installation package from the <a href="http://download.websitebaker.org/" target="_blank">official project site</a></li>
|
178 |
|
|
<li>Upload all files contained in the WB 2.7 installation package (except config.php and the folder /install) via FTP over your existing installation</li>
|
179 |
|
|
<li>start this script by typing the URL into your browser</li>
|
180 |
|
|
</ol>
|
181 |
724
|
doc
|
<strong class="error">Note: </strong>If you have an version lower than 2.6.7, you need to upgrade to 2.6.7 first!! Instructions can be found on the <a href="http://help.websitebaker.org/pages/en/basic-docu/installation/upgrade.php" target="_blank">Website Baker Help portal</a>.</p><p> </p>
|
182 |
|
|
EOT;
|
183 |
|
|
die;
|
184 |
|
|
}
|
185 |
|
|
// pre-checks passed, proceed
|
186 |
715
|
doc
|
status_msg('<p>Congratulations: You have passed all the required pre-checks.', 'ok');
|
187 |
|
|
?>
|
188 |
|
|
|
189 |
|
|
<h2>Step 2: Create a backup of your existing data</h2>
|
190 |
|
|
<p>It is highly recommended to <strong>create a manual backup</strong> of the entire <strong>/pages folder</strong> and the <strong>MySQL database</strong> before proceeding. The upgrade script is not sufficiently tested at the moment and should therefore only be used for testing purposes!!! Please confirm the disclaimer before starting this script.</p>
|
191 |
|
|
|
192 |
|
|
<form name="send" action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">
|
193 |
|
|
<textarea cols="80" rows="5">DISCLAIMER: The Website Baker upgrade script is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. One needs to confirm that a manual backup of the /pages folder (including all files and subfolders contained in it) and backup of the entire Website Baker MySQL database was created before you can proceed.</textarea>
|
194 |
|
|
<br /><br /><input name="backup_confirmed" type="checkbox" value="confirmed" /> I confirm that a manual backup of the /pages folder and the MySQL database was created.
|
195 |
|
|
<br /><br /><input name="send" type="submit" value="Start upgrade script" />
|
196 |
|
|
</form>
|
197 |
|
|
<br />
|
198 |
|
|
|
199 |
|
|
<?php
|
200 |
|
|
if(isset($_POST['send'])) {
|
201 |
|
|
status_msg('<strong>Notice:</strong><br />You need to confirm that you have created a manual backup of the /pages directory and the MySQL database before you can proceed.', 'warning', 'div');
|
202 |
|
|
}
|
203 |
|
|
?>
|
204 |
|
|
<br /><br />
|
205 |
|
|
<?php
|
206 |
|
|
} else {
|
207 |
692
|
doc
|
/**
|
208 |
715
|
doc
|
THE WEBSITE BAKER UPGRADE SCRIPT STARTS HERE
|
209 |
|
|
**/
|
210 |
719
|
doc
|
require_once('config.php');
|
211 |
|
|
require_once(WB_PATH.'/framework/functions.php');
|
212 |
692
|
doc
|
?>
|
213 |
715
|
doc
|
<h2>Step 3: Upgrading the existing Website Baker installation to WB 2.7</h2>
|
214 |
|
|
<p>will upgrade Website Baker 2.6.5 / 2.6.7 to version 2.7</p>
|
215 |
692
|
doc
|
<?php
|
216 |
552
|
thorn
|
|
217 |
720
|
doc
|
$OK = '<span class="ok">OK</span>';
|
218 |
|
|
$FAIL = '<span class="error">FAILED</span>';
|
219 |
552
|
thorn
|
|
220 |
|
|
|
221 |
|
|
/**********************************************************
|
222 |
|
|
* - modules-based search
|
223 |
|
|
*/
|
224 |
|
|
function db_add_search_key_value($key, $value) {
|
225 |
|
|
global $database; global $OK; global $FAIL;
|
226 |
596
|
thorn
|
$table = TABLE_PREFIX.'search';
|
227 |
|
|
$query = $database->query("SELECT value FROM $table WHERE name = '$key' LIMIT 1");
|
228 |
552
|
thorn
|
if($query->numRows() > 0) {
|
229 |
|
|
echo "$key: allready there. $OK.<br />";
|
230 |
|
|
return true;
|
231 |
|
|
} else {
|
232 |
596
|
thorn
|
$database->query("INSERT INTO $table (name,value,extra) VALUES ('$key', '$value', '')");
|
233 |
648
|
thorn
|
echo (mysql_error()?mysql_error().'<br />':'');
|
234 |
596
|
thorn
|
$query = $database->query("SELECT value FROM $table WHERE name = '$key' LIMIT 1");
|
235 |
552
|
thorn
|
if($query->numRows() > 0) {
|
236 |
|
|
echo "$key: $OK.<br />";
|
237 |
|
|
return true;
|
238 |
|
|
} else {
|
239 |
|
|
echo "$key: $FAIL!<br />";
|
240 |
|
|
return false;
|
241 |
|
|
}
|
242 |
|
|
}
|
243 |
|
|
}
|
244 |
644
|
thorn
|
function db_add_field($field, $table, $desc) {
|
245 |
|
|
global $database; global $OK; global $FAIL;
|
246 |
648
|
thorn
|
echo "<u>Adding field '$field' to table '$table'</u><br />";
|
247 |
644
|
thorn
|
$table = TABLE_PREFIX.$table;
|
248 |
|
|
$query = $database->query("DESCRIBE $table '$field'");
|
249 |
|
|
if($query->numRows() == 0) { // add field
|
250 |
|
|
$query = $database->query("ALTER TABLE $table ADD $field $desc");
|
251 |
648
|
thorn
|
echo (mysql_error()?mysql_error().'<br />':'');
|
252 |
644
|
thorn
|
$query = $database->query("DESCRIBE $table '$field'");
|
253 |
648
|
thorn
|
echo (mysql_error()?mysql_error().'<br />':'');
|
254 |
644
|
thorn
|
if($query->numRows() > 0) {
|
255 |
|
|
echo "'$field' added. $OK.<br />";
|
256 |
|
|
} else {
|
257 |
|
|
echo "adding '$field' $FAIL!<br />";
|
258 |
|
|
}
|
259 |
|
|
} else {
|
260 |
|
|
echo "'$field' allready there. $OK.<br />";
|
261 |
|
|
}
|
262 |
|
|
}
|
263 |
552
|
thorn
|
|
264 |
|
|
echo "<br /><u>Adding module_order and max_excerpt to search-table</u><br />";
|
265 |
|
|
// module_order - in which order to show the search-results
|
266 |
|
|
// max_excerpt - how many lines of excerpt to print per matching page
|
267 |
|
|
|
268 |
|
|
$cfg = array(
|
269 |
|
|
'module_order' => 'faqbaker,manual,wysiwyg',
|
270 |
|
|
'max_excerpt' => '15'
|
271 |
|
|
);
|
272 |
|
|
foreach($cfg as $key=>$value) {
|
273 |
|
|
db_add_search_key_value($key, $value);
|
274 |
|
|
}
|
275 |
|
|
|
276 |
644
|
thorn
|
echo "<br /><u>Adding some internal config-elements to search-table</u><br />";
|
277 |
|
|
// These are global config-elements which don't appear in settings-page. Change them in the database if needed.
|
278 |
|
|
// cfg_show_description - whether to show page-description on the results page (true/false), def: true
|
279 |
|
|
// cfg_search_description - whether to search in page-description (true/false), def: true [only used while searching title/link/description/keywords]
|
280 |
|
|
// cfg_search_keywords - whether to search in page-keywords (true/false), def: true [only used while searching title/link/description/keywords]
|
281 |
|
|
// cfg_enable_old_search - use old search-method, too (true/false), def: true [use old method as fallback]
|
282 |
|
|
$cfg = array(
|
283 |
|
|
'cfg_show_description' => 'true',
|
284 |
|
|
'cfg_search_description' => 'true',
|
285 |
|
|
'cfg_search_keywords' => 'true',
|
286 |
|
|
'cfg_enable_old_search' => 'true'
|
287 |
|
|
);
|
288 |
|
|
foreach($cfg as $key=>$value) {
|
289 |
|
|
db_add_search_key_value($key, $value);
|
290 |
|
|
}
|
291 |
552
|
thorn
|
|
292 |
|
|
echo "<br /><u>Changing results_loop in search-table</u><br />";
|
293 |
|
|
// adding [EXCERPT]
|
294 |
|
|
|
295 |
|
|
$query = $database->query("SELECT value FROM ".TABLE_PREFIX."search WHERE name = 'results_loop' LIMIT 1");
|
296 |
|
|
if($query->numRows() > 0) {
|
297 |
|
|
$fetch_results_loop = $query->fetchRow();
|
298 |
|
|
$string = $fetch_results_loop['value'];
|
299 |
|
|
if(preg_match("/\[EXCERPT\]/", $string)) {
|
300 |
|
|
echo "[EXCERPT] is allready there. $OK.<br />";
|
301 |
|
|
} else {
|
302 |
|
|
$string = preg_replace("/10px;\">\[DESCRIPTION\]/", "5px;\">[DESCRIPTION]", $string);
|
303 |
|
|
$string .= "<tr><td colspan=\"2\" style=\"text-align: justify; padding-bottom: 10px;\">[EXCERPT]</td></tr>";
|
304 |
|
|
$string = addslashes($string);
|
305 |
|
|
$database->query("UPDATE ".TABLE_PREFIX."search SET name='results_loop',value='".$string."',extra='' WHERE name = 'results_loop' LIMIT 1");
|
306 |
648
|
thorn
|
echo (mysql_error()?mysql_error().'<br />':'');
|
307 |
552
|
thorn
|
$query = $database->query("SELECT value FROM ".TABLE_PREFIX."search WHERE name = 'results_loop' LIMIT 1");
|
308 |
|
|
if($query->numRows() > 0) {
|
309 |
|
|
$fetch_results_loop = $query->fetchRow();
|
310 |
|
|
$string = $fetch_results_loop['value'];
|
311 |
|
|
if(preg_match("/\[EXCERPT\]/", $string)) {
|
312 |
|
|
echo "[EXCERPT] added. $OK.<br />";
|
313 |
|
|
} else {
|
314 |
|
|
echo "adding [EXCERPT] $FAIL!<br />";
|
315 |
|
|
}
|
316 |
|
|
}
|
317 |
|
|
}
|
318 |
|
|
}
|
319 |
|
|
|
320 |
|
|
echo "<br /><u>Changing \"Header:\" in search-table</u><br />";
|
321 |
|
|
// adding [SEARCH_PATH]
|
322 |
|
|
|
323 |
|
|
$query = $database->query("SELECT value FROM ".TABLE_PREFIX."search WHERE name = 'header' LIMIT 1");
|
324 |
|
|
if($query->numRows() > 0) {
|
325 |
|
|
$fetch_header = $query->fetchRow();
|
326 |
|
|
$string = $fetch_header['value'];
|
327 |
|
|
if(preg_match("/\[SEARCH_PATH\]/", $string)) {
|
328 |
|
|
echo "[SEARCH_PATH] is allready there. $OK.<br />";
|
329 |
|
|
} else {
|
330 |
|
|
$string = preg_replace("/<input type=\"text\" name=\"string\" value=\"\[SEARCH_STRING\]\" style=\"width: 100%;\" \/>/", "<input type=\"hidden\" name=\"search_path\" value=\"[SEARCH_PATH]\" /><input type=\"text\" name=\"string\" value=\"[SEARCH_STRING]\" style=\"width: 100%;\" />", $string);
|
331 |
|
|
$string = addslashes($string);
|
332 |
|
|
$database->query("UPDATE ".TABLE_PREFIX."search SET name='header',value='".$string."',extra='' WHERE name = 'header' LIMIT 1");
|
333 |
648
|
thorn
|
echo (mysql_error()?mysql_error().'<br />':'');
|
334 |
552
|
thorn
|
$query = $database->query("SELECT value FROM ".TABLE_PREFIX."search WHERE name = 'header' LIMIT 1");
|
335 |
|
|
if($query->numRows() > 0) {
|
336 |
|
|
$fetch_header = $query->fetchRow();
|
337 |
|
|
$string = $fetch_header['value'];
|
338 |
|
|
if(preg_match("/\[SEARCH_PATH\]/", $string)) {
|
339 |
|
|
echo "[SEARCH_PATH] added. $OK.<br />";
|
340 |
|
|
} else {
|
341 |
|
|
echo "adding [SEARCH_PATH] $FAIL!<br />";
|
342 |
|
|
}
|
343 |
|
|
}
|
344 |
|
|
}
|
345 |
|
|
}
|
346 |
|
|
|
347 |
714
|
Ruebenwurz
|
|
348 |
552
|
thorn
|
/**********************************************************
|
349 |
|
|
* - publish-by-date
|
350 |
|
|
*/
|
351 |
|
|
// Add fields "publ_start" and "publ_end" to table "sections"
|
352 |
|
|
// check if fields are present
|
353 |
644
|
thorn
|
db_add_field('publ_start', 'sections', "INT NOT NULL DEFAULT '0'");
|
354 |
|
|
db_add_field('publ_end', 'sections', "INT NOT NULL DEFAULT '0'");
|
355 |
552
|
thorn
|
|
356 |
|
|
|
357 |
566
|
thorn
|
/**********************************************************
|
358 |
|
|
* - core-module menu_link
|
359 |
|
|
*/
|
360 |
|
|
// create table
|
361 |
|
|
$table = TABLE_PREFIX ."mod_menu_link";
|
362 |
|
|
$database->query("DROP TABLE IF EXISTS `$table`");
|
363 |
|
|
$database->query("
|
364 |
|
|
CREATE TABLE `$table` (
|
365 |
|
|
`section_id` INT(11) NOT NULL DEFAULT '0',
|
366 |
|
|
`page_id` INT(11) NOT NULL DEFAULT '0',
|
367 |
|
|
`target_page_id` INT(11) NOT NULL DEFAULT '0',
|
368 |
575
|
thorn
|
`anchor` VARCHAR(255) NOT NULL DEFAULT '0' ,
|
369 |
701
|
thorn
|
`extern` VARCHAR(255) NOT NULL DEFAULT '' ,
|
370 |
566
|
thorn
|
PRIMARY KEY (`section_id`)
|
371 |
|
|
)
|
372 |
|
|
");
|
373 |
|
|
// fetch all menu_link-pages in $pages
|
374 |
|
|
$pages = array();
|
375 |
|
|
$table_p = TABLE_PREFIX.'pages';
|
376 |
|
|
$table_s = TABLE_PREFIX.'sections';
|
377 |
580
|
thorn
|
$table_mm = TABLE_PREFIX ."mod_menu_link";
|
378 |
|
|
|
379 |
|
|
$query_page = $database->query("SELECT p.*, s.section_id FROM $table_p AS p, $table_s AS s WHERE p.page_id=s.page_id AND s.module = 'menu_link'");
|
380 |
566
|
thorn
|
if($query_page->numRows() > 0) {
|
381 |
|
|
while($page = $query_page->fetchRow()) {
|
382 |
|
|
$pages[$page['page_id']]['page_details'] = $page;
|
383 |
|
|
}
|
384 |
|
|
}
|
385 |
648
|
thorn
|
if($pages!=array())
|
386 |
|
|
echo "<br /><u>Convert menu_links</u><br />";
|
387 |
|
|
|
388 |
566
|
thorn
|
// get all related files with content from pages/ in $pages, too
|
389 |
|
|
function list_files_dirs($dir, $depth=true, $files=array(), $dirs=array()) {
|
390 |
|
|
$dh=opendir($dir);
|
391 |
|
|
while(($file = readdir($dh)) !== false) {
|
392 |
|
|
if($file == '.' || $file == '..') {
|
393 |
|
|
continue;
|
394 |
|
|
}
|
395 |
|
|
if(is_dir($dir.'/'.$file)) {
|
396 |
|
|
if($depth) {
|
397 |
|
|
$dirs[] = $dir.'/'.$file;
|
398 |
|
|
list($files, $dirs) = list_files_dirs($dir.'/'.$file, $depth, $files, $dirs);
|
399 |
|
|
}
|
400 |
|
|
} else {
|
401 |
726
|
thorn
|
$newfile = $dir.'/'.$file;
|
402 |
|
|
if(filesize($newfile) <= 100)
|
403 |
|
|
$files[] = $newfile;
|
404 |
566
|
thorn
|
}
|
405 |
|
|
}
|
406 |
|
|
closedir($dh);
|
407 |
|
|
return(array($files, $dirs));
|
408 |
|
|
}
|
409 |
|
|
list($files, $dirs) = list_files_dirs(WB_PATH.PAGES_DIRECTORY);
|
410 |
|
|
foreach($files as $file) {
|
411 |
|
|
if(($content = implode('', file($file))) !== FALSE) {
|
412 |
|
|
if(preg_match('/\$page_id = (\d+)/', $content, $matches)) {
|
413 |
|
|
if(array_key_exists($matches[1], $pages)) {
|
414 |
|
|
$pages[$matches[1]]['file_content'] = $content;
|
415 |
|
|
$pages[$matches[1]]['filename'] = $file;
|
416 |
|
|
}
|
417 |
|
|
}
|
418 |
|
|
}
|
419 |
|
|
}
|
420 |
580
|
thorn
|
unset($files); unset($dirs);
|
421 |
566
|
thorn
|
// try to convert old menu_links to new ones
|
422 |
|
|
foreach($pages as $p) {
|
423 |
|
|
$page = $p['page_details'];
|
424 |
|
|
$file_content = $p['file_content'];
|
425 |
|
|
$filename = $p['filename'];
|
426 |
|
|
$link = $p['page_details']['link'];
|
427 |
580
|
thorn
|
$parent_pid = $p['page_details']['parent'];
|
428 |
579
|
thorn
|
$page_id = $p['page_details']['page_id'];
|
429 |
580
|
thorn
|
$section_id = $p['page_details']['section_id'];
|
430 |
|
|
$menu_title = $p['page_details']['menu_title'];
|
431 |
562
|
Ruebenwurz
|
|
432 |
580
|
thorn
|
// calculate link from wb_pages.parent and menu_title
|
433 |
|
|
$cur_link = '';
|
434 |
|
|
if($parent_pid != '0' && $query_link = $database->query("SELECT link FROM $table_p WHERE page_id = '$parent_pid'")) {
|
435 |
|
|
$res = $query_link->fetchRow();
|
436 |
|
|
$cur_link .= $res['link'];
|
437 |
|
|
}
|
438 |
|
|
$cur_link .= '/'.page_filename($menu_title);
|
439 |
|
|
echo "found: $cur_link<br />";
|
440 |
|
|
$database->query("UPDATE $table_p SET link = '$cur_link' WHERE page_id = '$page_id'");
|
441 |
648
|
thorn
|
echo (mysql_error()?'mySQL: '.mysql_error().'<br />':'');
|
442 |
580
|
thorn
|
|
443 |
|
|
$new_filenames[$page_id]['file'] = WB_PATH.PAGES_DIRECTORY.$cur_link.PAGE_EXTENSION;
|
444 |
|
|
$new_filenames[$page_id]['link'] = $cur_link;
|
445 |
|
|
$new_filenames[$page_id]['menu'] = $menu_title;
|
446 |
|
|
|
447 |
|
|
// delete old access files in pages
|
448 |
|
|
if(file_exists($filename)) {
|
449 |
|
|
if(!is_writable(WB_PATH.PAGES_DIRECTORY.'/')) {
|
450 |
|
|
echo "Cannot delete access file in pages/ - permission denied ($FAIL)<br />";
|
451 |
|
|
} else {
|
452 |
|
|
unlink($filename);
|
453 |
|
|
}
|
454 |
|
|
}
|
455 |
|
|
|
456 |
|
|
// make entry in wb_mod_menu_link
|
457 |
|
|
if($query_pid = $database->query("SELECT page_id FROM $table_p WHERE page_id != '$page_id' AND link = '$link'")) {
|
458 |
579
|
thorn
|
$res = $query_pid->fetchRow();
|
459 |
|
|
$target_page_id = $res['page_id'];
|
460 |
701
|
thorn
|
$extern = '';
|
461 |
|
|
if(strpos($link, '://') !== FALSE || strpos($link, 'mailto:') !== FALSE) {
|
462 |
|
|
$target_page_id=-1;
|
463 |
|
|
$extern=addslashes($link);
|
464 |
|
|
}
|
465 |
|
|
$database->query("INSERT INTO $table_mm (page_id, section_id, target_page_id, anchor, extern) VALUES ('$page_id', '$section_id', '$target_page_id', '0', '$extern')");
|
466 |
648
|
thorn
|
echo (mysql_error()?'mySQL: '.mysql_error().'<br />':'');
|
467 |
579
|
thorn
|
}
|
468 |
580
|
thorn
|
}
|
469 |
|
|
// create new access files in pages/; make directories as needed
|
470 |
|
|
foreach($pages as $p) {
|
471 |
|
|
$page_id = $p['page_details']['page_id'];
|
472 |
|
|
$filename = $new_filenames[$page_id]['file'];
|
473 |
|
|
$menu_title = $new_filenames[$page_id]['menu'];
|
474 |
|
|
$link = $new_filenames[$page_id]['link'];
|
475 |
|
|
$content = $p['file_content'];
|
476 |
|
|
$level = $p['page_details']['level'];
|
477 |
|
|
$depth = '';
|
478 |
|
|
for($i=0; $i<=$level; $i++)
|
479 |
|
|
$depth .= '../';
|
480 |
|
|
$content = preg_replace('#((../)+)config\.php#', "{$depth}config.php", $content);
|
481 |
|
|
while(file_exists($filename)) {
|
482 |
|
|
echo "Cannot create '$filename' - file exist. Renamed to: ";
|
483 |
|
|
$menu_title .= '_';
|
484 |
|
|
$link .= '_';
|
485 |
|
|
$filename = WB_PATH.PAGES_DIRECTORY.$link.PAGE_EXTENSION;
|
486 |
|
|
echo "$filename<br />";
|
487 |
|
|
$database->query("UPDATE $table_p SET link='$link', menu_title='$menu_title' WHERE page_id = '$page_id'");
|
488 |
|
|
echo mysql_error()?'mySQL: '.mysql_error().'<br />':'';
|
489 |
|
|
}
|
490 |
|
|
// check if we need to create a subdir somewhere
|
491 |
|
|
$dirs = array();
|
492 |
726
|
thorn
|
while(dirname($link) != '/' && dirname($link) != '.') {
|
493 |
580
|
thorn
|
$link = dirname($link);
|
494 |
|
|
$dirs[] = WB_PATH.PAGES_DIRECTORY.$link;
|
495 |
|
|
}
|
496 |
|
|
foreach(array_reverse($dirs) as $dir) {
|
497 |
|
|
if(!file_exists($dir)) {
|
498 |
726
|
thorn
|
@mkdir($dir, OCTAL_DIR_MODE);
|
499 |
580
|
thorn
|
}
|
500 |
|
|
}
|
501 |
|
|
// create new file in pages/
|
502 |
|
|
if($handle=fopen($filename, "wb")) {
|
503 |
|
|
if(!fwrite($handle, $content)) {
|
504 |
|
|
echo "Cannot write to $filename - ($FAIL)<br />";
|
505 |
|
|
}
|
506 |
|
|
fclose($handle);
|
507 |
|
|
} else {
|
508 |
|
|
echo "Cannot create $filename - ($FAIL)<br />";
|
509 |
|
|
}
|
510 |
|
|
|
511 |
|
|
}
|
512 |
566
|
thorn
|
|
513 |
627
|
doc
|
// some code missing to regenerate page_title from link/filename
|
514 |
|
|
// for_all_pages: if filename($page_title) != basename($link) {
|
515 |
|
|
// rename $page_title to basename($link)
|
516 |
|
|
// }
|
517 |
|
|
// This must be done after menu_link-upgrade
|
518 |
|
|
//
|
519 |
|
|
// Should we really do this? - must be checked
|
520 |
|
|
|
521 |
714
|
Ruebenwurz
|
|
522 |
596
|
thorn
|
/**********************************************************
|
523 |
|
|
* - asp - Advanced Spam Protection
|
524 |
|
|
*/
|
525 |
|
|
echo "<br /><u>Adding table mod_captcha_control</u><br />";
|
526 |
|
|
$table = TABLE_PREFIX.'mod_captcha_control';
|
527 |
|
|
$database->query("DROP TABLE IF EXISTS `$table`");
|
528 |
|
|
$database->query("CREATE TABLE `$table` (
|
529 |
|
|
`enabled_captcha` VARCHAR(1) NOT NULL DEFAULT '1',
|
530 |
|
|
`enabled_asp` VARCHAR(1) NOT NULL DEFAULT '1',
|
531 |
|
|
`captcha_type` VARCHAR(255) NOT NULL DEFAULT 'calc_text',
|
532 |
|
|
`asp_session_min_age` INT(11) NOT NULL DEFAULT '20',
|
533 |
|
|
`asp_view_min_age` INT(11) NOT NULL DEFAULT '10',
|
534 |
642
|
thorn
|
`asp_input_min_age` INT(11) NOT NULL DEFAULT '5',
|
535 |
|
|
`ct_text` LONGTEXT NOT NULL DEFAULT ''
|
536 |
596
|
thorn
|
)"
|
537 |
|
|
);
|
538 |
|
|
$database->query("
|
539 |
|
|
INSERT INTO `$table`
|
540 |
|
|
(`enabled_captcha`, `enabled_asp`, `captcha_type`)
|
541 |
|
|
VALUES
|
542 |
|
|
('1', '1', 'calc_text')
|
543 |
|
|
");
|
544 |
566
|
thorn
|
|
545 |
714
|
Ruebenwurz
|
|
546 |
648
|
thorn
|
/**********************************************************
|
547 |
|
|
* - multi-group
|
548 |
|
|
*/
|
549 |
|
|
db_add_field('groups_id', 'users', "VARCHAR( 255 ) NOT NULL DEFAULT '0' AFTER group_id");
|
550 |
|
|
$table = TABLE_PREFIX.'users';
|
551 |
|
|
if($query_group = $database->query("SELECT user_id,group_id,groups_id FROM $table")) {
|
552 |
|
|
while($group = $query_group->fetchRow()) {
|
553 |
|
|
if($group['groups_id'] == '0') {
|
554 |
|
|
if($database->query("UPDATE $table SET groups_id = group_id WHERE user_id = {$group['user_id']}")) {
|
555 |
|
|
echo 'groups_id updated successfully<br>';
|
556 |
|
|
}
|
557 |
|
|
echo mysql_error().'<br />';
|
558 |
|
|
}
|
559 |
|
|
}
|
560 |
|
|
}
|
561 |
566
|
thorn
|
|
562 |
648
|
thorn
|
|
563 |
714
|
Ruebenwurz
|
/**********************************************************
|
564 |
|
|
* -Javascript Admin
|
565 |
|
|
*/
|
566 |
|
|
echo "<br /><u>Adding table mod_jsadmin</u><br />";
|
567 |
|
|
$table = TABLE_PREFIX ."mod_jsadmin";
|
568 |
|
|
$database->query("DROP TABLE IF EXISTS `$table`");
|
569 |
648
|
thorn
|
|
570 |
714
|
Ruebenwurz
|
$database->query("
|
571 |
|
|
CREATE TABLE `$table` (
|
572 |
|
|
`id` INT(11) NOT NULL DEFAULT '0',
|
573 |
|
|
`name` VARCHAR(255) NOT NULL DEFAULT '0',
|
574 |
|
|
`value` INT(11) NOT NULL DEFAULT '0',
|
575 |
|
|
PRIMARY KEY (`id`)
|
576 |
|
|
)
|
577 |
|
|
");
|
578 |
552
|
thorn
|
|
579 |
714
|
Ruebenwurz
|
global $database;
|
580 |
720
|
doc
|
echo "Insert default value for mod_jsadmin_persist_order: ";
|
581 |
|
|
echo ($database->query("INSERT INTO ".$table." (id,name,value) VALUES ('1','mod_jsadmin_persist_order','0')")) ? " $OK<br />" : " $FAIL<br />";
|
582 |
|
|
echo "Insert default value for mod_jsadmin_ajax_order_pages: ";
|
583 |
|
|
echo ($database->query("INSERT INTO ".$table." (id,name,value) VALUES ('2','mod_jsadmin_ajax_order_pages','0')")) ? " $OK<br />" : " $FAIL<br />";
|
584 |
|
|
echo "Insert default value for mod_jsadmin_ajax_order_sections: ";
|
585 |
|
|
echo ($database->query("INSERT INTO ".$table." (id,name,value) VALUES ('3','mod_jsadmin_ajax_order_sections','0')")) ? " $OK<br />" : " $FAIL<br />";
|
586 |
714
|
Ruebenwurz
|
|
587 |
|
|
/**********************************************************
|
588 |
|
|
* - Output Filter
|
589 |
|
|
*/
|
590 |
720
|
doc
|
echo "<br /><u>Adding table mod_outputfilter</u><br />Status: ";
|
591 |
714
|
Ruebenwurz
|
$table = TABLE_PREFIX .'mod_output_filter';
|
592 |
|
|
$database->query("DROP TABLE IF EXISTS `$table`");
|
593 |
|
|
|
594 |
|
|
$database->query("CREATE TABLE `$table` (
|
595 |
|
|
`email_filter` VARCHAR(1) NOT NULL DEFAULT '0',
|
596 |
|
|
`mailto_filter` VARCHAR(1) NOT NULL DEFAULT '0',
|
597 |
|
|
`at_replacement` VARCHAR(255) NOT NULL DEFAULT '(at)',
|
598 |
|
|
`dot_replacement` VARCHAR(255) NOT NULL DEFAULT '(dot)'
|
599 |
|
|
)"
|
600 |
|
|
);
|
601 |
|
|
|
602 |
|
|
// add default values to the module table
|
603 |
720
|
doc
|
echo ($database->query("INSERT INTO ".TABLE_PREFIX
|
604 |
|
|
."mod_output_filter (email_filter, mailto_filter, at_replacement, dot_replacement) VALUES ('0', '0', '(at)', '(dot)')")) ? " $OK<br />" : " $FAIL<br />";
|
605 |
714
|
Ruebenwurz
|
|
606 |
|
|
|
607 |
|
|
/**********************************************************
|
608 |
|
|
* - Form Modul
|
609 |
|
|
*/
|
610 |
720
|
doc
|
echo '<br />';
|
611 |
648
|
thorn
|
db_add_field('success_email_subject', 'mod_form_settings', "VARCHAR(255) NOT NULL AFTER `email_subject`");
|
612 |
720
|
doc
|
echo '<br />';
|
613 |
648
|
thorn
|
db_add_field('success_email_text', 'mod_form_settings', "TEXT NOT NULL AFTER `email_subject`");
|
614 |
720
|
doc
|
echo '<br />';
|
615 |
648
|
thorn
|
db_add_field('success_email_from', 'mod_form_settings', "VARCHAR(255) NOT NULL AFTER `email_subject`");
|
616 |
720
|
doc
|
echo '<br />';
|
617 |
648
|
thorn
|
db_add_field('success_email_to', 'mod_form_settings', "TEXT NOT NULL AFTER `email_subject`");
|
618 |
720
|
doc
|
echo '<br />';
|
619 |
648
|
thorn
|
db_add_field('success_page', 'mod_form_settings', "TEXT NOT NULL AFTER `email_subject`");
|
620 |
720
|
doc
|
echo '<br />';
|
621 |
644
|
thorn
|
db_add_field('email_fromname', 'mod_form_settings', "VARCHAR( 255 ) NOT NULL AFTER email_from");
|
622 |
720
|
doc
|
echo '<br />';
|
623 |
644
|
thorn
|
db_add_field('success_email_fromname', 'mod_form_settings', "VARCHAR( 255 ) NOT NULL AFTER success_email_from");
|
624 |
560
|
Ruebenwurz
|
|
625 |
720
|
doc
|
echo "<br /><b>Deleting field success_message from table mod_form_settings</b><br />";
|
626 |
560
|
Ruebenwurz
|
|
627 |
|
|
if($database->query("ALTER TABLE `".TABLE_PREFIX."mod_form_settings` DROP `success_message`")) {
|
628 |
|
|
echo 'Database field success_message droped successfully<br>';
|
629 |
|
|
}
|
630 |
|
|
echo mysql_error().'<br />';
|
631 |
|
|
|
632 |
|
|
// These are the default setting
|
633 |
|
|
$success_page = 'none';
|
634 |
|
|
$success_email_to = '';
|
635 |
|
|
$success_email_text = 'Thank you for submitting your form on '.WEBSITE_TITLE;
|
636 |
|
|
$success_email_text = addslashes($success_email_text);
|
637 |
|
|
$success_email_subject = 'You have submitted a form';
|
638 |
|
|
|
639 |
|
|
// Insert default settings into database
|
640 |
|
|
$query_dates = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_form_settings where section_id != 0 and page_id != 0");
|
641 |
|
|
while($result = $query_dates->fetchRow()) {
|
642 |
|
|
|
643 |
|
|
echo "<B>Add default settings data to database for form section_id= ".$result['section_id']."</b><BR>";
|
644 |
|
|
$section_id = $result['section_id'];
|
645 |
|
|
|
646 |
|
|
if($database->query("UPDATE `".TABLE_PREFIX."mod_form_settings` SET `success_page` = '$success_page' WHERE `section_id` = $section_id")) {
|
647 |
|
|
echo 'Database data success_page added successfully<br>';
|
648 |
|
|
}
|
649 |
|
|
echo mysql_error().'<br />';
|
650 |
|
|
|
651 |
|
|
if($database->query("UPDATE `".TABLE_PREFIX."mod_form_settings` SET `success_email_to` = '$success_email_to' WHERE `section_id` = $section_id")) {
|
652 |
|
|
echo 'Database data success_email_to added successfully<br>';
|
653 |
|
|
}
|
654 |
|
|
echo mysql_error().'<br />';
|
655 |
|
|
|
656 |
|
|
if($database->query("UPDATE `".TABLE_PREFIX."mod_form_settings` SET `success_email_text` = '$success_email_text' WHERE `section_id` = $section_id")) {
|
657 |
|
|
echo 'Database data success_email_text added successfully<br>';
|
658 |
|
|
}
|
659 |
|
|
echo mysql_error().'<br />';
|
660 |
|
|
|
661 |
|
|
if($database->query("UPDATE `".TABLE_PREFIX."mod_form_settings` SET `success_email_subject` = '$success_email_subject' WHERE `section_id` = $section_id")) {
|
662 |
|
|
echo 'Database data success_email_subject added successfully<br>';
|
663 |
|
|
}
|
664 |
|
|
echo mysql_error().'<br />';
|
665 |
|
|
|
666 |
|
|
}
|
667 |
|
|
|
668 |
|
|
// copy field email_to to success_email_from
|
669 |
|
|
$query_dates = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_form_settings where section_id != 0 and page_id != 0");
|
670 |
|
|
while($result = $query_dates->fetchRow()) {
|
671 |
|
|
|
672 |
|
|
echo "<B>Copying field email_to to success_email_from for form section_id= ".$result['section_id']."</B><BR>";
|
673 |
|
|
$section_id = $result['section_id'];
|
674 |
|
|
|
675 |
|
|
$success_email_from = $result['email_to'];
|
676 |
|
|
if($database->query("UPDATE `".TABLE_PREFIX."mod_form_settings` SET `success_email_from` = '$success_email_from' WHERE `section_id` = $section_id")) {
|
677 |
|
|
echo 'Copyied field email_to to success_email_from successfully<br>';
|
678 |
|
|
}
|
679 |
|
|
echo mysql_error().'<br />';
|
680 |
|
|
}
|
681 |
|
|
|
682 |
|
|
|
683 |
714
|
Ruebenwurz
|
/**********************************************************
|
684 |
|
|
* - News Modul
|
685 |
|
|
*/
|
686 |
644
|
thorn
|
db_add_field('published_when', 'mod_news_posts', "INT NOT NULL AFTER `commenting`");
|
687 |
|
|
db_add_field('published_until', 'mod_news_posts', "INT NOT NULL AFTER `published_when`");
|
688 |
562
|
Ruebenwurz
|
|
689 |
|
|
// These are the default setting
|
690 |
|
|
$header = '<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"98%\">';
|
691 |
|
|
$post_loop = '<tr class=\"post_top\">
|
692 |
|
|
<td class=\"post_title\"><a href=\"[LINK]\">[TITLE]</a></td>
|
693 |
|
|
<td class=\"post_date\">[MODI_TIME], [MODI_DATE]</td>
|
694 |
|
|
</tr>
|
695 |
|
|
<tr>
|
696 |
|
|
<td class=\"post_short\" colspan=\"2\">
|
697 |
|
|
[SHORT]
|
698 |
|
|
<a href=\"[LINK]\">[TEXT_READ_MORE]</a>
|
699 |
|
|
</td>
|
700 |
|
|
</tr>';
|
701 |
|
|
$post_header = addslashes('<table cellpadding="0" cellspacing="0" border="0" width="100%">
|
702 |
|
|
<tr>
|
703 |
|
|
<td height="30"><h1>[TITLE]</h1></td>
|
704 |
|
|
<td rowspan="3" style="display: [DISPLAY_IMAGE]"><img src="[GROUP_IMAGE]" alt="[GROUP_TITLE]" /></td>
|
705 |
|
|
</tr>
|
706 |
|
|
<tr>
|
707 |
|
|
<td valign="top"><b>Posted by [DISPLAY_NAME] ([USERNAME]) on [PUBL_DATE]</b></td>
|
708 |
|
|
</tr>
|
709 |
|
|
<tr style="display: [DISPLAY_GROUP]">
|
710 |
|
|
<td valign="top"><a href="[BACK]">[PAGE_TITLE]</a> >> <a href="[BACK]?g=[GROUP_ID]">[GROUP_TITLE]</a></td>
|
711 |
|
|
</tr>
|
712 |
|
|
</table>
|
713 |
|
|
<p style="text-align: justify;">');
|
714 |
|
|
$post_footer = '</p><p>Last changed: [MODI_DATE] at [MODI_TIME]</p>
|
715 |
|
|
<a href=\"[BACK]\">Back</a>';
|
716 |
|
|
$comments_header = addslashes('<br /><br />
|
717 |
|
|
<h2>Comments</h2>
|
718 |
|
|
<table cellpadding="2" cellspacing="0" border="0" width="98%">');
|
719 |
|
|
|
720 |
|
|
// Insert default settings into database
|
721 |
|
|
$query_dates = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_settings where section_id != 0 and page_id != 0");
|
722 |
|
|
while($result = $query_dates->fetchRow()) {
|
723 |
|
|
|
724 |
|
|
echo "<B>Add default settings data to database for news section_id= ".$result['section_id']."</b><BR>";
|
725 |
|
|
$section_id = $result['section_id'];
|
726 |
|
|
|
727 |
|
|
if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `header` = '$header' WHERE `section_id` = $section_id")) {
|
728 |
|
|
echo 'Database data header added successfully<br>';
|
729 |
|
|
}
|
730 |
|
|
echo mysql_error().'<br />';
|
731 |
|
|
|
732 |
|
|
if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `post_loop` = '$post_loop' WHERE `section_id` = $section_id")) {
|
733 |
|
|
echo 'Database data post_loop added successfully<br>';
|
734 |
|
|
}
|
735 |
|
|
echo mysql_error().'<br />';
|
736 |
|
|
|
737 |
|
|
if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `post_header` = '$post_header' WHERE `section_id` = $section_id")) {
|
738 |
|
|
echo 'Database data post_header added successfully<br>';
|
739 |
|
|
}
|
740 |
|
|
echo mysql_error().'<br />';
|
741 |
|
|
|
742 |
|
|
if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `post_footer` = '$post_footer' WHERE `section_id` = $section_id")) {
|
743 |
|
|
echo 'Database data post_footer added successfully<br>';
|
744 |
|
|
}
|
745 |
|
|
echo mysql_error().'<br />';
|
746 |
|
|
|
747 |
|
|
if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `comments_header` = '$comments_header' WHERE `section_id` = $section_id")) {
|
748 |
|
|
echo 'Database data comments_header added successfully<br>';
|
749 |
|
|
}
|
750 |
|
|
echo mysql_error().'<br />';
|
751 |
|
|
|
752 |
|
|
}
|
753 |
|
|
|
754 |
|
|
// MIGRATING FIELD DATES to POSTED_WHEN
|
755 |
|
|
$query_dates = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_posts where section_id != 0 and page_id != 0");
|
756 |
648
|
thorn
|
if($query_dates->numRows() > 0) {
|
757 |
|
|
echo "<B>Copying field posted_when value to published_when</B><BR>";
|
758 |
|
|
}
|
759 |
562
|
Ruebenwurz
|
while($result = $query_dates->fetchRow()) {
|
760 |
|
|
$pid = $result['post_id'];
|
761 |
|
|
$NEW_DATE = $result['posted_when'];
|
762 |
|
|
if($database->query("UPDATE `".TABLE_PREFIX."mod_news_posts` SET `published_when` = '$NEW_DATE' WHERE `post_id` = $pid")) {
|
763 |
|
|
echo 'Copying posted_when value to published_when successfully<br>';
|
764 |
|
|
}
|
765 |
|
|
echo mysql_error().'<br />';
|
766 |
|
|
}
|
767 |
|
|
|
768 |
720
|
doc
|
/**********************************************************
|
769 |
725
|
doc
|
* - Alter the WYSIWYG editor (longtext, default FCK)
|
770 |
720
|
doc
|
*/
|
771 |
725
|
doc
|
echo "<br /><u>Alter WYSIWYG editor settings</u><br />Alter field content from text to longtext: ";
|
772 |
720
|
doc
|
echo ($database->query("ALTER TABLE ".TABLE_PREFIX."mod_wysiwyg MODIFY content LONGTEXT NOT NULL")) ?" $OK<br />" : " $FAIL<br />";
|
773 |
725
|
doc
|
if(file_exists(WB_PATH .'/modules/fckeditor/include.php')) {
|
774 |
|
|
echo "Make FCKEditor the new default editor: ";
|
775 |
|
|
echo ($database->query("UPDATE ".TABLE_PREFIX."settings SET value='fckeditor' WHERE name='wysiwyg_editor'")) ?" $OK<br />" : " $FAIL<br />";
|
776 |
|
|
}
|
777 |
562
|
Ruebenwurz
|
|
778 |
714
|
Ruebenwurz
|
/**********************************************************
|
779 |
|
|
* - Add Admintools to Administrator group
|
780 |
|
|
*/
|
781 |
720
|
doc
|
echo "<br /><u>Add Admintools to Adminsitrator group</u><br />Status: ";
|
782 |
714
|
Ruebenwurz
|
$full_system_permissions = 'pages,pages_view,pages_add,pages_add_l0,pages_settings,pages_modify,pages_intro,pages_delete,media,media_view,media_upload,media_rename,media_delete,media_create,addons,modules,modules_view,modules_install,modules_uninstall,templates,templates_view,templates_install,templates_uninstall,languages,languages_view,languages_install,languages_uninstall,settings,settings_basic,settings_advanced,access,users,users_view,users_add,users_modify,users_delete,groups,groups_view,groups_add,groups_modify,groups_delete,admintools';
|
783 |
720
|
doc
|
echo ($database->query("UPDATE `".TABLE_PREFIX."groups` SET `system_permissions` = '$full_system_permissions' WHERE `name` = 'Administrators'")) ? " $OK<br />" : " $FAIL<br />";
|
784 |
644
|
thorn
|
|
785 |
714
|
Ruebenwurz
|
/**********************************************************
|
786 |
|
|
* - Add Mailer Settings to settings table
|
787 |
|
|
*/
|
788 |
720
|
doc
|
echo "<br /><u>Add Mailer Settings to settings table</u><br />Status: ";
|
789 |
714
|
Ruebenwurz
|
//delete rows to prevent double entries
|
790 |
|
|
$database->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name = 'wbmailer_routine'");
|
791 |
|
|
$database->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name = 'server_email'");
|
792 |
|
|
$database->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name = 'wbmailer_default_sendername'");
|
793 |
|
|
$database->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name = 'wbmailer_smtp_host'");
|
794 |
|
|
$database->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name = 'wbmailer_smtp_auth'");
|
795 |
|
|
$database->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name = 'wbmailer_smtp_username'");
|
796 |
|
|
$database->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name = 'wbmailer_smtp_password'");
|
797 |
|
|
//add new rows with default values
|
798 |
720
|
doc
|
$wbmailer_smtp_host = (defined('WBMAILER_SMTP_HOST')) ? WBMAILER_SMTP_HOST : '';
|
799 |
724
|
doc
|
$wbmailer_routine = ($wbmailer_smtp_host == '') ? 'phpmail' : 'smtp';
|
800 |
714
|
Ruebenwurz
|
$settings_rows= "INSERT INTO `".TABLE_PREFIX."settings` "
|
801 |
|
|
." (name, value) VALUES "
|
802 |
720
|
doc
|
." ('wbmailer_routine', '$wbmailer_routine'),"
|
803 |
714
|
Ruebenwurz
|
." ('server_email', 'admin@yourdomain.com')," // avoid that mail provider (e.g. mail.com) reject mails like yourname@mail.com
|
804 |
|
|
." ('wbmailer_default_sendername', 'WB Mailer'),"
|
805 |
720
|
doc
|
." ('wbmailer_smtp_host', '$wbmailer_smtp_host'),"
|
806 |
714
|
Ruebenwurz
|
." ('wbmailer_smtp_auth', ''),"
|
807 |
|
|
." ('wbmailer_smtp_username', ''),"
|
808 |
|
|
." ('wbmailer_smtp_password', '')";
|
809 |
720
|
doc
|
echo ($database->query($settings_rows)) ? " $OK<br />" : " $FAIL<br />";
|
810 |
644
|
thorn
|
|
811 |
720
|
doc
|
/**********************************************************
|
812 |
|
|
* - Set Version to WB 2.7
|
813 |
|
|
*/
|
814 |
|
|
echo "<br /><u>Update database version number to 2.7</u><br />Status: ";
|
815 |
|
|
$version = '2.7';
|
816 |
|
|
echo ($database->query("UPDATE `".TABLE_PREFIX."settings` SET `value` = '$version' WHERE `name` = 'wb_version'")) ? " $OK<br />" : " $FAIL<br />";
|
817 |
714
|
Ruebenwurz
|
|
818 |
|
|
/**********************************************************
|
819 |
|
|
* - Reload all addons
|
820 |
|
|
*/
|
821 |
|
|
|
822 |
|
|
//delete modules
|
823 |
|
|
$database->query("DELETE FROM ".TABLE_PREFIX."addons WHERE type = 'module'");
|
824 |
|
|
// Load all modules
|
825 |
|
|
if($handle = opendir(WB_PATH.'/modules/')) {
|
826 |
|
|
while(false !== ($file = readdir($handle))) {
|
827 |
|
|
if($file != '' AND substr($file, 0, 1) != '.' AND $file != 'admin.php' AND $file != 'index.php') {
|
828 |
|
|
load_module(WB_PATH.'/modules/'.$file);
|
829 |
|
|
}
|
830 |
|
|
}
|
831 |
|
|
closedir($handle);
|
832 |
|
|
}
|
833 |
|
|
echo '<br />Modules reloaded<br />';
|
834 |
|
|
|
835 |
|
|
//delete templates
|
836 |
|
|
$database->query("DELETE FROM ".TABLE_PREFIX."addons WHERE type = 'template'");
|
837 |
|
|
// Load all templates
|
838 |
|
|
if($handle = opendir(WB_PATH.'/templates/')) {
|
839 |
|
|
while(false !== ($file = readdir($handle))) {
|
840 |
|
|
if($file != '' AND substr($file, 0, 1) != '.' AND $file != 'index.php') {
|
841 |
|
|
load_template(WB_PATH.'/templates/'.$file);
|
842 |
|
|
}
|
843 |
|
|
}
|
844 |
|
|
closedir($handle);
|
845 |
|
|
}
|
846 |
|
|
echo '<br />Templates reloaded<br />';
|
847 |
|
|
|
848 |
|
|
//delete languages
|
849 |
|
|
$database->query("DELETE FROM ".TABLE_PREFIX."addons WHERE type = 'language'");
|
850 |
|
|
// Load all languages
|
851 |
|
|
if($handle = opendir(WB_PATH.'/languages/')) {
|
852 |
|
|
while(false !== ($file = readdir($handle))) {
|
853 |
|
|
if($file != '' AND substr($file, 0, 1) != '.' AND $file != 'index.php') {
|
854 |
|
|
load_language(WB_PATH.'/languages/'.$file);
|
855 |
|
|
}
|
856 |
|
|
}
|
857 |
|
|
closedir($handle);
|
858 |
|
|
}
|
859 |
|
|
echo '<br />Languages reloaded<br />';
|
860 |
|
|
|
861 |
|
|
/**********************************************************
|
862 |
|
|
* - End of upgrade script
|
863 |
|
|
*/
|
864 |
724
|
doc
|
$config_msg = ($wbmailer_smtp_host != '') ? '<br /><br />Note: Please remove the line: <strong>define(\'WBMAILER_SMTP_HOST\', \''.$wbmailer_smtp_host.'\');</strong> from file <strong>config.php</strong> before proceeding!' : '';
|
865 |
722
|
doc
|
echo '<p style="font-size:120%;"><strong>Congratulations: The upgrade script is finished ...</strong></p>';
|
866 |
724
|
doc
|
status_msg('<strong>Warning:</strong><br />Please delete the file <strong>upgrade-script.php</strong> via FTP before proceeding.<br />If you do not delete this script from your server, others can delete/overwritte database settings by executing this script again.'.$config_msg, 'warning', 'div');
|
867 |
722
|
doc
|
// show buttons to go to the backend or frontend
|
868 |
|
|
echo '<br />';
|
869 |
|
|
if(defined('WB_URL')) {
|
870 |
|
|
echo '<form action="'.WB_URL.'" target="_self">';
|
871 |
724
|
doc
|
echo '<input type="submit" value="kick me to the Frontend" style="float:left;" />';
|
872 |
722
|
doc
|
echo '</form>';
|
873 |
715
|
doc
|
}
|
874 |
722
|
doc
|
if(defined('ADMIN_URL')) {
|
875 |
|
|
echo '<form action="'.ADMIN_URL.'" target="_self">';
|
876 |
724
|
doc
|
echo ' <input type="submit" value="kick me to the Backend" />';
|
877 |
722
|
doc
|
echo '</form>';
|
878 |
|
|
}
|
879 |
|
|
echo '<p> </p>';
|
880 |
|
|
}
|
881 |
552
|
thorn
|
?>
|
882 |
715
|
doc
|
</div>
|
883 |
552
|
thorn
|
</body>
|
884 |
714
|
Ruebenwurz
|
</html>
|