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