Project

General

Profile

« Previous | Next » 

Revision 1418

Added by Dietmar almost 14 years ago

View differences:

upgrade-script.php
1
<?php
2
/**
3
 *
4
 * @category        backend
5
 * @package         installation
6
 * @author          WebsiteBaker Project
7
 * @copyright       2004-2009, Ryan Djurovich
8
 * @copyright       2009-2011, 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 5.2.2 and higher
13
 * @version         $Id$
14
 * @filesource		$HeadURL$
15
 * @lastmodified    $Date$
16
 *
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.2';
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

  
68

  
69

  
70

  
71
    return $data;
72
}
73

  
74

  
75
// check existings tables for upgrade or install
76
function check_wb_tables()
77
{
78
    global $database,$table_list;
79

  
80
 // if prefix inludes '_' or '%'
81
 $search_for = addcslashes ( TABLE_PREFIX, '%_' );
82
 $get_result = $database->query( 'SHOW TABLES LIKE "'.$search_for.'%"');
83

  
84
        // $get_result = $database->query( "SHOW TABLES FROM ".DB_NAME);
85
        $all_tables = array();
86
        if($get_result->numRows() > 0)
87
        {
88
            while ($data = $get_result->fetchRow())
89
            {
90
                $tmp = str_replace(TABLE_PREFIX, '', $data[0]);
91
                if(in_array($tmp,$table_list))
92
                {
93
                    $all_tables[] = $tmp;
94
                }
95
            }
96
        }
97
     return $all_tables;
98
}
99

  
100
// check existing tables
101
$all_tables = check_wb_tables();
102

  
103
// only for array tests
104
function show_array($array=array())
105
{
106
    print '<pre>';
107
    print_r ($array);
108
    print '</pre>';
109
}
110

  
111
?>
112
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
113
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
114
<head>
115
<title>Upgrade script</title>
116
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
117
<style type="text/css">
118
html { overflow: -moz-scrollbars-vertical; /* Force firefox to always show room for a vertical scrollbar */ }
119

  
120
body {
121
	margin:0;
122
	padding:0;
123
	border:0;
124
	background: #EBF7FC;
125
	color:#000;
126
	font-family: 'Trebuchet MS', Verdana, Arial, Helvetica, Sans-Serif;
127
	font-size: small;
128
	height:101%;
129
}
130

  
131
#container {
132
	width:85%;
133
	background: #A8BCCB url(templates/wb_theme/images/background.png) repeat-x;
134
	border:1px solid #000;
135
	color:#000;
136
	margin:2em auto;
137
	padding:0 15px;
138
	min-height: 500px;
139
	text-align:left;
