当前位置: 首页>>代码示例>>PHP>>正文


PHP ilUtil::stripSlashesRecursive方法代码示例

本文整理汇总了PHP中ilUtil::stripSlashesRecursive方法的典型用法代码示例。如果您正苦于以下问题:PHP ilUtil::stripSlashesRecursive方法的具体用法?PHP ilUtil::stripSlashesRecursive怎么用?PHP ilUtil::stripSlashesRecursive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ilUtil的用法示例。


在下文中一共展示了ilUtil::stripSlashesRecursive方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: checkInput

 function checkInput()
 {
     global $lng;
     include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
     if (is_array($_POST[$this->getPostVar()])) {
         $_POST[$this->getPostVar()] = ilUtil::stripSlashesRecursive($_POST[$this->getPostVar()], false, ilObjAdvancedEditing::_getUsedHTMLTagsAsString("assessment"));
     }
     $foundvalues = $_POST[$this->getPostVar()];
     #vd($foundvalues);
     if (is_array($foundvalues)) {
         // check answers
         if (is_array($foundvalues['answer'])) {
             foreach ($foundvalues['answer'] as $aidx => $answervalue) {
                 if (strlen($answervalue) == 0 && strlen($foundvalues['imagename'][$aidx]) == 0) {
                     $this->setAlert($lng->txt("msg_input_is_required"));
                     return FALSE;
                 }
             }
         }
         // check correctness
         if (!isset($foundvalues['correctness']) || count($foundvalues['correctness']) < count($foundvalues['answer'])) {
             $this->setAlert($lng->txt("msg_input_is_required"));
             return false;
         }
         if (!$this->checkUploads($foundvalues)) {
             return false;
         }
     } else {
         $this->setAlert($lng->txt("msg_input_is_required"));
         return FALSE;
     }
     return $this->checkSubItemsInput();
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:33,代码来源:class.ilKprimChoiceWizardInputGUI.php

示例2: checkInput

 /**
  * Check input, strip slashes etc. set alert, if input is not ok.
  *
  * @return	boolean		Input ok, true/false
  */
 function checkInput()
 {
     global $lng;
     if (is_array($_POST[$this->getPostVar()])) {
         $_POST[$this->getPostVar()] = ilUtil::stripSlashesRecursive($_POST[$this->getPostVar()]);
     }
     $foundvalues = $_POST[$this->getPostVar()];
     if (is_array($foundvalues)) {
         // check answers
         if (is_array($foundvalues['answer'])) {
             foreach ($foundvalues['answer'] as $aidx => $answervalue) {
                 if (strlen($answervalue) == 0) {
                     $this->setAlert($lng->txt("msg_input_is_required"));
                     return FALSE;
                 }
             }
         }
         // check points
         $max = 0;
         if (is_array($foundvalues['points'])) {
             foreach ($foundvalues['points'] as $points) {
                 if ($points > $max) {
                     $max = $points;
                 }
                 if (strlen($points) == 0 || !is_numeric($points)) {
                     $this->setAlert($lng->txt("form_msg_numeric_value_required"));
                     return FALSE;
                 }
             }
         }
         if ($max == 0) {
             $this->setAlert($lng->txt("enter_enough_positive_points"));
             return false;
         }
     } else {
         $this->setAlert($lng->txt("msg_input_is_required"));
         return FALSE;
     }
     return $this->checkSubItemsInput();
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:45,代码来源:class.ilAnswerWizardInputGUI.php

示例3: checkInput

 /**
  * Check input, strip slashes etc. set alert, if input is not ok.
  *
  * @return	boolean		Input ok, true/false
  */
 function checkInput()
 {
     global $lng;
     include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
     if (is_array($_POST[$this->getPostVar()])) {
         $_POST[$this->getPostVar()] = ilUtil::stripSlashesRecursive($_POST[$this->getPostVar()], true, ilObjAdvancedEditing::_getUsedHTMLTagsAsString("assessment"));
     }
     $foundvalues = $_POST[$this->getPostVar()];
     if (is_array($foundvalues)) {
         // check answers
         if (is_array($foundvalues['answer'])) {
             foreach ($foundvalues['answer'] as $aidx => $answervalue) {
                 if (strlen($answervalue) == 0 && strlen($foundvalues['imagename'][$aidx]) == 0) {
                     $this->setAlert($lng->txt("msg_input_is_required"));
                     return FALSE;
                 }
             }
         }
         if (!$this->hideImages) {
             if (is_array($_FILES[$this->getPostVar()]['error']['image'])) {
                 foreach ($_FILES[$this->getPostVar()]['error']['image'] as $index => $error) {
                     // error handling
                     if ($error > 0) {
                         switch ($error) {
                             case UPLOAD_ERR_INI_SIZE:
                                 $this->setAlert($lng->txt("form_msg_file_size_exceeds"));
                                 return false;
                                 break;
                             case UPLOAD_ERR_FORM_SIZE:
                                 $this->setAlert($lng->txt("form_msg_file_size_exceeds"));
                                 return false;
                                 break;
                             case UPLOAD_ERR_PARTIAL:
                                 $this->setAlert($lng->txt("form_msg_file_partially_uploaded"));
                                 return false;
                                 break;
                             case UPLOAD_ERR_NO_FILE:
                                 if ($this->getRequired()) {
                                     if (!strlen($foundvalues['imagename'][$index]) && !strlen($foundvalues['answer'][$index])) {
                                         $this->setAlert($lng->txt("form_msg_file_no_upload"));
                                         return false;
                                     }
                                 }
                                 break;
                             case UPLOAD_ERR_NO_TMP_DIR:
                                 $this->setAlert($lng->txt("form_msg_file_missing_tmp_dir"));
                                 return false;
                                 break;
                             case UPLOAD_ERR_CANT_WRITE:
                                 $this->setAlert($lng->txt("form_msg_file_cannot_write_to_disk"));
                                 return false;
                                 break;
                             case UPLOAD_ERR_EXTENSION:
                                 $this->setAlert($lng->txt("form_msg_file_upload_stopped_ext"));
                                 return false;
                                 break;
                         }
                     }
                 }
             }
             if (is_array($_FILES[$this->getPostVar()]['tmp_name']['image'])) {
                 foreach ($_FILES[$this->getPostVar()]['tmp_name']['image'] as $index => $tmpname) {
                     $filename = $_FILES[$this->getPostVar()]['name']['image'][$index];
                     $filename_arr = pathinfo($filename);
                     $suffix = $filename_arr["extension"];
                     // check suffixes
                     if (strlen($tmpname) && is_array($this->getSuffixes())) {
                         $vir = ilUtil::virusHandling($tmpname, $filename);
                         if ($vir[0] == false) {
                             $this->setAlert($lng->txt("form_msg_file_virus_found") . "<br />" . $vir[1]);
                             return false;
                         }
                         if (!in_array(strtolower($suffix), $this->getSuffixes())) {
                             $this->setAlert($lng->txt("form_msg_file_wrong_file_type"));
                             return false;
                         }
                     }
                 }
             }
         }
     }
     return $this->checkSubItemsInput();
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:88,代码来源:class.ilMatchingWizardInputGUI.php

示例4: checkInput

 /**
  * Check input, strip slashes etc. set alert, if input is not ok.
  *
  * @return	boolean		Input ok, true/false
  */
 function checkInput()
 {
     global $lng;
     if (is_array($_POST[$this->getPostVar()])) {
         $_POST[$this->getPostVar()] = ilUtil::stripSlashesRecursive($_POST[$this->getPostVar()]);
     }
     $foundvalues = $_POST[$this->getPostVar()];
     $max_points = 0;
     if (is_array($foundvalues)) {
         // check answers
         if (is_array($foundvalues['key']) && is_array($foundvalues['value'])) {
             foreach ($foundvalues['key'] as $val) {
                 if ($this->getRequired() && strlen($val) == 0) {
                     $this->setAlert($lng->txt("msg_input_is_required"));
                     return FALSE;
                 }
             }
             foreach ($foundvalues['value'] as $val) {
                 if ($this->getRequired() && strlen($val) == 0) {
                     $this->setAlert($lng->txt("msg_input_is_required"));
                     return FALSE;
                 }
             }
             foreach ($foundvalues['points'] as $val) {
                 if ($this->getRequired() && strlen($val) == 0) {
                     $this->setAlert($lng->txt("msg_input_is_required"));
                     return FALSE;
                 }
                 if (!is_numeric(str_replace(",", ".", $val))) {
                     $this->setAlert($lng->txt("form_msg_numeric_value_required"));
                     return FALSE;
                 }
                 if ((double) $val <= 0) {
                     $this->setAlert($lng->txt("positive_numbers_required"));
                     return FALSE;
                 }
             }
         } else {
             if ($this->getRequired()) {
                 $this->setAlert($lng->txt("msg_input_is_required"));
                 return FALSE;
             }
         }
     } else {
         if ($this->getRequired()) {
             $this->setAlert($lng->txt("msg_input_is_required"));
             return FALSE;
         }
     }
     return $this->checkSubItemsInput();
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:56,代码来源:class.ilErrorTextWizardInputGUI.php

示例5: checkInput

 /**
  * Check input, strip slashes etc. set alert, if input is not ok.
  *
  * @return	boolean		Input ok, true/false
  */
 function checkInput()
 {
     global $lng;
     if (is_array($_POST[$this->getPostVar()])) {
         $_POST[$this->getPostVar()] = ilUtil::stripSlashesRecursive($_POST[$this->getPostVar()]);
     }
     $foundvalues = $_POST[$this->getPostVar()];
     if (is_array($foundvalues)) {
         // check answers
         if (is_array($foundvalues['key']) && is_array($foundvalues['value'])) {
             foreach ($foundvalues['key'] as $val) {
                 if ($this->getRequired() && strlen($val) == 0) {
                     $this->setAlert($lng->txt("msg_input_is_required"));
                     return FALSE;
                 }
             }
             foreach ($foundvalues['value'] as $val) {
                 if ($this->getRequired() && strlen($val) == 0) {
                     $this->setAlert($lng->txt("msg_input_is_required"));
                     return FALSE;
                 }
             }
         } else {
             if ($this->getRequired()) {
                 $this->setAlert($lng->txt("msg_input_is_required"));
                 return FALSE;
             }
         }
     } else {
         if ($this->getRequired()) {
             $this->setAlert($lng->txt("msg_input_is_required"));
             return FALSE;
         }
     }
     return $this->checkSubItemsInput();
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:41,代码来源:class.ilKVPWizardInputGUI.php

示例6: checkInput

 /**
  * Check input, strip slashes etc. set alert, if input is not ok.
  *
  * @return	boolean		Input ok, true/false
  */
 function checkInput()
 {
     global $lng;
     if (is_array($_POST[$this->getPostVar()])) {
         $_POST[$this->getPostVar()] = ilUtil::stripSlashesRecursive($_POST[$this->getPostVar()]);
     }
     if (is_array($_FILES[$this->getPostVar()]['error']['image'])) {
         foreach ($_FILES[$this->getPostVar()]['error']['image'] as $index => $error) {
             // error handling
             if ($error > 0) {
                 switch ($error) {
                     case UPLOAD_ERR_INI_SIZE:
                         $this->setAlert($lng->txt("form_msg_file_size_exceeds"));
                         return false;
                         break;
                     case UPLOAD_ERR_FORM_SIZE:
                         $this->setAlert($lng->txt("form_msg_file_size_exceeds"));
                         return false;
                         break;
                     case UPLOAD_ERR_PARTIAL:
                         $this->setAlert($lng->txt("form_msg_file_partially_uploaded"));
                         return false;
                         break;
                     case UPLOAD_ERR_NO_FILE:
                         if ($this->getRequired()) {
                             if (!strlen($_POST[$this->getPostVar()]['imagename'][$index])) {
                                 $this->setAlert($lng->txt("form_msg_file_no_upload"));
                                 return false;
                             }
                         }
                         break;
                     case UPLOAD_ERR_NO_TMP_DIR:
                         $this->setAlert($lng->txt("form_msg_file_missing_tmp_dir"));
                         return false;
                         break;
                     case UPLOAD_ERR_CANT_WRITE:
                         $this->setAlert($lng->txt("form_msg_file_cannot_write_to_disk"));
                         return false;
                         break;
                     case UPLOAD_ERR_EXTENSION:
                         $this->setAlert($lng->txt("form_msg_file_upload_stopped_ext"));
                         return false;
                         break;
                 }
             }
         }
     } else {
         if ($this->getRequired()) {
             $this->setAlert($lng->txt("form_msg_file_no_upload"));
             return false;
         }
     }
     if (is_array($_FILES[$this->getPostVar()]['tmp_name']['image'])) {
         foreach ($_FILES[$this->getPostVar()]['tmp_name']['image'] as $index => $tmpname) {
             $filename = $_FILES[$this->getPostVar()]['name']['image'][$index];
             $filename_arr = pathinfo($filename);
             $suffix = $filename_arr["extension"];
             $mimetype = $_FILES[$this->getPostVar()]['type']['image'][$index];
             $size_bytes = $_FILES[$this->getPostVar()]['size']['image'][$index];
             // check suffixes
             if (strlen($tmpname) && is_array($this->getSuffixes())) {
                 if (!in_array(strtolower($suffix), $this->getSuffixes())) {
                     $this->setAlert($lng->txt("form_msg_file_wrong_file_type"));
                     return false;
                 }
             }
         }
     }
     if (is_array($_FILES[$this->getPostVar()]['tmp_name']['image'])) {
         foreach ($_FILES[$this->getPostVar()]['tmp_name']['image'] as $index => $tmpname) {
             $filename = $_FILES[$this->getPostVar()]['name']['image'][$index];
             $filename_arr = pathinfo($filename);
             $suffix = $filename_arr["extension"];
             $mimetype = $_FILES[$this->getPostVar()]['type']['image'][$index];
             $size_bytes = $_FILES[$this->getPostVar()]['size']['image'][$index];
             // virus handling
             if (strlen($tmpname)) {
                 $vir = ilUtil::virusHandling($tmpname, $filename);
                 if ($vir[0] == false) {
                     $this->setAlert($lng->txt("form_msg_file_virus_found") . "<br />" . $vir[1]);
                     return false;
                 }
             }
         }
     }
     return $this->checkSubItemsInput();
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:92,代码来源:class.ilImageWizardInputGUI.php

示例7: checkInput

 /**
  * Check input, strip slashes etc. set alert, if input is not ok.
  *
  * @return	boolean		Input ok, true/false
  */
 function checkInput()
 {
     global $lng;
     if (is_array($_POST[$this->getPostVar()])) {
         $_POST[$this->getPostVar()] = ilUtil::stripSlashesRecursive($_POST[$this->getPostVar()]);
     }
     $foundvalues = $_POST[$this->getPostVar()];
     if (is_array($foundvalues)) {
         // check answers
         if (is_array($foundvalues['answer'])) {
             foreach ($foundvalues['answer'] as $idx => $answervalue) {
                 if (strlen($answervalue) == 0 && ($this->getRequired() && !$foundvalues['other'][$idx])) {
                     $this->setAlert($lng->txt("msg_input_is_required"));
                     return FALSE;
                 }
             }
         }
     } else {
         $this->setAlert($lng->txt("msg_input_is_required"));
         return FALSE;
     }
     return $this->checkSubItemsInput();
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:28,代码来源:class.ilMatrixRowWizardInputGUI.php

示例8: stripSlashesRecursive

 /**
  * Strip slashes from array and sub-arrays
  * 
  * @static
  * 
  */
 public static function stripSlashesRecursive($a_data, $a_strip_html = true, $a_allow = "")
 {
     if (is_array($a_data)) {
         foreach ($a_data as $k => $v) {
             if (is_array($v)) {
                 $a_data[$k] = ilUtil::stripSlashesRecursive($v, $a_strip_html, $a_allow);
             } else {
                 $a_data[$k] = ilUtil::stripSlashes($v, $a_strip_html, $a_allow);
             }
         }
     } else {
         $a_data = ilUtil::stripSlashes($a_data, $a_strip_html, $a_allow);
     }
     return $a_data;
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:21,代码来源:class.ilUtil.php

示例9: checkInput

 /**
  * Check input, strip slashes etc. set alert, if input is not ok.
  *
  * @return	boolean		Input ok, true/false
  */
 function checkInput()
 {
     global $lng;
     if (is_array($_POST[$this->getPostVar()])) {
         $_POST[$this->getPostVar()] = ilUtil::stripSlashesRecursive($_POST[$this->getPostVar()]);
     }
     $foundvalues = $_POST[$this->getPostVar()];
     if (is_array($foundvalues)) {
         // check answers
         if (is_array($foundvalues['term'])) {
             foreach ($foundvalues['term'] as $val) {
                 if ($this->getRequired() && $val < 1) {
                     $this->setAlert($lng->txt("msg_input_is_required"));
                     return FALSE;
                 }
             }
             foreach ($foundvalues['definition'] as $val) {
                 if ($this->getRequired() && $val < 1) {
                     $this->setAlert($lng->txt("msg_input_is_required"));
                     return FALSE;
                 }
             }
             $max = 0;
             foreach ($foundvalues['points'] as $val) {
                 if ($val > 0) {
                     $max += $val;
                 }
                 if ($this->getRequired() && strlen($val) == 0) {
                     $this->setAlert($lng->txt("msg_input_is_required"));
                     return FALSE;
                 }
             }
             if ($max <= 0) {
                 $this->setAlert($lng->txt("enter_enough_positive_points"));
                 return FALSE;
             }
         } else {
             if ($this->getRequired()) {
                 $this->setAlert($lng->txt("msg_input_is_required"));
                 return FALSE;
             }
         }
     } else {
         if ($this->getRequired()) {
             $this->setAlert($lng->txt("msg_input_is_required"));
             return FALSE;
         }
     }
     return $this->checkSubItemsInput();
 }
开发者ID:bheyser,项目名称:qplskl,代码行数:55,代码来源:class.ilMatchingPairWizardInputGUI.php

示例10: checkInput

 public function checkInput()
 {
     $error = false;
     $json = json_decode(ilUtil::stripSlashes($_POST['gap_json_post']));
     $_POST['gap'] = ilUtil::stripSlashesRecursive($_POST['gap']);
     $gaps_used_in_combination = array();
     if (array_key_exists('gap_combination', $_POST)) {
         $_POST['gap_combination'] = ilUtil::stripSlashesRecursive($_POST['gap_combination']);
         $_POST['gap_combination_values'] = ilUtil::stripSlashesRecursive($_POST['gap_combination_values']);
         $gap_with_points = array();
         for ($i = 0; $i < count($_POST['gap_combination']['select']); $i++) {
             foreach ($_POST['gap_combination']['select'][$i] as $key => $item) {
                 if ($item == 'none_selected_minus_one') {
                     return false;
                 }
                 $gaps_used_in_combination[$item] = $item;
                 $check_points_for_best_scoring = false;
                 foreach ($_POST['gap_combination_values'][$i] as $index => $answeritems) {
                     foreach ($answeritems as $answeritem) {
                         if ($answeritem == 'none_selected_minus_one') {
                             return false;
                         }
                     }
                     $points = $_POST['gap_combination']['points'][$i][$index];
                     if ($points > 0) {
                         $check_points_for_best_scoring = true;
                     }
                 }
                 if (!$check_points_for_best_scoring) {
                     return false;
                 }
             }
         }
     }
     if (isset($_POST['gap']) && is_array($_POST['gap'])) {
         foreach ($_POST['gap'] as $key => $item) {
             $_POST['clozetype_' . $key] = ilUtil::stripSlashes($_POST['clozetype_' . $key]);
             $getType = $_POST['clozetype_' . $key];
             $gapsize = $_POST['gap_' . $key . '_gapsize'];
             $json[0][$key]->text_field_length = $gapsize > 0 ? $gapsize : '';
             if ($getType == CLOZE_TEXT || $getType == CLOZE_SELECT) {
                 $_POST['gap_' . $key] = ilUtil::stripSlashesRecursive($_POST['gap_' . $key]);
                 $gapText = $_POST['gap_' . $key];
                 foreach ($gapText['answer'] as $row => $answer) {
                     if (!isset($answer) || $answer == '') {
                         $error = true;
                     }
                 }
                 $points_sum = 0;
                 if (array_key_exists('points', $gapText)) {
                     foreach ($gapText['points'] as $row => $points) {
                         if (isset($points) && $points != '' && is_numeric($points)) {
                             $points_sum += $points;
                         } else {
                             $error = true;
                         }
                     }
                     if (is_array($gap_with_points) && array_key_exists($key, $gap_with_points)) {
                         $points_sum += $gap_with_points[$key];
                     }
                     if ($points_sum == 0) {
                         if (!array_key_exists($key, $gaps_used_in_combination)) {
                             $error = true;
                         }
                     }
                     if ($getType == CLOZE_SELECT) {
                         $_POST['shuffle_' . $key] = ilUtil::stripSlashes($_POST['shuffle_' . $key]);
                         if (!isset($_POST['shuffle_' . $key])) {
                             $error = true;
                         }
                     }
                 } else {
                     $error = true;
                 }
             }
             if ($getType == CLOZE_NUMERIC) {
                 $_POST['gap_' . $key . 'numeric'] = ilUtil::stripSlashes($_POST['gap_' . $key . 'numeric'], FALSE);
                 $_POST['gap_' . $key . 'numeric_lower'] = ilUtil::stripSlashes($_POST['gap_' . $key . 'numeric_lower'], FALSE);
                 $_POST['gap_' . $key . 'numeric_upper'] = ilUtil::stripSlashes($_POST['gap_' . $key . 'numeric_upper'], FALSE);
                 $_POST['gap_' . $key . 'numeric_points'] = ilUtil::stripSlashes($_POST['gap_' . $key . 'numeric_points']);
                 $mark_errors = array('answer' => false, 'lower' => false, 'upper' => false, 'points' => false);
                 $eval = new EvalMath();
                 $eval->suppress_errors = true;
                 $formula = $_POST['gap_' . $key . '_numeric'];
                 $result = $eval->e(str_replace(',', '.', $_POST['gap_' . $key . '_numeric'], $formula));
                 if ($result === false) {
                     $error = true;
                 }
                 $lower = $_POST['gap_' . $key . '_numeric_lower'];
                 $assClozeTestObject = new assClozeTest();
                 $has_valid_chars = $assClozeTestObject->checkForValidFormula($lower);
                 $result = $eval->e(str_replace(',', '.', $lower), FALSE);
                 if ($result === false || !$has_valid_chars) {
                     $error = true;
                 }
                 $_POST['gap_' . $key . '_numeric_lower'] = $result;
                 $result = $eval->e(str_replace(',', '.', $_POST['gap_' . $key . '_numeric_upper']), FALSE);
                 if ($result === false) {
                     $error = true;
                 }
//.........这里部分代码省略.........
开发者ID:bheyser,项目名称:qplskl,代码行数:101,代码来源:class.ilClozeGapInputBuilderGUI.php

示例11: writeAnswerSpecificPostData

 public function writeAnswerSpecificPostData(ilPropertyFormGUI $form)
 {
     if (is_array($_POST['gap'])) {
         if ($this->ctrl->getCmd() != 'createGaps') {
             $this->object->clearGapAnswers();
         }
         foreach ($_POST['gap'] as $idx => $hidden) {
             $clozetype = $_POST['clozetype_' . $idx];
             $this->object->setGapType($idx, $clozetype);
             switch ($clozetype) {
                 case CLOZE_TEXT:
                     $this->object->setGapShuffle($idx, 0);
                     if ($this->ctrl->getCmd() != 'createGaps') {
                         if (is_array($_POST['gap_' . $idx]['answer'])) {
                             foreach ($_POST['gap_' . $idx]['answer'] as $order => $value) {
                                 $this->object->addGapAnswer($idx, $order, $value);
                             }
                         } else {
                             $this->object->addGapAnswer($idx, 0, '');
                         }
                     }
                     if (is_array($_POST['gap_' . $idx]['points'])) {
                         foreach ($_POST['gap_' . $idx]['points'] as $order => $value) {
                             $this->object->setGapAnswerPoints($idx, $order, $value);
                         }
                     }
                     if (array_key_exists('gap_' . $idx . '_gapsize', $_POST)) {
                         $this->object->setGapSize($idx, $order, $_POST['gap_' . $idx . '_gapsize']);
                     }
                     break;
                 case CLOZE_SELECT:
                     $this->object->setGapShuffle($idx, (int) (isset($_POST["shuffle_{$idx}"]) && $_POST["shuffle_{$idx}"]));
                     if ($this->ctrl->getCmd() != 'createGaps') {
                         if (is_array($_POST['gap_' . $idx]['answer'])) {
                             foreach ($_POST['gap_' . $idx]['answer'] as $order => $value) {
                                 $this->object->addGapAnswer($idx, $order, $value);
                             }
                         } else {
                             $this->object->addGapAnswer($idx, 0, '');
                         }
                     }
                     if (is_array($_POST['gap_' . $idx]['points'])) {
                         foreach ($_POST['gap_' . $idx]['points'] as $order => $value) {
                             $this->object->setGapAnswerPoints($idx, $order, $value);
                         }
                     }
                     break;
                 case CLOZE_NUMERIC:
                     $this->object->setGapShuffle($idx, 0);
                     $gap = $this->object->getGap($idx);
                     if (!$gap) {
                         break;
                     }
                     $this->object->getGap($idx)->clearItems();
                     if (array_key_exists('gap_' . $idx . '_numeric', $_POST)) {
                         if ($this->ctrl->getCmd() != 'createGaps') {
                             $this->object->addGapAnswer($idx, 0, str_replace(",", ".", $_POST['gap_' . $idx . '_numeric']));
                         }
                         $this->object->setGapAnswerLowerBound($idx, 0, str_replace(",", ".", $_POST['gap_' . $idx . '_numeric_lower']));
                         $this->object->setGapAnswerUpperBound($idx, 0, str_replace(",", ".", $_POST['gap_' . $idx . '_numeric_upper']));
                         $this->object->setGapAnswerPoints($idx, 0, $_POST['gap_' . $idx . '_numeric_points']);
                     } else {
                         if ($this->ctrl->getCmd() != 'createGaps') {
                             $this->object->addGapAnswer($idx, 0, '');
                         }
                         $this->object->setGapAnswerLowerBound($idx, 0, '');
                         $this->object->setGapAnswerUpperBound($idx, 0, '');
                     }
                     if (array_key_exists('gap_' . $idx . '_gapsize', $_POST)) {
                         $this->object->setGapSize($idx, $order, $_POST['gap_' . $idx . '_gapsize']);
                     }
                     break;
             }
             $assClozeGapCombinationObject = new assClozeGapCombination();
             $assClozeGapCombinationObject->clearGapCombinationsFromDb($this->object->getId());
             if (count($_POST['gap_combination']) > 0) {
                 $assClozeGapCombinationObject->saveGapCombinationToDb($this->object->getId(), ilUtil::stripSlashesRecursive($_POST['gap_combination']), ilUtil::stripSlashesRecursive($_POST['gap_combination_values']));
             }
         }
         if ($this->ctrl->getCmd() != 'createGaps') {
             $this->object->updateClozeTextFromGaps();
         }
     }
 }
开发者ID:bheyser,项目名称:qplskl,代码行数:84,代码来源:class.assClozeTestGUI.php

示例12: checkInput

 /**
  * Check input, strip slashes etc. set alert, if input is not ok.
  *
  * @return	boolean		Input ok, true/false
  */
 function checkInput()
 {
     global $lng;
     if (is_array($_POST[$this->getPostVar()])) {
         $_POST[$this->getPostVar()] = ilUtil::stripSlashesRecursive($_POST[$this->getPostVar()]);
     }
     $foundvalues = $_POST[$this->getPostVar()];
     if (is_array($foundvalues)) {
         // check answers
         if (is_array($foundvalues['answer'])) {
             foreach ($foundvalues['answer'] as $idx => $answervalue) {
                 if (strlen($answervalue) == 0 && ($this->getRequired() && !$foundvalues['other'][$idx])) {
                     $this->setAlert($lng->txt("msg_input_is_required"));
                     return FALSE;
                 }
             }
         }
         // check neutral column
         if (array_key_exists('neutral', $foundvalues)) {
             if (strlen($foundvalues['neutral']) == 0 && $this->getRequired) {
                 $this->setAlert($lng->txt("msg_input_is_required"));
                 return false;
             }
         }
         // check scales
         if (is_array($foundvalues['scale'])) {
             foreach ($foundvalues['scale'] as $scale) {
                 if (strlen($scale) == 0) {
                     $this->setAlert($lng->txt("msg_input_is_required"));
                     return FALSE;
                 }
             }
         }
         // check scales
         if (is_array($foundvalues['scale'])) {
             if (count(array_unique($foundvalues['scale'])) != count($foundvalues['scale'])) {
                 $this->setAlert($lng->txt("msg_duplicate_scale"));
                 return FALSE;
             }
         }
         // check neutral column scale
         if (strlen($_POST[$this->postvar . '_neutral_scale'])) {
             if (is_array($foundvalues['scale'])) {
                 if (in_array($_POST[$this->postvar . '_neutral_scale'], $foundvalues['scale'])) {
                     $this->setAlert($lng->txt("msg_duplicate_scale"));
                     return FALSE;
                 }
             }
         }
     } else {
         $this->setAlert($lng->txt("msg_input_is_required"));
         return FALSE;
     }
     return $this->checkSubItemsInput();
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:60,代码来源:class.ilCategoryWizardInputGUI.php

示例13: checkInput

 /**
  * Check input, strip slashes etc. set alert, if input is not ok.
  *
  * @return	boolean		Input ok, true/false
  */
 function checkInput()
 {
     global $lng;
     if (is_array($_POST[$this->getPostVar()])) {
         $_POST[$this->getPostVar()] = ilUtil::stripSlashesRecursive($_POST[$this->getPostVar()]);
     }
     // remove trailing '/'
     while (substr($_FILES[$this->getPostVar()]["name"], -1) == '/') {
         $_FILES[$this->getPostVar()]["name"] = substr($_FILES[$this->getPostVar()]["name"], 0, -1);
     }
     $filename = $_FILES[$this->getPostVar()]["name"];
     $filename_arr = pathinfo($_FILES[$this->getPostVar()]["name"]);
     $suffix = $filename_arr["extension"];
     $mimetype = $_FILES[$this->getPostVar()]["type"];
     $size_bytes = $_FILES[$this->getPostVar()]["size"];
     $temp_name = $_FILES[$this->getPostVar()]["tmp_name"];
     $error = $_FILES[$this->getPostVar()]["error"];
     // error handling
     if ($error > 0) {
         switch ($error) {
             case UPLOAD_ERR_INI_SIZE:
                 $this->setAlert($lng->txt("form_msg_file_size_exceeds"));
                 return false;
                 break;
             case UPLOAD_ERR_FORM_SIZE:
                 $this->setAlert($lng->txt("form_msg_file_size_exceeds"));
                 return false;
                 break;
             case UPLOAD_ERR_PARTIAL:
                 $this->setAlert($lng->txt("form_msg_file_partially_uploaded"));
                 return false;
                 break;
             case UPLOAD_ERR_NO_FILE:
                 if ($this->getRequired()) {
                     if (!strlen($this->getValue())) {
                         $this->setAlert($lng->txt("form_msg_file_no_upload"));
                         return false;
                     }
                 }
                 break;
             case UPLOAD_ERR_NO_TMP_DIR:
                 $this->setAlert($lng->txt("form_msg_file_missing_tmp_dir"));
                 return false;
                 break;
             case UPLOAD_ERR_CANT_WRITE:
                 $this->setAlert($lng->txt("form_msg_file_cannot_write_to_disk"));
                 return false;
                 break;
             case UPLOAD_ERR_EXTENSION:
                 $this->setAlert($lng->txt("form_msg_file_upload_stopped_ext"));
                 return false;
                 break;
         }
     }
     // check suffixes
     if ($_FILES[$this->getPostVar()]["tmp_name"] != "" && is_array($this->getSuffixes())) {
         if (!in_array(strtolower($suffix), $this->getSuffixes())) {
             $this->setAlert($lng->txt("form_msg_file_wrong_file_type"));
             return false;
         }
     }
     // virus handling
     if ($_FILES[$this->getPostVar()]["tmp_name"] != "") {
         $vir = ilUtil::virusHandling($temp_name, $filename);
         if ($vir[0] == false) {
             $this->setAlert($lng->txt("form_msg_file_virus_found") . "<br />" . $vir[1]);
             return false;
         }
     }
     $max = 0;
     if (is_array($_POST[$this->getPostVar()]['coords']['name'])) {
         foreach ($_POST[$this->getPostVar()]['coords']['name'] as $idx => $name) {
             if (!strlen($_POST[$this->getPostVar()]['coords']['points'][$idx]) && $this->getRequired) {
                 $this->setAlert($lng->txt('form_msg_area_missing_points'));
                 return false;
             }
             if (!is_numeric($_POST[$this->getPostVar()]['coords']['points'][$idx])) {
                 $this->setAlert($lng->txt('form_msg_numeric_value_required'));
                 return false;
             }
             if ($_POST[$this->getPostVar()]['coords']['points'][$idx] > 0) {
                 $max = $_POST[$this->getPostVar()]['coords']['points'][$idx];
             }
         }
     }
     if ($max == 0 && !$filename) {
         $this->setAlert($lng->txt("enter_enough_positive_points"));
         return false;
     }
     return true;
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:96,代码来源:class.ilImagemapFileInputGUI.php


注:本文中的ilUtil::stripSlashesRecursive方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。