Exemple #1
0
 /**
  * Constructor
  * @access	public
  */
 public function __construct()
 {
     global $ilDB, $ilErr, $ilias;
     // set db & error handler
     isset($ilDB) ? $this->ilDB =& $ilDB : ($this->ilDB =& $ilias->db);
     if (!isset($ilErr)) {
         $ilErr = new ilErrorHandling();
         $ilErr->setErrorHandling(PEAR_ERROR_CALLBACK, array($ilErr, 'errorHandler'));
     } else {
         $this->ilErr =& $ilErr;
     }
 }
 /**
  * Constructor
  * @access	public
  */
 function ilRbacReview()
 {
     global $ilDB, $ilErr, $ilias, $ilLog;
     $this->log =& $ilLog;
     // set db & error handler
     isset($ilDB) ? $this->ilDB =& $ilDB : ($this->ilDB =& $ilias->db);
     if (!isset($ilErr)) {
         $ilErr = new ilErrorHandling();
         $ilErr->setErrorHandling(PEAR_ERROR_CALLBACK, array($ilErr, 'errorHandler'));
     } else {
         $this->ilErr =& $ilErr;
     }
 }
 /**
  * Constructor
  * @access	public
  */
 protected function ilRbacSystem()
 {
     global $ilDB, $ilErr, $ilias;
     $this->ilias =& $ilias;
     // set db & error handler
     isset($ilDB) ? $this->ilDB =& $ilDB : ($this->ilDB =& $ilias->db);
     if (!isset($ilErr)) {
         $ilErr = new ilErrorHandling();
         $ilErr->setErrorHandling(PEAR_ERROR_CALLBACK, array($ilErr, 'errorHandler'));
     } else {
         $this->ilErr =& $ilErr;
     }
 }
 public function __construct($a_gui_obj)
 {
     global $ilias, $objDefinition, $tpl, $tree, $ilCtrl, $ilErr, $lng;
     if (!isset($ilErr)) {
         $ilErr = new ilErrorHandling();
         $ilErr->setErrorHandling(PEAR_ERROR_CALLBACK, array($ilErr, 'errorHandler'));
     } else {
         $this->ilErr =& $ilErr;
     }
     $this->objDefinition =& $objDefinition;
     $this->tpl =& $tpl;
     $this->lng =& $lng;
     $this->lng->loadLanguageModule("rbac");
     $this->ctrl =& $ilCtrl;
     $this->gui_obj = $a_gui_obj;
     $this->roles = array();
     $this->num_roles = 0;
 }
 /**
  * Constructor
  * @access	public
  * @param	array	??
  * @param	integer	object id
  * @param	boolean	call be reference
  */
 function ilObjiLincUserGUI(&$a_user_obj, &$a_usrf_ref_id)
 {
     global $ilias, $tpl, $ilCtrl, $ilErr, $lng;
     if (!isset($ilErr)) {
         $ilErr = new ilErrorHandling();
         $ilErr->setErrorHandling(PEAR_ERROR_CALLBACK, array($ilErr, 'errorHandler'));
     } else {
         $this->ilErr =& $ilErr;
     }
     $this->ilias =& $ilias;
     $this->tpl =& $tpl;
     $this->lng =& $lng;
     $this->ctrl =& $ilCtrl;
     $this->lng->loadLanguageModule('ilinc');
     $this->usrf_ref_id =& $a_usrf_ref_id;
     $this->user =& $a_user_obj;
     $this->ilinc_user = new ilObjiLincUser($a_user_obj);
 }
 /**
  * Constructor
  * @access	public
  * @param	array	??
  * @param	integer	object id
  * @param	boolean	call be reference
  */
 function ilObjectGUI($a_data, $a_id = 0, $a_call_by_reference = true, $a_prepare_output = true)
 {
     global $ilias, $objDefinition, $tpl, $tree, $ilCtrl, $ilErr, $lng, $ilTabs;
     $this->tabs_gui =& $ilTabs;
     if (!isset($ilErr)) {
         $ilErr = new ilErrorHandling();
         $ilErr->setErrorHandling(PEAR_ERROR_CALLBACK, array($ilErr, 'errorHandler'));
     } else {
         $this->ilErr =& $ilErr;
     }
     $this->ilias =& $ilias;
     $this->objDefinition =& $objDefinition;
     $this->tpl =& $tpl;
     $this->html = "";
     $this->ctrl =& $ilCtrl;
     $params = array("ref_id");
     if (!$a_call_by_reference) {
         $params = array("ref_id", "obj_id");
     }
     $this->ctrl->saveParameter($this, $params);
     $this->lng =& $lng;
     $this->tree =& $tree;
     $this->formaction = array();
     $this->return_location = array();
     $this->target_frame = array();
     $this->actions = "";
     $this->sub_objects = "";
     $this->data = $a_data;
     $this->id = $a_id;
     $this->call_by_reference = $a_call_by_reference;
     $this->prepare_output = $a_prepare_output;
     $this->creation_mode = false;
     $this->ref_id = $this->call_by_reference ? $this->id : $_GET["ref_id"];
     $this->obj_id = $this->call_by_reference ? $_GET["obj_id"] : $this->id;
     if ($this->id != 0) {
         $this->link_params = "ref_id=" . $this->ref_id;
     }
     // get the object
     $this->assignObject();
     // set context
     if (is_object($this->object)) {
         if ($this->call_by_reference && $this->ref_id == $_GET["ref_id"]) {
             $this->ctrl->setContext($this->object->getId(), $this->object->getType());
         }
     }
     // use global $lng instead, when creating new objects object is not available
     //$this->lng =& $this->object->lng;
     //prepare output
     if ($a_prepare_output) {
         $this->prepareOutput();
     }
 }
 /**
  * Constructor
  * @access	public
  * @param	integer	$a_tree_id		tree_id
  * @param	integer	$a_root_id		root_id (optional)
  */
 function ilTree($a_tree_id, $a_root_id = 0)
 {
     global $ilDB, $ilErr, $ilias, $ilLog;
     // set db & error handler
     $this->ilDB = $ilDB;
     if (!isset($ilErr)) {
         $ilErr = new ilErrorHandling();
         $ilErr->setErrorHandling(PEAR_ERROR_CALLBACK, array($ilErr, 'errorHandler'));
     } else {
         $this->ilErr = $ilErr;
     }
     $this->lang_code = "en";
     if (!isset($a_tree_id) or func_num_args() == 0) {
         $this->ilErr->raiseError(get_class($this) . "::Constructor(): No tree_id given!", $this->ilErr->WARNING);
     }
     if (func_num_args() > 2) {
         $this->ilErr->raiseError(get_class($this) . "::Constructor(): Wrong parameter count!", $this->ilErr->WARNING);
     }
     // CREATE LOGGER INSTANCE
     $this->log = $ilLog;
     //init variables
     if (empty($a_root_id)) {
         $a_root_id = ROOT_FOLDER_ID;
     }
     $this->tree_id = $a_tree_id;
     $this->root_id = $a_root_id;
     $this->table_tree = 'tree';
     $this->table_obj_data = 'object_data';
     $this->table_obj_reference = 'object_reference';
     $this->ref_pk = 'ref_id';
     $this->obj_pk = 'obj_id';
     $this->tree_pk = 'tree';
     $this->use_cache = true;
     // If cache is activated, cache object translations to improve performance
     $this->translation_cache = array();
     $this->parent_type_cache = array();
     // By default, we create gaps in the tree sequence numbering for 50 nodes
     $this->gap = 50;
 }
 /**
  * Constructor
  *
  * @param int $a_id
  * @param int $a_id_type
  * @param int $a_parent_node_id
  */
 function __construct($a_id = 0, $a_id_type = self::REPOSITORY_NODE_ID, $a_parent_node_id = 0)
 {
     global $objDefinition, $tpl, $ilCtrl, $ilErr, $lng, $ilTabs, $tree, $ilAccess;
     if (!isset($ilErr)) {
         $ilErr = new ilErrorHandling();
         $ilErr->setErrorHandling(PEAR_ERROR_CALLBACK, array($ilErr, 'errorHandler'));
     } else {
         $this->ilErr =& $ilErr;
     }
     $this->id_type = $a_id_type;
     $this->parent_id = $a_parent_node_id;
     $this->type = $this->getType();
     $this->html = "";
     // use globals instead?
     $this->tabs_gui = $ilTabs;
     $this->objDefinition = $objDefinition;
     $this->tpl = $tpl;
     $this->ctrl = $ilCtrl;
     $this->lng = $lng;
     $params = array();
     switch ($this->id_type) {
         case self::REPOSITORY_NODE_ID:
             $this->node_id = $a_id;
             $this->object_id = ilObject::_lookupObjectId($this->node_id);
             $this->tree = $tree;
             $this->access_handler = $ilAccess;
             $this->call_by_reference = true;
             // needed for prepareOutput()
             $params[] = "ref_id";
             break;
         case self::REPOSITORY_OBJECT_ID:
             $this->object_id = $a_id;
             $this->tree = $tree;
             $this->access_handler = $ilAccess;
             $params[] = "obj_id";
             // ???
             break;
         case self::WORKSPACE_NODE_ID:
             global $ilUser;
             $this->node_id = $a_id;
             include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
             $this->tree = new ilWorkspaceTree($ilUser->getId());
             $this->object_id = $this->tree->lookupObjectId($this->node_id);
             include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
             $this->access_handler = new ilWorkspaceAccessHandler($this->tree);
             $params[] = "wsp_id";
             break;
         case self::WORKSPACE_OBJECT_ID:
             global $ilUser;
             $this->object_id = $a_id;
             include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
             $this->tree = new ilWorkspaceTree($ilUser->getId());
             include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
             $this->access_handler = new ilWorkspaceAccessHandler($this->tree);
             $params[] = "obj_id";
             // ???
             break;
         case self::PORTFOLIO_OBJECT_ID:
             $this->object_id = $a_id;
             include_once './Modules/Portfolio/classes/class.ilPortfolioAccessHandler.php';
             $this->access_handler = new ilPortfolioAccessHandler();
             $params[] = "prt_id";
             break;
         case self::OBJECT_ID:
             $this->object_id = $a_id;
             include_once "Services/Object/classes/class.ilDummyAccessHandler.php";
             $this->access_handler = new ilDummyAccessHandler();
             $params[] = "obj_id";
             break;
     }
     $this->ctrl->saveParameter($this, $params);
     // old stuff for legacy code (obsolete?)
     if (!$this->object_id) {
         $this->creation_mode = true;
     }
     if ($this->node_id) {
         // add parent node id if missing
         if (!$this->parent_id && $this->tree) {
             $this->parent_id = $this->tree->getParentId($this->node_id);
         }
     }
     $this->ref_id = $this->node_id;
     $this->obj_id = $this->object_id;
     $this->assignObject();
     // set context
     if (is_object($this->object)) {
         $this->ctrl->setContext($this->object->getId(), $this->object->getType());
     }
     $this->afterConstructor();
 }
 function initIlias($context = "web")
 {
     global $ilDB, $ilUser, $ilLog, $ilErr, $ilClientIniFile, $ilIliasIniFile, $ilSetting, $ilias, $https, $ilObjDataCache, $ilLog, $objDefinition, $lng, $ilCtrl, $ilBrowser, $ilHelp, $ilTabs, $ilMainMenu, $rbacsystem, $ilNavigationHistory;
     // remove unsafe characters
     $this->removeUnsafeCharacters();
     // error reporting
     // remove notices from error reporting
     if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
         error_reporting(ini_get("error_reporting") & ~E_NOTICE & ~E_DEPRECATED);
     } else {
         error_reporting(ini_get('error_reporting') & ~E_NOTICE);
     }
     // include common code files
     $this->requireCommonIncludes();
     global $ilBench;
     // set error handler (to do: check preconditions for error handler to work)
     $ilBench->start("Core", "HeaderInclude_GetErrorHandler");
     $ilErr = new ilErrorHandling();
     $GLOBALS['ilErr'] =& $ilErr;
     $ilErr->setErrorHandling(PEAR_ERROR_CALLBACK, array($ilErr, 'errorHandler'));
     $ilBench->stop("Core", "HeaderInclude_GetErrorHandler");
     // prepare file access to work with safe mode (has been done in class ilias before)
     umask(0117);
     // set cookie params
     $this->setCookieParams();
     // $ilIliasIniFile initialisation
     $this->initIliasIniFile();
     // CLIENT_ID determination
     $this->determineClient();
     // $ilAppEventHandler initialisation
     $this->initEventHandling();
     // $ilClientIniFile initialisation
     $this->initClientIniFile();
     // removed redirection madness the service should respond with SERVICE UNAVAILABLE
     // $ilDB initialisation
     $this->initDatabase();
     // init plugin admin class
     include_once "Services/Component/classes/class.ilPluginAdmin.php";
     $ilPluginAdmin = new ilPluginAdmin();
     $GLOBALS['ilPluginAdmin'] = $ilPluginAdmin;
     // set session handler
     $this->setSessionHandler();
     // $ilSetting initialisation
     $this->initSettings();
     // $ilLog initialisation
     $this->initLog();
     // $https initialisation
     require_once 'classes/class.ilHTTPS.php';
     $https = new ilHTTPS();
     $GLOBALS['https'] =& $https;
     $https->enableSecureCookies();
     $https->checkPort();
     if ($this->returnBeforeAuth()) {
         return;
     }
     $ilCtrl = new ilCtrl2();
     $GLOBALS['ilCtrl'] =& $ilCtrl;
     // $ilAuth initialisation
     include_once "Services/Authentication/classes/class.ilAuthUtils.php";
     ilAuthUtils::_initAuth();
     global $ilAuth;
     $this->includePhp5Compliance();
     // Do not accept external session ids
     if (!ilSession::_exists(session_id())) {
         // $_GET["PHPSESSID"] = "";
         session_regenerate_id();
     }
     // $ilias initialisation
     global $ilias, $ilBench;
     $ilBench->start("Core", "HeaderInclude_GetILIASObject");
     $ilias = new ILIAS();
     $GLOBALS['ilias'] =& $ilias;
     $ilBench->stop("Core", "HeaderInclude_GetILIASObject");
     // $ilObjDataCache initialisation
     $ilObjDataCache = new ilObjectDataCache();
     $GLOBALS['ilObjDataCache'] =& $ilObjDataCache;
     // workaround: load old post variables if error handler 'message' was called
     if (isset($_SESSION["message"]) && $_SESSION["message"]) {
         $_POST = $_SESSION["post_vars"];
     }
     // put debugging functions here
     require_once "include/inc.debug.php";
     // $objDefinition initialisation
     $ilBench->start("Core", "HeaderInclude_getObjectDefinitions");
     $objDefinition = new ilObjectDefinition();
     $GLOBALS['objDefinition'] =& $objDefinition;
     // $objDefinition->startParsing();
     $ilBench->stop("Core", "HeaderInclude_getObjectDefinitions");
     // init tree
     $tree = new ilTree(ROOT_FOLDER_ID);
     $GLOBALS['tree'] =& $tree;
     // $ilAccess and $rbac... initialisation
     $this->initAccessHandling();
     // authenticate & start session
     PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array($ilErr, "errorHandler"));
     $ilBench->start("Core", "HeaderInclude_Authentication");
     //var_dump($_SESSION);
     ////require_once('Log.php');
     ////$ilAuth->logger = Log::singleton('error_log',PEAR_LOG_TYPE_SYSTEM,'TEST');
     ////$ilAuth->enableLogging = true;
     if (!defined("IL_PHPUNIT_TEST")) {
         $oldSid = session_id();
         $ilAuth->start();
         $newSid = session_id();
         include_once 'Services/Payment/classes/class.ilPaymentShoppingCart.php';
         ilPaymentShoppingCart::_migrateShoppingCart($oldSid, $newSid);
     }
     //var_dump($_SESSION);
     $ilias->setAuthError($ilErr->getLastError());
     $ilBench->stop("Core", "HeaderInclude_Authentication");
     // workaround: force login
     if (!empty($_GET["cmd"]) && $_GET["cmd"] == "force_login" || $this->script == "login.php") {
         $ilAuth->logout();
         if (!isset($_GET['forceShoppingCartRedirect'])) {
             $_SESSION = array();
         }
         $_SESSION["AccountId"] = "";
         $ilAuth->start();
         $ilias->setAuthError($ilErr->getLastError());
     }
     // check correct setup
     if (!$ilias->getSetting("setup_ok")) {
         die("Setup is not completed. Please run setup routine again.");
     }
     // $ilUser initialisation (1)
     $ilBench->start("Core", "HeaderInclude_getCurrentUser");
     $ilUser = new ilObjUser();
     $ilias->account =& $ilUser;
     $GLOBALS['ilUser'] =& $ilUser;
     $ilBench->stop("Core", "HeaderInclude_getCurrentUser");
     // $ilCtrl initialisation
     //$ilCtrl = new ilCtrl();
     // determin current script and up-path to main directory
     // (sets $this->script and $this->updir)
     $this->determineScriptAndUpDir();
     // $styleDefinition initialisation and style handling for login and co.
     $this->initStyle();
     if (in_array($this->script, array("login.php", "register.php", "view_usr_agreement.php")) || $_GET["baseClass"] == "ilStartUpGUI") {
         $this->handleStyle();
     }
     // init locale
     $this->initLocale();
     // handle ILIAS 2 imported users:
     // check ilias 2 password, if authentication failed
     // only if AUTH_LOCAL
     //echo "A";
     if (AUTH_CURRENT == AUTH_LOCAL && !$ilAuth->getAuth() && $this->script == "login.php" && $_POST["username"] != "") {
         if (ilObjUser::_lookupHasIlias2Password(ilUtil::stripSlashes($_POST["username"]))) {
             if (ilObjUser::_switchToIlias3Password(ilUtil::stripSlashes($_POST["username"]), ilUtil::stripSlashes($_POST["password"]))) {
                 $ilAuth->start();
                 $ilias->setAuthError($ilErr->getLastError());
                 ilUtil::redirect("index.php");
             }
         }
     }
     //
     // SUCCESSFUL AUTHENTICATION
     //
     if ($ilAuth->getStatus() == '' && $ilias->account->isCurrentUserActive() || defined("IL_PHPUNIT_TEST") && DEVMODE) {
         //echo "C"; exit;
         $ilBench->start("Core", "HeaderInclude_getCurrentUserAccountData");
         //var_dump($_SESSION);
         // get user data
         $this->initUserAccount();
         //var_dump($_SESSION);
         // differentiate account security mode
         require_once 'Services/PrivacySecurity/classes/class.ilSecuritySettings.php';
         $security_settings = ilSecuritySettings::_getInstance();
         if ($security_settings->getAccountSecurityMode() == ilSecuritySettings::ACCOUNT_SECURITY_MODE_CUSTOMIZED) {
             // reset counter for failed logins
             ilObjUser::_resetLoginAttempts($ilUser->getId());
         }
         $ilBench->stop("Core", "HeaderInclude_getCurrentUserAccountData");
     } else {
         if (!$ilAuth->getAuth()) {
             require_once 'Services/PrivacySecurity/classes/class.ilSecuritySettings.php';
             // differentiate account security mode
             $security = ilSecuritySettings::_getInstance();
             if ($security->getAccountSecurityMode() == ilSecuritySettings::ACCOUNT_SECURITY_MODE_CUSTOMIZED) {
                 if (isset($_POST['username']) && $_POST['username'] && $ilUser->getId() == 0) {
                     $username = ilUtil::stripSlashes($_POST['username']);
                     $usr_id = ilObjUser::_lookupId($username);
                     if ($usr_id != ANONYMOUS_USER_ID) {
                         ilObjUser::_incrementLoginAttempts($usr_id);
                         $login_attempts = ilObjUser::_getLoginAttempts($usr_id);
                         $max_attempts = $security->getLoginMaxAttempts();
                         if ($login_attempts >= $max_attempts && $usr_id != SYSTEM_USER_ID && $max_attempts > 0) {
                             ilObjUser::_setUserInactive($usr_id);
                         }
                     }
                 }
             }
         }
     }
     //
     // SUCCESSFUL AUTHENTICATED or NON-AUTH-AREA (Login, Registration, ...)
     //
     // $lng initialisation
     $this->initLanguage();
     // store user language in tree
     $GLOBALS['tree']->initLangCode();
     // ### AA 03.10.29 added new LocatorGUI class ###
     // when locator data array does not exist, initialise
     if (!isset($_SESSION["locator_level"])) {
         $_SESSION["locator_data"] = array();
         $_SESSION["locator_level"] = -1;
     }
     // initialise global ilias_locator object
     // ECS Tasks
     include_once 'Services/WebServices/ECS/classes/class.ilECSTaskScheduler.php';
     $scheduler = ilECSTaskScheduler::start();
     $ilBench->stop("Core", "HeaderInclude");
 }