140
}
141

  
142
p { line-height:1.5em; }
143

  
144
h1,h2,h3,h4,h5,h6 {
145
	font-family: Verdana, Arial, Helvetica, sans-serif;
146
	color: #369;
147
	margin-top: 1.0em;
148
	margin-bottom: 0.1em;
149
}
150

  
151
h1 { font-size:150%; }
152
h2 { font-size: 130%; border-bottom: 1px #CCC solid; }
153
h3 { font-size: 120%; }
154

  
155
.ok, .error { font-weight:bold; }
156
.ok { color:green; }
157
.error { color:red; }
158
.check { color:#555; }
159

  
160
.warning {
161
	width: 98%;
162
	background:#FFDBDB;
163
	padding:0.2em;
164
	margin-top:0.5em;
165
	border: 1px solid black;
166
}
167
.info {
168
	width: 98%;
169
	background:#99CC99;
170
	padding:0.2em;
171
	margin-top:0.5em;
172
	border: 1px solid black;
173
}
174

  
175
</style>
176
</head>
177
<body>
178
<div id="container">
179
<img src="templates/wb_theme/images/logo.png" alt="WebsiteBaker Project" />
180

  
181
<h1>WebsiteBaker Upgrade</h1>
182
<p>This script upgrades an existing WebsiteBaker <strong>Version 2.7 and higher</strong> installation to the <strong>Version <?php echo $version ?></strong>. The upgrade script alters the existing WB database to reflect the changes introduced with WB 2.8.x</p>
183

  
184
<?php
185
/**
186
 * Check if disclaimer was accepted
187
 */
188
if (!(isset($_POST['backup_confirmed']) && $_POST['backup_confirmed'] == 'confirmed')) { ?>
189
<h2>Step 1: Backup your files</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.<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>
191

  
192
<form name="send" action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">
193
<textarea cols="80" rows="5">DISCLAIMER: The WebsiteBaker upgrade script is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. One needs to confirm that a manual backup of the /pages folder (including all files and subfolders contained in it) and backup of the entire WebsiteBaker MySQL database was created before you can proceed.</textarea>
194
<br /><br /><input name="backup_confirmed" type="checkbox" value="confirmed" />&nbsp;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
	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');
201
	echo '<br /><br />';
202
    echo "</div>
203
    </body>
204
    </html>
205
    ";
206
	exit();
207
}
208

  
209
echo '<h2>Step 2: Updating database entries</h2>';
210

  
211
require_once(WB_PATH.'/framework/functions.php');
212
require_once(WB_PATH.'/framework/class.admin.php');
213
$admin = new admin('Addons', 'modules', false, false);
214

  
215
$OK   = '<span class="ok">OK</span>';
216
$FAIL = '<span class="error">FAILED</span>';
217

  
218
// function to add a var/value-pair into settings-table
219
function db_add_key_value($key, $value) {
220
	global $database; global $OK; global $FAIL;
221
	$table = TABLE_PREFIX.'settings';
222
	$query = $database->query("SELECT value FROM $table WHERE name = '$key' LIMIT 1");
223
	if($query->numRows() > 0) {
224
		echo "$key: already exists. $OK.<br />";
225
		return true;
226
	} else {
227
		$database->query("INSERT INTO $table (name,value) VALUES ('$key', '$value')");
228
		echo (mysql_error()?mysql_error().'<br />':'');
229
		$query = $database->query("SELECT value FROM $table WHERE name = '$key' LIMIT 1");
230
		if($query->numRows() > 0) {
231
			echo "$key: $OK.<br />";
232
			return true;
233
		} else {
234
			echo "$key: $FAIL!<br />";
235
			return false;
236
		}
237
	}
238
}
239

  
240
// function to add a new field into a table
241
function db_add_field($field, $table, $desc) {
242
	global $database; global $OK; global $FAIL;
243
	$table = TABLE_PREFIX.$table;
244
	$query = $database->query("DESCRIBE $table '$field'");
245
	if($query->numRows() == 0) { // add field
246
		$query = $database->query("ALTER TABLE $table ADD $field $desc");
247
		echo (mysql_error()?mysql_error().'<br />':'');
248
		$query = $database->query("DESCRIBE $table '$field'");
249
		echo (mysql_error()?mysql_error().'<br />':'');
250
		if($query->numRows() > 0) {
251
			echo "'$field' added. $OK.<br />";
252
		} else {
253
			echo "adding '$field' $FAIL!<br />";
254
		}
255
	} else {
256
		echo "'$field' already exists. $OK.<br />";
257
	}
258
}
259

  
260
/**********************************************************
261
 *  - Adding field default_theme to settings table
262
 */
263
echo "<br />Adding default_theme to settings table<br />";
264
$cfg = array(
265
	'default_theme' => 'wb_theme'
266
);
267

  
268
foreach($cfg as $key=>$value) {
269
	db_add_key_value($key, $value);
270
}
271

  
272
/**********************************************************
273
 *  - Adding field warn_page_leave to settings table
274
 */
275
echo "<br />Adding warn_page_leave to settings table<br />";
276
$cfg = array(
277
	'warn_page_leave' => '1'
278
);
279

  
280
foreach($cfg as $key=>$value) {
281
	db_add_key_value($key, $value);
282
}
283

  
284
/**********************************************************
285
 *  - install droplets
286
 */
287
    $drops = (!in_array ( "mod_droplets", $all_tables)) ? "<br />Install droplets<br />" : "<br />Upgrade droplets<br />";
288
    echo $drops;
289

  
290
     $file_name = (!in_array ( "mod_droplets", $all_tables)) ? "install.php" : "upgrade.php";
291
     require_once (WB_PATH."/modules/droplets/".$file_name);
292

  
293
// check again all tables, to get a new array
294
 if(sizeof($all_tables) < 22) { $all_tables = check_wb_tables(); }
295
/**********************************************************
296
 *  - check tables comin with WebsiteBaker
297
 */
298
    $check_text = 'total ';
299
    // $check_tables = mysqlCheckTables( DB_NAME ) ;
300

  
301
    if(sizeof($all_tables) == 22)
302
    {
303
        echo '<h4>NOTICE: Your database '.DB_NAME.' has '.sizeof($all_tables).' '.$check_text.' tables from '.sizeof($table_list).' included in package '.$OK.'</h4>';
304
    }
305
    else
306
    {
307
        status_msg('<strong>WARNING:</strong><br />can\'t run Upgrade, missing tables', 'warning', 'div');
308
    	echo '<h4>Missing required tables. You can install them in backend->addons->modules->advanced. Then again run upgrade-script.php</h4>';
309
        $result = array_diff ( $table_list, $all_tables );
310
        echo '<h4 class="warning"><br />';
311
        while ( list ( $key, $val ) = each ( $result ) )
312
        {
313
            echo TABLE_PREFIX.$val.' '.$FAIL.'<br>';
314
        }
315
        echo '<br /></h4>';
316
    	echo '<br /><form action="'. $_SERVER['PHP_SELF'] .'">';
317
    	echo '<input type="submit" value="kick me back" style="float:left;" />';
318
    	echo '</form>';
319
        if(defined('ADMIN_URL'))
320
        {
321
        	echo '<form action="'.ADMIN_URL.'" target="_self">';
322
        	echo '&nbsp;<input type="submit" value="kick me to the Backend" />';
323
        	echo '</form>';
324
        }
325
        echo "<br /><br /></div>
326
        </body>
327
        </html>
328
        ";
329
        exit();
330
    }
331

  
332
/**********************************************************
333
 *  - Adding field sec_anchor to settings table
334
 */
335

  
336
echo "<br />Adding sec_anchor to settings table<br />";
337
$cfg = array(
338
	'sec_anchor' => 'wb_'
339
);
340
foreach($cfg as $key=>$value) {
341
	db_add_key_value($key, $value);
342
}
343

  
344
/**********************************************************
345
 *  - Adding redirect timer to settings table
346
 */
347
echo "<br />Adding redirect timer to settings table<br />";
348
$cfg = array(
349
	'redirect_timer' => '1500'
350
);
351
foreach($cfg as $key=>$value) {
352
	db_add_key_value($key, $value);
353
}
354

  
355
/**********************************************************
356
 *  - Adding mediasettings to settings table
357
 */
358
echo "<br />Adding mediasettings to settings table<br />";
359
$cfg = array(
360
	'mediasettings' => ''
361
);
362
foreach($cfg as $key=>$value) {
363
	db_add_key_value($key, $value);
364
}
365

  
366
/**********************************************************
367
 *  - Add field "redirect_type" to table "mod_menu_link"
368
 */
369
echo "<br />Adding field redirect_type to mod_menu_link table<br />";
370
db_add_field('redirect_type', 'mod_menu_link', "INT NOT NULL DEFAULT '302' AFTER `target_page_id`");
371

  
372

  
373

  
374
if (version_compare(WB_VERSION, '2.8.0') < 0)
375
{
376
    /**********************************************************
377
     *  - Update search no results database filed to create
378
     *  valid XHTML if search is empty
379
     */
380
    echo "<br />Updating database field `no_results` of search table: ";
381
    $search_no_results = addslashes('<tr><td><p>[TEXT_NO_RESULTS]</p></td></tr>');
382
    $sql = "UPDATE `" . TABLE_PREFIX . "search` SET `value` = '$search_no_results' WHERE `name`= 'no_results'";
383
    $database->query($sql);
384
    echo ($database->query($sql)) ? " $OK<br />" : " $FAIL<br />";
385
    /**********************************************************
386
     *  - Update settings of News Modul
387
     */
388

  
389
    // These are the default setting
390
    $header = '<table cellpadding=\"0\" cellspacing=\"0\" class=\"loop-header\">'."\n";
391
    $post_loop = '<tr class=\"post_top\">
392
<td class=\"post_title\"><a href=\"[LINK]\">[TITLE]</a></td>
393
<td class=\"post_date\">[PUBLISHED_TIME], [PUBLISHED_DATE]</td>
394
</tr>
395
<tr>
396
<td class=\"post_short\" colspan=\"2\">
397
[SHORT]
398
<span style=\"visibility:[SHOW_READ_MORE];\"><a href=\"[LINK]\">[TEXT_READ_MORE]</a></span>
399
</td>
400
</tr>';
401
    $footer = '</table>
402
<table cellpadding="0" cellspacing="0" class="page-header" style="display: [DISPLAY_PREVIOUS_NEXT_LINKS]">
403
<tr>
404
<td class="page-left">[PREVIOUS_PAGE_LINK]</td>
405
<td class="page-center">[OF]</td>
406
<td class="page-right">[NEXT_PAGE_LINK]</td>
407
</tr>
408
</table>';
409
    $post_header = addslashes('<table cellpadding="0" cellspacing="0" class="post-header">
410
<tr>
411
<td><h1>[TITLE]</h1></td>
412
<td rowspan="3" style="display: [DISPLAY_IMAGE]">[GROUP_IMAGE]</td>
413
</tr>
414
<tr>
415
<td class="public-info"><b>[TEXT_POSTED_BY] [DISPLAY_NAME] ([USERNAME]) [TEXT_ON] [PUBLISHED_DATE]</b></td>
416
</tr>
417
<tr style="display: [DISPLAY_GROUP]">
418
<td class="group-page"><a href="[BACK]">[PAGE_TITLE]</a> &gt;&gt; <a href="[BACK]?g=[GROUP_ID]">[GROUP_TITLE]</a></td>
419
</tr>
420
</table>');
421
    $post_footer = '<p>[TEXT_LAST_CHANGED]: [MODI_DATE] [TEXT_AT] [MODI_TIME]</p>
422
<a href=\"[BACK]\">[TEXT_BACK]</a>';
423
    $comments_header = addslashes('<br /><br />
424
<h2>[TEXT_COMMENTS]</h2>
425
<table cellpadding="2" cellspacing="0" class="comment-header">');
426
    $comments_loop = addslashes('<tr>
427
<td class="comment_title">[TITLE]</td>
428
<td class="comment_info">[TEXT_BY] [DISPLAY_NAME] [TEXT_ON] [DATE] [TEXT_AT] [TIME]</td>
429
</tr>
430
<tr>
431
<td colspan="2" class="comment_text">[COMMENT]</td>
432
</tr>');
433
    $comments_footer = '</table>
434
<br /><a href=\"[ADD_COMMENT_URL]\">[TEXT_ADD_COMMENT]</a>';
435
    $comments_page = '<h1>[TEXT_COMMENT]</h1>
436
<h2>[POST_TITLE]</h2>
437
<br />';
438

  
439
if(in_array('mod_news_settings', $all_tables))
440
{
441
   // Insert default settings into database
442
   $query_dates = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_settings where section_id != 0 and page_id != 0");
443
   if($query_dates->numRows() > 1)
444
   {
445
        while($result = $query_dates->fetchRow())
446
        {
447

  
448
        	echo "<br /><u>Add default settings to database for news section_id= ".$result['section_id']."</u><br />";
449
        	$section_id = $result['section_id'];
450

  
451
        	if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `header` = '$header' WHERE `section_id` = $section_id")) {
452
        		echo 'Database data header added successfully';
453
        	}
454
        	echo mysql_error().'<br />';
455

  
456
        	if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `post_loop` = '$post_loop' WHERE `section_id` = $section_id")) {
457
        		echo 'Database data post_loop added successfully';
458
        	}
459
        	echo mysql_error().'<br />';
460

  
461
        	if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `footer` = '$footer' WHERE `section_id` = $section_id")) {
462
        		echo 'Database data footer added successfully';
463
        	}
464
        	echo mysql_error().'<br />';
465

  
466
        	if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `post_header` = '$post_header' WHERE `section_id` = $section_id")) {
467
        		echo 'Database data post_header added successfully';
468
        	}
469
        	echo mysql_error().'<br />';
470

  
471
        	if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `post_footer` = '$post_footer' WHERE `section_id` = $section_id")) {
472
        		echo 'Database data post_footer added successfully';
473
        	}
474
        	echo mysql_error().'<br />';
475

  
476
        	if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `comments_header` = '$comments_header' WHERE `section_id` = $section_id")) {
477
        		echo 'Database data comments_header added successfully';
478
        	}
479
        	echo mysql_error().'<br />';
480

  
481
        	if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `comments_loop` = '$comments_loop' WHERE `section_id` = $section_id")) {
482
        		echo 'Database data comments_loop added successfully';
483
        	}
484
        	echo mysql_error().'<br />';
485

  
486
        	if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `comments_footer` = '$comments_footer' WHERE `section_id` = $section_id")) {
487
        		echo 'Database data comments_footer added successfully';
488
        	}
489
        	echo mysql_error().'<br />';
490

  
491
        	if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `comments_page` = '$comments_page' WHERE `section_id` = $section_id")) {
492
        		echo 'Database data comments_page added successfully';
493
        	}
