/** * Save * * @access public * */ public function save() { $form = $this->initFormSettings(); if ($form->checkInput()) { $this->getSettings()->setActive($form->getInput('active')); $this->getSettings()->setServer($form->getInput('server')); $this->getSettings()->setPort($form->getInput('port')); $this->getSettings()->setUri($form->getInput('uri')); $this->getSettings()->setDefaultRole($form->getInput('role')); $this->getSettings()->enableLocalAuthentication($form->getInput('local')); $this->getSettings()->setLoginInstruction($form->getInput('instruction')); $this->getSettings()->enableUserCreation($form->getInput('sync') == ilCASSettings::SYNC_CAS ? true : false); $this->getSettings()->save(); include_once './Services/LDAP/classes/class.ilLDAPServer.php'; switch ((int) $form->getInput('sync')) { case ilCASSettings::SYNC_DISABLED: ilLDAPServer::toggleDataSource(AUTH_CAS, false); break; case ilCASSettings::SYNC_CAS: ilLDAPServer::toggleDataSource(AUTH_CAS, false); break; case ilCASSettings::SYNC_LDAP: // TODO: handle multiple ldap configurations ilLDAPServer::toggleDataSource(AUTH_CAS, true); break; } ilUtil::sendSuccess($this->lng->txt('settings_saved'), true); $this->ctrl->redirect($this, 'settings'); } $form->setValuesByPost(); ilUtil::sendFailure($this->lng->txt('err_ceck_input')); $this->tpl->setContent($form->getHTML()); }
/** * Save * * @access public * */ public function save() { $this->settings->setActive((int) $_POST['active']); $this->settings->setName(ilUtil::stripSlashes($_POST['name'])); $this->settings->setPort(ilUtil::stripSlashes($_POST['port'])); $this->settings->setSecret(ilUtil::stripSlashes($_POST['secret'])); $this->settings->setServerString(ilUtil::stripSlashes($_POST['servers'])); $this->settings->setDefaultRole((int) $_POST['role']); $this->settings->enableAccountMigration((int) $_POST['migration']); $this->settings->setCharset((int) $_POST['charset']); $this->settings->enableCreation((int) $_POST['sync'] == ilRadiusSettings::SYNC_RADIUS ? true : false); if (!$this->settings->validateRequired()) { ilUtil::sendFailure($this->lng->txt("fill_out_all_required_fields")); $this->settings(); return false; } if (!$this->settings->validatePort()) { ilUtil::sendFailure($this->lng->txt("err_invalid_port")); $this->settings(); return false; } if (!$this->settings->validateServers()) { ilUtil::sendFailure($this->lng->txt("err_invalid_server")); $this->settings(); return false; } include_once './Services/LDAP/classes/class.ilLDAPServer.php'; switch ((int) $_POST['sync']) { case ilRadiusSettings::SYNC_DISABLED: ilLDAPServer::toggleDataSource(AUTH_RADIUS, false); break; case ilRadiusSettings::SYNC_RADIUS: ilLDAPServer::toggleDataSource(AUTH_RADIUS, false); break; case ilRadiusSettings::SYNC_LDAP: // TODO: handle multiple ldap configurations ilLDAPServer::toggleDataSource(AUTH_RADIUS, true); break; } $this->settings->save(); ilUtil::sendSuccess($this->lng->txt('settings_saved')); $this->settings(); return true; }