function executeCommand() { global $ilUser; // Check for incomplete profile if ($ilUser->getProfileIncomplete()) { ilUtil::redirect('ilias.php?baseClass=ilPersonalDesktopGUI'); } // check whether password of user have to be changed // due to first login or password of user is expired if ($ilUser->isPasswordChangeDemanded() || $ilUser->isPasswordExpired()) { ilUtil::redirect('ilias.php?baseClass=ilPersonalDesktopGUI'); } $next_class = $this->ctrl->getNextClass($this); switch ($next_class) { case 'ilpageobjectgui': $this->prepareOutput(); $ret = $this->forwardToPageObject(); if ($ret != '') { $this->tpl->setContent($ret); } break; default: switch ($this->cmd) { case 'firstpage': $this->clearFilter(); if (!$this->genSet->get('show_general_filter') && !$this->genSet->get('show_topics_filter') && !$this->genSet->get('show_shop_explorer')) { $cmd = 'performSearch'; } else { if (ilPaymentSettings::useShopSpecials() == true) { $cmd = 'showSpecialContent'; } else { $cmd = 'performSearch'; } } break; case 'resetFilter': $cmd = 'resetFilter'; break; case 'setFilter': $cmd = 'setFilter'; break; default: $cmd = 'performSearch'; break; } if ($this->cmd != 'firstpage' && (isset($_GET['ref_id']) || $this->cmd == 'showTree')) { $obj_type = ilObject::_lookupType(ilObject::_lookupObjId($this->cur_ref_id)); $container = array("root", "cat", 'catr', "grp", "icrs", "crs", 'crsr', 'rcrs'); if (in_array($obj_type, $container)) { $cmd = 'showContainerContent'; } else { $cmd = 'performSearch'; } } $this->prepareOutput(); $this->{$cmd}(); break; } return true; }
/** * Handle target parameter * @param object $a_target * @return */ public static function handleCode($a_ref_id, $a_type, $a_code) { global $lng, $tree, $ilUser; include_once './Services/Link/classes/class.ilLink.php'; $lng->loadLanguageModule($a_type); try { self::useCode($a_code, $a_ref_id); $title = ilObject::_lookupTitle(ilObject::_lookupObjectId($a_ref_id)); ilUtil::sendSuccess(sprintf($lng->txt($a_type . "_admission_link_success_registration"), $title), true); ilUtil::redirect(ilLink::_getLink($a_ref_id)); } catch (ilMembershipRegistrationException $e) { switch ($e->getCode()) { case 124: //added to waiting list ilUtil::sendSuccess($e->getMessage(), true); break; case 123: //object is full ilUtil::sendFailure($lng->txt($a_type . "_admission_link_failure_membership_limited"), true); break; case 789: //out of registration period ilUtil::sendFailure($lng->txt($a_type . "_admission_link_failure_registration_period"), true); break; default: ilUtil::sendFailure($e->getMessage(), true); break; } $GLOBALS['ilLog']->logStack(); $GLOBALS['ilLog']->write($e->getCode() . ': ' . $e->getMessage()); $parent_id = $tree->getParentId($a_ref_id); ilUtil::redirect(ilLink::_getLink($parent_id)); } }
protected function checkPermission($a_cmd) { global $ilAccess; $ref_id = $this->object->getRefId(); if (!$ilAccess->checkAccess($a_cmd, "", $ref_id)) { ilUtil::sendFailure($this->lng->txt("permission_denied"), true); ilUtil::redirect("goto.php?target=" . $this->object->getType() . "_" . $ref_id); } }
/** * @return void */ public function adjust() { if (isset($_GET['baseClass']) && strtolower($_GET['baseClass']) == 'ilpersonaldesktopgui') { $this->ctrl->setTargetScript('ilias.php'); ilUtil::redirect($this->ctrl->getLinkTargetByClass(array('ilpersonaldesktopgui', 'ilpersonalprofilegui'), 'showPersonalData', '', false, false)); } else { ilUtil::redirect('ilias.php?baseClass=ilPersonalDesktopGUI'); } }
/** * Handle target parameter * @param object $a_target * @return */ public static function handleCode($a_ref_id, $a_type, $a_code) { include_once './Services/Link/classes/class.ilLink.php'; try { self::useCode($a_code, $a_ref_id); ilUtil::redirect(ilLink::_getLink($a_ref_id, ilObject::_lookupType(ilObject::_lookupObjId($a_ref_id)))); } catch (Exception $e) { $GLOBALS['ilLog']->logStack(); $GLOBALS['ilLog']->write($e->getMessage()); ilUtil::redirect(ilLink::_getLink($e->getCode(), ilObject::_lookupType(ilObject::_lookupObjId($e->getCode())))); } }
function &executeCommand() { global $rbacsystem, $ilUser; // Check for incomplete profile if ($ilUser->getProfileIncomplete()) { ilUtil::redirect('ilias.php?baseClass=ilPersonalDesktopGUI'); } // check whether password of user have to be changed // due to first login or password of user is expired if ($ilUser->isPasswordChangeDemanded() || $ilUser->isPasswordExpired()) { ilUtil::redirect('ilias.php?baseClass=ilPersonalDesktopGUI'); } include_once 'Services/Search/classes/class.ilSearchSettings.php'; // Check hacks if (!$rbacsystem->checkAccess('search', ilSearchSettings::_getSearchSettingRefId())) { $this->ilias->raiseError($this->lng->txt("permission_denied"), $this->ilias->error_obj->MESSAGE); } $forward_class = $this->ctrl->getNextClass($this) ? $this->ctrl->getNextClass($this) : $this->getLastClass(); switch ($forward_class) { case 'illucenesearchgui': $this->setLastClass('illucenesearchgui'); include_once './Services/Search/classes/Lucene/class.ilLuceneSearchGUI.php'; $this->ctrl->forwardCommand(new ilLuceneSearchGUI()); break; case 'illuceneadvancedsearchgui': $this->setLastClass('illuceneadvancedsearchgui'); include_once './Services/Search/classes/Lucene/class.ilLuceneAdvancedSearchGUI.php'; $this->ctrl->forwardCommand(new ilLuceneAdvancedSearchGUI()); break; case 'iladvancedsearchgui': // Remember last class $this->setLastClass('iladvancedsearchgui'); include_once 'Services/Search/classes/class.ilAdvancedSearchGUI.php'; $this->ctrl->forwardCommand(new ilAdvancedSearchGUI()); break; case 'ilsearchgui': // Remember last class $this->setLastClass('ilsearchgui'); default: include_once 'Services/Search/classes/class.ilSearchGUI.php'; $search_gui = new ilSearchGUI(); $this->ctrl->forwardCommand($search_gui); break; } $this->tpl->show(); return true; }
protected function renderFullscreen() { global $tpl, $lng, $ilMainMenu; if (!ilImprint::isActive()) { ilUtil::redirect("ilias.php?baseClass=ilPersonalDesktopGUI"); } $tpl->getStandardTemplate(); $this->setRawPageContent(true); $html = $this->showPage(); $itpl = new ilTemplate("tpl.imprint.html", true, true, "Services/Imprint"); $itpl->setVariable("PAGE_TITLE", $lng->txt("imprint")); $itpl->setVariable("IMPRINT", $html); unset($html); $tpl->setContent($itpl->get()); $ilMainMenu->showLogoOnly(true); echo $tpl->show("DEFAULT", true, false); exit; }
/** * show send mail * * @access public * @param * @return */ public function sendMailToSelectedUsers() { if (isset($_GET['member_id'])) { $_POST['participants'] = array($_GET['member_id']); } else { $_POST['participants'] = array_unique(array_merge((array) $_POST['admins'], (array) $_POST['tutors'], (array) $_POST['members'], (array) $_POST['roles'], (array) $_POST['waiting'], (array) $_POST['subscribers'])); } if (!count($_POST['participants'])) { ilUtil::sendFailure($GLOBALS['lng']->txt("no_checkbox"), TRUE); $this->ctrl->returnToParent($this); return false; } foreach ($_POST['participants'] as $usr_id) { $rcps[] = ilObjUser::_lookupLogin($usr_id); } require_once 'Services/Mail/classes/class.ilMailFormCall.php'; ilUtil::redirect(ilMailFormCall::getRedirectTarget($this->getCurrentObject(), 'members', array(), array('type' => 'new', 'rcp_to' => implode(',', $rcps), 'sig' => $this->createMailSignature()))); return true; }
/** * Auth login function * Redirects to openid provider * @param object $username * @param object $status * @param object $auth * @return */ public function callProvider($username, $status, $auth) { global $ilCtrl; $username = $_POST['oid_username']; if (!$this->parseUsername($username, $auth)) { return false; } $consumer = $this->settings->getConsumer(); $oid_auth = $consumer->begin($username); if (!$oid_auth) { $auth->status = AUTH_WRONG_LOGIN; return false; } include_once 'Auth/OpenID/SReg.php'; $sreg_req = Auth_OpenID_SRegRequest::build(array('nickname'), array('fullname', 'dob', 'email', 'gender', 'postcode', 'language', 'timezone')); if ($sreg_req) { $oid_auth->addExtension($sreg_req); } // TODO: Switch openid v. 1,2 $url = $oid_auth->redirectURL(ILIAS_HTTP_PATH, $this->settings->getReturnLocation()); ilUtil::redirect($url); }
/** * set feedback status for member and redirect to mail screen */ function redirectFeedbackMailObject() { $this->checkPermission("write"); $members = array(); if ($_GET["member_id"] != "") { if ($this->ass->getType() == ilExAssignment::TYPE_UPLOAD_TEAM) { $members = ilExAssignment::getTeamMembersByAssignmentId($this->ass->getId(), $_GET["member_id"]); } else { $members = array($_GET["member_id"]); } } else { if (count($_POST["member"]) > 0) { if ($this->ass->getType() == ilExAssignment::TYPE_UPLOAD_TEAM) { foreach (array_keys($_POST["member"]) as $user_id) { $members = array_merge($members, ilExAssignment::getTeamMembersByAssignmentId($this->ass->getId(), $user_id)); } $members = array_unique($members); } else { $members = array_keys($_POST["member"]); } } } if ($members) { $logins = array(); foreach ($members as $user_id) { ilExAssignment::updateStatusFeedbackForUser($this->ass->getId(), $user_id, 1); $logins[] = ilObjUser::_lookupLogin($user_id); } $logins = implode($logins, ","); require_once 'Services/Mail/classes/class.ilMailFormCall.php'; ilUtil::redirect(ilMailFormCall::getRedirectTarget($this, 'members', array(), array('type' => 'new', 'rcp_to' => $logins))); } ilUtil::sendFailure($this->lng->txt("no_checkbox"), true); $this->ctrl->redirect($this, "members"); }
function mailMembers() { global $ilUser; $members = array(); if (!is_array($this->umail->getSavedData())) { $this->umail->savePostData($ilUser->getId(), array(), "", "", "", "", "", "", "", ""); } $ids = (int) $_GET['search_members'] ? array((int) $_GET['search_members']) : $_POST['search_members']; foreach ($ids as $member) { $login = ilObjUser::_lookupLogin($member); array_push($members, $login); } $mail_data = $this->umail->appendSearchResult($members, "to"); $this->umail->savePostData($mail_data["user_id"], $mail_data["attachments"], $mail_data["rcp_to"], $mail_data["rcp_cc"], $mail_data["rcp_bcc"], $mail_data["m_type"], $mail_data["m_email"], $mail_data["m_subject"], $mail_data["m_message"], $mail_data["use_placeholders"]); ilUtil::redirect("ilias.php?baseClass=ilMailGUI&type=search_res"); }
/** * display status information or report errors messages * in case of error * * @access public */ function importFileObject() { global $_FILES, $rbacsystem, $ilDB, $tpl; include_once "./Modules/LearningModule/classes/class.ilObjLearningModule.php"; if (!$rbacsystem->checkAccess("create", $_GET["ref_id"], $_GET["new_type"])) { $this->ilias->raiseError($this->lng->txt("no_create_permission"), $this->ilias->error_obj->MESSAGE); return; } $form = $this->initImportForm(); if ($form->checkInput()) { // create and insert object in objecttree include_once "./Modules/LearningModule/classes/class.ilObjContentObject.php"; $newObj = new ilObjContentObject(); $newObj->setType($_GET["new_type"]); $newObj->setTitle($_FILES["xmldoc"]["name"]); $newObj->setDescription(""); $newObj->create(true); $newObj->createReference(); $newObj->putInTree($_GET["ref_id"]); $newObj->setPermissions($_GET["ref_id"]); $newObj->notify("new", $_GET["ref_id"], $_GET["parent_non_rbac_id"], $_GET["ref_id"], $newObj->getRefId()); // create learning module tree $newObj->createLMTree(); // import lm from file $mess = $newObj->importFromZipFile($_FILES["xmldoc"]["tmp_name"], $_FILES["xmldoc"]["name"], $_POST["validate"]); if ($mess == "") { ilUtil::sendSuccess($this->lng->txt($this->type . "_added"), true); ilUtil::redirect("ilias.php?ref_id=" . $newObj->getRefId() . "&baseClass=ilLMEditorGUI"); } else { $link = '<a href="' . "ilias.php?ref_id=" . $newObj->getRefId() . "&baseClass=ilLMEditorGUI" . '" target="_top">' . $this->lng->txt("btn_next") . '</a>'; $tpl->setContent("<br />" . $link . "<br /><br />" . $mess . $link); } } else { $form->setValuesByPost(); $tpl->setContent($form->getHtml()); } }
public function mailToList() { global $ilUser, $rbacsystem; // check if current user may send mails include_once "Services/Mail/classes/class.ilMail.php"; $mail = new ilMail($_SESSION["AccountId"]); $mailing_allowed = $rbacsystem->checkAccess('internal_mail', $mail->getMailObjectReferenceId()); if (!$mailing_allowed) { ilUtil::sendFailure($this->lng->txt('no_permission')); return true; } $ml_ids = (int) $_GET['ml_id'] ? array($_GET['ml_id']) : $_POST['ml_id']; if (!$ml_ids) { ilUtil::sendInfo($this->lng->txt('mail_select_one_entry')); $this->showMailingLists(); return true; } $mail_data = $this->umail->getSavedData(); if (!is_array($mail_data)) { $this->umail->savePostData($ilUser->getId(), array(), '', '', '', '', '', '', '', ''); } $lists = array(); foreach ($ml_ids as $id) { if (ilMailingList::_isOwner($id, $ilUser->getId()) && !$this->umail->doesRecipientStillExists('#il_ml_' . $id, $mail_data['rcp_to'])) { $lists[] = '#il_ml_' . $id; } } if (count($lists)) { $mail_data = $this->umail->appendSearchResult($lists, 'to'); $this->umail->savePostData($mail_data['user_id'], $mail_data['attachments'], $mail_data['rcp_to'], $mail_data['rcp_cc'], $mail_data['rcp_bcc'], $mail_data['m_type'], $mail_data['m_email'], $mail_data['m_subject'], $mail_data['m_message'], $mail_data['use_placeholders']); } ilUtil::redirect("ilias.php?baseClass=ilMailGUI&type=search_res"); return true; }
function mailObject() { global $ilUser; $user_ids = $this->getActionUserIds(); if (!$user_ids) { ilUtil::sendFailure($this->lng->txt('select_one')); return $this->viewObject(); } // remove existing (temporary) lists include_once "Services/Contact/classes/class.ilMailingLists.php"; $list = new ilMailingLists($ilUser); $list->deleteTemporaryLists(); // create (temporary) mailing list include_once "Services/Contact/classes/class.ilMailingList.php"; $list = new ilMailingList($ilUser); $list->setMode(ilMailingList::MODE_TEMPORARY); $list->setTitle("-TEMPORARY SYSTEM LIST-"); $list->setDescription("-USER ACCOUNTS MAIL-"); $list->setCreateDate(date("Y-m-d H:i:s")); $list->insert(); $list_id = $list->getId(); // after list has been saved... foreach ($user_ids as $user_id) { $list->assignAddressbookEntry($user_id); } include_once "Services/Mail/classes/class.ilFormatMail.php"; $umail = new ilFormatMail($ilUser->getId()); $mail_data = $umail->getSavedData(); if (!is_array($mail_data)) { $mail_data = array("user_id" => $ilUser->getId()); } // ??? // $mail_data = $umail->appendSearchResult(array('#il_ml_'.$list_id), 'to'); $umail->savePostData($mail_data['user_id'], $mail_data['attachments'], '#il_ml_' . $list_id, $mail_data['rcp_cc'], $mail_data['rcp_bcc'], $mail_data['m_type'], $mail_data['m_email'], $mail_data['m_subject'], $mail_data['m_message'], $mail_data['use_placeholders']); ilUtil::redirect("ilias.php?baseClass=ilMailGUI&type=search_res"); }
/** * 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); } }
/** * Redirects to next parent class that used setReturn */ function returnToParent(&$a_gui_obj, $a_anchor = "") { $script = $this->getParentReturn($a_gui_obj); $script = ilUtil::appendUrlParameterString($script, "redirectSource=" . strtolower(get_class($a_gui_obj))); $script = ilUtil::appendUrlParameterString($script, "cmdMode=" . $_GET["cmdMode"]); if ($a_anchor != "") { $script = $script . "#" . $a_anchor; } ilUtil::redirect($script); }
/** * save question */ function saveReturn() { global $ilUser; $old_id = $_GET["q_id"]; $result = $this->writePostData(); if ($result == 0) { $ilUser->setPref("tst_lastquestiontype", $this->object->getQuestionType()); $ilUser->writePref("tst_lastquestiontype", $this->object->getQuestionType()); $this->object->saveToDb(); $originalexists = $this->object->_questionExistsInPool($this->object->original_id); include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php"; if (($_GET["calling_test"] || isset($_GET['calling_consumer']) && (int) $_GET['calling_consumer']) && $originalexists && assQuestion::_isWriteable($this->object->original_id, $ilUser->getId())) { ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true); $this->ctrl->redirect($this, "originalSyncForm"); return; } elseif ($_GET["calling_test"]) { require_once 'Modules/Test/classes/class.ilObjTest.php'; $test = new ilObjTest($_GET["calling_test"]); #var_dump(assQuestion::_questionExistsInTest($this->object->getId(), $test->getTestId())); $q_id = $this->object->getId(); if (!assQuestion::_questionExistsInTest($this->object->getId(), $test->getTestId())) { global $tree, $ilDB, $ilPluginAdmin; include_once "./Modules/Test/classes/class.ilObjTest.php"; $_GET["ref_id"] = $_GET["calling_test"]; $test = new ilObjTest($_GET["calling_test"], true); require_once 'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php'; $testQuestionSetConfigFactory = new ilTestQuestionSetConfigFactory($tree, $ilDB, $ilPluginAdmin, $test); $new_id = $test->insertQuestion($testQuestionSetConfigFactory->getQuestionSetConfig(), $this->object->getId()); $q_id = $new_id; if (isset($_REQUEST['prev_qid'])) { $test->moveQuestionAfter($this->object->getId() + 1, $_REQUEST['prev_qid']); } $this->ctrl->setParameter($this, 'q_id', $new_id); $this->ctrl->setParameter($this, 'calling_test', $_GET['calling_test']); #$this->ctrl->setParameter($this, 'test_ref_id', false); } ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true); if ($_REQUEST['test_express_mode']) { ilUtil::redirect(ilTestExpressPage::getReturnToPageLink($q_id)); } else { ilUtil::redirect("ilias.php?baseClass=ilObjTestGUI&cmd=questions&ref_id=" . $_GET["calling_test"]); } } else { if ($this->object->getId() != $old_id) { $this->callNewIdListeners($this->object->getId()); ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true); $this->ctrl->redirectByClass("ilobjquestionpoolgui", "questions"); } if (strcmp($_SESSION["info"], "") != 0) { ilUtil::sendSuccess($_SESSION["info"] . "<br />" . $this->lng->txt("msg_obj_modified"), true); } else { ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true); } $this->ctrl->redirectByClass("ilobjquestionpoolgui", "questions"); } } }
/** * save scope for style */ function saveScopeObject() { global $ilias; include_once "./Services/Style/classes/class.ilObjStyleSheet.php"; if ($_GET["cat"] == 0) { $_GET["cat"] == ""; } ilObjStyleSheet::_writeScope($_GET["style_id"], $_GET["cat"]); ilUtil::redirect($this->ctrl->getLinkTarget($this, "editContentStyles", "", false, false)); }
/** * @param $a_username * @param $password * @param bool $isChallengeResponse * @return bool|void * @throws ilLDAPQueryException */ function fetchData($a_username, $password, $isChallengeResponse = false) { /** * @var $ilDB ilDB * @var $ilSetting ilSetting * @var $rbacadmin ilRbacAdmin */ global $ilDB, $ilSetting, $rbacadmin; $settings = new ilSetting('apache_auth'); if (!$settings->get('apache_enable_auth')) { return false; } if (!$settings->get('apache_auth_indicator_name') || !$settings->get('apache_auth_indicator_value')) { return false; } if (!ilUtil::isLogin($a_username)) { return false; } if ($a_username == 'anonymous' && $password == 'anonymous') { $query = 'SELECT * FROM usr_data WHERE login = %s'; $qres = $ilDB->queryF($query, array('text'), array($a_username)); $userRow = $ilDB->fetchAssoc($qres); if (is_array($userRow) && $userRow['usr_id']) { // user as a local account... // fetch logindata $this->activeUser = $userRow['login']; foreach ($userRow as $key => $value) { if ($key == $this->options['passwordcol'] || $key == $this->options['usernamecol']) { continue; } // Use reference to the auth object if exists // This is because the auth session variable can change so a static call to setAuthData does not make sense $this->_auth_obj->setAuthData($key, $value); } $this->_auth_obj->setAuth($userRow['login']); return true; } return false; } if (!$_SESSION['login_invalid'] && in_array($_SERVER[$settings->get('apache_auth_indicator_name')], array_filter(array_map('trim', str_getcsv($settings->get('apache_auth_indicator_value')))))) { // we have a valid apache auth $list = array($ilSetting->get('auth_mode')); // Respect the auth method sequence include_once './Services/Authentication/classes/class.ilAuthModeDetermination.php'; $det = ilAuthModeDetermination::_getInstance(); if (!$det->isManualSelection() && $det->getCountActiveAuthModes() > 1) { $list = array(); foreach (ilAuthModeDetermination::_getInstance()->getAuthModeSequence() as $auth_mode) { $list[] = $auth_mode; } } foreach ($list as $auth_mode) { if (AUTH_LDAP == $auth_mode) { // if no local user has been found AND ldap lookup is enabled if ($settings->get('apache_enable_ldap')) { include_once 'Services/LDAP/classes/class.ilLDAPServer.php'; $this->server = new ilLDAPServer(ilLDAPServer::_getFirstActiveServer()); $this->server->doConnectionCheck(); $config = $this->server->toPearAuthArray(); $query = new ilLDAPQuery($this->server); $query->bind(); $ldapUser = $query->fetchUser($a_username); if ($ldapUser && $ldapUser[$a_username] && $ldapUser[$a_username][$config['userattr']] == $a_username) { $ldapUser[$a_username]['ilInternalAccount'] = ilObjUser::_checkExternalAuthAccount("ldap", $a_username); $user_data = $ldapUser[$a_username]; //array_change_key_case($a_auth->getAuthData(),CASE_LOWER); if ($this->server->enabledSyncOnLogin()) { if (!$user_data['ilInternalAccount'] && $this->server->isAccountMigrationEnabled() && !self::$force_creation) { $this->_auth_obj->logout(); $_SESSION['tmp_auth_mode'] = 'ldap'; $_SESSION['tmp_external_account'] = $a_username; $_SESSION['tmp_pass'] = $_POST['password']; include_once './Services/LDAP/classes/class.ilLDAPRoleAssignmentRules.php'; $roles = ilLDAPRoleAssignmentRules::getAssignmentsForCreation($a_username, $user_data); $_SESSION['tmp_roles'] = array(); foreach ($roles as $info) { if ($info['action'] == ilLDAPRoleAssignmentRules::ROLE_ACTION_ASSIGN) { $_SESSION['tmp_roles'][] = $info['id']; } } ilUtil::redirect('ilias.php?baseClass=ilStartUpGUI&cmdClass=ilstartupgui&cmd=showAccountMigration'); } if ($this->updateRequired($a_username)) { $this->initLDAPAttributeToUser(); $this->ldap_attr_to_user->setUserData($ldapUser); $this->ldap_attr_to_user->refresh(); $user_data['ilInternalAccount'] = ilObjUser::_checkExternalAuthAccount("ldap", $a_username); } else { // User exists and no update required $user_data['ilInternalAccount'] = ilObjUser::_checkExternalAuthAccount("ldap", $a_username); } } if ($user_data['ilInternalAccount']) { $this->_auth_obj->setAuth($user_data['ilInternalAccount']); $this->_auth_obj->username = $user_data['ilInternalAccount']; return true; } } } } else { if (AUTH_APACHE != $auth_mode && $settings->get('apache_enable_local')) { $condition = ''; if ($ilSetting->get("auth_mode") && $ilSetting->get("auth_mode") == 'ldap') { $condition = " AND auth_mode != " . $ilDB->quote('default', 'text') . " "; } $query = "SELECT * FROM usr_data WHERE login = %s AND auth_mode != %s {$condition}"; $qres = $ilDB->queryF($query, array('text', 'text'), array($a_username, 'ldap')); $userRow = $ilDB->fetchAssoc($qres); if (is_array($userRow) && $userRow['usr_id']) { // user as a local account... // fetch logindata $this->activeUser = $userRow['login']; foreach ($userRow as $key => $value) { if ($key == $this->options['passwordcol'] || $key == $this->options['usernamecol']) { continue; } // Use reference to the auth object if exists // This is because the auth session variable can change so a static call to setAuthData does not make sense $this->_auth_obj->setAuthData($key, $value); } $this->_auth_obj->setAuth($userRow['login']); return true; } } } } if ($settings->get('apache_enable_local') && $settings->get('apache_local_autocreate')) { if ($_GET['r']) { $_SESSION['profile_complete_redirect'] = $_GET['r']; } $user = new ilObjUser(); $user->setLogin($a_username); $user->setExternalAccount($a_username); $user->setProfileIncomplete(true); $user->create(); $user->setAuthMode('apache'); // set a timestamp for last_password_change // this ts is needed by ilSecuritySettings $user->setLastPasswordChangeTS(time()); $user->setTimeLimitUnlimited(1); $user->setActive(1); //insert user data in table user_data $user->saveAsNew(); $user->writePrefs(); $rbacadmin->assignUser($settings->get('apache_default_role', 4), $user->getId(), true); return true; } } else { if (defined('IL_CERT_SSO') && IL_CERT_SSO) { define('APACHE_ERRORCODE', AUTH_APACHE_FAILED); } } return false; }
/** * list questions of question pool */ function questionsObject() { global $rbacsystem, $ilUser, $ilCtrl, $ilDB, $lng, $ilPluginAdmin; if (get_class($this->object) == "ilObjTest") { if ($_GET["calling_test"] > 0) { $ref_id = $_GET["calling_test"]; $q_id = $_GET["q_id"]; if ($_REQUEST['test_express_mode']) { if ($q_id) { ilUtil::redirect("ilias.php?ref_id=" . $ref_id . "&q_id=" . $q_id . "&test_express_mode=1&cmd=showPage&cmdClass=iltestexpresspageobjectgui&baseClass=ilObjTestGUI"); } else { ilUtil::redirect("ilias.php?ref_id=" . $ref_id . "&test_express_mode=1&cmd=showPage&cmdClass=iltestexpresspageobjectgui&baseClass=ilObjTestGUI"); } } else { ilUtil::redirect("ilias.php?baseClass=ilObjTestGUI&ref_id=" . $ref_id . "&cmd=questions"); } } } else { if (isset($_GET['calling_consumer']) && (int) $_GET['calling_consumer']) { $ref_id = (int) $_GET['calling_consumer']; $consumer = ilObjectFactory::getInstanceByRefId($ref_id); if ($consumer instanceof ilQuestionEditingFormConsumer) { ilUtil::redirect($consumer->getQuestionEditingFormBackTarget($_GET['consumer_context'])); } require_once 'Services/Link/classes/class.ilLink.php'; ilUtil::redirect(ilLink::_getLink($ref_id)); } } $this->object->purgeQuestions(); // reset test_id SESSION variable $_SESSION["test_id"] = ""; require_once 'Services/Taxonomy/classes/class.ilObjTaxonomy.php'; $taxIds = ilObjTaxonomy::getUsageOfObject($this->object->getId()); $table_gui = $this->buildQuestionBrowserTableGUI($taxIds); $table_gui->setPreventDoubleSubmission(false); if ($rbacsystem->checkAccess('write', $_GET['ref_id'])) { $toolbar = new ilToolbarGUI(); $toolbar->addButton($this->lng->txt("ass_create_question"), $this->ctrl->getLinkTarget($this, 'createQuestionForm')); $this->tpl->setContent($this->ctrl->getHTML($toolbar) . $this->ctrl->getHTML($table_gui)); } else { $this->tpl->setContent($this->ctrl->getHTML($table_gui)); } if ($this->object->getShowTaxonomies()) { $this->lng->loadLanguageModule('tax'); require_once 'Services/Taxonomy/classes/class.ilTaxonomyExplorerGUI.php'; foreach ($taxIds as $taxId) { if ($taxId != $this->object->getNavTaxonomyId()) { continue; } $taxExp = new ilTaxonomyExplorerGUI($this, 'showNavTaxonomy', $taxId, 'ilobjquestionpoolgui', 'questions'); if (!$taxExp->handleCommand()) { $this->tpl->setLeftContent($taxExp->getHTML() . " "); } break; } } }
public function joinObject() { global $ilAccess; if (!$ilAccess->checkAccess('join', '', (int) $_GET['ref_id'])) { $this->ilias->raiseError($this->lng->txt('permission_denied'), $this->ilias->error_obj->MESSAGE); } if (!$this->object->addMember($this->ilias->account, $this->object->getDefaultMemberRole(), false)) { $this->ilErr->raiseError($this->object->getErrorMsg(), $this->ilErr->MESSAGE); } $this->ilias->account->addDesktopItem($this->object->getRefId(), "icrs"); ilUtil::sendInfo($this->lng->txt("ilinc_msg_joined"), true); ilUtil::redirect($this->ctrl->getLinkTarget($this, "view", "", false, false)); }
public function addToShoppingCart() { global $ilTabs; $ilTabs->setTabActive('buy'); if (!isset($_POST['price_id'])) { ilUtil::sendInfo($this->lng->txt('pay_select_price')); $this->showDetails(); return true; } else { $this->__initPaymentObject(); $this->__initShoppingCartObject(); $this->sc_obj->setSessionId(session_id()); $this->sc_obj->setPriceId((int) $_POST['price_id']); $this->sc_obj->setPobjectId($this->pobject->getPobjectId()); $this->sc_obj->add(); ilUtil::redirect('ilias.php?baseClass=ilShopController&cmd=redirect&redirect_class=ilshopshoppingcartgui'); return true; } }
function fetchData($a_username, $password, $isChallengeResponse = false) { //var_dump(func_get_args()); //var_dump($_SERVER); global $lng; $settings = new ilSetting('apache_auth'); if (!$settings->get('apache_enable_auth')) { return false; } if (!$settings->get('apache_auth_indicator_name') || !$settings->get('apache_auth_indicator_value')) { return false; } if (!ilUtil::isLogin($a_username)) { return false; } if ($a_username == 'anonymous' && $password == 'anonymous') { global $ilDB; $query = 'SELECT * FROM usr_data WHERE login = %s'; $qres = $ilDB->queryF($query, array('text'), array($a_username)); $userRow = $ilDB->fetchAssoc($qres); if (is_array($userRow) && $userRow['usr_id']) { // user as a local account... // fetch logindata $this->activeUser = $userRow['login']; foreach ($userRow as $key => $value) { if ($key == $this->options['passwordcol'] || $key == $this->options['usernamecol']) { continue; } // Use reference to the auth object if exists // This is because the auth session variable can change so a static call to setAuthData does not make sense $this->_auth_obj->setAuthData($key, $value); } //var_dump($userRow); $this->_auth_obj->setAuth($userRow['login']); return true; } return false; } if (!$_SESSION['login_invalid'] && $_SERVER[$settings->get('apache_auth_indicator_name')] == $settings->get('apache_auth_indicator_value')) { // we have a valid apache auth global $ilDB; if ($settings->get('apache_enable_local')) { $query = 'SELECT * FROM usr_data WHERE login = %s OR (auth_mode = %s AND ext_account = %s)'; $qres = $ilDB->queryF($query, array('text', 'text', 'text'), array($a_username, 'apache', $a_username)); $userRow = $ilDB->fetchAssoc($qres); if (is_array($userRow) && $userRow['usr_id']) { // user as a local account... // fetch logindata $this->activeUser = $userRow['login']; foreach ($userRow as $key => $value) { if ($key == $this->options['passwordcol'] || $key == $this->options['usernamecol']) { continue; } // Use reference to the auth object if exists // This is because the auth session variable can change so a static call to setAuthData does not make sense $this->_auth_obj->setAuthData($key, $value); } //var_dump($userRow); $this->_auth_obj->setAuth($userRow['login']); return true; } } // if no local user has been found AND ldap lookup is enabled if ($settings->get('apache_enable_ldap')) { include_once 'Services/LDAP/classes/class.ilLDAPServer.php'; $this->server = new ilLDAPServer(ilLDAPServer::_getFirstActiveServer()); $this->server->doConnectionCheck(); $config = $this->server->toPearAuthArray(); $query = new ilLDAPQuery($this->server); $ldapUser = $query->fetchUser($a_username); if ($ldapUser && $ldapUser[$a_username] && $ldapUser[$a_username][$config['userattr']] == $a_username) { $ldapUser[$a_username]['ilInternalAccount'] = ilObjUser::_checkExternalAuthAccount("apache", $a_username); $user_data = $ldapUser[$a_username]; //array_change_key_case($a_auth->getAuthData(),CASE_LOWER); if ($this->server->enabledSyncOnLogin()) { if (!$user_data['ilInternalAccount'] && $this->server->isAccountMigrationEnabled() && !self::$force_creation) { $this->_auth_obj->logout(); $_SESSION['tmp_auth_mode'] = 'apache'; $_SESSION['tmp_external_account'] = $a_username; $_SESSION['tmp_pass'] = $_POST['password']; include_once './Services/LDAP/classes/class.ilLDAPRoleAssignmentRules.php'; $roles = ilLDAPRoleAssignmentRules::getAssignmentsForCreation($a_username, $user_data); $_SESSION['tmp_roles'] = array(); foreach ($roles as $info) { if ($info['action'] == ilLDAPRoleAssignmentRules::ROLE_ACTION_ASSIGN) { $_SESSION['tmp_roles'][] = $info['id']; } } ilUtil::redirect('ilias.php?baseClass=ilStartUpGUI&cmdClass=ilstartupgui&cmd=showAccountMigration'); exit; } if ($this->updateRequired($a_username)) { $this->initLDAPAttributeToUser(); $this->ldap_attr_to_user->setUserData($ldapUser); $this->ldap_attr_to_user->refresh(); $user_data['ilInternalAccount'] = ilObjUser::_checkExternalAuthAccount("apache", $a_username); } else { // User exists and no update required $user_data['ilInternalAccount'] = ilObjUser::_checkExternalAuthAccount("apache", $a_username); } } if ($user_data['ilInternalAccount']) { $this->_auth_obj->setAuth($user_data['ilInternalAccount']); return true; } } } if ($settings->get('apache_enable_local') && $settings->get('apache_local_autocreate')) { // no local user, no ldap match or ldap not activated // if (!self::$force_creation) // { // $_SESSION['tmp_auth_mode'] = 'apache'; // $_SESSION['tmp_external_account'] = $a_username; // $_SESSION['tmp_pass'] = $_POST['password']; //ilUtil::redirect('https://lernwelt.janposselt.de/ilias.php?baseClass=ilStartUpGUI&cmdClass=ilstartupgui&cmd=showAccountMigration'); // } // else // { global $ilIliasIniFile; if ($_GET['r']) { $_SESSION['profile_complete_redirect'] = $_GET['r']; } $user = new ilObjUser(); $user->setLogin($a_username); $user->setExternalAccount($a_username); $user->setProfileIncomplete(true); $user->create(); $user->setAuthMode('apache'); // set a timestamp for last_password_change // this ts is needed by ilSecuritySettings $user->setLastPasswordChangeTS(time()); $user->setTimeLimitUnlimited(1); $user->setActive(1); //insert user data in table user_data $user->saveAsNew(); $user->writePrefs(); global $rbacadmin; $rbacadmin->assignUser($settings->get('apache_default_role', 4), $user->getId(), true); return true; // } } } else { if (defined('IL_CERT_SSO') && IL_CERT_SSO) { define('APACHE_ERRORCODE', AUTH_APACHE_FAILED); } } return false; }
/** * form for new survey object import */ function importFileObject() { global $tpl, $ilErr; $parent_id = $_GET["ref_id"]; $new_type = $_REQUEST["new_type"]; // create permission is already checked in createObject. This check here is done to prevent hacking attempts if (!$this->checkPermissionBool("create", "", $new_type)) { $ilErr->raiseError($this->lng->txt("no_create_permission")); } $this->lng->loadLanguageModule($new_type); $this->ctrl->setParameter($this, "new_type", $new_type); $form = $this->initImportForm($new_type); if ($form->checkInput()) { include_once "./Modules/Survey/classes/class.ilObjSurvey.php"; $newObj = new ilObjSurvey(); $newObj->setType($new_type); $newObj->setTitle("dummy"); $newObj->setDescription("dummy"); $newObj->create(true); $this->putObjectInTree($newObj); // copy uploaded file to import directory $error = $newObj->importObject($_FILES["importfile"], $form->getInput("spl")); if (strlen($error)) { $newObj->delete(); $this->ilias->raiseError($error, $this->ilias->error_obj->MESSAGE); return; } ilUtil::sendSuccess($this->lng->txt("object_imported"), true); ilUtil::redirect("ilias.php?ref_id=" . $newObj->getRefId() . "&baseClass=ilObjSurveyGUI"); // using template? include_once "Services/Administration/classes/class.ilSettingsTemplate.php"; $templates = ilSettingsTemplate::getAllSettingsTemplates("svy"); if ($templates) { global $tpl; $tpl->addJavaScript("./Modules/Scorm2004/scripts/questions/jquery.js"); // $tpl->addJavaScript("./Modules/Scorm2004/scripts/questions/jquery-ui-min.js"); $this->tpl->setCurrentBlock("template_option"); $this->tpl->setVariable("VAL_TEMPLATE_OPTION", ""); $this->tpl->setVariable("TXT_TEMPLATE_OPTION", $this->lng->txt("none")); $this->tpl->parseCurrentBlock(); foreach ($templates as $item) { $this->tpl->setCurrentBlock("template_option"); $this->tpl->setVariable("VAL_TEMPLATE_OPTION", $item["id"]); $this->tpl->setVariable("TXT_TEMPLATE_OPTION", $item["title"]); $this->tpl->parseCurrentBlock(); $desc = str_replace("\n", "", nl2br($item["description"])); $desc = str_replace("\r", "", $desc); $this->tpl->setCurrentBlock("js_data"); $this->tpl->setVariable("JS_DATA_ID", $item["id"]); $this->tpl->setVariable("JS_DATA_TEXT", $desc); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock("templates"); $this->tpl->setVariable("TXT_TEMPLATE", $this->lng->txt("svy_settings_template")); $this->tpl->parseCurrentBlock(); } } // display form to correct errors $form->setValuesByPost(); $tpl->setContent($form->getHtml()); }
/** * Check permission and redirect on error * * @param string $a_perm * @param string $a_cmd * @param string $a_type * @param int $a_ref_id * @return bool */ protected function checkPermission($a_perm, $a_cmd = "", $a_type = "", $a_ref_id = null) { if (!$this->checkPermissionBool($a_perm, $a_cmd, $a_type, $a_ref_id)) { if (!is_int(strpos($_SERVER["PHP_SELF"], "goto.php"))) { // create: redirect to parent if ($a_perm == "create") { if (!$a_ref_id) { $a_ref_id = $_GET["ref_id"]; } $type = ilObject::_lookupType($a_ref_id, true); } else { // does this make sense? if (!is_object($this->object)) { return; } if (!$a_ref_id) { $a_ref_id = $this->object->getRefId(); } $type = $this->object->getType(); } ilSession::clear("il_rep_ref_id"); ilUtil::sendFailure($this->lng->txt("permission_denied"), true); ilUtil::redirect("goto.php?target=" . $type . "_" . $a_ref_id); } else { die("Permission Denied."); } } }
/** * Goto item group */ function gotoParent() { global $ilAccess, $ilErr, $lng, $tree; $ref_id = $this->object->getRefId(); $par_id = $tree->getParentId($ref_id); if ($ilAccess->checkAccess("read", "", $par_id)) { include_once "./Services/Link/classes/class.ilLink.php"; ilUtil::redirect(ilLink::_getLink($par_id)); exit; } }
function closeLinkHelp() { if ($this->return == "") { $this->ctrl->returnToParent($this); } else { ilUtil::redirect($this->return); } }
function setAuthModeObject() { global $rbacsystem, $ilSetting; if (!$rbacsystem->checkAccess("write", $this->object->getRefId())) { $this->ilias->raiseError($this->lng->txt("permission_denied"), $this->ilias->error_obj->MESSAGE); } if (empty($_POST["auth_mode"])) { $this->ilias->raiseError($this->lng->txt("auth_err_no_mode_selected"), $this->ilias->error_obj->MESSAGE); } if ($_POST["auth_mode"] == AUTH_DEFAULT) { ilUtil::sendInfo($this->lng->txt("auth_mode") . ": " . $this->getAuthModeTitle() . " " . $this->lng->txt("auth_mode_not_changed"), true); $this->ctrl->redirect($this, 'authSettings'); } switch ($_POST["auth_mode"]) { case AUTH_LDAP: /* if ($this->object->checkAuthLDAP() !== true) { ilUtil::sendInfo($this->lng->txt("auth_ldap_not_configured"),true); ilUtil::redirect($this->getReturnLocation("authSettings",$this->ctrl->getLinkTarget($this,"editLDAP", "", false, false))); } */ break; case AUTH_SHIB: if ($this->object->checkAuthSHIB() !== true) { ilUtil::sendFailure($this->lng->txt("auth_shib_not_configured"), true); ilUtil::redirect($this->getReturnLocation("authSettings", $this->ctrl->getLinkTarget($this, "editSHIB", "", false, false))); } break; case AUTH_RADIUS: if ($this->object->checkAuthRADIUS() !== true) { ilUtil::sendFailure($this->lng->txt("auth_radius_not_configured"), true); $this->ctrl->redirect($this, 'editRADIUS'); } break; case AUTH_SCRIPT: if ($this->object->checkAuthScript() !== true) { ilUtil::sendFailure($this->lng->txt("auth_script_not_configured"), true); ilUtil::redirect($this->getReturnLocation("authSettings", $this->ctrl->getLinkTarget($this, "editScript", "", false, false))); } break; } $this->ilias->setSetting("auth_mode", $_POST["auth_mode"]); ilUtil::sendSuccess($this->lng->txt("auth_default_mode_changed_to") . " " . $this->getAuthModeTitle(), true); $this->ctrl->redirect($this, 'authSettings'); }
protected function cancelPassword() { global $ilUser; if ($ilUser->getId() && $ilUser->getId() != ANONYMOUS_USER_ID) { if ($this->node_id) { include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php"; include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php"; $tree = new ilWorkspaceTree($ilUser->getId()); $owner = $tree->lookupOwner($this->node_id); ilUtil::redirect("ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToWorkspace&dsh=" . $owner); } else { include_once "Services/Portfolio/classes/class.ilObjPortfolio.php"; $prtf = new ilObjPortfolio($this->portfolio_id, false); $owner = $prtf->getOwner(); ilUtil::redirect("ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToPortfolio&dsh=" . $owner); } } }
/** * Handle ldap as data source * @param Auth $auth * @param string $ext_account */ protected function handleLDAPDataSource($a_auth, $ext_account) { include_once './Services/LDAP/classes/class.ilLDAPServer.php'; $server = ilLDAPServer::getInstanceByServerId(ilLDAPServer::getDataSource(AUTH_RADIUS)); $GLOBALS['ilLog']->write(__METHOD__ . 'Using ldap data source'); include_once './Services/LDAP/classes/class.ilLDAPUserSynchronisation.php'; $sync = new ilLDAPUserSynchronisation('radius', $server->getServerId()); $sync->setExternalAccount($ext_account); $sync->setUserData(array()); $sync->forceCreation($this->force_creation); try { $internal_account = $sync->sync(); } catch (UnexpectedValueException $e) { $GLOBALS['ilLog']->write(__METHOD__ . ': Login failed with message: ' . $e->getMessage()); $a_auth->status = AUTH_WRONG_LOGIN; $a_auth->logout(); return false; } catch (ilLDAPSynchronisationForbiddenException $e) { // No syncronisation allowed => create Error $GLOBALS['ilLog']->write(__METHOD__ . ': Login failed with message: ' . $e->getMessage()); $a_auth->status = AUTH_RADIUS_NO_ILIAS_USER; $a_auth->logout(); return false; } catch (ilLDAPAccountMigrationRequiredException $e) { $GLOBALS['ilLog']->write(__METHOD__ . ': Starting account migration.'); $a_auth->logout(); ilUtil::redirect('ilias.php?baseClass=ilStartUpGUI&cmdClass=ilstartupgui&cmd=showAccountMigration'); } $a_auth->setAuth($internal_account); return true; }