Project

General

Profile

1
<?php
2

    
3
// $Id: index.php 221 2005-11-18 17:19:37Z stefan $
4

    
5
/*
6

    
7
 Website Baker Project <http://www.websitebaker.org/>
8
 Copyright (C) 2004-2005, 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
} else {
40
   // Check if session variable has been saved after reload
41
   if(isset($_SESSION['session_support'])) {
42
      $session_support = $_SESSION['session_support'];
43
   } else {   
44
      $session_support = '<font class="bad">Disabled</font>';
45
   }
46
}
47

    
48
?>
49
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
50
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
51
<head>
52
<title>Website Baker Installation Wizard</title>
53
<link href="stylesheet.css" rel="stylesheet" type="text/css">
54
<script language="javascript" type="text/javascript">
55
function toggle_checkbox(checkbox_id) {
56
	if(document.getElementById(checkbox_id).checked == true) {
57
		document.getElementById(checkbox_id).checked = false;
58
	} else {
59
		document.getElementById(checkbox_id).checked = true;
60
	}
61
}
62
function confirm_link(message, url) {
63
	if(confirm(message)) location.href = url;
64
}
65
function change_os(type) {
66
	if(type == 'linux') {
67
		document.getElementById('operating_system_linux').checked = true;
68
		document.getElementById('operating_system_windows').checked = false;
69
		document.getElementById('file_perms_box').style.display = 'block';
70
	} else if(type == 'windows') {
71
		document.getElementById('operating_system_linux').checked = false;
72
		document.getElementById('operating_system_windows').checked = true;
73
		document.getElementById('file_perms_box').style.display = 'none';
74
	}
75
}
76
</script>
77
</head>
78
<body>
79

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

    
93
<form name="website_baker_installation_wizard" action="save.php" method="post">
94
<input type="hidden" name="url" value="" />
95
<input type="hidden" name="username_fieldname" value="admin_username" />
96
<input type="hidden" name="password_fieldname" value="admin_password" />
97
<input type="hidden" name="remember" id="remember" value="true" />
98

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

    
360
</form>
361

    
362
<table cellpadding="0" cellspacing="0" border="0" width="100%" style="padding: 10px 0px 10px 0px;">
363
<tr>
364
	<td align="center" style="font-size: 10px;">
365
		<!-- Please note: the following copyright/license notice must not be removed/modified -->
366
		<a href="http://www.websitebaker.com/" style="color: #000000;" target="_blank">Website Baker</a>
367
		is	released under the
368
		<a href="http://www.gnu.org/licenses/gpl.html" style="color: #000000;" target="_blank">GNU General Public License</a>
369
		<!-- Please note: the above copyright/license notice must not be removed/modified -->
370
	</td>
371
</tr>
372
</table>
373

    
374
</body>
375
</html>
(1-1/3)