mirror of
https://github.com/maxpozdeev/mytinytodo.git
synced 2026-03-11 08:55:27 +00:00
* rename die2() to logAndDie()
This commit is contained in:
parent
866c34e2e0
commit
61bdead019
5 changed files with 13 additions and 13 deletions
|
|
@ -809,12 +809,12 @@ function myExceptionHandler($e)
|
|||
{
|
||||
if(-1 == $e->getCode()) {
|
||||
//thrown in myErrorHandler
|
||||
die2($e->getMessage()."\n". $e->getTraceAsString(), $e->getMessage());
|
||||
logAndDie($e->getMessage()."\n". $e->getTraceAsString(), $e->getMessage());
|
||||
}
|
||||
die2('Exception: \''. $e->getMessage() .'\' in '. $e->getFile() .':'. $e->getLine());
|
||||
logAndDie('Exception: \''. $e->getMessage() .'\' in '. $e->getFile() .':'. $e->getLine());
|
||||
}
|
||||
catch(Exception $e) {
|
||||
die2('Exception in ExceptionHandler: \''. $e->getMessage() .'\' in '. $e->getFile() .':'. $e->getLine());
|
||||
logAndDie('Exception in ExceptionHandler: \''. $e->getMessage() .'\' in '. $e->getFile() .':'. $e->getLine());
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class Lang
|
|||
$lang->loadDefaultStrings();
|
||||
}
|
||||
else if ( $die == 1 ) {
|
||||
die("Language file not found ($code.json)");
|
||||
die("Language file not found (". htmlspecialchars($code). ".json)");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -68,7 +68,7 @@ class Lang
|
|||
function loadDefaultStrings()
|
||||
{
|
||||
if ( ! self::langExists($this->default) ) {
|
||||
die("Default language file not found ({$this->default}.json)");
|
||||
die("Default language file not found (". htmlspecialchars($this->default). ".json)");
|
||||
}
|
||||
$defStr = file_get_contents($this->langDir(). "{$this->default}.json");
|
||||
$this->strings = json_decode($defStr, true);
|
||||
|
|
|
|||
|
|
@ -2297,8 +2297,8 @@ function hideList(listId)
|
|||
function flashError(str, details)
|
||||
{
|
||||
if (details === undefined) details = '';
|
||||
$("#msg>.msg-text").text(str)
|
||||
$("#msg>.msg-details").text(details);
|
||||
$("#msg>.msg-text").text(dehtml(str))
|
||||
$("#msg>.msg-details").text(dehtml(details));
|
||||
$("#loading").hide();
|
||||
$("#msg").addClass('mtt-error').effect("highlight", {color:_mtt.theme.msgFlashColor}, 700);
|
||||
}
|
||||
|
|
@ -2306,8 +2306,8 @@ function flashError(str, details)
|
|||
function flashInfo(str, details)
|
||||
{
|
||||
if (details === undefined) details = '';
|
||||
$("#msg>.msg-text").text(str)
|
||||
$("#msg>.msg-details").text(details);
|
||||
$("#msg>.msg-text").text(dehtml(str))
|
||||
$("#msg>.msg-details").text(dehtml(details));
|
||||
$("#loading").hide();
|
||||
$("#msg").addClass('mtt-info').effect("highlight", {color:_mtt.theme.msgFlashColor}, 700);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ if(Config::get('db') == 'mysql')
|
|||
$db->connect(Config::get('mysql.host'), Config::get('mysql.user'), Config::get('mysql.password'), Config::get('mysql.db'));
|
||||
}
|
||||
catch(Exception $e) {
|
||||
die2("Failed to connect to mysql database: ". $e->getMessage());
|
||||
logAndDie("Failed to connect to mysql database: ". $e->getMessage());
|
||||
}
|
||||
$db->dq("SET NAMES utf8");
|
||||
}
|
||||
|
|
@ -253,10 +253,10 @@ function jsonExit($data)
|
|||
exit;
|
||||
}
|
||||
|
||||
function die2($userText, $errText = null)
|
||||
function logAndDie($userText, $errText = null)
|
||||
{
|
||||
$errText === null ? error_log($userText) : error_log($errText);
|
||||
echo $userText;
|
||||
echo htmlspecialchars($userText);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -260,7 +260,7 @@ class DefaultLang
|
|||
function loadLangHeader($langFile)
|
||||
{
|
||||
if (!file_exists($langFile)) {
|
||||
die("file does not exist: $langFile");
|
||||
die("file does not exist: ". htmlspecialchars($langFile));
|
||||
}
|
||||
$contents = file_get_contents($langFile);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue