/**
  * Displays window box to kick a user fetched from $_REQUEST['user'].
  *
  * @global ilObjUser $ilUser
  * @param string $method
  */
 public function executeDefault($method)
 {
     global $ilUser, $ilCtrl;
     require_once 'Modules/Chatroom/classes/class.ilChatroom.php';
     require_once 'Modules/Chatroom/classes/class.ilChatroomUser.php';
     if (!ilChatroom::checkUserPermissions(array('moderate'), $this->gui->ref_id)) {
         $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", ROOT_FOLDER_ID);
         $ilCtrl->redirectByClass("ilrepositorygui", "");
     }
     $room = ilChatroom::byObjectId($this->gui->object->getId());
     if ($room) {
         // if user is in scope
         $scope = $room->getRoomId();
         $chat_user = new ilChatroomUser($ilUser, $room);
         $message = json_encode($this->buildMessage(ilUtil::stripSlashes((int) $_REQUEST['sub']), $chat_user));
         $params = array('message' => $message);
         $query = http_build_query($params);
         $connector = $this->gui->getConnector();
         $response = $connector->post($scope, $query);
         $responseObject = json_decode($response);
         $room->clearMessages($_REQUEST['sub']);
     } else {
         $response = json_encode(array('success' => false, 'reason' => 'unkown room'));
     }
     echo $response;
     exit;
 }
 /**
  * Get user items
  */
 function getItems()
 {
     global $lng, $rbacreview, $ilObjDataCache;
     $this->determineOffsetAndOrder();
     include_once "./Services/User/classes/class.ilAccountCode.php";
     $codes_data = ilAccountCode::getCodesData(ilUtil::stripSlashes($this->getOrderField()), ilUtil::stripSlashes($this->getOrderDirection()), ilUtil::stripSlashes($this->getOffset()), ilUtil::stripSlashes($this->getLimit()), $this->filter["code"], $this->filter["valid_until"], $this->filter["generated"]);
     if (count($codes_data["set"]) == 0 && $this->getOffset() > 0) {
         $this->resetOffset();
         $codes_data = ilAccountCode::getCodesData(ilUtil::stripSlashes($this->getOrderField()), ilUtil::stripSlashes($this->getOrderDirection()), ilUtil::stripSlashes($this->getOffset()), ilUtil::stripSlashes($this->getLimit()), $this->filter["code"], $this->filter["valid_until"], $this->filter["generated"]);
     }
     $result = array();
     foreach ($codes_data["set"] as $k => $code) {
         $result[$k]["generated"] = ilDatePresentation::formatDate(new ilDateTime($code["generated"], IL_CAL_UNIX));
         if ($code["used"]) {
             $result[$k]["used"] = ilDatePresentation::formatDate(new ilDateTime($code["used"], IL_CAL_UNIX));
         } else {
             $result[$k]["used"] = "";
         }
         if ($code["valid_until"] === "0") {
             $valid = $lng->txt("user_account_code_valid_until_unlimited");
         } else {
             if (is_numeric($code["valid_until"])) {
                 $valid = $code["valid_until"] . " " . ($code["valid_until"] == 1 ? $lng->txt("day") : $lng->txt("days"));
             } else {
                 $valid = ilDatePresentation::formatDate(new ilDate($code["valid_until"], IL_CAL_DATE));
             }
         }
         $result[$k]["valid_until"] = $valid;
         $result[$k]["code"] = $code["code"];
         $result[$k]["code_id"] = $code["code_id"];
     }
     $this->setMaxCount($codes_data["cnt"]);
     $this->setData($result);
 }
예제 #3
0
 /**
  * Fill table row
  */
 protected function fillRow($a_set)
 {
     global $lng;
     $this->tpl->setVariable("VAL_TITLE", $a_set["title"]);
     $this->tpl->setVariable("PAGE_ID", $a_set["obj_id"]);
     $exp_id = ilLMPageObject::getExportId($this->parent_obj->object->getId(), $a_set["obj_id"], $a_set["type"]);
     if ($this->validation) {
         if (!preg_match("/^[a-zA-Z_]*\$/", trim($_POST["exportid"][$a_set["obj_id"]]))) {
             // @todo: move to style
             $this->tpl->setVariable("STYLE", " style='background-color: #FCEAEA;' ");
             $this->tpl->setVariable("ALERT_IMG", ilUtil::img(ilUtil::getImagePath("icon_alert.svg"), $lng->txt("alert")));
         }
         $this->tpl->setVariable("EXPORT_ID", ilUtil::prepareFormOutput(ilUtil::stripSlashes($_POST["exportid"][$a_set["obj_id"]])));
     } else {
         $this->tpl->setVariable("EXPORT_ID", ilUtil::prepareFormOutput($exp_id));
     }
     if ($this->cnt_exp_ids[$exp_id] > 1) {
         $this->tpl->setVariable("ITEM_ADD_TXT", $lng->txt("cont_exp_id_used_multiple"));
         $this->tpl->setVariable("ALERT_IMG", ilUtil::img(ilUtil::getImagePath("icon_alert.svg"), $lng->txt("alert")));
         if (!$this->dup_info_given) {
             ilUtil::sendInfo($lng->txt("content_some_export_ids_multiple_times"));
             $this->dup_info_given = true;
         }
     }
 }
 /**
  * This method overwrites the one found in ilNumberInputGUI. It is used
  * to implement an own check algorithm for the number input.
  *
  * @return    boolean    true, if the input is ok; false otherwise
  */
 public function checkInput()
 {
     global $lng;
     $_POST[$this->getPostVar()] = ilUtil::stripSlashes($_POST[$this->getPostVar()]);
     // Is an input required but the input itself empty?
     if ($this->getRequired() && trim($_POST[$this->getPostVar()]) === "") {
         $this->setAlert($lng->txt("msg_input_is_required"));
         return false;
     }
     // Is the input numeric?
     if (trim($_POST[$this->getPostVar()]) !== "" && !is_numeric(str_replace(',', '.', $_POST[$this->getPostVar()]))) {
         $this->setAlert($lng->txt("form_msg_numeric_value_required"));
         return false;
     }
     // Check if the input is lower than the given minimum
     if (trim($_POST[$this->getPostVar()]) !== "" && $this->getMinValue() !== false && $_POST[$this->getPostVar()] < $this->getMinValue()) {
         $this->setAlert($lng->txt("form_msg_value_too_low"));
         return false;
     }
     // Check if the input is greater than the given maximum
     if (trim($_POST[$this->getPostVar()]) !== "" && $this->getMaxValue() !== false && $_POST[$this->getPostVar()] > $this->getMaxValue()) {
         $this->setAlert($lng->txt("form_msg_value_too_high"));
         return false;
     }
     // check subitems if present
     return $this->checkSubItemsInput();
 }
 public function searchModerators()
 {
     if (!is_object($oQueryParser = $this->parseQueryString(ilUtil::stripSlashes($_POST['search_query'])))) {
         ilUtil::sendInfo($oQueryParser);
         return $this->searchModeratorsForm();
     }
     $oUserSearchFirstname = ilObjectSearchFactory::_getUserSearchInstance($oQueryParser);
     $oUserSearchFirstname->setFields(array('firstname'));
     /** @var $oSearchResult ilObjectSearchFactory */
     $oSearchResult = $oUserSearchFirstname->performSearch();
     $oUserSearchLastname = ilObjectSearchFactory::_getUserSearchInstance($oQueryParser);
     $oUserSearchLastname->setFields(array('lastname'));
     $oSearchResultLastname = $oUserSearchLastname->performSearch();
     $oSearchResult->mergeEntries($oSearchResultLastname);
     $oUserSearchLogin = ilObjectSearchFactory::_getUserSearchInstance($oQueryParser);
     $oUserSearchLogin->setFields(array('login'));
     $oSearchResultLogin = $oUserSearchLogin->performSearch();
     $oSearchResult->mergeEntries($oSearchResultLogin);
     $oSearchResult->filter(ROOT_FOLDER_ID, $oQueryParser->getCombination() == 'and');
     $search_results = $oSearchResult->getUniqueResults();
     if (is_array($search_results) && count($search_results)) {
         $_SESSION['frm']['moderators']['search_result'] = $search_results;
         return $this->showModeratorsSearchResult($search_results);
     } else {
         ilUtil::sendInfo($this->lng->txt('frm_moderators_matches_in_no_results'));
         return $this->searchModeratorsForm();
     }
 }
예제 #6
0
 public function open($file = "")
 {
     // #16643
     $this->line_ends = ini_get("auto_detect_line_endings");
     ini_set("auto_detect_line_endings", true);
     return $this->ptr_file = @fopen(ilUtil::stripSlashes($file), "r");
 }
 function checkInput()
 {
     if (!is_array($_POST[$this->getPostVar()])) {
         $_POST[$this->getPostVar()] = ilUtil::stripSlashes($_POST[$this->getPostVar()]);
     }
     return $this->checkSubItemsInput();
 }
 /**
  * Get user items
  */
 function getItems()
 {
     global $lng, $rbacreview, $ilObjDataCache;
     $this->determineOffsetAndOrder();
     include_once "./Services/Registration/classes/class.ilRegistrationCode.php";
     $order_map = array("registration_code" => "code", "role" => "role", "registration_generated" => "generated", "registration_used" => "used");
     $codes_data = ilRegistrationCode::getCodesData(ilUtil::stripSlashes($order_map[$this->getOrderField()]), ilUtil::stripSlashes($this->getOrderDirection()), ilUtil::stripSlashes($this->getOffset()), ilUtil::stripSlashes($this->getLimit()), $this->filter["code"], $this->filter["role"], $this->filter["generated"]);
     if (count($codes_data["set"]) == 0 && $this->getOffset() > 0) {
         $this->resetOffset();
         $codes_data = ilRegistrationCode::getCodesData(ilUtil::stripSlashes($this->getOrderField()), ilUtil::stripSlashes($this->getOrderDirection()), ilUtil::stripSlashes($this->getOffset()), ilUtil::stripSlashes($this->getLimit()), $this->filter["code"], $this->filter["role"], $this->filter["generated"]);
     }
     include_once './Services/AccessControl/classes/class.ilObjRole.php';
     $options = array();
     foreach ($rbacreview->getGlobalRoles() as $role_id) {
         if (!in_array($role_id, array(SYSTEM_ROLE_ID, ANONYMOUS_ROLE_ID))) {
             $role_map[$role_id] = $ilObjDataCache->lookupTitle($role_id);
         }
     }
     $result = array();
     foreach ($codes_data["set"] as $k => $code) {
         $result[$k]["registration_generated"] = ilDatePresentation::formatDate(new ilDateTime($code["generated"], IL_CAL_UNIX));
         if ($code["used"]) {
             $result[$k]["registration_used"] = ilDatePresentation::formatDate(new ilDateTime($code["used"], IL_CAL_UNIX));
         } else {
             $result[$k]["registration_used"] = "";
         }
         if ($code["role"]) {
             $result[$k]["role"] = $this->role_map[$code["role"]];
         }
         $result[$k]["registration_code"] = $code["code"];
         $result[$k]["code_id"] = $code["code_id"];
     }
     $this->setMaxCount($codes_data["cnt"]);
     $this->setData($result);
 }
 /**
  * Check input, strip slashes etc. set alert, if input is not ok.
  *
  * @return	boolean		Input ok, true/false
  */
 public function checkInput()
 {
     global $lng;
     $foundvalues = $_POST[$this->getPostVar()];
     $this->setOpenAnswerIndexes(array());
     if (is_array($foundvalues)) {
         foreach ($foundvalues as $idx => $value) {
             if ($idx === 'open') {
                 foreach ((array) $value as $oindex => $ovalue) {
                     $this->addOpenAnswerIndex($oindex);
                 }
                 continue;
             }
             $_POST[$this->getPostVar()][$idx] = ilUtil::stripSlashes($value);
             if ($this->getRequired() && trim($value) == "") {
                 $this->setAlert($lng->txt("msg_input_is_required"));
                 return false;
             } else {
                 if (strlen($this->getValidationRegexp())) {
                     if (!preg_match($this->getValidationRegexp(), $value)) {
                         $this->setAlert($lng->txt("msg_wrong_format"));
                         return FALSE;
                     }
                 }
             }
         }
     } else {
         $this->setAlert($lng->txt("msg_input_is_required"));
         return FALSE;
     }
     return $this->checkSubItemsInput();
 }
 protected function getRequestParams()
 {
     $this->params = array();
     foreach ($_REQUEST as $name => $value) {
         $this->params[$name] = ilUtil::stripSlashes(urldecode($value));
     }
 }
 /**
  * Check input, strip slashes etc. set alert, if input is not ok.
  *
  * @return    boolean        Input ok, true/false
  */
 function checkInput()
 {
     global $ilUser;
     // for the date use the UNIX time stamp "0", since we don't care about it
     $dt['mday'] = 1;
     $dt['mon'] = 1;
     $dt['year'] = 1970;
     $post = $_POST[$this->getPostVar()];
     // empty date valid with input field
     if (!$this->getRequired() && $this->getMode() === self::MODE_INPUT && $post["date"] === "") {
         return true;
     }
     $post["time"]["h"] = ilUtil::stripSlashes($post["time"]["h"]);
     $post["time"]["m"] = ilUtil::stripSlashes($post["time"]["m"]);
     $post["time"]["s"] = ilUtil::stripSlashes($post["time"]["s"]);
     $dt['hours'] = (int) $post['time']['h'];
     $dt['minutes'] = (int) $post['time']['m'];
     $dt['seconds'] = (int) $post['time']['s'];
     // very basic validation
     if ($dt['hours'] > 23 || $dt['minutes'] > 59 || $dt['seconds'] > 59) {
         $dt = false;
     }
     $date = new ilDateTime($dt, IL_CAL_FKT_GETDATE, $ilUser->getTimeZone());
     $this->setDate($date);
     // post values used to be overwritten anyways - cannot change behaviour
     $_POST[$this->getPostVar()]['date'] = $date->get(IL_CAL_FKT_DATE, 'Y-m-d', $ilUser->getTimeZone());
     $_POST[$this->getPostVar()]['time'] = $date->get(IL_CAL_FKT_DATE, 'H:i:s', $ilUser->getTimeZone());
     return (bool) $dt;
 }
 /**
  * lookup version
  */
 function _lookupVersion($a_id)
 {
     global $ilDB;
     $q = "SELECT version FROM file_data WHERE file_id = " . $ilDB->quote($a_id, 'integer');
     $r = $ilDB->query($q);
     $row = $r->fetchRow(DB_FETCHMODE_OBJECT);
     return ilUtil::stripSlashes($row->version);
 }
