You should have received a copy of the GNU General Public License along with GLPI; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -------------------------------------------------------------------------- */ // ---------------------------------------------------------------------- // Original Author of file: // Purpose of file: // ---------------------------------------------------------------------- define('GLPI_ROOT', '..'); include GLPI_ROOT . "/inc/includes.php"; checkCentralAccess(); // Change profile system if (isset($_POST['newprofile'])) { if (isset($_SESSION["glpiprofiles"][$_POST['newprofile']])) { changeProfile($_POST['newprofile']); if ($_SESSION["glpiactiveprofile"]["interface"] == "helpdesk") { glpi_header($CFG_GLPI['root_doc'] . "/front/helpdesk.public.php"); } glpi_header($_SERVER['PHP_SELF']); } glpi_header(preg_replace("/entities_id.*/", "", $_SERVER['HTTP_REFERER'])); } // Manage entity change if (isset($_GET["active_entity"])) { if (!isset($_GET["is_recursive"])) { $_GET["is_recursive"] = 0; } if (changeActiveEntities($_GET["active_entity"], $_GET["is_recursive"])) { if ($_GET["active_entity"] == $_SESSION["glpiactive_entity"] && isset($_SERVER['HTTP_REFERER'])) { glpi_header(preg_replace("/entities_id.*/", "", $_SERVER['HTTP_REFERER']));
<?php session_start(); if ($_SESSION["authenticated"] != "true") { header('Location: index.html'); } include 'controller.php'; if ($_SERVER['REQUEST_METHOD'] == 'POST') { changeProfile($_SESSION["username"]); header('Location: profile.php?changed=yes'); } else { ?> <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <link href='https://fonts.googleapis.com/css?family=Cantora+One' rel='stylesheet' type='text/css'> <link href='https://fonts.googleapis.com/css?family=Raleway' rel='stylesheet' type='text/css'> <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script> <link rel="stylesheet" href="includes/style.css" /> <script src="includes/script.js"></script> <title>Fridge List - Change Profile</title> </head> <body id="change_body"> <?php if (isset($_GET["changed"])) { echo "<p>Successfully changed</p>"; } ?>
/** * Init session for the user is defined * * @return nothing **/ function initSession() { global $CFG_GLPI, $LANG; if ($this->auth_succeded) { // Restart GLPi session : complete destroy to prevent lost datas $tosave = array('glpi_plugins', 'glpicookietest', 'phpCAS'); $save = array(); foreach ($tosave as $t) { if (isset($_SESSION[$t])) { $save[$t] = $_SESSION[$t]; } } $this->destroySession(); startGlpiSession(); $_SESSION = $save; // Normal mode for this request $_SESSION["glpi_use_mode"] = NORMAL_MODE; // Check ID exists and load complete user from DB (plugins...) if (isset($this->user->fields['id']) && $this->user->getFromDB($this->user->fields['id'])) { if (!$this->user->fields['is_deleted'] && $this->user->fields['is_active']) { $_SESSION["glpiID"] = $this->user->fields['id']; $_SESSION["glpiname"] = $this->user->fields['name']; $_SESSION["glpirealname"] = $this->user->fields['realname']; $_SESSION["glpifirstname"] = $this->user->fields['firstname']; $_SESSION["glpidefault_entity"] = $this->user->fields['entities_id']; $_SESSION["glpiusers_idisation"] = true; $_SESSION["glpiextauth"] = $this->extauth; $_SESSION["glpiauthtype"] = $this->user->fields['authtype']; $_SESSION["glpisearchcount"] = array(); $_SESSION["glpisearchcount2"] = array(); $_SESSION["glpiroot"] = $CFG_GLPI["root_doc"]; $_SESSION["glpi_use_mode"] = $this->user->fields['use_mode']; $_SESSION["glpicrontimer"] = time(); // Default tab // $_SESSION['glpi_tab']=1; $_SESSION['glpi_tabs'] = array(); $this->user->computePreferences(); foreach ($CFG_GLPI['user_pref_field'] as $field) { if (isset($this->user->fields[$field])) { $_SESSION["glpi{$field}"] = $this->user->fields[$field]; } } // Do it here : do not reset on each page, cause export issue if ($_SESSION["glpilist_limit"] > $CFG_GLPI['list_limit_max']) { $_SESSION["glpilist_limit"] = $CFG_GLPI['list_limit_max']; } // Init not set value for language if (empty($_SESSION["glpilanguage"])) { $_SESSION["glpilanguage"] = $CFG_GLPI['language']; } loadLanguage(); // glpiprofiles -> other available profile with link to the associated entities doHook("init_session"); initEntityProfiles(getLoginUserID()); // Use default profile if exist if (isset($_SESSION['glpiprofiles'][$this->user->fields['profiles_id']])) { changeProfile($this->user->fields['profiles_id']); } else { // Else use first changeProfile(key($_SESSION['glpiprofiles'])); } if (!isset($_SESSION["glpiactiveprofile"]["interface"])) { $this->auth_succeded = false; $this->addToError($LANG['login'][25]); } } else { $this->auth_succeded = false; $this->addToError($LANG['login'][20]); } } else { $this->auth_succeded = false; $this->addToError($LANG['login'][25]); } } }
showHelpRegister(); break; case "user": showUser($id); break; case "createhtaccess": createHtaccess(); break; case "deletehtaccess": deleteHtaccess(); break; case "deletelog": deleteLog(); break; case "changeProfile": changeProfile(); break; case "changeMaster": changeMaster(); break; case "testFolder": testFolder(); break; case "chmod777": chmod_tfu(0777); break; case "chmod666": chmod_tfu(0666); break; case "chmod755": chmod_tfu(0755);