Project

General

Profile

« Previous | Next » 

Revision 1529

Added by Dietmar almost 13 years ago

add new backend theme handling (Tks to Stefek)

View differences:

save.php
81 81
		exit();
82 82
	}
83 83
}
84
/* */
84 85

  
85
// Dummy class to allow modules' install scripts to call $admin->print_error
86
class admin_dummy
87
{
88
	var $error='';
89
	function print_error($message)
90
	{
91
		$this->error=$message;
92
	}
93
}
94

  
95 86
// Function to workout what the default permissions are for files created by the webserver
96 87
function default_file_mode($temp_dir) {
97 88
	$v = explode(".",PHP_VERSION);
......
295 286
"\n".
296 287
"define('DB_TYPE', 'mysql');\n".
297 288
"define('DB_HOST', '$database_host');\n".
289
"define('DB_NAME', '$database_name');\n".
298 290
"define('DB_USERNAME', '$database_username');\n".
299 291
"define('DB_PASSWORD', '$database_password');\n".
300
"define('DB_NAME', '$database_name');\n".
301 292
"define('TABLE_PREFIX', '$table_prefix');\n".
302 293
"\n".
303 294
"define('WB_PATH', dirname(__FILE__));\n".
304 295
"define('WB_URL', '$wb_url');\n".
305 296
"define('ADMIN_PATH', WB_PATH.'/admin');\n".
306
"define('ADMIN_URL', '$wb_url/admin');\n".
297
"define('ADMIN_URL', WB_URL.'/admin');\n".
307 298
"\n".
308 299
"require_once(WB_PATH.'/framework/initialize.php');\n".
309 300
"\n".
310
"?>";
301
"";
311 302

  
312 303
$config_filename = '../config.php';
313 304

  
......
329 320
// Define configuration vars
330 321
define('DB_TYPE', 'mysql');
331 322
define('DB_HOST', $database_host);
323
define('DB_NAME', $database_name);
332 324
define('DB_USERNAME', $database_username);
333 325
define('DB_PASSWORD', $database_password);
334
define('DB_NAME', $database_name);
335 326
define('TABLE_PREFIX', $table_prefix);
336 327
define('WB_PATH', str_replace(array('/install','\install'), '',dirname(__FILE__)));
337 328
define('WB_URL', $wb_url);
......
358 349
$sSecMod = WB_PATH.'/framework/SecureForm'.$sSecMod.'.php';
359 350
require_once($sSecMod);
360 351

  
352
require_once(WB_PATH.'/framework/class.admin.php');
353

  
354
// Dummy class to allow modules' install scripts to call $admin->print_error
355
class admin_dummy extends admin
356
{
357
	var $error='';
358
	function print_error($message)
359
	{
360
		$this->error=$message;
361
	}
362
}
363

  
361 364
// Include WB functions file
362 365
require_once(WB_PATH.'/framework/functions.php');
363 366

  
364 367
// Re-connect to the database, this time using in-build database class
365 368
require_once(WB_PATH.'/framework/class.login.php');
369

  
366 370
$database=new database();
367 371

  
368 372
// Check if we should install tables
......
419 423
	       . ' `modified_when` INT NOT NULL DEFAULT \'0\','
420 424
	       . ' `modified_by` INT NOT NULL  DEFAULT \'0\','
421 425
	       . ' PRIMARY KEY ( `page_id` ) '
422
	       . ' )';
426
	       . ' ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci';
423 427
	$database->query($pages);
424 428
	
425 429
	// Sections table
......
431 435
	       . ' `publ_start` VARCHAR( 255 ) NOT NULL DEFAULT \'0\' ,'
432 436
	       . ' `publ_end` VARCHAR( 255 ) NOT NULL DEFAULT \'0\' ,' 
433 437
	       . ' PRIMARY KEY ( `section_id` ) '
434
	       . ' )';
438
	       . ' ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci';
435 439
	$database->query($pages);
436 440

  
437 441
	require(ADMIN_PATH.'/interface/version.php');
......
441 445
		. ' `name` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
442 446
		. ' `value` TEXT NOT NULL ,'
443 447
		. ' PRIMARY KEY ( `setting_id` ) '
444
		. ' )';
448
		. ' ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci';
445 449
	$database->query($settings);
446 450

  
447 451
	$settings_rows=	"INSERT INTO `".TABLE_PREFIX."settings` "
......
453 457
	." ('website_header', ''),"
454 458
	." ('website_footer', ''),"
455 459
	." ('wysiwyg_style', 'font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px;'),"
456
	." ('rename_files_on_upload', 'php,asp,phpx,aspx'),"
457 460
	." ('er_level', ''),"
458 461
	." ('default_language', '$default_language'),"
459 462
	." ('app_name', 'wb_$session_rand'),"
......
519 522
	       . ' `login_when` INT NOT NULL  DEFAULT \'0\','
520 523
	       . ' `login_ip` VARCHAR( 15 ) NOT NULL DEFAULT \'\' ,'
521 524
	       . ' PRIMARY KEY ( `user_id` ) '
522
	       . ' )';
525
	       . ' ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci';
523 526
	$database->query($users);
524 527
	
525 528
	// Groups table
......
529 532
	        . ' `module_permissions` TEXT NOT NULL ,'
530 533
	        . ' `template_permissions` TEXT NOT NULL ,'
531 534
	        . ' PRIMARY KEY ( `group_id` ) '
532
	        . ' )';
535
	        . ' ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci';
533 536
	$database->query($groups);
534 537
	
535 538
	// Search settings table
......
538 541
	        . ' `value` TEXT NOT NULL ,'
539 542
	        . ' `extra` TEXT NOT NULL ,'
540 543
	        . ' PRIMARY KEY ( `search_id` ) '
541
	        . ' )';
544
	        . ' ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci';
542 545
	$database->query($search);
543 546
	
544 547
	// Addons table
......
554 557
			.'`author` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
555 558
			.'`license` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
556 559
			.' PRIMARY KEY ( `addon_id` ) '
557
			.' )';
560
			.' ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci';
558 561
	$database->query($addons);
559 562

  
560 563
	// Insert default data
......
654 657

  
655 658
	// Include the PclZip class file (thanks to
656 659
	require_once(WB_PATH.'/include/pclzip/pclzip.lib.php');
657
			
660

  
658 661
	// Install add-ons
659 662
	if(file_exists(WB_PATH.'/install/modules')) {
660 663
		// Unpack pre-packaged modules
......
668 671
		// Unpack pre-packaged languages
669 672
		
670 673
	}
671
	
672
	$admin=new admin_dummy();
674

  
675
	$admin=new admin_dummy('Start','',false,false);
676

  
673 677
	// Load addons into DB
674 678
	$dirs['modules'] = WB_PATH.'/modules/';
675 679
	$dirs['templates'] = WB_PATH.'/templates/';
......
774 778
	 	}
