Changed die() to trigger_error()
E_USER_ERROR will always be displayed. Changed die() to trigger_error(error, E_USER_ERROR).pull/612/merge
parent
a96e1e5a2e
commit
3023c83226
|
@ -50,13 +50,11 @@ if(file_exists($path_conf)) {
|
|||
if(!defined('PSM_DEBUG')) {
|
||||
define('PSM_DEBUG', false);
|
||||
}
|
||||
if(PSM_DEBUG) {
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', 1);
|
||||
} else {
|
||||
error_reporting(0);
|
||||
ini_set('display_errors', 0);
|
||||
}
|
||||
|
||||
// Debug enabled: report everything
|
||||
// Debug disabled: report error only if created manually
|
||||
ini_set('display_errors', 1);
|
||||
PSM_DEBUG ? error_reporting(E_ALL) : error_reporting(E_USER_ERROR);
|
||||
|
||||
// check for a cron allowed ip array
|
||||
if(!defined('PSM_CRON_ALLOW')) {
|
||||
|
@ -66,7 +64,7 @@ if(!defined('PSM_CRON_ALLOW')) {
|
|||
|
||||
$vendor_autoload = PSM_PATH_SRC . '..' . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
|
||||
if(!file_exists($vendor_autoload)) {
|
||||
die('No dependencies found in vendor dir. Did you install the dependencies? Please run "php composer.phar install".');
|
||||
trigger_error("No dependencies found in vendor dir. Did you install the dependencies? Please run \"php composer.phar install\".", E_USER_ERROR);
|
||||
}
|
||||
require_once $vendor_autoload;
|
||||
|
||||
|
@ -79,22 +77,22 @@ if(!defined('PSM_INSTALL') || !PSM_INSTALL) {
|
|||
if($db->getDbHost() === null) {
|
||||
// no config file has been loaded, redirect the user to the install
|
||||
header('Location: install.php');
|
||||
die();
|
||||
trigger_error("Could not load config file. Redirect to install failed, <a href=\"install.php\">click here</a>.", E_USER_ERROR);
|
||||
}
|
||||
// config file has been loaded, check if we have a connection
|
||||
if(!$db->status()) {
|
||||
die('Unable to establish database connection...');
|
||||
trigger_error("Unable to establish database connection...", E_USER_ERROR);
|
||||
}
|
||||
// attempt to load configuration from database
|
||||
if(!psm_load_conf()) {
|
||||
// unable to load from config table
|
||||
header('Location: install.php');
|
||||
die();
|
||||
trigger_error("Could not load config table. Redirect to install failed, <a href=\"install.php\">click here</a>.", E_USER_ERROR);
|
||||
}
|
||||
// config load OK, make sure database version is up to date
|
||||
$installer = new \psm\Util\Install\Installer($db);
|
||||
if($installer->isUpgradeRequired()) {
|
||||
die('Your database is for an older version and requires an upgrade, <a href="install.php">please click here</a> to update your database to the latest version.');
|
||||
trigger_error("Your database is for an older version and requires an upgrade, <a href=\"install.php\">please click here</a> to update your database to the latest version.", E_USER_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -76,8 +76,8 @@ function psm_load_lang($lang) {
|
|||
// this will also fill in every part that is not translated in other translation files
|
||||
$default_lang_file = PSM_PATH_LANG . 'en_US.lang.php';
|
||||
|
||||
file_exists($default_lang_file) ? require $default_lang_file : die('English translation needs to be intalled at all time!');
|
||||
isset($sm_lang) ? $GLOBALS['sm_lang_default'] = $sm_lang : die('$sm_lang not found in English translation!');
|
||||
file_exists($default_lang_file) ? require $default_lang_file : trigger_error("English translation needs to be intalled at all time!", E_USER_ERROR);
|
||||
isset($sm_lang) ? $GLOBALS['sm_lang_default'] = $sm_lang : trigger_error("\$sm_lang not found in English translation!", E_USER_ERROR);
|
||||
unset($sm_lang);
|
||||
|
||||
// load translation is the selected language is not English (en_US)
|
||||
|
|
|
@ -206,7 +206,7 @@ class ConfigController extends AbstractController {
|
|||
|
||||
if($language_refresh) {
|
||||
header('Location: ' . psm_build_url(array('mod' => 'config'), true, false));
|
||||
die();
|
||||
trigger_error("Redirect failed.", E_USER_ERROR);
|
||||
}
|
||||
|
||||
if(isset($_POST['general_submit'])) {
|
||||
|
|
|
@ -46,7 +46,7 @@ class UpdateController extends AbstractController {
|
|||
header('Location: ' . psm_build_url(array(
|
||||
'mod' => 'server_status'
|
||||
), true, false));
|
||||
die();
|
||||
trigger_error("Redirect failed.", E_USER_ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ class LoginController extends AbstractController {
|
|||
if($result) {
|
||||
// success login, redirect
|
||||
header('Location: ' . psm_build_url($_SERVER['QUERY_STRING']));
|
||||
die();
|
||||
trigger_error("Redirect failed.", E_USER_ERROR);
|
||||
} else {
|
||||
$this->addMessage(psm_get_lang('login', 'error_login_incorrect'), 'error');
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue