69 lines
1.3 KiB
PHP
69 lines
1.3 KiB
PHP
<?php
|
|
/**
|
|
* Created by Pensare Software.
|
|
* User: Theo Weijmer
|
|
* Date: 05/12/2017
|
|
* Time: 11:02
|
|
*/
|
|
|
|
class MY_Controller extends CI_Controller {
|
|
|
|
public $authenticated;
|
|
public $user;
|
|
public $version;
|
|
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
|
|
$this->version = '1.00.6-a';
|
|
|
|
$this->load->library( 'beheer/session/RetrieveUserSession' );
|
|
|
|
$this->handle();
|
|
}
|
|
|
|
private function handle()
|
|
{
|
|
$this->setSecureSite();
|
|
|
|
$this->retrieveusersession->handle();
|
|
|
|
$this->user = $this->User_model->get( USERID );
|
|
}
|
|
|
|
public function setSecureSite()
|
|
{
|
|
if ( getenv( 'ENVIRONMENT' ) != 'production' ) return;
|
|
|
|
if ( ! isset( $_SERVER["HTTPS"] ) || $_SERVER["HTTPS"] != "on" )
|
|
{
|
|
header( "Location: " . getenv( 'APP_URL' ) );
|
|
|
|
exit;
|
|
}
|
|
}
|
|
|
|
function clean_input( $post )
|
|
{
|
|
$value = $this->input->input_stream( $post, TRUE );
|
|
|
|
$denulledValue = str_replace( 'null', '', $value );
|
|
|
|
return $denulledValue;
|
|
}
|
|
|
|
public function json( $data )
|
|
{
|
|
$this->output
|
|
->set_content_type( 'application/json' )
|
|
->set_output( json_encode( $data ) );
|
|
}
|
|
|
|
public function unAuthorized()
|
|
{
|
|
|
|
}
|
|
|
|
}
|