Moved more functions from OSB

This commit is contained in:
Deon George 2016-09-01 14:34:29 +10:00
parent 3086fa2998
commit 81edc432b4
7 changed files with 100 additions and 21 deletions

View File

@ -0,0 +1,3 @@
<?php defined('SYSPATH') OR die('No direct script access.');
class Database_Query_Builder_Join extends lnAuth_Database_Query_Builder_Join {}

4
classes/Minion/Task.php Normal file
View File

@ -0,0 +1,4 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
abstract class Minion_Task extends lnAuth_Minion_Task {}
?>

4
classes/Request.php Normal file
View File

@ -0,0 +1,4 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
class Request extends lnAuth_Request {}
?>

View File

@ -0,0 +1,20 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class extends Kohana's [Database_Query_Builder_Join] to ensure that we have a site_id in join statements
*
* @package lnAuth
* @category Helpers
* @author Deon George
* @copyright (c) 2009-2013 Deon George
* @license http://dev.leenooks.net/license.html
*/
abstract class lnAuth_Database_Query_Builder_Join extends Kohana_Database_Query_Builder_Join {
public function compile($db = NULL) {
$this->_on[] = array($this->_table.'.site_id','=',Site::id());
return parent::compile($db);
}
}
?>

View File

@ -0,0 +1,25 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class overrides Kohana's Minion CLI Module
*
* @package lnAuth
* @category Helpers
* @author Deon George
* @copyright (c) 2009-2013 Deon George
* @license http://dev.leenooks.net/license.html
*/
abstract class lnAuth_Minion_Task extends Kohana_Minion_Task {
protected $_sysoptions = array(
'site'=>NULL,
);
/**
* Override our __construct so that we can specify options in each class file
*/
protected function __construct() {
// Populate $_accepted_options based on keys from $_options
$this->_accepted_options = array_keys(Arr::merge($this->_sysoptions,$this->_options));
}
}
?>

View File

@ -58,27 +58,6 @@ abstract class lnAuth_Model_Module_Method extends ORM {
return $this->menu_display ? $this->menu_display : sprintf('%s: %s',$this->module->name,$this->name); return $this->menu_display ? $this->menu_display : sprintf('%s: %s',$this->module->name,$this->name);
} }
/**
* Get our Module_Method object for this request
*/
public function request_mmo(Request $ro) {
list($c,$x) = substr_count($ro->controller(),'_') ? explode('_',$ro->controller(),2) : array($ro->controller(),'');
$mo = ORM::factory('Module',array('name'=>$c));
if ($mo->loaded() AND $mo->active) {
$method = strtolower($ro->directory() ? sprintf('%s:%s',$ro->directory() ? $ro->directory().($x ? '_'.$x : '') : $ro->action(),$ro->action()) : $ro->action());
// Get the method number
$mmo = $mo->module_method
->where('name','=',$method)
->find();
if ($mmo->loaded())
return $mmo;
}
}
public function status($status=NULL) { public function status($status=NULL) {
if ($status) if ($status)
$this->status = $status; $this->status = $status;

View File

@ -0,0 +1,44 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* Request. Uses the [Route] class to determine what
* [Controller] to send the request to.
*
* @package lnAuth
* @category Modifications
* @author Deon George
* @copyright (c) 2009-2013 Deon George
* @license http://dev.leenooks.net/license.html
*/
abstract class lnAuth_Request extends lnApp_Request {
/**
* Get our Module_Method object for this request
*/
public function mmo() {
static $result = FALSE;
if (is_null($result) OR $result)
return $result;
$result = NULL;
list($c,$x) = substr_count($this->_controller,'_') ? explode('_',$this->_controller,2) : array($this->_controller,'');
$mo = ORM::factory('Module',array('name'=>$c));
if ($mo->loaded() AND $mo->active) {
$method = strtolower($this->_directory ? sprintf('%s:%s',$this->_directory.($x ? '_'.$x : ''),$this->_action) : $this->_action);
// Get the method number
$mmo = $mo->module_method
->where('name','=',$method)
->find();
if ($mmo->loaded())
$result = $mmo;
}
return $result;
}
}
?>