Project

General

Profile

« Previous | Next » 

Revision 1873

Added by darkviper over 11 years ago

some small fixes in packet Translate
added option to disable cache
added option to keep placeholders if no translation was found

View differences:

initialize.php
154 154
// define constant systemenvironment settings ---
155 155
	date_default_timezone_set('UTC');
156 156
	if(!defined('MAX_TIME')) { define('MAX_TIME', (pow(2, 31)-1)); } // 32-Bit Timestamp of 19 Jan 2038 03:14:07 GMT
157
	if(!defined('DO_NOT_TRACK')) { define('DO_NOT_TRACK', (isset($_SERVER['HTTP_DNT']))); }
157
	$sTmp = (isset($_SERVER['HTTP_DNT']) && $_SERVER['HTTP_DNT'] != '') ? $_SERVER['HTTP_DNT'] : '0';
158
	if(!defined('DO_NOT_TRACK')) { define('DO_NOT_TRACK', ($sTmp[0] == '1')); }
158 159
// register WB basic autoloader ---
159 160
	$sTmp = dirname(__FILE__).'/WbAutoloader.php';
160
	if(!class_exists('WbAutoloader', false)){ include($sTmp); }
161
	if(!class_exists('WbAutoloader')){ 
162
		include($sTmp);
163
	}
161 164
	WbAutoloader::doRegister(array(ADMIN_DIRECTORY=>'a', 'modules'=>'m'));
162 165
// register TWIG autoloader ---
163 166
	$sTmp = dirname(dirname(__FILE__)).'/include/Sensio/Twig/lib/Twig/Autoloader.php';
164
	if(!class_exists('Twig_Autoloader', false)){ include($sTmp); }
167
	if(!class_exists('Twig_Autoloader')) { 
168
		include($sTmp); 
169
	}
165 170
	Twig_Autoloader::register();
166 171
// aktivate exceptionhandler ---
167 172
	if(!function_exists('globalExceptionHandler')) {
......
188 193
									 ? false 
189 194
									 : $aSetting['value'])
190 195
								 );
191
			$aSetting['name'] = strtoupper($aSetting['name']);
192
			if($aSetting['name'] == 'STRING_FILE_MODE') {
193
				$iTmp = ((intval(octdec($aSetting['value'])) & ~0111)|0600);
194
				define('OCTAL_FILE_MODE', $iTmp);
195
				define('STRING_FILE_MODE', sprintf('0%03o', $iTmp));
196
			}elseif($aSetting['name'] == 'STRING_DIR_MODE') {
197
				$iTmp = (intval(octdec($aSetting['value'])) |0711);
198
				define('OCTAL_DIR_MODE', $iTmp);
199
				define('STRING_DIR_MODE', sprintf('0%03o', $iTmp));
200
			}else {
201
			// make global const from setting
202
				@define($aSetting['name'], $aSetting['value']);
203
			}
196
			$sSettingName = strtoupper($aSetting['name']);
197
			switch($sSettingName):
198
				case 'STRING_FILE_MODE':
199
					$iTmp = ((intval(octdec($aSetting['value'])) & ~0111)|0600);
200
					define('OCTAL_FILE_MODE', $iTmp);
201
					define('STRING_FILE_MODE', sprintf('0%03o', $iTmp));
202
					break;
203
				case 'STRING_DIR_MODE':
204
					$iTmp = (intval(octdec($aSetting['value'])) |0711);
205
					define('OCTAL_DIR_MODE', $iTmp);
206
					define('STRING_DIR_MODE', sprintf('0%03o', $iTmp));
207
				case 'PAGES_DIRECTORY':
208
					// sanitize pages_directory
209
					$sTmp = trim($aSetting['value'], '/');
210
					$sTmp = ($sTmp == '' ? '' : '/'.$sTmp);
211
					define('PAGES_DIRECTORY', $sTmp);
212
					break;
213
				default: // make global const from setting
214
					@define($aSetting['name'], $aSetting['value']);
215
					break;
216
			endswitch;
204 217
		}
205 218
	}else { throw new AppException($database->get_error()); }
206 219
// set error-reporting from loaded settings ---
......
286 299
	}
287 300
// load and activate new global translation table
288 301
	Translate::getInstance()->initialize('en',
289
	                                     (defined('DEFAULT_LANGUAGE') ? DEFAULT_LANGUAGE : ''), 
290
	                                     (defined('LANGUAGE') ? LANGUAGE : ''), 
291
	                                     'WbOldStyle',
292
	                                     Translate::CACHE_ENABLED);
302
										 (defined('DEFAULT_LANGUAGE') ? DEFAULT_LANGUAGE : ''), 
303
										 (defined('LANGUAGE') ? LANGUAGE : '') 
304
										);
293 305
// *** END OF FILE ***********************************************************************
294 306
	

Also available in: Unified diff