Project

General

Profile

1
<?php
2
/**
3
 *
4
 * @category        backend
5
 * @package         install
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: index.php 1278 2010-01-28 10:06:24Z Luisehahne $
14
 * @filesource		$HeadURL:  $
15
 * @lastmodified    $Date: $
16
 *
17
 */
18

    
19
// Start a session
20
if(!defined('SESSION_STARTED')) {
21
	session_name('wb_session_id');
22
	session_start();
23
	define('SESSION_STARTED', true);
24
}
25

    
26
// Function to highlight input fields which contain wrong/missing data
27
function field_error($field_name='') {
28
	if(!defined('SESSION_STARTED') || $field_name == '') return;
29
	if(isset($_SESSION['ERROR_FIELD']) && $_SESSION['ERROR_FIELD'] == $field_name) {
30
		return ' class="wrong"';
31
	}
32
}
33

    
34
// Check if the page has been reloaded
35
if(!isset($_GET['sessions_checked']) OR $_GET['sessions_checked'] != 'true') {
36
	// Set session variable
37
	$_SESSION['session_support'] = '<font class="good">Enabled</font>';
38
	// Reload page
39
	header('Location: index.php?sessions_checked=true');
40
	exit(0);
41
} else {
42
	// Check if session variable has been saved after reload
43
	if(isset($_SESSION['session_support'])) {
44
		$session_support = $_SESSION['session_support'];
45
	} else {   
46
		$session_support = '<font class="bad">Disabled</font>';
47
	}
48
}
49

    
50
// Check if AddDefaultCharset is set
51
$e_adc=false;
52
$sapi=php_sapi_name();
53
if(strpos($sapi, 'apache')!==FALSE || strpos($sapi, 'nsapi')!==FALSE) {
54
	flush();
55
	$apache_rheaders=apache_response_headers();
56
	foreach($apache_rheaders AS $h) {
57
		if(strpos($h, 'html; charset')!==FALSE) {
58
			preg_match('/charset\s*=\s*([a-zA-Z0-9- _]+)/', $h, $match);
59
			$apache_charset=$match[1];
60
			$e_adc=$apache_charset;
61
		}
62
	}
63
}
64

    
65
?>
66
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
67
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
68
<head>
69
<title>Website Baker Installation Wizard</title>
70
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
71
<link href="stylesheet.css" rel="stylesheet" type="text/css" />
72
<script language="javascript" type="text/javascript">
73

    
74
function confirm_link(message, url) {
75
	if(confirm(message)) location.href = url;
76
}
77
function change_os(type) {
78
	if(type == 'linux') {
79
		document.getElementById('operating_system_linux').checked = true;
80
		document.getElementById('operating_system_windows').checked = false;
81
		document.getElementById('file_perms_box').style.display = 'block';
82
	} else if(type == 'windows') {
83
		document.getElementById('operating_system_linux').checked = false;
84
		document.getElementById('operating_system_windows').checked = true;
85
		document.getElementById('file_perms_box').style.display = 'none';
86
	}
87
}
88

    
89
</script>
90
</head>
91
<body>
92

    
93
<table cellpadding="0" cellspacing="0" border="0" width="750" align="center">
94
<tr>
95
	<td width="60" valign="top">
96
		<img src="../templates/wb_theme/images/logo.png" alt="Logo" />
97
	</td>
98
	<td width="5">&nbsp;</td>
99
	<td style="font-size: 20px;">
100
		<font style="color: #FFF;">Installation Wizard</font>
101
	</td>
102
</tr>
103
</table>
104

    
105
<form name="website_baker_installation_wizard" action="save.php" method="post">
106
<input type="hidden" name="url" value="" />
107
<input type="hidden" name="username_fieldname" value="admin_username" />
108
<input type="hidden" name="password_fieldname" value="admin_password" />
109
<input type="hidden" name="remember" id="remember" value="true" />
110

    
111
<table cellpadding="0" cellspacing="0" border="0" width="750" align="center" style="margin-top: 10px;">
112
<tr>
113
	<td class="content">
114
	
115
		<center style="padding: 5px;">
