data = add_csrf_token($this->data);
$this->load_default_language();
if ($caller !== "auth") $this->check_login_status();
$this->get_login_user_data();
/* Initialize BO users */
Page::initBOUserRoles();
/* Initialize current user privileges */
if ( UserAuth::isBOUser() )
Page::initUserPrivileges();
}
protected function frontoffice_parent_controller()
{
parent::__construct();
$this->data = add_csrf_token($this->data);
$this->load_default_language();
$this->check_login_status();
$this->get_login_user_data();
}
/**
* Get session data
* @return void
*/
protected function get_login_user_data() {
$this->data['logged_in'] = UserAuth::auth();
}
protected function clear_cache(){
$this->output->set_header("Cache-Control: no-store, no-cache, must-revalidate, no-transform, max-age=0, post-check=0, pre-check=0");
$this->output->set_header("Pragma: no-cache");
}
public function load_default_language(){
$this->lang->load('system', 'fr');
}
public function load_language_backoffice(){
$this->lang->load('system', 'fr');
$this->lang->load('backoffice/system_message', 'fr');
}
public function load_language_frontoffice(){
$this->lang->load('system', 'fr');
$this->lang->load('frontoffice/homepage', 'fr');
$this->lang->load('frontoffice/system_config', 'fr');
}
protected function check_instance_of_reservation_modal(){
/*check which page is currently being accessed*/
if($this->data["logged_in"]) {
if(isset($this->data["logged_in"]['rs_action']) && !empty($this->data["logged_in"]['rs_action']))
{
$current_url = str_replace("?/","",current_url());
$base_url = base_url();
$found = false;
$search_items = ['home','event_details','my_account','faq','mentions-legales','contact'];
foreach($search_items as $search){
$found = strpos($current_url, $search);
if($found){
break;
}
}
/* check if there is active lock for the current session then release the lock
when one of these pages are currently being accessed */
if(($current_url === $base_url || $found) && $this->data["logged_in"]){
if(isset($this->data["logged_in"]['rs_action']) && !empty($this->data["logged_in"]['rs_action'])) {
$this->load->model('event_concurrent_process_model');
$check = $this->event_concurrent_process_model->unlock_action($this->data["logged_in"]['user_id'], $this->data["logged_in"]['login_id'], $this->data["logged_in"]['rs_action']['process_reference'], $this->data["logged_in"]['rs_action']['process_type']);
//remove from session
unset($this->data["logged_in"]['rs_action']);
if($this->session->userdata('first_logged_in')) {
unset($this->data["logged_in"]['rs_action']);
$this->session->set_userdata('first_logged_in', $this->data["logged_in"]);
} else if($this->session->userdata('logged_in')) {
$this->session->set_userdata('logged_in', $this->data["logged_in"]);
}
}
}
} // Second if
} // First if
}
public function load_extra_files($with=array()){
if(!isset($this->data["load_styles"]) && empty($this->data['load_styles'])) {
$this->data['load_styles'] = array();
}
if(!isset($this->data["load_scripts"]) && empty($this->data['load_scripts'])) {
$this->data['load_scripts'] = array();
}
if(isset($with["ajax_helper"]) && $with["ajax_helper"]){
array_push($this->data['load_scripts'], '');
}
if(isset($with["datatable"]) && $with["datatable"]){
array_push($this->data['load_styles'], '');
array_push($this->data['load_styles'], '');
array_push($this->data['load_styles'], '');
array_push($this->data['load_scripts'], '');
array_push($this->data['load_scripts'], '');
array_push($this->data['load_scripts'], '');
array_push($this->data['load_scripts'], '');
array_push($this->data['load_scripts'], '');
array_push($this->data['load_scripts'], '');
}
if(isset($with["moment"]) && $with["moment"]){
array_push($this->data['load_scripts'], '');
array_push($this->data['load_scripts'], '');
array_push($this->data['load_scripts'], '');
array_push($this->data['load_scripts'], '');
}
if(isset($with["datetime"]) && $with["datetime"]){
array_push($this->data['load_styles'], '');
// array_push($this->data['load_styles'], '');
array_push($this->data['load_styles'], '');
array_push($this->data['load_scripts'], '');
array_push($this->data['load_scripts'], '');
array_push($this->data['load_scripts'], '');
array_push($this->data['load_scripts'], '');
// array_push($this->data['load_scripts'], '');
array_push($this->data['load_scripts'], '');
}
if(isset($with["money_formatter"]) && $with["money_formatter"]){
array_push($this->data['load_scripts'], '');
array_push($this->data['load_scripts'], '');
}
if(isset($with["tinymce"]) && $with["tinymce"]){
array_push($this->data['load_scripts'], '');
array_push($this->data['load_scripts'], '');
}
if(isset($with["tinymcev5"]) && $with["tinymcev5"]){
array_push($this->data['load_scripts'], '');
array_push($this->data['load_scripts'], '');
array_push($this->data['load_scripts'], '');
}
if(isset($with["form_validator"]) && $with["form_validator"]){
array_push($this->data['load_styles'], '');
array_push($this->data['load_styles'], '');
array_push($this->data['load_scripts'], '');
array_push($this->data['load_scripts'], '');
}
if(isset($with["bootbox"]) && $with["bootbox"]){
array_push($this->data['load_scripts'], '');
array_push($this->data['load_scripts'],'');
}
if(isset($with["dotdotdot"]) && $with["dotdotdot"]){
array_push($this->data['load_scripts'], '');
array_push($this->data['load_scripts'],'');
}
if(isset($with["notify"]) && $with["notify"]){
array_push($this->data['load_scripts'], '');
array_push($this->data['load_scripts'],'');
}
if(isset($with["typeahead"]) && $with["typeahead"]){
array_push($this->data['load_scripts'], '');
array_push($this->data['load_scripts'],'');
}
if(isset($with["inputmask"]) && $with["inputmask"]){
array_push($this->data['load_scripts'], '');
array_push($this->data['load_scripts'],'');
}
if(isset($with["appjs"]) && $with["appjs"]){
array_push($this->data['load_scripts'], '');
array_push($this->data['load_scripts'], '');
}
if(GDPR['on'] && isset($with["ga"]) && $with["ga"]){
array_push($this->data['load_scripts'], '');
array_push($this->data['load_scripts'], '');
}
if(isset($with["ga_embed"]) && $with["ga_embed"]){
array_push($this->data['load_scripts'], '');
array_push($this->data['load_scripts'], '');
}
if(isset($with["date_range"]) && $with["date_range"]){
array_push($this->data['load_scripts'], '');
array_push($this->data['load_styles'], '');
array_push($this->data['load_scripts'], '');
}
if(isset($with["bootstrap_select"]) && $with["bootstrap_select"]){
array_push($this->data['load_scripts'], '');
array_push($this->data['load_styles'], '');
array_push($this->data['load_scripts'], '');
array_push($this->data['load_scripts'], '');
}
if(isset($with["easycomplete"]) && $with["easycomplete"]){
array_push($this->data['load_scripts'], '');
array_push($this->data['load_styles'], '');
array_push($this->data['load_styles'], '');
array_push($this->data['load_styles'], '');
array_push($this->data['load_styles'], '');
}
if(isset($with["autocomplete"]) && $with["autocomplete"]){
array_push($this->data['load_styles'], '');
array_push($this->data['load_scripts'], '');
}
if(isset($with["select2"]) && $with["select2"]){
array_push($this->data['load_styles'], '');
array_push($this->data['load_scripts'], '');
// array_push($this->data['load_scripts'], '');
array_push($this->data['load_scripts'], '');
}
if(isset($with["selectize"]) && $with["selectize"]){
array_push($this->data['load_styles'], '');
array_push($this->data['load_scripts'], '');
}
if(isset($with["mask"]) && $with["mask"]){
array_push($this->data['load_scripts'], '');
}
}
public function setCspHeader($report_only = true)
{
$http_protocol = isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ? 'https' : 'http';
$mode = $report_only? '-Report-Only': '';
$this->data['csp_nonce'] = base64_encode(date('now').time());
header('Access-Control-Allow-Origin: *');
header("Content-Security-Policy{$mode}: "
."default-src 'none';"
."connect-src *.tinymce.com *.tiny.cloud {$http_protocol}:;"
."font-src 'self' *.tinymce.com *.tiny.cloud {$http_protocol}: data:;"
."frame-src {$http_protocol}:;"
."img-src 'self' *.tinymce.com *.tiny.cloud {$http_protocol}: data: blob: mediastream: ;"
."media-src 'self' data: blob: mediastream: {$http_protocol}:; "
."object-src 'none'; "
."script-src 'nonce-{$this->data['csp_nonce']}' 'self' *.tinymce.com *.tiny.cloud 'unsafe-inline' {$http_protocol}:; "
."style-src 'self' 'unsafe-inline' *.tinymce.com *.tiny.cloud {$http_protocol}:;"
."frame-ancestors 'none';"
."base-uri 'self';"
."report-uri '';"
);
}
/*
* Check if user is logged in from main site
* if the user is logged out from the main site but logged in to evenements
* log out the user from evenements
*/
/*
* If the cookies indicating a user is logged in from lemonde fr
* and user is logged in on evenements is detected
* return true, do not check for logged in user from the main site anymore
*/
protected function check_login_status($userIsLoggedIn = false){
// Check session
Sso::signOutUserWhenLoggedOutFromParentSite();
// Making sure that this function runs for FO users ONLY!
if (isset( $_COOKIE['lmd_a_s'], $_COOKIE['lmd_a_m'])) {
Sso::resetSSOInSession();
return $this->getActiveUserFromWebService('self');
}
}
protected function getActiveUserFromWebService($caller='self') {
$sso = Sso::connect();
if (isset($sso['telephone']) && !empty($sso['telephone'])) {
if ($caller === 'self'){
Sso::authenticateBySSO($sso);
}
}
return $sso;
}
}
/* End of file MY_CONTROLLER.php */
/* Location: ./application/core/MY_Controller.php */