diff --git a/application/classes/Auth/OSB.php b/application/classes/Auth/OSB.php index 19c7e5bc..3f2e01d2 100644 --- a/application/classes/Auth/OSB.php +++ b/application/classes/Auth/OSB.php @@ -21,11 +21,6 @@ class Auth_OSB extends Auth_ORM { * @return boolean */ public function logged_in($role=NULL,$debug=NULL) { - static $status = NULL; - - if (! is_null($status)) - return $status; - $status = FALSE; // Get the user from the session @@ -109,11 +104,6 @@ class Auth_OSB extends Auth_ORM { $status = TRUE; } - // Check and see if we have a token to login and run the method - } elseif ((! empty($_REQUEST['token']) AND $token = $_REQUEST['token']) OR $token=Session::instance()->get('token')) { - if (! is_null($this->_get_token_user($token))) - $status = TRUE; - } else { if (Config::sitemode() == Kohana::DEVELOPMENT) SystemMessage::add(array('title'=>'Debug','type'=>'debug','body'=>'No user logged in')); @@ -130,10 +120,11 @@ class Auth_OSB extends Auth_ORM { * @return mixed */ public function get_user($default=NULL,$tokenuser=TRUE) { + // Get the current user $uo = parent::get_user($default); // If we are not logged in, see if there is token for the user - if (is_null($uo) AND $tokenuser AND $token=Session::instance()->get('token')) + if (is_null($uo) AND $tokenuser AND ($token=Session::instance()->get('token')) OR (! empty($_REQUEST['token']) AND $token=$_REQUEST['token'])) $uo = $this->_get_token_user($token); return $uo; diff --git a/application/classes/Controller/TemplateDefault.php b/application/classes/Controller/TemplateDefault.php index cdea26b5..e7ed22d7 100644 --- a/application/classes/Controller/TemplateDefault.php +++ b/application/classes/Controller/TemplateDefault.php @@ -17,7 +17,7 @@ class Controller_TemplateDefault extends lnApp_Controller_TemplateDefault { public function __construct(Request $request, Response $response) { if (Config::theme()) - $this->template = 'theme/'.Config::theme().'/page'; + $this->template = Config::theme().'/page'; return parent::__construct($request,$response); } @@ -56,6 +56,7 @@ class Controller_TemplateDefault extends lnApp_Controller_TemplateDefault { throw new Kohana_Exception('Class has no security defined :class, or no security configured for :method',array(':class'=>get_class($this),':method'=>Request::current()->action())); $this->ao = Auth::instance()->get_user(); + if (! is_null($this->ao) AND (is_string($this->ao) OR ! $this->ao->loaded())) throw HTTP_Exception::factory(501,'Account doesnt exist :account ?',array(':account'=>(is_string($this->ao) OR is_null($this->ao)) ? $this->ao : Auth::instance()->get_user()->id)); } diff --git a/application/classes/Kohana/Exception.php b/application/classes/Kohana/Exception.php index 6354d239..2ab18210 100644 --- a/application/classes/Kohana/Exception.php +++ b/application/classes/Kohana/Exception.php @@ -46,9 +46,8 @@ class Kohana_Exception extends Kohana_Kohana_Exception { SystemMessage::add(array( 'title'=>'An Error Occured.', 'type'=>'error', - 'body'=>'A error occured, which has been logged.', + 'body'=>'Dont panic, its been logged.', )); - // We'll redirect to the main page. $response = Response::factory(); diff --git a/modules/lnApp/classes/lnApp/Controller/Media.php b/modules/lnApp/classes/lnApp/Controller/Media.php index f9ecda82..70f5e55c 100644 --- a/modules/lnApp/classes/lnApp/Controller/Media.php +++ b/modules/lnApp/classes/lnApp/Controller/Media.php @@ -31,7 +31,7 @@ abstract class lnApp_Controller_Media extends Controller { $this->response->body($fd); // First try and find media files for the theme-site_id - } elseif ($f = Kohana::find_file($x=sprintf('media/site/%s/theme/%s',Config::siteid(),Config::theme()),$file,$ext)) { + } elseif ($f = Kohana::find_file($x=sprintf('media/site/%s/%s',Config::siteid(),Config::theme()),$file,$ext)) { // Send the file content as the response $this->response->body(file_get_contents($f));