116
			Welcome to the Website Baker Installation Wizard.
117
		</center>
118
		
119
		<?php
120
		if(isset($_SESSION['message']) AND $_SESSION['message'] != '') {
121
			?><div style="width: 700px; padding: 10px; margin-bottom: 5px; border: 1px solid #FF0000; background-color: #FFDBDB;"><b>Error:</b> <?php echo $_SESSION['message']; ?></div><?php
122
		}
123
		?>
124
		<table cellpadding="3" cellspacing="0" width="100%" align="center">
125
		<tr>
126
			<td colspan="6"><h1>Step 1</h1>Please check the following requirements are met before continuing...</td>
127
		</tr>
128
		<?php if($session_support != '<font class="good">Enabled</font>') { ?>
129
		<tr>
130
			<td colspan="6" style="font-size: 10px;" class="bad">Please note: PHP Session Support may appear disabled if your browser does not support cookies.</td>
131
		</tr>
132
		<?php } ?>
133
		<tr>
134
			<td width="160" style="color: #666666;">PHP Version > 4.1.0</td>
135
			<td width="60">
136
				<?php
137
				$phpversion = substr(PHP_VERSION, 0, 6);
138
				if($phpversion > 4.1) {
139
					?><font class="good">Yes</font><?php
140
				} else {
141
					?><font class="bad">No</font><?php
142
				}
143
				?>
144
			</td>
145
			<td width="140" style="color: #666666;">PHP Session Support</td>
146
			<td width="105"><?php echo $session_support; ?></td>
147
			<td width="115" style="color: #666666;">PHP Safe Mode</td>
148
			<td>
149
				<?php
150
				if(ini_get('safe_mode')=='' || strpos(strtolower(ini_get('safe_mode')), 'off')!==FALSE || ini_get('safe_mode')==0) {
151
					?><font class="good">Disabled</font><?php
152
				} else {
153
					?><font class="bad">Enabled</font><?php
154
				}	
155
				?>
156
			</td>
157
		</tr>
158
		<tr>
159
			<td width="160" style="color: #666666;">AddDefaultCharset unset</td>
160
			<td width="60">
161
				<?php
162
					if($e_adc) {
163
						?><font class="bad">No</font><?php
164
					} else {
165
						?><font class="good">Yes</font><?php
166
					}
167
				?>
168
			</td>
169
			<td colspan="4">&nbsp;</td>
170
		</tr>
171
		<?php if($e_adc) { ?>
172
		<tr>
173
			<td colspan="6" style="font-size: 10px;" class="bad">Please note: AddDefaultCharset is set to <?php echo $e_adc;?> in apache.conf.<br />If you have to use umlauts (e.g. &auml; &aacute;) please change this to Off. - Or use <?php echo $e_adc;?> inside website baker, too.</td>
174
		</tr>
175
		<?php } ?>
176
		</table>
177
		<table cellpadding="3" cellspacing="0" width="100%" align="center">
178
		<tr>
179
			<td colspan="8"><h1>Step 2</h1>Please check the following files/folders are writeable before continuing...</td>
180
		</tr>
181
		<tr>
182
			<td style="color: #666666;">wb/config.php</td>
183
			<td><?php if(is_writable('../config.php')) { echo '<font class="good">Writeable</font>'; } elseif(!file_exists('../config.php')) { echo '<font class="bad">File Not Found</font>'; } else { echo '<font class="bad">Unwriteable</font>'; } ?></td>
184
			<td style="color: #666666;">wb/pages/</td>
185
			<td><?php if(is_writable('../pages/')) { echo '<font class="good">Writeable</font>'; } elseif(!file_exists('../pages/')) { echo '<font class="bad">Directory Not Found</font>'; } else { echo '<font class="bad">Unwriteable</font>'; } ?></td>
186
			<td style="color: #666666;">wb/media/</td>
187
			<td><?php if(is_writable('../media/')) { echo '<font class="good">Writeable</font>'; } elseif(!file_exists('../media/')) { echo '<font class="bad">Directory Not Found</font>'; } else { echo '<font class="bad">Unwriteable</font>'; } ?></td>
