/** * */ protected function storeRequest() { /** * @var $http ilHTTPS */ global $https; if (!ilSession::get('orig_request_target')) { //#16324 don't use the complete REQUEST_URI $url = substr($_SERVER['REQUEST_URI'], strrpos($_SERVER['REQUEST_URI'], "/") + 1); ilSession::set('orig_request_target', $url); } }
/** * Get chapters * * @param * @return */ function getChapters() { $hc = ilSession::get("help_chap"); $lm_tree = $this->parent_obj->object->getTree(); if ($hc > 0 && $lm_tree->isInTree($hc)) { //$node = $lm_tree->getNodeData($hc); //$chaps = $lm_tree->getSubTree($node); $chaps = $lm_tree->getFilteredSubTree($hc, array("pg")); unset($chaps[0]); } else { $chaps = ilStructureObject::getChapterList($this->parent_obj->object->getId()); } $this->setData($chaps); }
/** * */ protected function storeRequest() { /** * @var $http ilHTTPS */ global $https; if (!ilSession::get('orig_request_target')) { $target_protocol = 'http'; if ($https->isDetected()) { $target_protocol .= 's'; } $host = isset($_SERVER['HTTP_X_FORWARDED_HOST']) ? $_SERVER['HTTP_X_FORWARDED_HOST'] : $_SERVER['HTTP_HOST']; $request_url = $_SERVER['REQUEST_URI'][0] == '/' ? $_SERVER['REQUEST_URI'] : '/' . $_SERVER['REQUEST_URI']; $url = $target_protocol . '://' . $host . $request_url; ilSession::set('orig_request_target', $url); } }
function fillMessage() { global $lng; $ms = array("info", "success", "failure", "question"); $out = ""; foreach ($ms as $m) { if ($m == "question") { $m = "mess_question"; } $txt = ilSession::get($m) != "" ? ilSession::get($m) : $this->message[$m]; if ($m == "mess_question") { $m = "question"; } if ($txt != "") { $mtpl = new ilTemplate("tpl.message.html", true, true, "Services/Utilities"); $mtpl->setCurrentBlock($m . "_message"); $mtpl->setVariable("TEXT", $txt); $mtpl->setVariable("MESSAGE_HEADING", $lng->txt($m . "_message")); $mtpl->setVariable("ALT_IMAGE", $lng->txt("icon") . " " . $lng->txt($m . "_message")); $mtpl->setVariable("SRC_IMAGE", ilUtil::getImagePath("mess_" . $m . ".png")); $mtpl->parseCurrentBlock(); $out .= $mtpl->get(); } if ($m == "question") { $m = "mess_question"; } if (ilSession::get($m)) { ilSession::clear($m); } } if ($out != "") { $this->setVariable("MESSAGE", $out); } }
public static function authenticate() { global $ilAuth, $ilias, $ilErr, $ilUser; $oldSid = session_id(); // error_log(">> init authenticate " . $oldSid); $ilAuth->start(); $ilias->setAuthError($ilErr->getLastError()); if ($ilAuth->getAuth() && $ilAuth->getStatus() == '') { error_log(">> init authenticate no session?"); if (ilSession::get("AccountId")) { // ensure that web users have access to the services self::initUserAccount(); } // self::initUserAccount(); // // self::handleAuthenticationSuccess(); } // // error_log(">> init authenticate user is: " . $ilUser->getId()); }
function finishTestCmd($requires_confirmation = true) { global $ilUser, $ilAuth; unset($_SESSION["tst_next"]); $active_id = $this->testSession->getActiveId(); $actualpass = $this->object->_getPass($active_id); $allObligationsAnswered = ilObjTest::allObligationsAnswered($this->testSession->getTestId(), $active_id, $actualpass); /* * The following "endgames" are possible prior to actually finishing the test: * - Obligations (Ability to finish the test.) * If not all obligatory questions are answered, the user is presented a list * showing the deficits. * - Examview (Will to finish the test.) * With the examview, the participant can review all answers given in ILIAS or a PDF prior to * commencing to the finished test. * - Last pass allowed (Reassuring the will to finish the test.) * If passes are limited, on the last pass, an additional confirmation is to be displayed. */ // Obligations fulfilled? redirectQuestion : one or the other summary -> no finish if ($this->object->areObligationsEnabled() && !$allObligationsAnswered) { if ($this->object->getListOfQuestions()) { $_GET['activecommand'] = 'summary_obligations'; } else { $_GET['activecommand'] = 'summary_obligations_only'; } $this->redirectQuestion(); return; } // Examview enabled & !reviewed & requires_confirmation? test_submission_overview (review gui) if ($this->object->getEnableExamview() && !isset($_GET['reviewed']) && $requires_confirmation) { $_GET['activecommand'] = 'test_submission_overview'; $this->redirectQuestionCmd(); return; } // Last try in limited tries & !confirmed if ($requires_confirmation && $actualpass == $this->object->getNrOfTries() - 1) { if ($this->object->canShowSolutionPrintview($ilUser->getId())) { $template = new ilTemplate("tpl.il_as_tst_finish_navigation.html", TRUE, TRUE, "Modules/Test"); $template->setVariable("BUTTON_FINISH", $this->lng->txt("btn_next")); $template->setVariable("BUTTON_CANCEL", $this->lng->txt("btn_previous")); $template_top = new ilTemplate("tpl.il_as_tst_list_of_answers_topbuttons.html", TRUE, TRUE, "Modules/Test"); $template_top->setCurrentBlock("button_print"); $template_top->setVariable("BUTTON_PRINT", $this->lng->txt("print")); $template_top->parseCurrentBlock(); $this->showListOfAnswers($active_id, NULL, $template_top->get(), $template->get()); return; } else { // show confirmation page return $this->confirmFinishTestCmd(); } } // Last try in limited tries & confirmed? if ($actualpass == $this->object->getNrOfTries() - 1 && !$requires_confirmation) { $this->object->setActiveTestSubmitted($ilUser->getId()); $ilAuth->setIdle(ilSession::getIdleValue(), false); $ilAuth->setExpire(0); switch ($this->object->getMailNotification()) { case 1: $this->object->sendSimpleNotification($active_id); break; case 2: $this->object->sendAdvancedNotification($active_id); break; } } // Non-last try finish if (!$_SESSION['tst_pass_finish']) { if (!$_SESSION['tst_pass_finish']) { $_SESSION['tst_pass_finish'] = 1; } if ($this->object->getMailNotificationType() == 1) { switch ($this->object->getMailNotification()) { case 1: $this->object->sendSimpleNotification($active_id); break; case 2: $this->object->sendAdvancedNotification($active_id); break; } } $this->testSession->increaseTestPass(); ilSession::set('passincreased', $actualpass); } if ($this->object->getEnableArchiving()) { $this->archiveParticipantSubmission($active_id, $actualpass); } /** @var $ilPluginAdmin ilPluginAdmin */ global $ilPluginAdmin, $ilCtrl; if ($this->object->getSignSubmission() && count($ilPluginAdmin->getActivePluginsForSlot(IL_COMP_MODULE, 'Test', 'tsig')) != 0) { $key = 'signed_' . $active_id . '_' . $actualpass; if (ilSession::get('passincreased') != null) { $key = 'signed_' . $active_id . '_' . ilSession::get('passincreased'); } $val = ilSession::get($key); if (is_null($val)) { /** @var $ilCtrl ilCtrl */ $ilCtrl->redirectByClass('ilTestSignatureGUI', 'invokeSignaturePlugin'); } } // Redirect after test $redirection_mode = $this->object->getRedirectionMode(); $redirection_url = $this->object->getRedirectionUrl(); if ($redirection_url && $redirection_mode && !$this->object->canViewResults()) { if ($redirection_mode == REDIRECT_KIOSK) { if ($this->object->getKioskMode()) { ilUtil::redirect($redirection_url); } } else { ilUtil::redirect($redirection_url); } } $this->redirectBackCmd(); }
/** * Show export IDs overview * * @param * @return */ function showTooltipList() { global $tpl, $ilToolbar, $ilCtrl, $lng; $this->setTabs(); $this->setContentSubTabs("help_tooltips"); $ilToolbar->setFormAction($ilCtrl->getFormAction($this)); include_once "./Services/Form/classes/class.ilTextInputGUI.php"; $ti = new ilTextInputGUI($this->lng->txt("help_tooltip_id"), "tooltip_id"); $ti->setMaxLength(200); $ti->setSize(20); $ilToolbar->addInputItem($ti, true); $ilToolbar->addFormButton($lng->txt("add"), "addTooltip"); $ilToolbar->addSeparator(); include_once "./Services/Form/classes/class.ilSelectInputGUI.php"; $options = ilHelp::getTooltipComponents(); if (ilSession::get("help_tt_comp") != "") { $options[ilSession::get("help_tt_comp")] = ilSession::get("help_tt_comp"); } $si = new ilSelectInputGUI($this->lng->txt("help_component"), "help_tt_comp"); $si->setOptions($options); $si->setValue(ilSession::get("help_tt_comp")); $ilToolbar->addInputItem($si, true); $ilToolbar->addFormButton($lng->txt("help_filter"), "filterTooltips"); include_once "./Modules/LearningModule/classes/class.ilHelpTooltipTableGUI.php"; $tbl = new ilHelpTooltipTableGUI($this, "showTooltipList", ilSession::get("help_tt_comp")); $tpl->setContent($tbl->getHTML()); }
/** * Detail view of a mail */ public function showMail() { /** * @var $ilUser ilObjUser * @var $ilToolbar ilToolbarGUI * @var $ilTabs ilTabsGUI */ global $ilUser, $ilToolbar, $ilTabs; if ($_SESSION['mail_id']) { $_GET['mail_id'] = $_SESSION['mail_id']; $_SESSION['mail_id'] = ''; } $ilTabs->clearTargets(); $ilTabs->setBackTarget($this->lng->txt('back_to_folder'), $this->ctrl->getFormAction($this, 'showFolder')); $this->umail->markRead(array((int) $_GET['mail_id'])); $mailData = $this->umail->getMail((int) $_GET['mail_id']); $this->tpl->setTitle($this->lng->txt('mail_mails_of')); require_once 'Services/Form/classes/class.ilPropertyFormGUI.php'; $form = new ilPropertyFormGUI(); $form->setPreventDoubleSubmission(false); $form->setTableWidth('100%'); $this->ctrl->setParameter($this, 'mail_id', (int) $_GET['mail_id']); $form->setFormAction($this->ctrl->getFormAction($this, 'showMail')); $this->ctrl->clearParameters($this); $form->setTitle($this->lng->txt('mail_mails_of')); if ('tree' == ilSession::get(ilMailGUI::VIEWMODE_SESSION_KEY)) { $this->tpl->setVariable('FORM_TARGET', ilFrameTargetInfo::_getFrame('MainContent')); } include_once 'Services/Accessibility/classes/class.ilAccessKeyGUI.php'; /** * @var $sender ilObjUser */ $sender = ilObjectFactory::getInstanceByObjId($mailData['sender_id'], false); if ($sender && $sender->getId() && $sender->getId() != ANONYMOUS_USER_ID) { $this->ctrl->setParameterByClass('ilmailformgui', 'mail_id', (int) $_GET['mail_id']); $this->ctrl->setParameterByClass('ilmailformgui', 'type', 'reply'); $this->ctrl->clearParametersByClass('iliasmailformgui'); $ilToolbar->addButton($this->lng->txt('reply'), $this->ctrl->getLinkTargetByClass('ilmailformgui'), '', ilAccessKey::REPLY); $this->ctrl->clearParameters($this); } $this->ctrl->setParameterByClass('ilmailformgui', 'mail_id', (int) $_GET['mail_id']); $this->ctrl->setParameterByClass('ilmailformgui', 'type', 'forward'); $this->ctrl->clearParametersByClass('iliasmailformgui'); $ilToolbar->addButton($this->lng->txt('forward'), $this->ctrl->getLinkTargetByClass('ilmailformgui'), '', ilAccessKey::FORWARD_MAIL); $this->ctrl->clearParameters($this); $this->ctrl->setParameter($this, 'mail_id', (int) $_GET['mail_id']); $ilToolbar->addButton($this->lng->txt('print'), $this->ctrl->getLinkTarget($this, 'printMail'), '_blank'); $this->ctrl->clearParameters($this); $this->ctrl->setParameter($this, 'mail_id', (int) $_GET['mail_id']); $this->ctrl->setParameter($this, 'selected_cmd', 'deleteMails'); $ilToolbar->addButton($this->lng->txt('delete'), $this->ctrl->getLinkTarget($this), '', ilAccessKey::DELETE); $this->ctrl->clearParameters($this); if ($sender && $sender->getId() && $sender->getId() != ANONYMOUS_USER_ID) { $linked_fullname = $sender->getPublicName(); $picture = ilUtil::img($sender->getPersonalPicturePath('xsmall'), $sender->getPublicName()); $add_to_addb_button = ''; if (in_array(ilObjUser::_lookupPref($sender->getId(), 'public_profile'), array('y', 'g'))) { $this->ctrl->setParameter($this, 'mail_id', (int) $_GET['mail_id']); $this->ctrl->setParameter($this, 'user', $sender->getId()); $linked_fullname = '<br /><a href="' . $this->ctrl->getLinkTarget($this, 'showUser') . '" title="' . $linked_fullname . '">' . $linked_fullname . '</a>'; $this->ctrl->clearParameters($this); } if ($sender->getId() != $ilUser->getId()) { require_once 'Services/Contact/classes/class.ilAddressbook.php'; $abook = new ilAddressbook($ilUser->getId()); if ($abook->checkEntryByLogin($sender->getLogin()) == 0) { $tplbtn = new ilTemplate('tpl.buttons.html', true, true); $tplbtn->setCurrentBlock('btn_cell'); $this->ctrl->setParameter($this, 'mail_id', (int) $_GET['mail_id']); $tplbtn->setVariable('BTN_LINK', $this->ctrl->getLinkTarget($this, 'add')); $this->ctrl->clearParameters($this); $tplbtn->setVariable('BTN_TXT', $this->lng->txt('mail_add_to_addressbook')); $tplbtn->parseCurrentBlock(); $add_to_addb_button = '<br />' . $tplbtn->get(); } } $from = new ilCustomInputGUI($this->lng->txt('from')); $from->setHtml($picture . ' ' . $linked_fullname . $add_to_addb_button); $form->addItem($from); } else { if (!$sender || !$sender->getId()) { $from = new ilCustomInputGUI($this->lng->txt('from')); $from->setHtml($mailData['import_name'] . ' (' . $this->lng->txt('user_deleted') . ')'); $form->addItem($from); } else { $from = new ilCustomInputGUI($this->lng->txt('from')); $from->setHtml(ilUtil::img(ilUtil::getImagePath('HeaderIconAvatar.svg'), ilMail::_getIliasMailerName()) . '<br />' . ilMail::_getIliasMailerName()); $form->addItem($from); } } $to = new ilCustomInputGUI($this->lng->txt('mail_to')); $to->setHtml(ilUtil::htmlencodePlainString($this->umail->formatNamesForOutput($mailData['rcp_to']), false)); $form->addItem($to); if ($mailData['rcp_cc']) { $cc = new ilCustomInputGUI($this->lng->txt('cc')); $cc->setHtml(ilUtil::htmlencodePlainString($this->umail->formatNamesForOutput($mailData['rcp_cc']), false)); $form->addItem($cc); } if ($mailData['rcp_bcc']) { $bcc = new ilCustomInputGUI($this->lng->txt('bc')); $bcc->setHtml(ilUtil::htmlencodePlainString($this->umail->formatNamesForOutput($mailData['rcp_bcc']), false)); $form->addItem($bcc); } $subject = new ilCustomInputGUI($this->lng->txt('subject')); $subject->setHtml(ilUtil::htmlencodePlainString($mailData['m_subject'], true)); $form->addItem($subject); $date = new ilCustomInputGUI($this->lng->txt('date')); $date->setHtml(ilDatePresentation::formatDate(new ilDateTime($mailData['send_time'], IL_CAL_DATETIME))); $form->addItem($date); $message = new ilCustomInputGUI($this->lng->txt('message')); $message->setHtml(ilUtil::htmlencodePlainString($mailData['m_message'], true)); $form->addItem($message); if ($mailData['attachments']) { $att = new ilCustomInputGUI($this->lng->txt('attachments')); $radiog = new ilRadioGroupInputGUI('', 'filename'); foreach ($mailData['attachments'] as $file) { $radiog->addOption(new ilRadioOption($file, md5($file))); } $att->setHtml($radiog->render()); $form->addCommandButton('deliverFile', $this->lng->txt('download')); $form->addItem($att); } $isTrashFolder = false; if ($this->mbox->getTrashFolder() == $_GET['mobj_id']) { $isTrashFolder = true; } $current_folder_data = $this->mbox->getFolderData((int) $_GET['mobj_id']); $selectOptions = array(); $actions = $this->mbox->getActions((int) $_GET["mobj_id"]); foreach ($actions as $key => $action) { if ($key == 'moveMails') { $folders = $this->mbox->getSubFolders(); foreach ($folders as $folder) { if (($folder["type"] != 'trash' || !$isTrashFolder) && $folder['obj_id'] != $current_folder_data['obj_id']) { $optionText = ''; if ($folder['type'] != 'user_folder') { $optionText = $action . ' ' . $this->lng->txt('mail_' . $folder['title']) . ($folder['type'] == 'trash' ? ' (' . $this->lng->txt('delete') . ')' : ''); } else { $optionText = $action . ' ' . $folder['title']; } $selectOptions[$folder['obj_id']] = $optionText; } } } } if ($current_folder_data['type'] == 'user_folder') { $txt_folder = $current_folder_data['title']; } else { $txt_folder = $this->lng->txt('mail_' . $current_folder_data['title']); } $ilToolbar->addSeparator(); $ilToolbar->addText(sprintf($this->lng->txt('current_folder'), $txt_folder)); if (is_array($selectOptions) && count($selectOptions)) { include_once 'Services/Form/classes/class.ilSelectInputGUI.php'; $actions = new ilSelectInputGUI('', 'selected_cmd'); $actions->setOptions($selectOptions); $this->ctrl->setParameter($this, 'mail_id', (int) $_GET['mail_id']); $ilToolbar->setFormAction($this->ctrl->getFormAction($this, 'showMail')); $ilToolbar->addInputItem($actions); $ilToolbar->addFormButton($this->lng->txt('submit'), 'changeFolder'); } // Navigation $prevMail = $this->umail->getPreviousMail((int) $_GET['mail_id']); $nextMail = $this->umail->getNextMail((int) $_GET['mail_id']); if (is_array($prevMail) || is_array($nextMail)) { $ilToolbar->addSeparator(); if ($prevMail['mail_id']) { $this->ctrl->setParameter($this, 'mail_id', $prevMail['mail_id']); $ilToolbar->addButton($this->lng->txt('previous'), $this->ctrl->getLinkTarget($this, 'showMail')); $this->ctrl->clearParameters($this); } if ($nextMail['mail_id']) { $this->ctrl->setParameter($this, 'mail_id', $nextMail['mail_id']); $ilToolbar->addButton($this->lng->txt('next'), $this->ctrl->getLinkTarget($this, 'showMail')); $this->ctrl->clearParameters($this); } } $this->tpl->setContent($form->getHTML()); $this->tpl->show(); }
/** * Save personal data form * */ public function savePersonalData() { global $tpl, $lng, $ilCtrl, $ilUser, $ilSetting, $ilAuth; $this->initPersonalDataForm(); if ($this->form->checkInput()) { $form_valid = true; // if form field name differs from setter $map = array("firstname" => "FirstName", "lastname" => "LastName", "title" => "UTitle", "sel_country" => "SelectedCountry", "phone_office" => "PhoneOffice", "phone_home" => "PhoneHome", "phone_mobile" => "PhoneMobile", "referral_comment" => "Comment", "interests_general" => "GeneralInterests", "interests_help_offered" => "OfferingHelp", "interests_help_looking" => "LookingForHelp"); include_once "./Services/User/classes/class.ilUserProfile.php"; $up = new ilUserProfile(); foreach ($up->getStandardFields() as $f => $p) { // if item is part of form, it is currently valid (if not disabled) $item = $this->form->getItemByPostVar("usr_" . $f); if ($item && !$item->getDisabled()) { $value = $this->form->getInput("usr_" . $f); switch ($f) { case "birthday": if (is_array($value)) { if (is_array($value['date'])) { if ($value['d'] > 0 && $value['m'] > 0 && $value['y'] > 0) { $ilUser->setBirthday(sprintf("%04d-%02d-%02d", $value['y'], $value['m'], $value['d'])); } else { $ilUser->setBirthday(""); } } else { $ilUser->setBirthday($value['date']); } } break; default: $m = ucfirst($f); if (isset($map[$f])) { $m = $map[$f]; } $ilUser->{"set" . $m}($value); break; } } } $ilUser->setFullname(); // set instant messengers if ($this->workWithUserSetting("instant_messengers")) { $ilUser->setInstantMessengerId('icq', $this->form->getInput("usr_im_icq")); $ilUser->setInstantMessengerId('yahoo', $this->form->getInput("usr_im_yahoo")); $ilUser->setInstantMessengerId('msn', $this->form->getInput("usr_im_msn")); $ilUser->setInstantMessengerId('aim', $this->form->getInput("usr_im_aim")); $ilUser->setInstantMessengerId('skype', $this->form->getInput("usr_im_skype")); $ilUser->setInstantMessengerId('jabber', $this->form->getInput("usr_im_jabber")); $ilUser->setInstantMessengerId('voip', $this->form->getInput("usr_im_voip")); } // check map activation include_once "./Services/Maps/classes/class.ilMapUtil.php"; if (ilMapUtil::isActivated()) { $location = $this->form->getInput("location"); $ilUser->setLatitude(ilUtil::stripSlashes($location["latitude"])); $ilUser->setLongitude(ilUtil::stripSlashes($location["longitude"])); $ilUser->setLocationZoom(ilUtil::stripSlashes($location["zoom"])); } // Set user defined data $defs = $this->user_defined_fields->getVisibleDefinitions(); $udf = array(); foreach ($defs as $definition) { $f = "udf_" . $definition['field_id']; $item = $this->form->getItemByPostVar($f); if ($item && !$item->getDisabled()) { $udf[$definition['field_id']] = $this->form->getInput($f); } } $ilUser->setUserDefinedData($udf); // if loginname is changeable -> validate $un = $this->form->getInput('username'); if ((int) $ilSetting->get('allow_change_loginname') && $un != $ilUser->getLogin()) { if (!strlen($un) || !ilUtil::isLogin($un)) { ilUtil::sendFailure($lng->txt('form_input_not_valid')); $this->form->getItemByPostVar('username')->setAlert($this->lng->txt('login_invalid')); $form_valid = false; } else { if (ilObjUser::_loginExists($un, $ilUser->getId())) { ilUtil::sendFailure($lng->txt('form_input_not_valid')); $this->form->getItemByPostVar('username')->setAlert($this->lng->txt('loginname_already_exists')); $form_valid = false; } else { $ilUser->setLogin($un); try { $ilUser->updateLogin($ilUser->getLogin()); $ilAuth->setAuth($ilUser->getLogin()); $ilAuth->start(); } catch (ilUserException $e) { ilUtil::sendFailure($lng->txt('form_input_not_valid')); $this->form->getItemByPostVar('username')->setAlert($e->getMessage()); $form_valid = false; } } } } // everthing's ok. save form data if ($form_valid) { $this->uploadUserPicture(); // profile ok $ilUser->setProfileIncomplete(false); // save user data & object_data $ilUser->setTitle($ilUser->getFullname()); $ilUser->setDescription($ilUser->getEmail()); $ilUser->update(); ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true); if (ilSession::get('orig_request_target')) { $target = ilSession::get('orig_request_target'); ilSession::set('orig_request_target', ''); ilUtil::redirect($target); } else { if ($redirect = $_SESSION['profile_complete_redirect']) { unset($_SESSION['profile_complete_redirect']); ilUtil::redirect($redirect); } else { $ilCtrl->redirect($this, "showPersonalData"); } } } } $this->form->setValuesByPost(); $this->showPersonalData(true); }
public function loadTokenFromSession() { $exod_bearer_token = unserialize(ilSession::get(self::EXOD_AUTH_BEARER)); if ($exod_bearer_token instanceof exodBearerToken) { $this->setExodbearerToken($exod_bearer_token); } }
private function showHeader() { global $ilMainMenu, $ilTabs, $ilHelp; $ilHelp->setScreenIdComponent("mail"); $ilMainMenu->setActive("mail"); // $this->tpl->getStandardTemplate(); $this->tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html"); $this->tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html"); $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_mail_b.png")); // display infopanel if something happened ilUtil::infoPanel(); $ilTabs->addTarget('fold', $this->ctrl->getLinkTargetByClass('ilmailfoldergui')); $this->ctrl->setParameterByClass('ilmailformgui', 'type', 'new'); $ilTabs->addTarget('compose', $this->ctrl->getLinkTargetByClass('ilmailformgui')); $this->ctrl->clearParametersByClass('ilmailformgui'); $ilTabs->addTarget('mail_addressbook', $this->ctrl->getLinkTargetByClass('ilmailaddressbookgui')); $ilTabs->addTarget('options', $this->ctrl->getLinkTargetByClass('ilmailoptionsgui')); switch ($this->forwardClass) { case 'ilmailformgui': $ilTabs->setTabActive('compose'); break; case 'ilmailaddressbookgui': $ilTabs->setTabActive('mail_addressbook'); break; case 'ilmailoptionsgui': $ilTabs->setTabActive('options'); break; case 'ilmailfoldergui': default: $ilTabs->setTabActive('fold'); break; } if (isset($_GET['message_sent'])) { $ilTabs->setTabActive('fold'); } if ('tree' != ilSession::get(self::VIEWMODE_SESSION_KEY)) { $this->ctrl->setParameter($this, 'viewmode', 'tree'); $this->tpl->setTreeFlatIcon($this->ctrl->getLinkTarget($this), 'tree'); } else { $this->ctrl->setParameter($this, 'viewmode', 'flat'); $this->tpl->setTreeFlatIcon($this->ctrl->getLinkTarget($this), 'flat'); } $this->ctrl->clearParameters($this); $this->tpl->setCurrentBlock("tree_icons"); $this->tpl->parseCurrentBlock(); }
/** * migrate account * * @access public * */ public function migrateAccount() { global $lng, $ilClientIniFile, $ilLog, $rbacadmin; $lng->loadLanguageModule('auth'); if (!isset($_POST['account_migration'])) { $this->showAccountMigration($lng->txt('err_choose_migration_type')); return false; } if ($_POST['account_migration'] == 1 and (!strlen($_POST['mig_username']) or !strlen($_POST['mig_password']))) { $this->showAccountMigration($lng->txt('err_wrong_login')); return false; } if ($_POST['account_migration'] == 1) { if (!($user_id = ilObjUser::_lookupId(ilUtil::stripSlashes($_POST['mig_username'])))) { $this->showAccountMigration($lng->txt('err_wrong_login')); return false; } $_POST['username'] = $_POST['mig_username']; $_POST['password'] = $_POST['mig_password']; include_once './Services/Authentication/classes/class.ilAuthFactory.php'; include_once './Services/Database/classes/class.ilAuthContainerMDB2.php'; $ilAuth = ilAuthFactory::factory(new ilAuthContainerMDB2()); $ilAuth->start(); if (!$ilAuth->checkAuth()) { $ilAuth->logout(); $this->showAccountMigration($lng->txt('err_wrong_login')); return false; } $user = new ilObjUser($user_id); $user->setAuthMode(ilSession::get('tmp_auth_mode')); $user->setExternalAccount(ilSession::get('tmp_external_account')); $user->setActive(true); $user->update(); // Assign to default role if (is_array(ilSession::get('tmp_roles'))) { foreach (ilSession::get('tmp_roles') as $role) { $rbacadmin->assignUser((int) $role, $user->getId()); } } // Log migration $ilLog->write(__METHOD__ . ': Migrated ' . ilSession::get('tmp_external_account') . ' to ILIAS account ' . $user->getLogin() . '.'); } elseif ($_POST['account_migration'] == 2) { switch (ilSession::get('tmp_auth_mode')) { case 'apache': $_POST['username'] = ilSession::get('tmp_external_account'); $_POST['password'] = ilSession::get('tmp_pass'); include_once 'Services/AuthApache/classes/class.ilAuthContainerApache.php'; $container = new ilAuthContainerApache(); $container->forceCreation(true); $ilAuth = ilAuthFactory::factory($container); $ilAuth->start(); break; case 'ldap': $_POST['username'] = ilSession::get('tmp_external_account'); $_POST['password'] = ilSession::get('tmp_pass'); include_once 'Services/LDAP/classes/class.ilAuthContainerLDAP.php'; $container = new ilAuthContainerLDAP(); $container->forceCreation(true); $ilAuth = ilAuthFactory::factory($container); $ilAuth->start(); break; case 'radius': $_POST['username'] = ilSession::get('tmp_external_account'); $_POST['password'] = ilSession::get('tmp_pass'); include_once './Services/Authentication/classes/class.ilAuthFactory.php'; include_once './Services/Radius/classes/class.ilAuthContainerRadius.php'; $container = new ilAuthContainerRadius(); $container->forceCreation(true); $ilAuth = ilAuthFactory::factory($container); $ilAuth->start(); break; case 'openid': $_POST['username'] = ilSession::get('dummy'); $_POST['password'] = ilSession::get('dummy'); $_POST['oid_username'] = ilSession::get('tmp_oid_username'); $_POST['oid_provider'] = ilSession::get('tmp_oid_provider'); //ilSession::set('force_creation', true); include_once './Services/Authentication/classes/class.ilAuthFactory.php'; include_once './Services/OpenId/classes/class.ilAuthContainerOpenId.php'; $container = new ilAuthContainerOpenId(); $container->forceCreation(true); ilAuthFactory::setContext(ilAuthFactory::CONTEXT_OPENID); include_once './Services/OpenId/classes/class.ilAuthOpenId.php'; $ilAuth = ilAuthFactory::factory($container); // logout first to initiate a new login session $ilAuth->logout(); ilSession::_destroy(session_id()); ilSession::set('force_creation', true); $ilAuth->start(); } // Redirect to acceptance ilUtil::redirect("ilias.php?baseClass=ilStartUpGUI&cmdClass=ilstartupgui&target=" . $_GET["target"] . "&cmd=getAcceptance"); } // show personal desktop ilUtil::redirect('ilias.php?baseClass=ilPersonalDesktopGUI'); }
/** * Show terms of service */ protected function showTermsOfService() { /** * @var $lng ilLanguage * @var $tpl ilTemplate * @var $ilUser ilObjUser * @var $ilSetting ilSetting */ global $lng, $tpl, $ilUser, $ilSetting; $back_to_login = '******' != $this->ctrl->getCmd(); self::initStartUpTemplate('tpl.view_terms_of_service.html', $back_to_login, !$back_to_login); $tpl->setVariable('TXT_PAGEHEADLINE', $lng->txt('usr_agreement')); // #9728 $lang_opts = array(); foreach ($lng->getInstalledLanguages() as $lang_key) { $lang_opts[$lang_key] = ilLanguage::_lookupEntry($lang_key, "meta", "meta_l_" . $lang_key); } if (sizeof($lang_opts) > 1) { asort($lang_opts); foreach ($lang_opts as $lang_key => $lang_caption) { $tpl->setCurrentBlock('lang_headline_languages'); $tpl->setVariable('LANG_HEADLINE_LANGUAGES_LANG_NAME', $lang_caption); $tpl->setVariable('LANG_HEADLINE_LANGUAGES_LANG_KEY', $lang_key); if ($lang_key == $lng->getLangKey()) { $tpl->setVariable('LANG_HEADLINE_LANGUAGES_SELECTED_LANG', ' selected="selected"'); } $tpl->parseCurrentBlock(); } $tpl->setCurrentBlock('lang_headline'); $tpl->setVariable('LANG_CHANGE_CMD', $this->ctrl->getCmd()); $tpl->setVariable('LANG_CHANGE_FORMACTION', $this->ctrl->getFormAction($this, $this->ctrl->getCmd())); $tpl->setVariable('LANG_CHANGE_TXT_OK', $lng->txt('ok')); $tpl->setVariable('LANG_CHANGE_TXT_CHOOSE_LANGUAGE', $lng->txt('choose_language')); $tpl->setCurrentBlock('lang_headline'); } try { require_once 'Services/TermsOfService/classes/class.ilTermsOfServiceSignableDocumentFactory.php'; $document = ilTermsOfServiceSignableDocumentFactory::getByLanguageObject($lng); if ('getAcceptance' == $this->ctrl->getCmd()) { if (isset($_POST['status']) && 'accepted' == $_POST['status']) { require_once 'Services/TermsOfService/classes/class.ilTermsOfServiceHelper.php'; ilTermsOfServiceHelper::trackAcceptance($ilUser, $document); if (ilSession::get('orig_request_target')) { $target = ilSession::get('orig_request_target'); ilSession::set('orig_request_target', ''); ilUtil::redirect($target); } else { ilUtil::redirect('index.php?target=' . $_GET['target'] . '&client_id=' . CLIENT_ID); } } $tpl->setVariable('FORM_ACTION', $this->ctrl->getFormAction($this, $this->ctrl->getCmd())); $tpl->setVariable('ACCEPT_CHECKBOX', ilUtil::formCheckbox(0, 'status', 'accepted')); $tpl->setVariable('ACCEPT_TERMS_OF_SERVICE', $lng->txt('accept_usr_agreement')); $tpl->setVariable('TXT_SUBMIT', $lng->txt('submit')); } $tpl->setVariable('TERMS_OF_SERVICE_CONTENT', $document->getContent()); } catch (ilTermsOfServiceNoSignableDocumentFoundException $e) { $tpl->setVariable('TERMS_OF_SERVICE_CONTENT', sprintf($lng->txt('no_agreement_description'), 'mailto:' . $ilSetting->get('feedback_recipient'))); } $tpl->show(); }
/** * Save password form * */ public function savePassword() { global $tpl, $lng, $ilCtrl, $ilUser, $ilSetting; // normally we should not end up here if (!$this->allowPasswordChange()) { $ilCtrl->redirect($this, "showPersonalData"); return; } $this->initPasswordForm(); if ($this->form->checkInput()) { $cp = $this->form->getItemByPostVar("current_password"); $np = $this->form->getItemByPostVar("new_password"); $error = false; // The old password needs to be checked for verification // unless the user uses Shibboleth authentication with additional // local authentication for WebDAV. #if ($ilUser->getAuthMode(true) != AUTH_SHIBBOLETH || ! $ilSetting->get("shib_auth_allow_local")) if ($ilUser->getAuthMode(true) == AUTH_LOCAL) { require_once 'Services/User/classes/class.ilUserPasswordManager.php'; if (!ilUserPasswordManager::getInstance()->verifyPassword($ilUser, ilUtil::stripSlashes($_POST['current_password']))) { $error = true; $cp->setAlert($this->lng->txt('passwd_wrong')); } } // select password from auto generated passwords if ($this->ilias->getSetting("passwd_auto_generate") == 1 && !ilUtil::isPassword($_POST["new_password"])) { $error = true; $np->setAlert($this->lng->txt("passwd_not_selected")); } if ($this->ilias->getSetting("passwd_auto_generate") != 1 && !ilUtil::isPassword($_POST["new_password"], $custom_error)) { $error = true; if ($custom_error != '') { $np->setAlert($custom_error); } else { $np->setAlert($this->lng->txt("passwd_invalid")); } } $error_lng_var = ''; if ($this->ilias->getSetting("passwd_auto_generate") != 1 && !ilUtil::isPasswordValidForUserContext($_POST["new_password"], $ilUser, $error_lng_var)) { ilUtil::sendFailure($this->lng->txt('form_input_not_valid')); $np->setAlert($this->lng->txt($error_lng_var)); $error = true; } if ($this->ilias->getSetting("passwd_auto_generate") != 1 && ($ilUser->isPasswordExpired() || $ilUser->isPasswordChangeDemanded()) && $_POST["current_password"] == $_POST["new_password"]) { $error = true; $np->setAlert($this->lng->txt("new_pass_equals_old_pass")); } if (!$error) { $ilUser->resetPassword($_POST["new_password"], $_POST["new_password"]); if ($_POST["current_password"] != $_POST["new_password"]) { $ilUser->setLastPasswordChangeToNow(); } if (ilSession::get('orig_request_target')) { ilUtil::sendSuccess($this->lng->txt('saved_successfully'), true); $target = ilSession::get('orig_request_target'); ilSession::set('orig_request_target', ''); ilUtil::redirect($target); } else { ilUtil::sendSuccess($this->lng->txt('saved_successfully')); $this->showPassword(true, true); return; } } } $this->form->setValuesByPost(); $this->showPassword(true); }
/** * Render current help page * * @param * @return */ function initHelp($a_tpl) { global $ilUser; if (ilSession::get("help_pg") > 0) { $a_tpl->addOnLoadCode("il.Help.showCurrentPage(" . ilSession::get("help_pg") . ");", 3); } if ($ilUser->getPref("hide_help_tt")) { $a_tpl->addOnLoadCode("il.Help.switchTooltips();", 3); } }
protected function isTestSignRedirectRequired($activeId, $lastFinishedPass) { if (!$this->object->getSignSubmission()) { return false; } if (!is_null(ilSession::get("signed_{$activeId}_{$lastFinishedPass}"))) { return false; } global $ilPluginAdmin; $activePlugins = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_MODULE, 'Test', 'tsig'); if (!count($activePlugins)) { return false; } return true; }
/** * @param string $password */ public function login($password) { /** * @var $lng ilLanguage */ global $lng; ilStartUpGUI::initStartUpTemplate(array('tpl.usr_registered.html', 'Services/Registration'), true); $this->tpl->setVariable('TXT_PAGEHEADLINE', $this->lng->txt('registration')); $this->tpl->setVariable("TXT_WELCOME", $lng->txt("welcome") . ", " . $this->userObj->getTitle() . "!"); if (($this->registration_settings->getRegistrationType() == IL_REG_DIRECT || $this->registration_settings->getRegistrationType() == IL_REG_CODES || $this->code_was_used) && !$this->registration_settings->passwordGenerationEnabled()) { $this->tpl->setCurrentBlock('activation'); $this->tpl->setVariable('TXT_REGISTERED', $lng->txt('txt_registered')); $this->tpl->setVariable('FORMACTION', 'login.php?cmd=post&target=' . ilUtil::stripSlashes($_GET['target'])); if (ilSession::get('forceShoppingCartRedirect')) { $this->tpl->setVariable('FORMACTION', './login.php?forceShoppingCartRedirect=1'); } $this->tpl->setVariable('TARGET', 'target="_parent"'); $this->tpl->setVariable('TXT_LOGIN', $lng->txt('login_to_ilias')); $this->tpl->setVariable('USERNAME', $this->userObj->getLogin()); $this->tpl->setVariable('PASSWORD', $password); $this->tpl->parseCurrentBlock(); } else { if ($this->registration_settings->getRegistrationType() == IL_REG_APPROVE) { $this->tpl->setVariable('TXT_REGISTERED', $lng->txt('txt_submitted')); if (IS_PAYMENT_ENABLED == true) { if (ilSession::get('forceShoppingCartRedirect')) { $this->tpl->setCurrentBlock('activation'); include_once 'Services/Payment/classes/class.ilShopLinkBuilder.php'; $shop_link = new ilShopLinkBuilder(); $this->tpl->setVariable('FORMACTION', $shop_link->buildLink('ilshopshoppingcartgui', '_forceShoppingCartRedirect_user='******'TARGET', 'target=\'_parent\''); $this->lng->loadLanguageModule('payment'); $this->tpl->setVariable('TXT_LOGIN', $lng->txt('pay_goto_shopping_cart')); $this->tpl->parseCurrentBlock(); $this->lng->loadLanguageModule('registration'); } } } else { if ($this->registration_settings->getRegistrationType() == IL_REG_ACTIVATION) { $login_url = './login.php?cmd=force_login&lang=' . $this->userObj->getLanguage(); $this->tpl->setVariable('TXT_REGISTERED', sprintf($lng->txt('reg_confirmation_link_successful'), $login_url)); $this->tpl->setVariable('REDIRECT_URL', $login_url); } else { $this->tpl->setVariable('TXT_REGISTERED', $lng->txt('txt_registered_passw_gen')); } } } }
/** * Show terms of service */ protected function showTermsOfService() { /** * @var $lng ilLanguage * @var $tpl ilTemplate * @var $ilUser ilObjUser * @var $ilSetting ilSetting */ global $lng, $tpl, $ilUser, $ilSetting; $back_to_login = '******' != $this->ctrl->getCmd(); self::initStartUpTemplate('tpl.view_terms_of_service.html', $back_to_login, !$back_to_login); $tpl->setVariable('TXT_PAGEHEADLINE', $lng->txt('usr_agreement')); try { require_once 'Services/TermsOfService/classes/class.ilTermsOfServiceSignableDocumentFactory.php'; $document = ilTermsOfServiceSignableDocumentFactory::getByLanguageObject($lng); if ('getAcceptance' == $this->ctrl->getCmd()) { if (isset($_POST['status']) && 'accepted' == $_POST['status']) { require_once 'Services/TermsOfService/classes/class.ilTermsOfServiceHelper.php'; ilTermsOfServiceHelper::trackAcceptance($ilUser, $document); if (ilSession::get('orig_request_target')) { $target = ilSession::get('orig_request_target'); ilSession::set('orig_request_target', ''); ilUtil::redirect($target); } else { ilUtil::redirect('index.php?target=' . $_GET['target'] . '&client_id=' . CLIENT_ID); } } $tpl->setVariable('FORM_ACTION', $this->ctrl->getFormAction($this, $this->ctrl->getCmd())); $tpl->setVariable('ACCEPT_CHECKBOX', ilUtil::formCheckbox(0, 'status', 'accepted')); $tpl->setVariable('ACCEPT_TERMS_OF_SERVICE', $lng->txt('accept_usr_agreement')); $tpl->setVariable('TXT_SUBMIT', $lng->txt('submit')); } $tpl->setVariable('TERMS_OF_SERVICE_CONTENT', $document->getContent()); } catch (ilTermsOfServiceNoSignableDocumentFoundException $e) { $tpl->setVariable('TERMS_OF_SERVICE_CONTENT', sprintf($lng->txt('no_agreement_description'), 'mailto:' . ilUtil::prepareFormOutput($ilSetting->get('feedback_recipient')))); } $tpl->show(); }
protected function initSessionStorage() { $sess = ilSession::get('frm'); if (!is_array($sess)) { $sess = array(); ilSession::set('frm', $sess); } if (isset($_GET['thr_fk']) && !is_array($sess[(int) $_GET['thr_fk']])) { $sess[(int) $_GET['thr_fk']] = array(); ilSession::set('frm', $sess); } }
/** * Init core objects (level 0) */ protected static function initCore() { global $ilErr; // remove notices from error reporting if (version_compare(PHP_VERSION, '5.4.0', '>=')) { // Prior to PHP 5.4.0 E_ALL does not include E_STRICT. // With PHP 5.4.0 and above E_ALL >DOES< include E_STRICT. error_reporting(ini_get("error_reporting") & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT); } elseif (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); } // breaks CAS: must be included after CAS context isset in AuthUtils //self::includePhp5Compliance(); self::requireCommonIncludes(); // error handler self::initGlobal("ilErr", "ilErrorHandling", "./Services/Init/classes/class.ilErrorHandling.php"); $ilErr->setErrorHandling(PEAR_ERROR_CALLBACK, array($ilErr, 'errorHandler')); // :TODO: obsolete? PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array($ilErr, "errorHandler")); // workaround: load old post variables if error handler 'message' was called include_once "Services/Authentication/classes/class.ilSession.php"; if (ilSession::get("message")) { $_POST = ilSession::get("post_vars"); } self::removeUnsafeCharacters(); self::initIliasIniFile(); // deprecated self::initGlobal("ilias", "ILIAS", "./Services/Init/classes/class.ilias.php"); }
/** * @param bool|null $status * @return void|bool */ public function hasToAcceptTermsOfServiceInSession($status = null) { if (null === $status) { return ilSession::get('has_to_accept_agr_in_session'); } require_once 'Services/TermsOfService/classes/class.ilTermsOfServiceHelper.php'; if (ilTermsOfServiceHelper::isEnabled()) { ilSession::set('has_to_accept_agr_in_session', (int) $status); } }
/** * confirmed deletion of object -> objects are moved to trash or deleted * immediately, if trash is disabled */ public function confirmedDeleteObject() { global $ilSetting, $lng; if (isset($_POST["mref_id"])) { $_SESSION["saved_post"] = array_unique(array_merge($_SESSION["saved_post"], $_POST["mref_id"])); } include_once "./Services/Repository/classes/class.ilRepUtilGUI.php"; $ru = new ilRepUtilGUI($this); $ru->deleteObjects($_GET["ref_id"], ilSession::get("saved_post")); ilSession::clear("saved_post"); $this->ctrl->returnToParent($this); }
/** * Render current help page * * @param * @return */ function initHelp($a_tpl) { global $ilUser, $ilSetting; $module_id = (int) $ilSetting->get("help_module"); if ((OH_REF_ID > 0 || $module_id > 0) && $ilUser->getLanguage() == "de") { if (ilSession::get("help_pg") > 0) { $a_tpl->addOnLoadCode("il.Help.showCurrentPage(" . ilSession::get("help_pg") . ");", 3); } if ($ilUser->getPref("hide_help_tt")) { $a_tpl->addOnLoadCode("il.Help.switchTooltips();", 3); } } }