207 |
207 |
|
208 |
208 |
function WbErrorHandler($iErrorCode, $sErrorText, $sErrorFile, $iErrorLine)
|
209 |
209 |
{
|
210 |
|
if (!(error_reporting() & $iErrorCode) || ini_get('log_errors') == 0) {
|
211 |
|
return false;
|
212 |
|
}
|
213 |
210 |
$bRetval = false;
|
214 |
|
$sErrorLogFile = ini_get ('error_log');
|
215 |
|
if (!is_writeable($sErrorLogFile)){return false;}
|
216 |
|
$sErrorType = E_NOTICE ;
|
217 |
|
$aErrors = array(
|
218 |
|
E_USER_DEPRECATED => 'E_USER_DEPRECATED',
|
219 |
|
E_USER_NOTICE => 'E_USER_NOTICE',
|
220 |
|
E_USER_WARNING => 'E_USER_WARNING',
|
221 |
|
E_DEPRECATED => 'E_DEPRECATED',
|
222 |
|
E_NOTICE => 'E_NOTICE',
|
223 |
|
E_WARNING => 'E_WARNING',
|
224 |
|
E_CORE_WARNING => 'E_CORE_WARNING',
|
225 |
|
E_COMPILE_WARNING => 'E_COMPILE_WARNING',
|
226 |
|
E_STRICT => 'E_STRICT',
|
227 |
|
E_RECOVERABLE_ERROR => 'E_RECOVERABLE_ERROR',
|
228 |
|
);
|
229 |
|
if (array_key_exists($iErrorCode, $aErrors)) {
|
230 |
|
$sErrorType = $aErrors[$iErrorCode];
|
231 |
|
$bRetval = true;
|
|
211 |
if ((error_reporting() & $iErrorCode) || ini_get('log_errors') != 0) {
|
|
212 |
$sErrorLogFile = ini_get ('error_log');
|
|
213 |
if (is_writeable($sErrorLogFile)) {
|
|
214 |
$sErrorType = E_NOTICE ;
|
|
215 |
$aErrors = [
|
|
216 |
E_USER_DEPRECATED => 'E_USER_DEPRECATED',
|
|
217 |
E_USER_NOTICE => 'E_USER_NOTICE',
|
|
218 |
E_USER_WARNING => 'E_USER_WARNING',
|
|
219 |
E_DEPRECATED => 'E_DEPRECATED',
|
|
220 |
E_NOTICE => 'E_NOTICE',
|
|
221 |
E_WARNING => 'E_WARNING',
|
|
222 |
E_CORE_WARNING => 'E_CORE_WARNING',
|
|
223 |
E_COMPILE_WARNING => 'E_COMPILE_WARNING',
|
|
224 |
E_STRICT => 'E_STRICT',
|
|
225 |
E_RECOVERABLE_ERROR => 'E_RECOVERABLE_ERROR',
|
|
226 |
];
|
|
227 |
if (array_key_exists($iErrorCode, $aErrors)) {
|
|
228 |
$sErrorType = $aErrors[$iErrorCode];
|
|
229 |
$bRetval = true;
|
|
230 |
}
|
|
231 |
$aBt= debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
|
|
232 |
$x = sizeof($aBt) -1;
|
|
233 |
$iSize = $x < 0 ? 0 : ($x <= 2 ? $x : 2);
|
|
234 |
$sEntry = date('c').' '.'['.$sErrorType.'] '.str_replace(dirname(__DIR__), '', $sErrorFile).':['.$iErrorLine.'] '
|
|
235 |
. ' from '.str_replace(dirname(__DIR__), '', $aBt[$iSize]['file']).':['.$aBt[$iSize]['line'].'] '
|
|
236 |
. (isset($aBt[$iSize]['class']) ? $aBt[$iSize]['class'].$aBt[$iSize]['type'] : '').$aBt[$iSize]['function'].' '
|
|
237 |
. '"'.$sErrorText.'"'.PHP_EOL;
|
|
238 |
file_put_contents($sErrorLogFile, $sEntry, FILE_APPEND);
|
|
239 |
}
|
232 |
240 |
}
|
233 |
|
$aBt= debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
|
234 |
|
$x = sizeof($aBt) -1;
|
235 |
|
$iSize = $x < 0 ? 0 : ($x <= 2 ? $x : 2);
|
236 |
|
$sEntry = date('c').' '.'['.$sErrorType.'] '.str_replace(dirname(__DIR__), '', $sErrorFile).':['.$iErrorLine.'] '
|
237 |
|
. ' from '.str_replace(dirname(__DIR__), '', $aBt[$iSize]['file']).':['.$aBt[$iSize]['line'].'] '
|
238 |
|
. (isset($aBt[$iSize]['class']) ? $aBt[$iSize]['class'].$aBt[$iSize]['type'] : '').$aBt[$iSize]['function'].' '
|
239 |
|
. '"'.$sErrorText.'"'.PHP_EOL;
|
240 |
|
file_put_contents($sErrorLogFile, $sEntry, FILE_APPEND);
|
241 |
241 |
return $bRetval;
|
242 |
242 |
}
|
243 |
243 |
/**
|
... | ... | |
279 |
279 |
include __DIR__.'/CoreAutoloader.php';
|
280 |
280 |
}
|
281 |
281 |
\bin\CoreAutoloader::doRegister(dirname(__DIR__));
|
282 |
|
\bin\CoreAutoloader::addNamespace([ // add several needed namespaces
|
|
282 |
\bin\CoreAutoloader::addNamespace([ // add several needed namespaces->folder translations
|
283 |
283 |
// Namespace Directory
|
284 |
|
'bin' => 'framework',
|
285 |
|
'addon' => 'modules',
|
286 |
|
'vendor' => 'include',
|
287 |
|
'vendor\\jscalendar' => 'include/jscalendar',
|
288 |
|
'bin\\db' => 'framework/db',
|
289 |
|
'bin\\security' => 'framework',
|
290 |
|
'bin\\interfaces' => 'framework',
|
291 |
|
'api' => 'framework/api',
|
|
284 |
'bin' => 'framework',
|
|
285 |
'addon' => 'modules',
|
|
286 |
'vendor' => 'include',
|
|
287 |
'vendor\\jscalendar' => 'include/jscalendar',
|
|
288 |
'bin\\db' => 'framework/db',
|
|
289 |
'bin\\requester' => 'framework',
|
|
290 |
'bin\\requester\\filter' => 'framework',
|
|
291 |
'bin\\security' => 'framework',
|
|
292 |
'bin\\interfaces' => 'framework',
|
|
293 |
'api' => 'framework/api',
|
292 |
294 |
]);
|
293 |
295 |
|
294 |
296 |
// *** initialize Exception handling
|
... | ... | |
319 |
321 |
$aCfg = initReadSetupFile();
|
320 |
322 |
initSetInstallWbConstants($aCfg);
|
321 |
323 |
// activate requester --------------------------------------------------------------------
|
322 |
|
$oRequest = \bin\HttpRequester();
|
|
324 |
$oRequest = new \bin\requester\HttpRequester();
|
323 |
325 |
// ---------------------------
|
324 |
326 |
// get Database connection data from configuration
|
325 |
327 |
defined('ADMIN_DIRECTORY') ? '' : define('ADMIN_DIRECTORY', 'admin');
|
... | ... | |
437 |
439 |
$sLang = strtoupper($aMatches[1]);
|
438 |
440 |
define('LANGUAGE', $slang);
|
439 |
441 |
$_SESSION['LANGUAGE'] = $sLang;
|
|
442 |
// // strtoupper() is deprecated and for backward compatibility only!
|
|
443 |
// $sLang = strtoupper($oRequest->getParam('lang', FILTER_CALLBACK, [
|
|
444 |
// new \bin\requester\filter\CoreFilters(['default'=>'en', 'seperator'=>'-']),
|
|
445 |
// 'FILTER_LANGUAGE_CODE'
|
|
446 |
// ]));
|
|
447 |
// define('LANGUAGE', $slang);
|
|
448 |
// $_SESSION['LANGUAGE'] = $sLang;
|
440 |
449 |
}
|
441 |
450 |
$sCachePath = dirname(__DIR__).'/temp/cache/';
|
442 |
451 |
if (!file_exists($sCachePath)) {
|
little fix in HttpRequester::__construct()