Minor fixes to ssl and core

This commit is contained in:
Deon George
2011-12-30 10:54:54 +11:00
parent 4a68621fc7
commit 125407656d
9 changed files with 77 additions and 13 deletions

View File

@@ -23,8 +23,8 @@ class Controller_TemplateDefault_User extends Controller_TemplateDefault {
parent::before();
$this->ao = Auth::instance()->get_user();
if (! $this->ao->loaded())
throw new Kohana_Exception('Account doesnt exist :account ?',array(':account'=>Auth::instance()->get_user()->id));
if (is_string($this->ao) OR ! $this->ao->loaded())
throw new Kohana_Exception('Account doesnt exist :account ?',array(':account'=>is_string($this->ao) ? $this->ao : Auth::instance()->get_user()->id));
}
public function after() {

View File

@@ -0,0 +1,36 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class overrides Kohana's Core
*
* @package OSB/Modifications
* @category Classes
* @category Helpers
* @author Deon George
* @copyright (c) 2010 Deon George
* @license http://dev.leenooks.net/license.html
*/
class Kohana extends Kohana_Core {
/**
* Override Kohana's shutdown_handler()
*
* When set up for multi-site, we need to disable Kohana's caching
* unless each site has exactly the same modules enabled.
* This is because Kohana::$file is cached with the enabled modules
* and is not OSB multi-site aware.
*
* @todo It might be nice to cache the Kohana::$file site-aware for improved performance
*/
public static function shutdown_handler() {
// If caching isnt enabled, we can skip this anyway
if (! Kohana::$caching)
return parent::shutdown_handler();;
Kohana::$caching = FALSE;
$result = parent::shutdown_handler();
Kohana::$caching = TRUE;
return $result;
}
}
?>

View File

@@ -124,6 +124,7 @@ class ORM extends Kohana_ORM {
->from($this->_has_many[$alias]['through'])
->where($this->_has_many[$alias]['foreign_key'], '=', $this->pk())
->where($this->_has_many[$alias]['far_key'], 'IN', $far_keys)
->where('site_id', '=', Config::siteid())
->execute($this->_db)->get('records_found');
}
}