/** * @return array */ private static function getSupportedContexts() { if (null !== self::$context_map) { return self::$context_map; } self::$context_map = array(); $r = new ReflectionClass(new self()); $constants = $r->getConstants(); foreach ($constants as $name => $value) { if (strpos($name, 'CONTEXT_') === 0) { self::$context_map[strtolower(substr($name, strlen('CONTEXT_')))] = $value; } } return self::$context_map; }
/** * */ public function login() { $this->_loadStorage(); if (!empty($this->username) && 'anonymous' != $this->username && $this->storage->supportsCaptchaVerification()) { require_once 'Services/Captcha/classes/class.ilCaptchaUtil.php'; if (ilCaptchaUtil::isActiveForLogin()) { require_once 'Services/Form/classes/class.ilPropertyFormGUI.php'; require_once 'Services/Captcha/classes/class.ilCaptchaInputGUI.php'; $captcha = new ilCaptchaInputGUI('', 'captcha_code'); $captcha->setRequired(true); if (!$captcha->checkInput()) { $this->log('Captcha verification failed'); $this->status = AUTH_CAPTCHA_INVALID; return; } } } parent::login(); }
/** * @param string $a_form_id * @return array */ public function addToExternalSettingsForm($a_form_id) { switch ($a_form_id) { case ilAdministrationSettingsFormHandler::FORM_ACCESSIBILITY: require_once 'Services/Captcha/classes/class.ilCaptchaUtil.php'; $fields = array('adm_captcha_anonymous_short' => array(ilCaptchaUtil::isActiveForLogin(), ilAdministrationSettingsFormHandler::VALUE_BOOL)); return array('authentication_settings' => array('authSettings', $fields)); } }
/** * @param string $a_form_id * @return array */ public function addToExternalSettingsForm($a_form_id) { /** * @var $ilSetting ilSetting */ global $ilSetting; switch ($a_form_id) { case ilAdministrationSettingsFormHandler::FORM_PRIVACY: $fields = array('enable_fora_statistics' => array($ilSetting->get('enable_fora_statistics', false), ilAdministrationSettingsFormHandler::VALUE_BOOL), 'enable_anonymous_fora' => array($ilSetting->get('enable_anonymous_fora', false), ilAdministrationSettingsFormHandler::VALUE_BOOL)); return array(array("editSettings", $fields)); case ilAdministrationSettingsFormHandler::FORM_ACCESSIBILITY: require_once 'Services/Captcha/classes/class.ilCaptchaUtil.php'; $fields = array('adm_captcha_anonymous_short' => array(ilCaptchaUtil::isActiveForForum(), ilAdministrationSettingsFormHandler::VALUE_BOOL)); return array('obj_frma' => array('editSettings', $fields)); } }
/** * edit ("view" before) */ function edit() { global $tree, $lng, $ilCtrl, $ilSetting, $ilUser, $ilHelp; // editing allowed? if (!$this->getEnableEditing()) { ilUtil::sendFailure($lng->txt("permission_denied"), true); $ilCtrl->redirect($this, "preview"); } $ilHelp->setScreenId("edit_" . $this->getParentType()); require_once 'Services/Captcha/classes/class.ilCaptchaUtil.php'; if ($ilUser->isAnonymous() && !$ilUser->isCaptchaVerified() && ilCaptchaUtil::isActiveForWiki()) { $form = $this->initCaptchaForm(); if ($_POST['captcha_code'] && $form->checkInput()) { $ilUser->setCaptchaVerified(true); } else { return $form->getHTML(); } } // edit lock if (!$this->getPageObject()->getEditLock()) { $info = $lng->txt("content_no_edit_lock"); include_once "./Services/User/classes/class.ilUserUtil.php"; $lock = $this->getPageObject()->getEditLockInfo(); $info .= "</br>" . $lng->txt("content_until") . ": " . ilDatePresentation::formatDate(new ilDateTime($lock["edit_lock_until"], IL_CAL_UNIX)); $info .= "</br>" . $lng->txt("obj_usr") . ": " . ilUserUtil::getNamePresentation($lock["edit_lock_user"]); ilUtil::sendInfo($info); return ""; } else { $aset = new ilSetting("adve"); $min = (int) $aset->get("block_mode_minutes"); if ($min > 0) { $info = $lng->txt("cont_got_lock"); include_once "./Services/User/classes/class.ilUserUtil.php"; $lock = $this->getPageObject()->getEditLockInfo(); //$info.= "</br>".$lng->txt("content_until").": ". // ilDatePresentation::formatDate(new ilDateTime($lock["edit_lock_until"],IL_CAL_UNIX)); //$info.= "</br>".$lng->txt("obj_usr").": ". // ilUserUtil::getNamePresentation($lock["edit_lock_user"]); $info .= " <a class='small submit' href='" . $ilCtrl->getLinkTarget($this, "releasePageLock") . "'>" . $lng->txt("cont_finish_editing") . "</a>"; ilUtil::sendInfo($info); } } $this->setOutputMode(IL_PAGE_EDIT); $html = $this->showPage(); if ($this->isEnabledNotes()) { $html .= "<br /><br />" . $this->getNotesHTML(); } return $html; }
/** * Show login form * @global ilSetting $ilSetting * @param string $page_editor_html */ protected function showLoginForm($page_editor_html) { global $ilSetting, $lng, $tpl; // @todo move this to auth utils. // login via ILIAS (this also includes radius and ldap) // If local authentication is enabled for shibboleth users, we // display the login form for ILIAS here. if (($ilSetting->get("auth_mode") != AUTH_SHIBBOLETH || $ilSetting->get("shib_auth_allow_local")) && $ilSetting->get("auth_mode") != AUTH_CAS) { include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); //$form->setTableWidth('500'); $form->setFormAction($this->ctrl->getFormAction($this, '')); $form->setName("formlogin"); $form->setShowTopButtons(false); $form->setTitle($lng->txt("login_to_ilias")); // auth selection include_once './Services/Authentication/classes/class.ilAuthModeDetermination.php'; $det = ilAuthModeDetermination::_getInstance(); if (ilAuthUtils::_hasMultipleAuthenticationMethods() and $det->isManualSelection()) { $visible_auth_methods = array(); $radg = new ilRadioGroupInputGUI($lng->txt("auth_selection"), "auth_mode"); foreach (ilAuthUtils::_getMultipleAuthModeOptions($lng) as $key => $option) { if (isset($option['hide_in_ui']) && $option['hide_in_ui']) { continue; } $op1 = new ilRadioOption($option['txt'], $key); $radg->addOption($op1); if (isset($option['checked'])) { $radg->setValue($key); } $visible_auth_methods[] = $op1; } if (count($visible_auth_methods) == 1) { $first_auth_method = current($visible_auth_methods); $hidden_auth_method = new ilHiddenInputGUI("auth_mode"); $hidden_auth_method->setValue($first_auth_method->getValue()); $form->addItem($hidden_auth_method); } else { $form->addItem($radg); } } $ti = new ilTextInputGUI($lng->txt("username"), "username"); $ti->setSize(20); $ti->setRequired(true); $form->addItem($ti); $pi = new ilPasswordInputGUI($lng->txt("password"), "password"); $pi->setRetype(false); $pi->setSize(20); $pi->setDisableHtmlAutoComplete(false); $pi->setRequired(true); $form->addItem($pi); $form->addCommandButton("showLogin", $lng->txt("log_in")); require_once 'Services/Captcha/classes/class.ilCaptchaUtil.php'; if (ilCaptchaUtil::isActiveForLogin()) { require_once 'Services/Captcha/classes/class.ilCaptchaInputGUI.php'; $captcha = new ilCaptchaInputGUI($lng->txt('captcha_code'), 'captcha_code'); $captcha->setRequired(true); $form->addItem($captcha); } return $this->substituteLoginPageElements($tpl, $page_editor_html, $form->getHTML(), '[list-login-form]', 'LOGIN_FORM'); } return $page_editor_html; }
public function addThreadObject($a_prevent_redirect = false) { /** * @var $ilUser ilObjUser * @var $ilAccess ilAccessHandler * @var $lng ilLanguage */ global $ilUser, $ilAccess, $lng; $frm = $this->object->Forum; $frm->setForumId($this->object->getId()); $frm->setForumRefId($this->object->getRefId()); if (!$ilAccess->checkAccess('add_thread', '', $this->object->getRefId())) { $this->ilias->raiseError($lng->txt('permission_denied'), $this->ilias->error_obj->MESSAGE); } $frm->setMDB2WhereCondition('top_frm_fk = %s ', array('integer'), array($frm->getForumId())); $topicData = $frm->getOneTopic(); $this->initTopicCreateForm(); if ($this->create_topic_form_gui->checkInput()) { require_once 'Services/Captcha/classes/class.ilCaptchaUtil.php'; if ($ilUser->isAnonymous() && !$ilUser->isCaptchaVerified() && ilCaptchaUtil::isActiveForForum()) { $ilUser->setCaptchaVerified(true); } if ($this->objProperties->isAnonymized()) { if (!strlen($this->create_topic_form_gui->getInput('alias'))) { $user_alias = $this->lng->txt('forums_anonymous'); } else { $user_alias = $this->create_topic_form_gui->getInput('alias'); } } else { $user_alias = $ilUser->getLogin(); } $status = 1; if ($this->objProperties->isPostActivationEnabled() && !$this->is_moderator || $this->objCurrentPost->isAnyParentDeactivated()) { $status = 0; } // build new thread $newPost = $frm->generateThread($topicData['top_pk'], $ilUser->getId(), $this->objProperties->isAnonymized() ? 0 : $ilUser->getId(), $this->handleFormInput($this->create_topic_form_gui->getInput('subject'), false), ilRTE::_replaceMediaObjectImageSrc($this->create_topic_form_gui->getInput('message'), 0), $this->create_topic_form_gui->getItemByPostVar('notify') ? (int) $this->create_topic_form_gui->getInput('notify') : 0, $this->create_topic_form_gui->getItemByPostVar('notify_posts') ? (int) $this->create_topic_form_gui->getInput('notify_posts') : 0, $user_alias, '', $status); $file = $_FILES['userfile']; // file upload if (is_array($file) && !empty($file)) { $tmp_file_obj = new ilFileDataForum($this->object->getId(), $newPost); $tmp_file_obj->storeUploadedFile($file); } // Visit-Counter $frm->setDbTable('frm_data'); $frm->setMDB2WhereCondition('top_pk = %s ', array('integer'), array($topicData['top_pk'])); $frm->updateVisits($topicData['top_pk']); $frm->setMDB2WhereCondition('thr_top_fk = %s AND thr_subject = %s AND thr_num_posts = 1 ', array('integer', 'text'), array($topicData['top_pk'], $this->create_topic_form_gui->getInput('subject'))); // copy temporary media objects (frm~) include_once 'Services/MediaObjects/classes/class.ilObjMediaObject.php'; $mediaObjects = ilRTE::_getMediaObjects($this->create_topic_form_gui->getInput('message'), 0); foreach ($mediaObjects as $mob) { if (ilObjMediaObject::_exists($mob)) { ilObjMediaObject::_removeUsage($mob, 'frm~:html', $ilUser->getId()); ilObjMediaObject::_saveUsage($mob, 'frm:html', $newPost); } } if ($this->ilias->getSetting('forum_notification') == 1) { // send notification about new topic $objPost = new ilForumPost((int) $newPost, $this->is_moderator); $post_data = array(); $post_data = $objPost->getDataAsArray(); $titles = $this->getTitlesByRefId(array($this->object->getRefId())); $post_data["top_name"] = $titles[0]; $post_data["ref_id"] = $this->object->getRefId(); $frm->sendForumNotifications($post_data); } if (!$a_prevent_redirect) { ilUtil::sendSuccess($this->lng->txt('forums_thread_new_entry'), true); $this->ctrl->redirect($this); } else { return $newPost; } } else { $this->create_topic_form_gui->setValuesByPost(); if (!$this->objProperties->isAnonymized()) { $this->create_topic_form_gui->getItemByPostVar('alias')->setValue($ilUser->getLogin()); } return $this->tpl->setContent($this->create_topic_form_gui->getHTML()); } }
/** * edit ("view" before) */ function edit() { global $tree, $lng, $ilCtrl, $ilSetting, $ilUser; // editing allowed? if (!$this->getEnableEditing()) { ilUtil::sendFailure($lng->txt("permission_denied"), true); $ilCtrl->redirect($this, "preview"); } require_once 'Services/Captcha/classes/class.ilCaptchaUtil.php'; if ($ilUser->isAnonymous() && !$ilUser->isCaptchaVerified() && ilCaptchaUtil::isActiveForWiki()) { $form = $this->initCaptchaForm(); if ($_POST['captcha_code'] && $form->checkInput()) { $ilUser->setCaptchaVerified(true); } else { return $form->getHTML(); } } // edit lock if (!$this->getPageObject()->getEditLock()) { $info = $lng->txt("content_no_edit_lock"); include_once "./Services/User/classes/class.ilUserUtil.php"; $lock = $this->getPageObject()->getEditLockInfo(); $info .= "</br>" . $lng->txt("content_until") . ": " . ilDatePresentation::formatDate(new ilDateTime($lock["edit_lock_until"], IL_CAL_UNIX)); $info .= "</br>" . $lng->txt("obj_usr") . ": " . ilUserUtil::getNamePresentation($lock["edit_lock_user"]); ilUtil::sendInfo($info); return ""; } $this->setOutputMode(IL_PAGE_EDIT); $html = $this->showPage(); if ($this->isEnabledNotes()) { $html .= "<br /><br />" . $this->getNotesHTML(); } return $html; }
protected function __initForm() { global $lng, $ilUser; include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $this->form = new ilPropertyFormGUI(); $this->form->setFormAction($this->ctrl->getFormAction($this)); // code handling if ($this->code_enabled) { include_once 'Services/Registration/classes/class.ilRegistrationCode.php'; $code = new ilTextInputGUI($lng->txt("registration_code"), "usr_registration_code"); $code->setSize(40); $code->setMaxLength(ilRegistrationCode::CODE_LENGTH); if ((bool) $this->registration_settings->registrationCodeRequired()) { $code->setRequired(true); $code->setInfo($lng->txt("registration_code_required_info")); } else { $code->setInfo($lng->txt("registration_code_optional_info")); } $this->form->addItem($code); } // user defined fields $user_defined_data = $ilUser->getUserDefinedData(); include_once './Services/User/classes/class.ilUserDefinedFields.php'; $user_defined_fields =& ilUserDefinedFields::_getInstance(); $custom_fields = array(); foreach ($user_defined_fields->getRegistrationDefinitions() as $field_id => $definition) { if ($definition['field_type'] == UDF_TYPE_TEXT) { $custom_fields["udf_" . $definition['field_id']] = new ilTextInputGUI($definition['field_name'], "udf_" . $definition['field_id']); $custom_fields["udf_" . $definition['field_id']]->setValue($user_defined_data["f_" . $field_id]); $custom_fields["udf_" . $definition['field_id']]->setMaxLength(255); $custom_fields["udf_" . $definition['field_id']]->setSize(40); } else { if ($definition['field_type'] == UDF_TYPE_WYSIWYG) { $custom_fields["udf_" . $definition['field_id']] = new ilTextAreaInputGUI($definition['field_name'], "udf_" . $definition['field_id']); $custom_fields["udf_" . $definition['field_id']]->setValue($user_defined_data["f_" . $field_id]); $custom_fields["udf_" . $definition['field_id']]->setUseRte(true); } else { $custom_fields["udf_" . $definition['field_id']] = new ilSelectInputGUI($definition['field_name'], "udf_" . $definition['field_id']); $custom_fields["udf_" . $definition['field_id']]->setValue($user_defined_data["f_" . $field_id]); $custom_fields["udf_" . $definition['field_id']]->setOptions($user_defined_fields->fieldValuesToSelectArray($definition['field_values'])); } } if ($definition['required']) { $custom_fields["udf_" . $definition['field_id']]->setRequired(true); } } // standard fields include_once "./Services/User/classes/class.ilUserProfile.php"; $up = new ilUserProfile(); $up->setMode(ilUserProfile::MODE_REGISTRATION); $up->skipGroup("preferences"); // add fields to form $up->addStandardFieldsToForm($this->form, NULL, $custom_fields); unset($custom_fields); // set language selection to current display language $flang = $this->form->getItemByPostVar("usr_language"); if ($flang) { $flang->setValue($lng->getLangKey()); } // add information to role selection (if not hidden) if ($this->code_enabled) { $role = $this->form->getItemByPostVar("usr_roles"); if ($role && $role->getType() == "select") { $role->setInfo($lng->txt("registration_code_role_info")); } } // #11407 $domains = array(); foreach ($this->registration_settings->getAllowedDomains() as $item) { if (trim($item)) { $domains[] = $item; } } if (sizeof($domains)) { $mail_obj = $this->form->getItemByPostVar('usr_email'); $mail_obj->setInfo(sprintf($lng->txt("reg_email_domains"), implode(", ", $domains)) . "<br />" . ($this->code_enabled ? $lng->txt("reg_email_domains_code") : "")); } if (ilTermsOfServiceHelper::isEnabled()) { try { require_once 'Services/TermsOfService/classes/class.ilTermsOfServiceSignableDocumentFactory.php'; $document = ilTermsOfServiceSignableDocumentFactory::getByLanguageObject($lng); $field = new ilFormSectionHeaderGUI(); $field->setTitle($lng->txt('usr_agreement')); $this->form->addItem($field); $field = new ilCustomInputGUI(); $field->setHTML('<div id="agreement">' . $document->getContent() . '</div>'); $this->form->addItem($field); $field = new ilCheckboxInputGUI($lng->txt('accept_usr_agreement'), 'accept_terms_of_service'); $field->setRequired(true); $field->setValue(1); $this->form->addItem($field); } catch (ilTermsOfServiceNoSignableDocumentFoundException $e) { } } require_once 'Services/Captcha/classes/class.ilCaptchaUtil.php'; if (ilCaptchaUtil::isActiveForRegistration()) { require_once 'Services/Captcha/classes/class.ilCaptchaInputGUI.php'; $captcha = new ilCaptchaInputGUI($lng->txt("captcha_code"), 'captcha_code'); $captcha->setRequired(true); $this->form->addItem($captcha); } $this->form->addCommandButton("saveForm", $lng->txt("register")); }
/** * Init basic settings form. */ public function initBasicSettingsForm() { global $lng, $ilSetting; include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $this->form = new ilPropertyFormGUI(); $lng->loadLanguageModule("pd"); // installation short title $ti = new ilTextInputGUI($this->lng->txt("short_inst_name"), "short_inst_name"); $ti->setMaxLength(200); $ti->setSize(40); $ti->setValue($ilSetting->get("short_inst_name")); $ti->setInfo($this->lng->txt("short_inst_name_info")); $this->form->addItem($ti); // public section $cb = new ilCheckboxInputGUI($this->lng->txt("pub_section"), "pub_section"); $cb->setInfo($lng->txt("pub_section_info")); if ($ilSetting->get("pub_section")) { $cb->setChecked(true); } // search engine include_once 'Services/PrivacySecurity/classes/class.ilRobotSettings.php'; $robot_settings = ilRobotSettings::_getInstance(); $cb2 = new ilCheckboxInputGUI($this->lng->txt("search_engine"), "open_google"); $cb2->setInfo($this->lng->txt("enable_search_engine")); $cb->addSubItem($cb2); if (!$robot_settings->checkModRewrite()) { $cb2->setAlert($lng->txt("mod_rewrite_disabled")); $cb2->setChecked(false); $cb2->setDisabled(true); } elseif (!$robot_settings->checkRewrite()) { $cb2->setAlert($lng->txt("allow_override_alert")); $cb2->setChecked(false); $cb2->setDisabled(true); } else { if ($ilSetting->get("open_google")) { $cb2->setChecked(true); } } // Enable Global Profiles $cb_prop = new ilCheckboxInputGUI($lng->txt('pd_enable_user_publish'), 'enable_global_profiles'); $cb_prop->setInfo($lng->txt('pd_enable_user_publish_info')); $cb_prop->setChecked($ilSetting->get('enable_global_profiles')); $cb->addSubItem($cb_prop); // activate captcha for anonymous wiki/forum editing include_once "./Services/Captcha/classes/class.ilCaptchaUtil.php"; $cap = new ilCheckboxInputGUI($this->lng->txt('adm_captcha_wiki_forum'), 'activate_captcha_anonym'); $cap->setValue(1); if (ilCaptchaUtil::checkFreetype()) { $cap->setChecked($ilSetting->get('activate_captcha_anonym')); } else { $cap->setAlert(ilCaptchaUtil::getPreconditionsMessage()); } $cb->addSubItem($cap); $this->form->addItem($cb); // default repository view $options = array("flat" => $lng->txt("flatview"), "tree" => $lng->txt("treeview")); $si = new ilSelectInputGUI($this->lng->txt("def_repository_view"), "default_rep_view"); $si->setOptions($options); $si->setInfo($this->lng->txt("")); if ($ilSetting->get("default_repository_view") == "tree") { $si->setValue("tree"); } else { $si->setValue("flat"); } $this->form->addItem($si); // $options = array("" => $lng->txt("adm_rep_tree_only_container"), "tree" => $lng->txt("adm_all_resource_types")); // repository tree $radg = new ilRadioGroupInputGUI($lng->txt("adm_rep_tree_presentation"), "tree_pres"); $radg->setValue($ilSetting->get("repository_tree_pres")); $op1 = new ilRadioOption($lng->txt("adm_rep_tree_only_cntr"), "", $lng->txt("adm_rep_tree_only_cntr_info")); $radg->addOption($op1); $op2 = new ilRadioOption($lng->txt("adm_rep_tree_all_types"), "all_types", $lng->txt("adm_rep_tree_all_types_info")); // limit tree in courses and groups $cb = new ilCheckboxInputGUI($lng->txt("adm_rep_tree_limit_grp_crs"), "rep_tree_limit_grp_crs"); $cb->setChecked($ilSetting->get("rep_tree_limit_grp_crs")); $cb->setInfo($lng->txt("adm_rep_tree_limit_grp_crs_info")); $op2->addSubItem($cb); $radg->addOption($op2); $this->form->addItem($radg); $sdesc = new ilCheckboxInputGUI($lng->txt("adm_rep_shorten_description"), "rep_shorten_description"); $sdesc->setInfo($lng->txt("adm_rep_shorten_description_info")); $sdesc->setChecked($ilSetting->get("rep_shorten_description")); $this->form->addItem($sdesc); $sdesclen = new ilTextInputGUI($lng->txt("adm_rep_shorten_description_length"), "rep_shorten_description_length"); $sdesclen->setValue($ilSetting->get("rep_shorten_description_length")); $sdesclen->setSize(3); $sdesc->addSubItem($sdesclen); // synchronize repository tree with main view $cb = new ilCheckboxInputGUI($lng->txt("adm_synchronize_rep_tree"), "rep_tree_synchronize"); $cb->setInfo($lng->txt("adm_synchronize_rep_tree_info")); $cb->setChecked($ilSetting->get("rep_tree_synchronize")); $this->form->addItem($cb); // repository access check /* $options = array( 0 => "0", 10 => "10", 30 => "30", 60 => "60", 120 => "120" ); $si = new ilSelectInputGUI($this->lng->txt("adm_repository_cache_time"), "rep_cache"); $si->setOptions($options); $si->setValue($ilSetting->get("rep_cache")); $si->setInfo($this->lng->txt("adm_repository_cache_time_info")." ". $this->lng->txt("adm_repository_cache_time_info2")); $this->form->addItem($si);*/ // load action commands asynchronously $cb = new ilCheckboxInputGUI($this->lng->txt("adm_item_cmd_asynch"), "item_cmd_asynch"); $cb->setInfo($this->lng->txt("adm_item_cmd_asynch_info")); $cb->setChecked($ilSetting->get("item_cmd_asynch")); $this->form->addItem($cb); // locale $ti = new ilTextInputGUI($this->lng->txt("adm_locale"), "locale"); $ti->setMaxLength(80); $ti->setSize(40); $ti->setInfo($this->lng->txt("adm_locale_info")); $ti->setValue($ilSetting->get("locale")); $this->form->addItem($ti); // trash $cb = new ilCheckboxInputGUI($this->lng->txt("enable_trash"), "enable_trash"); $cb->setInfo($this->lng->txt("enable_trash_info")); if ($ilSetting->get("enable_trash")) { $cb->setChecked(true); } $this->form->addItem($cb); // BEGIN SESSION SETTINGS // create session handling radio group $ssettings = new ilRadioGroupInputGUI($this->lng->txt('sess_mode'), 'session_handling_type'); $ssettings->setValue($ilSetting->get('session_handling_type', ilSession::SESSION_HANDLING_FIXED)); // first option, fixed session duration $fixed = new ilRadioOption($this->lng->txt('sess_fixed_duration'), ilSession::SESSION_HANDLING_FIXED); // create session reminder subform $cb = new ilCheckboxInputGUI($this->lng->txt("session_reminder"), "session_reminder_enabled"); $expires = ilSession::getSessionExpireValue(); $time = ilFormat::_secondsToString($expires, true); $cb->setInfo($this->lng->txt("session_reminder_info") . "<br />" . sprintf($this->lng->txt('session_reminder_session_duration'), $time)); if ((int) $ilSetting->get("session_reminder_enabled")) { $cb->setChecked(true); } $fixed->addSubItem($cb); // add session handling to radio group $ssettings->addOption($fixed); // second option, session control $ldsh = new ilRadioOption($this->lng->txt('sess_load_dependent_session_handling'), ilSession::SESSION_HANDLING_LOAD_DEPENDENT); // add session control subform require_once 'Services/Authentication/classes/class.ilSessionControl.php'; // this is the max count of active sessions // that are getting started simlutanously $sub_ti = new ilTextInputGUI($this->lng->txt('session_max_count'), 'session_max_count'); $sub_ti->setMaxLength(5); $sub_ti->setSize(5); $sub_ti->setInfo($this->lng->txt('session_max_count_info')); $sub_ti->setValue($ilSetting->get("session_max_count", ilSessionControl::DEFAULT_MAX_COUNT)); if (!$ilSetting->get('session_allow_client_maintenance', ilSessionControl::DEFAULT_ALLOW_CLIENT_MAINTENANCE)) { $sub_ti->setDisabled(true); } $ldsh->addSubItem($sub_ti); // after this (min) idle time the session can be deleted, // if there are further requests for new sessions, // but max session count is reached yet $sub_ti = new ilTextInputGUI($this->lng->txt('session_min_idle'), 'session_min_idle'); $sub_ti->setMaxLength(5); $sub_ti->setSize(5); $sub_ti->setInfo($this->lng->txt('session_min_idle_info')); $sub_ti->setValue($ilSetting->get("session_min_idle", ilSessionControl::DEFAULT_MIN_IDLE)); if (!$ilSetting->get('session_allow_client_maintenance', ilSessionControl::DEFAULT_ALLOW_CLIENT_MAINTENANCE)) { $sub_ti->setDisabled(true); } $ldsh->addSubItem($sub_ti); // after this (max) idle timeout the session expires // and become invalid, so it is not considered anymore // when calculating current count of active sessions $sub_ti = new ilTextInputGUI($this->lng->txt('session_max_idle'), 'session_max_idle'); $sub_ti->setMaxLength(5); $sub_ti->setSize(5); $sub_ti->setInfo($this->lng->txt('session_max_idle_info')); $sub_ti->setValue($ilSetting->get("session_max_idle", ilSessionControl::DEFAULT_MAX_IDLE)); if (!$ilSetting->get('session_allow_client_maintenance', ilSessionControl::DEFAULT_ALLOW_CLIENT_MAINTENANCE)) { $sub_ti->setDisabled(true); } $ldsh->addSubItem($sub_ti); // this is the max duration that can elapse between the first and the secnd // request to the system before the session is immidietly deleted $sub_ti = new ilTextInputGUI($this->lng->txt('session_max_idle_after_first_request'), 'session_max_idle_after_first_request'); $sub_ti->setMaxLength(5); $sub_ti->setSize(5); $sub_ti->setInfo($this->lng->txt('session_max_idle_after_first_request_info')); $sub_ti->setValue($ilSetting->get("session_max_idle_after_first_request", ilSessionControl::DEFAULT_MAX_IDLE_AFTER_FIRST_REQUEST)); if (!$ilSetting->get('session_allow_client_maintenance', ilSessionControl::DEFAULT_ALLOW_CLIENT_MAINTENANCE)) { $sub_ti->setDisabled(true); } $ldsh->addSubItem($sub_ti); // add session control to radio group $ssettings->addOption($ldsh); // add radio group to form if ($ilSetting->get('session_allow_client_maintenance', ilSessionControl::DEFAULT_ALLOW_CLIENT_MAINTENANCE)) { // just shows the status wether the session //setting maintenance is allowed by setup $this->form->addItem($ssettings); } else { // just shows the status wether the session //setting maintenance is allowed by setup $ti = new ilNonEditableValueGUI($this->lng->txt('session_config'), "session_config"); $ti->setValue($this->lng->txt('session_config_maintenance_disabled')); $ssettings->setDisabled(true); $ti->addSubItem($ssettings); $this->form->addItem($ti); } // END SESSION SETTINGS // password assistance $cb = new ilCheckboxInputGUI($this->lng->txt("enable_password_assistance"), "password_assistance"); if ($ilSetting->get("password_assistance")) { $cb->setChecked(true); } $cb->setInfo($this->lng->txt("password_assistance_info")); $this->form->addItem($cb); // password generation $cb = new ilCheckboxInputGUI($this->lng->txt("passwd_generation"), "passwd_auto_generate"); if ($ilSetting->get("passwd_auto_generate")) { $cb->setChecked(true); } $cb->setInfo($this->lng->txt("passwd_generation_info")); $this->form->addItem($cb); // dynamic web links $cb = new ilCheckboxInputGUI($this->lng->txt("links_dynamic"), "links_dynamic"); $cb->setInfo($this->lng->txt("links_dynamic_info")); if ($ilSetting->get("links_dynamic")) { $cb->setChecked(true); } $this->form->addItem($cb); // Learners View $pl = new ilCheckboxInputGUI($this->lng->txt('preview_learner'), 'preview_learner'); $pl->setValue(1); $pl->setInfo($this->lng->txt('preview_learner_info')); $pl->setChecked($ilSetting->get('preview_learner')); $this->form->addItem($pl); // notes/comments/tagging $pl = new ilCheckboxInputGUI($this->lng->txt('adm_show_comments_tagging_in_lists'), 'comments_tagging_in_lists'); $pl->setValue(1); $pl->setChecked($ilSetting->get('comments_tagging_in_lists')); $this->form->addItem($pl); // starting point include_once "Services/User/classes/class.ilUserUtil.php"; $si = new ilRadioGroupInputGUI($this->lng->txt("adm_user_starting_point"), "usr_start"); $si->setRequired(true); $si->setInfo($this->lng->txt("adm_user_starting_point_info")); foreach (ilUserUtil::getPossibleStartingPoints() as $value => $caption) { $si->addOption(new ilRadioOption($caption, $value)); } $si->setValue(ilUserUtil::getStartingPoint()); $this->form->addItem($si); // starting point: repository object $repobj = new ilRadioOption($lng->txt("adm_user_starting_point_object"), ilUserUtil::START_REPOSITORY_OBJ); $repobj_id = new ilTextInputGUI($lng->txt("adm_user_starting_point_ref_id"), "usr_start_ref_id"); $repobj_id->setRequired(true); $repobj_id->setSize(5); if ($si->getValue() == ilUserUtil::START_REPOSITORY_OBJ) { $start_ref_id = ilUserUtil::getStartingObject(); $repobj_id->setValue($start_ref_id); if ($start_ref_id) { $start_obj_id = ilObject::_lookupObjId($start_ref_id); if ($start_obj_id) { $repobj_id->setInfo($lng->txt("obj_" . ilObject::_lookupType($start_obj_id)) . ": " . ilObject::_lookupTitle($start_obj_id)); } } } $repobj->addSubItem($repobj_id); $si->addOption($repobj); // starting point: personal $startp = new ilCheckboxInputGUI($lng->txt("adm_user_starting_point_personal"), "usr_start_pers"); $startp->setInfo($lng->txt("adm_user_starting_point_personal_info")); $startp->setChecked(ilUserUtil::hasPersonalStartingPoint()); $si->addSubItem($startp); // save and cancel commands $this->form->addCommandButton("saveBasicSettings", $lng->txt("save")); $this->form->setTitle($lng->txt("basic_settings")); $this->form->setFormAction($this->ctrl->getFormAction($this)); }
function save() { global $ilAccess, $ilErr; if (!$ilAccess->checkAccess('write', '', $this->ref_id)) { $ilErr->raiseError($this->lng->txt("msg_no_perm_write"), $ilErr->MESSAGE); } $this->registration_settings->setRegistrationType((int) $_POST['reg_type']); $this->registration_settings->setPasswordGenerationStatus((int) $_POST['reg_pwd']); $this->registration_settings->setApproveRecipientLogins(ilUtil::stripSlashes($_POST['reg_approver'])); $this->registration_settings->setRoleType((int) $_POST['reg_role_type']); $this->registration_settings->setAccessLimitation((int) $_POST['reg_access_limitation']); $this->registration_settings->setAllowedDomains($_POST['reg_allowed_domains']); $allow_codes = false; if (in_array((int) $_POST['reg_type'], array(IL_REG_DIRECT, IL_REG_APPROVE, IL_REG_ACTIVATION))) { $allow_codes = (bool) $_POST['reg_codes_' . (int) $_POST['reg_type']]; } $this->registration_settings->setAllowCodes($allow_codes); if (!preg_match('/^([0]|([1-9][0-9]*))([\\.,][0-9][0-9]*)?$/', (int) $_POST['reg_hash_life_time'])) { $this->registration_settings->setRegistrationHashLifetime(ilRegistrationSettings::REG_HASH_LIFETIME_MIN_VALUE); } else { $this->registration_settings->setRegistrationHashLifetime(max((int) $_POST['reg_hash_life_time'], ilRegistrationSettings::REG_HASH_LIFETIME_MIN_VALUE)); } if ($error_code = $this->registration_settings->validate()) { switch ($error_code) { case ilRegistrationSettings::ERR_UNKNOWN_RCP: ilUtil::sendFailure($this->lng->txt('reg_unknown_recipients') . ' ' . $this->registration_settings->getUnknown()); $this->view(); return false; case ilRegistrationSettings::ERR_MISSING_RCP: ilUtil::sendFailure($this->lng->txt('reg_approve_needs_recipient') . ' ' . $this->registration_settings->getUnknown()); $this->view(); return false; } } require_once 'Services/Captcha/classes/class.ilCaptchaUtil.php'; ilCaptchaUtil::setActiveForRegistration((bool) $_POST['activate_captcha_anonym']); $this->registration_settings->save(); ilUtil::sendSuccess($this->lng->txt('saved_successfully')); $this->view(); return true; }
/** * edit ("view" before) */ function edit() { global $tree, $lng, $ilCtrl, $ilSetting, $ilUser; if (!$this->getEnableEditing()) { ilUtil::sendFailure($lng->txt("permission_denied"), true); $ilCtrl->redirect($this, "preview"); } include_once "./Services/Captcha/classes/class.ilCaptchaUtil.php"; if ($ilUser->getId() == ANONYMOUS_USER_ID && ilCaptchaUtil::isActive() && !$ilUser->isCaptchaVerified()) { $form = $this->initCaptchaForm(); if ($_POST["captcha_code"] && $form->checkInput()) { $ilUser->setCaptchaVerified(true); } else { return $form->getHTML(); } } $this->setOutputMode(IL_PAGE_EDIT); $html = $this->showPage(); if ($this->isEnabledNotes()) { $html .= "<br /><br />" . $this->getNotesHTML(); } return $html; }