Readied error pages for variable themes.

Fixed error in parsing pseudocode.
This commit is contained in:
2018-06-21 13:25:38 +02:00
committed by Stefan Rohde-Enslin
parent b340c7efff
commit 4e06d0bae7
18 changed files with 84 additions and 81 deletions

View File

@ -30,11 +30,11 @@ loadHttpToGlobals(["id", "task", "content"]);
define("targetFile", __DIR__ . "/../data/$id.htm");
if (!isset($id) or !in_array($id, ['footer', 'aside', 'banner', 'welcomeMsg'])) {
echo printErrorPage($translations['specifyToEdit']); return;
echo printErrorPage($settings, $translations['specifyToEdit']); return;
}
if ($id == 'welcomeMsg' and !$_SESSION['admin']) {
echo printErrorPage($translations['accessDenied']); return;
echo printErrorPage($settings, $translations['accessDenied']); return;
}
// Read file contents if there is no new content sent by $_POST.

View File

@ -81,17 +81,17 @@ else if ($task == "upload") {
// Whitelist of allowed types.
if (!in_array($_FILES['file']['type'], $allowedFiletypes)) {
printErrorPage($translations['filetypeNotWhitelisted']);
echo printErrorPage($settings, $translations['filetypeNotWhitelisted']);
return;
}
if (filesize($_FILES['file']['tmp_name']) > 300000) {
printErrorPage($translations['fileTooLarge']);
if (filesize($_FILES['file']['tmp_name']) > $settings['maxFileSize']) {
echo printErrorPage($settings, $translations['fileTooLarge']);
return;
}
if (!(move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile))) {
printErrorPage($translations['fileUploadError']);
echo printErrorPage($settings, $translations['fileUploadError']);
return;
}
@ -106,7 +106,7 @@ else if ($task == "upload") {
else if ($task == "delete") {
if (!is_file(fileDir . "/$subject")) {
printErrorPage($translations['fileDoesNotExist']); return;
echo printErrorPage($settings, $translations['fileDoesNotExist']); return;
}
unlink(fileDir . "/$subject");

View File

@ -214,11 +214,6 @@ document.addEventListener("DOMContentLoaded", function() {
uploadLabel.textContent = getTranslation(translations, "uploadFile");
uploadLabel.for = "fileUploadInput";
let uploadSize = document.createElement("input");
uploadSize.type = "hidden";
uploadSize.name = "MAX_FILE_SIZE";
uploadSize.value = "300000";
let uploadBackTo = document.createElement("input");
uploadBackTo.type = "hidden";
uploadBackTo.name = "backTo";
@ -233,13 +228,13 @@ document.addEventListener("DOMContentLoaded", function() {
uploadInput.type = "file";
uploadInput.id = "fileUploadInput";
uploadInput.name = "file";
uploadInput.value = "";
let uploadButton = document.createElement("button");
uploadButton.type = "submit";
uploadButton.textContent = getTranslation(translations, "submit");
uploadForm.appendChild(uploadLabel);
uploadForm.appendChild(uploadSize);
uploadForm.appendChild(uploadTask);
uploadForm.appendChild(uploadBackTo);
uploadForm.appendChild(uploadInput);

View File

@ -62,7 +62,7 @@ if (isset($task)) {
else if ($task == "delete") {
if (!isset($id)) {
echo printErrorPage($translations['specifyToDelete']); return;
echo printErrorPage($settings, $translations['specifyToDelete']); return;
}
unlink(__DIR__ . "/../data/static/$id.json");

View File

@ -17,7 +17,7 @@ ensureBackendEnv(); // Ensure session is sta
$pages = loadPages(); // Load overview of pages.
if (!$_SESSION['admin']) {
echo printErrorPage($translations['accessDenied']); return;
echo printErrorPage($settings, $translations['accessDenied']); return;
}
/*

View File

@ -126,4 +126,5 @@ $translations['deletedFile'] = 'Datei wurde gelöscht';
$translations['uploadedFile'] = 'Datei wurde heraufgeladen';
$translations['fileUploadError'] = 'Ein Fehler ist aufgetreten';
$translations['filetypeNotWhitelisted'] = 'Dateityp ist nicht erlaubt';
$translations['fileTooLarge'] = 'Die Datei ist zu groß';
?>

View File

@ -126,4 +126,5 @@ $translations['deletedFile'] = 'Deleted file';
$translations['uploadedFile'] = 'Uploaded file';
$translations['fileUploadError'] = 'Error uploading file';
$translations['filetypeNotWhitelisted'] = 'Filetype is not in whitelist';
$translations['fileTooLarge'] = 'The file is too large.';
?>

View File

@ -17,7 +17,7 @@ ensureBackendEnv(); // Ensure session is sta
$pages = loadPages(); // Load overview of pages.
if (!$_SESSION['admin']) {
echo printErrorPage($translations['accessDenied']); return;
echo printErrorPage($settings, $translations['accessDenied']); return;
}
/*