summaryrefslogtreecommitdiffstats
path: root/createStory.php
diff options
context:
space:
mode:
Diffstat (limited to '')
-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);
+}
+
+?>