diff --git a/application/Bootstrap.php b/application/Bootstrap.php index ad678f9..c3e1223 100644 --- a/application/Bootstrap.php +++ b/application/Bootstrap.php @@ -60,6 +60,7 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap // Set helper path $view->addHelperPath('Fiktiv/View/Helper/', 'Fiktiv_View_Helper'); + $view->app = $this->getApplication()->getOption('app'); return $view; } diff --git a/application/configs/application.ini b/application/configs/application.ini index 06a3b61..bdc176f 100644 --- a/application/configs/application.ini +++ b/application/configs/application.ini @@ -17,6 +17,7 @@ db.host = 127.0.0.1 db.username = fiktivkod db.password = pw db.dbname = fiktivkod +db.port = 4401 [development : production] diff --git a/application/models/User.php b/application/models/User.php deleted file mode 100644 index 73e657a..0000000 --- a/application/models/User.php +++ /dev/null @@ -1,11 +0,0 @@ -fetchAll(); - - foreach ($users as $u) { - echo $u->firstName."
"; - } } } diff --git a/application/modules/blog/views/scripts/index/index.phtml b/application/modules/blog/views/scripts/index/index.phtml index 49daeac..a7881c7 100644 --- a/application/modules/blog/views/scripts/index/index.phtml +++ b/application/modules/blog/views/scripts/index/index.phtml @@ -1 +1,3 @@ -Blog > Index > Index \ No newline at end of file +

translate('u:blog') ?>

+ +

translate('BLOG_TXT') ?>

\ No newline at end of file diff --git a/application/modules/default/controllers/AuthController.php b/application/modules/default/controllers/AuthController.php index b9c8781..108fee7 100644 --- a/application/modules/default/controllers/AuthController.php +++ b/application/modules/default/controllers/AuthController.php @@ -1,10 +1,9 @@ setLabel($this->translate('u:email')) + ->setRequired(true) + ->addValidator(new Zend_Validate_EmailAddress()); + + $passwordElement = new Zend_Form_Element_Password('password'); + $passwordElement->setLabel($this->translate('u:password')) + ->setRequired(true); + + $buttonElement = new Zend_Form_Element_Submit('login'); + + $form->addElements(array($emailElement, $passwordElement, $buttonElement)); + + if ($this->_request->isPost() && $form->isValid($this->_request->getParams())) { + + $users = new Users(); + + if ($users->login($this->_request->getParam('email'), $this->_request->getParam('password'))) { + + // TODO: redirect user + } else { + // TODO: Wrong email / password + echo "Wrong email / password"; + } + } + + echo "You are "; + $auth = Zend_Auth::getInstance(); + if ($auth->hasIdentity()) { + $user = $auth->getIdentity(); + echo $user->firstName; + } else { + echo "Nobody"; + } + + $this->view->form = $form; + } /** @@ -22,6 +60,11 @@ class AuthController extends Zend_Controller_Action public function logoutAction() { // Destroy the magic! + $auth = Zend_Auth::getInstance(); + + $auth->clearIdentity(); + + $this->_redirect('/'); } } \ No newline at end of file diff --git a/application/modules/default/views/layout/default.phtml b/application/modules/default/views/layout/default.phtml index 9272e86..54dc124 100644 --- a/application/modules/default/views/layout/default.phtml +++ b/application/modules/default/views/layout/default.phtml @@ -3,7 +3,7 @@ headTitle() . "\n" /* Newline for pretty source :) */ ?> - headMeta() . "\n" ?> + headMeta() . "\n" /* Newline for pretty source :) */ ?> @@ -13,8 +13,8 @@ @@ -22,5 +22,10 @@ layout()->content ?> + \ No newline at end of file diff --git a/application/modules/default/views/scripts/index/about.phtml b/application/modules/default/views/scripts/index/about.phtml index 60f8514..f635566 100644 --- a/application/modules/default/views/scripts/index/about.phtml +++ b/application/modules/default/views/scripts/index/about.phtml @@ -1 +1,3 @@ -About \ No newline at end of file +

translate('uw:about') ?>

+ +

translate('ABOUT_TXT') ?>

\ No newline at end of file diff --git a/application/modules/default/views/scripts/index/index.phtml b/application/modules/default/views/scripts/index/index.phtml index e13c823..4c7f57c 100644 --- a/application/modules/default/views/scripts/index/index.phtml +++ b/application/modules/default/views/scripts/index/index.phtml @@ -1,4 +1,8 @@ -Do nothing! +

app['url']) ?>

+ +

translate('START_TXT') ?>

+ +

Translated: translate('uw:example', 'home', 'about', true) ?>

diff --git a/library/Fiktiv/Translate/Adapter.php b/library/Fiktiv/Translate/Adapter.php index 7887e2f..44e0769 100644 --- a/library/Fiktiv/Translate/Adapter.php +++ b/library/Fiktiv/Translate/Adapter.php @@ -47,6 +47,12 @@ abstract class Fiktiv_Translate_Adapter extends Zend_Translate_Adapter case 'ua': return strtoupper($text); break; + case 'l': + return strtolower($text[0]); + break; + case 'la': + return strtolower($text); + break; } }