コード例 #1
0
 /**
  * @param string $rcp
  * @throws ilMailException
  */
 protected function handleCurrentRecipient($rcp)
 {
     require_once 'Services/Mail/exceptions/class.ilMailException.php';
     if (is_numeric($rcp)) {
         /**
          * @var $rcp ilObjUser
          */
         $rcp = ilObjectFactory::getInstanceByObjId($rcp, false);
         if (!$rcp) {
             throw new ilMailException('no_recipient_found');
         }
         $this->setCurrentRecipient($rcp->getEmail());
         $this->initLanguage($rcp->getId());
     } else {
         if (is_string($rcp) && ilUtil::is_email($rcp)) {
             $this->setCurrentRecipient($rcp);
             $this->initLanguageByIso2Code();
         } else {
             if ($rcp instanceof ilObjUser) {
                 /**
                  * @var $rcp ilObjUser
                  */
                 $this->setCurrentRecipient($rcp->getEmail());
                 $this->initLanguage($rcp->getId());
             } else {
                 throw new ilMailException('no_recipient_found');
             }
         }
     }
 }
コード例 #2
0
 /**
  * Check input, strip slashes etc. set alert, if input is not ok.
  *
  * @return	boolean		Input ok, true/false
  */
 function checkInput()
 {
     global $lng;
     $_POST[$this->getPostVar()] = ilUtil::stripSlashes($_POST[$this->getPostVar()]);
     if ($this->getRequired() && trim($_POST[$this->getPostVar()]) == "") {
         $this->setAlert($lng->txt("msg_input_is_required"));
         return false;
     }
     if (!ilUtil::is_email($_POST[$this->getPostVar()]) && trim($_POST[$this->getPostVar()]) != "") {
         $this->setAlert($lng->txt("email_not_valid"));
         return false;
     }
     return true;
 }
コード例 #3
0
 public function validate()
 {
     global $ilErr, $lng;
     if (!count($this->getRecipients())) {
         return true;
     }
     foreach ((array) $this->getRecipients() as $rcp_data) {
         if ($rcp_data['type'] == self::TYPE_USER) {
             continue;
         } else {
             if (!ilUtil::is_email($rcp_data['email'])) {
                 $ilErr->appendMessage($lng->txt('cal_err_invalid_notification_rcps'));
                 return false;
             }
         }
     }
     return true;
 }
コード例 #4
0
 function validateInfoSettings()
 {
     global $ilErr;
     $error = false;
     if ($this->getContactEmail()) {
         $emails = split(",", $this->getContactEmail());
         foreach ($emails as $email) {
             $email = trim($email);
             if (!(ilUtil::is_email($email) or ilObjUser::getUserIdByLogin($email))) {
                 $ilErr->appendMessage($this->lng->txt('contact_email_not_valid') . " '" . $email . "'");
                 $error = true;
             }
         }
     }
     return !$error;
 }
コード例 #5
0
 /**
  * get email of sender
  * @access	public
  * @return	string email
  */
 function getEmailOfSender()
 {
     $umail = self::getCachedUserInstance($this->user_id);
     $sender = $umail->getEmail();
     if (ilUtil::is_email($sender)) {
         return $sender;
     } else {
         return '';
     }
 }
コード例 #6
0
 function mailUserResultsObject()
 {
     global $ilUser;
     $anonymous_code = $_SESSION["anonymous_id"][$this->object->getId()];
     $active_id = $this->object->getActiveID($ilUser->getId(), $anonymous_code, 0);
     if ($this->object->isSurveyStarted($ilUser->getId(), $anonymous_code) !== 1 || !$active_id) {
         $this->ctrl->redirect($this, "infoScreen");
     }
     $recipient = $_POST["mail"];
     if (!ilUtil::is_email($recipient)) {
         $this->ctrl->redirect($this, "infoScreen");
     }
     $this->sendUserResultsMail($active_id, $recipient);
     ilUtil::sendSuccess($this->lng->txt("mail_sent"), true);
     $this->ctrl->redirect($this, "infoScreen");
 }
コード例 #7
0
 public function updateCode($a_id, $a_email, $a_last_name, $a_first_name, $a_sent)
 {
     global $ilDB;
     $a_email = trim($a_email);
     // :TODO:
     if ($a_email && !ilUtil::is_email($a_email)) {
         return;
     }
     $data = array("email" => $a_email, "lastname" => trim($a_last_name), "firstname" => trim($a_first_name));
     $fields = array("externaldata" => array("text", serialize($data)), "sent" => array("integer", $a_sent));
     $ilDB->update("svy_anonymous", $fields, array("anonymous_id" => array("integer", $a_id)));
 }
コード例 #8
0
ファイル: class.ilSetup.php プロジェクト: bheyser/qplskl
 /**
  * check client contact data status
  * @param	object	client
  * @return	boolean
  */
 function checkClientContact(&$client)
 {
     $arr["status"] = true;
     //$arr["comment"] = $this->lng->txt("filled_out");
     $settings = $client->getAllSettings();
     $client_name = $client->getName();
     // check required fields
     if (empty($settings["admin_firstname"]) or empty($settings["admin_lastname"]) or empty($settings["admin_email"]) or empty($client_name)) {
         $arr["status"] = false;
         $arr["comment"] = $this->lng->txt("missing_data");
     }
     // admin email
     if (!ilUtil::is_email($settings["admin_email"]) and $arr["status"] != false) {
         $arr["status"] = false;
         $arr["comment"] = $this->lng->txt("email_not_valid");
     }
     return $arr;
 }
