diff options
Diffstat (limited to 'lib/functions.stories.inc.php')
-rw-r--r-- | lib/functions.stories.inc.php | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/lib/functions.stories.inc.php b/lib/functions.stories.inc.php new file mode 100644 index 0000000..a8102c3 --- /dev/null +++ b/lib/functions.stories.inc.php @@ -0,0 +1,33 @@ +<?php +/* + * functions.stories.php + */ + + +function visibleName($nameWithUnderscore) { + //return str_replace('_', ' ', $nameWithUnderscore); + return urldecode($nameWithUnderscore); +} + +function generateDirectoryName($storyName) { + return urlencode($storyName); +} + +function createEntity($path, $description, $file, $filename) { + if (!dir_exists($path)) { + // create directory for story + if (mkdir($path)) { + // create description file + if (file_put_contents($path.DIRECTORY_SEPARATOR.'description.txt', $description) === FALSE) { + // Error on writing description file + } + // move uploaded logo + if (NULL === $file || move_uploaded_file($file['tmp_name'], $path.DIRECTORY_SEPARATOR.$filename)) { + return TRUE; + } + } else { + // Error on directory creation + } + } +} +?> |