494
        	echo mysql_error().'<br />';
495

  
496
        }
497

  
498

  
499
      if ((version_compare(WB_VERSION, '2.8.1') <= 0) && file_exists(WB_PATH."/modules/news/upgrade.php"))
500
      {
501
              echo '<h4>Upgrade existings postfiles to new format</h4><br />';
502
              // change old postfiles to new postfiles
503
              require_once(WB_PATH."/modules/news/upgrade.php");
504
      }
505
    }
506

  
507
   }
508

  
509
}
510

  
511
/**********************************************************
512
 *  - Set Version to WB 2.8.2
513
 */
514
echo "<br />Update database version number to 2.8.2 : ";
515
echo ($database->query("UPDATE `".TABLE_PREFIX."settings` SET `value` = '$version' WHERE `name` = 'wb_version'")) ? " $OK<br />" : " $FAIL<br />";
516

  
517
/**********************************************************
518
 *  - Reload all addons
519
 */
520

  
521
//delete modules
522
$database->query("DELETE FROM ".TABLE_PREFIX."addons WHERE type = 'module'");
523
// Load all modules
524
if($handle = opendir(WB_PATH.'/modules/')) {
525
	while(false !== ($file = readdir($handle))) {
526
		if($file != '' AND substr($file, 0, 1) != '.' AND $file != 'admin.php' AND $file != 'index.php') {
527
			load_module(WB_PATH.'/modules/'.$file);
528
		}
529
	}
530
	closedir($handle);
531
}
532
echo '<br />Modules reloaded<br />';
533

  
534
//delete templates		
535
$database->query("DELETE FROM ".TABLE_PREFIX."addons WHERE type = 'template'");
536
// Load all templates
537
if($handle = opendir(WB_PATH.'/templates/')) {
538
	while(false !== ($file = readdir($handle))) {
539
		if($file != '' AND substr($file, 0, 1) != '.' AND $file != 'index.php') {
540
			load_template(WB_PATH.'/templates/'.$file);
541
		}
542
	}
543
	closedir($handle);
544
}
545
echo '<br />Templates reloaded<br />';
546

  
547
//delete languages
548
$database->query("DELETE FROM ".TABLE_PREFIX."addons WHERE type = 'language'");
549
// Load all languages
550
if($handle = opendir(WB_PATH.'/languages/')) {
551
	while(false !== ($file = readdir($handle))) {
552
		if($file != '' AND substr($file, 0, 1) != '.' AND $file != 'index.php') {
553
			load_language(WB_PATH.'/languages/'.$file);
554
		}
555
	}
556
	closedir($handle);
557
}
558
echo '<br />Languages reloaded<br />';
559

  
560

  
561
/**********************************************************
562
 *  - End of upgrade script
563
 */
