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;
     }
 }
Example #2
0
 /**
  * @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'));
 }
 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";
 }
Example #4
0
<?php

/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
/**
* logout script for ilias
*
* @author Sascha Hofmann <*****@*****.**>
* @version $Id: logout.php 33447 2012-03-01 14:00:01Z jluetzen $
*
* @package ilias-core
*/
require_once "Services/Init/classes/class.ilInitialisation.php";
ilInitialisation::initILIAS();
$ilCtrl->initBaseClass("ilStartUpGUI");
$ilCtrl->setCmd("showLogout");
$ilCtrl->setTargetScript("ilias.php");
$ilCtrl->callBaseClass();
$ilBench->save();
exit;
 /**
  * ilias initialisation
  */
 public static function initILIAS()
 {
     if (self::$already_initialized) {
         return;
     }
     self::$already_initialized = true;
     global $tree;
     self::initCore();
     if (ilContext::initClient()) {
         self::initClient();
         if (ilContext::hasUser()) {
             self::initUser();
             if (ilContext::doAuthentication()) {
                 self::authenticate();
             }
         }
         // init after Auth otherwise breaks CAS
         self::includePhp5Compliance();
         // language may depend on user setting
         self::initLanguage();
         $tree->initLangCode();
         if (ilContext::hasHTML()) {
             include_once './Services/WebServices/ECS/classes/class.ilECSTaskScheduler.php';
             ilECSTaskScheduler::start();
             self::initHTML();
         }
     }
 }