예제 #13
0
 /**
  * Save the mark schema POST data when the form was submitted
  */
 protected function saveMarkSchemaFormData()
 {
     $this->object->getMarkSchema()->flush();
     foreach ($_POST as $key => $value) {
         if (preg_match('/mark_short_(\\d+)/', $key, $matches)) {
             $this->object->getMarkSchema()->addMarkStep(ilUtil::stripSlashes($_POST["mark_short_{$matches['1']}"]), ilUtil::stripSlashes($_POST["mark_official_{$matches['1']}"]), ilUtil::stripSlashes($_POST["mark_percentage_{$matches['1']}"]), ilUtil::stripSlashes($_POST["passed_{$matches['1']}"]));
         }
     }
 }
예제 #14
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;
     }
     return true;
 }
 /**
  * Input should always be valid, since we sort only
  * 
  * @return boolean
  */
 function checkInput()
 {
     if (is_array($_POST[$this->getPostVar()])) {
         foreach ($_POST[$this->getPostVar()] as $k => $v) {
             $_POST[$this->getPostVar()][$k]["id"] = ilUtil::stripSlashes($_POST[$this->getPostVar()][$k]["id"]);
             $_POST[$this->getPostVar()][$k]["text"] = ilUtil::stripSlashes($_POST[$this->getPostVar()][$k]["text"]);
         }
     } else {
         $_POST[$this->getPostVar()] = array();
     }
     return true;
 }
 /**
  * Get user items
  */
 function getItems()
 {
     global $lng, $rbacreview;
     $this->determineOffsetAndOrder();
     include_once "./Services/User/classes/class.ilUserQuery.php";
     $usr_data = ilUserQuery::getUserListData(ilUtil::stripSlashes($this->getOrderField()), ilUtil::stripSlashes($this->getOrderDirection()), ilUtil::stripSlashes($this->getOffset()), ilUtil::stripSlashes($this->getLimit()), '', '', null, false, false, 0, $this->getRoleId());
     if ($rbacreview->isAssigned(SYSTEM_USER_ID, $this->getRoleId())) {
         $this->setMaxCount($usr_data["cnt"] - 1);
     } else {
         $this->setMaxCount($usr_data["cnt"]);
     }
     $this->setData($usr_data["set"]);
 }
 /**
  * Prepares and posts message fetched from $_REQUEST['message']
  * to recipients fetched from $_REQUEST['recipient']
  * and adds an entry to history if successful.
  *
  * @global ilObjUser $ilUser
  * @param string $method
  */
 public function executeDefault($method)
 {
     global $ilUser, $ilCtrl;
     require_once 'Modules/Chatroom/classes/class.ilChatroom.php';
     require_once 'Modules/Chatroom/classes/class.ilChatroomUser.php';
     if (!ilChatroom::checkUserPermissions('read', $this->gui->ref_id)) {
         $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", ROOT_FOLDER_ID);
         $ilCtrl->redirectByClass("ilrepositorygui", "");
     }
     $room = ilChatroom::byObjectId($this->gui->object->getId());
     $chat_user = new ilChatroomUser($ilUser, $room);
     $user_id = $chat_user->getUserId();
     if (!$room) {
         throw new Exception('unkown room');
     } else {
         if (!$room->isSubscribed($chat_user->getUserId())) {
             throw new Exception('not subscribed');
         } else {
             if (isset($_REQUEST['sub']) && !$room->userIsInPrivateRoom($_REQUEST['sub'], $chat_user->getUserId())) {
                 $response = json_encode(array('success' => false, 'reason' => 'not subscribed to private room'));
                 echo json_encode($response);
                 exit;
             }
         }
     }
     $scope = $room->getRoomId();
     $params = array();
     if ($recipient = $_REQUEST['recipient']) {
         $params['recipients'] = join(',', array_unique(array($user_id, $recipient)));
         $params['recipient_names'] = implode(',', array($chat_user->getUsername(), $_REQUEST['recipient_name']));
         $params['public'] = isset($_REQUEST['public']) ? (int) $_REQUEST['public'] : 0;
     } else {
         $params['public'] = 1;
     }
     if ($_REQUEST['sub']) {
         $params['sub'] = (int) $_REQUEST['sub'];
     }
     $messageObject = $this->buildMessage(ilUtil::stripSlashes($_REQUEST['message']), $params, $chat_user);
     $message = json_encode($messageObject);
     $params = array_merge($params, array('message' => $message));
     //print_r($params);exit;
     $query = http_build_query($params);
     $connector = $this->gui->getConnector();
     $response = $connector->post($scope, $query);
     $responseObject = json_decode($response);
     if ($responseObject->success == true) {
         $room->addHistoryEntry($messageObject, $recipient, $publicMessage);
     }
     echo $response;
     exit;
 }