564

  
565
// require(WB_PATH.'/framework/initialize.php');
566

  
567
if(!defined('DEFAULT_THEME')) { define('DEFAULT_THEME', 'wb_theme'); }
568
if(!defined('THEME_PATH')) { define('THEME_PATH', WB_PATH.'/templates/'.DEFAULT_THEME);}
569

  
570
echo '<p style="font-size:120%;"><strong>Congratulations: The upgrade script is finished ...</strong></p>';
571
status_msg('<strong>Warning:</strong><br />Please delete the file <strong>upgrade-script.php</strong> via FTP before proceeding.', 'warning', 'div');
572
// show buttons to go to the backend or frontend
573
echo '<br />';
574
if(defined('WB_URL')) {
575
	echo '<form action="'.WB_URL.'">';
576
	echo '<input type="submit" value="kick me to the Frontend" style="float:left;" />';
577
	echo '</form>';
578
}
579
if(defined('ADMIN_URL')) {
580
	echo '<form action="'.ADMIN_URL.'">';
581
	echo '&nbsp;<input type="submit" value="kick me to the Backend" />';
582
	echo '</form>';
583
}
584
echo '<p>&nbsp;</p>';
585

  
586
?>
587
</div>
588
</body>
1
<?php
2
/**
3
 *
4
 * @category        backend
5
 * @package         installation
6
 * @author          WebsiteBaker Project
7
 * @copyright       2004-2009, Ryan Djurovich
8
 * @copyright       2009-2011, 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 5.2.2 and higher
13
 * @version         $Id$
14
 * @filesource		$HeadURL$
15
 * @lastmodified    $Date$
16
 *
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.2';
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

  
68

  
69

  
70

  
71
    return $data;
72
}
73

  
74

  
75
// check existings tables for upgrade or install
76
function check_wb_tables()
77
{
78
    global $database,$table_list;
79

  
80
 // if prefix inludes '_' or '%'
81
 $search_for = addcslashes ( TABLE_PREFIX, '%_' );
82
 $get_result = $database->query( 'SHOW TABLES LIKE "'.$search_for.'%"');
83

  
84
        // $get_result = $database->query( "SHOW TABLES FROM ".DB_NAME);
85
        $all_tables = array();
86
        if($get_result->numRows() > 0)
87
        {
88
            while ($data = $get_result->fetchRow())
89
            {
90
                $tmp = str_replace(TABLE_PREFIX, '', $data[0]);
91
                if(in_array($tmp,$table_list))
92
                {
93
                    $all_tables[] = $tmp;
94
                }
95
            }
96
        }
97
     return $all_tables;
98
}
99

  
100
// check existing tables
101
$all_tables = check_wb_tables();
102

  
103
// only for array tests
104
function show_array($array=array())
105
{
106
    print '<pre>';
107
    print_r ($array);
108
    print '</pre>';
109
}
110

  
111
?>
112
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
113
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
114
<head>
115
<title>Upgrade script</title>
116
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
117
<style type="text/css">
118
html { overflow: -moz-scrollbars-vertical; /* Force firefox to always show room for a vertical scrollbar */ }
119

  
120
body {
121
	margin:0;
122
	padding:0;
123
	border:0;
124
	background: #EBF7FC;
125
	color:#000;
126
	font-family: 'Trebuchet MS', Verdana, Arial, Helvetica, Sans-Serif;
127
	font-size: small;
128
	height:101%;
129
}
130

  
131
#container {
132
	width:85%;
