Fixed weird access::verify_csrf() issue with TagFaces.
This commit is contained in:
parent
5add59a795
commit
d316a1c45f
@ -20,7 +20,6 @@
|
|||||||
class tagfaces_Controller extends Controller {
|
class tagfaces_Controller extends Controller {
|
||||||
public function drawfaces($id) {
|
public function drawfaces($id) {
|
||||||
// Generate the page that allows the user to draw boxes over a photo.
|
// Generate the page that allows the user to draw boxes over a photo.
|
||||||
|
|
||||||
// Make sure user has access to view and edit the photo.
|
// Make sure user has access to view and edit the photo.
|
||||||
$item = ORM::factory("item", $id);
|
$item = ORM::factory("item", $id);
|
||||||
access::required("view", $item);
|
access::required("view", $item);
|
||||||
@ -89,7 +88,7 @@ class tagfaces_Controller extends Controller {
|
|||||||
$str_y1 = Input::instance()->post("y1");
|
$str_y1 = Input::instance()->post("y1");
|
||||||
$str_x2 = Input::instance()->post("x2");
|
$str_x2 = Input::instance()->post("x2");
|
||||||
$str_y2 = Input::instance()->post("y2");
|
$str_y2 = Input::instance()->post("y2");
|
||||||
|
|
||||||
// If the user didn't select a face, display an error and abort.
|
// If the user didn't select a face, display an error and abort.
|
||||||
if (($str_x1 == "") || ($str_x2 == "") || ($str_y1 == "") || ($str_y2 == "")) {
|
if (($str_x1 == "") || ($str_x2 == "") || ($str_y1 == "") || ($str_y2 == "")) {
|
||||||
message::error(t("Please select a face."));
|
message::error(t("Please select a face."));
|
||||||
@ -180,19 +179,22 @@ class tagfaces_Controller extends Controller {
|
|||||||
|
|
||||||
$tags_group->dropdown('tagsList')
|
$tags_group->dropdown('tagsList')
|
||||||
->label(t("Select a tag:"))
|
->label(t("Select a tag:"))
|
||||||
|
->id('tagsList')
|
||||||
->options($array_tags);
|
->options($array_tags);
|
||||||
|
|
||||||
$tags_group->input("face_title")
|
$tags_group->input("face_title")
|
||||||
|
->id('face_title')
|
||||||
->label(t("Title"));
|
->label(t("Title"));
|
||||||
|
|
||||||
$tags_description = $form->group("TagsDescription")
|
$tags_description = $form->group("TagsDescription")
|
||||||
->label(t("Description (optional):"));
|
->label(t("Description (optional):"));
|
||||||
$tags_description->input("face_description");
|
$tags_description->input("face_description")
|
||||||
|
->id('face_description');
|
||||||
|
|
||||||
// Generate input boxes to hold the coordinates of the face.
|
// Generate input boxes to hold the coordinates of the face.
|
||||||
$coordinates_group = $form->group("FaceCoordinates")
|
$coordinates_group = $form->group("FaceCoordinates")
|
||||||
->label(t("Coordinates:"));
|
->label(t("Coordinates:"));
|
||||||
$coordinates_group->input("x1")
|
$coordinates_group->input('x1')
|
||||||
->id('x1')
|
->id('x1')
|
||||||
->label(t("X1"));
|
->label(t("X1"));
|
||||||
$coordinates_group->input("y1")
|
$coordinates_group->input("y1")
|
||||||
@ -206,7 +208,7 @@ class tagfaces_Controller extends Controller {
|
|||||||
->label(t("Y2"));
|
->label(t("Y2"));
|
||||||
|
|
||||||
// Add the id# of the photo and a save button to the form.
|
// Add the id# of the photo and a save button to the form.
|
||||||
$form->hidden("item_id")->value($id);
|
$coordinates_group->hidden("item_id")->value($id);
|
||||||
$form->submit("SaveFace")->value(t("Save face"));
|
$form->submit("SaveFace")->value(t("Save face"));
|
||||||
|
|
||||||
// Return the newly generated form.
|
// Return the newly generated form.
|
||||||
@ -216,7 +218,6 @@ class tagfaces_Controller extends Controller {
|
|||||||
private function _get_delfaces_form($id) {
|
private function _get_delfaces_form($id) {
|
||||||
// Generate a form to allow the user to remove face data
|
// Generate a form to allow the user to remove face data
|
||||||
// from a photo.
|
// from a photo.
|
||||||
|
|
||||||
// Make a new Form.
|
// Make a new Form.
|
||||||
$form = new Forge("tagfaces/delface", "", "post",
|
$form = new Forge("tagfaces/delface", "", "post",
|
||||||
array("id" => "g-tag-del-faces-form"));
|
array("id" => "g-tag-del-faces-form"));
|
||||||
@ -238,13 +239,14 @@ class tagfaces_Controller extends Controller {
|
|||||||
// Add a checklist to the form.
|
// Add a checklist to the form.
|
||||||
$tags_group = $form->group("ExistingFaces")
|
$tags_group = $form->group("ExistingFaces")
|
||||||
->label(t("Tags with faces:"));
|
->label(t("Tags with faces:"));
|
||||||
|
// Add the id# of the photo and a delete button to the form.
|
||||||
|
$tags_group->hidden("item_id")->value($id);
|
||||||
|
|
||||||
$tags_group->checklist("facesList")
|
$tags_group->checklist("facesList")
|
||||||
->options($array_faces)
|
->options($array_faces)
|
||||||
->label(t("Select the tag(s) that correspond(s) to the face(s) you wish to delete:"));
|
->label(t("Select the tag(s) that correspond(s) to the face(s) you wish to delete:"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the id# of the photo and a delete button to the form.
|
|
||||||
$form->hidden("item_id")->value($id);
|
|
||||||
$form->submit("DeleteFace")->value(t("Delete face(s)"));
|
$form->submit("DeleteFace")->value(t("Delete face(s)"));
|
||||||
|
|
||||||
// Return the newly generated form.
|
// Return the newly generated form.
|
||||||
|
Reference in New Issue
Block a user