Project

General

Profile

1
<?php
2

    
3
// $Id: index.php 239 2005-11-22 11:50:41Z 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

    
56
function toggle_checkbox(checkbox_id) {
57

    
58
	if(document.getElementById(checkbox_id).checked == true) {
59

    
60
		document.getElementById(checkbox_id).checked = false;
61

    
62
	} else {
63

    
64
		document.getElementById(checkbox_id).checked = true;
65

    
66
	}
67

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

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

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

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

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

    
368
</form>
369

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

    
382
</body>
383
</html>
(1-1/3)