Exemple #10
0
require_once "./Services/Logging/classes/class.ilLog.php";
require_once "./Services/Authentication/classes/class.ilSession.php";
require_once "./Services/Utilities/classes/class.ilUtil.php";
require_once "./Services/Init/classes/class.ilIniFile.php";
require_once "./Services/Database/classes/class.ilDB.php";
require_once "./setup/classes/class.ilSetupGUI.php";
require_once "./setup/classes/class.Session.php";
require_once "./setup/classes/class.ilClientList.php";
require_once "./setup/classes/class.ilClient.php";
require_once "./Services/FileSystem/classes/class.ilFile.php";
require_once "./setup/classes/class.ilCtrlStructureReader.php";
require_once "./Services/Xml/classes/class.ilSaxParser.php";
require_once "./include/inc.ilias_version.php";
// include error_handling
require_once "./Services/Init/classes/class.ilErrorHandling.php";
$ilErr = new ilErrorHandling();
$ilErr->setErrorHandling(PEAR_ERROR_CALLBACK, array($ilErr, 'errorHandler'));
// set ilias pathes
if ($_SERVER['HTTPS'] == 'on') {
    define("ILIAS_HTTP_PATH", substr("https://" . $_SERVER["HTTP_HOST"] . dirname($_SERVER["REQUEST_URI"]), 0, -6));
} else {
    define("ILIAS_HTTP_PATH", substr("http://" . $_SERVER["HTTP_HOST"] . dirname($_SERVER["REQUEST_URI"]), 0, -6));
}
// PHP is running in CGI mode?
if (isset($_SERVER["REDIRECT_STATUS"]) && !isset($_SERVER["FCGI_ROLE"])) {
    if ($_SERVER["PATH_TRANSLATED"] != "") {
        define("ILIAS_ABSOLUTE_PATH", substr(dirname($_SERVER["PATH_TRANSLATED"]), 0, -6));
    } else {
        define("ILIAS_ABSOLUTE_PATH", substr(dirname($_SERVER["SCRIPT_FILENAME"]), 0, -6));
    }
} else {