Skip to content
Snippets Groups Projects
Commit 2f256970 authored by PavelBegunkov's avatar PavelBegunkov
Browse files

accounts.php and user.php are not modules yet!

parent 34a51b1f
Branches
Tags
No related merge requests found
...@@ -131,14 +131,13 @@ define('ASSEMBLY_VERSION', '0.9'); ...@@ -131,14 +131,13 @@ define('ASSEMBLY_VERSION', '0.9');
* Enable modules. Modules are referenced by a relative or absolute path. * Enable modules. Modules are referenced by a relative or absolute path.
*/ */
Kohana::modules(array( Kohana::modules(array(
'account' => MODPATH.'account', // Authentication and account manager
'kotwig' => MODPATH.'kotwig', // Twig template engine 'kotwig' => MODPATH.'kotwig', // Twig template engine
'mpdf' => MODPATH.'mpdf', // HTML->PDF converter 'mpdf' => MODPATH.'mpdf', // HTML->PDF converter
'phpexcel' => MODPATH.'phpexcel', // HTML->MS Excel 2007 converter 'phpexcel' => MODPATH.'phpexcel', // HTML->MS Excel 2007 converter
'mailer' => MODPATH.'mail', 'mailer' => MODPATH.'mail',
// 'codebench' => MODPATH.'codebench', // Benchmarking tool // 'codebench' => MODPATH.'codebench', // Benchmarking tool
'database' => MODPATH.'database', // Database access 'database' => MODPATH.'database', // Database access
)); ));
/** /**
* Set the routes. Each route must have a minimum of a name, a URI and a set of * Set the routes. Each route must have a minimum of a name, a URI and a set of
......
...@@ -41,8 +41,8 @@ function gradeSendMail($subject, $body, $sendToEmail, $sendToName) { ...@@ -41,8 +41,8 @@ function gradeSendMail($subject, $body, $sendToEmail, $sendToName) {
} }
} }
class Kohana_Account { class Account {
protected static $_instance; protected static $_instance;
protected $_config; protected $_config;
protected $_model; protected $_model;
...@@ -58,7 +58,7 @@ class Kohana_Account { ...@@ -58,7 +58,7 @@ class Kohana_Account {
} }
return self::$_instance; return self::$_instance;
} }
private function __construct($config = array()) { private function __construct($config = array()) {
$this->_config = $config; $this->_config = $config;
$this->_model = new Model_Account; $this->_model = new Model_Account;
......
...@@ -51,7 +51,11 @@ class Controller_Authentication extends Controller { ...@@ -51,7 +51,11 @@ class Controller_Authentication extends Controller {
public function action_enter_frontdoor() public function action_enter_frontdoor()
{ {
$check = false; $check = false;
$role = (int)User::instance()->RoleMark; try {
$role = (int)User::instance()->RoleMark;
} catch (Exception $e) {
$role = (int)1;
}
$isNotSigned = !User::instance()->isSignedIn(); $isNotSigned = !User::instance()->isSignedIn();
if($isNotSigned || ($role & 8) == 0) // if not signed or not admin if($isNotSigned || ($role & 8) == 0) // if not signed or not admin
......
<?php defined('SYSPATH') or die('No direct script access.'); <?php defined('SYSPATH') or die('No direct script access.');
class Model_Kohana_Account extends Model class Model_Account extends Model
{ {
public function setHashKey($key) public function setHashKey($key)
{ {
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
* @property-read $PasswordHash string * @property-read $PasswordHash string
* @property-read $start_time int * @property-read $start_time int
*/ */
class Kohana_User implements ArrayAccess class User implements ArrayAccess
{ {
protected static $_instance; protected static $_instance;
protected $_session; protected $_session;
......
<?php
class Account extends Kohana_Account { }
\ No newline at end of file
<?php
class Model_Account extends Model_Kohana_Account { }
\ No newline at end of file
<?php
class User extends Kohana_User { }
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment