Project

General

Profile

« Previous | Next » 

Revision 1874

Added by darkviper over 11 years ago

some little typo fixes in initialize.php
readConfiguration() fixed in initialize.php

View differences:

initialize.php
92 92
 * 
93 93
 */
94 94
	function readConfiguration($sRetvalType = 'url') {
95
		// check for valid file request. Becomes more stronger in next version
95 96
		$x = debug_backtrace();
96
		if(sizeof($x) != 0) { throw new RuntimeException('illegal function request!'); }
97
		$bValidRequest = false;
98
		if(sizeof($x) != 0) {
99
			foreach($x as $aStep) {
100
				// define the scripts which can read the configuration
101
				if(preg_match('/(index.php|config.php|upgrade-script.php)$/si', $aStep['file'])) {
102
					$bValidRequest = true;
103
					break;
104
				}
105
			}
106
		}else {
107
			$bValidRequest = true;
108
		}
109
		if(!$bValidRequest) {
110
			throw new RuntimeException('illegal function request!'); 
111
		}
97 112
		$aRetval = array();
98 113
		$sSetupFile = dirname(dirname(__FILE__)).'/setup.ini.php';
99 114
		if(is_readable($sSetupFile)) {
......
123 138
				            . $db['host'].($db['port'] != '' ? ':'.$db['port'] : '').'/'.$db['name'];
124 139
			}
125 140
			unset($db, $aCfg);
126
			return $sRetval;
141
			return $aRetval;
127 142
		}
128 143
		throw new RuntimeException('unable to read setup.ini.php');
129 144
	}
......
176 191
// Create global database instance ---
177 192
	$database = WbDatabase::getInstance();
178 193
	if($sDbConnectType == 'dsn') {
179
		$database->doConnect($aSqlData[0], $aSqlData[1]['user'], $aSqlData[1]['pass'], $aSqlData[2]);
194
		$bTmp = $database->doConnect($aSqlData[0], $aSqlData[1]['user'], $aSqlData[1]['pass'], $aSqlData[2]);
180 195
	}else {
181
		$database->doConnect($aSqlData[0], TABLE_PREFIX);
196
		$bTmp = $database->doConnect($aSqlData[0], TABLE_PREFIX);
182 197
	}
183 198
	unset($aSqlData);
184 199
// load global settings from database and define global consts from ---
......
204 219
					$iTmp = (intval(octdec($aSetting['value'])) |0711);
205 220
					define('OCTAL_DIR_MODE', $iTmp);
206 221
					define('STRING_DIR_MODE', sprintf('0%03o', $iTmp));
222
					break;
207 223
				case 'PAGES_DIRECTORY':
208 224
					// sanitize pages_directory
209 225
					$sTmp = trim($aSetting['value'], '/');
......
211 227
					define('PAGES_DIRECTORY', $sTmp);
212 228
					break;
213 229
				default: // make global const from setting
214
					@define($aSetting['name'], $aSetting['value']);
230
					@define($sSettingName, $aSetting['value']);
215 231
					break;
216 232
			endswitch;
217 233
		}
......
303 319
										 (defined('LANGUAGE') ? LANGUAGE : '') 
304 320
										);
305 321
// *** END OF FILE ***********************************************************************
306
	
322
 

Also available in: Unified diff