summaryrefslogtreecommitdiffstats
path: root/createStory.php
blob: 83d900041bc8df7abb437d958c84f2ea7d1a0cfb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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 = getOptionalFileParameter('story-logo');
$storyDescription = getOptionalPostParameter('story-description');

$pathToStory = __DIR__.DIRECTORY_SEPARATOR.'stories'.DIRECTORY_SEPARATOR.generateDirectoryName($storyName);

$result = createEntity($pathToStory, $storyDescription, $storyLogoFile, 'logo.png');
if (TRUE !== $result) {
    sendHttpReturnCodeAndJson(500, $result);
} else {
    sendHttpReturnCodeAndMessage(201);
}

?>