]> dev.renevier.net Git - syp.git/blobdiff - api.php
forbird creation or deletion of item; forbids adding or deleting an image
[syp.git] / api.php
diff --git a/api.php b/api.php
index 052b5145a47e5aef5701b72648896a3c08367369..38dc35dab9ef09834ac3120e8e8f74b229a9a868 100644 (file)
--- a/api.php
+++ b/api.php
@@ -100,17 +100,9 @@ function save_uploaded_file ($file, $con) {
         }
         $mini_dest = getthumbsdir () . "/mini_" . basename_safe ($dest);
 
-        try {
-            $thumbnail_ok = create_thumbnail ($dest, $mini_dest);
-        } catch (Exception $e) {
-            $thumbnail_ok = false;
-        }
-        if (!$thumbnail_ok) {
-            if (!copy ($dest, $mini_dest)) {
-                server_error ();
-            }
+        if (!create_thumbnail_or_copy ($dest, $mini_dest)) {
+            server_error ();
         }
-
     }
     return basename_safe ($dest);
 }
@@ -224,6 +216,7 @@ function main ($con) {
             if ($_POST ["keep_img"] == "yes") {
                 $imgpath = $feature->imgpath;
             } else {
+                request_error ();
                 $imgpath = save_uploaded_file ($_FILES ["image_file"], $con);
             }
 
@@ -264,6 +257,7 @@ function main ($con) {
             success_feature ($new_feature, "update");
         break;
         case "add":
+            request_error ();
             $imgpath = save_uploaded_file ($_FILES ["image_file"], $con);
 
             $lon = $_POST ["lon"];
@@ -283,6 +277,7 @@ function main ($con) {
             success_feature ($feature, "add");
         break;
         case "del":
+            request_error ();
             $id = $_POST ["fid"];
             $feature = $con->getfeature ($id);
             if (!isset ($feature)) {