From: arno Date: Mon, 27 Sep 2010 08:46:03 +0000 (+0200) Subject: do not fail when client uses a proxy X-Git-Tag: v0.2.1~2 X-Git-Url: https://dev.renevier.net/?p=syj.git;a=commitdiff_plain;h=a86eeac0ab678ea55307e1386c5f955f77d8ff73 do not fail when client uses a proxy --- diff --git a/application/controllers/IdxController.php b/application/controllers/IdxController.php index ee1efb0..3996fa0 100644 --- a/application/controllers/IdxController.php +++ b/application/controllers/IdxController.php @@ -66,7 +66,8 @@ class IdxController extends Zend_Controller_Action $geomform->geom_title->setValue($path->title); } else { $geomform->setAction('path'); - $extent = new phptojs\JsObject('gMaxExtent', $this->_helper->syjGeoip($this->getRequest()->getClientIp(true))); + $clientip = trim(end(split(',', $this->getRequest()->getClientIp(true)))); + $extent = new phptojs\JsObject('gMaxExtent', $this->_helper->syjGeoip($clientip)); $this->view->headScript()->prependScript((string) $extent); $title = "Show your journey"; } diff --git a/application/controllers/PathController.php b/application/controllers/PathController.php index bb969e8..48a22be 100644 --- a/application/controllers/PathController.php +++ b/application/controllers/PathController.php @@ -13,7 +13,7 @@ class PathController extends Zend_Controller_Action throw new Syj_Exception_Request(); } $path->creator = $user; - $path->creatorIp = $this->getRequest()->getClientIp(true); + $path->creatorIp = trim(end(split(',', $this->getRequest()->getClientIp(true)))); $this->save($path, $formData); $data = array('redirect' => "idx/" . (string)$path->id);