public function executeCommand()
 {
     if ($this->isAccessDenied()) {
         $this->ilias->raiseError($this->lng->txt("permission_denied"), $this->ilias->error_obj->MESSAGE);
     }
     $nextClass = $this->ctrl->getNextClass();
     $this->manageTabs($nextClass);
     switch ($nextClass) {
         case 'ilassquestionskillassignmentsgui':
             $questionContainerId = $this->getQuestionContainerId();
             require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionList.php';
             $questionList = new ilAssQuestionList($this->db, $this->lng, $this->pluginAdmin);
             $questionList->setParentObjId($questionContainerId);
             $questionList->setQuestionInstanceTypeFilter($this->getRequiredQuestionInstanceTypeFilter());
             $questionList->load();
             $gui = new ilAssQuestionSkillAssignmentsGUI($this->ctrl, $this->access, $this->tpl, $this->lng, $this->db);
             $gui->setAssignmentEditingEnabled($this->isAssignmentEditingRequired());
             $gui->setQuestionContainerId($questionContainerId);
             $gui->setQuestionList($questionList);
             if ($this->testOBJ->isFixedTest()) {
                 $gui->setQuestionOrderSequence($this->testOBJ->getQuestions());
             } else {
                 $gui->setAssignmentConfigurationHintMessage($this->buildAssignmentConfigurationInPoolHintMessage());
             }
             $this->ctrl->forwardCommand($gui);
             break;
         case 'iltestskilllevelthresholdsgui':
             $gui = new ilTestSkillLevelThresholdsGUI($this->ctrl, $this->tpl, $this->lng, $this->db, $this->testOBJ->getTestId());
             $gui->setQuestionAssignmentColumnsEnabled(!$this->testOBJ->isRandomTest());
             $gui->setQuestionContainerId($this->getQuestionContainerId());
             $this->ctrl->forwardCommand($gui);
             break;
     }
 }
 public function executeCommand()
 {
     if ($this->isAccessDenied()) {
         $this->ilias->raiseError($this->lng->txt("permission_denied"), $this->ilias->error_obj->MESSAGE);
     }
     $nextClass = $this->ctrl->getNextClass();
     $this->manageTabs($nextClass);
     switch ($nextClass) {
         case 'ilassquestionskillassignmentsgui':
             require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionList.php';
             $questionList = new ilAssQuestionList($this->db, $this->lng, $this->pluginAdmin);
             $questionList->setParentObjId($this->poolOBJ->getId());
             $questionList->setQuestionInstanceTypeFilter(ilAssQuestionList::QUESTION_INSTANCE_TYPE_ORIGINALS);
             $questionList->load();
             $gui = new ilAssQuestionSkillAssignmentsGUI($this->ctrl, $this->access, $this->tpl, $this->lng, $this->db);
             $gui->setAssignmentEditingEnabled(true);
             $gui->setQuestionContainerId($this->poolOBJ->getId());
             $gui->setQuestionList($questionList);
             $this->ctrl->forwardCommand($gui);
             break;
         case 'ilassquestionskillusagestablegui':
             $gui = new ilAssQuestionSkillUsagesTableGUI($this->ctrl, $this->tpl, $this->lng, $this->db, $this->poolOBJ->getId());
             $this->ctrl->forwardCommand($gui);
             break;
     }
 }
Exemplo n.º 3
0
 /**
  * 
  */
 public function performMergeThreadsObject()
 {
     /**
      * @var $lng ilLanguage
      */
     global $lng;
     if (!$this->is_moderator) {
         $this->ilias->raiseError($this->lng->txt('permission_denied'), $this->ilias->error_obj->MESSAGE);
     }
     if (!isset($_POST['thread_ids']) || !is_array($_POST['thread_ids']) || count($_POST['thread_ids']) != 2) {
         ilUtil::sendFailure($this->lng->txt('select_one'));
         $this->showThreadsObject();
         return;
     }
     if ((int) $_POST['thread_ids'][0] == (int) $_POST['thread_ids'][1]) {
         ilUtil::sendFailure($this->lng->txt('error_same_thread_ids'));
         $this->showThreadsObject();
         return;
     }
     try {
         ilForum::mergeThreads($this->object->id, (int) $_POST['thread_ids'][0], (int) $_POST['thread_ids'][1]);
         ilUtil::sendSuccess($this->lng->txt('merged_threads_successfully'));
     } catch (ilException $e) {
         return ilUtil::sendFailure($lng->txt($e->getMessage()));
     }
     $this->showThreadsObject();
 }
 public function executeCommand()
 {
     if ($this->isAccessDenied()) {
         $this->ilias->raiseError($this->lng->txt("permission_denied"), $this->ilias->error_obj->MESSAGE);
     }
     $nextClass = $this->ctrl->getNextClass();
     $this->manageTabs($nextClass);
     switch ($nextClass) {
         case 'iltestskillquestionassignmentsgui':
             $gui = new ilTestSkillQuestionAssignmentsGUI($this->ctrl, $this->tpl, $this->lng, $this->db, $this->testOBJ);
             $this->ctrl->forwardCommand($gui);
             break;
         case 'iltestskilllevelthresholdsgui':
             $gui = new ilTestSkillLevelThresholdsGUI($this->ctrl, $this->tpl, $this->lng, $this->db, $this->testOBJ);
             $this->ctrl->forwardCommand($gui);
             break;
     }
 }
