Project

General

Profile

« Previous | Next » 

Revision 1770

Added by Dietmar almost 12 years ago

  1. fixed issues with database names
    WbDatabase::getTableEngine() changed SQL statement to strikt.
    ! remove empty warning box if you aren't sysadmin
    ! change order errorhandling in installation save.php
  2. typofix in news/upgrade.php $MESSAGE
    ! Framework/frontend.functions.php change file_exists to is_readable

View differences:

branches/2.8.x/CHANGELOG
13 13

  
14 14

  
15 15

  
16
24 Sep-2012 Build 1770 Dietmar Woellbrink (Luisehahne)
17
# fixed issues with database names
18
  WbDatabase::getTableEngine() changed SQL statement to strikt.
19
! remove empty warning box if you aren't sysadmin
20
! change order errorhandling in installation save.php
21
# typofix in news/upgrade.php $MESSAGE
22
! Framework/frontend.functions.php change file_exists to is_readable
16 23
23 Sep-2012 Build 1769 Dietmar Woellbrink (Luisehahne)
17 24
# typofix in upgrade-script, fixed wrong count for language and modules folder
18 25
23 Sep-2012 Build 1768 Dietmar Woellbrink (Luisehahne)
branches/2.8.x/wb/admin/start/index.php
85 85
// workout to upgrade the groups system_permissions
86 86
// ---------------------------------------
87 87
if( ($admin->get_user_id()==1) &&
88
	file_exists(ADMIN_PATH.'/groups/upgradePermissions.php') &&
89
	!defined('GROUPS_UPDATED') )
88
	file_exists(ADMIN_PATH.'/groups/upgradePermissions.php') && !defined('GROUPS_UPDATED') )
90 89
{
91 90
	// check if it is neccessary to start the uograde-script
92 91
	$sql = 'SELECT `value` FROM `'.TABLE_PREFIX.'settings` WHERE `name`=\'wb_revision\'';
......
235 234
// Check if installation directory still exists
236 235
if(file_exists(WB_PATH.'/install/') || file_exists(WB_PATH.'/upgrade-script.php') ) {
237 236
	// Check if user is part of Adminstrators group
238
	if(in_array(1, $admin->get_groups_id()))
237
	if($admin->get_user_id()==1)
239 238
    {
240 239
		$oTpl->set_var('WARNING', $msg );
241 240
	} else {
branches/2.8.x/wb/admin/interface/version.php
51 51

  
52 52
// check if defined to avoid errors during installation (redirect to admin panel fails if PHP error/warnings are enabled)
53 53
if(!defined('VERSION')) define('VERSION', '2.8.3');
54
if(!defined('REVISION')) define('REVISION', '1769');
54
if(!defined('REVISION')) define('REVISION', '1770');
55 55
if(!defined('SP')) define('SP', '');
branches/2.8.x/wb/framework/WbDatabase.php
396 396
		$retVal = false;
397 397
		$mysqlVersion = mysql_get_server_info($this->_db_handle);
398 398
		$engineValue = (version_compare($mysqlVersion, '5.0') < 0) ? 'Type' : 'Engine';
399
		$sql = "SHOW TABLE STATUS FROM " . $this->_db_name . " LIKE '" . $table . "'";
399
		$sql = 'SHOW TABLE STATUS FROM `' . $this->_db_name . '` LIKE \'' . $table . '\'';
400 400
		if(($result = $this->query($sql, $this->_db_handle))) {
401 401
			if(($row = $result->fetchRow(MYSQL_ASSOC))) {
402 402
				$retVal = $row[$engineValue];
branches/2.8.x/wb/framework/frontend.functions.php
39 39
	if(($resSnippets = $database->query($sql))) {
40 40
		while($recSnippet = $resSnippets->fetchRow()) {
41 41
			$module_dir = $recSnippet['directory'];
42
			if (file_exists(WB_PATH.'/modules/'.$module_dir.'/include.php')) {
42
			if (is_readable(WB_PATH.'/modules/'.$module_dir.'/include.php')) {
43 43
				include(WB_PATH.'/modules/'.$module_dir.'/include.php');
44 44
			// check if frontend.css file needs to be included into the <head></head> of index.php
45
				if( file_exists(WB_PATH .'/modules/'.$module_dir.'/frontend.css')) {
45

  
46
				if( is_readable(WB_PATH .'/modules/'.$module_dir.'/frontend.css')) {
46 47
					$include_head_link_css .= '<link href="'.WB_URL.'/modules/'.$module_dir.'/frontend.css"';
47 48
					$include_head_link_css .= ' rel="stylesheet" type="text/css" media="screen" />'."\n";
48 49
					$include_head_file = 'frontend.css';
49 50
				}
50 51
			// check if frontend.js file needs to be included into the <body></body> of index.php
51
				if(file_exists(WB_PATH .'/modules/'.$module_dir.'/frontend.js')) {
52
				if(is_readable(WB_PATH .'/modules/'.$module_dir.'/frontend.js')) {
52 53
					$include_head_links .= '<script src="'.WB_URL.'/modules/'.$module_dir.'/frontend.js" type="text/javascript"></script>'."\n";
53 54
					$include_head_file = 'frontend.js';
54 55
				}
55 56
			// check if frontend_body.js file needs to be included into the <body></body> of index.php
56
				if(file_exists(WB_PATH .'/modules/'.$module_dir.'/frontend_body.js')) {
57
				if(is_readable(WB_PATH .'/modules/'.$module_dir.'/frontend_body.js')) {
57 58
					$include_body_links .= '<script src="'.WB_URL.'/modules/'.$module_dir.'/frontend_body.js" type="text/javascript"></script>'."\n";
58 59
					$include_body_file = 'frontend_body.js';
59 60
				}
......
468 469
			$jquery_links .= '<script src="'.WB_URL.'/include/jquery/jquery-include.js" type="text/javascript"></script>'."\n";
469 470
            /* workout to insert ui.css and theme */
470 471
            $jquery_theme =  WB_PATH.'/modules/jquery/jquery_theme.js';
471
			$jquery_links .=  file_exists($jquery_theme)
472
			$jquery_links .=  is_readable($jquery_theme)
472 473
                ? '<script src="'.WB_URL.'/modules/jquery/jquery_theme.js" type="text/javascript"></script>'."\n"
473 474
                : '<script src="'.WB_URL.'/include/jquery/jquery_theme.js" type="text/javascript"></script>'."\n";
474 475
            /* workout to insert plugins functions, set in templatedir */
475 476
            $jquery_frontend_file = TEMPLATE_DIR.'/jquery_frontend.js';
476
			$jquery_links .= file_exists(str_replace( WB_URL, WB_PATH, $jquery_frontend_file))
477
			$jquery_links .= is_readable(str_replace( WB_URL, WB_PATH, $jquery_frontend_file))
477 478
                ? '<script src="'.$jquery_frontend_file.'" type="text/javascript"></script>'."\n"
478 479
                : '';
479 480
		}
......
525 526
	    		while($row = $query_modules->fetchRow())
526 527
	            {
527 528
	    			// check if page module directory contains a frontend_body.js file
528
	    			if(file_exists(WB_PATH ."/modules/" .$row['module'] ."/$base_file"))
529
	    			if(is_readable(WB_PATH ."/modules/" .$row['module'] ."/$base_file"))
529 530
	                {
530 531
	    			// create link with frontend_body.js source for the current module
531 532
	    				$tmp_link = str_replace("{MODULE_DIRECTORY}", $row['module'], $base_link);
......
603 604
	    		while($row = $query_modules->fetchRow())
604 605
	            {
605 606
	    			// check if page module directory contains a frontend.js or frontend.css file
606
	    			if(file_exists(WB_PATH ."/modules/" .$row['module'] ."/$base_file"))
607
	    			if(is_readable(WB_PATH ."/modules/" .$row['module'] ."/$base_file"))
607 608
	                {
608 609
	    			// create link with frontend.js or frontend.css source for the current module
609 610
	    				$tmp_link = str_replace("{MODULE_DIRECTORY}", $row['module'], $base_link);
......
637 638
        print $head_links;
638 639
    }
639 640
}
640
/*
641
	function moveCssToHead($content) {
642
		// move css definitions into head section
643
		$pattern1 = '/(?:<body.*?)(<link[^>]*?\"text\/css\".*?\/>)/si';
644
		$pattern2 = '/(?:<body.*?)(<style[^>]*?\"text\/css\"[^>]* ?>.*?<\/style>)/si';
645
		while(preg_match($pattern1, $content, $matches)==1) {
646
		// loop through all linked CSS
647
			$insert = $matches[1];
648
			$content = str_replace($insert, '', $content);
649
			$insert = "\n".$insert."\n</head>\n<body";
650
			$content = preg_replace('/<\/head>.*?<body/si', $insert, $content);
651
		}
652
		while(preg_match($pattern2, $content, $matches)==1) {
653
		// loop through all inline CSS
654
			$insert = $matches[1];
655
			$content = str_replace($insert, '', $content);
656
			$insert = "\n".$insert."\n</head>\n<body";
657
			$content = preg_replace('/<\/head>.*?<body/si', $insert, $content);
658
		}
659
		return $content;
660
	}
661
*/
branches/2.8.x/wb/install/save.php
201 201
	set_error('Please enter a database host name', 'database_host');
202 202
} else {
203 203
	$database_host = $_POST['database_host'];
204
}
205
// Check if user has entered a database username
206
if(!isset($_POST['database_username']) OR $_POST['database_username'] == '') {
207
	set_error('Please enter a database username','database_username');
208
} else {
209
	$database_username = $_POST['database_username'];
210
}
211
// Check if user has entered a database password
212
if(!isset($_POST['database_password'])) {
213
	set_error('Please enter a database password', 'database_password');
214
} else {
215
	$database_password = $_POST['database_password'];
216
}
204
 }
217 205
// Check if user has entered a database name
218 206
if(!isset($_POST['database_name']) OR $_POST['database_name'] == '') {
219 207
	set_error('Please enter a database name', 'database_name');
220 208
} else {
221 209
	// make sure only allowed characters are specified
222
	if(preg_match('/[^a-z0-9_-]+/i', $_POST['database_name'])) {
210
	if(!preg_match('/^[a-z0-9_-]*$/i', $_POST['database_name'])) {
223 211
		// contains invalid characters (only a-z, A-Z, 0-9 and _ allowed to avoid problems with table/field names)
224 212
		set_error('Only characters a-z, A-Z, 0-9, - and _ allowed in database name.', 'database_name');
225 213
	}
226 214
	$database_name = $_POST['database_name'];
227 215
}
228 216
// Get table prefix
229
if(preg_match('/[^a-z0-9_]+/i', $_POST['table_prefix'])) {
217
if(!preg_match('/^[a-z0-9_]*$/i', $_POST['table_prefix'])) {
230 218
	// contains invalid characters (only a-z, A-Z, 0-9 and _ allowed to avoid problems with table/field names)
231 219
	set_error('Only characters a-z, A-Z, 0-9 and _ allowed in table_prefix.', 'table_prefix');
232 220
} else {
233 221
	$table_prefix = $_POST['table_prefix'];
234 222
}
235 223

  
224
// Check if user has entered a database username
225
if(!isset($_POST['database_username']) OR $_POST['database_username'] == '') {
226
	set_error('Please enter a database username','database_username');
227
} else {
228
	$database_username = $_POST['database_username'];
229
}
230
// Check if user has entered a database password
231
if(!isset($_POST['database_password'])) {
232
	set_error('Please enter a database password', 'database_password');
233
} else {
234
	$database_password = $_POST['database_password'];
235
}
236

  
236 237
// Find out if the user wants to install tables and data
237 238
$install_tables = ((isset($_POST['install_tables']) AND $_POST['install_tables'] == 'true'));
238 239
// End database details code
branches/2.8.x/wb/modules/news/upgrade.php
82 82
					return;
83 83
				} else {
84 84
//					$admin->print_error($MESSAGE['RECORD_MODIFIED_FAILED']);
85
					$msg[] = $$MESSAGE['RECORD_MODIFIED_FAILED'];
85
					$msg[] = $MESSAGE['RECORD_MODIFIED_FAILED'];
86 86
					return $msg;
87 87
				}
88 88
			}
......
100 100
					return;
101 101
				}else {
102 102
//					$admin->print_error($MESSAGE['RECORD_MODIFIED_FAILED']);
103
					$msg[] = $$MESSAGE['RECORD_MODIFIED_FAILED'];
103
					$msg[] = $MESSAGE['RECORD_MODIFIED_FAILED'];
104 104
					return $msg;
105 105
				}
106 106
			}

Also available in: Unified diff