133
	background: #A8BCCB url(templates/wb_theme/images/background.png) repeat-x;
134
	border:1px solid #000;
135
	color:#000;
136
	margin:2em auto;
137
	padding:0 15px;
138
	min-height: 500px;
139
	text-align:left;
140
}
141

  
142
p { line-height:1.5em; }
143

  
144
h1,h2,h3,h4,h5,h6 {
145
	font-family: Verdana, Arial, Helvetica, sans-serif;
146
	color: #369;
147
	margin-top: 1.0em;
148
	margin-bottom: 0.1em;
149
}
150

  
151
h1 { font-size:150%; }
152
h2 { font-size: 130%; border-bottom: 1px #CCC solid; }
153
h3 { font-size: 120%; }
154

  
155
.ok, .error { font-weight:bold; }
156
.ok { color:green; }
157
.error { color:red; }
158
.check { color:#555; }
159

  
160
.warning {
161
	width: 98%;
162
	background:#FFDBDB;
163
	padding:0.2em;
164
	margin-top:0.5em;
165
	border: 1px solid black;
166
}
167
.info {
168
	width: 98%;
169
	background:#99CC99;
170
	padding:0.2em;
171
	margin-top:0.5em;
172
	border: 1px solid black;
173
}
174

  
175
</style>
176
</head>
177
<body>
178
<div id="container">
179
<img src="templates/wb_theme/images/logo.png" alt="WebsiteBaker Project" />
180

  
181
<h1>WebsiteBaker Upgrade</h1>
182
<p>This script upgrades an existing WebsiteBaker <strong>Version 2.7 and higher</strong> installation to the <strong>Version <?php echo $version ?></strong>. The upgrade script alters the existing WB database to reflect the changes introduced with WB 2.8.x</p>
183

  
184
<?php
185
/**
186
 * Check if disclaimer was accepted
187
 */
188
if (!(isset($_POST['backup_confirmed']) && $_POST['backup_confirmed'] == 'confirmed')) { ?>
189
<h2>Step 1: Backup your files</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.<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>
191

  
192
<form name="send" action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">
193
<textarea cols="80" rows="5">DISCLAIMER: The WebsiteBaker upgrade script is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. One needs to confirm that a manual backup of the /pages folder (including all files and subfolders contained in it) and backup of the entire WebsiteBaker MySQL database was created before you can proceed.</textarea>
194
<br /><br /><input name="backup_confirmed" type="checkbox" value="confirmed" />&nbsp;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
	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');
201
	echo '<br /><br />';
202
    echo "</div>
203
    </body>
204
    </html>
205
    ";
206
	exit();
207
}
208

  
209
echo '<h2>Step 2: Updating database entries</h2>';
210

  
211
require_once(WB_PATH.'/framework/functions.php');
212
require_once(WB_PATH.'/framework/class.admin.php');
213
$admin = new admin('Addons', 'modules', false, false);
214

  
215
$OK   = '<span class="ok">OK</span>';
216
$FAIL = '<span class="error">FAILED</span>';
217

  
218
// function to add a var/value-pair into settings-table
219
function db_add_key_value($key, $value) {
220
	global $database; global $OK; global $FAIL;
221
	$table = TABLE_PREFIX.'settings';
222
	$query = $database->query("SELECT value FROM $table WHERE name = '$key' LIMIT 1");
223
	if($query->numRows() > 0) {
224
		echo "$key: already exists. $OK.<br />";
225
		return true;
226
	} else {
227
		$database->query("INSERT INTO $table (name,value) VALUES ('$key', '$value')");
228
		echo (mysql_error()?mysql_error().'<br />':'');
229
		$query = $database->query("SELECT value FROM $table WHERE name = '$key' LIMIT 1");
230
		if($query->numRows() > 0) {
231
			echo "$key: $OK.<br />";
232
			return true;
233
		} else {
234
			echo "$key: $FAIL!<br />";
235
			return false;
236
		}
237
	}
238
}
239

  
240
// function to add a new field into a table
241
function db_add_field($field, $table, $desc) {
242
	global $database; global $OK; global $FAIL;
243
	$table = TABLE_PREFIX.$table;
244
	$query = $database->query("DESCRIBE $table '$field'");
245
	if($query->numRows() == 0) { // add field
246
		$query = $database->query("ALTER TABLE $table ADD $field $desc");
247
		echo (mysql_error()?mysql_error().'<br />':'');
248
		$query = $database->query("DESCRIBE $table '$field'");
249
		echo (mysql_error()?mysql_error().'<br />':'');
250
		if($query->numRows() > 0) {
251
			echo "'$field' added. $OK.<br />";
252
		} else {
253
			echo "adding '$field' $FAIL!<br />";
254
		}
255
	} else {
256
		echo "'$field' already exists. $OK.<br />";
257
	}
258
}
259

  
260
/**********************************************************
261
 *  - Adding field default_theme to settings table
262
 */
263
echo "<br />Adding default_theme to settings table<br />";
264
$cfg = array(
265
	'default_theme' => 'wb_theme'
266
);
267

  
268
foreach($cfg as $key=>$value) {
269
	db_add_key_value($key, $value);
270
}
271

  
272
/**********************************************************
273
 *  - install droplets
274
 */
275
    $drops = (!in_array ( "mod_droplets", $all_tables)) ? "<br />Install droplets<br />" : "<br />Upgrade droplets<br />";
276
    echo $drops;
277

  
278
     $file_name = (!in_array ( "mod_droplets", $all_tables)) ? "install.php" : "upgrade.php";
279
     require_once (WB_PATH."/modules/droplets/".$file_name);
280

  
281
// check again all tables, to get a new array
282
 if(sizeof($all_tables) < 22) { $all_tables = check_wb_tables(); }
283
/**********************************************************
284
 *  - check tables comin with WebsiteBaker
285
 */
286
    $check_text = 'total ';
287
    // $check_tables = mysqlCheckTables( DB_NAME ) ;
288

  
289
    if(sizeof($all_tables) == 22)
290
    {
291
        echo '<h4>NOTICE: Your database '.DB_NAME.' has '.sizeof($all_tables).' '.$check_text.' tables from '.sizeof($table_list).' included in package '.$OK.'</h4>';
292
    }
293
    else
294
    {
295
        status_msg('<strong>WARNING:</strong><br />can\'t run Upgrade, missing tables', 'warning', 'div');
296
    	echo '<h4>Missing required tables. You can install them in backend->addons->modules->advanced. Then again run upgrade-script.php</h4>';
297
        $result = array_diff ( $table_list, $all_tables );
298
        echo '<h4 class="warning"><br />';
299
        while ( list ( $key, $val ) = each ( $result ) )
300
        {
301
            echo TABLE_PREFIX.$val.' '.$FAIL.'<br>';
302
        }
303
        echo '<br /></h4>';
304
    	echo '<br /><form action="'. $_SERVER['PHP_SELF'] .'">';
305
    	echo '<input type="submit" value="kick me back" style="float:left;" />';
306
    	echo '</form>';
307
        if(defined('ADMIN_URL'))
308
        {
309
        	echo '<form action="'.ADMIN_URL.'" target="_self">';
310
        	echo '&nbsp;<input type="submit" value="kick me to the Backend" />';
311
        	echo '</form>';
312
        }
313
        echo "<br /><br /></div>
314
        </body>
315
        </html>
316
        ";
317
        exit();
318
    }
319

  
320
/**********************************************************
321
 *  - Adding field sec_anchor to settings table
322
 */
323

  
324
echo "<br />Adding sec_anchor to settings table<br />";
325
$cfg = array(
326
	'sec_anchor' => 'wb_'
327
);
328
foreach($cfg as $key=>$value) {
329
	db_add_key_value($key, $value);
330
}
331

  
332
/**********************************************************
333
 *  - Adding redirect timer to settings table
334
 */
335
echo "<br />Adding redirect timer to settings table<br />";
336
$cfg = array(
337
	'redirect_timer' => '1500'
338
);
339
foreach($cfg as $key=>$value) {
340
	db_add_key_value($key, $value);
341
}
342

  
343
/**********************************************************
344
 *  - Adding mediasettings to settings table
345
 */
346
echo "<br />Adding mediasettings to settings table<br />";
347
$cfg = array(
348
	'mediasettings' => ''
349
);
350
foreach($cfg as $key=>$value) {
351
	db_add_key_value($key, $value);
352
}
353

  
354
/**********************************************************
355
 *  - Add field "redirect_type" to table "mod_menu_link"
356
 */
357
echo "<br />Adding field redirect_type to mod_menu_link table<br />";
358
db_add_field('redirect_type', 'mod_menu_link', "INT NOT NULL DEFAULT '302' AFTER `target_page_id`");
359

  
360

  
361

  
362
if (version_compare(WB_VERSION, '2.8.0') < 0)
363
{
364
    /**********************************************************
365
     *  - Update search no results database filed to create
366
     *  valid XHTML if search is empty
367
     */
368
    echo "<br />Updating database field `no_results` of search table: ";
369
    $search_no_results = addslashes('<tr><td><p>[TEXT_NO_RESULTS]</p></td></tr>');
370
    $sql = "UPDATE `" . TABLE_PREFIX . "search` SET `value` = '$search_no_results' WHERE `name`= 'no_results'";
371
    $database->query($sql);
372
    echo ($database->query($sql)) ? " $OK<br />" : " $FAIL<br />";
373
    /**********************************************************
374
     *  - Update settings of News Modul
375
     */
376

  
377
    // These are the default setting
378
    $header = '<table cellpadding=\"0\" cellspacing=\"0\" class=\"loop-header\">'."\n";
379
    $post_loop = '<tr class=\"post_top\">
380
<td class=\"post_title\"><a href=\"[LINK]\">[TITLE]</a></td>
381
<td class=\"post_date\">[PUBLISHED_TIME], [PUBLISHED_DATE]</td>
382
</tr>
383
<tr>
384
<td class=\"post_short\" colspan=\"2\">
385
[SHORT]
386
<span style=\"visibility:[SHOW_READ_MORE];\"><a href=\"[LINK]\">[TEXT_READ_MORE]</a></span>
387
</td>
388
</tr>';
389
    $footer = '</table>
390
<table cellpadding="0" cellspacing="0" class="page-header" style="display: [DISPLAY_PREVIOUS_NEXT_LINKS]">
391
<tr>
392
<td class="page-left">[PREVIOUS_PAGE_LINK]</td>
393
<td class="page-center">[OF]</td>
394
<td class="page-right">[NEXT_PAGE_LINK]</td>
395
</tr>
396
</table>';
397
    $post_header = addslashes('<table cellpadding="0" cellspacing="0" class="post-header">
398
<tr>
399
<td><h1>[TITLE]</h1></td>
400
<td rowspan="3" style="display: [DISPLAY_IMAGE]">[GROUP_IMAGE]</td>
401
</tr>
402
<tr>
403
<td class="public-info"><b>[TEXT_POSTED_BY] [DISPLAY_NAME] ([USERNAME]) [TEXT_ON] [PUBLISHED_DATE]</b></td>
404
</tr>
405
<tr style="display: [DISPLAY_GROUP]">
406
<td class="group-page"><a href="[BACK]">[PAGE_TITLE]</a> &gt;&gt; <a href="[BACK]?g=[GROUP_ID]">[GROUP_TITLE]</a></td>
407
</tr>
408
</table>');
409
    $post_footer = '<p>[TEXT_LAST_CHANGED]: [MODI_DATE] [TEXT_AT] [MODI_TIME]</p>
410
<a href=\"[BACK]\">[TEXT_BACK]</a>';
411
    $comments_header = addslashes('<br /><br />
412
<h2>[TEXT_COMMENTS]</h2>
413
<table cellpadding="2" cellspacing="0" class="comment-header">');
414
    $comments_loop = addslashes('<tr>
415
<td class="comment_title">[TITLE]</td>
416
<td class="comment_info">[TEXT_BY] [DISPLAY_NAME] [TEXT_ON] [DATE] [TEXT_AT] [TIME]</td>
417
</tr>
418
<tr>
419
<td colspan="2" class="comment_text">[COMMENT]</td>
420
</tr>');
421
    $comments_footer = '</table>
422
<br /><a href=\"[ADD_COMMENT_URL]\">[TEXT_ADD_COMMENT]</a>';
423
    $comments_page = '<h1>[TEXT_COMMENT]</h1>
424
<h2>[POST_TITLE]</h2>
425
<br />';
426

  
427
if(in_array('mod_news_settings', $all_tables))
428
{
429
   // Insert default settings into database
430
   $query_dates = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_settings where section_id != 0 and page_id != 0");
431
   if($query_dates->numRows() > 1)
432
   {
433
        while($result = $query_dates->fetchRow())
434
        {
435

  
436
        	echo "<br /><u>Add default settings to database for news section_id= ".$result['section_id']."</u><br />";
437
        	$section_id = $result['section_id'];
438

  
439
        	if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `header` = '$header' WHERE `section_id` = $section_id")) {
440
        		echo 'Database data header added successfully';
441
        	}
442
        	echo mysql_error().'<br />';
443

  
444
        	if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `post_loop` = '$post_loop' WHERE `section_id` = $section_id")) {
445
        		echo 'Database data post_loop added successfully';
446
        	}
447
        	echo mysql_error().'<br />';
448

  
449
        	if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `footer` = '$footer' WHERE `section_id` = $section_id")) {
450
        		echo 'Database data footer added successfully';
451
        	}
452
        	echo mysql_error().'<br />';
453

  
454
        	if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `post_header` = '$post_header' WHERE `section_id` = $section_id")) {
455
        		echo 'Database data post_header added successfully';
456
        	}
457
        	echo mysql_error().'<br />';
458

  
459
        	if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `post_footer` = '$post_footer' WHERE `section_id` = $section_id")) {
460
        		echo 'Database data post_footer added successfully';
461
        	}
462
        	echo mysql_error().'<br />';
463

  
464
        	if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `comments_header` = '$comments_header' WHERE `section_id` = $section_id")) {
465
        		echo 'Database data comments_header added successfully';
466
        	}
467
        	echo mysql_error().'<br />';
468

  
469
        	if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `comments_loop` = '$comments_loop' WHERE `section_id` = $section_id")) {
470
        		echo 'Database data comments_loop added successfully';
471
        	}
472
        	echo mysql_error().'<br />';
473

  
474
        	if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `comments_footer` = '$comments_footer' WHERE `section_id` = $section_id")) {
475
        		echo 'Database data comments_footer added successfully';
476
        	}
477
        	echo mysql_error().'<br />';
478

  
479
        	if($database->query("UPDATE `".TABLE_PREFIX."mod_news_settings` SET `comments_page` = '$comments_page' WHERE `section_id` = $section_id")) {
480
        		echo 'Database data comments_page added successfully';
481
        	}
482
        	echo mysql_error().'<br />';
483

  
484
        }
