From ef8b3fd973fa34b303370d5acc21744e57bca507 Mon Sep 17 00:00:00 2001 From: M.Gergo Date: Mon, 17 May 2021 17:50:05 +0200 Subject: Rev: 4787 --- mayor-orig/mayor-base/www/include/base/base.php | 2 ++ mayor-orig/mayor-base/www/include/base/config.php | 1 + mayor-orig/mayor-base/www/include/base/error.php | 40 ++++++++++++++++++++++- mayor-orig/mayor-base/www/include/base/log.php | 5 +-- mayor-orig/mayor-base/www/include/base/mysql.php | 10 +++--- mayor-orig/mayor-base/www/include/base/rights.php | 3 +- mayor-orig/mayor-base/www/include/base/var.php | 3 ++ 7 files changed, 54 insertions(+), 10 deletions(-) (limited to 'mayor-orig/mayor-base/www/include/base') diff --git a/mayor-orig/mayor-base/www/include/base/base.php b/mayor-orig/mayor-base/www/include/base/base.php index 378b31fd..f2d64583 100644 --- a/mayor-orig/mayor-base/www/include/base/base.php +++ b/mayor-orig/mayor-base/www/include/base/base.php @@ -62,6 +62,8 @@ function isMobile() { $_SESSION['alert'] - figyelmeztető üzenet (tömb) - opcionális */ + if (!defined('_DEFAULT_LANG')) define('_DEFAULT_LANG','hu_HU'); + if (($__key = array_search('blue', $SKINS)) !== false) unset($SKINS[$__key]); if (($__key = array_search('pda', $SKINS)) !== false) unset($SKINS[$__key]); if ($AUTH['public']['skin'] == 'blue') $AUTH['public']['skin'] = 'classic'; diff --git a/mayor-orig/mayor-base/www/include/base/config.php b/mayor-orig/mayor-base/www/include/base/config.php index 991e249e..01755b79 100644 --- a/mayor-orig/mayor-base/www/include/base/config.php +++ b/mayor-orig/mayor-base/www/include/base/config.php @@ -24,6 +24,7 @@ if (_RUNLEVEL === 'cron') { } } +if (!defined('_ENVIRONMENT')) define('_ENVIRONMENT','production'); if (!defined('_LOGLEVEL')) define('_LOGLEVEL',10); if (!defined('__DEBUG')) define('__DEBUG',false); diff --git a/mayor-orig/mayor-base/www/include/base/error.php b/mayor-orig/mayor-base/www/include/base/error.php index e790d65a..2b817ab3 100644 --- a/mayor-orig/mayor-base/www/include/base/error.php +++ b/mayor-orig/mayor-base/www/include/base/error.php @@ -38,7 +38,45 @@ } /* Írjuk felül a gyárit */ - $old_error_handler = set_error_handler("mayorErrorHandler"); + //$old_error_handler = set_error_handler("mayorErrorHandler"); //restore_error_handler(); + +// checkcheck + +#try { +# throw new \Exception('test exception'); +#} catch (\Exception $e) { +# Rollbar::log(Level::DEBUG, $e); +#} + +use \Rollbar\Rollbar; +use \Rollbar\Payload\Level; + +if (defined('_MAYOR_REMOTE_LOGGER_ENABLED') && _MAYOR_REMOTE_LOGGER_ENABLED===true) { + + if (defined('_MAYOR_REMOTE_LOGGER_SENTRY_URL')) { + $sentryClient = new Raven_Client(_MAYOR_REMOTE_LOGGER_SENTRY_URL); + $sentryClient->release = _MAYORREV; + $sentryClient->environment = _ENVIRONMENT; + $error_handler = new Raven_ErrorHandler($sentryClient); + $error_handler->registerExceptionHandler(); + $error_handler->registerErrorHandler(); + $error_handler->registerShutdownFunction(); + } + + if (defined('_MAYOR_REMOTE_LOGGER_ROLLBAR_ACCESSTOKEN')) { + $rollbarconfig = array( + 'access_token' => _MAYOR_REMOTE_LOGGER_ROLLBAR_ACCESSTOKEN, + 'environment' => _ENVIRONMENT, + 'root' => _BASEDIR, + 'use_error_reporting' => true + ); + + Rollbar::init($rollbarconfig); + if (is_array($_SESSION['alert']) && count($_SESSION['alert'])>0) { + Rollbar::log(Level::INFO, 'mayor alert msg', array('revision'=>_MAYORREV)); + } + } +} ?> diff --git a/mayor-orig/mayor-base/www/include/base/log.php b/mayor-orig/mayor-base/www/include/base/log.php index 4ea4f4f7..0e949ac1 100644 --- a/mayor-orig/mayor-base/www/include/base/log.php +++ b/mayor-orig/mayor-base/www/include/base/log.php @@ -28,9 +28,10 @@ fputs($fp,$msg); fclose($fp); } else { - echo 'fatal error 004'; - die(); + // echo 'fatal error 004'; + // die(); } } } + ?> diff --git a/mayor-orig/mayor-base/www/include/base/mysql.php b/mayor-orig/mayor-base/www/include/base/mysql.php index e4322dc8..8e692a44 100644 --- a/mayor-orig/mayor-base/www/include/base/mysql.php +++ b/mayor-orig/mayor-base/www/include/base/mysql.php @@ -1,6 +1,6 @@ 'Write', 'fv' => $SET['fv'])); } if ($lr === false) { - if ($SET['detailed'] === true || __DETAILED) $_SESSION['alert'][] = 'message:sql_connect_failure:db_query/'.$SET['fv'].':'.$SET['modul'].':'.$q; + if ($SET['detailed'] === true || (defined('__DETAILED') && __DETAILED)) $_SESSION['alert'][] = 'message:sql_connect_failure:db_query/'.$SET['fv'].':'.$SET['modul'].':'.$q; else $_SESSION['alert'][] = 'message:sql_connect_failure:db_query/'.$SET['fv']; return false; } @@ -189,7 +189,7 @@ } } if ( - ($SET['detailed'] === true || __DETAILED) + ($SET['detailed'] === true || (defined('__DETAILED') && __DETAILED)) && strpos($q_pattern, '%s') !== false && (strpos($q_pattern, '`%s`') === false && strpos($q_pattern, "'%s'") === false) ) $_SESSION['alert'][] = 'message:lehet hiba?:db_query/'.$SET['fv'].':'.$SET['modul'].':'.$q_pattern; @@ -204,7 +204,7 @@ $_insert_id = mysql_insert_id($lr); $_affected_rows = mysql_affected_rows($lr); } - define(MYSQL_LOGGER,false); + define('MYSQL_LOGGER',false); if (MYSQL_LOGGER === true) { $filename = '/tmp/mysql.log'; $fp = fopen($filename, "a+"); @@ -241,7 +241,7 @@ /* WARNING HANDLER */ if (!$r) { // if ($SET['detailed'] === true || __DETAILED) $_SESSION['alert'][] = 'message:sql_query_failure:'.$SET['fv'].':'.':'.$q; - if ($SET['detailed'] === true || __DETAILED) { + if ($SET['detailed'] === true || (defined('__DETAILED') && __DETAILED)) { if (MYSQLI_ENABLED===true) { $_SESSION['alert'][] = 'message:sql_query_failure:mysqli:'.$SET['fv'].':'.mysqli_error($lr).':'.$q; } else { diff --git a/mayor-orig/mayor-base/www/include/base/rights.php b/mayor-orig/mayor-base/www/include/base/rights.php index c30a927d..1fe87148 100644 --- a/mayor-orig/mayor-base/www/include/base/rights.php +++ b/mayor-orig/mayor-base/www/include/base/rights.php @@ -383,7 +383,7 @@ function validUser($sessionID,$policy,$skin='',$lang='') { } // --------- //Breadcrumb - if (count($_SESSION['breadcrumb'])>10) array_shift($_SESSION['breadcrumb']); + if (is_array($_SESSION['breadcrumb']) && count($_SESSION['breadcrumb'])>10) array_shift($_SESSION['breadcrumb']); $_SESSION['breadcrumb'][] = array('page'=>"$page",'sub'=>"$sub",'f'=>"$f"); // --------- if (file_exists($includeFile)) require($includeFile); @@ -396,5 +396,4 @@ function validUser($sessionID,$policy,$skin='',$lang='') { $_DEBUG = ob_get_contents(); ob_end_clean(); - ?> \ No newline at end of file diff --git a/mayor-orig/mayor-base/www/include/base/var.php b/mayor-orig/mayor-base/www/include/base/var.php index fda47dd2..98d4908a 100644 --- a/mayor-orig/mayor-base/www/include/base/var.php +++ b/mayor-orig/mayor-base/www/include/base/var.php @@ -75,6 +75,9 @@ case 'email': $return = filter_var($IN, FILTER_VALIDATE_EMAIL); break; + case 'url': + $return = filter_var($IN, FILTER_VALIDATE_URL); + break; case 'userAccount': $return = (preg_match("#([a-z]|[A-Z]|[0-9]| |\.|,|_|[űáäéúőóüöíŰÁÄÉÚŐÓÜÖÍäÄ]|-|@)*$#", $IN) != false) ? $IN : $default; break; -- cgit v1.2.3