コード例 #9
0
 /**
  * save user profile data
  */
 function saveProfile()
 {
     global $ilUser, $ilSetting, $ilAuth;
     //init checking var
     $form_valid = true;
     // testing by ratana ty:
     // if people check on check box it will
     // write some datata to table usr_pref
     // if check on Public Profile
     if ($_POST["chk_pub"] == "on") {
         $ilUser->setPref("public_profile", "y");
     } else {
         $ilUser->setPref("public_profile", "n");
     }
     // if check on Institute
     $val_array = array("institution", "department", "upload", "street", "zip", "city", "country", "phone_office", "phone_home", "phone_mobile", "fax", "email", "hobby", "matriculation");
     // set public profile preferences
     foreach ($val_array as $key => $value) {
         if ($_POST["chk_" . $value] == "on") {
             $ilUser->setPref("public_" . $value, "y");
         } else {
             $ilUser->setPref("public_" . $value, "n");
         }
     }
     $d_set = new ilSetting("delicious");
     if ($d_set->get("user_profile")) {
         if ($_POST["chk_delicious"] == "on") {
             $ilUser->setPref("public_delicious", "y");
         } else {
             $ilUser->setPref("public_delicious", "n");
         }
     }
     // check dynamically required fields
     foreach ($this->settings as $key => $val) {
         if (substr($key, 0, 8) == "require_") {
             $require_keys[] = substr($key, 8);
         }
     }
     foreach ($require_keys as $key => $val) {
         // exclude required system and registration-only fields
         $system_fields = array("login", "default_role", "passwd", "passwd2");
         if (!in_array($val, $system_fields)) {
             if ($this->workWithUserSetting($val)) {
                 if (isset($this->settings["require_" . $val]) && $this->settings["require_" . $val]) {
                     if (empty($_POST["usr_" . $val])) {
                         ilUtil::sendFailure($this->lng->txt("fill_out_all_required_fields") . ": " . $this->lng->txt($val));
                         $form_valid = false;
                     }
                 }
             }
         }
     }
     // Check user defined required fields
     if ($form_valid and !$this->__checkUserDefinedRequiredFields()) {
         ilUtil::sendFailure($this->lng->txt("fill_out_all_required_fields"));
         $form_valid = false;
     }
     // check email
     if ($this->workWithUserSetting("email")) {
         if (!ilUtil::is_email($_POST["usr_email"]) and !empty($_POST["usr_email"]) and $form_valid) {
             ilUtil::sendFailure($this->lng->txt("email_not_valid"));
             $form_valid = false;
         }
     }
     //update user data (not saving!)
     if ($this->workWithUserSetting("firstname")) {
         $ilUser->setFirstName(ilUtil::stripSlashes($_POST["usr_firstname"]));
     }
     if ($this->workWithUserSetting("lastname")) {
         $ilUser->setLastName(ilUtil::stripSlashes($_POST["usr_lastname"]));
     }
     if ($this->workWithUserSetting("gender")) {
         $ilUser->setGender($_POST["usr_gender"]);
     }
     if ($this->workWithUserSetting("title")) {
         $ilUser->setUTitle(ilUtil::stripSlashes($_POST["usr_title"]));
     }
     $ilUser->setFullname();
     if ($this->workWithUserSetting("institution")) {
         $ilUser->setInstitution(ilUtil::stripSlashes($_POST["usr_institution"]));
     }
     if ($this->workWithUserSetting("department")) {
         $ilUser->setDepartment(ilUtil::stripSlashes($_POST["usr_department"]));
     }
     if ($this->workWithUserSetting("street")) {
         $ilUser->setStreet(ilUtil::stripSlashes($_POST["usr_street"]));
     }
     if ($this->workWithUserSetting("zipcode")) {
         $ilUser->setZipcode(ilUtil::stripSlashes($_POST["usr_zipcode"]));
     }
     if ($this->workWithUserSetting("city")) {
         $ilUser->setCity(ilUtil::stripSlashes($_POST["usr_city"]));
     }
     if ($this->workWithUserSetting("country")) {
         $ilUser->setCountry(ilUtil::stripSlashes($_POST["usr_country"]));
     }
     if ($this->workWithUserSetting("phone_office")) {
         $ilUser->setPhoneOffice(ilUtil::stripSlashes($_POST["usr_phone_office"]));
     }
     if ($this->workWithUserSetting("phone_home")) {
         $ilUser->setPhoneHome(ilUtil::stripSlashes($_POST["usr_phone_home"]));
     }
     if ($this->workWithUserSetting("phone_mobile")) {
         $ilUser->setPhoneMobile(ilUtil::stripSlashes($_POST["usr_phone_mobile"]));
     }
     if ($this->workWithUserSetting("fax")) {
         $ilUser->setFax(ilUtil::stripSlashes($_POST["usr_fax"]));
     }
     if ($this->workWithUserSetting("email")) {
         $ilUser->setEmail(ilUtil::stripSlashes($_POST["usr_email"]));
     }
     if ($this->workWithUserSetting("hobby")) {
         $ilUser->setHobby(ilUtil::stripSlashes($_POST["usr_hobby"]));
     }
     if ($this->workWithUserSetting("referral_comment")) {
         $ilUser->setComment(ilUtil::stripSlashes($_POST["usr_referral_comment"]));
     }
     if ($this->workWithUserSetting("matriculation")) {
         $ilUser->setMatriculation(ilUtil::stripSlashes($_POST["usr_matriculation"]));
     }
     // delicious
     $d_set = new ilSetting("delicious");
     if ($d_set->get("user_profile")) {
         $ilUser->setDelicious(ilUtil::stripSlashes($_POST["usr_delicious"]));
     }
     // set instant messengers
     if ($this->workWithUserSetting("instant_messengers")) {
         $ilUser->setInstantMessengerId('icq', ilUtil::stripSlashes($_POST["usr_im_icq"]));
         $ilUser->setInstantMessengerId('yahoo', ilUtil::stripSlashes($_POST["usr_im_yahoo"]));
         $ilUser->setInstantMessengerId('msn', ilUtil::stripSlashes($_POST["usr_im_msn"]));
         $ilUser->setInstantMessengerId('aim', ilUtil::stripSlashes($_POST["usr_im_aim"]));
         $ilUser->setInstantMessengerId('skype', ilUtil::stripSlashes($_POST["usr_im_skype"]));
         $ilUser->setInstantMessengerId('jabber', ilUtil::stripSlashes($_POST["usr_im_jabber"]));
         $ilUser->setInstantMessengerId('voip', ilUtil::stripSlashes($_POST["usr_im_voip"]));
     }
     // Set user defined data
     $ilUser->setUserDefinedData($_POST['udf']);
     // everthing's ok. save form data
     if ($form_valid) {
         // init reload var. page should only be reloaded if skin or style were changed
         $reload = false;
         if ($this->workWithUserSetting("skin_style")) {
             //set user skin and style
             if ($_POST["usr_skin_style"] != "") {
                 $sknst = explode(":", $_POST["usr_skin_style"]);
                 if ($ilUser->getPref("style") != $sknst[1] || $ilUser->getPref("skin") != $sknst[0]) {
                     $ilUser->setPref("skin", $sknst[0]);
                     $ilUser->setPref("style", $sknst[1]);
                     $reload = true;
                 }
             }
         }
         if ($this->workWithUserSetting("language")) {
             // reload page if language was changed
             //if ($_POST["usr_language"] != "" and $_POST["usr_language"] != $_SESSION['lang'])
             // (this didn't work as expected, alex)
             if ($_POST["usr_language"] != $ilUser->getLanguage()) {
                 $reload = true;
             }
             // set user language
             $ilUser->setLanguage($_POST["usr_language"]);
         }
         if ($this->workWithUserSetting("hits_per_page")) {
             // set user hits per page
             if ($_POST["hits_per_page"] != "") {
                 $ilUser->setPref("hits_per_page", $_POST["hits_per_page"]);
             }
         }
         // set show users online
         if ($this->workWithUserSetting("show_users_online")) {
             $ilUser->setPref("show_users_online", $_POST["show_users_online"]);
         }
         // set hide own online_status
         if ($this->workWithUserSetting("hide_own_online_status")) {
             if ($_POST["chk_hide_own_online_status"] != "") {
                 $ilUser->setPref("hide_own_online_status", "y");
             } else {
                 $ilUser->setPref("hide_own_online_status", "n");
             }
         }
         // personal desktop items in news block
         /* Subscription Concept is abandonded for now, we show all news of pd items (Alex)
         			if ($_POST["pd_items_news"] != "")
         			{
         				$ilUser->setPref("pd_items_news","y");
         			}
         			else
         			{
         				$ilUser->setPref("pd_items_news","n");
         			}
         */
         // profile ok
         $ilUser->setProfileIncomplete(false);
         // save user data & object_data
         $ilUser->setTitle($ilUser->getFullname());
         $ilUser->setDescription($ilUser->getEmail());
         $ilUser->update();
         // update lucene index
         include_once './Services/Search/classes/Lucene/class.ilLuceneIndexer.php';
         ilLuceneIndexer::updateLuceneIndex(array($GLOBALS['ilUser']->getId()));
         // reload page only if skin or style were changed
         // feedback
         if (!empty($this->password_error)) {
             ilUtil::sendFailure($this->password_error, true);
         } elseif (!empty($this->upload_error)) {
             ilUtil::sendFailure($this->upload_error, true);
         } else {
             if ($reload) {
                 // feedback
                 ilUtil::sendSuccess($this->lng->txt("saved_successfully"), true);
                 $this->ctrl->redirect($this, "");
                 //$this->tpl->setVariable("RELOAD","<script language=\"Javascript\">\ntop.location.href = \"./start.php\";\n</script>\n");
             } else {
                 ilUtil::sendSuccess($this->lng->txt("saved_successfully"), true);
             }
         }
     }
     $this->showProfile();
 }
コード例 #10
0
 /**
  * Check user's input
  */
 function checkInput($addr_id = 0)
 {
     // check if user login and e-mail-address are empty
     if (!strcmp(trim($_POST["login"]), "") && !strcmp(trim($_POST["email"]), "")) {
         ilUtil::sendInfo($this->lng->txt("mail_enter_login_or_email_addr"));
         $error = true;
     } else {
         if ($_POST["login"] != "" && !ilObjUser::_lookupId(ilUtil::stripSlashes($_POST["login"]))) {
             ilUtil::sendInfo($this->lng->txt("mail_enter_valid_login"));
             $error = true;
         } else {
             if ($_POST["email"] && !ilUtil::is_email($_POST["email"])) {
                 ilUtil::sendInfo($this->lng->txt("mail_enter_valid_email_addr"));
                 $error = true;
             }
         }
     }
     if (($this->existingEntry = $this->abook->checkEntryByLogin(ilUtil::stripSlashes($_POST["login"]))) > 0 && ($this->existingEntry != $addr_id && $addr_id > 0 || !$addr_id)) {
         ilUtil::sendInfo($this->lng->txt("mail_entry_exists"));
         $error = true;
     }
     return $error ? false : true;
 }
コード例 #11
0
 function mailUserResults()
 {
     if (!$this->object->hasMailOwnResults()) {
         $this->backToRepository();
     }
     $this->checkAuth(false, true);
     $recipient = $_POST["mail"];
     if (!ilUtil::is_email($recipient)) {
         $this->ctrl->redirect($this, "runShowFinishedPage");
     }
     $survey_gui = new ilObjSurveyGUI();
     $survey_gui->sendUserResultsMail($_SESSION["finished_id"][$this->object->getId()], $recipient);
     ilUtil::sendSuccess($this->lng->txt("mail_sent"), true);
     $this->ctrl->redirect($this, "runShowFinishedPage");
 }
