本文整理汇总了PHP中addslashes_deep函数的典型用法代码示例。如果您正苦于以下问题:PHP addslashes_deep函数的具体用法?PHP addslashes_deep怎么用?PHP addslashes_deep使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了addslashes_deep函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addslashes_deep
function addslashes_deep($value, $htmlspecialchars = false)
{
if (empty($value)) {
return $value;
} else {
if (is_array($value)) {
foreach ($value as $key => $v) {
unset($value[$key]);
if ($htmlspecialchars == true) {
$key = addslashes(htmlspecialchars($key));
} else {
$key = addslashes($key);
}
if (is_array($v)) {
$value[$key] = addslashes_deep($v);
} else {
if ($htmlspecialchars == true) {
$value[$key] = addslashes(htmlspecialchars($v));
} else {
$value[$key] = addslashes($v);
}
}
}
} else {
if ($htmlspecialchars == true) {
$value = addslashes(htmlspecialchars($value));
} else {
$value = addslashes($value);
}
}
return $value;
}
}
示例2: _initialize
private function _initialize()
{
//初始化设置
@ini_set('memory_limit', '64M');
@ini_set('session.cache_expire', 180);
@ini_set('session.use_cookies', 1);
@ini_set('session.auto_start', 0);
@ini_set('display_errors', 1);
@ini_set("arg_separator.output", "&");
@ini_set('include_path', '.;' . BASE_PATH);
//加载系统常量和函数库
require BASE_PATH . 'base/constant.php';
require BASE_PATH . 'base/function.php';
//对用户传入的变量进行转义操作
if (!get_magic_quotes_gpc()) {
if (!empty($_GET)) {
$_GET = addslashes_deep($_GET);
}
if (!empty($_POST)) {
$_POST = addslashes_deep($_POST);
}
$_COOKIE = addslashes_deep($_COOKIE);
$_REQUEST = addslashes_deep($_REQUEST);
}
//创建 ECSHOP 对象
self::$ecs = new EcsEcshop(C('DB_NAME'), C('DB_PREFIX'));
//初始化数据库类
self::$db = new EcsMysql(C('DB_HOST'), C('DB_USER'), C('DB_PWD'), C('DB_NAME'));
//创建错误处理对象
self::$err = new EcsError('message.dwt');
//载入系统参数
C('CFG', model('Base')->load_config());
}
示例3: addslashes_deep
function addslashes_deep(&$var)
{
if (is_array($var)) {
foreach ($var as $k => &$v) {
addslashes_deep($v);
}
} else {
$var = addslashes($var);
}
}
示例4: addslashes_deep
function addslashes_deep($var)
{
if (is_array($var)) {
foreach ($var as $k => $v) {
$var[$k] = addslashes_deep($v);
}
return $var;
} else {
return addslashes($var);
}
}
示例5: addslashes_deep_obj
/**
* 将对象成员变量或者数组的特殊字符进行转义
*
* @access public
* @param mix $obj 对象或者数组
* @author Xuan Yan
*
* @return mix 对象或者数组
*/
function addslashes_deep_obj($obj)
{
if (is_object($obj) == true) {
foreach ($obj as $key => $val) {
$obj->{$key} = addslashes_deep($val);
}
} else {
$obj = addslashes_deep($obj);
}
return $obj;
}
示例6: showForItem
/**
* Show OcsLink of an item
*
* @param $item CommonDBTM object
*
* @return nothing
**/
static function showForItem(CommonDBTM $item)
{
global $DB, $LANG;
if (in_array($item->getType(), array('Computer'))) {
$items_id = $item->getField('id');
$query = "SELECT `glpi_ocslinks`.`tag` AS tag\n FROM `glpi_ocslinks`\n WHERE `glpi_ocslinks`.`computers_id` = '{$items_id}' " . getEntitiesRestrictRequest("AND", "glpi_ocslinks");
$result = $DB->query($query);
if ($DB->numrows($result) > 0) {
$data = $DB->fetch_assoc($result);
$data = clean_cross_side_scripting_deep(addslashes_deep($data));
echo "<div class='center'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr><th>" . $LANG['ocsng'][0] . "</th>";
echo "<tr class='tab_bg_2'>";
echo "<td class='center'>" . $LANG['ocsconfig'][39] . " : " . $data['tag'] . "</td></tr>";
}
}
}
示例7: arr_to_html
/**
* 转换数据为HTML代码
* @param array $data
*/
private static function arr_to_html($data)
{
if (is_array($data)) {
$str = 'array(';
foreach ($data as $key => $val) {
if (is_array($val)) {
$str .= "'{$key}'=>" . self::arr_to_html($val) . ",";
} else {
if (strpos($val, '$') === 0) {
$str .= "'{$key}'=>{$val},";
} else {
$str .= "'{$key}'=>'" . addslashes_deep($val) . "',";
}
}
}
return $str . ')';
}
return false;
}
示例8: startup
function startup($config = array())
{
/* 加载初始化文件 */
require ROOT_PATH . '/eccore/controller/app.base.php';
//基础控制器类
require ROOT_PATH . '/eccore/model/model.base.php';
//模型基础类
if (!empty($config['external_libs'])) {
foreach ($config['external_libs'] as $lib) {
require $lib;
}
}
/* 数据过滤 */
if (!get_magic_quotes_gpc()) {
$_GET = addslashes_deep($_GET);
$_POST = addslashes_deep($_POST);
$_COOKIE = addslashes_deep($_COOKIE);
}
/* 请求转发 */
$default_app = $config['default_app'] ? $config['default_app'] : 'default';
$default_act = $config['default_act'] ? $config['default_act'] : 'index';
$app = isset($_REQUEST['app']) ? trim($_REQUEST['app']) : $default_app;
$act = isset($_REQUEST['act']) ? trim($_REQUEST['act']) : $default_act;
$app_file = $config['app_root'] . "/{$app}.app.php";
if (!is_file($app_file)) {
exit('Missing controller');
}
require $app_file;
define('APP', $app);
define('ACT', $act);
$app_class_name = ucfirst($app) . 'App';
/* 实例化控制器 */
$app = new $app_class_name();
c($app);
$app->do_action($act);
//转发至对应的Action
$app->destruct();
}
示例9: check_cookie
/**
* 检查cookie
*
* @access public
* @param
*
* @return void
*/
function check_cookie()
{
if (empty($_COOKIE['bbuserid']) || empty($_COOKIE['bbpassword'])) {
return '';
}
$user_id = intval($_COOKIE['bbuserid']);
$bbpassword = addslashes_deep($_COOKIE['bbpassword']);
$row = $this->db->getRow("SELECT " . $this->field_name . " AS user_name, " . $this->field_pass . " As password " . " FROM " . $this->table($this->user_table) . " WHERE " . $this->field_id . "='{$user_id}'");
if (empty($row)) {
return '';
}
if ($bbpassword != md5($row['password'] . $this->cookie_salt)) {
return '';
}
if ($this->charset != 'UTF8') {
$row['user_name'] = ecs_iconv($this->charset, 'UTF8', $row['user_name']);
}
return $row['user_name'];
}
示例10: error_reporting
error_reporting(0);
}
if (isset($config['TIME_LIMIT'])) {
set_time_limit($config['TIME_LIMIT']);
}
if (isset($config['TIMEZONE'])) {
date_default_timezone_set($config['TIMEZONE']);
}
define('PHP_NAME', substr(strrchr($_SERVER['SCRIPT_NAME'], '/'), 1));
define('PHP_PATH', str_replace(PHP_NAME, '', $_SERVER['SCRIPT_NAME']));
define('CORE_PATH', str_replace('\\', '/', dirname(__FILE__)));
require CORE_PATH . '/core.php';
if (!get_magic_quotes_gpc()) {
!empty($_GET) && ($_GET = addslashes_deep($_GET));
!empty($_POST) && ($_POST = addslashes_deep($_POST));
!empty($_COOKIE) && ($_COOKIE = addslashes_deep($_COOKIE));
}
if (isset($_REQUEST['session_id'])) {
session_id(trim($_REQUEST['session_id']));
}
session_start();
$router = array();
if (file_exists(APP_PATH . 'router.php')) {
$router = (include APP_PATH . 'router.php');
}
$_uri = router($router);
define('MODULE', $_uri['module']);
define('ACTION', $_uri['action']);
require CORE_PATH . '/db.php';
$db = new db();
if (isset($config['DB_DRIVER'])) {
示例11: action_act_edit_surplus
function action_act_edit_surplus()
{
$user = $GLOBALS['user'];
$_CFG = $GLOBALS['_CFG'];
$_LANG = $GLOBALS['_LANG'];
$smarty = $GLOBALS['smarty'];
$db = $GLOBALS['db'];
$ecs = $GLOBALS['ecs'];
$user_id = $_SESSION['user_id'];
/* 检查是否登录 */
if ($_SESSION['user_id'] <= 0) {
ecs_header("Location: ./\n");
exit;
}
/* 检查订单号 */
$order_id = intval($_POST['order_id']);
if ($order_id <= 0) {
ecs_header("Location: ./\n");
exit;
}
/* 检查余额 */
$surplus = floatval($_POST['surplus']);
if ($surplus <= 0) {
$err->add($_LANG['error_surplus_invalid']);
$err->show($_LANG['order_detail'], 'user.php?act=order_detail&order_id=' . $order_id);
}
include_once ROOT_PATH . 'includes/lib_order.php';
/* 取得订单 */
$order = order_info($order_id);
if (empty($order)) {
ecs_header("Location: ./\n");
exit;
}
/* 检查订单用户跟当前用户是否一致 */
if ($_SESSION['user_id'] != $order['user_id']) {
ecs_header("Location: ./\n");
exit;
}
/* 检查订单是否未付款,检查应付款金额是否大于0 */
if ($order['pay_status'] != PS_UNPAYED || $order['order_amount'] <= 0) {
$err->add($_LANG['error_order_is_paid']);
$err->show($_LANG['order_detail'], 'user.php?act=order_detail&order_id=' . $order_id);
}
/* 计算应付款金额(减去支付费用) */
$order['order_amount'] -= $order['pay_fee'];
/* 余额是否超过了应付款金额,改为应付款金额 */
if ($surplus > $order['order_amount']) {
$surplus = $order['order_amount'];
}
/* 取得用户信息 */
$user = user_info($_SESSION['user_id']);
/* 用户帐户余额是否足够 */
if ($surplus > $user['user_money'] + $user['credit_line']) {
$err->add($_LANG['error_surplus_not_enough']);
$err->show($_LANG['order_detail'], 'user.php?act=order_detail&order_id=' . $order_id);
}
/* 修改订单,重新计算支付费用 */
$order['surplus'] += $surplus;
$order['order_amount'] -= $surplus;
if ($order['order_amount'] > 0) {
$cod_fee = 0;
if ($order['shipping_id'] > 0) {
$regions = array($order['country'], $order['province'], $order['city'], $order['district']);
$shipping = shipping_area_info($order['shipping_id'], $regions);
if ($shipping['support_cod'] == '1') {
$cod_fee = $shipping['pay_fee'];
}
}
$pay_fee = 0;
if ($order['pay_id'] > 0) {
$pay_fee = pay_fee($order['pay_id'], $order['order_amount'], $cod_fee);
}
$order['pay_fee'] = $pay_fee;
$order['order_amount'] += $pay_fee;
}
/* 如果全部支付,设为已确认、已付款 */
if ($order['order_amount'] == 0) {
if ($order['order_status'] == OS_UNCONFIRMED) {
$order['order_status'] = OS_CONFIRMED;
$order['confirm_time'] = gmtime();
}
$order['pay_status'] = PS_PAYED;
$order['pay_time'] = gmtime();
}
$order = addslashes_deep($order);
update_order($order_id, $order);
/* 更新用户余额 */
$change_desc = sprintf($_LANG['pay_order_by_surplus'], $order['order_sn']);
log_account_change($user['user_id'], -1 * $surplus, 0, 0, 0, $change_desc);
/* 跳转 */
ecs_header('Location: user.php?act=order_detail&order_id=' . $order_id . "\n");
exit;
}
示例12: transferNetworkLink
/**
* Transfer network links
*
* @param $itemtype original type of transfered item
* @param $ID original ID of the item
* @param $newID new ID of the item
* @param $ocs_computer if computer type OCS ID of the item if available
**/
function transferNetworkLink($itemtype, $ID, $newID, $ocs_computer = false)
{
global $DB;
$np = new NetworkPort();
$nn = new NetworkPort_NetworkPort();
$query = "SELECT *\n FROM `glpi_networkports`\n WHERE `items_id` = '{$ID}'\n AND `itemtype` = '{$itemtype}'";
if ($result = $DB->query($query)) {
if ($DB->numrows($result) != 0) {
switch ($this->options['keep_networklink']) {
// Delete netport
case 0:
// Not a copy -> delete
if ($ID == $newID) {
while ($data = $DB->fetch_array($result)) {
$np->delete(array('id' => $data['id']));
}
// Only case of ocs link update is needed (if netports are keep nothing to do)
if ($ocs_computer) {
$query = "UPDATE `glpi_ocslinks`\n SET `import_ip` = NULL\n WHERE `computers_id` = '{$ID}'";
$DB->query($query);
}
}
// Copy -> do nothing
break;
// Disconnect
// Disconnect
case 1:
// Not a copy -> disconnect
if ($ID == $newID) {
while ($data = $DB->fetch_array($result)) {
if ($nn->getFromDBForNetworkPort($data['id'])) {
$nn->delete($data);
}
if ($data['netpoints_id']) {
$netpointID = $this->transferDropdownNetpoint($data['netpoints_id']);
$input['id'] = $data['id'];
$input['netpoints_id'] = $netpointID;
$np->update($input);
}
}
} else {
// Copy -> copy netports
while ($data = $DB->fetch_array($result)) {
$data = addslashes_deep($data);
unset($data['id']);
$data['items_id'] = $newID;
$data['netpoints_id'] = $this->transferDropdownNetpoint($data['netpoints_id']);
unset($np->fields);
$np->add($data);
}
}
break;
// Keep network links
// Keep network links
default:
// Copy -> Copy netpoints (do not keep links)
if ($ID != $newID) {
while ($data = $DB->fetch_array($result)) {
unset($data['id']);
$data['items_id'] = $newID;
$data['netpoints_id'] = $this->transferDropdownNetpoint($data['netpoints_id']);
unset($np->fields);
$np->add($data);
}
} else {
while ($data = $DB->fetch_array($result)) {
// Not a copy -> only update netpoint
if ($data['netpoints_id']) {
$netpointID = $this->transferDropdownNetpoint($data['netpoints_id']);
$input['id'] = $data['id'];
$input['netpoints_id'] = $netpointID;
$np->update($input);
}
}
}
}
}
}
}
示例13: addslashes_deep
require ROOT_PATH . 'includes/cls_error.php';
require ROOT_PATH . 'includes/lib_time.php';
require ROOT_PATH . 'includes/lib_base.php';
require ROOT_PATH . 'includes/lib_common.php';
require ROOT_PATH . ADMIN_PATH . '/includes/lib_main.php';
require ROOT_PATH . ADMIN_PATH . '/includes/cls_exchange.php';
/* 对用户传入的变量进行转义操作。*/
if (!get_magic_quotes_gpc()) {
if (!empty($_GET)) {
$_GET = addslashes_deep($_GET);
}
if (!empty($_POST)) {
$_POST = addslashes_deep($_POST);
}
$_COOKIE = addslashes_deep($_COOKIE);
$_REQUEST = addslashes_deep($_REQUEST);
}
/* 对路径进行安全处理 */
if (strpos(PHP_SELF, '.php/') !== false) {
ecs_header("Location:" . substr(PHP_SELF, 0, strpos(PHP_SELF, '.php/') + 4) . "\n");
exit;
}
/* 创建 ECSHOP 对象 */
$ecs = new ECS($db_name, $prefix);
define('DATA_DIR', $ecs->data_dir());
define('IMAGE_DIR', $ecs->image_dir());
/* 初始化数据库类 */
require ROOT_PATH . 'includes/cls_mysql.php';
$db = new cls_mysql($db_host, $db_user, $db_pass, $db_name);
$db_host = $db_user = $db_pass = $db_name = NULL;
/* 创建错误处理对象 */
示例14: while
// 关联文章
$sql = "DELETE FROM " . $ecs->table('goods_article') . " WHERE goods_id = 0 AND admin_id = '{$_SESSION['admin_id']}'";
$db->query($sql);
$sql = "SELECT 0 AS goods_id, article_id, '{$_SESSION['admin_id']}' AS admin_id " . "FROM " . $ecs->table('goods_article') . " WHERE goods_id = '{$_REQUEST['goods_id']}' ";
$res = $db->query($sql);
while ($row = $db->fetchRow($res)) {
$db->autoExecute($ecs->table('goods_article'), $row, 'INSERT');
}
// 图片不变
// 商品属性
$sql = "DELETE FROM " . $ecs->table('goods_attr') . " WHERE goods_id = 0";
$db->query($sql);
$sql = "SELECT 0 AS goods_id, attr_id, attr_value, attr_price " . "FROM " . $ecs->table('goods_attr') . " WHERE goods_id = '{$_REQUEST['goods_id']}' ";
$res = $db->query($sql);
while ($row = $db->fetchRow($res)) {
$db->autoExecute($ecs->table('goods_attr'), addslashes_deep($row), 'INSERT');
}
}
// 扩展分类
$other_cat_list = array();
$sql = "SELECT cat_id FROM " . $ecs->table('goods_cat') . " WHERE goods_id = '{$_REQUEST['goods_id']}'";
$goods['other_cat'] = $db->getCol($sql);
foreach ($goods['other_cat'] as $cat_id) {
$other_cat_list[$cat_id] = cat_list(0, $cat_id);
}
$smarty->assign('other_cat_list', $other_cat_list);
$link_goods_list = get_linked_goods($goods['goods_id']);
// 关联商品
$group_goods_list = get_group_goods($goods['goods_id']);
// 配件
$goods_article_list = get_goods_articles($goods['goods_id']);
示例15: admin_log
$db->autoExecute($ecs->table('users'), $other, 'UPDATE', "user_name = '{$username}'");
/* 记录管理员操作 */
admin_log($username, 'edit', 'users');
/* 提示信息 */
$links[0]['text'] = $_LANG['goto_list'];
$links[0]['href'] = 'users.php?act=list&' . list_link_postfix();
$links[1]['text'] = $_LANG['go_back'];
$links[1]['href'] = 'javascript:history.back()';
sys_msg($_LANG['update_success'], 0, $links);
} elseif ($_REQUEST['act'] == 'batch_remove') {
/* 检查权限 */
admin_priv('users_drop');
if (isset($_POST['checkboxes'])) {
$sql = "SELECT user_name FROM " . $ecs->table('users') . " WHERE user_id " . db_create_in($_POST['checkboxes']);
$col = $db->getCol($sql);
$usernames = implode(',', addslashes_deep($col));
$count = count($col);
/* 通过插件来删除用户 */
$users =& init_users();
$users->remove_user($col);
admin_log($usernames, 'batch_remove', 'users');
$lnk[] = array('text' => $_LANG['go_back'], 'href' => 'users.php?act=list');
sys_msg(sprintf($_LANG['batch_remove_success'], $count), 0, $lnk);
} else {
$lnk[] = array('text' => $_LANG['go_back'], 'href' => 'users.php?act=list');
sys_msg($_LANG['no_select_user'], 0, $lnk);
}
} elseif ($_REQUEST['act'] == 'edit_username') {
/* 检查权限 */
check_authz_json('users_manage');
$username = empty($_REQUEST['val']) ? '' : json_str_iconv(trim($_REQUEST['val']));