本文整理汇总了PHP中ilSession::get方法的典型用法代码示例。如果您正苦于以下问题:PHP ilSession::get方法的具体用法?PHP ilSession::get怎么用?PHP ilSession::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilSession
的用法示例。
在下文中一共展示了ilSession::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: storeRequest
/**
*
*/
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);
}
}
示例2: getChapters
/**
* 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);
}
示例3: storeRequest
/**
*
*/
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);
}
}
示例4: fillMessage
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);
}
}
示例5: authenticate
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());
}
示例6: finishTestCmd
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
//.........这里部分代码省略.........
示例7: showTooltipList
/**
* 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());
}
示例8: showMail
/**
* 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);
//.........这里部分代码省略.........
示例9: savePersonalData
/**
* 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
//.........这里部分代码省略.........
示例10: loadTokenFromSession
public function loadTokenFromSession()
{
$exod_bearer_token = unserialize(ilSession::get(self::EXOD_AUTH_BEARER));
if ($exod_bearer_token instanceof exodBearerToken) {
$this->setExodbearerToken($exod_bearer_token);
}
}
示例11: showHeader
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();
}
示例12: migrateAccount
/**
* 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
//.........这里部分代码省略.........
示例13: showTermsOfService
/**
* 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 = 'getAcceptance' != $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();
}
示例14: savePassword
/**
* 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);
}
示例15: initHelp
/**
* 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);
}
}