summaryrefslogtreecommitdiffstats
path: root/lib
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 /lib
parent253297e60ceacd38e092469e00c19a101aeec05c (diff)
first admin iteration
Diffstat (limited to 'lib')
-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
+ }
+ }
+}
+?>