diff --git a/www/extern/egg/EGGDatabase.php b/www/extern/egg/EGGDatabase.php index 67ec66d..613d172 100644 --- a/www/extern/egg/EGGDatabase.php +++ b/www/extern/egg/EGGDatabase.php @@ -69,9 +69,7 @@ class EGGDatabase public function sql_query_assoc(string $query) { - $r = $this->pdo->query($query)->fetchAll(PDO::FETCH_ASSOC); - - return $r; + return $this->pdo->query($query)->fetchAll(PDO::FETCH_ASSOC); } public function sql_query_assoc_prep(string $query, array $params) @@ -84,9 +82,7 @@ class EGGDatabase } $stmt->execute(); - $r = $stmt->fetchAll(PDO::FETCH_ASSOC); - - return $r; + return $stmt->fetchAll(PDO::FETCH_ASSOC); } public function sql_exec_prep(string $query, array $params) diff --git a/www/internals/modules/programs.php b/www/internals/modules/programs.php index 0d23560..7c1f577 100644 --- a/www/internals/modules/programs.php +++ b/www/internals/modules/programs.php @@ -223,7 +223,7 @@ class Programs if (strpos($prog['internal_name'], ' ') !== FALSE) return ['result'=>'err', 'message' => 'Internal name contains spaces ' . $prog['name']]; - foreach (explode('|', $prog['ui_language']) as $lang) if ($this->convertLanguageToFlag($lang) === null) return ['result'=>'err', 'message' => 'Unknown ui-lang ' . $prog['name']];; + foreach (explode('|', $prog['ui_language']) as $lang) if ($this->convertLanguageToFlag($lang) === null) return ['result'=>'err', 'message' => 'Unknown ui-lang ' . $prog['name']]; if (!in_array($prog['prog_language'], self::PROG_LANGS)) return ['result'=>'err', 'message' => 'Unknown prog-lang ' . $prog['name']]; diff --git a/www/internals/utils.php b/www/internals/utils.php index c877e98..c157590 100644 --- a/www/internals/utils.php +++ b/www/internals/utils.php @@ -1,16 +1,5 @@ getMessage() . "\n"; - $content .= 'CODE:' . "\n" . $e->getCode() . "\n"; - $content .= 'TRACE:' . "\n" . $e->getTraceAsString() . "\n"; - $content .= '$_GET:' . "\n" . print_r($_GET, true) . "\n"; - $content .= '$_POST:' . "\n" . print_r($_POST, true) . "\n"; - $content .= '$_FILES:' . "\n" . print_r($_FILES, true) . "\n"; - - sendMail($subject, $content, 'virtualadmin@mikescher.de', 'webserver-error@mikescher.com'); - } - catch (Exception $e) - { - // - } + mail($to, $subject, $content, 'From: ' . $from); } function get_client_ip() { diff --git a/www/pages/api.php b/www/pages/api.php index f953822..93e54c0 100644 --- a/www/pages/api.php +++ b/www/pages/api.php @@ -65,7 +65,9 @@ if (!array_key_exists($cmd, $API_COMMANDS)) print(" ::::::`:::::;' / / `# \n"); print(" \n"); print(" \n"); - httpDie(400, 'Wrong command.'); + + $FRAME_OPTIONS->forceResult(400, 'Wrong command.'); + return; } $config = $API_COMMANDS[$cmd]; @@ -73,10 +75,10 @@ $config = $API_COMMANDS[$cmd]; $secret = isset($_GET['secret']) ? $_GET['secret'] : ''; -if ($config['auth'] === 'webhook_secret' && $secret !== $CONFIG['webhook_secret']) { $FRAME_OPTIONS->forceResult(401, "Unauthorized."); return; } -if ($config['auth'] === 'ajax_secret' && $secret !== $CONFIG['ajax_secret']) { $FRAME_OPTIONS->forceResult(401, "Unauthorized."); return; } -if ($config['auth'] === 'upload_secret' && $secret !== $CONFIG['upload_secret']) { $FRAME_OPTIONS->forceResult(401, "Unauthorized."); return; } -if ($config['auth'] === 'admin' && !$SITE->isLoggedInByCookie()) { $FRAME_OPTIONS->forceResult(401, "Unauthorized."); return; } +if ($config['auth'] === 'webhook_secret' && $secret !== $SITE->config['webhook_secret']) { $FRAME_OPTIONS->forceResult(401, "Unauthorized."); return; } +if ($config['auth'] === 'ajax_secret' && $secret !== $SITE->config['ajax_secret']) { $FRAME_OPTIONS->forceResult(401, "Unauthorized."); return; } +if ($config['auth'] === 'upload_secret' && $secret !== $SITE->config['upload_secret']) { $FRAME_OPTIONS->forceResult(401, "Unauthorized."); return; } +if ($config['auth'] === 'admin' && !$SITE->isLoggedInByCookie()) { $FRAME_OPTIONS->forceResult(401, "Unauthorized."); return; } global $API_OPTIONS;