mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-20 00:12:15 +00:00
- Moved the loading of the fhcauth from Filters controller to the library FiltersLib
- Added comments
This commit is contained in:
@@ -21,10 +21,6 @@ class Filters extends FHC_Controller
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
// Loads authentication helper
|
||||
// NOTE: needed to load custom filters do not remove!
|
||||
$this->load->helper('fhcauth');
|
||||
|
||||
// Loads the FiltersLib with HTTP GET/POST parameters
|
||||
$this->_loadFiltersLib();
|
||||
|
||||
|
||||
@@ -25,16 +25,14 @@ class CallerLib
|
||||
'PersonLogLib'
|
||||
);
|
||||
|
||||
private $_ci; // CI instance
|
||||
|
||||
/**
|
||||
* Object initialization
|
||||
* Library initialization
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
// Gets CI instance
|
||||
$this->ci =& get_instance();
|
||||
|
||||
// Loads permission library
|
||||
$this->ci->load->library('PermissionLib');
|
||||
$this->_ci =& get_instance(); // Gets CI instance
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -80,7 +78,7 @@ class CallerLib
|
||||
elseif (strpos($parameters->resourceName, CallerLib::LIB_PREFIX) !== false)
|
||||
{
|
||||
// Check if the resource is already loaded, it works only with libraries and drivers
|
||||
$isLoaded = $this->ci->load->is_loaded($parameters->resourceName);
|
||||
$isLoaded = $this->_ci->load->is_loaded($parameters->resourceName);
|
||||
// If not loaded then load it
|
||||
if ($isLoaded === false)
|
||||
{
|
||||
@@ -210,7 +208,7 @@ class CallerLib
|
||||
|
||||
try
|
||||
{
|
||||
$loaded = $this->ci->load->model($resourcePath.$resourceName);
|
||||
$loaded = $this->_ci->load->model($resourcePath.$resourceName);
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
@@ -245,7 +243,7 @@ class CallerLib
|
||||
try
|
||||
{
|
||||
// Gets all the configured resources paths
|
||||
$packagePaths = $this->ci->load->get_package_paths();
|
||||
$packagePaths = $this->_ci->load->get_package_paths();
|
||||
// Looking for a file in every paths with the same name of the resource
|
||||
$found = null;
|
||||
for ($i = 0; $i < count($packagePaths) && is_null($found); $i++)
|
||||
@@ -262,7 +260,7 @@ class CallerLib
|
||||
if (!is_null($found))
|
||||
{
|
||||
// Load the file
|
||||
$loaded = $this->ci->load->file($found);
|
||||
$loaded = $this->_ci->load->file($found);
|
||||
// If the resource is not present inside the file
|
||||
if (!class_exists($resourceName))
|
||||
{
|
||||
|
||||
@@ -86,6 +86,9 @@ class FiltersLib
|
||||
{
|
||||
$this->_ci =& get_instance(); // get code igniter instance
|
||||
|
||||
// Loads authentication helper
|
||||
$this->_ci->load->helper('fhcauth'); // NOTE: needed to load custom filters do not remove!
|
||||
|
||||
$this->_filterUniqueId = $this->_getFilterUniqueId($params); // sets the id for the related filter widget
|
||||
}
|
||||
|
||||
@@ -96,6 +99,7 @@ class FiltersLib
|
||||
* Checks if at least one of the permissions given as parameter (requiredPermissions) belongs
|
||||
* to the authenticated user, if confirmed then is allowed to use this FilterWidget.
|
||||
* If the parameter requiredPermissions is NOT given, then no one is allow to use this FilterWidget
|
||||
* NOTE: PermissionLib is loaded hedere
|
||||
*/
|
||||
public function isAllowed($requiredPermissions = null)
|
||||
{
|
||||
|
||||
@@ -249,6 +249,8 @@ class PhrasesLib
|
||||
$language = $parameters[1];
|
||||
}
|
||||
// Checks if the user is authenticated to retrive the users's language
|
||||
// NOTE: this library could be called when the user is not logged in the system
|
||||
// so this is why is checked if the function getAuthUID exists
|
||||
elseif (function_exists('getAuthUID'))
|
||||
{
|
||||
$this->_ci->load->model('person/Person_model', 'PersonModel');
|
||||
|
||||
Reference in New Issue
Block a user