485

  
486

  
487
      if ((version_compare(WB_VERSION, '2.8.1') <= 0) && file_exists(WB_PATH."/modules/news/upgrade.php"))
488
      {
489
              echo '<h4>Upgrade existings postfiles to new format</h4><br />';
490
              // change old postfiles to new postfiles
491
              require_once(WB_PATH."/modules/news/upgrade.php");
492
      }
493
    }
494

  
495
   }
496

  
497
}
498

  
499
/**********************************************************
500
 *  - Set Version to WB 2.8.2
501
 */
502
echo "<br />Update database version number to 2.8.2 : ";
503
echo ($database->query("UPDATE `".TABLE_PREFIX."settings` SET `value` = '$version' WHERE `name` = 'wb_version'")) ? " $OK<br />" : " $FAIL<br />";
504

  
505
/**********************************************************
506
 *  - Reload all addons
507
 */
508

  
509
//delete modules
510
$database->query("DELETE FROM ".TABLE_PREFIX."addons WHERE type = 'module'");
511
// Load all modules
512
if($handle = opendir(WB_PATH.'/modules/')) {
513
	while(false !== ($file = readdir($handle))) {
514
		if($file != '' AND substr($file, 0, 1) != '.' AND $file != 'admin.php' AND $file != 'index.php') {
515
			load_module(WB_PATH.'/modules/'.$file);
516
		}
517
	}
518
	closedir($handle);
519
}
520
echo '<br />Modules reloaded<br />';
521

  
522
//delete templates		
523
$database->query("DELETE FROM ".TABLE_PREFIX."addons WHERE type = 'template'");
524
// Load all templates
525
if($handle = opendir(WB_PATH.'/templates/')) {
526
	while(false !== ($file = readdir($handle))) {
527
		if($file != '' AND substr($file, 0, 1) != '.' AND $file != 'index.php') {
528
			load_template(WB_PATH.'/templates/'.$file);
529
		}
530
	}
531
	closedir($handle);
532
}
533
echo '<br />Templates reloaded<br />';
534

  
535
//delete languages
536
$database->query("DELETE FROM ".TABLE_PREFIX."addons WHERE type = 'language'");
537
// Load all languages
538
if($handle = opendir(WB_PATH.'/languages/')) {
539
	while(false !== ($file = readdir($handle))) {
540
		if($file != '' AND substr($file, 0, 1) != '.' AND $file != 'index.php') {
541
			load_language(WB_PATH.'/languages/'.$file);
542
		}
543
	}
544
	closedir($handle);
545
}
546
echo '<br />Languages reloaded<br />';
547

  
548

  
549
/**********************************************************
550
 *  - End of upgrade script
551
 */
