Configurable index page
[phorkie.git] / www / new.php
diff --git a/www/new.php b/www/new.php
new file mode 100644 (file)
index 0000000..ef9daec
--- /dev/null
@@ -0,0 +1,34 @@
+<?php
+namespace phorkie;
+/**
+ * Show paste creation form
+ *
+ * Elements:
+ * - description
+ * - file name (default: default.php)
+ * - content
+ *
+ * Creates and redirects to display page
+ */
+require_once 'www-header.php';
+
+$repopo = new Repository_Post();
+if ($repopo->process($_POST)) {
+    redirect($repopo->repo->getLink('display'));
+}
+
+$phork = array(
+    '1' => new File(null, null)
+);
+$db = new Database();
+render(
+    'new',
+    array(
+        'files'       => $phork,
+        'description' => '',
+        'htmlhelper'  => new HtmlHelper(),
+        'recents'     => $db->getSearch()->listAll(0, 5, 'crdate', 'desc'),
+        'dh'          => new \Date_HumanDiff(),
+    )
+);
+?>