mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-21 00:42:15 +00:00
- Added private method _checkHTTPS to core/FHC_Controller
- Method _checkHTTPS is called in core/FHC_Controller constructor immediately after the parent constructor call - Method _checkHTTPS checks if the HTTPS protocol is enabled and used, if NOT then an error is raised and the execution is terminated
This commit is contained in:
@@ -21,6 +21,9 @@ abstract class FHC_Controller extends CI_Controller
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
// NOTE: placed here before performing anything else!!!
|
||||
$this->_checkHTTPS();
|
||||
|
||||
$this->_controllerId = null; // set _controllerId as null by default
|
||||
|
||||
// Loads helper message to manage returning messages
|
||||
@@ -129,4 +132,20 @@ abstract class FHC_Controller extends CI_Controller
|
||||
{
|
||||
$this->output->set_content_type('application/json')->set_output(json_encode($mixed));
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
// Private methods
|
||||
|
||||
/**
|
||||
* Checks if the call is performed via web and if HTTPS is enabled and used
|
||||
* If NOT then an error is raised and the execution is terminated
|
||||
*/
|
||||
private function _checkHTTPS()
|
||||
{
|
||||
// If NOT called from command line and if the HTTPS protocol is NOT enabled
|
||||
if (!$this->input->is_cli_request() && !isset($_SERVER['HTTPS']))
|
||||
{
|
||||
show_error('This web site cannot work correctly without the HTTPS protocol enabled');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user