/** * Starts a session in the admin backend */ public function loginAction() { \Phalcon\Tag::appendTitle(" - Вход"); $form = new LoginForm(); try { if (!$this->request->isPost()) { if ($this->auth->hasRememberMe()) { return $this->auth->loginWithRememberMe(); } } else { if ($form->isValid($this->request->getPost()) == false) { foreach ($form->getMessages() as $message) { $this->flash->error($message); } } else { $this->auth->check(array('email' => $this->request->getPost('email', 'email'), 'password' => $this->request->getPost('password'), 'remember' => $this->request->getPost('remember'))); $auth = $this->session->get('auth'); $this->flashSession->notice($auth['role']); if (!$auth) { $this->flashSession->notice("Нужно войти или зарегистрироваться"); return $this->response->redirect("session/login"); } if ($auth['role'] == 'Administrators') { $this->flashSession->success("Здравствуйте администратор. Вы находитесь в области управления сайтом, в разделе Новости."); return $this->response->redirect("backend/news"); } return $this->response->redirect(); } } } catch (AuthException $e) { $this->flash->error($e->getMessage()); } $this->view->form = $form; }
public function testSetTitleSeparator() { Tag::setTitle('Title'); Tag::appendTitle('Class'); $this->assertEquals(Tag::getTitle(), '<title>TitleClass</title>' . PHP_EOL); Tag::setTitle('Title'); Tag::setTitleSeparator('|'); Tag::appendTitle('Class'); $this->assertEquals(Tag::getTitle(), '<title>Title|Class</title>' . PHP_EOL); $this->assertEquals(Tag::getTitleSeparator(), '|'); Tag::setTitle('Title'); Tag::setTitleSeparator('|'); Tag::prependTitle('Class'); $this->assertEquals(Tag::getTitle(), '<title>Class|Title</title>' . PHP_EOL); }
public static function appendTitle($title) { parent::appendTitle($title); }
/** * Tests appendTitle * * @author Nikos Dimopoulos <*****@*****.**> * @since 2012-09-05 */ public function testAppendTitle() { $value = 'This is my title'; \Phalcon\Tag::setTitle($value); $append = ' - Welcome!'; \Phalcon\Tag::appendTitle($append); $expected = "<title>{$value}{$append}</title>" . PHP_EOL; $actual = \Phalcon\Tag::getTitle(); $this->assertEquals($expected, $actual, sprintf($this->message, 'appendTitle')); }