break; case "logout": require_once $GLOBALS['where_lms'] . '/lib/lib.track_user.php'; if (!Docebo::user()->isAnonymous() && isset($_SESSION['idCourse'])) { TrackUser::setActionTrack(getLogUserId(), $_SESSION['idCourse'], '', ''); } //i need to save the language of the user in order to use it again after logout $language = Lang::get(); if (!Docebo::user()->isAnonymous()) { TrackUser::logoutSessionCourseTrack(); $_SESSION = array(); session_destroy(); // load standard language module and put it global $glang =& DoceboLanguage::createInstance('standard', 'framework'); // Recreate Anonymous user $GLOBALS['current_user'] =& DoceboUser::createDoceboUserFromSession('public_area'); $GLOBALS['logout'] = true; require_once _base_ . '/lib/lib.platform.php'; $pm =& PlatformManager::createInstance(); $pm->doCommonOperations("logout"); } $GLOBALS['op'] = 'login'; $GLOBALS['modname'] = 'login'; $query = 'logout=1&special=changelang&new_lang=' . $language; if (isset($_GET['msg']) && !empty($_GET['msg'])) { $query = 'msg=' . (int) $_GET['msg']; } Util::jump_to('../index.php?' . $query); break; case "aula": require_once $GLOBALS['where_lms'] . '/lib/lib.course.php';
} else { $_SESSION['logged_in'] = true; $GLOBALS['r'] = 'adm/dashboard/show'; $GLOBALS['modname'] = ''; //loading related ST $GLOBALS['current_user']->loadUserSectionST(); $GLOBALS['current_user']->SaveInSession(); // perform other platforms login operation require_once _base_ . '/lib/lib.platform.php'; $pm =& PlatformManager::createInstance(); $pm->doCommonOperations("login"); } } break; case "logout": $_SESSION = array(); session_destroy(); // Recreate Anonymous user $GLOBALS['current_user'] =& DoceboUser::createDoceboUserFromSession(Get::sett('common_admin_session') == 'on' ? "public_area" : "admin_area"); $GLOBALS['op'] = 'login'; $GLOBALS['modname'] = 'login'; $GLOBALS['logout'] = true; $pm =& PlatformManager::createInstance(); $pm->doCommonOperations("logout"); Util::jump_to(Get::rel_path('base') . '/index.php?modname=login&op=login'); break; } if (isset($_GET['close_over'])) { $_SESSION['menu_over']['p_sel'] = ''; $_SESSION['menu_over']['main_sel'] = 0; }
default: if (Get::sett('common_admin_session') == 'on') { $sn = "docebo_session"; $user_session = 'public_area'; } else { $sn = "docebo_core"; $user_session = 'admin_area'; } break; } session_name($sn); session_start(); // load regional setting // load current user from session require_once _base_ . '/lib/lib.user.php'; $GLOBALS['current_user'] =& DoceboUser::createDoceboUserFromSession($user_session); // Utils and so on require_once $GLOBALS['where_framework'] . '/lib/lib.php'; // load standard language module and put it global $glang =& DoceboLanguage::createInstance('standard', 'framework'); $glang->setGlobal(); require_once _base_ . '/lib/lib.platform.php'; // create instance of StdPageWriter StdPageWriter::createInstance(); require_once $GLOBALS['where_framework'] . '/lib/lib.preoperation.php'; $GLOBALS["template_path"] = $path_to_root . '/' . getPathTemplate('scs') . 'tools/htmlwachat/'; $GLOBALS["img_path"] = $path_to_root . '/' . getPathTemplate('scs') . 'tools/htmlwachat/'; $GLOBALS['page']->add('<link href="' . $GLOBALS["template_path"] . 'style_chat.css" rel="stylesheet" type="text/css" />' . "\n", 'page_head'); $out =& $GLOBALS["page"]; $out->setWorkingZone("content"); $lang =& DoceboLanguage::createInstance('htmlframechat', 'scs');
/** * - create the user representative object, load anonymoous data if needed or load the info of the * user logged into the session (also manage the user login here ? will be usefull for kerberos * and similar approach) * - load user personal data (language, date/time setting, template preference) * - load user system data (role) * @return array */ private static function user() { self::log("Load user from session '" . self::$session_name . "'"); // load current user from session require_once _base_ . '/lib/lib.user.php'; $GLOBALS['current_user'] =& DoceboUser::createDoceboUserFromSession('public_area'); // ip coerency check self::log("Ip coerency check."); if (Get::sett('session_ip_control', 'on') == 'on') { if (Docebo::user()->isLoggedIn() && Docebo::user()->getLogIp() != $_SERVER['REMOTE_ADDR']) { Util::jump_to('../index.php?msg=104'); //Util::fatal("logip: ".Docebo::user()->getLogIp()."<br/>"."addr: ".$_SERVER['REMOTE_ADDR']."<br/>".'Ip incoherent!'); //unlog the user die; } } // Generate a session signature or regenerate it if needed self::log("Generating session signature"); Util::generateSignature(); }