コード例 #12
0
 function __validateUserData(&$user_data, $check_complete = true)
 {
     global $lng, $styleDefinition, $ilLog;
     $this->__setMessage('');
     include_once './Services/Authentication/classes/class.ilAuthUtils.php';
     $allow_empty_password = ilAuthUtils::_needsExternalAccountByAuthMode(ilAuthUtils::_getAuthMode($user_data['auth_mode']));
     if ($check_complete) {
         if (!isset($user_data['login'])) {
             $this->__appendMessage('No login given.');
         }
         if (!isset($user_data['passwd']) and !$allow_empty_password) {
             $this->__appendMessage('No password given.');
         }
         if (!isset($user_data['email'])) {
             $this->__appendMessage('No email given');
         }
         if (!isset($user_data['user_language'])) {
             $user_data['user_language'] = $lng->getDefaultLanguage();
         }
     }
     foreach ($user_data as $field => $value) {
         switch ($field) {
             case 'login':
                 if (!ilUtil::isLogin($value)) {
                     $this->__appendMessage('Login invalid.');
                 }
                 // check loginname
                 if ($check_complete) {
                     if (ilObjUser::_loginExists($value)) {
                         $this->__appendMessage('Login already exists.');
                     }
                 }
                 break;
             case 'passwd':
                 if (!strlen($value) and $allow_empty_password) {
                     break;
                 }
                 if (!ilUtil::isPassword($value)) {
                     $this->__appendMessage('Password invalid.');
                 }
                 break;
             case 'email':
                 if (!ilUtil::is_email($value)) {
                     $this->__appendMessage('Email invalid.');
                 }
                 break;
             case 'time_limit_unlimited':
                 if ($value != 1) {
                     if ($user_data['time_limit_from'] >= $user_data['time_limit_until']) {
                         $this->__appendMessage('Time limit invalid');
                     }
                 }
                 break;
             case 'user_language':
                 $lang_inst = $lng->getInstalledLanguages();
                 if (!in_array($user_data['user_language'], $lang_inst)) {
                     $this->__appendMessage('Language: ' . $user_data['user_language'] . ' is not installed');
                 }
                 break;
             case 'user_skin':
             case 'user_style':
                 if ($user_data['user_skin'] and !$user_data['user_style'] or !$user_data['user_skin'] and $user_data['user_style']) {
                     $this->__appendMessage('user_skin, user_style not valid.');
                 } elseif ($user_data['user_skin'] and $user_data['user_style']) {
                     $ok = false;
                     $templates = $styleDefinition->getAllTemplates();
                     if (count($templates) > 0 && is_array($templates)) {
                         foreach ($templates as $template) {
                             $styleDef =& new ilStyleDefinition($template["id"]);
                             $styleDef->startParsing();
                             $styles = $styleDef->getStyles();
                             foreach ($styles as $style) {
                                 if ($user_data['user_skin'] == $template["id"] && $user_data['user_style'] == $style["id"]) {
                                     $ok = true;
                                 }
                             }
                         }
                         if (!$ok) {
                             $this->__appendMessage('user_skin, user_style not valid.');
                         }
                     }
                 }
                 break;
             case 'time_limit_owner':
                 $type = ilObject::_lookupType($user_data['time_limit_owner'], true);
                 if ($type != 'cat' and $type != 'usrf') {
                     $this->__appendMessage('time_limit_owner must be ref_id of category or user folder' . $type);
                 }
                 break;
             default:
                 continue;
         }
     }
     return strlen($this->__getMessage()) ? false : true;
 }
