Newer
Older
<?php defined('SYSPATH') or die('No direct script access.');
class Controller_Authentication extends Controller {
public function before() {
parent::before();
if(UTF8::strcasecmp($this->request->action(), 'logout')) {
$user = User::instance();
if($user->isSignedIn()) {
$request = $user->Type . '/index';
protected function getUpdates()
$fp = fopen(APPPATH.'updates.txt', 'r');
$updates['Date'] = fgets($fp, 999);
$text = '<ol>';
if ($fp) {
while (!feof($fp)) {
$text .= '<li>'.fgets($fp, 999).'</li>';
}
$text .= '</ol>';
$updates['Text'] = $text;
return $updates;
{
if(!User::instance()->isSignedIn())
{
$type = $this->request->param('type');
$type = empty($type)? 'in': $type;
$twig = Twig::factory('sign/'.$type);
$twig->Updates = Model_System::getChangeLog();
public function action_enter_backdoor()
{
$this->sign();
}
public function action_enter_frontdoor()
{
$isNotAdmin = !User::instance()->isAdmin();
if($isNotSigned || $isNotAdmin)
$admission = !$this->check_maintenance();
Andrew Rudenets
committed
if(!User::instance()->isSignedIn())
$this->response->body($twig);
}
}
public function action_endremind()
{
$token = $this->request->param('token');
$message = "Данная ссылка для восстановления пароля более не действительна!\n" .
"Либо истекло время действия ссылки, либо она уже была использована.";
throw HTTP_Exception::factory(403, $message);
if (!User::instance()->isSignedIn()) {
$twig->Token = $token;
$this->response->body($twig);
}
}
public function action_logout()
{
Andrew Rudenets
committed
User::instance()->signOut();
$maintenance_info = Model_Account::getMaintenanceInfo();
if ($maintenance_info['active']) {
$this->response->status(503);
$twig = Twig::factory('errors/http');
$twig->title = 'Закрыто на техобслуживание!';
$twig->code = 503;
$twig->message = "Восстановление работы сервиса: " . $maintenance_info['return'];
$this->response->body($twig);
return true;
}
else
return false;
}
public function action_check_maintenance()
{
$this->check_maintenance();
}