From 2f256970754b72850a15e713848ea146f508fb88 Mon Sep 17 00:00:00 2001 From: PavelBegunkov <asml.Silence@gmail.com> Date: Tue, 9 Jun 2015 12:13:10 +0300 Subject: [PATCH] accounts.php and user.php are not modules yet! --- ~dev_rating/application/bootstrap.php | 7 +++---- .../classes/Kohana => application/classes}/Account.php | 6 +++--- .../application/classes/Controller/Authentication.php | 6 +++++- .../Model/Kohana => application/classes/Model}/Account.php | 2 +- .../classes/Kohana => application/classes}/User.php | 2 +- ~dev_rating/modules/account/classes/Account.php | 3 --- ~dev_rating/modules/account/classes/Model/Account.php | 3 --- ~dev_rating/modules/account/classes/User.php | 3 --- 8 files changed, 13 insertions(+), 19 deletions(-) rename ~dev_rating/{modules/account/classes/Kohana => application/classes}/Account.php (99%) rename ~dev_rating/{modules/account/classes/Model/Kohana => application/classes/Model}/Account.php (99%) rename ~dev_rating/{modules/account/classes/Kohana => application/classes}/User.php (99%) delete mode 100644 ~dev_rating/modules/account/classes/Account.php delete mode 100644 ~dev_rating/modules/account/classes/Model/Account.php delete mode 100644 ~dev_rating/modules/account/classes/User.php diff --git a/~dev_rating/application/bootstrap.php b/~dev_rating/application/bootstrap.php index ffa030d01..4c0c7c9a2 100644 --- a/~dev_rating/application/bootstrap.php +++ b/~dev_rating/application/bootstrap.php @@ -131,14 +131,13 @@ define('ASSEMBLY_VERSION', '0.9'); * Enable modules. Modules are referenced by a relative or absolute path. */ Kohana::modules(array( - 'account' => MODPATH.'account', // Authentication and account manager 'kotwig' => MODPATH.'kotwig', // Twig template engine 'mpdf' => MODPATH.'mpdf', // HTML->PDF converter 'phpexcel' => MODPATH.'phpexcel', // HTML->MS Excel 2007 converter 'mailer' => MODPATH.'mail', - // 'codebench' => MODPATH.'codebench', // Benchmarking tool - 'database' => MODPATH.'database', // Database access - )); + // 'codebench' => MODPATH.'codebench', // Benchmarking tool + 'database' => MODPATH.'database', // Database access + )); /** * Set the routes. Each route must have a minimum of a name, a URI and a set of diff --git a/~dev_rating/modules/account/classes/Kohana/Account.php b/~dev_rating/application/classes/Account.php similarity index 99% rename from ~dev_rating/modules/account/classes/Kohana/Account.php rename to ~dev_rating/application/classes/Account.php index 18091f4d5..fcf48e90e 100644 --- a/~dev_rating/modules/account/classes/Kohana/Account.php +++ b/~dev_rating/application/classes/Account.php @@ -41,8 +41,8 @@ function gradeSendMail($subject, $body, $sendToEmail, $sendToName) { } } -class Kohana_Account { - +class Account { + protected static $_instance; protected $_config; protected $_model; @@ -58,7 +58,7 @@ class Kohana_Account { } return self::$_instance; } - + private function __construct($config = array()) { $this->_config = $config; $this->_model = new Model_Account; diff --git a/~dev_rating/application/classes/Controller/Authentication.php b/~dev_rating/application/classes/Controller/Authentication.php index b64e00557..81fe1806f 100644 --- a/~dev_rating/application/classes/Controller/Authentication.php +++ b/~dev_rating/application/classes/Controller/Authentication.php @@ -51,7 +51,11 @@ class Controller_Authentication extends Controller { public function action_enter_frontdoor() { $check = false; - $role = (int)User::instance()->RoleMark; + try { + $role = (int)User::instance()->RoleMark; + } catch (Exception $e) { + $role = (int)1; + } $isNotSigned = !User::instance()->isSignedIn(); if($isNotSigned || ($role & 8) == 0) // if not signed or not admin diff --git a/~dev_rating/modules/account/classes/Model/Kohana/Account.php b/~dev_rating/application/classes/Model/Account.php similarity index 99% rename from ~dev_rating/modules/account/classes/Model/Kohana/Account.php rename to ~dev_rating/application/classes/Model/Account.php index ff183b7d6..87607624c 100644 --- a/~dev_rating/modules/account/classes/Model/Kohana/Account.php +++ b/~dev_rating/application/classes/Model/Account.php @@ -1,6 +1,6 @@ <?php defined('SYSPATH') or die('No direct script access.'); -class Model_Kohana_Account extends Model +class Model_Account extends Model { public function setHashKey($key) { diff --git a/~dev_rating/modules/account/classes/Kohana/User.php b/~dev_rating/application/classes/User.php similarity index 99% rename from ~dev_rating/modules/account/classes/Kohana/User.php rename to ~dev_rating/application/classes/User.php index 0db3e6942..181fe2902 100644 --- a/~dev_rating/modules/account/classes/Kohana/User.php +++ b/~dev_rating/application/classes/User.php @@ -28,7 +28,7 @@ * @property-read $PasswordHash string * @property-read $start_time int */ -class Kohana_User implements ArrayAccess +class User implements ArrayAccess { protected static $_instance; protected $_session; diff --git a/~dev_rating/modules/account/classes/Account.php b/~dev_rating/modules/account/classes/Account.php deleted file mode 100644 index f59c365e6..000000000 --- a/~dev_rating/modules/account/classes/Account.php +++ /dev/null @@ -1,3 +0,0 @@ -<?php - -class Account extends Kohana_Account { } \ No newline at end of file diff --git a/~dev_rating/modules/account/classes/Model/Account.php b/~dev_rating/modules/account/classes/Model/Account.php deleted file mode 100644 index 564605891..000000000 --- a/~dev_rating/modules/account/classes/Model/Account.php +++ /dev/null @@ -1,3 +0,0 @@ -<?php - -class Model_Account extends Model_Kohana_Account { } \ No newline at end of file diff --git a/~dev_rating/modules/account/classes/User.php b/~dev_rating/modules/account/classes/User.php deleted file mode 100644 index 62449146b..000000000 --- a/~dev_rating/modules/account/classes/User.php +++ /dev/null @@ -1,3 +0,0 @@ -<?php - -class User extends Kohana_User { } \ No newline at end of file -- GitLab