コード例 #13
0
 function saveSettingsObject()
 {
     global $rbacsystem, $ilCtrl;
     $settings = $this->ilias->getAllSettings();
     if (!$rbacsystem->checkAccess("write", $this->object->getRefId())) {
         $this->ilias->raiseError($this->lng->txt("permission_denied"), $this->ilias->error_obj->MESSAGE);
     }
     //init checking var
     $form_valid = true;
     // moved to privacy/security
     /*if($_POST['https'])
     		{
     			include_once './Services/Http/classes/class.ilHTTPS.php';
     
     			if(!ilHTTPS::_checkHTTPS())
     			{
     				ilUtil::sendInfo($this->lng->txt('https_not_possible'));
     				$form_valid = false;
     			}
     			if(!ilHTTPS::_checkHTTP())
     			{
     				ilUtil::sendInfo($this->lng->txt('http_not_possible'));
     				$form_valid = false;
     			}
     		}*/
     // check required user information
     if (empty($_POST["admin_firstname"]) or empty($_POST["admin_lastname"]) or empty($_POST["admin_street"]) or empty($_POST["admin_zipcode"]) or empty($_POST["admin_country"]) or empty($_POST["admin_city"]) or empty($_POST["admin_phone"]) or empty($_POST["admin_email"])) {
         // feedback
         ilUtil::sendFailure($this->lng->txt("fill_out_all_required_fields"));
         $form_valid = false;
     }
     // check email adresses
     // feedback_recipient
     if (!ilUtil::is_email($_POST["feedback_recipient"]) and !empty($_POST["feedback_recipient"]) and $form_valid) {
         ilUtil::sendFailure($this->lng->txt("input_error") . ": '" . $this->lng->txt("feedback_recipient") . "'<br/>" . $this->lng->txt("email_not_valid"));
         $form_valid = false;
     }
     // error_recipient
     if (!ilUtil::is_email($_POST["error_recipient"]) and !empty($_POST["error_recipient"]) and $form_valid) {
         ilUtil::sendFailure($this->lng->txt("input_error") . ": '" . $this->lng->txt("error_recipient") . "'<br/>" . $this->lng->txt("email_not_valid"));
         $form_valid = false;
     }
     // admin email
     if (!ilUtil::is_email($_POST["admin_email"]) and $form_valid) {
         ilUtil::sendFailure($this->lng->txt("input_error") . ": '" . $this->lng->txt("email") . "'<br/>" . $this->lng->txt("email_not_valid"));
         $form_valid = false;
     }
     // prepare output
     foreach ($_POST as $key => $val) {
         if ($key != "cmd") {
             $_POST[$key] = ilUtil::prepareFormOutput($val, true);
         }
     }
     if (!$form_valid) {
         ////////////////////////////////////////////////////////////
         // load user modified settings again
         // basic data
         $settings["feedback_recipient"] = $_POST["feedback_recipient"];
         $settings["error_recipient"] = $_POST["error_recipient"];
         // modules
         $settings["pub_section"] = $_POST["pub_section"];
         $settings["open_google"] = $_POST["open_google"];
         $settings["default_repository_view"] = $_POST["default_rep_view"];
         $settings["password_assistance"] = $_POST["password_assistance"];
         $settings['short_inst_title'] = $_POST['short_inst_title'];
         $settings["passwd_auto_generate"] = $_POST["password_auto_generate"];
         //$settings["js_edit"] = $_POST["js_edit"];
         $settings["enable_trash"] = $_POST["enable_trash"];
         //$settings["https"] = $_POST["https"];
         //session_reminder
         $settings['session_reminder_enabled'] = (int) $_POST['session_reminder_enabled'];
         // session control
         // contact
         $settings["admin_firstname"] = $_POST["admin_firstname"];
         $settings["admin_lastname"] = $_POST["admin_lastname"];
         $settings["admin_title"] = $_POST["admin_title"];
         $settings["admin_position"] = $_POST["admin_position"];
         $settings["admin_institution"] = $_POST["admin_institution"];
         $settings["admin_street"] = $_POST["admin_street"];
         $settings["admin_zipcode"] = $_POST["admin_zipcode"];
         $settings["admin_city"] = $_POST["admin_city"];
         $settings["admin_country"] = $_POST["admin_country"];
         $settings["admin_phone"] = $_POST["admin_phone"];
         $settings["admin_email"] = $_POST["admin_email"];
         // cron
         $settings["cron_user_check"] = $_POST["cron_user_check"];
         $settings["cron_link_check"] = $_POST["cron_link_check"];
         $settings["cron_web_resource_check"] = $_POST["cron_web_resource_check"];
         $settings["cron_lucene_index"] = $_POST["cron_lucene_index"];
         $settings["forum_notification"] = $_POST["forum_notification"];
         $settings["mail_notification"] = $_POST["mail_notification"];
         $settings["mail_notification_message"] = $_POST["mail_notification_message"];
         // forums
         $settings['frm_store_new'] = $_POST['frm_store_new'];
         // soap
         $settings["soap_user_administration"] = $_POST["soap_user_administration"];
         // data privacy
         /*	$settings["enable_fora_statistics"] = $_POST["enable_fora_statistics"]; */
         $settings["suffix_repl_additional"] = $_POST["suffix_repl_additional"];
         // dynamic links
         $settings["links_dynamic"] = $_POST["links_dynamic"];
     } else {
         ////////////////////////////////////////////////////////////
         // write new settings
         // basic data
         $this->ilias->setSetting("feedback_recipient", $_POST["feedback_recipient"]);
         $this->ilias->setSetting("error_recipient", $_POST["error_recipient"]);
         //$this->ilias->ini->setVariable("language","default",$_POST["default_language"]);
         //set default skin and style
         /*
         			if ($_POST["default_skin_style"] != "")
         			{
         				$sknst = explode(":", $_POST["default_skin_style"]);
         
         				if ($this->ilias->ini->readVariable("layout","style") != $sknst[1] ||
         					$this->ilias->ini->readVariable("layout","skin") != $sknst[0])
         				{
         					$this->ilias->ini->setVariable("layout","skin", $sknst[0]);
         					$this->ilias->ini->setVariable("layout","style",$sknst[1]);
         				}
         			}*/
         // set default view target
         /*
         			if ($_POST["open_views_inside_frameset"] == "1")
         			{
         				$this->ilias->ini->setVariable("layout","view_target","frame");
         			}
         			else
         			{
         				$this->ilias->ini->setVariable("layout","view_target","window");
         			}*/
         // modules
         $this->ilias->setSetting("pub_section", $_POST["pub_section"]);
         $this->ilias->setSetting('open_google', $_POST['open_google']);
         $this->ilias->setSetting("default_repository_view", $_POST["default_rep_view"]);
         //$this->ilias->setSetting('https',$_POST['https']);
         $this->ilias->setSetting('password_assistance', $_POST['password_assistance']);
         $this->ilias->setSetting('passwd_auto_generate', $_POST['password_auto_generate']);
         $this->ilias->setSetting('short_inst_name', $_POST['short_inst_name']);
         $this->ilias->setSetting('enable_trash', $_POST['enable_trash']);
         //session_reminder
         $this->ilias->setSetting('session_reminder_enabled', (int) $_POST['session_reminder_enabled']);
         // contact
         $this->ilias->setSetting("admin_firstname", $_POST["admin_firstname"]);
         $this->ilias->setSetting("admin_lastname", $_POST["admin_lastname"]);
         $this->ilias->setSetting("admin_title", $_POST["admin_title"]);
         $this->ilias->setSetting("admin_position", $_POST["admin_position"]);
         $this->ilias->setSetting("admin_institution", $_POST["admin_institution"]);
         $this->ilias->setSetting("admin_street", $_POST["admin_street"]);
         $this->ilias->setSetting("admin_zipcode", $_POST["admin_zipcode"]);
         $this->ilias->setSetting("admin_city", $_POST["admin_city"]);
         $this->ilias->setSetting("admin_country", $_POST["admin_country"]);
         $this->ilias->setSetting("admin_phone", $_POST["admin_phone"]);
         $this->ilias->setSetting("admin_email", $_POST["admin_email"]);
         // cron
         $this->ilias->setSetting("cron_user_check", $_POST["cron_user_check"]);
         $this->ilias->setSetting("cron_link_check", $_POST["cron_link_check"]);
         $this->ilias->setSetting("cron_web_resource_check", $_POST["cron_web_resource_check"]);
         $this->ilias->setSetting("cron_lucene_index", $_POST["cron_lucene_index"]);
         $this->ilias->setSetting("forum_notification", $_POST["forum_notification"]);
         if ($_POST["forum_notification"] == 2) {
             $this->ilias->setSetting("cron_forum_notification_last_date", date("Y-m-d H:i:s"));
         }
         $this->ilias->setSetting("mail_notification", $_POST["mail_notification"]);
         $this->ilias->setSetting("mail_notification_message", $_POST["mail_notification_message"]);
         // webservice
         $this->ilias->setSetting("soap_user_administration", $_POST["soap_user_administration"]);
         $this->ilias->setSetting("rpc_server_host", trim($_POST["rpc_server_host"]));
         $this->ilias->setSetting("rpc_server_port", trim($_POST["rpc_server_port"]));
         // data privacy
         //	$this->ilias->setSetting("enable_fora_statistics",$_POST["enable_fora_statistics"]);
         // forums
         $this->ilias->setSetting('frm_store_new', $_POST['frm_store_new']);
         // write ini settings
         $this->ilias->ini->write();
         // links dynamic
         $this->ilias->setSetting('links_dynamic', $_POST['links_dynamic']);
         $this->ilias->setSetting("suffix_repl_additional", ilUtil::stripSlashes($_POST["suffix_repl_additional"]));
         $settings = $this->ilias->getAllSettings();
         // feedback
         $feedback = $this->lng->txt("saved_successfully");
         if (trim($_POST["rpc_server_host"]) != "" || trim($_POST["rpc_server_port"]) != "") {
             include_once 'Services/WebServices/RPC/classes/class.ilRPCServerSettings.php';
             $rpc_settings = ilRPCServerSettings::getInstance();
             if (!$rpc_settings->pingServer()) {
                 $feedback .= "<br />\n" . $this->lng->txt('java_server_no_connection');
             }
         }
         ilUtil::sendInfo($feedback);
     }
     $ilCtrl->redirect($this, "view");
     //$this->displayBasicSettings();
 }
コード例 #14
0
 /**
  * Does input checks and updates a user account if everything is fine.
  * @access	public
  */
 function updateObjectOld()
 {
     global $ilias, $rbacsystem, $rbacadmin, $ilUser;
     include_once './Services/Authentication/classes/class.ilAuthUtils.php';
     //load ILIAS settings
     $settings = $ilias->getAllSettings();
     // User folder
     if ($this->usrf_ref_id == USER_FOLDER_ID and !$rbacsystem->checkAccess('visible,read,write', $this->usrf_ref_id)) {
         $this->ilias->raiseError($this->lng->txt("msg_no_perm_modify_user"), $this->ilias->error_obj->MESSAGE);
     }
     // if called from local administration $this->usrf_ref_id is category id
     // Todo: this has to be fixed. Do not mix user folder id and category id
     if ($this->usrf_ref_id != USER_FOLDER_ID) {
         // check if user is assigned to category
         if (!$rbacsystem->checkAccess('cat_administrate_users', $this->object->getTimeLimitOwner())) {
             $this->ilias->raiseError($this->lng->txt("msg_no_perm_modify_user"), $this->ilias->error_obj->MESSAGE);
         }
     }
     foreach ($_POST["Fobject"] as $key => $val) {
         $_POST["Fobject"][$key] = ilUtil::stripSlashes($val);
     }
     // check dynamically required fields
     foreach ($settings as $key => $val) {
         $field = substr($key, 8);
         switch ($field) {
             case 'passwd':
             case 'passwd2':
                 if (ilAuthUtils::_allowPasswordModificationByAuthMode(ilAuthUtils::_getAuthMode($_POST['Fobject']['auth_mode']))) {
                     $require_keys[] = $field;
                 }
                 break;
             default:
                 $require_keys[] = $field;
                 break;
         }
     }
     foreach ($require_keys as $key => $val) {
         // exclude required system and registration-only fields
         $system_fields = array("default_role");
         if (!in_array($val, $system_fields)) {
             if (isset($settings["require_" . $val]) && $settings["require_" . $val]) {
                 if (empty($_POST["Fobject"][$val])) {
                     $this->ilias->raiseError($this->lng->txt("fill_out_all_required_fields") . ": " . $this->lng->txt($val), $this->ilias->error_obj->MESSAGE);
                 }
             }
         }
     }
     if (!$this->__checkUserDefinedRequiredFields()) {
         $this->ilias->raiseError($this->lng->txt("fill_out_all_required_fields"), $this->ilias->error_obj->MESSAGE);
     }
     // validate login
     if ($this->object->getLogin() != $_POST["Fobject"]["login"] && !ilUtil::isLogin($_POST["Fobject"]["login"])) {
         $this->ilias->raiseError($this->lng->txt("login_invalid"), $this->ilias->error_obj->MESSAGE);
     }
     // check loginname
     if (ilObjUser::_loginExists($_POST["Fobject"]["login"], $this->id)) {
         $this->ilias->raiseError($this->lng->txt("login_exists"), $this->ilias->error_obj->MESSAGE);
     }
     if (ilAuthUtils::_allowPasswordModificationByAuthMode(ilAuthUtils::_getAuthMode($_POST['Fobject']['auth_mode']))) {
         if ($_POST['Fobject']['passwd'] == "********" and !strlen($this->object->getPasswd())) {
             $this->ilias->raiseError($this->lng->txt("fill_out_all_required_fields") . ": " . $this->lng->txt('password'), $this->ilias->error_obj->MESSAGE);
         }
         // check passwords
         if ($_POST["Fobject"]["passwd"] != $_POST["Fobject"]["passwd2"]) {
             $this->ilias->raiseError($this->lng->txt("passwd_not_match"), $this->ilias->error_obj->MESSAGE);
         }
         // validate password
         if (!ilUtil::isPassword($_POST["Fobject"]["passwd"])) {
             $this->ilias->raiseError($this->lng->txt("passwd_invalid"), $this->ilias->error_obj->MESSAGE);
         }
     } else {
         // Password will not be changed...
         $_POST['Fobject']['passwd'] = "********";
     }
     if (ilAuthUtils::_needsExternalAccountByAuthMode(ilAuthUtils::_getAuthMode($_POST['Fobject']['auth_mode']))) {
         if (!strlen($_POST['Fobject']['ext_account'])) {
             $this->ilias->raiseError($this->lng->txt('ext_acccount_required'), $this->ilias->error_obj->MESSAGE);
         }
     }
     if ($_POST['Fobject']['ext_account'] && ($elogin = ilObjUser::_checkExternalAuthAccount($_POST['Fobject']['auth_mode'], $_POST['Fobject']['ext_account']))) {
         if ($elogin != $this->object->getLogin()) {
             $this->ilias->raiseError(sprintf($this->lng->txt("err_auth_ext_user_exists"), $_POST["Fobject"]["ext_account"], $_POST['Fobject']['auth_mode'], $elogin), $this->ilias->error_obj->MESSAGE);
         }
     }
     // The password type is not passed with the post data.  Therefore we
     // append it here manually.
     include_once './Services/User/classes/class.ilObjUser.php';
     $_POST["Fobject"]["passwd_type"] = IL_PASSWD_PLAIN;
     // validate email
     if (strlen($_POST['Fobject']['email']) and !ilUtil::is_email($_POST["Fobject"]["email"])) {
         $this->ilias->raiseError($this->lng->txt("email_not_valid"), $this->ilias->error_obj->MESSAGE);
     }
     $start = $this->__toUnix($_POST["time_limit"]["from"]);
     $end = $this->__toUnix($_POST["time_limit"]["until"]);
     // validate time limit
     if (!$_POST["time_limit"]["unlimited"] and $start > $end) {
         $this->ilias->raiseError($this->lng->txt("time_limit_not_valid"), $this->ilias->error_obj->MESSAGE);
     }
     if (!$this->ilias->account->getTimeLimitUnlimited()) {
         if ($start < $this->ilias->account->getTimeLimitFrom() or $end > $this->ilias->account->getTimeLimitUntil() or $_POST['time_limit']['unlimited']) {
             $_SESSION['error_post_vars'] = $_POST;
             ilUtil::sendFailure($this->lng->txt('time_limit_not_within_owners'));
             $this->editObject();
             return false;
         }
     }
     // TODO: check length of login and passwd
     // checks passed. save user
     $_POST['Fobject']['time_limit_owner'] = $this->object->getTimeLimitOwner();
     $_POST['Fobject']['time_limit_unlimited'] = (int) $_POST['time_limit']['unlimited'];
     $_POST['Fobject']['time_limit_from'] = $this->__toUnix($_POST['time_limit']['from']);
     $_POST['Fobject']['time_limit_until'] = $this->__toUnix($_POST['time_limit']['until']);
     if ($_POST['Fobject']['time_limit_unlimited'] != $this->object->getTimeLimitUnlimited() or $_POST['Fobject']['time_limit_from'] != $this->object->getTimeLimitFrom() or $_POST['Fobject']['time_limit_until'] != $this->object->getTimeLimitUntil()) {
         $_POST['Fobject']['time_limit_message'] = 0;
     } else {
         $_POST['Fobject']['time_limit_message'] = $this->object->getTimeLimitMessage();
     }
     $this->object->assignData($_POST["Fobject"]);
     $this->object->setUserDefinedData($_POST['udf']);
     try {
         $this->object->updateLogin($_POST['Fobject']['login']);
     } catch (ilUserException $e) {
         ilUtil::sendFailure($e->getMessage());
         $this->form_gui->setValuesByPost();
         return $tpl->setContent($this->form_gui->getHtml());
     }
     $this->object->setTitle($this->object->getFullname());
     $this->object->setDescription($this->object->getEmail());
     $this->object->setLanguage($_POST["Fobject"]["language"]);
     //set user skin and style
     $sknst = explode(":", $_POST["Fobject"]["skin_style"]);
     if ($this->object->getPref("style") != $sknst[1] || $this->object->getPref("skin") != $sknst[0]) {
         $this->object->setPref("skin", $sknst[0]);
         $this->object->setPref("style", $sknst[1]);
     }
     // set hits per pages
     $this->object->setPref("hits_per_page", $_POST["Fobject"]["hits_per_page"]);
     // set show users online
     $this->object->setPref("show_users_online", $_POST["Fobject"]["show_users_online"]);
     // set hide_own_online_status
     if ($_POST["Fobject"]["hide_own_online_status"]) {
         $this->object->setPref("hide_own_online_status", $_POST["Fobject"]["hide_own_online_status"]);
     } else {
         $this->object->setPref("hide_own_online_status", "n");
     }
     $this->update = $this->object->update();
     //$rbacadmin->updateDefaultRole($_POST["Fobject"]["default_role"], $this->object->getId());
     // BEGIN DiskQuota: Remember the state of the "send info mail" checkbox
     global $ilUser;
     $ilUser->setPref('send_info_mails', $_POST['send_mail'] == 'y' ? 'y' : 'n');
     $ilUser->writePrefs();
     // END DiskQuota: Remember the state of the "send info mail" checkbox
     $mail_message = $this->__sendProfileMail();
     $msg = $this->lng->txt('saved_successfully') . $mail_message;
     // feedback
     ilUtil::sendSuccess($msg, true);
     if (strtolower($_GET["baseClass"]) == 'iladministrationgui') {
         $this->ctrl->redirectByClass("ilobjuserfoldergui", "view");
     } else {
         $this->ctrl->redirectByClass('ilobjcategorygui', 'listUsers');
     }
 }
