summaryrefslogtreecommitdiffstats
path: root/lib/functions.stories.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/functions.stories.php')
-rw-r--r--lib/functions.stories.php33
1 files changed, 33 insertions, 0 deletions
diff --git a/lib/functions.stories.php b/lib/functions.stories.php
new file mode 100644
index 0000000..a8102c3
--- /dev/null
+++ b/lib/functions.stories.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
+ }
+ }
+}
+?>