Exemplo n.º 5
0
 /**
  * Add subtabs for editing type
  */
 protected function setSubTabsEdit($active_tab_id)
 {
     $this->tabs->addSubTab('general', $this->lng->txt('meta_general'), $this->ctrl->getLinkTarget($this, 'edit'));
     if ($this->ilias->getSetting('custom_icons')) {
         $this->tabs->addSubTab('custom_icons', $this->lng->txt('icon_settings'), $this->ctrl->getLinkTarget($this, 'editCustomIcons'));
     }
     if (count(ilOrgUnitType::getAvailableAdvancedMDRecordIds())) {
         $this->tabs->addSubTab('amd', $this->lng->txt('md_advanced'), $this->ctrl->getLinkTarget($this, 'editAMD'));
     }
     $this->tabs->setSubTabActive($active_tab_id);
 }
 protected function initHeaderAction($a_sub_type = null, $a_sub_id = null)
 {
     /**
      * @var $ilUser ilObjUser
      */
     global $ilUser;
     $lg = parent::initHeaderAction();
     // Workaround: Do not show "desktop actions" in thread view
     if ($this->objCurrentTopic->getId()) {
         $container_obj = null;
         $lg->setContainerObject($container_obj);
     }
     if ($lg instanceof ilObjForumListGUI) {
         include_once 'Modules/Forum/classes/class.ilForumNotification.php';
         $frm_noti = new ilForumNotification((int) $_GET['ref_id']);
         $frm_noti->setUserId($ilUser->getId());
         $user_toggle = $frm_noti->isUserToggleNotification();
         // Notification button
         $notificiation_enabled = false;
         if ($ilUser->getId() != ANONYMOUS_USER_ID && $this->ilias->getSetting('forum_notification') != 0 && $user_toggle != 1) {
             $frm = $this->object->Forum;
             $frm->setForumId($this->object->getId());
             $frm->setForumRefId($this->object->getRefId());
             $frm->setMDB2Wherecondition('top_frm_fk = %s ', array('integer'), array($frm->getForumId()));
             if ($this->objCurrentTopic->getId()) {
                 $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentTopic->getId());
             }
             if ($frm->isForumNotificationEnabled($ilUser->getId())) {
                 $lg->addCustomCommand($this->ctrl->getLinkTarget($this, 'disableForumNotification'), "forums_disable_forum_notification");
                 $notificiation_enabled = true;
             } else {
                 $lg->addCustomCommand($this->ctrl->getLinkTarget($this, 'enableForumNotification'), "forums_enable_forum_notification");
             }
             if ($this->objCurrentTopic->getId()) {
                 if ($this->objCurrentTopic->isNotificationEnabled($ilUser->getId())) {
                     $lg->addCustomCommand($this->ctrl->getLinkTarget($this, 'toggleThreadNotification'), "forums_disable_notification");
                     $notificiation_enabled = true;
                 } else {
                     $lg->addCustomCommand($this->ctrl->getLinkTarget($this, 'toggleThreadNotification'), "forums_enable_notification");
                 }
             }
             $this->ctrl->setParameter($this, 'thr_pk', '');
             if ($notificiation_enabled) {
                 $lg->addHeaderIcon("not_icon", ilUtil::getImagePath("notification_on.png"), $this->lng->txt("frm_notification_activated"));
             } else {
                 $lg->addHeaderIcon("not_icon", ilUtil::getImagePath("notification_off.png"), $this->lng->txt("frm_notification_deactivated"));
             }
         }
     }
     return $lg;
 }
 /**
  * Creates (or reuses) a password assistance session, and sends a password
  * assistance mail to the specified user.
  * Note: To prevent DOS attacks, a new session is created only, if no session
  * exists, or if the existing session has been expired.
  * The password assistance mail contains an URL, which points to this script
  * and contains the following URL parameters:
  * client_id
  * key
  * @param $email
  * @param $logins
  */
 public function sendUsernameAssistanceMail($email, array $logins)
 {
     require_once 'Services/Mail/classes/class.ilMailbox.php';
     require_once 'Services/Mail/classes/class.ilMimeMail.php';
     require_once 'include/inc.pwassist_session_handler.php';
     $protocol = $this->https->isDetected() ? 'https://' : 'http://';
     $server_url = $protocol . $_SERVER['HTTP_HOST'] . substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], '/')) . '/';
     $login_url = $server_url . 'pwassist.php' . '?client_id=' . $this->ilias->getClientId() . '&lang=' . $this->lng->getLangKey();
     $contact_address = $this->settings->get('admin_email');
     $mm = new ilMimeMail();
     $mm->Subject($this->lng->txt('pwassist_mail_subject'));
     $mm->From($contact_address);
     $mm->To($email);
     $mm->Body(str_replace(array("\\n", "\\t"), array("\n", "\t"), sprintf($this->lng->txt('pwassist_username_mail_body'), join($logins, ",\n"), $server_url, $_SERVER['REMOTE_ADDR'], $email, 'mailto:' . $contact_address, $login_url)));
     $mm->Send();
 }
 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");
 }