X-Git-Url: https://dev.renevier.net/?p=syj.git;a=blobdiff_plain;f=application%2Fcontrollers%2FPathController.php;h=6ef95292baf813d54c7a3a41a0dff0f032148d29;hp=37394d02dbfd4bc3331a3771543f09d772365187;hb=a64d41557a62ec6051d7fa08d1ba941e089aa5c2;hpb=3c4eae3c94fd2369087cd3cc73e195cbc48fc433 diff --git a/application/controllers/PathController.php b/application/controllers/PathController.php index 37394d0..6ef9529 100644 --- a/application/controllers/PathController.php +++ b/application/controllers/PathController.php @@ -6,12 +6,6 @@ class PathController extends Zend_Controller_Action { public function indexAction() { $formData = $this->_helper->SyjPostData->getPostData('Syj_Form_Geom'); - - $user = $this->_helper->SyjSession->user(); - if (!$user) { - throw new Syj_Exception_Forbidden(); - } - $decoder = new gisconverter\WKT(); try { @@ -32,16 +26,24 @@ class PathController extends Zend_Controller_Action } } $path->geom = $geom; + + $user = $this->_helper->SyjSession->user(); + if (!$user and !$formData["geom_accept"]) { + throw new Syj_Exception_Request(); + } + if ($path->getId()) { - if ($path->owner->id != $user->id) { - throw new Syj_Exception_Forbidden(); + if (!$path->isCreator($user)) { + throw new Syj_Exception_Request(); } } else { - $path->owner = $user; + $path->creator = $user; } + if (isset($formData["geom_title"])) { $path->title = $formData["geom_title"]; } + $path->creatorIp = $this->getRequest()->getClientIp(true); try { $pathMapper->save ($path); } catch(Zend_Db_Statement_Exception $e) {