Merge branch 'master' into permissions

This commit is contained in:
Paolo
2018-06-28 14:52:09 +02:00
72 changed files with 655 additions and 381 deletions
+1 -1
View File
@@ -11,7 +11,7 @@ class APIv1_Controller extends REST_Controller
{
parent::__construct();
// Loads return messages
// Loads helper message to manage returning messages
$this->load->helper('message');
// Loads permission lib
+4 -4
View File
@@ -466,9 +466,9 @@ class DB_Model extends FHC_Model
$tmpTable = trim($table);
// Check parameters
if (empty($tmpTable)) return error(FHC_MODEL_ERROR, FHC_MODEL_ERROR);
if (isEmptyString($tmpTable)) return error(FHC_MODEL_ERROR, FHC_MODEL_ERROR);
if (!empty($alias))
if (!isEmptyString($alias))
{
$tmpTable .= ' AS '.$alias;
}
@@ -568,7 +568,7 @@ class DB_Model extends FHC_Model
$result = array();
// String that represents the pgsql array, better if not empty
if (!empty($string))
if (!isEmptyString($string))
{
// Magic convertion
preg_match_all(
@@ -724,7 +724,7 @@ class DB_Model extends FHC_Model
$result = null;
// If the query is empty don't lose time
if (!empty($query))
if (!isEmptyString($query))
{
// If there are parameters to bind to the query
if (is_array($parametersArray) && count($parametersArray) > 0)
+25 -3
View File
@@ -10,13 +10,24 @@ class FHC_Controller extends CI_Controller
/**
* Standard construct for all the controllers
* - initialize the object properties
* - loads the authentication system
* - loads all the helpers that later are always needed
*/
public function __construct()
{
parent::__construct();
// Set _controllerId as null by default
$this->_controllerId = null;
$this->_controllerId = null; // set _controllerId as null by default
// Loads helper message to manage returning messages
$this->load->helper('message');
// Loads helper with generic utility function
$this->load->helper('fhc');
// Loads helper session to manage the php session
$this->load->helper('session');
}
//------------------------------------------------------------------------------------------------------------------
@@ -47,7 +58,7 @@ class FHC_Controller extends CI_Controller
{
$this->_controllerId = $this->input->get(self::FHC_CONTROLLER_ID);
if (!isset($this->_controllerId) || empty($this->_controllerId))
if (!isset($this->_controllerId) || isEmptyString($this->_controllerId))
{
$this->_controllerId = uniqid(); // generate a unique id
// Redirect to the same URL, but giving FHC_CONTROLLER_ID as HTTP GET parameter
@@ -91,6 +102,17 @@ class FHC_Controller extends CI_Controller
$this->_outputJson(error($mixed));
}
/**
* Terminate the execution of the page after have printed a message encoded to JSON.
* Used directly header and echo to speed up the output before the exit command stops the execution.
*/
protected function terminateWithJsonError($message)
{
header('Content-Type: application/json');
echo json_encode(error($message));
exit;
}
//------------------------------------------------------------------------------------------------------------------
// Private methods
-5
View File
@@ -6,8 +6,6 @@ class FHC_Model extends CI_Model
{
/**
* Standard constructor for all the models
* It loads the helper message to manage the values returned by methods
* It loads the permission library
*/
public function __construct()
{
@@ -16,8 +14,5 @@ class FHC_Model extends CI_Model
// Load languages files
$this->lang->load('fhc_model');
$this->lang->load('fhcomplete');
// Load return message helper
$this->load->helper('message');
}
}
-3
View File
@@ -14,9 +14,6 @@ class FS_Model extends FHC_Model
// Load the filesystem library
$this->load->library('FilesystemLib');
// Load return message helper
$this->load->helper('message');
$this->filepath = $filepath;
}