188
			<td style="color: #666666;">wb/templates/</td>
189
			<td><?php if(is_writable('../templates/')) { echo '<font class="good">Writeable</font>'; } elseif(!file_exists('../templates/')) { echo '<font class="bad">Directory Not Found</font>'; } else { echo '<font class="bad">Unwriteable</font>'; } ?></td>
190
		</tr>
191
		<tr>
192
			<td style="color: #666666;">wb/modules/</td>
193
			<td><?php if(is_writable('../modules/')) { echo '<font class="good">Writeable</font>'; } elseif(!file_exists('../modules/')) { echo '<font class="bad">Directory Not Found</font>'; } else { echo '<font class="bad">Unwriteable</font>'; } ?></td>
194
			<td style="color: #666666;">wb/languages/</td>
195
			<td><?php if(is_writable('../languages/')) { echo '<font class="good">Writeable</font>'; } elseif(!file_exists('../languages/')) { echo '<font class="bad">Directory Not Found</font>'; } else { echo '<font class="bad">Unwriteable</font>'; } ?></td>
196
			<td style="color: #666666;">wb/temp/</td>
197
			<td><?php if(is_writable('../temp/')) { echo '<font class="good">Writeable</font>'; } elseif(!file_exists('../temp/')) { echo '<font class="bad">Directory Not Found</font>'; } else { echo '<font class="bad">Unwriteable</font>'; } ?></td>
198
			<td>&nbsp;</td>
199
			<td>&nbsp;</td>
200
		</tr>
201
		</table>
202
		<table cellpadding="3" cellspacing="0" width="100%" align="center">
203
		<tr>
204
			<td colspan="2"><h1>Step 3</h1>Please check your path settings, and select a default timezone and a default backend language...</td>
205
		</tr>
206
		<tr>
207
			<td width="125" style="color: #666666;">
208
				Absolute URL:
209
			</td>
210
			<td>
211
				<?php
212
				// Try to guess installation URL
213
				$guessed_url = 'http://'.$_SERVER["SERVER_NAME"].$_SERVER["SCRIPT_NAME"];
214
				$guessed_url = rtrim(dirname($guessed_url), 'install');
215
				?>
216
				<input <?php echo field_error('wb_url');?> type="text" tabindex="1" name="wb_url" style="width: 99%;" value="<?php if(isset($_SESSION['wb_url'])) { echo $_SESSION['wb_url']; } else { echo $guessed_url; } ?>" />
217
			</td>
218
		</tr>
219
		<tr>
220
			<td style="color: #666666;">
221
				Default Timezone:
222
			</td>
223
			<td>
224
				<select <?php echo field_error('default_timezone');?> tabindex="3" name="default_timezone" style="width: 100%;">
225
					<?php
226
					$TIMEZONES['-12'] = 'GMT - 12 Hours';
227
					$TIMEZONES['-11'] = 'GMT -11 Hours';
228
					$TIMEZONES['-10'] = 'GMT -10 Hours';
229
					$TIMEZONES['-9'] = 'GMT -9 Hours';
230
					$TIMEZONES['-8'] = 'GMT -8 Hours';
231
					$TIMEZONES['-7'] = 'GMT -7 Hours';
232
					$TIMEZONES['-6'] = 'GMT -6 Hours';
233
					$TIMEZONES['-5'] = 'GMT -5 Hours';
234
					$TIMEZONES['-4'] = 'GMT -4 Hours';
235
					$TIMEZONES['-3.5'] = 'GMT -3.5 Hours';
236
					$TIMEZONES['-3'] = 'GMT -3 Hours';
237
					$TIMEZONES['-2'] = 'GMT -2 Hours';
238
					$TIMEZONES['-1'] = 'GMT -1 Hour';
239
					$TIMEZONES['0'] = 'GMT';
240
					$TIMEZONES['1'] = 'GMT +1 Hour';
241
					$TIMEZONES['2'] = 'GMT +2 Hours';
242
					$TIMEZONES['3'] = 'GMT +3 Hours';
