* rename die2() to logAndDie()

(cherry picked from commit 61bdead019)
This commit is contained in:
Max Pozdeev 2021-09-20 13:42:30 +03:00
parent d67571fcb3
commit 37f83a9ce7
4 changed files with 8 additions and 8 deletions

View file

@ -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);

View file

@ -2359,8 +2359,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);
}
@ -2368,8 +2368,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);
}

View file

@ -261,7 +261,7 @@ function logAndDie($userText, $errText = null)
{
$errText === null ? error_log($userText) : error_log($errText);
if (ini_get('display_errors')) {
echo $userText;
echo htmlspecialchars($userText);
}
else {
echo "Error! See details in error log.";

View file

@ -257,7 +257,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);