コード例 #15
0
 /**
  * Check input, strip slashes etc. set alert, if input is not ok.
  * @return    boolean        Input ok, true/false
  */
 function checkInput()
 {
     global $lng;
     $_POST[$this->getPostVar()] = ilUtil::stripSlashes($_POST[$this->getPostVar()], !(bool) $this->allowRFC822);
     $_POST[$this->getPostVar() . '_retype'] = ilUtil::stripSlashes($_POST[$this->getPostVar() . '_retype'], !(bool) $this->allowRFC822);
     if ($this->getRequired() && trim($_POST[$this->getPostVar()]) == "") {
         $this->setAlert($lng->txt("msg_input_is_required"));
         return false;
     }
     if ($this->getRetype() && $_POST[$this->getPostVar()] != $_POST[$this->getPostVar() . '_retype']) {
         $this->setAlert($lng->txt('email_not_match'));
         return false;
     }
     if (!ilUtil::is_email($_POST[$this->getPostVar()]) && trim($_POST[$this->getPostVar()]) != "") {
         $this->setAlert($lng->txt("email_not_valid"));
         return false;
     }
     return true;
 }
コード例 #16
0
 /**
  * (PHP 5 &gt;= 5.1.0)<br/>
  * Check whether the current element of the iterator is acceptable
  * @link http://php.net/manual/en/filteriterator.accept.php
  * @return bool true if the current element is acceptable, otherwise false.
  */
 public function accept()
 {
     $element = parent::current();
     return ilUtil::is_email($element['login']);
 }