diff --git a/application/bootstrap.php b/application/bootstrap.php index 6b2aab5e14691676028df7344404feb5addb419a..d07975eba7f59cd83a44d95ff4c6415cfa0aeb47 100644 --- a/application/bootstrap.php +++ b/application/bootstrap.php @@ -158,7 +158,7 @@ Route::set('remind', 'remind') 'action' => 'remind', )); -Route::set('logout', 'logout') +Route::set('sign/out', 'logout') ->defaults(array( 'controller' => 'authentication', 'action' => 'logout', diff --git a/application/classes/Controller/Twig.php b/application/classes/Controller/Twig.php index 198f8745b825c1b9429a0a822c7a7f0dcc25a072..5f1a70883aba3972e7974ca99db28c2fb066a5d2 100644 --- a/application/classes/Controller/Twig.php +++ b/application/classes/Controller/Twig.php @@ -12,11 +12,7 @@ class Controller_Twig extends Controller { $this->response->body($twig); } else - { - $twig = Twig::factory('errors/404'); - $twig->message = 'Шаблончик-то РЅРµ найден!'; - $this->response->status(404)->body($twig); - } + throw HTTP_Exception::factory (404, 'Рскомый шаблон РЅРµ найден'); } } // End Welcome diff --git a/application/classes/Controller/UserEnvi.php b/application/classes/Controller/UserEnvi.php index 0f33b0ba9fed8d0b9193f85475a921c43fa4981e..9e9510472c54de9e718b0eb6272871a903afbb5d 100644 --- a/application/classes/Controller/UserEnvi.php +++ b/application/classes/Controller/UserEnvi.php @@ -21,7 +21,7 @@ class Controller_UserEnvi extends Controller { unset($this->UserInfo['Type']); $directory = $this->request->directory(); if(!empty($directory) && UTF8::strcasecmp($this->request->directory(), $user['Type'])) - throw HTTP_Exception::factory(404, 'РќРµ пытайтесь попасть туда, РєСѓРґР° попадать РЅРµ следует.'); + throw HTTP_Exception::factory(403, 'РќРµ пытайтесь попасть туда, РєСѓРґР° попадать РЅРµ следует.'); } } diff --git a/application/classes/HTTP/Exception.php b/application/classes/HTTP/Exception.php index 3e4cd91ad585d28f6a109a909c080fa05003aff3..96feb7353957d2fa3c79e485075c5414986a4410 100644 --- a/application/classes/HTTP/Exception.php +++ b/application/classes/HTTP/Exception.php @@ -14,21 +14,15 @@ class HTTP_Exception extends Kohana_HTTP_Exception { { // Lets log the Exception, Just in case it's important! Kohana_Exception::log($this); - - if (Kohana::$environment >= Kohana::DEVELOPMENT) - { - // Show the normal Kohana error page. - return parent::get_response(); - } - else - { - // Generate a nicer looking "Oops" page. - $twig = Twig::factory('errors/default'); - $response = Response::factory() - ->status($this->getCode()) - ->body($twig); - - return $response; - } + + $twig = Twig::factory('errors/http'); + $twig->code = $this->getCode(); + $twig->message = $this->getMessage(); + $twig->link = URL::site(''); + $response = Response::factory() + ->status($this->getCode()) + ->body($twig); + + return $response; } } \ No newline at end of file diff --git a/application/classes/HTTP/Exception/404.php b/application/classes/HTTP/Exception/404.php deleted file mode 100644 index 5710071fc2eb5f9f66e92ee4cddf04ed6b6de6dd..0000000000000000000000000000000000000000 --- a/application/classes/HTTP/Exception/404.php +++ /dev/null @@ -1,24 +0,0 @@ -<?php defined('SYSPATH') or die('No direct script access.'); - -class HTTP_Exception_404 extends Kohana_HTTP_Exception_404 { - - /** - * Generate a Response for the 404 Exception. - * - * The user should be shown a nice 404 page. - * - * @return Response - */ - public function get_response() - { - $twig = Twig::factory('errors/404'); - - // Remembering that `$this` is an instance of HTTP_Exception_404 - $twig->message = $this->getMessage(); - $response = Response::factory() - ->status(404) - ->body($twig); - - return $response; - } -} \ No newline at end of file diff --git a/application/views/base.twig b/application/views/base.twig index a429e58bf8c86ff33338a836c41f63977f4365ab..707bf4bdc1ffd78120b0167e15c404509abb9b1c 100644 --- a/application/views/base.twig +++ b/application/views/base.twig @@ -20,7 +20,7 @@ <div class="top_user"> {{ User.FirstName }} {{ User.LastName }} {{ HTML.anchor('settings', 'Настройки', {'title': 'Настройки аккаунта'})|raw }} - {{ HTML.anchor('logout', 'Выход', {'title': 'Выход РёР· системы'})|raw }} + {{ HTML.anchor('sign/out', 'Выход', {'title': 'Выход РёР· системы'})|raw }} </div> </div> </div> diff --git a/application/views/errors/404.twig b/application/views/errors/404.twig deleted file mode 100644 index 1094832f2deb496384c48ce84f435c0991248ec4..0000000000000000000000000000000000000000 --- a/application/views/errors/404.twig +++ /dev/null @@ -1,20 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <title>{% block pagename %}Ошибочка вышла!{% endblock %}</title> - {{ HTML.style('media/css/error.css')|raw }} - <meta charset="UTF-8"> - <meta name="viewport" content="width=device-width, initial-scale=1.0"> - </head> - <body> - <div class='page_layout'> - <div class='content_box'> - <div class='error'>404</div> - <div class='message'>{{ message }}</div> - </div> - <div class='footer'> - Создано отборными рабами<br>Южного Федерального Университета © 2014 - </div> - </div> - </body> -</html> diff --git a/application/views/errors/default.twig b/application/views/errors/default.twig deleted file mode 100644 index 0cf45b3354eaf8f8df81ce5cdf10c3682429644c..0000000000000000000000000000000000000000 --- a/application/views/errors/default.twig +++ /dev/null @@ -1,24 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <title>{% block pagename %}Р’С…РѕРґ РІ систему | MM'Rate{% endblock %}</title> - {{ HTML.style('media/css/error.css')|raw }} - <meta charset="UTF-8"> - <meta name="viewport" content="width=device-width, initial-scale=1.0"> - </head> - <body> - <div class='layout'> - <div class='generalXYNTA'> - <div class='XYNTA'> - <div class='box'> - <div class='error'>Беда!</div> - <div class='message'>{{ message }}</div> - </div> - </div> - <div class='footer'> - Создано отборными рабами<br>Южного Федерального Университета © 2014 - </div> - </div> - </div> - </body> -</html> diff --git a/application/views/errors/http.twig b/application/views/errors/http.twig new file mode 100644 index 0000000000000000000000000000000000000000..7d6ba22f84813bb69f0ebce21ac9ba3efe022172 --- /dev/null +++ b/application/views/errors/http.twig @@ -0,0 +1,44 @@ +<!DOCTYPE html> +<html> + <head> + <title>{% block pagename %}Ошибка{% endblock %} | {{ System.Title }}</title> + {{ HTML.style('media/css/sign.css')|raw }} + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + </head> + <body> + <div class="header_wrapper"> + <div class="header"> + <div class="top_logo"> + {{ System.Title }} + </div> + <div class="top_name_faculty"> + {{ User.FacultyName }} + </div> + <div class="top_user"> + Ошибка + </div> + </div> + </div> + <div class='auth_layout'> + <div class="sign_form"> + <div class="main"> + <div class="top"> + <div class="top_title">Ошибка</div> + </div> + + <div class="content_wrapper"> + <div class="content" style="text-align: center;"> + <div style="font-size: 100px;">{{ code }}</div> + <div style="color: #999; font-size: 12px;">{{ message }}</div> + <div><a href="{{ link }}" style='font-size: 12px; color: #0183ce; text-decoration: none;'>Вернуться РЅР° главную страницу</a></div> + </div> + </div> + </div> + </div> + <div class='footer'> + <a href='http://vk.com/itlab_mmcs'>IT-лаборатория мехмата ЮФУ © 2014</a> + </div> + </div> + </body> +</html> \ No newline at end of file