Project

General

Profile

« Previous | Next » 

Revision 987

Added by aldus almost 15 years ago

Bugfixes for ticket 728 (install without tables) - see changelog for details.

View differences:

trunk/CHANGELOG
11 11
! = Update/Change
12 12

  
13 13
------------------------------------- 2.8.0 -------------------------------------
14
14-June-2009 Dietrich Roland Pehlke (aldus)
15
# Bugfixes for (ticket #728)
16
+ Add additional constant to "install/save.php" to avoid conflikts during
17
	installation inside "/framework/initialize.php".
18
+ Add condition inside "/framework/initialize.php" to avoid conflikts
19
	during installation; table "mod_captcha_control" doesn't exsits at runtime.
20
+ Add test for tables inside "install/save.php" if the user uncheck "install table" option.
21
+ Additional Errormessage if nessesary tables are not found (english).
14 22
13-jun-2009 Matthias Gallas
15 23
+	Added jQuery-insert.js and jQuery plugins (Thanks to Luisehahne)
16 24
!	Moved images in lQuery plugins folder (Thanks to Luisehahne)
trunk/wb/framework/initialize.php
51 51
	$string_dir_mode = STRING_DIR_MODE;
52 52
	define('OCTAL_DIR_MODE',(int) octdec($string_dir_mode));
53 53
	
54
	// get CAPTCHA and ASP settings
55
	$table = TABLE_PREFIX.'mod_captcha_control';
