Permalink
Browse files

Fixes to "error_mode" parameter in app.ini

  • Loading branch information...
tvannini committed Nov 19, 2018
1 parent 13d6616 commit 645b2f5a7c183f8218a9e400896106cfb58f7b93
Showing with 69 additions and 23 deletions.
  1. +16 −15 lib/jxapp.inc
  2. +53 −8 lib/jxcore.inc
@@ -1062,21 +1062,22 @@ class o2_app {
*/
function versione($versione = "") {
$release_type = array('ver' => 0, 'sub' => 0, 'rel' => 0);
$rnt_release = $release_type;
$app_release = $release_type;
@list($rnt_release['ver'],
$rnt_release['sub'],
$rnt_release['rel']) = explode(".", $this->runtime->release, 3);
@list($app_release['ver'],
$app_release['sub'],
$app_release['rel']) = explode(".", $versione, 3);
$rnt_release['ver'] = intval($rnt_release['ver']);
$rnt_release['sub'] = intval($rnt_release['sub']);
$rnt_release['rel'] = intval($rnt_release['rel']);
$app_release['ver'] = intval($app_release['ver']);
$app_release['sub'] = intval($app_release['sub']);
$app_release['rel'] = intval($app_release['rel']);
$release_type = array('ver' => 0, 'sub' => 0, 'rel' => 0);
$rnt_release = $release_type;
$app_release = $release_type;
list($rnt_release['ver'],
$rnt_release['sub'],
$rnt_release['rel']) = array_pad(explode(".", $this->runtime->release, 3),
3, 0);
list($app_release['ver'],
$app_release['sub'],
$app_release['rel']) = array_pad(explode(".", $versione, 3), 3, 0);
$rnt_release['ver'] = intval($rnt_release['ver']);
$rnt_release['sub'] = intval($rnt_release['sub']);
$rnt_release['rel'] = intval($rnt_release['rel']);
$app_release['ver'] = intval($app_release['ver']);
$app_release['sub'] = intval($app_release['sub']);
$app_release['rel'] = intval($app_release['rel']);
if ($rnt_release['ver'] > $app_release['ver'] ||
($rnt_release['ver'] == $app_release['ver'] &&
$rnt_release['sub'] > $app_release['sub'])) {
@@ -306,6 +306,34 @@ class o2_exception extends Exception {
}
/**
* Handler for not-exception errors like warning, deprecated, ecc...
*
* @return boolean
*/
public static function errors_handler($severity, $message, $file, $line) {
if (isset($_SESSION['o2_app']) && $_SESSION['o2_app']->error_mode == 'DEV') {
if ($severity === E_WARNING) {
(new o2_exception($message.'<br>File: '.$file.' Line: '.$line,
o2error_WARNING))->send();
}
elseif ($severity === E_DEPRECATED) {
(new o2_exception($message.'<br>File: '.$file.' Line: '.$line,
o2error_DEPRECATED))->send();
}
elseif ($severity != E_STRICT && $severity != E_NOTICE) {
(new o2_exception($message.'<br>File: '.$file.' Line: '.$line))->send();
}
else {
return false;
}
}
return true;
}
/**
* This is the public method to get private property ->code
*
@@ -899,15 +927,24 @@ class o2_fsitem {
$this->ext = (isset($parts['extension']) ? $parts['extension'] : '');
$this->nome = $parts['filename'];
$this->path = $parts['dirname'].DIRECTORY_SEPARATOR;
$timestamp_local = @filemtime($this->nome_completo);
$this->data_modifica = date("Ymd", $timestamp_local);
$this->ora_modifica = date("His", $timestamp_local);
$exists = file_exists($this->nome_completo);
if ($exists) {
$timestamp_local = @filemtime($this->nome_completo);
$this->data_modifica = date("Ymd", $timestamp_local);
$this->ora_modifica = date("His", $timestamp_local);
}
else {
$this->data_modifica = '00000000';
$this->ora_modifica = '000000';
}
if (is_dir($this->nome_completo)) {
$this->tipo = "D";
}
else {
$this->tipo = "F";
$this->dimensioni = @filesize($this->nome_completo);
$this->tipo = "F";
if ($exists) {
$this->dimensioni = @filesize($this->nome_completo);
}
}
}
@@ -964,9 +1001,15 @@ class o2_dir extends o2_fsitem {
$this->nome_completo = $dir.(substr($dir, -1) != DIRECTORY_SEPARATOR ?
DIRECTORY_SEPARATOR : "");
$this->esistenza = file_exists($this->nome_completo);
$timestamp_local = @filemtime($this->nome_completo);
$this->data_modifica = date("Ymd", $timestamp_local);
$this->ora_modifica = date("His", $timestamp_local);
if ($this->esistenza) {
$timestamp_local = @filemtime($this->nome_completo);
$this->data_modifica = date("Ymd", $timestamp_local);
$this->ora_modifica = date("His", $timestamp_local);
}
else {
$this->data_modifica = '00000000';
$this->ora_modifica = '000000';
}
}
@@ -5885,6 +5928,8 @@ class o2_runtime {
// ________________________________________________ Error constants definition ___
o2_exception::def_errors();
// ___________________________________________________ Top level error handler ___
set_error_handler(array('o2_exception', 'errors_handler'));
// _______________________________________________ Top level exception handler ___
set_exception_handler(array('o2_exception', 'autosend'));
$this->id = "jxrnt_".$this->microtime();
$this->release = $GLOBALS['jxrel'];

0 comments on commit 645b2f5

Please sign in to comment.