本文整理汇总了PHP中stripslashes_recursive函数的典型用法代码示例。如果您正苦于以下问题:PHP stripslashes_recursive函数的具体用法?PHP stripslashes_recursive怎么用?PHP stripslashes_recursive使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了stripslashes_recursive函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: noslashes_recursive
/**
* Undoes any magic quote slashing from an array, like the GET or POST
* @param array $a Probably either $_GET or $_POST or $_COOKIES
* @return array The array with all of the values in it noslashed
*
* In many cases, this can be a drop-in replacement for stripslashes_recursive
* since this is what we typically use stripslashes_recursive for. This is
* somewhat different in that if we ever turn off magic quotes, it will still
* behave correctly and not double stripslashes.
*
*/
function noslashes_recursive($a)
{
if (get_magic_quotes_gpc()) {
$a = stripslashes_recursive($a);
}
return $a;
}
开发者ID:luxurymask,项目名称:platform,代码行数:18,代码来源:strings.php
示例2: remove_magic_quotes
function remove_magic_quotes()
{
if (get_magic_quotes_gpc()) {
$_GET = stripslashes_recursive($_GET);
$_POST = stripslashes_recursive($_POST);
}
}
开发者ID:thanush,项目名称:master_autoindex,代码行数:7,代码来源:functions.php
示例3: useredit_update_user_preference
function useredit_update_user_preference($usernew)
{
$ua = (array) $usernew;
foreach ($ua as $key => $value) {
if (strpos($key, 'preference_') === 0) {
$name = substr($key, strlen('preference_'));
set_user_preference($name, stripslashes_recursive($value), $usernew->id);
}
}
}
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:10,代码来源:editlib.php
示例4: stripslashes_recursive
function stripslashes_recursive($value)
{
if (is_array($value)) {
foreach ($value as $index => $val) {
$value[$index] = stripslashes_recursive($val);
}
return $value;
} else {
return stripslashes($value);
}
}
开发者ID:joksnet,项目名称:php-old,代码行数:11,代码来源:db.php
示例5: form_process_data
function form_process_data($cform)
{
if ($this->form) {
$data = $cform->get_data();
// cr_serialize() will add slashes
$data = stripslashes_recursive($data);
$components = cr_unserialize($this->config->components);
$components['columns']['config'] = $data;
$this->config->components = cr_serialize($components);
update_record('block_configurable_reports_report', $this->config);
}
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:12,代码来源:component.class.php
示例6: checklist_update_instance
/**
* Given an object containing all the necessary data,
* (defined by the form in mod_form.php) this function
* will update an existing instance with new data.
*
* @param object $checklist An object from the form in mod_form.php
* @return boolean Success/Fail
*/
function checklist_update_instance($checklist)
{
$checklist->timemodified = time();
$checklist->id = $checklist->instance;
$returnid = update_record('checklist', $checklist);
// Add or remove all calendar events, as needed
$course = get_record('course', 'id', $checklist->course);
$cm = get_coursemodule_from_instance('checklist', $checklist->id, $course->id);
$chk = new checklist_class($cm->id, 0, $checklist, $cm, $course);
$chk->setallevents();
$checklist = stripslashes_recursive($checklist);
checklist_grade_item_update($checklist);
return $returnid;
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:22,代码来源:lib.php
示例7: glossary_update_instance
function glossary_update_instance($glossary)
{
/// Given an object containing all the necessary data,
/// (defined by the form in mod.html) this function
/// will update an existing instance with new data.
global $CFG;
if (empty($glossary->globalglossary)) {
$glossary->globalglossary = 0;
}
if (!has_capability('mod/glossary:manageentries', get_context_instance(CONTEXT_SYSTEM))) {
// keep previous
unset($glossary->globalglossary);
}
$glossary->timemodified = time();
$glossary->id = $glossary->instance;
if (empty($glossary->userating)) {
$glossary->assessed = 0;
}
if (empty($glossary->ratingtime) or empty($glossary->assessed)) {
$glossary->assesstimestart = 0;
$glossary->assesstimefinish = 0;
}
//Check displayformat is a valid one
$formats = get_list_of_plugins('mod/glossary/formats', 'TEMPLATE');
if (!in_array($glossary->displayformat, $formats)) {
error("This format doesn't exist!");
}
if ($return = update_record("glossary", $glossary)) {
if ($glossary->defaultapproval) {
execute_sql("update {$CFG->prefix}glossary_entries SET approved = 1 where approved != 1 and glossaryid = " . $glossary->id, false);
}
$glossary = stripslashes_recursive($glossary);
glossary_grade_item_update($glossary);
}
return $return;
}
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:36,代码来源:lib.php
示例8: update_instance
/**
* Updates a new assignment activity
*
* Given an object containing all the necessary data,
* (defined by the form in mod.html) this function
* will update the assignment instance and return the id number
* The due date is updated in the calendar
* This is common to all assignment types.
*
* @param $assignment object The data from the form on mod.html
* @return int The assignment id
*/
function update_instance($assignment)
{
global $COURSE;
$assignment->timemodified = time();
$assignment->id = $assignment->instance;
$assignment->courseid = $assignment->course;
if (!update_record('assignment', $assignment)) {
return false;
}
if ($assignment->timedue) {
$event = new object();
if ($event->id = get_field('event', 'id', 'modulename', 'assignment', 'instance', $assignment->id)) {
$event->name = $assignment->name;
$event->description = $assignment->description;
$event->timestart = $assignment->timedue;
update_event($event);
} else {
$event = new object();
$event->name = $assignment->name;
$event->description = $assignment->description;
$event->courseid = $assignment->course;
$event->groupid = 0;
$event->userid = 0;
$event->modulename = 'assignment';
$event->instance = $assignment->id;
$event->eventtype = 'due';
$event->timestart = $assignment->timedue;
$event->timeduration = 0;
add_event($event);
}
} else {
delete_records('event', 'modulename', 'assignment', 'instance', $assignment->id);
}
// get existing grade item
$assignment = stripslashes_recursive($assignment);
assignment_grade_item_update($assignment);
return true;
}
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:50,代码来源:lib.php
示例9: process_config
/**
* Processes and stores configuration data for this authentication plugin.
*/
function process_config($config)
{
// set to defaults if undefined
if (!isset($config->host)) {
$config->host = 'localhost';
}
if (!isset($config->type)) {
$config->type = 'mysql';
}
if (!isset($config->sybasequoting)) {
$config->sybasequoting = 0;
}
if (!isset($config->name)) {
$config->name = '';
}
if (!isset($config->user)) {
$config->user = '';
}
if (!isset($config->pass)) {
$config->pass = '';
}
if (!isset($config->table)) {
$config->table = '';
}
if (!isset($config->fielduser)) {
$config->fielduser = '';
}
if (!isset($config->fieldpass)) {
$config->fieldpass = '';
}
if (!isset($config->passtype)) {
$config->passtype = 'plaintext';
}
if (!isset($config->extencoding)) {
$config->extencoding = 'utf-8';
}
if (!isset($config->setupsql)) {
$config->setupsql = '';
}
if (!isset($config->debugauthdb)) {
$config->debugauthdb = 0;
}
if (!isset($config->removeuser)) {
$config->removeuser = 0;
}
if (!isset($config->changepasswordurl)) {
$config->changepasswordurl = '';
}
$config = stripslashes_recursive($config);
// save settings
set_config('host', $config->host, 'auth/db');
set_config('type', $config->type, 'auth/db');
set_config('sybasequoting', $config->sybasequoting, 'auth/db');
set_config('name', $config->name, 'auth/db');
set_config('user', $config->user, 'auth/db');
set_config('pass', $config->pass, 'auth/db');
set_config('table', $config->table, 'auth/db');
set_config('fielduser', $config->fielduser, 'auth/db');
set_config('fieldpass', $config->fieldpass, 'auth/db');
set_config('passtype', $config->passtype, 'auth/db');
set_config('extencoding', trim($config->extencoding), 'auth/db');
set_config('setupsql', trim($config->setupsql), 'auth/db');
set_config('debugauthdb', $config->debugauthdb, 'auth/db');
set_config('removeuser', $config->removeuser, 'auth/db');
set_config('changepasswordurl', trim($config->changepasswordurl), 'auth/db');
return true;
}
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:70,代码来源:auth.php
示例10: game_after_add_or_update
/**
* This function is called at the end of game_add_instance
* and game_update_instance, to do the common processing.
*
* @param object $game the game object.
*/
function game_after_add_or_update($game)
{
//update related grade item
game_grade_item_update(stripslashes_recursive($game));
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:11,代码来源:lib.php
示例11: stripslashes_recursive
$response->setError(1404, 'Operation not found: ' . $operation);
}
if ($response !== false) {
echo $response->emitJSON();
}
}
}
/** Take care of stripping the slashes */
function stripslashes_recursive($value)
{
$value = is_array($value) ? array_map('stripslashes_recursive', $value) : stripslashes($value);
return $value;
}
/** END **/
if (!defined('MOBILE_API_CONTROLLER_AVOID_TRIGGER')) {
$clientRequestValues = $_POST;
// $_REQUEST or $_GET
$clientRequestValuesRaw = array();
// Set of request key few controllers are interested in raw values (example, SaveRecord)
/*$rawValueHeaders = array('values');
foreach($rawValueHeaders as $rawValueHeader) {
if(isset($clientRequestValues[$rawValueHeader])) {
$clientRequestValuesRaw[$rawValueHeader] = $clientRequestValues[$rawValueHeader];
}
}*/
// END
if (get_magic_quotes_gpc()) {
$clientRequestValues = stripslashes_recursive($clientRequestValues);
}
Mobile_API_Controller::process(new Mobile_API_Request($clientRequestValues, $clientRequestValuesRaw));
}
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:31,代码来源:api.php
示例12: stripslashes_recursive
/**
* Recursively un-quotes a quoted variable
*
* @param mixed $var
* @return mixed
*/
function stripslashes_recursive($var)
{
if (is_array($var)) {
$unquoted = array();
foreach ($var as $key => $value) {
$unquoted[$key] = stripslashes_recursive($value);
}
return $unquoted;
} elseif (is_scalar($var)) {
return stripslashes($var);
} else {
return $var;
}
}
开发者ID:bank32,项目名称:ansible-php-directory-by-vagrant,代码行数:20,代码来源:index.php
示例13: data_update_instance
function data_update_instance($data)
{
global $CFG;
$data->timemodified = time();
$data->id = $data->instance;
if (empty($data->assessed)) {
$data->assessed = 0;
}
if (empty($data->notification)) {
$data->notification = 0;
}
if (!update_record('data', $data)) {
return false;
}
$data = stripslashes_recursive($data);
data_grade_item_update($data);
return true;
}
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:18,代码来源:lib.php
示例14: groups_update_grouping
/**
* Update grouping
* @param object $data grouping properties (with magic quotes)
* @return boolean success
*/
function groups_update_grouping($data)
{
global $CFG;
$data->timemodified = time();
$data->name = trim($data->name);
$result = update_record('groupings', $data);
if ($result) {
//trigger groups events
events_trigger('groups_grouping_updated', stripslashes_recursive($data));
}
return $result;
}
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:17,代码来源:lib.php
示例15: stripslashes_recursive
/**
* Recursive implementation of stripslashes()
*
* This function will allow you to strip the slashes from a variable.
* If the variable is an array or object, slashes will be stripped
* from the items (or properties) it contains, even if they are arrays
* or objects themselves.
*
* @param mixed the variable to remove slashes from
* @return mixed
*/
function stripslashes_recursive($var)
{
if (is_object($var)) {
$new_var = new object();
$properties = get_object_vars($var);
foreach ($properties as $property => $value) {
$new_var->{$property} = stripslashes_recursive($value);
}
} else {
if (is_array($var)) {
$new_var = array();
foreach ($var as $property => $value) {
$new_var[$property] = stripslashes_recursive($value);
}
} else {
if (is_string($var)) {
$new_var = stripslashes($var);
} else {
$new_var = $var;
}
}
}
return $new_var;
}
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:35,代码来源:weblib.php
示例16: trim
// $Id: search.php,v 1.12.2.2 2007/03/23 01:16:22 nicolasconnault Exp $
// searches for admin settings
require_once '../config.php';
require_once $CFG->libdir . '/adminlib.php';
$query = trim(stripslashes_safe(required_param('query', PARAM_NOTAGS)));
// Search string
$adminroot = admin_get_root();
admin_externalpage_setup('search', $adminroot);
// now hidden page
$CFG->adminsearchquery = $query;
// So we can reference it in search boxes later in this invocation
// now we'll deal with the case that the admin has submitted the form with changed settings
$statusmsg = '';
if ($data = data_submitted()) {
$unslashed = (array) stripslashes_recursive($data);
if (confirm_sesskey()) {
$olddbsessions = !empty($CFG->dbsessions);
$changedsettings = search_settings(admin_get_root(), $query);
$errors = '';
foreach ($changedsettings as $changedsetting) {
if (!isset($unslashed['s_' . $changedsetting->name])) {
$unslashed['s_' . $changedsetting->name] = '';
// needed for checkboxes
}
$errors .= $changedsetting->write_setting($unslashed['s_' . $changedsetting->name]);
}
if ($olddbsessions != !empty($CFG->dbsessions)) {
require_logout();
}
if (empty($errors)) {
开发者ID:veritech,项目名称:pare-project,代码行数:30,代码来源:search.php
示例17: forum_update_instance
/**
* Given an object containing all the necessary data,
* (defined by the form in mod.html) this function
* will update an existing instance with new data.
* @param object $forum forum instance (with magic quotes)
* @return bool success
*/
function forum_update_instance($forum)
{
$forum->timemodified = time();
$forum->id = $forum->instance;
if (empty($forum->assessed)) {
$forum->assessed = 0;
}
if (empty($forum->ratingtime) or empty($forum->assessed)) {
$forum->assesstimestart = 0;
$forum->assesstimefinish = 0;
}
$oldforum = get_record('forum', 'id', $forum->id);
// MDL-3942 - if the aggregation type or scale (i.e. max grade) changes then recalculate the grades for the entire forum
// if scale changes - do we need to recheck the ratings, if ratings higher than scale how do we want to respond?
// for count and sum aggregation types the grade we check to make sure they do not exceed the scale (i.e. max score) when calculating the grade
if ($oldforum->assessed != $forum->assessed or $oldforum->scale != $forum->scale) {
forum_update_grades($forum);
// recalculate grades for the forum
}
if ($forum->type == 'single') {
// Update related discussion and post.
if (!($discussion = get_record('forum_discussions', 'forum', $forum->id))) {
if ($discussions = get_records('forum_discussions', 'forum', $forum->id, 'timemodified ASC')) {
notify('Warning! There is more than one discussion in this forum - using the most recent');
$discussion = array_pop($discussions);
} else {
error('Could not find the discussion in this forum');
}
}
if (!($post = get_record('forum_posts', 'id', $discussion->firstpost))) {
error('Could not find the first post in this forum discussion');
}
$post->subject = $forum->name;
$post->message = $forum->intro;
$post->modified = $forum->timemodified;
if (!update_record('forum_posts', $post)) {
error('Could not update the first post');
}
$discussion->name = $forum->name;
if (!update_record('forum_discussions', $discussion)) {
error('Could not update the discussion');
}
}
if (!update_record('forum', $forum)) {
error('Can not update forum');
}
$forum = stripslashes_recursive($forum);
forum_grade_item_update($forum);
return true;
}
开发者ID:r007,项目名称:PMoodle,代码行数:57,代码来源:lib.php
示例18: quiz_after_add_or_update
/**
* This function is called at the end of quiz_add_instance
* and quiz_update_instance, to do the common processing.
*
* @param object $quiz the quiz object.
*/
function quiz_after_add_or_update($quiz)
{
// Save the feedback
delete_records('quiz_feedback', 'quizid', $quiz->id);
for ($i = 0; $i <= $quiz->feedbackboundarycount; $i += 1) {
$feedback = new stdClass();
$feedback->quizid = $quiz->id;
$feedback->feedbacktext = $quiz->feedbacktext[$i];
$feedback->mingrade = $quiz->feedbackboundaries[$i];
$feedback->maxgrade = $quiz->feedbackboundaries[$i - 1];
if (!insert_record('quiz_feedback', $feedback, false)) {
return "Could not save quiz feedback.";
}
}
// Update the events relating to this quiz.
// This is slightly inefficient, deleting the old events and creating new ones. However,
// there are at most two events, and this keeps the code simpler.
if ($events = get_records_select('event', "modulename = 'quiz' and instance = '{$quiz->id}'")) {
foreach ($events as $event) {
delete_event($event->id);
}
}
$event = new stdClass();
$event->description = $quiz->intro;
$event->courseid = $quiz->course;
$event->groupid = 0;
$event->userid = 0;
$event->modulename = 'quiz';
$event->instance = $quiz->id;
$event->timestart = $quiz->timeopen;
$event->timeduration = $quiz->timeclose - $quiz->timeopen;
$event->visible = instance_is_visible('quiz', $quiz);
$event->eventtype = 'open';
if ($quiz->timeclose and $quiz->timeopen and $event->timeduration <= QUIZ_MAX_EVENT_LENGTH) {
// Single event for the whole quiz.
$event->name = $quiz->name;
add_event($event);
} else {
// Separate start and end events.
$event->timeduration = 0;
if ($quiz->timeopen) {
$event->name = $quiz->name . ' (' . get_string('quizopens', 'quiz') . ')';
add_event($event);
unset($event->id);
// So we can use the same object for the close event.
}
if ($quiz->timeclose) {
$event->name = $quiz->name . ' (' . get_string('quizcloses', 'quiz') . ')';
$event->timestart = $quiz->timeclose;
$event->eventtype = 'close';
add_event($event);
}
}
//update related grade item
quiz_grade_item_update(stripslashes_recursive($quiz));
}
开发者ID:e-rasvet,项目名称:reader,代码行数:62,代码来源:lib.php
示例19: html_safe
function html_safe($value)
{
if (get_magic_quotes_gpc()) {
$value = stripslashes_recursive($value);
}
//function in config.inc.php
return htmlentities($value, ENT_QUOTES);
}
开发者ID:GoeGaming,项目名称:bans.sevenelevenclan.org,代码行数:8,代码来源:functions.inc.php
示例20: redirect
}
// OK, now redirect to day view
redirect(CALENDAR_URL . 'view.php?view=day&course=' . $urlcourse . '&cal_d=' . $form->startday . '&cal_m=' . $form->startmon . '&cal_y=' . $form->startyr);
} else {
foreach ($err as $key => $value) {
$focus = 'form.' . $key;
}
}
}
break;
default:
// no action
$title = '';
break;
}
$form = stripslashes_recursive($form);
if (!empty($SESSION->cal_course_referer)) {
// TODO: This is part of the Great $course Hack in Moodle. Replace it at some point.
$course = get_record('course', 'id', $SESSION->cal_course_referer);
} else {
$course = $site;
}
require_login($course, false);
$navlinks[] = $calendar_navlink;
$navlinks[] = array('name' => $title, 'link' => null, 'type' => 'misc');
$navigation = build_navigation($navlinks);
print_header($site->shortname . ': ' . $strcalendar . ': ' . $title, $strcalendar, $navigation, 'eventform.name', '', true, '', user_login_string($site));
echo calendar_overlib_html();
echo '<table id="calendar">';
echo '<tr><td class="maincalendar">';
switch ($action) {
开发者ID:NextEinstein,项目名称:riverhills,代码行数:31,代码来源:event.php
注:本文中的stripslashes_recursive函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论