Example #6
0
 /**
  * open start page (personal desktop or repository)
  *
  * precondition: authentication (maybe anonymous) successfull
  */
 function processStartingPage()
 {
     /**
      * @var $ilUser ilObjUser
      */
     global $ilUser;
     // fallback, should never happen
     if ($ilUser->getId() == ANONYMOUS_USER_ID) {
         ilInitialisation::goToPublicSection();
     } else {
         // for password change and incomplete profile
         // see ilPersonalDesktopGUI
         if (IS_PAYMENT_ENABLED) {
             include_once './Services/Payment/classes/class.ilPaymentShoppingCart.php';
             ilPaymentShoppingCart::_assignObjectsToUserId($ilUser->getId());
             if ((int) $_GET['forceShoppingCartRedirect']) {
                 ilUtil::redirect('ilias.php?baseClass=ilShopController&cmd=redirect&redirect_class=ilshopshoppingcartgui');
             }
         }
         if (!$_GET["target"]) {
             // Redirect here to switch back to http if desired
             include_once './Services/User/classes/class.ilUserUtil.php';
             ilUtil::redirect(ilUserUtil::getStartingPointAsUrl());
         } else {
             // will handle shop redirects, too
             ilUtil::redirect("goto.php?target=" . $_GET["target"]);
         }
     }
 }
 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');
 }
 /**
  * Check access rights of the requested file
  * @access	public
  */
 public function checkAccess()
 {
     global $ilLog, $ilUser, $ilObjDataCache, $objDefinition;
     // an error already occurred at class initialisation
     if ($this->errorcode) {
         return false;
     }
     // check for type by subdirectory
     $pos1 = strpos($this->subpath, "lm_data/lm_") + 11;
     $pos2 = strpos($this->subpath, "mobs/mm_") + 8;
     $pos3 = strpos($this->subpath, "usr_images/") + 11;
     $pos4 = strpos($this->subpath, "sec") + 3;
     $obj_id = 0;
     $type = 'none';
     // trying to access data within a learning module folder
     if ($pos1 > 11) {
         $type = 'lm';
         $seperator = strpos($this->subpath, '/', $pos1);
         $obj_id = substr($this->subpath, $pos1, ($seperator > 0 ? $seperator : strlen($this->subpath)) - $pos1);
     } else {
         if ($pos2 > 8) {
             $type = 'mob';
             $seperator = strpos($this->subpath, '/', $pos2);
             $obj_id = substr($this->subpath, $pos2, ($seperator > 0 ? $seperator : strlen($this->subpath)) - $pos2);
         } elseif ($pos3 > 11) {
             $type = 'user_image';
             // user images may be:
             // upload_123pic, upload_123
             // usr_123.jpg, usr_123_small.jpg, usr_123_xsmall.jpg, usr_123_xxsmall.jpg
             $seperator = strpos($this->subpath, '_', $pos3);
             $obj_id = (int) substr($this->subpath, $seperator + 1);
         } elseif ($pos4 > 3) {
             $plugin = false;
             $seperator = strpos($this->subpath, '/', $pos4);
             $path = explode("/", substr($this->subpath, $seperator + 1));
             $component = array_shift($path);
             if (substr($component, 0, 2) == "il") {
                 $component = substr($component, 2);
                 $comp_dir = null;
                 if (ilComponent::lookupId(IL_COMP_MODULE, $component)) {
                     $comp_dir = "Modules";
                 } else {
                     if (ilComponent::lookupId(IL_COMP_SERVICE, $component)) {
                         $comp_dir = "Services";
                     } else {
                         if ($objDefinition->isPlugin($pl_id = strtolower($component))) {
                             $comp_class = $objDefinition->getClassName($pl_id);
                             $comp_dir = $objDefinition->getLocation($pl_id);
                             $plugin = true;
                         }
                     }
                 }
                 if ($comp_dir) {
                     if ($plugin) {
                         $comp_class = "il" . $comp_class . "WebAccessChecker";
                         $comp_include = $comp_dir . "/class." . $comp_class . ".php";
                     } else {
                         $comp_class = "il" . $component . "WebAccessChecker";
                         $comp_include = $comp_dir . "/" . $component . "/classes/class." . $comp_class . ".php";
                     }
                     if (file_exists($comp_include)) {
                         include_once $comp_include;
                         if (class_exists($comp_class)) {
                             $comp_inst = new $comp_class();
                             if ($comp_inst instanceof ilComponentWebAccessChecker) {
                                 if ($comp_inst->isValidPath($path)) {
                                     $type = "sec";
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     if (!$obj_id && $type != "sec" || $type == 'none') {
         $this->errorcode = 404;
         $this->errortext = $this->lng->txt("obj_not_found");
         return false;
     }
     // #13237 - if imporint is display on login page we have user id 0
     if ($type == "mob") {
         $usages = ilObjMediaObject::lookupUsages($obj_id);
         foreach ($usages as $usage) {
             if ($usage['type'] == 'impr:pg') {
                 return $this->checkAccessMobUsage($usage, 1);
             }
         }
     }
     // get proper user id (could be anonymous)
     ilInitialisation::authenticate();
     // do this here because ip based checking may be set after construction
     $this->determineUser();
     switch ($type) {
         // SCORM or HTML learning module
         case 'lm':
             if ($this->checkAccessObject($obj_id)) {
                 return true;
             }
             break;
             // media object
         // media object
         case 'mob':
             if ($this->checkAccessMob($obj_id)) {
                 return true;
             }
             break;
             // image in user profile
         // image in user profile
         case 'user_image':
             if ($this->checkAccessUserImage($obj_id)) {
                 return true;
             }
             break;
         case 'sec':
             if ($obj_id = $comp_inst->getRepositoryObjectId()) {
                 return $this->checkAccessObject($obj_id);
             } else {
                 return $comp_inst->checkAccess($this->check_users);
             }
             break;
     }
     // none of the checks above gives access
     $this->errorcode = 403;
     $this->errortext = $this->lng->txt('msg_no_perm_read');
     return false;
 }
 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();
 }
Example #10
0
 /**
  * Renaming the session 
  */
 function renameSession($ticket)
 {
     phpCAS::traceBegin();
     if ($this->_start_session) {
         if (!empty($this->_user)) {
             $old_session = $_SESSION;
             session_destroy();
             // Fix for http://bugs.php.net/bug.php?id=32330
             if (version_compare(PHP_VERSION, '5.3.0', '<')) {
                 include_once './Services/Init/classes/class.ilInitialisation.php';
                 ilInitialisation::setSessionHandler();
             }
             // set up a new session, of name based on the ticket
             $session_id = preg_replace('/[^\\w]/', '', $ticket);
             phpCAS::trace("Session ID: " . $session_id);
             session_id($session_id);
             session_start();
             phpCAS::trace("Restoring old session vars");
             $_SESSION = $old_session;
         } else {
             phpCAS::error('Session should only be renamed after successfull authentication');
         }
     } else {
         phpCAS::trace("Skipping session rename since phpCAS is not handling the session.");
     }
     phpCAS::traceEnd();
 }
Example #11
0
<?php

/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
chdir('../../..');
include_once 'Services/Authentication/classes/class.ilAuthFactory.php';
ilAuthFactory::setContext(ilAuthFactory::CONTEXT_SOAP);
include_once 'Services/Init/classes/class.ilInitialisation.php';
$ilInit = new ilInitialisation();
$GLOBALS['ilInit'] = $ilInit;
$ilInit->initILIAS('webdav');
include_once './Services/WebServices/Rest/classes/class.ilRestServer.php';
$server = new ilRestServer();
$server->config('debug', true);
$server->init();
$server->run();
Example #12
0
<?php

require_once "Services/InitScorm2004store/classes/class.ilInitialisation.php";
$ilInit = new ilInitialisation();
$GLOBALS['ilInit'] = $ilInit;
$ilInit->initILIAS();
 public static function initILIAS()
 {
     parent::initILIAS();
     // needed to get $rbarcreview initialized
     parent::initAccessHandling();
 }