本文整理汇总了PHP中ilUtil::stripSlashes方法的典型用法代码示例。如果您正苦于以下问题:PHP ilUtil::stripSlashes方法的具体用法?PHP ilUtil::stripSlashes怎么用?PHP ilUtil::stripSlashes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilUtil
的用法示例。
在下文中一共展示了ilUtil::stripSlashes方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeDefault
/**
* 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;
}
示例2: getItems
/**
* 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: fillRow
/**
* 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;
}
}
}
示例4: checkInput
/**
* 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();
}
示例5: searchModerators
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: open
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");
}
示例7: checkInput
function checkInput()
{
if (!is_array($_POST[$this->getPostVar()])) {
$_POST[$this->getPostVar()] = ilUtil::stripSlashes($_POST[$this->getPostVar()]);
}
return $this->checkSubItemsInput();
}
示例8: getItems
/**
* 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);
}
示例9: checkInput
/**
* 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();
}
示例10: getRequestParams
protected function getRequestParams()
{
$this->params = array();
foreach ($_REQUEST as $name => $value) {
$this->params[$name] = ilUtil::stripSlashes(urldecode($value));
}
}
示例11: checkInput
/**
* 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;
}
示例12: _lookupVersion
/**
* 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: saveMarkSchemaFormData
/**
* 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: checkInput
/**
* 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;
}
示例15: checkInput
/**
* 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;
}