diff options
author | steckbrief <steckbrief@chefmail.de> | 2017-11-26 13:21:28 +0100 |
---|---|---|
committer | steckbrief <steckbrief@chefmail.de> | 2017-11-26 13:21:28 +0100 |
commit | 66fa1ca8e3ae25af82fb43fb9f79342fc3f65787 (patch) | |
tree | 2d24e12beda1a9cef4d0c66399877b3069288da7 /lib/functions.stories.inc.php | |
parent | d6dfb30a86deb8278732904cee0b05a9cfa230e2 (diff) |
fixed some bugs in create story workflow, gitignore added
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 + } + } +} +?> |