本文整理汇总了PHP中ilUtil::stripOnlySlashes方法的典型用法代码示例。如果您正苦于以下问题:PHP ilUtil::stripOnlySlashes方法的具体用法?PHP ilUtil::stripOnlySlashes怎么用?PHP ilUtil::stripOnlySlashes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilUtil
的用法示例。
在下文中一共展示了ilUtil::stripOnlySlashes方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAgreementTextByFilenameAsynch
/**
*
*/
protected function getAgreementTextByFilenameAsynch()
{
/**
* @var $rbacsystem ilRbacSystem
*/
global $rbacsystem;
require_once 'Services/TermsOfService/classes/class.ilTermsOfServiceJsonResponse.php';
$response = new ilTermsOfServiceJsonResponse();
if (!isset($_GET['agreement_document']) || !strlen($_GET['agreement_document']) || !$rbacsystem->checkAccess('read', $this->object->getRefId())) {
$response->setStatus(ilTermsOfServiceJsonResponse::STATUS_FAILURE);
echo $response;
}
$file = realpath(strip_tags(rawurldecode(ilUtil::stripOnlySlashes($_GET['agreement_document']))));
if (preg_match('/Customizing[\\/\\\\](global[\\/\\\\]agreement|clients[\\/\\\\]' . CLIENT_ID . '[\\/\\\\]agreement)[\\/\\\\]agreement_([a-z]{2})\\.html$/', $file)) {
$response->setBody(nl2br(trim(file_get_contents($file))));
} else {
$response->setStatus(ilTermsOfServiceJsonResponse::STATUS_FAILURE);
}
echo $response;
}
示例2: submitFormDefinition
/**
* Submit the definition form
*/
function submitFormDefinition()
{
global $ilCtrl, $ilTabs, $lng, $tpl;
$ilCtrl->saveParameter($this, 'type_id');
$ilTabs->activateSubTab('type_definition');
$xml = ilUtil::stripOnlySlashes($_POST['xml']);
$this->initFormDefinition($xml);
$this->form->checkInput();
$message = "";
if (!$this->type->setXML($xml, $message)) {
$this->form->setValuesByPost();
ilUtil::sendFailure($this->txt('type_failure_xml') . '<br />' . $message, false);
$style = "<style>#il_prop_cont_ {display:none;}</style>";
$tpl->setContent($style . $this->form->getHTML());
return;
}
$this->type->update();
ilUtil::sendSuccess($this->txt('type_updated'), true);
$ilCtrl->redirect($this, 'editDefinition');
}
示例3: writePostData
/**
* Evaluates a posted edit form and writes the form data in the question object
* (called frm generic commands in assQuestionGUI)
*
* @return integer 0: question can be saved / 1: form is not complete
*/
public function writePostData($always = false)
{
$this->initQuestionForm();
if ($this->form->checkInput()) {
$error = '';
// write the basic data
$this->writeQuestionGenericPostData();
// get the acccounts definition either by file upload or post
if (file_exists($_FILES["accounts_file"]["tmp_name"])) {
$accounts_xml = file_get_contents($_FILES["accounts_file"]["tmp_name"]);
} else {
$accounts_xml = ilUtil::stripOnlySlashes($_POST['accounts_xml']);
}
// check the accounts definition but save it anyway
if (!$this->object->analyzeAccountsXML($accounts_xml, false)) {
$error .= sprintf($this->plugin->txt('xml_accounts_error'));
}
$this->object->setAccountsXML($accounts_xml);
// sort the part positions
$positions = array();
foreach ($_POST['parts'] as $part_id) {
$positions[$part_id] = $_POST['position_' . $part_id];
}
asort($positions, SORT_NUMERIC);
// set the part data
$i = 1;
foreach ($positions as $part_id => $pos) {
if ($part_id == 0 and $pos == '') {
// add a new part to the end
$pos = count($positions);
} else {
// set the position to the counter
$pos = $i++;
}
// save the question part
// a new part object is be created if part_id is 0
$part_obj = $this->object->getPart($part_id);
$part_obj->setText($this->form->getInput('text_' . $part_id));
$part_obj->setPosition($pos);
if ($_FILES["booking_file_" . $part_id]["tmp_name"]) {
$booking_xml = file_get_contents($_FILES["booking_file_" . $part_id]["tmp_name"]);
} else {
$booking_xml = ilUtil::stripOnlySlashes($_POST['booking_xml_' . $part_id]);
}
// check the booking definition but save it anyway
if (!$part_obj->analyzeBookingXML($booking_xml, false)) {
$error .= sprintf($this->plugin->txt('xml_booking_error'), $pos);
}
$part_obj->setBookingXML($booking_xml);
}
if ($error != '') {
ilUtil::sendFailure($error, true);
}
// save taxonomy assignment
$this->saveTaxonomyAssignments();
// indicator to save the question
return 0;
} else {
// indicator to show the edit form with errors
return 1;
}
}
示例4: 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 ($this->usePurifier() && $this->getPurifier()) {
$_POST[$this->getPostVar()] = ilUtil::stripOnlySlashes($_POST[$this->getPostVar()]);
$_POST[$this->getPostVar()] = $this->getPurifier()->purify($_POST[$this->getPostVar()]);
} else {
$allowed = $this->getRteTagString();
if ($this->plugins["latex"] == "latex" && !is_int(strpos($allowed, "<span>"))) {
$allowed .= "<span>";
}
$_POST[$this->getPostVar()] = $this->getUseRte() || !$this->getUseTagsForRteOnly() ? ilUtil::stripSlashes($_POST[$this->getPostVar()], true, $allowed) : ilUtil::stripSlashes($_POST[$this->getPostVar()]);
}
if ($this->getRequired() && trim($_POST[$this->getPostVar()]) == "") {
$this->setAlert($lng->txt("msg_input_is_required"));
return false;
}
return $this->checkSubItemsInput();
}
示例5: writePostData
/**
* Evaluates a posted edit form and writes the form data in the question object
* @return integer A positive value, if one of the required fields wasn't set, else 0
*/
public function writePostData($always = false)
{
$hasErrors = !$always ? $this->editQuestion(true) : false;
$checked = true;
if (!$hasErrors) {
$this->object->setTitle($_POST["title"]);
$this->object->setAuthor($_POST["author"]);
$this->object->setComment($_POST["comment"]);
include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
$questiontext = ilUtil::stripOnlySlashes($_POST["question"]);
$this->object->setQuestion($questiontext);
$this->object->setEstimatedWorkingTime($_POST["Estimated"]["hh"], $_POST["Estimated"]["mm"], $_POST["Estimated"]["ss"]);
$this->object->parseQuestionText();
$found_vars = array();
$found_results = array();
foreach ($_POST as $key => $value) {
if (preg_match("/^unit_(\\\$v\\d+)\$/", $key, $matches)) {
array_push($found_vars, $matches[1]);
}
if (preg_match("/^unit_(\\\$r\\d+)\$/", $key, $matches)) {
array_push($found_results, $matches[1]);
}
}
// if(!$this->object->checkForDuplicateVariables())
// {
//
// $this->addErrorMessage($this->lng->txt("err_duplicate_variables"));
// $checked = FALSE;
// }
if (!$this->object->checkForDuplicateResults()) {
$this->addErrorMessage($this->lng->txt("err_duplicate_results"));
$checked = FALSE;
}
foreach ($found_vars as $variable) {
if ($this->object->getVariable($variable) != null) {
$varObj = new assFormulaQuestionVariable($variable, $_POST["range_min_{$variable}"], $_POST["range_max_{$variable}"], $this->object->getUnitrepository()->getUnit($_POST["unit_{$variable}"]), $_POST["precision_{$variable}"], $_POST["intprecision_{$variable}"]);
$varObj->setRangeMinTxt($_POST["range_min_{$variable}"]);
$varObj->setRangeMaxTxt($_POST["range_max_{$variable}"]);
$this->object->addVariable($varObj);
}
}
$tmp_form_vars = array();
$tmp_quest_vars = array();
foreach ($found_results as $result) {
$tmp_res_match = preg_match_all("/([\$][v][0-9]*)/", $_POST["formula_{$result}"], $form_vars);
$tmp_form_vars = array_merge($tmp_form_vars, $form_vars[0]);
$tmp_que_match = preg_match_all("/([\$][v][0-9]*)/", $_POST['question'], $quest_vars);
$tmp_quest_vars = array_merge($tmp_quest_vars, $quest_vars[0]);
}
$result_has_undefined_vars = array_diff($tmp_form_vars, $found_vars);
$question_has_unused_vars = array_diff($tmp_quest_vars, $tmp_form_vars);
if (count($result_has_undefined_vars) > 0 || count($question_has_unused_vars) > 0) {
$error_message = '';
if (count($result_has_undefined_vars) > 0) {
$error_message .= $this->lng->txt("res_contains_undef_var") . '<br>';
}
if (count($question_has_unused_vars) > 0) {
$error_message .= $this->lng->txt("que_contains_unused_var");
}
$checked = false;
if ($this->isSaveCommand()) {
ilUtil::sendFailure($error_message);
}
}
foreach ($found_results as $result) {
if (is_object($this->object->getUnitrepository()->getUnit($_POST["unit_{$result}"]))) {
$tmp_result_unit = $this->object->getUnitrepository()->getUnit($_POST["unit_{$result}"]);
} else {
$tmp_result_unit = NULL;
}
if ($this->object->getResult($result) != null) {
$use_simple_rating = $_POST["rating_advanced_{$result}"] == 1 ? FALSE : TRUE;
$resObj = new assFormulaQuestionResult($result, $_POST["range_min_{$result}"], $_POST["range_max_{$result}"], $_POST["tolerance_{$result}"], $tmp_result_unit, $_POST["formula_{$result}"], $_POST["points_{$result}"], $_POST["precision_{$result}"], $use_simple_rating, $_POST["rating_advanced_{$result}"] == 1 ? $_POST["rating_sign_{$result}"] : "", $_POST["rating_advanced_{$result}"] == 1 ? $_POST["rating_value_{$result}"] : "", $_POST["rating_advanced_{$result}"] == 1 ? $_POST["rating_unit_{$result}"] : "", $_POST["result_type_{$result}"] != 0 ? $_POST["result_type_{$result}"] : 0);
$resObj->setRangeMinTxt($_POST["range_min_{$result}"]);
$resObj->setRangeMaxTxt($_POST["range_max_{$result}"]);
$this->object->addResult($resObj);
$this->object->addResultUnits($resObj, $_POST["units_{$result}"]);
}
}
if ($checked == false) {
return 1;
} else {
$this->resetSavedPreviewSession();
return 0;
}
} else {
return 1;
}
}
示例6: writeQuestionGenericPostData
protected function writeQuestionGenericPostData()
{
$this->object->setTitle($_POST["title"]);
$this->object->setAuthor($_POST["author"]);
$this->object->setComment($_POST["comment"]);
if ($this->object->getSelfAssessmentEditingMode()) {
$this->object->setNrOfTries($_POST['nr_of_tries']);
}
$this->object->setQuestion(ilUtil::stripOnlySlashes($_POST['question']));
// ?
$this->object->setEstimatedWorkingTime($_POST["Estimated"]["hh"], $_POST["Estimated"]["mm"], $_POST["Estimated"]["ss"]);
}