Project

General

Profile

« Previous | Next » 

Revision 95

Added by stefan about 19 years ago

Moved settings from config.php into database.
NOT FULLY WORKING!!!

View differences:

save.php
268 268
$config_content = "" .
269 269
"<?php\n".
270 270
"\n".
271
"define('ER_LEVEL', '');\n".
272
"\n".
273
"define('DEFAULT_LANGUAGE', 'EN');\n".
274
"\n".
275
"define('APP_NAME', 'wb');\n".
276
"\n".
277 271
"define('DB_TYPE', 'mysql');\n".
278 272
"define('DB_HOST', '$database_host');\n".
279 273
"define('DB_USERNAME', '$database_username');\n".
280 274
"define('DB_PASSWORD', '$database_password');\n".
281 275
"define('DB_NAME', '$database_name');\n".
282
"\n".
283 276
"define('TABLE_PREFIX', '$table_prefix');\n".
284 277
"\n".
285
"define('DEFAULT_TIMEZONE', '$default_timezone');\n".
286
"define('DEFAULT_DATE_FORMAT', 'M d Y');\n".
287
"define('DEFAULT_TIME_FORMAT', 'g:i A');\n".
288
"\n".
289
"define('HOME_FOLDERS', true);\n".
290
"\n".
291
"define('DEFAULT_TEMPLATE', 'round');\n".
292
"define('MULTIPLE_MENUS', false);\n".
293
"\n".
294
"define('PAGE_LEVEL_LIMIT', '4');\n".
295
"define('INTRO_PAGE', false);\n".
296
"define('PAGE_TRASH', 'disabled');\n".
297
"define('HOMEPAGE_REDIRECTION', false);\n".
298
"define('PAGE_LANGUAGES', false);\n".
299
"define('WYSIWYG_EDITOR', 'htmlarea');\n".
300
"\n".
301
"define('MANAGE_SECTIONS', true);\n".
302
"define('SECTION_BLOCKS', false);\n".
303
"\n".
304
"define('SMART_LOGIN', false);\n".
305
"define('FRONTEND_LOGIN', false);\n".
306
"define('FRONTEND_SIGNUP', '');\n".
307
"\n".
308
"define('SERVER_EMAIL', '".$admin_email."');\n".
309
"\n".
310
"define('SEARCH', 'public');\n".
311
"\n".
312
"define('PAGE_EXTENSION', '.php');\n".
313
"define('PAGE_SPACER', '-');\n".
314
"\n".
315
"define('PAGES_DIRECTORY', '/pages');\n".
316
"define('MEDIA_DIRECTORY', '/media');\n".
317
"\n".
318
"define('OPERATING_SYSTEM', '$operating_system');\n".
319
"define('OCTAL_FILE_MODE', $file_mode);\n".
320
"define('STRING_FILE_MODE', '$file_mode');\n".
321
"define('OCTAL_DIR_MODE', $dir_mode);\n".
322
"define('STRING_DIR_MODE', '$dir_mode');\n".
323
"\n".
324 278
"define('WB_PATH', '$wb_path');\n".
325 279
"define('WB_URL', '$wb_url');\n".
326
"\n".
327 280
"define('ADMIN_PATH', '$wb_path/admin');\n".
328 281
"define('ADMIN_URL', '$wb_url/admin');\n".
329 282
"\n".
......
354 307
	set_error('It appears the Absolute path that you entered is incorrect');