552

  
553
// require(WB_PATH.'/framework/initialize.php');
554

  
555
if(!defined('DEFAULT_THEME')) { define('DEFAULT_THEME', 'wb_theme'); }
556
if(!defined('THEME_PATH')) { define('THEME_PATH', WB_PATH.'/templates/'.DEFAULT_THEME);}
557

  
558
echo '<p style="font-size:120%;"><strong>Congratulations: The upgrade script is finished ...</strong></p>';
559
status_msg('<strong>Warning:</strong><br />Please delete the file <strong>upgrade-script.php</strong> via FTP before proceeding.', 'warning', 'div');
560
// show buttons to go to the backend or frontend
561
echo '<br />';
562
if(defined('WB_URL')) {
563
	echo '<form action="'.WB_URL.'">';
564
	echo '<input type="submit" value="kick me to the Frontend" style="float:left;" />';
565
	echo '</form>';
566
}
567
if(defined('ADMIN_URL')) {
568
	echo '<form action="'.ADMIN_URL.'">';
569
	echo '&nbsp;<input type="submit" value="kick me to the Backend" />';
570
	echo '</form>';
571
}
572
echo '<p>&nbsp;</p>';
573

  
574
?>
575
</div>
576
</body>
589 577
</html>

Also available in: Unified diff