Project

General

Profile

1
<?php
2

    
3
// $Id: index.php 695 2008-02-10 18:45:07Z Ruebenwurzel $
4

    
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
// Start a session
27
if(!defined('SESSION_STARTED')) {
28
	session_name('wb_session_id');
29
	session_start();
30
	define('SESSION_STARTED', true);
31
}
32

    
33
// Function to highlight input fields which contain wrong/missing data
34
function field_error($field_name='') {
35
	if(!defined('SESSION_STARTED') || $field_name == '') return;
36
	if(isset($_SESSION['ERROR_FIELD']) && $_SESSION['ERROR_FIELD'] == $field_name) {
37
		return ' class="wrong"';
38
	}
39
}
40

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

    
57
?>
58
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
59
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
60
<head>
61
<title>Website Baker Installation Wizard</title>
62
<link href="stylesheet.css" rel="stylesheet" type="text/css">
63
<script language="javascript" type="text/javascript">
64

    
65
function confirm_link(message, url) {
66
	if(confirm(message)) location.href = url;
67
}
68
function change_os(type) {
69
	if(type == 'linux') {
70
		document.getElementById('operating_system_linux').checked = true;
71
		document.getElementById('operating_system_windows').checked = false;
72
		document.getElementById('file_perms_box').style.display = 'block';
73
	} else if(type == 'windows') {
74
		document.getElementById('operating_system_linux').checked = false;
75
		document.getElementById('operating_system_windows').checked = true;
76
		document.getElementById('file_perms_box').style.display = 'none';
77
	}
78
}
79

    
80
</script>
81
</head>
82
<body>
83

    
84
<table cellpadding="0" cellspacing="0" border="0" width="750" align="center">
85
<tr>
86
	<td width="60" valign="top">
87
		<img src="../admin/interface/logo.png" alt="Logo" />
88
	</td>
89
	<td width="5">&nbsp;</td>
90
	<td style="font-size: 20px;">
91
		<font style="color: #FFFFFF;">Website Baker</font> 
92
		<font style="color: #DDDDDD;">Installation Wizard</font>
93
	</td>
94
</tr>
95
</table>
96

    
97
<form name="website_baker_installation_wizard" action="save.php" method="post">
98
<input type="hidden" name="url" value="" />
99
<input type="hidden" name="username_fieldname" value="admin_username" />
100
<input type="hidden" name="password_fieldname" value="admin_password" />
101
<input type="hidden" name="remember" id="remember" value="true" />
102

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

    
390
</form>
391

    
392
<table cellpadding="0" cellspacing="0" border="0" width="100%" style="padding: 10px 0px 10px 0px;">
393
<tr>
394
	<td align="center" style="font-size: 10px;">
395
		<!-- 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. -->
396
		<a href="http://www.websitebaker.org/" style="color: #000000;" target="_blank">Website Baker</a>
397
		is	released under the
398
		<a href="http://www.gnu.org/licenses/gpl.html" style="color: #000000;" target="_blank">GNU General Public License</a>
399
		<!-- 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. -->
400
	</td>
401
</tr>
402
</table>
403

    
404
</body>
405
</html>
(1-1/3)