243
					$TIMEZONES['3.5'] = 'GMT +3.5 Hours';
244
					$TIMEZONES['4'] = 'GMT +4 Hours';
245
					$TIMEZONES['4.5'] = 'GMT +4.5 Hours';
246
					$TIMEZONES['5'] = 'GMT +5 Hours';
247
					$TIMEZONES['5.5'] = 'GMT +5.5 Hours';
248
					$TIMEZONES['6'] = 'GMT +6 Hours';
249
					$TIMEZONES['6.5'] = 'GMT +6.5 Hours';
250
					$TIMEZONES['7'] = 'GMT +7 Hours';
251
					$TIMEZONES['8'] = 'GMT +8 Hours';
252
					$TIMEZONES['9'] = 'GMT +9 Hours';
253
					$TIMEZONES['9.5'] = 'GMT +9.5 Hours';
254
					$TIMEZONES['10'] = 'GMT +10 Hours';
255
					$TIMEZONES['11'] = 'GMT +11 Hours';
256
					$TIMEZONES['12'] = 'GMT +12 Hours';
257
					$TIMEZONES['13'] = 'GMT +13 Hours';
258
					foreach($TIMEZONES AS $hour_offset => $title) {
259
						?>
260
							<option value="<?php echo $hour_offset; ?>"<?php if(isset($_SESSION['default_timezone']) AND $_SESSION['default_timezone'] == $hour_offset) { echo ' selected="selected"'; } elseif(!isset($_SESSION['default_timezone']) AND $hour_offset == 0) { echo ' selected="selected"'; } ?>><?php echo $title; ?></option>
261
						<?php
262
					}
263
					?>
264
				</select>
265
			</td>
266
		</tr>
267
		<tr>
268
			<td style="color: #666666;">
269
				Default Language:
270
			</td>
271
			<td>
272
				<select <?php echo field_error('default_language');?> tabindex="3" name="default_language" style="width: 100%;">
273
					<?php
274
					$DEFAULT_LANGUAGE = array(
275
						'BG'=>'Bulgarian', 'CA'=>'Catalan', 'CS'=>'&#268;e&scaron;tina', 'DA'=>'Danish', 'DE'=>'Deutsch', 'EN'=>'English',
276
						'ES'=>'Spanish', 'ET'=>'Eesti', 'FI'=>'Suomi', 'FR'=>'Fran&ccedil;ais',
277
						'HR'=>'Hrvatski', 'HU'=>'Magyar','IT'=>'Italiano', 'LV'=>'Latviesu',
278
						'NL'=>'Nederlands', 'NO'=>'Norsk', 'PL'=>'Polski', 'PT'=>'Portuguese (Brazil)', 'RU'=>'Russian', 'SE'=>'Svenska','SK'=>'Slovensky','TR'=>'Turkish'
279
					);
280
					foreach($DEFAULT_LANGUAGE as $lang_id => $lang_title) {
281
						?>
282
							<option value="<?php echo $lang_id; ?>"<?php if(isset($_SESSION['default_language']) AND $_SESSION['default_language'] == $lang_id) { echo ' selected="selected"'; } elseif(!isset($_SESSION['default_language']) AND $lang_id == 'EN') { echo ' selected="selected"'; } ?>><?php echo $lang_title; ?></option>
283
						<?php
284
					}
285
					?>
286
				</select>
287
			</td>
288
		</tr>
289
		</table>
290
		<table cellpadding="5" cellspacing="0" width="100%" align="center">
291
		<tr>
292
			<td colspan="3"><h1>Step 4</h1>Please specify your operating system information below...</td>
293
		</tr>
294
		<tr>
295
			<td width="170">
296
				Server Operating System:
297
			</td>
298
			<td width="180">
299
				<input type="radio" tabindex="4" name="operating_system" id="operating_system_linux" onclick="document.getElementById('file_perms_box').style.display = 'block';" value="linux"<?php if(!isset($_SESSION['operating_system']) OR $_SESSION['operating_system'] == 'linux') { echo ' checked="checked"'; } ?> />
300
				<span style="cursor: pointer;" onclick="javascript: change_os('linux');">Linux/Unix based</span>