775 779
	}
776 780
}
781

  
782
$ThemeUrl = WB_URL.$admin->correct_theme_source('warning.html');
783
// Setup template object, parse vars to it, then parse it
784
$ThemePath = realpath(WB_PATH.$admin->correct_theme_source('login.htt'));
785

  
777 786
// Log the user in and go to Website Baker Administration
778 787
$thisApp = new Login(
779 788
		array(
780 789
				"MAX_ATTEMPS" => "50",
781
				"WARNING_URL" => ADMIN_URL."/login/warning.html",
790
				"WARNING_URL" => $ThemeUrl."/warning.html",
782 791
				"USERNAME_FIELDNAME" => 'admin_username',
783 792
				"PASSWORD_FIELDNAME" => 'admin_password',
784 793
				"REMEMBER_ME_OPTION" => SMART_LOGIN,
785 794
				"MIN_USERNAME_LEN" => "2",
786
				"MIN_PASSWORD_LEN" => "2",
795
				"MIN_PASSWORD_LEN" => "3",
787 796
				"MAX_USERNAME_LEN" => "30",
788 797
				"MAX_PASSWORD_LEN" => "30",
789 798
				'LOGIN_URL' => ADMIN_URL."/login/index.php",
790 799
				'DEFAULT_URL' => ADMIN_URL."/start/index.php",
791
				'TEMPLATE_DIR' => ADMIN_PATH."/login",
792
				'TEMPLATE_FILE' => "template.html",
800
				'TEMPLATE_DIR' => $ThemePath,
801
				'TEMPLATE_FILE' => 'login.htt',
793 802
				'FRONTEND' => false,
794 803
				'FORGOTTEN_DETAILS_APP' => ADMIN_URL."/login/forgot/index.php",
795 804
				'USERS_TABLE' => TABLE_PREFIX."users",
796 805
				'GROUPS_TABLE' => TABLE_PREFIX."groups",
797 806
		)
798 807
);
799
?>

Also available in: Unified diff