From 8cff84ad1697a836c1361e669bd1b797957e75d0 Mon Sep 17 00:00:00 2001 From: arno Date: Sun, 26 Jul 2009 18:40:31 +0200 Subject: [PATCH] demo restrictions forbirds creation or deletion of item forbirds adding or deleting an image forbirds adding an user forbids changing password --- api.php | 5 +++++ inc/html/admin.php | 3 ++- js/admin.js | 16 +++++++++++++++- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/api.php b/api.php index e74f3b4..7895dad 100644 --- 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 (); } diff --git a/inc/html/admin.php b/inc/html/admin.php index ca2dd4d..56ac0a9 100644 --- a/inc/html/admin.php +++ b/inc/html/admin.php @@ -77,7 +77,8 @@ if (!$usrtblexists || !$itemstblexists) { changePassSuccess: "", newUserNonameError: "", newUserExistsError: "", - newUserSuccess: "" + newUserSuccess: "", + DisabledForDemo: "" }; var sypSettings = { diff --git a/js/admin.js b/js/admin.js index abce8a5..d1bd22e 100644 --- a/js/admin.js +++ b/js/admin.js @@ -269,7 +269,6 @@ var Admin = { addNewFeature: function () { userMgr.close(); - function cancel() { $(document).unbind("keydown"); Admin.reset() @@ -398,6 +397,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, "", "", ""); @@ -429,6 +432,8 @@ var FeatureMgr = { }, del: function (feature) { + alert (SypStrings.DisabledForDemo); + return; var form = $("#feature_delete"); form.find('input[name="fid"]').val(feature.fid); AjaxMgr.add({ @@ -938,6 +943,10 @@ var userMgr = { this.commError(""); + this.disableForms(); + alert (SypStrings.DisabledForDemo); + return; + AjaxMgr.add({ form: $("#changepass"), oncomplete: OpenLayers.Function.bind(this.ajaxReply, this), @@ -1021,6 +1030,9 @@ var userMgr = { } this.commError(""); + this.disableForms(); + alert (SypStrings.DisabledForDemo); + return; AjaxMgr.add({ form: $("#newuser"), @@ -1179,6 +1191,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. -- 2.39.2