- Moved the loading of the fhcauth from Filters controller to the library FiltersLib

- Added comments
This commit is contained in:
Paolo
2018-06-29 11:24:50 +02:00
parent 99292f93a7
commit 2b15c88410
4 changed files with 14 additions and 14 deletions
@@ -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();
+8 -10
View File
@@ -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))
{
+4
View File
@@ -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)
{
+2
View File
@@ -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');