355 308
}
356 309

  
357
// Include WB functions file
358
require_once(WB_PATH.'/framework/functions.php');
359

  
360 310
// Try connecting to database	
361 311
if(!mysql_connect(DB_HOST, DB_USERNAME, DB_PASSWORD)) {
362 312
	set_error('Database host name, username and/or password incorrect. MySQL Error:<br />'.mysql_error());
......
368 318
// Close the mysql connection
369 319
mysql_close();
370 320

  
321
// Include WB functions file
322
require_once(WB_PATH.'/framework/functions.php');
323

  
371 324
// Re-connect to the database, this time using in-build database class
372
require_once(WB_PATH.'/framework/class.admin.php');
373
$database = new database();
325
require_once(WB_PATH.'/framework/class.login.php');
326
$database=new database();
374 327

  
375 328
// Check if we should install tables
376 329
if($install_tables == true) {
......
396 349
	$search = "DROP TABLE IF EXISTS `".TABLE_PREFIX."search`";
397 350
	$database->query($search);
398 351
			
352

  
353

  
399 354
	// Try installing tables
400 355
	
401 356
	// Pages table
......
437 392
	$database->query($pages);
438 393
	
439 394
	// Settings table
440
	$settings = 'CREATE TABLE `'.TABLE_PREFIX.'settings` ( `setting_id` INT NOT NULL auto_increment,'
441
	          . ' `name` VARCHAR( 255 ) NOT NULL ,'
442
	          . ' `value` TEXT NOT NULL ,'
443
	          . ' PRIMARY KEY ( `setting_id` ) )'
444
	          . ' ';
395
	$settings="CREATE TABLE `".TABLE_PREFIX."settings` ( `setting_id` INT NOT NULL auto_increment,
396
		`name` VARCHAR( 255 ) NOT NULL ,
397
		`value` TEXT NOT NULL ,
398
		PRIMARY KEY ( `setting_id` ) )";
445 399
	$database->query($settings);
400
	$settings_rows=	"INSERT INTO `".TABLE_PREFIX."settings` VALUES ('', 'website_title', '$website_title'),"
401
	." ('', 'website_description', ''),"
402
	." ('', 'website_keywords', ''),"
403
	." ('', 'website_header', ''),"
404
	." ('', 'website_footer', ''),"
405
	." ('', 'wysiwyg_style', 'font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px;'),"
406
	." ('', 'rename_files_on_upload', 'php,asp,phpx,aspx'),"
407
	." ('', 'er_level', ''),"
408
	." ('', 'default_language', 'en'),"
409
	." ('', 'app_name', 'wb'),"
410
	." ('', 'default_timezone', '0'),"
411
	." ('', 'default_date_format', 'M d Y'),"
412
	." ('', 'default_time_format', 'g:i A'),"
413
	." ('', 'home_folders', '1'),"
414
	." ('', 'default_template', 'round'),"
415
	." ('', 'multiple_menus', 'false'),"
416
	." ('', 'page_level_limit', '4'),"
417
	." ('', 'intro_page', 'false'),"
418
	." ('', 'page_trash', 'disabled'),"
419
	." ('', 'homepage_redirection', 'false'),"
420
	." ('', 'page_languages', 'false'),"
421
	." ('', 'wysiwyg_editor', 'htmlarea'),"
422
	." ('', 'manage_sections', '1'),"
423
	." ('', 'section_blocks', 'false'),"
424
	." ('', 'smart_login', 'false'),"
425
	." ('', 'frontend_login', 'false'),"
426
	." ('', 'frontend_signup', 'false'),"
427
	." ('', 'server_email', '$admin_email'),"
428
	." ('', 'search', 'public'),"
429
	." ('', 'page_extension', '.php'),"
430
	." ('', 'page_spacer', '-'),"
431
	." ('', 'pages_directory', '/pages'),"
432
	." ('', 'media_directory', '/media'),"
433
	." ('', 'operating_system', '$operating_system'),"
434
	." ('', 'octal_file_mode', '$file_mode'),"
435
	." ('', 'string_file_mode', '$file_mode'),"
436
	." ('', 'octal_dir_mode', '$dir_mode'),"
437
	." ('', 'string_dir_mode', '$dir_mode');";
438
	$database->query($settings_rows);
446 439
	
440
	
447 441
	// Users table
448 442
	$users = 'CREATE TABLE `'.TABLE_PREFIX.'users` ( `user_id` INT NOT NULL auto_increment,'
449 443
	       . ' `group_id` INT NOT NULL ,'
......
493 487
	// Admin user
494 488
	$insert_admin_user = "INSERT INTO `".TABLE_PREFIX."users` (user_id,group_id,active,username,password,email,display_name) VALUES ('1','1','1','$admin_username','".md5($admin_password)."','$admin_email','Administrator')";
495 489
	$database->query($insert_admin_user);
496
	// Default settings
497
	$insert_website_title = "INSERT INTO `".TABLE_PREFIX."settings` VALUES ('', 'title', '".$website_title."')";
498
	$database->query($insert_website_title);
499
	$insert_website_description = "INSERT INTO `".TABLE_PREFIX."settings` VALUES ('', 'description', '')";
500
	$database->query($insert_website_description);
501
	$insert_website_keywords = "INSERT INTO `".TABLE_PREFIX."settings` VALUES ('', 'keywords', '')";
502
	$database->query($insert_website_keywords);
503
	$insert_website_header = "INSERT INTO `".TABLE_PREFIX."settings` VALUES ('', 'header', '')";
504
	$database->query($insert_website_header);
505
	$insert_website_footer = "INSERT INTO `".TABLE_PREFIX."settings` VALUES ('', 'footer', '')";
506
	$database->query($insert_website_footer);
507
	$insert_wysiwyg_style = "INSERT INTO `".TABLE_PREFIX."settings` VALUES ('', 'wysiwyg_style', 'font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px;')";
508
	$database->query($insert_wysiwyg_style);
509
	$insert_rename_files_on_upload = "INSERT INTO `".TABLE_PREFIX."settings` VALUES ('', 'rename_files_on_upload', 'php,asp,phpx,aspx')";
510
	$database->query($insert_rename_files_on_upload);
511 490
	
512 491
	// Search header
513 492
	$search_header = addslashes('
......
571 550
	// Search template
572 551
	$database->query("INSERT INTO `".TABLE_PREFIX."search` (name) VALUES ('template')");
573 552
	
553
	$wb=new wb();
554
	
574 555
	// Include the pre-installed module install scripts
575 556
	require(WB_PATH.'/modules/wysiwyg/install.php');
576 557
	require(WB_PATH.'/modules/code/install.php');
......
586 567
}
587 568

  
588 569
// Log the user in and go to Website Baker Administration
589
require(WB_PATH.'/framework/class.login.php');
590 570
$thisApp = new Login(
591 571
							array(
592 572
									"MAX_ATTEMPS" => "50",

Also available in: Unified diff