summaryrefslogtreecommitdiffstats
path: root/createStory.php
diff options
context:
space:
mode:
authorsteckbrief <steckbrief@chefmail.de>2017-11-26 10:37:44 +0100
committersteckbrief <steckbrief@chefmail.de>2017-11-26 10:37:44 +0100
commitd6dfb30a86deb8278732904cee0b05a9cfa230e2 (patch)
tree5d291b23fff63cab6fc9291b2ce8dcaf7da396b3 /createStory.php
parent253297e60ceacd38e092469e00c19a101aeec05c (diff)
first admin iteration
Diffstat (limited to 'createStory.php')
-rw-r--r--createStory.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/createStory.php b/createStory.php
new file mode 100644
index 0000000..906a302
--- /dev/null
+++ b/createStory.php
@@ -0,0 +1,25 @@
+<?php
+/*
+ *
+ * createStory.php
+ *
+ */
+
+require_once(__DIR__.DIRECTORY_SEPARATOR.'lib'.DIRECTORY_SEPARATOR.'commons'.DIRECTORY_SEPARATOR.'functions.common.inc.php');
+require_once(__DIR__.DIRECTORY_SEPARATOR.'lib'.DIRECTORY_SEPARATOR.'commons'.DIRECTORY_SEPARATOR.'functions.http.inc.php');
+require_once(__DIR__.DIRECTORY_SEPARATOR.'lib'.DIRECTORY_SEPARATOR.'functions.stories.inc.php');
+
+$storyName = getMandatoryPostParameter('story-name', '', true);
+$storyLogoFile = getOptionalPostParameter('story-logo');
+$storyDescription = getOptionalPostParameter('story-description');
+
+$pathToStory = __DIR__.DIRECTORY_SEPARATOR.generateDirectoryName($storyName);
+
+$result = createEntity($pathToStory, $storyDescription, $storyLogoFile, 'logo.png');
+if (TRUE !== $result) {
+ sendHttpReturnCodeAndJson(500, $result);
+} else {
+ sendHttpReturnCodeAndMessage(201);
+}
+
+?>