56
	if($get_settings = $database->query("SELECT * FROM $table LIMIT 1")) {
57
		if($get_settings->numRows() == 0) { die("CAPTCHA-Settings not found"); }
58
		$setting = $get_settings->fetchRow();
59
		if($setting['enabled_captcha'] == '1') define('ENABLED_CAPTCHA', true);
60
		else define('ENABLED_CAPTCHA', false);
61
		if($setting['enabled_asp'] == '1') define('ENABLED_ASP', true);
62
		else define('ENABLED_ASP', false);
63
		define('CAPTCHA_TYPE', $setting['captcha_type']);
64
		define('ASP_SESSION_MIN_AGE', (int)$setting['asp_session_min_age']);
65
		define('ASP_VIEW_MIN_AGE', (int)$setting['asp_view_min_age']);
66
		define('ASP_INPUT_MIN_AGE', (int)$setting['asp_input_min_age']);
54
	if (!defined("WB_INSTALL_PROCESS")) {
55
		// get CAPTCHA and ASP settings
56
		$table = TABLE_PREFIX.'mod_captcha_control';
57
		if($get_settings = $database->query("SELECT * FROM $table LIMIT 1")) {
58
			if($get_settings->numRows() == 0) { die("CAPTCHA-Settings not found"); }
59
			$setting = $get_settings->fetchRow();
60
			if($setting['enabled_captcha'] == '1') define('ENABLED_CAPTCHA', true);
61
			else define('ENABLED_CAPTCHA', false);
62
			if($setting['enabled_asp'] == '1') define('ENABLED_ASP', true);
63
			else define('ENABLED_ASP', false);
64
			define('CAPTCHA_TYPE', $setting['captcha_type']);
65
			define('ASP_SESSION_MIN_AGE', (int)$setting['asp_session_min_age']);
66
			define('ASP_VIEW_MIN_AGE', (int)$setting['asp_view_min_age']);
67
			define('ASP_INPUT_MIN_AGE', (int)$setting['asp_input_min_age']);
68
		}
67 69
	}
68

  
69 70
	// set error-reporting
70 71
	if(is_numeric(ER_LEVEL)) {
71 72
		error_reporting(ER_LEVEL);
trunk/wb/install/save.php
22 22
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23 23

  
24 24
*/
25
$debug = true;
25 26

  
27
if (true === $debug) {
28
	ini_set('display_errors', 1);
29
	error_reporting(E_ALL);
30
}
26 31
// Start a session
27 32
if(!defined('SESSION_STARTED')) {
28 33
	session_name('wb_session_id');
......
126 131
}
127 132

  
128 133
function add_slashes($input) {
129
		if ( get_magic_quotes_gpc() || ( !is_string($input) ) ) {
130
			return $input;
131
		}
132
		$output = addslashes($input);
133
		return $output;
134
	if ( get_magic_quotes_gpc() || ( !is_string($input) ) ) {
135
		return $input;
134 136
	}
137
	$output = addslashes($input);
138
	return $output;
139
}
135 140

  
136 141
// Begin check to see if form was even submitted
137 142
// Set error if no post vars found
......
364 369

  
365 370
// Check if we should install tables
366 371
if($install_tables == true) {
367
	
372
	if (!defined('WB_INSTALL_PROCESS')) define ('WB_INSTALL_PROCESS', true);
368 373
	// Remove tables if they exist
369 374

  
370 375
	// Pages table
......
693 698
	if($database->is_error()) {
694 699
		set_error($database->get_error());
695 700
	}
701

  
702
// end of if install_tables	
703
} else {
704
	/**
705
	 *	DB - Exists
706
	 *	Tables also?
707
	 *
708
	 */
709
	$requested_tables = array("pages","sections","settings","users","groups","search","addons");
710
	for($i=0;$i<count($requested_tables);$i++) $requested_tables[$i] = $table_prefix.$requested_tables[$i];
696 711
	
712
	$result = mysql_list_tables( DB_NAME );
713
	$all_tables = array();
714
	for($i=0; $i < mysql_num_rows($result); $i++) $all_tables[] = mysql_table_name($result, $i);
715

  
716
	$missing_tables = array();
717
	foreach($requested_tables as $temp_table) {
718
		if (!in_array($temp_table, $all_tables)) {
719
			$missing_tables[] = $temp_table;
720
		}
721
	}
722
	
723
	/**
724
	 *	If one or more needed tables are missing, so 
725
	 *	we can't go on and have to display an error
726
	 */
727
	if ( count($missing_tables) > 0 ) {
728
		$error_message  = "One or more tables are missing in the selected database <b><font color='#990000'>".DB_NAME."</font></b>.<br />";
729
		$error_message .= "Please install the missing tables or choose 'install tables' as recommend.<br />";
730
		$error_message .= "Missing tables are: <b>".implode(", ", $missing_tables)."</b>";
731
		
732
		set_error( $error_message );
733
	}
734
	
735
	/**
736
	 *	Try to get some default settings ...
737
	 */
738
	$vars = array(
739
		'DEFAULT_THEME'	=> "wb_theme",
740
		'THEME_URL'		=> WB_URL."/templates/wb_theme",
741
		'THEME_PATH'	=> WB_PATH."/templates/wb_theme",
742
		'LANGUAGE'		=> $_POST['default_language'],
743
		'SERVER_EMAIL'	=> "admin@yourdomain.com",
744
		'SMART_LOGIN'	=> false
745
	);
746
	foreach($vars as $k => $v) if (!defined($k)) define($k, $v);
747
	
748
	if (!isset($MESSAGE)) include (WB_PATH."/languages/".LANGUAGE.".php");
749
	
750
	/**
751
	 *	The important part ...
752
	 *	Is there an valid user?
753
	 */
754
	$result = $database->query("SELECT * from ".$table_prefix."users where username='".$_POST['admin_username']."'");
755
	if ( $database->is_error() ) {
756
		set_error ($database->get_error() );
757
	}
758
	if ($result->numRows() == 0) {
759
		/**
760
		 *	No matches found ... user properly unknown
761
	 	 */
762
	 	set_error ("Unkown user. Please use a valid username.");
763
	} else {
764
	 	
765
		$data = $result->fetchRow();
766
	 	/**
767
	 	 *	Does the password match
768
	 	 */
769
	 	if ( md5($_POST['admin_password']) != $data['password']) {
770
	 		set_error ("Password didn't match");
771
	 	}
772
	}
697 773
}
698

  
699 774
// Log the user in and go to Website Baker Administration
700 775
$thisApp = new Login(
701
							array(
702
									"MAX_ATTEMPS" => "50",
703
									"WARNING_URL" => ADMIN_URL."/login/warning.html",
704
									"USERNAME_FIELDNAME" => 'admin_username',
705
									"PASSWORD_FIELDNAME" => 'admin_password',
706
									"REMEMBER_ME_OPTION" => SMART_LOGIN,
707
									"MIN_USERNAME_LEN" => "2",
708
									"MIN_PASSWORD_LEN" => "2",
709
									"MAX_USERNAME_LEN" => "30",
710
									"MAX_PASSWORD_LEN" => "30",
711
									'LOGIN_URL' => ADMIN_URL."/login/index.php",
712
									'DEFAULT_URL' => ADMIN_URL."/start/index.php",
713
									'TEMPLATE_DIR' => ADMIN_PATH."/login",
714
									'TEMPLATE_FILE' => "template.html",
715
									'FRONTEND' => false,
716
									'FORGOTTEN_DETAILS_APP' => ADMIN_URL."/login/forgot/index.php",
717
									'USERS_TABLE' => TABLE_PREFIX."users",
718
									'GROUPS_TABLE' => TABLE_PREFIX."groups",
719
							)
720
					);
776
		array(
777
				"MAX_ATTEMPS" => "50",
778
				"WARNING_URL" => ADMIN_URL."/login/warning.html",
779
				"USERNAME_FIELDNAME" => 'admin_username',
780
				"PASSWORD_FIELDNAME" => 'admin_password',
781
				"REMEMBER_ME_OPTION" => SMART_LOGIN,
782
				"MIN_USERNAME_LEN" => "2",
783
				"MIN_PASSWORD_LEN" => "2",
784
				"MAX_USERNAME_LEN" => "30",
785
				"MAX_PASSWORD_LEN" => "30",
786
				'LOGIN_URL' => ADMIN_URL."/login/index.php",
787
				'DEFAULT_URL' => ADMIN_URL."/start/index.php",
788
				'TEMPLATE_DIR' => ADMIN_PATH."/login",
789
				'TEMPLATE_FILE' => "template.html",
790
				'FRONTEND' => false,
791
				'FORGOTTEN_DETAILS_APP' => ADMIN_URL."/login/forgot/index.php",
792
				'USERS_TABLE' => TABLE_PREFIX."users",
793
				'GROUPS_TABLE' => TABLE_PREFIX."groups",
794
		)
795
);
721 796
?>

Also available in: Unified diff