summaryrefslogtreecommitdiffstats
path: root/lib/functions.stories.inc.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/functions.stories.inc.php')
-rw-r--r--lib/functions.stories.inc.php18
1 files changed, 14 insertions, 4 deletions
diff --git a/lib/functions.stories.inc.php b/lib/functions.stories.inc.php
index 5e0527e..8f35e27 100644
--- a/lib/functions.stories.inc.php
+++ b/lib/functions.stories.inc.php
@@ -13,10 +13,7 @@ function generateDirectoryName($name) {
return urlencode($name);
}
-function createEntity($path, $description, $file, $filename) {
- if (!dir_exists($path)) {
- // create directory for story
- if (mkdir($path)) {
+function saveEntity($path, $description, $file, $filename) {
// create description file
if (file_put_contents($path.DIRECTORY_SEPARATOR.'description.txt', $description) === FALSE) {
// Error on writing description file
@@ -27,6 +24,19 @@ function createEntity($path, $description, $file, $filename) {
} else {
return 3;
}
+}
+
+function editEntity($path, $description, $file, $filename) {
+ if (dir_exists($path)) {
+ return saveEntity($path, $description, $file, $filename);
+ }
+}
+
+function createEntity($path, $description, $file, $filename) {
+ if (!dir_exists($path)) {
+ // create directory for story
+ if (mkdir($path)) {
+ return saveEntity($path, $description, $file, $filename);
} else {
// Error on directory creation
// return 'Could not create directory "'.$path;