summaryrefslogtreecommitdiffstats
path: root/admin/page/delete.php
diff options
context:
space:
mode:
authorThomas Lange <code@nerdmind.de>2017-02-24 21:27:59 +0100
committerThomas Lange <code@nerdmind.de>2017-02-24 21:27:59 +0100
commit52b077a48c743ba4d08ac00520a0bf1ef6deef5f (patch)
treeb4205c194167e0e03e273957cdd0aab3be9fdf01 /admin/page/delete.php
downloadblog-52b077a48c743ba4d08ac00520a0bf1ef6deef5f.tar.gz
blog-52b077a48c743ba4d08ac00520a0bf1ef6deef5f.tar.xz
blog-52b077a48c743ba4d08ac00520a0bf1ef6deef5f.zip
Initial commit.v1.0
Diffstat (limited to 'admin/page/delete.php')
-rw-r--r--admin/page/delete.php72
1 files changed, 72 insertions, 0 deletions
diff --git a/admin/page/delete.php b/admin/page/delete.php
new file mode 100644
index 0000000..163bbdb
--- /dev/null
+++ b/admin/page/delete.php
@@ -0,0 +1,72 @@
+<?php
+#===============================================================================
+# DEFINE: Administration
+#===============================================================================
+define('ADMINISTRATION', TRUE);
+define('AUTHENTICATION', TRUE);
+
+#===============================================================================
+# INCLUDE: Main configuration
+#===============================================================================
+require_once '../../core/application.php';
+
+#===============================================================================
+# TRY: Page\Exception
+#===============================================================================
+try {
+ $Page = Page\Factory::build(HTTP::GET('id'));
+ $Attribute = $Page->getAttribute();
+
+ if(HTTP::issetPOST(['token' => Application::getSecurityToken()], 'delete')) {
+ try {
+ if($Attribute->databaseDELETE($Database)) {
+ HTTP::redirect(Application::getAdminURL('page/'));
+ }
+ } catch(PDOException $Exception) {
+ $messages[] = $Exception->getMessage();
+ }
+ }
+
+ #===============================================================================
+ # TRY: Template\Exception
+ #===============================================================================
+ try {
+ $FormTemplate = Template\Factory::build('page/form');
+ $FormTemplate->set('HTML', $Page->getHTML());
+ $FormTemplate->set('FORM', [
+ 'TYPE' => 'DELETE',
+ 'INFO' => $messages ?? [],
+ 'DATA' => [
+ 'ID' => $Attribute->get('id'),
+ 'BODY' => $Attribute->get('body'),
+ 'TIME_INSERT' => $Attribute->get('time_insert'),
+ 'TIME_UPDATE' => $Attribute->get('time_update'),
+ ],
+ 'TOKEN' => Application::getSecurityToken()
+ ]);
+
+ $DeleteTemplate = Template\Factory::build('page/delete');
+ $DeleteTemplate->set('HTML', $FormTemplate);
+
+ $MainTemplate = Template\Factory::build('main');
+ $MainTemplate->set('NAME', $Language->text('title_page_delete'));
+ $MainTemplate->set('HTML', $DeleteTemplate);
+ echo $MainTemplate;
+ }
+
+ #===============================================================================
+ # CATCH: Template\Exception
+ #===============================================================================
+ catch(Template\Exception $Exception) {
+ $Exception->defaultHandler();
+ }
+}
+
+#===============================================================================
+# CATCH: Page\Exception
+#===============================================================================
+catch(Page\Exception $Exception) {
+ Application::exit(404);
+}
+?>
+