+ protected function _initForms() {
+ $this->view->geomform = new Syj_Form_Geom(array('name' => 'geomform', 'action' => 'path'));
+ $this->view->loginform = new Syj_Form_Login(array('name' => 'loginform', 'action' => 'login'));
+ $this->view->userform = new Syj_Form_User(array('name' => 'userform', 'action' => 'user'));
+ $this->view->newpwdform = new Syj_Form_Newpwd(array('name' => 'newpwdform', 'action' => 'newpwd'));
+ }
+
+ protected function _setInitialPos() {
+ $lat = $this->getRequest()->getQuery('lat');
+ $lon = $this->getRequest()->getQuery('lon');
+ $zoom = $this->getRequest()->getQuery('zoom');
+ if (is_numeric ($lat) and is_numeric ($lon) and is_numeric ($zoom)) {
+ $initialpos = array('lat' => (float)$lat, 'lon' => (float)$lon, 'zoom' => (int)$zoom);
+ } else {
+ $initialpos = $this->_helper->syjGeoip($this->getRequest()->getClientIp(true));
+ }
+ $this->view->headScript()->prependScript((string) new phptojs\JsObject('gInitialPos', $initialpos));
+ }
+
+ public function errorAction() {
+ Zend_Controller_Front::getInstance()->getRequest()->setRequestUri($this->_request->getBaseUrl());
+ $this->_initForms();
+ $this->_setInitialPos();
+
+ $this->_jsLoggedInfo(null);
+ $this->_jsLocaleStrings();
+
+ $this->view->headTitle("Show your journey");
+ $this->view->headMeta()->appendName('description', $this->view->translate('website to share routes'));
+ $this->view->loggedUser = $this->_helper->SyjSession->user();
+ $this->_helper->ViewRenderer->setViewScriptPathSpec(':controller/index.:suffix');
+
+ $error = $this->_getParam('error_handler');
+ if ($error) {
+ if ($error->exception instanceof Syj_Exception_ToolargeGeomUpload) {
+ $maxsize = $this->_bytesToString(min($this->_strToBytes(ini_get('upload_max_filesize')),
+ $this->_strToBytes(ini_get('upload_max_filesize'))));
+ $this->view->errorMsg = $this->view->translate('File too large. File size must not exceed %s', $maxsize);
+ } else if ($error->exception instanceof Syj_Exception_InvalidGeomUpload) {
+ $this->view->errorMsg = $this->view->translate("Invalid file");
+ }
+ }
+ }
+