301
				<br />
302
				<input type="radio" tabindex="5" name="operating_system" id="operating_system_windows" onclick="document.getElementById('file_perms_box').style.display = 'none';" value="windows"<?php if(isset($_SESSION['operating_system']) AND $_SESSION['operating_system'] == 'windows') { echo ' checked="checked"'; } ?> />
303
				<span style="cursor: pointer;" onclick="javascript: change_os('windows');">Windows</span>
304
			</td>
305
			<td>
306
				<div id="file_perms_box" style="margin: 0; padding: 0; display: <?php if(isset($_SESSION['operating_system']) AND $_SESSION['operating_system'] == 'windows') { echo 'none'; } else { echo 'block'; } ?>;">
307
					<input type="checkbox" tabindex="6" name="world_writeable" id="world_writeable" value="true"<?php if(isset($_SESSION['world_writeable']) AND $_SESSION['world_writeable'] == true) { echo 'checked'; } ?> />
308
					<label for="world_writeable">
309
						World-writeable file permissions (777)
310
					</label>
311
					<br />
312
					<font class="note">(Please note: only recommended for testing environments)</font>
313
				</div>
314
			</td>
315
		</tr>
316
		</table>
317
		<table cellpadding="5" cellspacing="0" width="100%" align="center">
318
    		<tr>
319
    			<td colspan="5">Please enter your MySQL database server details below...</td>
320
    		</tr>
321
    		<tr>
322
    			<td width="120" style="color: #666666;">Host Name:</td>
323
    			<td width="230">
324
    				<input <?php echo field_error('database_host');?> type="text" tabindex="7" name="database_host" style="width: 98%;" value="<?php if(isset($_SESSION['database_host'])) { echo $_SESSION['database_host']; } else { echo 'localhost'; } ?>" />
325
    			</td>
326
    			<td width="7">&nbsp;</td>
327
    			<td width="70" style="color: #666666;">Username:</td>
328
    			<td>
329
    				<input <?php echo field_error('database_username');?> type="text" tabindex="9" name="database_username" style="width: 98%;" value="<?php if(isset($_SESSION['database_username'])) { echo $_SESSION['database_username']; } else { echo 'root'; } ?>" />
330
    			</td>
331
    		</tr>
332
    		<tr>
333
    			<td style="color: #666666;">Database Name:<br />[a-zA-Z0-9_-]</td>
334
    			<td>
335
    				<input <?php echo field_error('database_name');?> type="text" tabindex="8" name="database_name" style="width: 98%;" value="<?php if(isset($_SESSION['database_name'])) { echo $_SESSION['database_name']; } else { echo 'wb'; } ?>" />
336
    			</td>
337
    			<td>&nbsp;</td>
338
    			<td style="color: #666666;">Password:</td>
339
    			<td>
340
    				<input type="password" tabindex="10" name="database_password" style="width: 98%;"<?php if(isset($_SESSION['database_password'])) { echo ' value = "'.$_SESSION['database_password'].'"'; } ?> />
341
    			</td>
342
    		</tr>
343
		<tr>
344
			<td style="color: #666666;">Table Prefix:<br />[a-zA-Z0-9_]</td>
345
			<td>
346
				<input <?php echo field_error('table_prefix');?> type="text" tabindex="11" name="table_prefix" style="width: 250px;"<?php if(isset($_SESSION['table_prefix'])) { echo ' value = "'.$_SESSION['table_prefix'].'"'; } ?> />
347
			</td>
348
			<td>&nbsp;</td>
349
			<td colspan="2">
350
				<input type="checkbox" tabindex="12" name="install_tables" id="install_tables" value="true"<?php if(!isset($_SESSION['install_tables'])) { echo ' checked="checked"'; } elseif($_SESSION['install_tables'] == 'true') { echo ' checked="checked"'; } ?> />
351
				<label for="install_tables" style="color: #666666;">Install Tables</label>
352
				<br />
353
				<span style="font-size: 10px; color: #666666;">(Please note: May remove existing tables and data)</span>
354
			</td>