예제 #18
0
 function getItems()
 {
     $this->determineOffsetAndOrder();
     include_once "./Services/User/classes/class.ilUserQuery.php";
     $usr_data = ilUserQuery::getUserListData(ilUtil::stripSlashes($this->getOrderField()), ilUtil::stripSlashes($this->getOrderDirection()), ilUtil::stripSlashes($this->getOffset()), ilUtil::stripSlashes($this->getLimit()), null, null, null, null, null, null, null, null, array("online_time"), null, null);
     if (count($usr_data["set"]) == 0 && $this->getOffset() > 0) {
         $this->resetOffset();
         $usr_data = ilUserQuery::getUserListData(ilUtil::stripSlashes($this->getOrderField()), ilUtil::stripSlashes($this->getOrderDirection()), ilUtil::stripSlashes($this->getOffset()), ilUtil::stripSlashes($this->getLimit()), null, null, null, null, null, null, null, null, array("online_time"), null, null);
     }
     $this->setMaxCount($usr_data["cnt"]);
     $this->setData($usr_data["set"]);
     include_once 'Services/Tracking/classes/class.ilObjUserTracking.php';
     $this->lp_active = ilObjUserTracking::_enabledLearningProgress();
 }
 /**
  * Get user items
  */
 function getItems()
 {
     global $lng;
     //if ($GLOBALS["kk"]++ == 1) nj();
     $this->determineOffsetAndOrder();
     include_once "./Modules/LearningModule/classes/class.ilLMPageObject.php";
     $questions = ilLMPageObject::queryQuestionsOfLearningModule($this->lm->getId(), ilUtil::stripSlashes($this->getOrderField()), ilUtil::stripSlashes($this->getOrderDirection()), ilUtil::stripSlashes($this->getOffset()), ilUtil::stripSlashes($this->getLimit()));
     if (count($questions["set"]) == 0 && $this->getOffset() > 0) {
         $this->resetOffset();
         $questions = ilLMPageObject::queryQuestionsOfLearningModule($this->lm->getId(), ilUtil::stripSlashes($this->getOrderField()), ilUtil::stripSlashes($this->getOrderDirection()), ilUtil::stripSlashes($this->getOffset()), ilUtil::stripSlashes($this->getLimit()));
     }
     $this->setMaxCount($questions["cnt"]);
     $this->setData($questions["set"]);
 }
