From: Michael J. Rubinsky Date: Mon, 9 Nov 2009 19:12:15 +0000 (-0500) Subject: track imple post-only changes in ajax actions for face editing X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=c2e417eadaff224b07b15eaf806eaf63f99132a7;p=horde.git track imple post-only changes in ajax actions for face editing --- diff --git a/ansel/js/editfaces.js b/ansel/js/editfaces.js index 4657ac155..47443b4f0 100644 --- a/ansel/js/editfaces.js +++ b/ansel/js/editfaces.js @@ -1,30 +1,20 @@ document.observe('dom:loaded', function() { Ansel.deleteFace = function(image_id, face_id) { - new Ajax.Request(Ansel.ajax.editFaces.url, + new Ajax.Request(Ansel.ajax.editFaces.url + "/action=delete/post=values", { method: 'post', - parameters: { - action: 'delete', - image: image_id, - face: face_id - } + parameters: { "values": "image=" + image_id + "/face=" + face_id } }); $('face' + face_id).remove(); }; Ansel.setFaceName = function(image_id, face_id) { - new Ajax.Request(Ansel.ajax.editFaces.url, + new Ajax.Request(Ansel.ajax.editFaces.url + "/action=setname/post=values", { method: 'post', - parameters: - { - action: 'setname', - face: face_id, - image: image_id, - facename: encodeURIComponent($F('facename' + face_id)) - }, + parameters: { "values": "face=" + face_id + "/image=" + image_id + "/facename=" + encodeURIComponent($F('facename' + face_id)) }, onComplete: function(r) { if (r.responseJSON.response == 1) { $('faces_widget_content').update(r.responseJSON.message); @@ -37,14 +27,10 @@ document.observe('dom:loaded', function() { Ansel.doFaceEdit = function(image_id) { $('faces_widget_content').update(Ansel.ajax.editFaces.text.loading); - new Ajax.Request(Ansel.ajax.editFaces.url, + new Ajax.Request(Ansel.ajax.editFaces.url + "/action=process/post=values", { method: 'post', - parameters: - { - action: 'process', - image: image_id - }, + parameters: { "values": "image=" + image_id }, onComplete: function(r) { if (r.responseJSON.response == 1) { $('faces_widget_content').update(r.responseJSON.message); diff --git a/ansel/lib/Ajax/Imple/EditFaces.php b/ansel/lib/Ajax/Imple/EditFaces.php index 2c23b380e..3f33ce078 100644 --- a/ansel/lib/Ajax/Imple/EditFaces.php +++ b/ansel/lib/Ajax/Imple/EditFaces.php @@ -33,10 +33,9 @@ class Ansel_Ajax_Imple_EditFaces extends Horde_Ajax_Imple_Base include_once dirname(__FILE__) . '/../../base.php'; if (Horde_Auth::getAuth()) { - /* Require POST for these actions */ - $action = Horde_Util::getPost('action'); - $image_id = (int)Horde_Util::getPost('image'); - $reload = Horde_Util::getPost('reload', 0); + $action = $args['action']; + $image_id = (int)$post['image']; + $reload = empty($post['reload']) ? 0 : $post['reload']; if (empty($action)) { return array('response' => 0); @@ -73,7 +72,7 @@ class Ansel_Ajax_Imple_EditFaces extends Horde_Ajax_Imple_Base case 'delete': // delete - deletes a single face from an image. - $face_id = (int)Horde_Util::getPost('face'); + $face_id = (int)$post['face']; $image = &$GLOBALS['ansel_storage']->getImage($image_id); $gallery = &$GLOBALS['ansel_storage']->getGallery($image->gallery); if (!$gallery->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) { @@ -86,12 +85,12 @@ class Ansel_Ajax_Imple_EditFaces extends Horde_Ajax_Imple_Base case 'setname': // setname - sets the name of a single image. - $face_id = (int)Horde_Util::getPost('face'); + $face_id = (int)$post['face']; if (!$face_id) { return array('response' => 0); } - $name = Horde_Util::getPost('facename'); + $name = $post['facename']; $image = &$GLOBALS['ansel_storage']->getImage($image_id); $gallery = &$GLOBALS['ansel_storage']->getGallery($image->gallery); if (!$gallery->hasPermission(Horde_Auth::getAuth(), PERMS_EDIT)) {