Fixed (file) comments.
This commit is contained in:
parent
32345e9629
commit
e3254eaaf7
|
@ -1,6 +1,7 @@
|
||||||
<?PHP
|
<?PHP
|
||||||
/**
|
/**
|
||||||
* The main display file for standalone pages.
|
* This file directly mirrors data from the MD api.
|
||||||
|
* In some cases, links are rewritten, to allow navigation on site.
|
||||||
*
|
*
|
||||||
* @author Joshua Ramon Enslin <joshua@jrenslin.de>
|
* @author Joshua Ramon Enslin <joshua@jrenslin.de>
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<?PHP
|
<?PHP
|
||||||
/**
|
/**
|
||||||
* This file displays object detail pages as fetched from museum-digital.
|
* This script offers detail pages for collections
|
||||||
|
* based on data fetched from museum-digital.
|
||||||
*
|
*
|
||||||
* @author Joshua Ramon Enslin <joshua@jrenslin.de>
|
* @author Joshua Ramon Enslin <joshua@jrenslin.de>
|
||||||
*/
|
*/
|
||||||
|
@ -21,6 +22,8 @@ if (!isset($_GET['id']) or !is_numeric($_GET['id'])) {
|
||||||
ensureEnvironment();
|
ensureEnvironment();
|
||||||
$pages = loadPublicPages(); // Load overview of pages.
|
$pages = loadPublicPages(); // Load overview of pages.
|
||||||
|
|
||||||
|
// Load data
|
||||||
|
|
||||||
$contents = json_decode(queryCachePage($settings['mdVersion'] . "?t=sammlung&gesusa=" . urlencode($_GET['id']) . "&output=json", "institution", $settings), true);
|
$contents = json_decode(queryCachePage($settings['mdVersion'] . "?t=sammlung&gesusa=" . urlencode($_GET['id']) . "&output=json", "institution", $settings), true);
|
||||||
|
|
||||||
if (!$contents || (isset($contents[0]) and $contents[0] == "There is no collection with this ID yet.")) {
|
if (!$contents || (isset($contents[0]) and $contents[0] == "There is no collection with this ID yet.")) {
|
||||||
|
|
|
@ -1,6 +1,12 @@
|
||||||
<?PHP
|
<?PHP
|
||||||
/**
|
/**
|
||||||
* This page offers the opportunity to edit static page elements: the side bar and the footer.
|
* This page offers the opportunity to edit static page elements:
|
||||||
|
* - the side bar,
|
||||||
|
* - the footer,
|
||||||
|
* - the banner,
|
||||||
|
* - the welcome message for the backend.
|
||||||
|
*
|
||||||
|
* @author Joshua Ramon Enslin <joshua@jrenslin.de>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
<?PHP
|
<?PHP
|
||||||
/**
|
/**
|
||||||
* Start page of the backend.
|
* Start page of the backend.
|
||||||
* Offers a dashboard.
|
* Offers the welcome message (if there is one),
|
||||||
|
* a description of the CMS and some basic data
|
||||||
|
* on the contents of the current page.
|
||||||
*
|
*
|
||||||
* @author Joshua Ramon Enslin <joshua@jrenslin.de>
|
* @author Joshua Ramon Enslin <joshua@jrenslin.de>
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
<?PHP
|
<?PHP
|
||||||
/**
|
/**
|
||||||
* This page offers the opportunity to edit static pages.
|
* This page offers the opportunity to edit static pages.
|
||||||
|
*
|
||||||
|
* @author Joshua Ramon Enslin <joshua@jrenslin.de>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
<?PHP
|
<?PHP
|
||||||
/**
|
/**
|
||||||
* Start page of the backend.
|
* Overview page for all pages.
|
||||||
* Offers a dashboard.
|
|
||||||
*
|
*
|
||||||
* @author Joshua Ramon Enslin <joshua@jrenslin.de>
|
* @author Joshua Ramon Enslin <joshua@jrenslin.de>
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?PHP
|
<?PHP
|
||||||
/**
|
/**
|
||||||
* Login script
|
* Login script.
|
||||||
*
|
*
|
||||||
* @author Joshua Ramon Enslin <joshua@jrenslin.de>
|
* @author Joshua Ramon Enslin <joshua@jrenslin.de>
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
<?PHP
|
<?PHP
|
||||||
/**
|
/**
|
||||||
* Start page of the backend.
|
* Settings page.
|
||||||
* Offers a dashboard.
|
|
||||||
*
|
*
|
||||||
* @author Joshua Ramon Enslin <joshua@jrenslin.de>
|
* @author Joshua Ramon Enslin <joshua@jrenslin.de>
|
||||||
*/
|
*/
|
||||||
|
@ -28,7 +27,11 @@ if (!$_SESSION['admin']) {
|
||||||
// Check for vars.
|
// Check for vars.
|
||||||
loadHttpToGlobals(["task", "startPage", "pageTitle", "logo", "url", "css", "hideInstitution", "mdVersion", "mdImgFolder", "cacheRefreshInterval", "limitToInstitutions", "maxFileSize", "sendHTTPHeaders", "CSPimageSources", "CSPobjectSources", "defaultLang"]);
|
loadHttpToGlobals(["task", "startPage", "pageTitle", "logo", "url", "css", "hideInstitution", "mdVersion", "mdImgFolder", "cacheRefreshInterval", "limitToInstitutions", "maxFileSize", "sendHTTPHeaders", "CSPimageSources", "CSPobjectSources", "defaultLang"]);
|
||||||
|
|
||||||
if (isset($task) and $task == "update") { // Adding new users.
|
/**
|
||||||
|
* Part for editing settings.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (isset($task) and $task == "update") {
|
||||||
|
|
||||||
if (isset($defaultLang) and !in_array("$defaultLang.php", scanDirConts(__DIR__ . "/translations"))) {
|
if (isset($defaultLang) and !in_array("$defaultLang.php", scanDirConts(__DIR__ . "/translations"))) {
|
||||||
$_SESSION["editHistory"] = ["changesAborted", $translations['languageUnavailable']];
|
$_SESSION["editHistory"] = ["changesAborted", $translations['languageUnavailable']];
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
<?PHP
|
<?PHP
|
||||||
/**
|
/**
|
||||||
* Start page of the backend.
|
* This script lists all users and offers the option to add new ones.
|
||||||
* Offers a dashboard.
|
|
||||||
*
|
*
|
||||||
* @author Joshua Ramon Enslin <joshua@jrenslin.de>
|
* @author Joshua Ramon Enslin <joshua@jrenslin.de>
|
||||||
*/
|
*/
|
||||||
|
@ -32,7 +31,10 @@ if (!isset($users)) {
|
||||||
$users = json_decode(file_get_contents(__DIR__ . "/../data/users.json"), true);
|
$users = json_decode(file_get_contents(__DIR__ . "/../data/users.json"), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($task) and $task == "insert") { // Adding new users.
|
/**
|
||||||
|
* Adding new users.
|
||||||
|
*/
|
||||||
|
if (isset($task) and $task == "insert") {
|
||||||
|
|
||||||
$redirectURL = "./users.php?" . write_common_vars(["username", "realName", "email", "admin"]) . "#addUser";
|
$redirectURL = "./users.php?" . write_common_vars(["username", "realName", "email", "admin"]) . "#addUser";
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<?PHP
|
<?PHP
|
||||||
/**
|
/**
|
||||||
* This file displays object detail pages as fetched from museum-digital.
|
* This script offers detail pages for events
|
||||||
|
* based on data fetched from museum-digital.
|
||||||
*
|
*
|
||||||
* @author Joshua Ramon Enslin <joshua@jrenslin.de>
|
* @author Joshua Ramon Enslin <joshua@jrenslin.de>
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<?PHP
|
<?PHP
|
||||||
/**
|
/**
|
||||||
* This file displays object detail pages as fetched from museum-digital.
|
* This script offers detail pages for exhibitions
|
||||||
|
* based on data fetched from museum-digital.
|
||||||
*
|
*
|
||||||
* @author Joshua Ramon Enslin <joshua@jrenslin.de>
|
* @author Joshua Ramon Enslin <joshua@jrenslin.de>
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -30,7 +30,7 @@ function ensureDir(string $filepath) {
|
||||||
*/
|
*/
|
||||||
function ensureJson(string $filepath) {
|
function ensureJson(string $filepath) {
|
||||||
|
|
||||||
if (!file_exists($filepath) or filesize($filepath) < 2) {
|
if (!file_exists($filepath) or filesize($filepath) < 2) { // If file exists, but is smaller than 2 byte, it is not valid JSON.
|
||||||
file_put_contents($filepath, "[]");
|
file_put_contents($filepath, "[]");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,6 +90,8 @@ function ensureEnvironment() {
|
||||||
|
|
||||||
$GLOBALS['settings'] = $settings;
|
$GLOBALS['settings'] = $settings;
|
||||||
|
|
||||||
|
// Send headers for increased security
|
||||||
|
|
||||||
if ($settings['sendHTTPHeaders']) {
|
if ($settings['sendHTTPHeaders']) {
|
||||||
header('X-Content-Type-Options: nosniff');
|
header('X-Content-Type-Options: nosniff');
|
||||||
header('X-XSS-Protection: 1; mode=block');
|
header('X-XSS-Protection: 1; mode=block');
|
||||||
|
@ -145,7 +147,7 @@ function queryCachePage(string $url, string $area = "", array $settings = ['cach
|
||||||
$fileName = md5($url);
|
$fileName = md5($url);
|
||||||
$filePath = "$fileDir/$fileName.json";
|
$filePath = "$fileDir/$fileName.json";
|
||||||
|
|
||||||
// Load from cache.
|
// Load from cache if appropriate.
|
||||||
if (file_exists($filePath) && time() - filemtime($filePath) < $settings['cacheRefreshInterval']) {
|
if (file_exists($filePath) && time() - filemtime($filePath) < $settings['cacheRefreshInterval']) {
|
||||||
return file_get_contents($filePath);
|
return file_get_contents($filePath);
|
||||||
}
|
}
|
||||||
|
@ -379,8 +381,8 @@ function checkPreviewAccess($sessionStarted = false) {
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
function startswith(string $haystack, string $needle):bool {
|
function startswith(string $haystack, string $needle):bool {
|
||||||
if (substr($haystack, 0, strlen($needle)) == $needle) return (true);
|
if (substr($haystack, 0, strlen($needle)) == $needle) return true;
|
||||||
else return (false);
|
else return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<?PHP
|
<?PHP
|
||||||
/**
|
/**
|
||||||
* This file displays object detail pages as fetched from museum-digital.
|
* This script offers detail pages for institutions
|
||||||
|
* based on data fetched from museum-digital.
|
||||||
*
|
*
|
||||||
* @author Joshua Ramon Enslin <joshua@jrenslin.de>
|
* @author Joshua Ramon Enslin <joshua@jrenslin.de>
|
||||||
*/
|
*/
|
||||||
|
|
Reference in New Issue
Block a user