예제 #20
0
 public function saveTopic()
 {
     $this->objCurrentTopic->setTitle(ilUtil::stripSlashes(trim($_POST['title'])));
     $this->objCurrentTopic->setSorting((int) ilUtil::stripSlashes(trim($_POST['sorting'])));
     if ($_POST['title'] == '') {
         ilUtil::sendFailure($this->lng->txt('fill_out_all_required_fields'));
         $this->showTopicForm();
     } else {
         $mode = $this->objCurrentTopic->getId() ? 'edit' : 'create';
         if ($this->objCurrentTopic->save()) {
             ilUtil::sendSuccess($this->lng->txt($mode == 'create' ? 'topic_saved' : 'topic_edited'));
         }
         $this->showTopicsList();
     }
     return true;
 }
 /**
  * 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;
     }
     include_once "./Services/Captcha/classes/class.ilSecurImage.php";
     $si = new ilSecurImage();
     if (!$si->check($_POST[$this->getPostVar()])) {
         $this->setAlert($lng->txt("cptch_wrong_input"));
         return false;
     }
     return true;
 }
 /**
  * @return bool
  */
 public function checkInput()
 {
     global $lng;
     $ok = parent::checkInput();
     $query = ilUtil::stripSlashes($_POST[$this->getPostVar()]);
     if (!$ok) {
         return false;
     }
     include_once 'Services/Mail/classes/class.ilMailLuceneQueryParser.php';
     try {
         ilMailLuceneQueryParser::validateQuery($query);
         return true;
     } catch (Exception $e) {
         $this->setAlert($lng->txt($e->getMessage()));
         return false;
     }
 }
 /**
  * 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;
     } else {
         $eval = new EvalMath();
         $eval->suppress_errors = true;
         $result = $eval->e(str_replace(",", ".", ilUtil::stripSlashes($_POST[$this->getPostVar()], FALSE)));
         if ($result === false) {
             $this->setAlert($lng->txt("form_msg_formula_is_required"));
             return false;
         }
     }
     return $this->checkSubItemsInput();
 }
예제 #24
0
 /** 
  * Called if the user pushes the submit button of the mail options form.
  * Passes the post data to the mail options model instance to store them.
  * 
  * @access public
  * 
  */
 public function saveOptions()
 {
     global $lng, $ilUser, $ilSetting;
     $this->tpl->setTitle($lng->txt('mail'));
     $this->initMailOptionsForm();
     $mailOptions = new ilMailOptions($ilUser->getId());
     if ($ilSetting->get('usr_settings_hide_mail_incoming_mail') != '1' && $ilSetting->get('usr_settings_disable_mail_incoming_mail') != '1') {
         $incoming_type = (int) $_POST['incoming_type'];
     } else {
         $incoming_type = $mailOptions->getIncomingType();
     }
     if ($this->form->checkInput()) {
         $mailOptions->updateOptions(ilUtil::stripSlashes($_POST['signature']), (int) $_POST['linebreak'], $incoming_type, (int) $_POST['cronjob_notification']);
         ilUtil::sendSuccess($lng->txt('mail_options_saved'));
     }
     $this->form->setValuesByPost();
     $this->tpl->setContent($this->form->getHTML());
     $this->tpl->show();
 }
