public function rejestracjaAction()
 {
     $form = new Form_Register();
     $request = $this->getRequest();
     if ($request->isPost()) {
         if ($form->isValid($this->_request->getPost())) {
             $data = $form->getValues();
             $model = new Model_User();
             $model->setFirstname($data['firstname']);
             $model->setLastname($data['lastname']);
             $model->setUsername($data['username']);
             $model->setPassword(md5($data['password']));
             $model->setEmail($data['email']);
             $mapper = Model_UserMapper::getInstance();
             $mapper->save($model);
             $this->createConfig($data['username']);
             $server = new Zend_View_Helper_ServerUrl();
             $server->setScheme('http');
             $this->_redirect($server->serverUrl($this->view->url(array('controller' => 'autentykacja', 'action' => 'logowanie'))));
             //                $this->_redirect('/autentykacja/logowanie');
         } else {
             $this->view->errorMessage = 'Nie uzupełniono wymaganych pól.';
         }
     }
     $this->view->form = $form;
 }
 public function wylogowanieAction()
 {
     Zend_Auth::getInstance()->clearIdentity();
     $server = new Zend_View_Helper_ServerUrl();
     $server->setScheme('http');
     $this->_redirect($server->serverUrl($this->view->url(array('controller' => 'index', 'action' => 'index'))));
     //        $this->_redirect('/');
 }
Exemplo n.º 3
0
Arquivo: Mvc.php Projeto: schpill/thin
 /**
  * Returns href for this page
  *
  * This method uses {@link Zend_Controller_Action_Helper_Url} to assemble
  * the href based on the page's properties.
  *
  * @return string  page href
  */
 public function getHref()
 {
     if ($this->_hrefCache) {
         return $this->_hrefCache;
     }
     if (null === self::$_urlHelper) {
         self::$_urlHelper = \Zend_Controller_Action_HelperBroker::getStaticHelper('Url');
     }
     $params = $this->getParams();
     if ($param = $this->getModule()) {
         $params['module'] = $param;
     }
     if ($param = $this->getController()) {
         $params['controller'] = $param;
     }
     if ($param = $this->getAction()) {
         $params['action'] = $param;
     }
     $url = self::$_urlHelper->url($params, $this->getRoute(), $this->getResetParams(), $this->getEncodeUrl());
     // Use scheme?
     $scheme = $this->getScheme();
     if (null !== $scheme) {
         if (null === self::$_schemeHelper) {
             self::$_schemeHelper = new \Zend_View_Helper_ServerUrl();
         }
         $url = self::$_schemeHelper->setScheme($scheme)->serverUrl($url);
     }
     // Add the fragment identifier if it is set
     $fragment = $this->getFragment();
     if (null !== $fragment) {
         $url .= '#' . $fragment;
     }
     return $this->_hrefCache = $url;
 }