/** * @return boolean */ public function adjust() { if (defined('IL_CERT_SSO')) { return false; } else { if (!ilContext::supportsRedirects()) { return false; } else { if ($this->ctrl->isAsynch()) { return false; } else { if (in_array(basename($_SERVER['PHP_SELF']), array('logout.php'))) { return false; } else { if (!$this->user->getId() || $this->user->isAnonymous()) { return false; } } } } } foreach ($this->cases as $case) { if ($case->isInFulfillment()) { return false; } if ($case->shouldAdjustRequest()) { if ($case->shouldStoreRequestTarget()) { $this->storeRequest(); } $case->adjust(); return true; } } return false; }
/** * Init context by type * * @param int $a_type * @return bool */ public static function init($a_type) { $class_name = self::getClassForType($a_type); if ($class_name) { include_once "Services/Context/classes/class." . $class_name . ".php"; self::$class_name = $class_name; self::$type = $a_type; return true; } return false; }
public static function initialize() { ini_set("display_errors", 'Off'); if (!class_exists('ilInitialisation')) { chdir(dirname(__FILE__) . "/../../../../../../../.."); include_once "Services/Context/classes/class.ilContext.php"; ilContext::init(11); // 11 = const unit_test require_once "Services/Init/classes/class.ilInitialisation.php"; ilInitialisation::initILIAS(); $GLOBALS['WEB_ACCESS_WITHOUT_SESSION'] = true; } }
/** * Start task scheduler for each server instance */ public static function start() { include_once './Services/Context/classes/class.ilContext.php'; if (ilContext::getType() != ilContext::CONTEXT_WEB) { return; } include_once './Services/WebServices/ECS/classes/class.ilECSServerSettings.php'; $servers = ilECSServerSettings::getInstance(); foreach ($servers->getServers() as $server) { $sched = new ilECSTaskScheduler($server); if ($sched->checkNextExecution()) { $sched->initNextExecution(); } } }
/** * ilias initialisation */ public static function initILIAS() { global $tree; self::initCore(); if (ilContext::initClient()) { self::initClient(); if (ilContext::hasUser()) { self::initUser(); self::authenticate(); } // init after Auth otherwise breaks CAS self::includePhp5Compliance(); // language may depend on user setting // Object selection breaks if the laguage is not set. self::initLanguage(); $tree->initLangCode(); } }
/** * @static */ public static function performInitialisation() { /** * @var $ilErr ilErrorHandling */ global $ilErr; define('IL_PHPUNIT_TEST', true); session_id('phpunittest'); $_SESSION = array(); include 'Services/PHPUnit/config/cfg.phpunit.php'; include_once 'Services/Context/classes/class.ilContext.php'; ilContext::init(ilContext::CONTEXT_UNITTEST); include_once 'Services/Init/classes/class.ilInitialisation.php'; ilInitialisation::initILIAS(); ilInitialisation::initUserAccount(); $ilUnitUtil = new self(); $ilErr->setErrorHandling(PEAR_ERROR_CALLBACK, array($ilUnitUtil, 'errorHandler')); PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array($ilUnitUtil, 'errorHandler')); }
/** * ilias initialisation */ public static function initILIAS() { global $tree; static::initCore(); if (ilContext::initClient()) { static::initClient(); // we always need a user! static::initUser(); // init after Auth otherwise breaks CAS static::includePhp5Compliance(); // language may depend on user setting static::initLanguage(); $tree->initLangCode(); //if(ilContext::hasHTML()) //{ // include_once('./Services/WebServices/ECS/classes/class.ilECSTaskScheduler.php'); // ilECSTaskScheduler::start(); //} } }
public function initILIAS() { chdir(substr($_SERVER['SCRIPT_FILENAME'], 0, strpos($_SERVER['SCRIPT_FILENAME'], '/Customizing'))); require_once 'include/inc.ilias_version.php'; require_once 'Services/Component/classes/class.ilComponent.php'; if (ilComponent::isVersionGreaterString(ILIAS_VERSION_NUMERIC, '4.2.999')) { require_once './Services/Context/classes/class.ilContext.php'; ilContext::init(ilContext::CONTEXT_WEB); require_once './Services/Init/classes/class.ilInitialisation.php'; ilInitialisation::initILIAS(); } else { $_GET['baseClass'] = 'ilStartUpGUI'; require_once './include/inc.get_pear.php'; require_once './include/inc.header.php'; } require_once './Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/Certificate/classes/class.ilCertificatePlugin.php'; require_once './Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/Certificate/classes/Certificate/class.srCertificate.php'; require_once "./Services/Tracking/classes/class.ilTrQuery.php"; require_once "./Services/Tracking/classes/class.ilLPStatusFactory.php"; }
/** * Redirects to target url if context supports it * * @param string $a_target * @param string $a_message_details */ protected static function redirect($a_target, $a_message_details) { if (ilContext::supportsRedirects()) { ilUtil::redirect($a_target); } else { // user-directed linked message if (ilContext::usesHTTP() && ilContext::hasHTML()) { $mess = $a_message_details . ' Please <a href="' . $a_target . '">click here</a> to continue.'; } else { // not much we can do here $mess = $a_message_details; if (!trim($mess)) { $mess = 'Redirect not supported by context (' . $a_target . ')'; } } self::abortAndDie($mess); } }
/* if ilias is called directly within the docroot $cookie_path is set to '/' expecting on servers running under windows.. here it is set to '\'. in both cases a further '/' won't be appended due to the following regex */ $cookie_path .= !preg_match("/[\\/|\\\\]\$/", $cookie_path) ? "/" : ""; if ($cookie_path == "\\") { $cookie_path = '/'; } $cookie_domain = ''; // Temporary Fix setcookie("ilClientId", $_GET["client_id"], 0, $cookie_path, $cookie_domain); $_COOKIE["ilClientId"] = $_GET["client_id"]; } include_once "Services/Context/classes/class.ilContext.php"; ilContext::init(ilContext::CONTEXT_RSS_AUTH); require_once "Services/Init/classes/class.ilInitialisation.php"; ilInitialisation::initILIAS(); global $lng, $ilSetting; $feed_set = new ilSetting("news"); if (!isset($_SERVER['PHP_AUTH_PW']) || !isset($_SERVER['PHP_AUTH_USER'])) { Header("WWW-Authenticate: Basic realm=\"ILIAS Newsfeed\""); Header("HTTP/1.0 401 Unauthorized"); exit; } else { if ($_GET["user_id"] != "" && ilObjUser::_getFeedPass($_GET["user_id"]) != "" && (md5($_SERVER['PHP_AUTH_PW']) == ilObjUser::_getFeedPass($_GET["user_id"]) && $_SERVER['PHP_AUTH_USER'] == ilObjUser::_lookupLogin($_GET["user_id"])) && $feed_set->get("enable_private_feed")) { include_once "./Services/Feeds/classes/class.ilUserFeedWriter.php"; // Third parameter is true for private feed $writer = new ilUserFeedWriter($_GET["user_id"], $_GET["hash"], true); $writer->showFeed(); } else {
<?php /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */ if (!file_exists(getcwd() . '/ilias.ini.php')) { exit; } include_once "Services/Context/classes/class.ilContext.php"; ilContext::init(ilContext::CONTEXT_SESSION_REMINDER); require_once "Services/Init/classes/class.ilInitialisation.php"; ilInitialisation::initILIAS(); include_once 'Services/Authentication/classes/class.ilSessionReminderCheck.php'; $session_reminder_check = new ilSessionReminderCheck(); echo $session_reminder_check->getJsonResponse(ilUtil::stripSlashes($_POST['session_id'])); exit;
// error_reporting (E_ALL); // ini_set("display_errors","on"); // fim. chdir("../../../../../../../"); // this should bring us all session data of the desired client // @see feed.php if (isset($_GET["client_id"])) { $cookie_domain = $_SERVER['SERVER_NAME']; $cookie_path = dirname($_SERVER['PHP_SELF']); /* if ilias is called directly within the docroot $cookie_path is set to '/' expecting on servers running under windows.. here it is set to '\'. in both cases a further '/' won't be appended due to the following regex */ $cookie_path .= !preg_match("/[\\/|\\\\]\$/", $cookie_path) ? "/" : ""; if ($cookie_path == "\\") { $cookie_path = '/'; } $cookie_domain = ''; // Temporary Fix setcookie("ilClientId", $_GET["client_id"], 0, $cookie_path, $cookie_domain); $_COOKIE["ilClientId"] = $_GET["client_id"]; } // REST context has http and client but no user, templates, html or redirects require_once "Services/Context/classes/class.ilContext.php"; ilContext::init(ilContext::CONTEXT_REST); require_once __DIR__ . "/classes/class.ilExternalContentInitialisation.php"; ilExternalContentInitialisation::initILIAS(); require_once __DIR__ . "/classes/class.ilExternalContentResultService.php"; $service = new ilExternalContentResultService(); $service->handleRequest();
/* if ilias is called directly within the docroot $cookie_path is set to '/' expecting on servers running under windows.. here it is set to '\'. in both cases a further '/' won't be appended due to the following regex */ $cookie_path .= !preg_match("/[\\/|\\\\]\$/", $cookie_path) ? "/" : ""; if ($cookie_path == "\\") { $cookie_path = '/'; } $cookie_domain = ''; // Temporary Fix setcookie("ilClientId", $_GET["client_id"], 0, $cookie_path, $cookie_domain); $_COOKIE["ilClientId"] = $_GET["client_id"]; } include_once "Services/Context/classes/class.ilContext.php"; ilContext::init(ilContext::CONTEXT_RSS); require_once "Services/Init/classes/class.ilInitialisation.php"; ilInitialisation::initILIAS(); if ($_GET["user_id"] != "") { include_once "./Services/Feeds/classes/class.ilUserFeedWriter.php"; $writer = new ilUserFeedWriter($_GET["user_id"], $_GET["hash"]); $writer->showFeed(); } else { if ($_GET["ref_id"] != "") { include_once "./Services/Feeds/classes/class.ilObjectFeedWriter.php"; $writer = new ilObjectFeedWriter($_GET["ref_id"], false, $_GET["purpose"]); $writer->showFeed(); } else { if ($_GET["blog_id"] != "") { include_once "Modules/Blog/classes/class.ilObjBlog.php"; ilObjBlog::deliverRSS($_GET["blog_id"]);
public static function _getHttpPath() { global $ilIliasIniFile; if ($_SERVER['SHELL'] || php_sapi_name() == 'cli' || class_exists("ilContext") && !ilContext::usesHTTP()) { return $ilIliasIniFile->readVariable('server', 'http_path'); } else { return ILIAS_HTTP_PATH; } }
/** * Redirects to target url if context supports it * * @param string $a_target * @param string $a_message_id * @param array $a_message_details */ protected static function redirect($a_target, $a_message_id, $a_message_static) { // #12739 if (defined("ILIAS_HTTP_PATH") && !stristr($a_target, ILIAS_HTTP_PATH)) { $a_target = ILIAS_HTTP_PATH . "/" . $a_target; } if (ilContext::supportsRedirects()) { ilUtil::redirect($a_target); } else { $message = self::translateMessage($a_message_id, $a_message_static); // user-directed linked message if (ilContext::usesHTTP() && ilContext::hasHTML()) { $link = self::translateMessage("init_error_redirect_click", array("en" => 'Please click to continue.', "de" => 'Bitte klicken um fortzufahren.')); $mess = $message . '<br /><a href="' . $a_target . '">' . $link . '</a>'; } else { // not much we can do here $mess = $message; if (!trim($mess)) { $mess = self::translateMessage("init_error_redirect_info", array("en" => 'Redirect not supported by context.', "de" => 'Weiterleitungen werden durch Kontext nicht unterstützt.')) . ' (' . $a_target . ')'; } } self::abortAndDie($mess); } }
// Front channel logout // Note: Generally the back-channel logout should be used once the Shibboleth // Identity Provider supports Single Log Out! // Front-channel logout is not of much use. if (isset($_GET['return']) && isset($_GET['action']) && $_GET['action'] == 'logout') { // Load all the IILIAS stuff require_once "include/inc.header.php"; global $ilAuth; // Logout out user from application // Destroy application session/cookie etc $ilAuth->logout(); // Finally, send user to the return URL ilUtil::redirect($_GET['return']); } elseif (!empty($HTTP_RAW_POST_DATA)) { include_once "Services/Context/classes/class.ilContext.php"; ilContext::init(ilContext::CONTEXT_SOAP); // Load ILIAS libraries and initialise ILIAS in non-web context require_once "Services/Init/classes/class.ilInitialisation.php"; ilInitialisation::initILIAS(); // Set SOAP header $server = new SoapServer('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . '/LogoutNotification.wsdl'); $server->addFunction("LogoutNotification"); $server->handle(); } else { header('Content-Type: text/xml'); echo <<<WSDL <?xml version ="1.0" encoding ="UTF-8" ?> <definitions name="LogoutNotification" targetNamespace="urn:mace:shibboleth:2.0:sp:notify" xmlns:notify="urn:mace:shibboleth:2.0:sp:notify" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
public function login() { $skipClasses = array('ilpasswordassistancegui', 'ilaccountregistrationgui'); $skipFiles = array('pwassist.php'); if (in_array(strtolower($_REQUEST['cmdClass']), $skipClasses)) { return; } else { $script = pathinfo($_SERVER['PHP_SELF'], PATHINFO_BASENAME); if (in_array(strtolower($script), $skipFiles)) { return; } } if (!$this->apache_settings->get('apache_auth_authenticate_on_login_page') && (preg_match('/.*login\\.php$/', $_SERVER['SCRIPT_NAME']) || (in_array($_REQUEST['cmd'], array('showLogin', 'showTermsOfService')) || isset($_POST['change_lang_to'])) && strtolower($_REQUEST['cmdClass']) == 'ilstartupgui')) { return; } if (!$this->apache_settings->get('apache_auth_authenticate_on_login_page') && preg_match('/.*login\\.php$/', $_SERVER['SCRIPT_NAME'])) { return; } if (ilContext::supportsRedirects() && !isset($_GET['passed_sso']) && (!defined('IL_CERT_SSO') || IL_CERT_SSO == false)) { // redirect to sso // this part is executed in default ilias context... $path = $_SERVER['REQUEST_URI']; if ($path[0] == '/') { $path = substr($path, 1); } if (substr($path, 0, 4) != 'http') { $parts = parse_url(ILIAS_HTTP_PATH); $path = $parts['scheme'] . '://' . $parts['host'] . '/' . $path; } $path = urlencode($path); ilUtil::redirect(ilUtil::getHtmlPath('/sso/index.php?force_mode_apache=1&r=' . $path . '&cookie_path=' . IL_COOKIE_PATH . '&ilias_path=' . ILIAS_HTTP_PATH)); } else { return parent::login(); } }
define("ILIAS_MODULE", substr($_SERVER['PHP_SELF'], strpos($_SERVER['PHP_SELF'], "/data/") + 6)); // Define the cookie path to prevent a different session created for web access // (see ilInitialisation::setCookieParams() for details) $GLOBALS['COOKIE_PATH'] = substr($_SERVER['PHP_SELF'], 0, strpos($_SERVER['PHP_SELF'], "/data/")); // Determine the ILIAS client from the web path // This is needed because a session cookie may not yet exist // (see ilINITIALISATION::determineClient() for details) $client_start = strpos($_SERVER['PHP_SELF'], "/data/") + 6; $client_end = strpos($_SERVER['PHP_SELF'], "/", $client_start); $_GET['client_id'] = substr($_SERVER['PHP_SELF'], $client_start, $client_end - $client_start); // Remember if the initial session was empty // Then a new session record should not be written // (see ilSession::_writeData for details) $GLOBALS['WEB_ACCESS_WITHOUT_SESSION'] = session_id() == ""; include_once "Services/Context/classes/class.ilContext.php"; ilContext::init(ilContext::CONTEXT_WEB_ACCESS_CHECK); // Now the ILIAS header can be included require_once "./include/inc.header.php"; require_once "./Services/Utilities/classes/class.ilUtil.php"; require_once "./Services/Object/classes/class.ilObject.php"; require_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php"; /** * Class ilWebAccessChecker * * Checks the access rights of a directly requested content file. * Called from an alias or rewrite rule * - determines the related learning module and checks the permission * - either delivers the accessed file (without redirect) * - or shows an error screen (if too less rights) * * @author Fred Neumann <*****@*****.**>
public function getClientInfoXML($clientid) { include_once "Services/Context/classes/class.ilContext.php"; ilContext::init(ilContext::CONTEXT_SOAP_WITHOUT_CLIENT); require_once "Services/Init/classes/class.ilInitialisation.php"; ilInitialisation::initILIAS(); $clientdir = ILIAS_WEB_DIR . "/" . $clientid; require_once "webservice/soap/classes/class.ilSoapInstallationInfoXMLWriter.php"; $writer = new ilSoapInstallationInfoXMLWriter(); $writer->setExportAdvancedMetaDataDefinitions(true); $writer->setExportUDFDefinitions(true); $writer->start(); if (is_object($client = $this->getClientInfo($init, $clientdir))) { $writer->addClient($client); } else { return $this->__raiseError("Client ID {$clientid} does not exist!", 'Client'); } $writer->end(); return $writer->getXML(); }
protected function initIlias() { include_once "Services/Context/classes/class.ilContext.php"; ilContext::init(ilContext::CONTEXT_ICAL); include_once './Services/Authentication/classes/class.ilAuthFactory.php'; ilAuthFactory::setContext(ilAuthFactory::CONTEXT_CALENDAR_TOKEN); $_POST['username'] = '******'; $_POST['password'] = '******'; require_once "Services/Init/classes/class.ilInitialisation.php"; ilInitialisation::initILIAS(); $GLOBALS['lng']->loadLanguageModule('dateplaner'); }
function isSOAPEnabled() { global $ilSetting; if (!extension_loaded('curl') || !$ilSetting->get('soap_user_administration')) { return false; } // Prevent using SOAP in cron context if (ilContext::getType() == ilContext::CONTEXT_CRON) { return false; } return (bool) $this->soap_enabled; }
<?php chdir(dirname(__FILE__)); chdir('..'); include_once "Services/Context/classes/class.ilContext.php"; ilContext::init(ilContext::CONTEXT_CRON); include_once 'Services/Authentication/classes/class.ilAuthFactory.php'; ilAuthFactory::setContext(ilAuthFactory::CONTEXT_CRON); $_COOKIE["ilClientId"] = $_SERVER['argv'][3]; $_POST['username'] = $_SERVER['argv'][1]; $_POST['password'] = $_SERVER['argv'][2]; if ($_SERVER['argc'] < 4) { die("Usage: cron.php username password client\n"); } include_once './include/inc.header.php'; // Start checks here include_once './cron/classes/class.ilCronCheck.php'; $cron_check = new ilCronCheck(); $cron_check->start();
/** * ilias initialisation * * This needs to be overwritten because Ilias would ignore several settings * initIlias has to be overwritten because there is no easy way to * refine the context definition */ public static function initILIAS() { if (self::$already_initialized) { return; } self::$already_initialized = true; global $tree; self::initCore(); if (ilContext::initClient()) { self::initClient(); self::initUser(); // NOTE authenticate() will setup the session user self::authenticate(); // init after Auth otherwise breaks CAS self::includePhp5Compliance(); // language may depend on user setting self::initLanguage(); $tree->initLangCode(); } }
<?php /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */ /** * for storing Data also without session * @author Uwe Kohnle <*****@*****.**> * @version $Id$ */ include_once "Services/Context/classes/class.ilContext.php"; ilContext::init(ilContext::CONTEXT_SCORM); require_once "Services/Init/classes/class.ilInitialisation.php"; ilInitialisation::initILIAS(); include_once 'Modules/Scorm2004/classes/class.ilSCORM2004StoreData.php'; if ((string) $_GET['do'] == "unload") { include_once 'Modules/Scorm2004/classes/class.ilSCORM2004StoreData.php'; ilSCORM2004StoreData::scormPlayerUnload(null, (int) $_GET['package_id']); } else { global $ilLog, $ilDB, $ilUser; $packageId = (int) $_GET['package_id']; $lm_set = $ilDB->queryF('SELECT default_lesson_mode, interactions, objectives, comments FROM sahs_lm WHERE id = %s', array('integer'), array($packageId)); while ($lm_rec = $ilDB->fetchAssoc($lm_set)) { $defaultLessonMode = $lm_rec["default_lesson_mode"]; $interactions = ilUtil::yn2tf($lm_rec["interactions"]); $objectives = ilUtil::yn2tf($lm_rec["objectives"]); $comments = ilUtil::yn2tf($lm_rec["comments"]); } $data = file_get_contents('php://input'); $ilUser->setId($data->p); //until now only 2004 include_once 'Modules/Scorm2004/classes/class.ilSCORM2004StoreData.php'; ilSCORM2004StoreData::persistCMIData(null, $packageId, $defaultLessonMode, $comments, $interactions, $objectives, $data);
*/ // Initialize // ----------------------------------------------------- // Retrieve the client id from PATH_INFO // Component 1 contains the ILIAS client_id. $path_info_components = explode('/', $_SERVER['PATH_INFO']); $client_id = $path_info_components[1]; // For all requests, except for GET-Requests for files, we enforce HTTP // authentication for the WebDAV protocol. #if ($_SERVER['REQUEST_METHOD'] != 'GET' || # count($path_info_components) < 3 || # substr($path_info_components[2],0,5) != 'file_') { # define ('WebDAV_Authentication', 'HTTP'); #} define('WebDAV_Authentication', 'HTTP'); // Set context for authentication include_once 'Services/Authentication/classes/class.ilAuthFactory.php'; ilAuthFactory::setContext(ilAuthFactory::CONTEXT_HTTP); // Launch ILIAS using the client id we have determined // ----------------------------------------------------- $_COOKIE["ilClientId"] = $client_id; include_once "Services/Context/classes/class.ilContext.php"; ilContext::init(ilContext::CONTEXT_WEBDAV); require_once "Services/Init/classes/class.ilInitialisation.php"; ilInitialisation::initILIAS(); // Launch the WebDAV Server // ----------------------------------------------------- include_once "Services/WebDAV/classes/class.ilDAVServer.php"; $server = new ilDAVServer(); $server->ServeRequest(); // END WebDAV