예제 #25
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()]);
     $_POST[$this->getPostVar() . '_retype'] = ilUtil::stripSlashes($_POST[$this->getPostVar() . '_retype']);
     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;
 }
 /**
  * Check input, strip slashes etc. set alert, if input is not ok.
  *
  * @return	boolean		Input ok, true/false
  */
 function checkInput()
 {
     global $lng, $ilUser;
     $ok = true;
     $_POST[$this->getPostVar()]["date"]["y"] = ilUtil::stripSlashes($_POST[$this->getPostVar()]["date"]["y"]);
     $_POST[$this->getPostVar()]["date"]["m"] = ilUtil::stripSlashes($_POST[$this->getPostVar()]["date"]["m"]);
     $_POST[$this->getPostVar()]["date"]["d"] = ilUtil::stripSlashes($_POST[$this->getPostVar()]["date"]["d"]);
     $_POST[$this->getPostVar()]["time"]["h"] = ilUtil::stripSlashes($_POST[$this->getPostVar()]["time"]["h"]);
     $_POST[$this->getPostVar()]["time"]["m"] = ilUtil::stripSlashes($_POST[$this->getPostVar()]["time"]["m"]);
     $_POST[$this->getPostVar()]["time"]["s"] = ilUtil::stripSlashes($_POST[$this->getPostVar()]["time"]["s"]);
     // verify date
     $dt['year'] = (int) $_POST[$this->getPostVar()]['date']['y'];
     $dt['mon'] = (int) $_POST[$this->getPostVar()]['date']['m'];
     $dt['mday'] = (int) $_POST[$this->getPostVar()]['date']['d'];
     $dt['hours'] = (int) $_POST[$this->getPostVar()]['time']['h'];
     $dt['minutes'] = (int) $_POST[$this->getPostVar()]['time']['m'];
     $dt['seconds'] = (int) $_POST[$this->getPostVar()]['time']['s'];
     if ($dt['year'] == 0 && $dt['mon'] == 0 && $dt['mday'] == 0 && $this->getRequired()) {
         $this->date = null;
         $this->setAlert($lng->txt("msg_input_is_required"));
         return false;
     } else {
         if ($dt['year'] == 0 && $dt['mon'] == 0 && $dt['mday'] == 0) {
             $this->date = null;
             $_POST[$this->getPostVar()]['date'] = "";
             // #10413
         } else {
             if (!checkdate((int) $dt['mon'], (int) $dt['mday'], (int) $dt['year'])) {
                 $this->date = null;
                 $this->setAlert($lng->txt("exc_date_not_valid"));
                 return false;
             }
             $date = new ilDateTime($dt, IL_CAL_FKT_GETDATE, $ilUser->getTimeZone());
             $_POST[$this->getPostVar()]['date'] = $date->get(IL_CAL_FKT_DATE, 'Y-m-d', $ilUser->getTimeZone());
             $this->setDate($date);
         }
     }
     return true;
 }
예제 #27
0
 /**
  * Check input, strip slashes etc. set alert, if input is not ok.
  *
  * @return	boolean		Input ok, true/false
  */
 function checkInput()
 {
     global $lng;
     $lng->loadLanguageModule("feed");
     $_POST[$this->getPostVar()] = ilUtil::stripSlashes($_POST[$this->getPostVar()]);
     // remove safari pseudo protocol
     if (substr($_POST[$this->getPostVar()], 0, 5) == "feed:") {
         $_POST[$this->getPostVar()] = "http:" . substr($_POST[$this->getPostVar()], 5);
     }
     // add missing http://
     if (!is_int(strpos($_POST[$this->getPostVar()], "://"))) {
         $_POST[$this->getPostVar()] = "http://" . $_POST[$this->getPostVar()];
     }
     // check required
     if ($this->getRequired() && trim($_POST[$this->getPostVar()]) == "") {
         $this->setAlert($lng->txt("msg_input_is_required"));
         return false;
     }
     // check feed url
     $url = $_POST[$this->getPostVar()];
     include_once "./Services/Feeds/classes/class.ilExternalFeed.php";
     $check = ilExternalFeed::_checkUrl($url);
     // try to determine a feed url, if we failed here
     if ($check !== true) {
         $url2 = ilExternalFeed::_determineFeedUrl($url);
         $check2 = ilExternalFeed::_checkUrl($url2);
         if ($check2 === true) {
             $_POST[$this->getPostVar()] = $url2;
             $check = true;
         }
     }
     // if check failed, output error message
     if ($check !== true) {
         $check = str_replace("MagpieRSS:", "", $check);
         $this->setAlert($lng->txt("feed_no_valid_url") . "<br />" . $check);
         return false;
     }
     return true;
 }
