if (!defined('HOME') && !defined('INSTALLER')) { redirect(); } } // check to see if we're installed... if (!get_config('installed')) { ensure_install_sanity(); $scriptfilename = str_replace('\\', '/', $_SERVER['SCRIPT_FILENAME']); if (!defined('CLI') && false === strpos($scriptfilename, 'admin/index.php') && false === strpos($scriptfilename, 'admin/upgrade.php') && false === strpos($scriptfilename, 'admin/upgrade.json.php') && false === strpos($scriptfilename, 'admin/cli/install.php') && false === strpos($scriptfilename, 'admin/cli/upgrade.php')) { redirect('/admin/index.php'); } } if (defined('JSON') && !defined('NOSESSKEY')) { $sesskey = param_variable('sesskey', null); global $USER; if ($sesskey === null || $USER->get('sesskey') != $sesskey) { $USER->logout(); json_reply('global', get_string('invalidsesskey'), 1); } } $mobile_detection_done = $SESSION->get('mobile_detection'); // Device detection if (!$mobile_detection_done) { if (get_config('installed') && get_account_preference($USER->get('id'), 'devicedetection')) { require_once get_config('libroot') . 'mobile_detect/Mobile_Detect.php'; $detect = new Mobile_Detect(); $isMobile = $detect->isMobile(); $isTablet = $detect->isTablet(); $SESSION->set('handheld_device', $isMobile); $SESSION->set('mobile', $isTablet ? false : $isMobile); $SESSION->set('tablet', $isTablet);
redirect(); } } } // check to see if we're installed... if (!get_config('installed')) { ensure_install_sanity(); $scriptfilename = str_replace('\\', '/', $_SERVER['SCRIPT_FILENAME']); if (false === strpos($scriptfilename, 'admin/index.php') && false === strpos($scriptfilename, 'admin/upgrade.php') && false === strpos($scriptfilename, 'admin/upgrade.json.php')) { redirect('/admin/'); } } if (defined('JSON') && !defined('NOSESSKEY')) { $sesskey = param_variable('sesskey', null); global $USER; if ($sesskey === null || $USER->get('sesskey') != $sesskey) { $USER->logout(); json_reply('global', get_string('invalidsesskey'), 1); } } // *********************************************************************** // END of copied stuff from original init.php // *********************************************************************** // restart the session for Mahara @session_start(); require_once get_config('docroot') . 'auth/saml/lib.php'; require_once get_config('libroot') . 'institution.php'; // if the user is not logged in, then lets start it going if (!$USER->is_logged_in()) { simplesaml_init($saml_config, $valid_saml_session, $saml_attributes, $as); } else {