Project

General

Profile

« Previous | Next » 

Revision 687

Added by doc almost 17 years ago

added visualization of wrong/empty input fields, fixed bug with re-enter of admin password

View differences:

index.php
30 30
	define('SESSION_STARTED', true);
31 31
}
32 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

  
33 41
// Check if the page has been reloaded
34 42
if(!isset($_GET['sessions_checked']) OR $_GET['sessions_checked'] != 'true') {
35 43
	// Set session variable
......
179 187
				$guessed_url = 'http://'.$_SERVER["SERVER_NAME"].$_SERVER["SCRIPT_NAME"];
180 188
				$guessed_url = rtrim(dirname($guessed_url), 'install');
181 189
				?>
182
				<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
				<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; } ?>" />
183 191
			</td>
184 192
		</tr>
185 193
		<tr>
......
187 195
				Default Timezone:
188 196
			</td>
189 197
			<td>
190
				<select tabindex="3" name="default_timezone" style="width: 100%;">
198
				<select <?php echo field_error('default_timezone');?> tabindex="3" name="default_timezone" style="width: 100%;">
191 199
					<?php
192 200
					$TIMEZONES['-12'] = 'GMT - 12 Hours';
193 201
					$TIMEZONES['-11'] = 'GMT -11 Hours';
......
235 243
				Default Language:
236 244
			</td>
237 245
			<td>
238
				<select tabindex="3" name="default_language" style="width: 100%;">
246
				<select <?php echo field_error('default_language');?> tabindex="3" name="default_language" style="width: 100%;">
239 247
					<?php
240 248
					$DEFAULT_LANGUAGE = array(
241 249
						'CA'=>'Catalan', 'DA'=>'Danish', 'DE'=>'Deutsch', 'EN'=>'English',
......
287 295
		<tr>
288 296
			<td width="120" style="color: #666666;">Host Name:</td>
289 297
			<td width="230">
290
				<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'; } ?>" />
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'; } ?>" />
291 299
			</td>
292 300
			<td width="7">&nbsp;</td>
293 301
			<td width="70" style="color: #666666;">Username:</td>
294 302
			<td>
295
				<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'; } ?>" />
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'; } ?>" />
296 304
			</td>
297 305
		</tr>
298 306
		<tr>
299 307
			<td style="color: #666666;">Database Name:</td>
300 308
			<td>
301
				<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'; } ?>" />
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'; } ?>" />
302 310
			</td>
303 311
			<td>&nbsp;</td>
304 312
			<td style="color: #666666;">Password:</td>
......
325 333
		<tr>
326 334
			<td style="color: #666666;" colspan="1">Website Title:</td>
327 335
			<td colspan="4">
328
				<input type="text" tabindex="13" name="website_title" style="width: 99%;" value="<?php if(isset($_SESSION['website_title'])) { echo $_SESSION['website_title']; } ?>" />
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']; } ?>" />
329 337
			</td>
330 338
		</tr>
331 339
		<tr>
......
334 342
		<tr>
335 343
			<td style="color: #666666;">Username:</td>
336 344
			<td>
337
				<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'; } ?>" />
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'; } ?>" />
338 346
			</td>
339 347
			<td>&nbsp;</td>
340 348
			<td style="color: #666666;">Password:</td>
341 349
			<td>
342
				<input type="password" tabindex="16" name="admin_password" style="width: 98%;"<?php if(isset($_SESSION['admin_password'])) { echo ' value = "'.$_SESSION['admin_password'].'"'; } ?> />
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'].'"'; } ?> />
343 351
			</td>
344 352
		</tr>
345 353
		<tr>
346 354
			<td style="color: #666666;">Email:</td>
347 355
			<td>
348
				<input type="text" tabindex="15" name="admin_email" style="width: 98%;"<?php if(isset($_SESSION['admin_email'])) { echo ' value = "'.$_SESSION['admin_email'].'"'; } ?> />
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'].'"'; } ?> />
349 357
			</td>
350 358
			<td>&nbsp;</td>
351 359
			<td style="color: #666666;">Re-Password:</td>
352 360
			<td>
353
				<input type="password" tabindex="17" name="admin_repassword" style="width: 98%;"<?php if(isset($_SESSION['admin_password'])) { echo ' value = "'.$_SESSION['admin_password'].'"'; } ?> />
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'].'"'; } ?> />
354 362
			</td>
355 363
		</tr>
356 364
		<tr>

Also available in: Unified diff