diff options
author | steckbrief <steckbrief@chefmail.de> | 2017-11-26 10:37:44 +0100 |
---|---|---|
committer | steckbrief <steckbrief@chefmail.de> | 2017-11-26 10:37:44 +0100 |
commit | d6dfb30a86deb8278732904cee0b05a9cfa230e2 (patch) | |
tree | 5d291b23fff63cab6fc9291b2ce8dcaf7da396b3 /lib | |
parent | 253297e60ceacd38e092469e00c19a101aeec05c (diff) |
first admin iteration
Diffstat (limited to 'lib')
-rw-r--r-- | lib/functions.stories.php | 33 |
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 + } + } +} +?> |