*/ // Include functions from frontend. require_once __DIR__ . '/../../inc/functions.php'; require_once __DIR__ . '/standardHTML.php'; /** * Function for ensuring everything is in order in the backend. * * @return void */ function ensureBackendEnv() { if (session_status() != PHP_SESSION_ACTIVE) { session_start(); } include_once __DIR__ . "/../password_protect.php"; } /** * Function that checks all the indexes in the input array for their availability in $_GET or $_POST. * If they exist in either, they are written to global variables. * * @param string[] $vars Input array containing indices, that may be contained in $_GET or $_POST. * * @return void */ function loadHttpToGlobals(array $vars) { foreach ($vars as $var) { if (isset($_GET[$var])) $GLOBALS[$var] = $_GET[$var]; else if (isset($_POST[$var])) $GLOBALS[$var] = $_POST[$var]; } } /** * Function for loading the language. * * @return string[] */ function loadLanguage():array { if (isset($_GET['lan'])) $_SESSION['lan'] = $lan = $_GET['lan']; else if (isset($_SESSION['lan'])) $lan = $_SESSION['lan']; // Default to English if (!isset($lan) or !file_exists(__DIR__ . "/translations/$lan.php")) { $lan = "en"; } include __DIR__ . "/../translations/$lan.php"; return $translations; } ?>