]> dev.renevier.net Git - syp.git/commitdiff
demo restrictions
authorarno <arenevier@fdn.fr>
Sun, 26 Jul 2009 16:40:31 +0000 (18:40 +0200)
committerarno <arno@renevier.net>
Fri, 16 Apr 2010 22:48:10 +0000 (00:48 +0200)
forbirds creation or deletion of item
forbirds adding or deleting an image
forbirds adding an user
forbids changing password

api.php
inc/html/admin.php
js/admin.js

diff --git a/api.php b/api.php
index 2dbfac4857a88e258513b114b3dcdb262ad770a3..7ba3f08c828bff59efe7ffedc4262ef6a8fd4e3f 100644 (file)
--- a/api.php
+++ b/api.php
@@ -255,6 +255,7 @@ function main ($con) {
             if ($_POST ["keep_img"] == "yes") {
                 $imgpath = $feature->imgpath;
             } else {
+                error_request ();
                 $imgpath = save_uploaded_file ($_FILES ["image_file"], $con);
             }
 
@@ -295,6 +296,7 @@ function main ($con) {
             success_feature ($new_feature, "update");
         break;
         case "add":
+            error_request ();
             $imgpath = save_uploaded_file ($_FILES ["image_file"], $con);
 
             $lon = $_POST ["lon"];
@@ -314,6 +316,7 @@ function main ($con) {
             success_feature ($feature, "add");
         break;
         case "del":
+            error_request ();
             $id = $_POST ["fid"];
             $feature = $con->getfeature ($id);
             if (!isset ($feature)) {
@@ -336,6 +339,7 @@ function main ($con) {
 
             success_delete_feature ($feature);
         case "changepass":
+            error_request ();
             $currpass = unquote ($_POST ["pass_current"]);
             if (!$con->checkpwdmd5 ($user, md5 ($currpass))) {
                 error_wrongpass ();
@@ -353,6 +357,7 @@ function main ($con) {
             success_changepass ($user);
         break;
         case "newuser":
+            error_request ();
             if ($user != "admin") {
                 error_unauthorized ();
             }
index ef43708a4b50f03314742deadafb2527c329420a..3dc893cd686e90ec28fd4a66658117a6e1e4fd35 100644 (file)
@@ -83,7 +83,8 @@ if (!$usrtblexists || !$itemstblexists) {
             changePassSuccess: "<?php ptrans('Password successfully changed.')?>",
             newUserNonameError: "<?php ptrans('User name has not been set.')?>",
             newUserExistsError: "<?php ptrans('User already exists in database.')?>",
-            newUserSuccess: "<?php ptrans('User successfully added.')?>"
+            newUserSuccess: "<?php ptrans('User successfully added.')?>",
+            DisabledForDemo: "<?php ptrans('This feature is not enabled on demo site')?>"
         };
 
         var sypSettings =  {
index 71daf2c7cc93ca4ecf6ad97dfa64ed98b9de34a8..cc02a60a00b040b40cb0238dbc5612465e6d2c8e 100644 (file)
@@ -329,7 +329,6 @@ var Admin = {
 
     addNewFeature: function () {
         userMgr.close();
-
         function cancel() {
             $(document).unbind("keydown");
             Admin.reset()
@@ -458,6 +457,10 @@ var FeatureMgr = {
     },
 
     add: function(evt) {
+        alert (SypStrings.DisabledForDemo);
+        $(document).unbind("keydown");
+        Admin.reset()
+        return;
         var map = Admin.map;
         var pos = map.getLonLatFromViewPortPx(evt.xy);
         feature = this.update (null, pos, "", "", "");
@@ -489,6 +492,8 @@ var FeatureMgr = {
     },
 
     del: function (feature) {
+        alert (SypStrings.DisabledForDemo);
+        return;
         var form = $("#feature_delete");
         form.find('input[name="fid"]').val(feature.fid);
         AjaxMgr.add({
@@ -998,6 +1003,10 @@ var userMgr = {
 
         this.commError("");
 
+        this.disableForms();
+        alert (SypStrings.DisabledForDemo);
+        return;
+
         AjaxMgr.add({
             form: $("#changepass"),
             oncomplete: OpenLayers.Function.bind(this.ajaxReply, this),
@@ -1081,6 +1090,9 @@ var userMgr = {
         }
 
         this.commError("");
+        this.disableForms();
+        alert (SypStrings.DisabledForDemo);
+        return;
 
         AjaxMgr.add({
             form: $("#newuser"),
@@ -1239,6 +1251,8 @@ $(window).load(function () {
         return false;
     });
     $("#image_delete").click(function() {
+            alert (SypStrings.DisabledForDemo);
+            return;
             $("#img").removeAttr('src');
             // needs to rebuild element otherwise some browsers still
             // display image.