예제 #28
0
 /**
  * Process answer
  */
 function processAnswer()
 {
     global $ilUser, $ilDB, $lng, $ilPluginAdmin, $ilLog;
     parent::processAnswer();
     //
     // Send notifications to authors that want to be informed on blocked users
     //
     $parent_id = ilPageObject::lookupParentId((int) $_GET["page_id"], "lm");
     // is restriction mode set?
     include_once "./Modules/LearningModule/classes/class.ilObjContentObject.php";
     if (ilObjContentObject::_lookupRestrictForwardNavigation($parent_id)) {
         // check if user is blocked
         $id = ilUtil::stripSlashes($_POST["id"]);
         include_once "./Services/COPage/classes/class.ilPageQuestionProcessor.php";
         $as = ilPageQuestionProcessor::getAnswerStatus($id, $ilUser->getId());
         // get question information
         include_once "./Modules/TestQuestionPool/classes/class.ilAssQuestionList.php";
         $qlist = new ilAssQuestionList($ilDB, $lng, $ilPluginAdmin);
         $qlist->setParentObjId(0);
         $qlist->addFieldFilter("question_id", array($id));
         $qlist->load();
         $qdata = $qlist->getQuestionDataArray();
         // has the user been blocked?
         if ($as["try"] >= $qdata[$as["qst_id"]]["nr_of_tries"] && $qdata[$as["qst_id"]]["nr_of_tries"] > 0 && !$as["passed"]) {
             include_once "./Services/Notification/classes/class.ilNotification.php";
             $users = ilNotification::getNotificationsForObject(ilNotification::TYPE_LM_BLOCKED_USERS, $parent_id);
             if (count($users) > 0) {
                 include_once "./Modules/LearningModule/classes/class.ilLMMailNotification.php";
                 $not = new ilLMMailNotification();
                 $not->setType(ilLMMailNotification::TYPE_USER_BLOCKED);
                 $not->setQuestionId($id);
                 $not->setRefId((int) $_GET["ref_id"]);
                 $not->setRecipients($users);
                 $not->send();
             }
         }
     }
 }
예제 #29
0
 /**
  * Displays window box to kick a user fetched from $_REQUEST['user'].
  *
  * @global ilObjUser $ilUser
  * @param string $method
  */
 public function executeDefault($method)
 {
     /**
      * @var $ilUser ilObjUser
      * @var $ilCtrl ilCtrl 
      */
     global $ilUser, $ilCtrl;
     require_once 'Modules/Chatroom/classes/class.ilChatroom.php';
     require_once 'Modules/Chatroom/classes/class.ilChatroomUser.php';
     if (!ilChatroom::checkUserPermissions(array('read', 'moderate'), $this->gui->ref_id)) {
         $ilCtrl->setParameterByClass('ilrepositorygui', 'ref_id', ROOT_FOLDER_ID);
         $ilCtrl->redirectByClass('ilrepositorygui', '');
     }
     $room = ilChatroom::byObjectId($this->gui->object->getId());
     if ($room) {
         // if user is in scope
         $scope = $room->getRoomId();
         $chat_user = new ilChatroomUser($ilUser, $room);
         $messageObject = $this->buildMessage(ilUtil::stripSlashes($_REQUEST['user']), $chat_user);
         $message = json_encode($messageObject);
         $params = array('message' => $message, 'userToKick' => $_REQUEST['user']);
         $query = http_build_query($params);
         $connector = $this->gui->getConnector();
         $response = $connector->kick($scope, $query);
         $responseObject = json_decode($response);
         if ($responseObject->success == true) {
             $room->addHistoryEntry($messageObject, '', 1);
             $message = json_encode(array('type' => 'userjustkicked', 'user' => $params['userToKick'], 'sub' => 0));
             $connector->sendMessage($room->getRoomId(), $message, array('public' => 1, 'sub' => 0));
             // 2013-09-11: Should already been done by the chat server
             $room->disconnectUser($params['userToKick']);
         }
     } else {
         $response = json_encode(array('success' => false, 'reason' => 'unkown room'));
     }
     echo $response;
     exit;
 }
 protected function displayLinkToUploadedFile($room, $chat_user)
 {
     global $ilCtrl;
     $scope = $room->getRoomId();
     $params = array();
     $params['public'] = 1;
     /**
      * @todo erwartet message als json
      */
     $message = json_encode($this->buildMessage(json_encode(array('format' => array(), 'content' => ilUtil::stripSlashes('Eine neue Datei mit dem Link ' . $ilCtrl->getLinkTarget($this->gui, 'uploadFile-deliverFile') . ' wurde hochgeladen'))), $params, $chat_user));
     $params = array_merge($params, array('message' => $message));
     $query = http_build_query($params);
     $connector = $this->gui->getConnector();
     $response = $connector->post($scope, $query);
     $responseObject = json_decode($response);
     /*
     if( $responseObject->success == true && $room->getSetting( 'enable_history' ) )
     {
     $room->addHistoryEntry( $message, $recipient, $publicMessage );
     }
     */
     echo $response;
     exit;
 }