355
		</tr>
356
		<tr>
357
			<td colspan="5"><h1>Step 5</h1>Please enter your website title below...</td>
358
		</tr>
359
		<tr>
360
			<td style="color: #666666;" colspan="1">Website Title:</td>
361
			<td colspan="4">
362
				<input <?php echo field_error('website_title');?> type="text" tabindex="13" name="website_title" style="width: 99%;" value="<?php if(isset($_SESSION['website_title'])) { echo $_SESSION['website_title']; } ?>" />
363
			</td>
364
		</tr>
365
		<tr>
366
			<td colspan="5"><h1>Step 6</h1>Please enter your Administrator account details below...</td>
367
		</tr>
368
		<tr>
369
			<td style="color: #666666;">Username:</td>
370
			<td>
371
				<input <?php echo field_error('admin_username');?> type="text" tabindex="14" name="admin_username" style="width: 98%;" value="<?php if(isset($_SESSION['admin_username'])) { echo $_SESSION['admin_username']; } else { echo 'admin'; } ?>" />
372
			</td>
373
			<td>&nbsp;</td>
374
			<td style="color: #666666;">Password:</td>
375
			<td>
376
				<input <?php echo field_error('admin_password');?> type="password" tabindex="16" name="admin_password" style="width: 98%;"<?php if(isset($_SESSION['admin_password'])) { echo ' value = "'.$_SESSION['admin_password'].'"'; } ?> />
377
			</td>
378
		</tr>
379
		<tr>
380
			<td style="color: #666666;">Email:</td>
381
			<td>
382
				<input <?php echo field_error('admin_email');?> type="text" tabindex="15" name="admin_email" style="width: 98%;"<?php if(isset($_SESSION['admin_email'])) { echo ' value = "'.$_SESSION['admin_email'].'"'; } ?> />
383
			</td>
384
			<td>&nbsp;</td>
385
			<td style="color: #666666;">Re-Password:</td>
386
			<td>
387
				<input <?php echo field_error('admin_repassword');?> type="password" tabindex="17" name="admin_repassword" style="width: 98%;"<?php if(isset($_SESSION['admin_repassword'])) { echo ' value = "'.$_SESSION['admin_repassword'].'"'; } ?> />
388
			</td>
389
		</tr>
390
		<tr>
391
			<td colspan="5" style="padding: 10px; padding-bottom: 0;"><h1 style="font-size: 0px;">&nbsp;</h1></td>
392
		</tr>
393
		<tr>
394
			<td colspan="4">
395
				<table cellpadding="0" cellspacing="0" width="100%" border="0">
396
				<tr valign="top">
397
					<td>Please note: &nbsp;</td>
398
					<td>
399
						Website Baker is released under the 
400
						<a href="http://www.gnu.org/licenses/gpl.html" target="_blank" tabindex="19">GNU General Public License</a>
401
						<br />
402
						By clicking install, you are accepting the license.
403
					</td>
404
				</tr>
405
				</table>
406
			</td>
407
			<td colspan="1" align="right">
408
				<input type="submit" tabindex="20" name="submit" value="Install Website Baker" class="submit" />
409
			</td>
410
		</tr>
411
		</table>
412
	</td>
413
</tr>
414
</table>
415

    
416
</form>
417

    
418
<table cellpadding="0" cellspacing="0" border="0" width="100%" style="padding: 10px 0px 10px 0px;">
419
<tr>
420
	<td align="center" style="font-size: 10px;">
421
		<!-- Please note: the below reference to the GNU GPL should not be removed, as it provides a link for users to read about warranty, etc. -->
422
		<a href="http://www.websitebaker.org/" style="color: #000000;" target="_blank">Website Baker</a>
423
		is	released under the
424
		<a href="http://www.gnu.org/licenses/gpl.html" style="color: #000000;" target="_blank">GNU General Public License</a>
425
		<!-- Please note: the above reference to the GNU GPL should not be removed, as it provides a link for users to read about warranty, etc. -->
426
	</td>
427
</tr>
428
</table>
429

    
430
</body>
431
</html>
(1-1/3)