From 52b077a48c743ba4d08ac00520a0bf1ef6deef5f Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Fri, 24 Feb 2017 21:27:59 +0100 Subject: Initial commit. --- admin/database.php | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 admin/database.php (limited to 'admin/database.php') diff --git a/admin/database.php b/admin/database.php new file mode 100644 index 0000000..47ffd29 --- /dev/null +++ b/admin/database.php @@ -0,0 +1,49 @@ + Application::getSecurityToken()], 'command')) { + try { + $Statement = $Database->query(HTTP::POST('command')); + $result = print_r($Statement->fetchAll(), TRUE); + } catch(PDOException $Exception) { + $messages[] = $Exception->getMessage(); + } +} + +#=============================================================================== +# TRY: Template\Exception +#=============================================================================== +try { + $DatabaseTemplate = Template\Factory::build('database'); + $DatabaseTemplate->set('FORM', [ + 'INFO' => $messages ?? [], + 'TOKEN' => Application::getSecurityToken(), + 'RESULT' => $result ?? NULL, + 'COMMAND' => HTTP::POST('command'), + ]); + + $MainTemplate = Template\Factory::build('main'); + $MainTemplate->set('NAME', 'SQL'); + $MainTemplate->set('HTML', $DatabaseTemplate); + echo $MainTemplate; +} + +#=============================================================================== +# CATCH: Template\Exception +#=============================================================================== +catch(Template\Exception $Exception) { + $Exception->defaultHandler(); +} +?> \ No newline at end of file -- cgit v1.2.3