Project

General

Profile

1
<?php
2

    
3
// $Id: index.php 449 2007-04-30 07:17:50Z Ruebenwurzel $
4

    
5
/*
6

    
7
 Website Baker Project <http://www.websitebaker.org/>
8
 Copyright (C) 2004-2007, 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
// Check if the page has been reloaded
34
if(!isset($_GET['sessions_checked']) OR $_GET['sessions_checked'] != 'true') {
35
	// Set session variable
36
	$_SESSION['session_support'] = '<font class="good">Enabled</font>';
37
	// Reload page
38
	header('Location: index.php?sessions_checked=true');
39
	exit(0);
40
} else {
41
	// Check if session variable has been saved after reload
42
	if(isset($_SESSION['session_support'])) {
43
		$session_support = $_SESSION['session_support'];
44
	} else {   
45
		$session_support = '<font class="bad">Disabled</font>';
46
	}
47
}
48

    
49
?>
50
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
51
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
52
<head>
53
<title>Website Baker Installation Wizard</title>
54
<link href="stylesheet.css" rel="stylesheet" type="text/css">
55
<script language="javascript" type="text/javascript">
56

    
57
function confirm_link(message, url) {
58
	if(confirm(message)) location.href = url;
59
}
60
function change_os(type) {
61
	if(type == 'linux') {
62
		document.getElementById('operating_system_linux').checked = true;
63
		document.getElementById('operating_system_windows').checked = false;
64
		document.getElementById('file_perms_box').style.display = 'block';
65
	} else if(type == 'windows') {
66
		document.getElementById('operating_system_linux').checked = false;
67
		document.getElementById('operating_system_windows').checked = true;
68
		document.getElementById('file_perms_box').style.display = 'none';
69
	}
70
}
71
function change_mail_type(type) {
72
	if(type == 'php') {
73
		document.getElementById('outgoing_mails_php').checked = true;
74
		document.getElementById('outgoing_mails_smtp').checked = false;
75
		document.getElementById('smtp_server').style.display = 'none';
76
		document.getElementById('caption_smtp_server').style.color = '#FFF';
77
	} else if(type == 'smtp') {
78
		document.getElementById('outgoing_mails_php').checked = false;
79
		document.getElementById('outgoing_mails_smtp').checked = true;
80
		document.getElementById('smtp_server').style.display = 'block';
81
		document.getElementById('caption_smtp_server').style.color = '#666';
82
	}
83
}
84

    
85
</script>
86
</head>
87
<body>
88

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

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

    
108
<table cellpadding="0" cellspacing="0" border="0" width="750" align="center" style="margin-top: 10px;">
109
<tr>
110
	<td class="content">
111
	
112
		<center style="padding: 5px;">
113
			Welcome to the Website Baker Installation Wizard.
114
		</center>
115
		
116
		<?php
117
		if(isset($_SESSION['message']) AND $_SESSION['message'] != '') {
118
			?><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
119
		}
120
		?>
121
		<table cellpadding="3" cellspacing="0" width="100%" align="center">
122
		<tr>
123
			<td colspan="8"><h1>Step 1</h1>Please check the following requirements are met before continuing...</td>
124
		</tr>
125
		<?php if($session_support != '<font class="good">Enabled</font>') { ?>
126
		<tr>
127
			<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>
128
		</tr>
129
		<?php } ?>
130
		<tr>
131
			<td width="140" style="color: #666666;">PHP Version > 4.1.0</td>
132
			<td width="35">
133
				<?php
134
				$phpversion = substr(PHP_VERSION, 0, 6);
135
				if($phpversion > 4.1) {
136
					?><font class="good">Yes</font><?php
137
				} else {
138
					?><font class="bad">No</font><?php
139
				}
140
				?>
141
			</td>
142
			<td width="140" style="color: #666666;">PHP Session Support</td>
143
			<td width="115"><?php echo $session_support; ?></td>
144
			<td width="105" style="color: #666666;">PHP Safe Mode</td>
145
			<td>
146
				<?php
147
				if(ini_get('safe_mode')) {
148
					?><font class="bad">Enabled</font><?php
149
				} else {
150
					?><font class="good">Disabled</font><?php
151
				}	
152
				?>
153
			</td>
154
		</tr>
155
		</table>
156
		<table cellpadding="3" cellspacing="0" width="100%" align="center">
157
		<tr>
158
			<td colspan="8"><h1>Step 2</h1>Please check the following files/folders are writeable before continuing...</td>
159
		</tr>
160
		<tr>
161
			<td style="color: #666666;">wb/config.php</td>
162
			<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>
163
			<td style="color: #666666;">wb/pages/</td>
164
			<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>
165
			<td style="color: #666666;">wb/media/</td>
166
			<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>
167
			<td style="color: #666666;">wb/templates/</td>
168
			<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>
169
		</tr>
170
		<tr>
171
			<td style="color: #666666;">wb/modules/</td>
172
			<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>
173
			<td style="color: #666666;">wb/languages/</td>
174
			<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>
175
			<td style="color: #666666;">wb/temp/</td>
176
			<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>
177
			<td>&nbsp;</td>
178
			<td>&nbsp;</td>
179
		</tr>
180
		</table>
181
		<table cellpadding="3" cellspacing="0" width="100%" align="center">
182
		<tr>
183
			<td colspan="2"><h1>Step 3</h1>Please check your path settings, and select your default timezone...</td>
184
		</tr>
185
		<tr>
186
			<td width="125" style="color: #666666;">
187
				Absolute URL:
188
			</td>
189
			<td>
190
				<?php
191
				// Try to guess installation URL
192
				$guessed_url = 'http://'.$_SERVER["SERVER_NAME"].$_SERVER["SCRIPT_NAME"];
193
				$guessed_url = rtrim(dirname($guessed_url), 'install');
194
				?>
195
				<input 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; } ?>" />
196
			</td>
197
		</tr>
198
		<tr>
199
			<td style="color: #666666;">
200
				Default Timezone:
201
			</td>
202
			<td>
203
				<select tabindex="3" name="default_timezone" style="width: 100%;">
204
					<?php
205
					$TIMEZONES['-12'] = 'GMT - 12 Hours';
206
					$TIMEZONES['-11'] = 'GMT -11 Hours';
207
					$TIMEZONES['-10'] = 'GMT -10 Hours';
208
					$TIMEZONES['-9'] = 'GMT -9 Hours';
209
					$TIMEZONES['-8'] = 'GMT -8 Hours';
210
					$TIMEZONES['-7'] = 'GMT -7 Hours';
211
					$TIMEZONES['-6'] = 'GMT -6 Hours';
212
					$TIMEZONES['-5'] = 'GMT -5 Hours';
213
					$TIMEZONES['-4'] = 'GMT -4 Hours';
214
					$TIMEZONES['-3.5'] = 'GMT -3.5 Hours';
215
					$TIMEZONES['-3'] = 'GMT -3 Hours';
216
					$TIMEZONES['-2'] = 'GMT -2 Hours';
217
					$TIMEZONES['-1'] = 'GMT -1 Hour';
218
					$TIMEZONES['0'] = 'GMT';
219
					$TIMEZONES['1'] = 'GMT +1 Hour';
220
					$TIMEZONES['2'] = 'GMT +2 Hours';
221
					$TIMEZONES['3'] = 'GMT +3 Hours';
222
					$TIMEZONES['3.5'] = 'GMT +3.5 Hours';
223
					$TIMEZONES['4'] = 'GMT +4 Hours';
224
					$TIMEZONES['4.5'] = 'GMT +4.5 Hours';
225
					$TIMEZONES['5'] = 'GMT +5 Hours';
226
					$TIMEZONES['5.5'] = 'GMT +5.5 Hours';
227
					$TIMEZONES['6'] = 'GMT +6 Hours';
228
					$TIMEZONES['6.5'] = 'GMT +6.5 Hours';
229
					$TIMEZONES['7'] = 'GMT +7 Hours';
230
					$TIMEZONES['8'] = 'GMT +8 Hours';
231
					$TIMEZONES['9'] = 'GMT +9 Hours';
232
					$TIMEZONES['9.5'] = 'GMT +9.5 Hours';
233
					$TIMEZONES['10'] = 'GMT +10 Hours';
234
					$TIMEZONES['11'] = 'GMT +11 Hours';
235
					$TIMEZONES['12'] = 'GMT +12 Hours';
236
					$TIMEZONES['13'] = 'GMT +13 Hours';
237
					foreach($TIMEZONES AS $hour_offset => $title) {
238
						?>
239
							<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>
240
						<?php
241
					}
242
					?>
243
				</select>
244
			</td>
245
		</tr>
246
		</table>
247
		<table cellpadding="5" cellspacing="0" width="100%" align="center">
248
		<tr>
249
			<td colspan="3"><h1>Step 4</h1>Please specify your operating system information below...</td>
250
		</tr>
251
		<tr height="50">
252
			<td width="170">
253
				Server Operating System:
254
			</td>
255
			<td width="180">
256
				<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'; } ?> />
257
				<font style="cursor: pointer;" onclick="javascript: change_os('linux');">Linux/Unix based</font>
258
				<br />
259
				<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'; } ?> />
260
				<font style="cursor: pointer;" onclick="javascript: change_os('windows');">Windows</font>
261
			</td>
262
			<td>
263
				<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'; } ?>;">
264
					<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'; } ?> />
265
					<label for="world_writeable">
266
						World-writeable file permissions (777)
267
					</label>
268
					<br />
269
					<font class="note">(Please note: this is only recommended for testing environments)</font>
270
				</div>
271
			</td>
272
		</tr>
273
		</table>
274
		<table cellpadding="5" cellspacing="0" width="100%" align="center">
275
		<tr>
276
			<td colspan="5">Please enter your MySQL database server details below...</td>
277
		</tr>
278
		<tr>
279
			<td width="120" style="color: #666666;">Host Name:</td>
280
			<td width="230">
281
				<input type="text" tabindex="7" name="database_host" style="width: 98%;" value="<?php if(isset($_SESSION['database_host'])) { echo $_SESSION['database_host']; } else { echo 'localhost'; } ?>" />
282
			</td>
283
			<td width="7">&nbsp;</td>
284
			<td width="70" style="color: #666666;">Username:</td>
285
			<td>
286
				<input type="text" tabindex="9" name="database_username" style="width: 98%;" value="<?php if(isset($_SESSION['database_username'])) { echo $_SESSION['database_username']; } else { echo 'root'; } ?>" />
287
			</td>
288
		</tr>
289
		<tr>
290
			<td style="color: #666666;">Database Name:</td>
291
			<td>
292
				<input type="text" tabindex="8" name="database_name" style="width: 98%;" value="<?php if(isset($_SESSION['database_name'])) { echo $_SESSION['database_name']; } else { echo 'wb'; } ?>" />
293
			</td>
294
			<td>&nbsp;</td>
295
			<td style="color: #666666;">Password:</td>
296
			<td>
297
				<input type="password" tabindex="10" name="database_password" style="width: 98%;"<?php if(isset($_SESSION['database_password'])) { echo ' value = "'.$_SESSION['database_password'].'"'; } ?> />
298
			</td>
299
		</tr>
300
		<tr>
301
			<td style="color: #666666;">Table Prefix:</td>
302
			<td>
303
				<input type="text" tabindex="11" name="table_prefix" style="width: 250px;"<?php if(isset($_SESSION['table_prefix'])) { echo ' value = "'.$_SESSION['table_prefix'].'"'; } ?> />
304
			</td>
305
			<td>&nbsp;</td>
306
			<td colspan="2">
307
				<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'; } ?> />
308
				<label for="install_tables" style="color: #666666;">Install Tables</label>
309
				<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
310
				<span style="font-size: 10px; color: #666666;">(Please note: May remove existing tables and data)</span></td>		
311
			</td>
312
		</tr>
313
		<tr>
314
			<td colspan="5"><h1>Step 5</h1>Please enter your website title below...</td>
315
		</tr>
316
		<tr>
317
			<td style="color: #666666;" colspan="1">Website Title:</td>
318
			<td colspan="4">
319
				<input type="text" tabindex="13" name="website_title" style="width: 99%;" value="<?php if(isset($_SESSION['website_title'])) { echo $_SESSION['website_title']; } ?>" />
320
			</td>
321
		</tr>
322
		<tr>
323
			<td colspan="5"><h1>Step 6</h1>Please enter your Administrator account details below...</td>
324
		</tr>
325
		<tr>
326
			<td style="color: #666666;">Username:</td>
327
			<td>
328
				<input type="text" tabindex="14" name="admin_username" style="width: 98%;" value="<?php if(isset($_SESSION['admin_username'])) { echo $_SESSION['admin_username']; } else { echo 'admin'; } ?>" />
329
			</td>
330
			<td>&nbsp;</td>
331
			<td style="color: #666666;">Password:</td>
332
			<td>
333
				<input type="password" tabindex="16" name="admin_password" style="width: 98%;"<?php if(isset($_SESSION['admin_password'])) { echo ' value = "'.$_SESSION['admin_password'].'"'; } ?> />
334
			</td>
335
		</tr>
336
		<tr>
337
			<td style="color: #666666;">Email:</td>
338
			<td>
339
				<input type="text" tabindex="15" name="admin_email" style="width: 98%;"<?php if(isset($_SESSION['admin_email'])) { echo ' value = "'.$_SESSION['admin_email'].'"'; } ?> />
340
			</td>
341
			<td>&nbsp;</td>
342
			<td style="color: #666666;">Re-Password:</td>
343
			<td>
344
				<input type="password" tabindex="17" name="admin_repassword" style="width: 98%;"<?php if(isset($_SESSION['admin_password'])) { echo ' value = "'.$_SESSION['admin_password'].'"'; } ?> />
345
			</td>
346
		</tr>
347
		<tr>
348
			<td colspan="5"><h1>Step 7 (optional)</h1>Please specify options for outgoing mails below...</td>
349
		</tr>
350
		<tr>
351
			<td width="170">
352
				Send outgoing mails via:
353
			</td>
354
			<td>
355
				<input type="radio" tabindex="18" name="outgoing_mails" id="outgoing_mails_php" onclick="document.getElementById('smtp_server').style.display = 'none';" value="php"<?php if(!isset($_SESSION['outgoing_mails']) OR $_SESSION['outgoing_mails'] == 'php') { echo ' checked'; } ?> />
356
				<font style="cursor: pointer;" onclick="javascript: change_mail_type('php');">PHP mail()</font> 
357
				<br />
358
				<input type="radio" tabindex="19" name="outgoing_mails" id="outgoing_mails_smtp" onclick="document.getElementById('smtp_server').style.display = 'block';" value="smtp"<?php if(isset($_SESSION['outgoing_mails']) AND $_SESSION['outgoing_mails'] == 'smtp') { echo ' checked'; } ?> />
359
				<font style="cursor: pointer;" onclick="javascript: change_mail_type('smtp');">SMTP</font> 
360
			</td>
361
			<td id="caption_smtp_server" colspan="2" style="color: <?php if(!isset($_SESSION['outgoing_mails']) OR $_SESSION['outgoing_mails'] == 'php') { echo '#FFF'; } else { echo '#666'; } ?>;">SMTP host:</td>
362
			<td>
363
				<input type="text" tabindex="20" id="smtp_server" name="smtp_server" style="display: <?php if(!isset($_SESSION['outgoing_mails']) OR $_SESSION['outgoing_mails'] == 'php') { echo 'none'; } else { echo 'block'; } ?>;" value="<?php if(isset($_SESSION['smtp_server'])) { echo $_SESSION['smtp_server']; } else { echo 'mail.example.com'; } ?>" />
364
			</td>
365
		</tr>
366
		<tr>
367
			<td colspan="5">
368
				<div style="border: 1px solid #CCC; background-color: #EEE; padding: 5px;">
369
				<strong> Please Note:</strong>
370
				<br \>
371
				Some service providers do not support sending mail via PHP.
372
				If your provider requires you to use SMTP for sending mail, you must know the SMTP host address.
373
				If you are not sure about these settings, or you do not know the SMTP host of your domain, use the default "PHP mail()" setting.
374
				You can change the settings	later if needed.
375
				</div>
376
			</td>
377
		</tr>
378
		<tr>
379
			<td colspan="5" style="padding: 10px; padding-bottom: 0;"><h1 style="font-size: 0px;">&nbsp;</h1></td>
380
		</tr>
381
		<tr>
382
			<td colspan="4">
383
				<table cellpadding="0" cellspacing="0" width="100%" border="0">
384
				<tr valign="top">
385
					<td>Please note: &nbsp;</td>
386
					<td>
387
						Website Baker is released under the 
388
						<a href="http://www.gnu.org/licenses/gpl.html" target="_blank" tabindex="19">GNU General Public License</a>
389
						<br />
390
						By clicking install, you are accepting the license.
391
					</td>
392
				</tr>
393
				</table>
394
			</td>
395
			<td colspan="1" align="right">
396
				<input type="submit" tabindex="20" name="submit" value="Install Website Baker" class="submit" />
397
			</td>
398
		</tr>
399
		</table>
400
	
401
	</td>
402
</tr>
403
</table>
404

    
405
</form>
406

    
407
<table cellpadding="0" cellspacing="0" border="0" width="100%" style="padding: 10px 0px 10px 0px;">
408
<tr>
409
	<td align="center" style="font-size: 10px;">
410
		<!-- 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. -->
411
		<a href="http://www.websitebaker.org/" style="color: #000000;" target="_blank">Website Baker</a>
412
		is	released under the
413
		<a href="http://www.gnu.org/licenses/gpl.html" style="color: #000000;" target="_blank">GNU General Public License</a>
414
		<!-- 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. -->
415
	</td>
416
</tr>
417
</table>
418

    
419
</body>
420
</html>
(1-1/3)