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


PHP addslashes_array函数代码示例

本文整理汇总了PHP中addslashes_array函数的典型用法代码示例。如果您正苦于以下问题:PHP addslashes_array函数的具体用法?PHP addslashes_array怎么用?PHP addslashes_array使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: addslashes_array

function addslashes_array($array)
{
    foreach ($array as $key => $val) {
        $array[$key] = is_array($val) ? addslashes_array($val) : addslashes($val);
    }
    return $array;
}
开发者ID:abhinay100,项目名称:fourimages_app,代码行数:7,代码来源:global.php

示例2: addslashes_array

function addslashes_array($input_arr)
{
    if (is_array($input_arr)) {
        $tmp = array();
        foreach ($input_arr as $key1 => $val) {
            $tmp[$key1] = addslashes_array($val);
        }
        return $tmp;
    } else {
        return addslashes($input_arr);
    }
}
开发者ID:radist,项目名称:Shopkeeper,代码行数:12,代码来源:ajax-action.php

示例3: addslashes_array

 function addslashes_array($a){
     if(is_array($a)){
         foreach($a as $n=>$v){
             $b[$n]=addslashes_array($v);
         }
         return $b;
     }else{
         if ($a != ''){
             return addslashes($a);
         }
     }
 }
开发者ID:robertatakenaka,项目名称:Biodiversidade,代码行数:12,代码来源:config.php

示例4: addslashes_array

/**
* Does addslashes() on every value in an array (NOTICE: Using 
* mysql_real_escape_string() or mysql_escape_array() is MUCH BETTER
* - especially for any data to be used in MySQL This function just exists for
* rare circumstances.)
*
* @param array The array to be slashed
*/
function addslashes_array($data)
{
    if (is_array($data)) {
        foreach ($data as $key => $value) {
            $data[$key] = addslashes_array($value);
        }
        return $data;
    } else {
        if (!is_numeric($data)) {
            return addslashes($data);
        } else {
            return $data;
        }
    }
}
开发者ID:negatendo,项目名称:animated-gifs-from-delicious,代码行数:23,代码来源:quotehandle.inc.php

示例5: addslashes_array

function addslashes_array($array)
{
    if (get_magic_quotes_gpc()) {
        return $array;
    }
    if (!is_array($array)) {
        return addslashes($array);
    }
    foreach ($array as $k => $val) {
        $array[$k] = addslashes_array($val);
    }
    return $array;
}
开发者ID:JavaAFei,项目名称:yun001,代码行数:13,代码来源:~runtime.php

示例6: _add_ship_bill

 function _add_ship_bill($order_info, $delivery_item, $type = 'delivery')
 {
     $dealer_orderid = $order_info['order_id'];
     $delivery_no = $this->_get_new_number($type);
     $_delivery_goods_items = $delivery_item['struct'];
     unset($delivery_item['struct']);
     unset($delivery_item['order_id']);
     $_data = array();
     $_data = array_merge((array) $delivery_item, (array) $order_info);
     $_data['supplier_delivery_id'] = $delivery_item['delivery_id'];
     $_data['delivery_id'] = $delivery_no;
     $_data['op_name'] = 'admin';
     $_data['logi_id'] = null;
     unset($_data['disabled']);
     $order_id = $order_info['order_id'];
     $rs = $this->db->query('SELECT * FROM sdb_delivery WHERE 0=1');
     $_data = addslashes_array($_data);
     $_sql = $this->db->GetInsertSQL($rs, $_data);
     if ($this->db->exec($_sql)) {
         foreach ($_delivery_goods_items as $_item) {
             $_data = array('product_id' => $_item['product_id'], 'delivery_id' => $delivery_no, 'product_bn' => $_item['dealer_bn'], 'item_type' => $_item['item_type'], 'product_name' => $_item['product_name'], 'number' => $_item['number']);
             $rs = $this->db->query('SELECT * FROM sdb_delivery_item WHERE 0=1');
             $_data = addslashes_array($_data);
             $_sql = $this->db->GetInsertSQL($rs, $_data);
             if (!$this->db->exec($_sql)) {
                 $this->api_response('fail', 'data fail', $result, '发货单/退货单商品清单插入失败');
             }
             //更新order_items 订单发货数量
             $_sql = sprintf('update sdb_order_items set sendnum=sendnum+%d where order_id=%s and bn=\'%s\'', ($type == 'delivery' ? 1 : -1) * $_item['number'], $dealer_orderid, $_item['dealer_bn']);
             $this->db->exec($_sql);
         }
     } else {
         $this->api_response('fail', 'data fail', null, '发货单/退货单插入失败');
     }
     //更新订单操作记录,add by hujianxin
     return $delivery_no;
 }
开发者ID:noikiy,项目名称:MyShop,代码行数:37,代码来源:api_b2c_2_0_delivery.php

示例7: update_product


//.........这里部分代码省略.........
             //设置销售多货品销售价等价格
             $goods['price'] = $goods['price'] ? min($price, $goods['price']) : $price;
             //取最小商品价格
             $goods['cost'] = $goods['cost'] ? min($data['cost'][$k], $goods['cost']) : $data['cost'][$k];
             $goods['weight'] = $goods['weight'] ? min($data['weight'][$k], $goods['weight']) : $data['weight'][$k];
             $products[$k]['price'] = $price;
             $products[$k]['bn'] = $data['bn'][$k];
             $products[$k]['store'] = trim($data['store'][$k]) === '' ? '' : intval($data['store'][$k]);
             $products[$k]['alert'] = $data['alert'][$k];
             $products[$k]['cost'] = $data['cost'][$k];
             $products[$k]['weight'] = $data['weight'][$k];
             $products[$k]['goodsspace'] = $data['goodsspace'][$k];
             //新增货位
             $newSpecI = 0;
             $proSpecFlag = '';
             foreach ($data['vars'] as $i => $v) {
                 $products[$k]['props']['spec'][$i] = trim($data['val'][$i][$k]);
                 //array('规格(颜色)序号'=>'规格值(红色)')
                 $products[$k]['props']['spec_private_value_id'][$i] = trim($data['pSpecId'][$i][$k]);
                 $products[$k]['props']['spec_value_id'][$i] = trim($data['specVId'][$i][$k]);
                 if (!$products[$k]['props']['spec'][$i]) {
                     $this->api_response('fail', '请为所有货品定义规格值 ');
                 }
                 $proSpecFlag .= $products[$k]['props']['spec_private_value_id'][$i] . '_';
             }
             if (in_array($proSpecFlag, $sameProFlag)) {
                 $this->api_response('fail', '不能添加相同规格货品 ');
             }
             $sameProFlag[$k] = $proSpecFlag;
             reset($proSpecFlag);
             reset($data['vars'], $data['pSpecId']);
             $products[$k]['pdt_desc'] = implode('、', $products[$k]['props']['spec']);
             //物品描述
             $products[$k]['pdt_desc'] = addslashes_array($products[$k]['pdt_desc']);
             foreach ($data['idata'] as $i => $v) {
                 $products[$k]['props']['idata'][$i] = $v[$k];
             }
             //设置会员价格
             if (is_array($data['mprice'])) {
                 foreach ($data['mprice'] as $levelid => $rows) {
                     $products[$k]['mprice'][$levelid] = floatval($rows[$k]);
                 }
             }
         }
         unset($sameProFlag);
         $goods['products'] =& $products;
     } else {
         $goods['props']['idata'] = $data['idata'];
     }
     $objGoods = $this->system->loadModel('trading/goods');
     foreach ($products as $k => $p) {
         if (empty($p['bn'])) {
             continue;
         }
         if ($objGoods->checkProductBn($p['bn'], $goods['goods_id'])) {
             $this->api_response('fail', '货号重复,请检查 ');
         }
         $aBn[] = $p['bn'];
     }
     if (!empty($goods['bn'])) {
         if ($objGoods->checkProductBn($goods['bn'], $goods['goods_id'])) {
             $this->api_response('fail', '货号重复,请检查 ');
         }
     }
     if (count($aBn) > count(array_unique($aBn))) {
         $this->api_response('fail', '货号重复,请检查 ');
开发者ID:noikiy,项目名称:cxe,代码行数:67,代码来源:api_pim_3_1_goods.php

示例8: addslashes_array

<?php

/**
 * Reorder, Furasta.Org
 *
 * Accessed via AJAX, this file reorders pages
 * according to data sent via POST.
 *
 * @author     Conor Mac Aoidh <conormacaoidh@gmail.com>
 * @license    http://furasta.org/licence.txt The BSD License
 * @version    1.0
 * @package    admin_pages
 */
/**
 * make sure ajax script was loaded and user is
 * logged in 
 */
if (!defined('AJAX_LOADED') || !defined('AJAX_VERIFIED')) {
    die;
}
$pages = addslashes_array($_POST['node']);
foreach ($pages as $position => $page) {
    query('update ' . DB_PAGES . ' set position=' . $position . ', parent=' . $page['parent'] . ' where id=' . $page['id']);
}
cache_clear('DB_PAGES');
exit;
开发者ID:letsdodjango,项目名称:furasta-org,代码行数:26,代码来源:reorder.php

示例9: commit_to_db

 function commit_to_db()
 {
     global $dbh;
     //on oublie pas que includes/global_vars.inc.php s'amuse à tout addslasher tout seul donc on le fait pas ici
     $this->type += 0;
     $this->config = addslashes_array($this->config);
     $serialized = serialize($this->config);
     $sql = "UPDATE connectors_out_sets SET connector_out_set_caption = '" . addslashes($this->caption) . "', connector_out_set_type = " . $this->type . ", connector_out_set_config = '" . addslashes($serialized) . "' WHERE connector_out_set_id = " . $this->id . "";
     pmb_mysql_query($sql, $dbh);
 }
开发者ID:noble82,项目名称:proyectos-ULS,代码行数:10,代码来源:connecteurs_out_sets.class.php

示例10: downloadImage

 /**
  * 下载图片
  * $retry=false && $command_id=1,表示重试下载该command_id所有需要重试下载的图片。注意点:如果反复调用带参数的方法,并且始终下载失败,那么会死锁,需要前台加以控制
  * PS:也可以由前台控制,首先把失败的标记改成成功,重新打开下载队列,这样就不需要传入参数了
  *
  * @param boolean $retry,是否重新下载失败的图片
  * @param int $command_id,同步列表的id
  * @return int -1:下载出错,1:下载成功,0:无需下载
  */
 function downloadImage($retry = false, $command_id = NULL)
 {
     $image_type = array('1' => 'gif', '2' => 'jpg', '3' => 'png', '6' => 'bmp');
     $sql = "SELECT * FROM sdb_image_sync WHERE 1=1 ";
     if ($retry) {
         $sql .= " AND failed='true'";
     } else {
         $sql .= " AND failed='false'";
     }
     if (!is_null($command_id)) {
         $sql .= " AND command_id=" . intval($command_id);
     }
     $sql .= " ORDER BY add_time ASC,img_sync_id ASC";
     $image = $this->db->selectrow($sql);
     if (!empty($image)) {
         $this->_updateLock('download_image');
         $filename = "";
         $type = $image['type'];
         $supplier_id = $image['supplier_id'];
         $object_id = $image['supplier_object_id'];
         switch ($type) {
             case 'gimage':
                 $dir = HOME_DIR . "/upload/gpic";
                 if (!is_dir($dir)) {
                     mkdir($dir, 0777);
                 }
                 $dir = HOME_DIR . "/upload/gpic/" . date("Ymd");
                 if (!is_dir($dir)) {
                     mkdir($dir, 0777);
                 }
                 $filename = $dir . "/" . md5($supplier_id . $object_id);
                 $p_type = 'gimage';
                 break;
             case 'spec_value':
                 $filename = MEDIA_DIR . "/default/" . "spec-" . md5($supplier_id . $object_id);
                 $p_type = 'spec';
                 break;
             case 'udfimg':
                 $dir = MEDIA_DIR . "/goods/" . date("Ymd");
                 if (!is_dir($dir)) {
                     mkdir($dir, 0777);
                 }
                 $filename = $dir . "/" . md5($supplier_id . $object_id);
                 $p_type = 'udfimg';
                 break;
             case 'brand_logo':
                 $dir = MEDIA_DIR . "/brand";
                 if (!is_dir($dir)) {
                     mkdir($dir, 0777);
                 }
                 $dir .= "/" . date("Ymd");
                 if (!is_dir($dir)) {
                     mkdir($dir, 0777);
                 }
                 $filename = $dir . "/" . md5($supplier_id . $object_id);
                 $p_type = 'brand';
                 break;
         }
         $send_params = array('supplier_id' => $supplier_id, 'type' => $p_type, 'id' => $object_id, 'return_data' => 'raw');
         $token = $this->system->getConf('certificate.token');
         $img_api = $this->system->api_call(IMAGESERVER, IMAGESERVER_HOST, IMAGESERVER_PATH, IMAGESERVER_PORT, $token);
         $file = $img_api->getApiData('getPicById', API_VERSION, $send_params);
         if ($file === false) {
             if (!is_null($image['command_id'])) {
                 $table = 'sdb_data_sync_' . $supplier_id;
                 $rs = $this->db->query("SELECT * FROM sdb_image_sync WHERE img_sync_id=" . intval($image['img_sync_id']));
                 $sql = $this->db->GetUpdateSQL($rs, array('failed' => 'true'));
                 $this->db->exec($sql);
                 $rs = $this->db->query("SELECT * FROM " . $table . " WHERE command_id=" . intval($image['command_id']));
                 $sql = $this->db->GetUpdateSQL($rs, array('img_down_failed' => 'true'));
                 $this->db->exec($sql);
             }
             return -1;
         } else {
             file_put_contents($filename, $file);
             list($img_width, $img_height, $img_type, $img_attr) = getimagesize($filename);
             $postfix = isset($image_type[$img_type]) ? $image_type[$img_type] : "jpg";
             rename($filename, $filename . "." . $postfix);
             $sql = "DELETE FROM sdb_image_sync WHERE img_sync_id=" . $image['img_sync_id'];
             $this->db->exec($sql);
             //下载完更新对应的gimage,spec_values的记录
             switch ($type) {
                 case 'gimage':
                     $image_path = "gpic/" . date("Ymd") . "/" . md5($supplier_id . $object_id) . "." . $postfix;
                     $supplier_gimage_id = $object_id;
                     $gimage_info = array('source' => $image_path, 'sync_time' => $image['add_time']);
                     $rs = $this->db->query("SELECT * FROM sdb_gimages WHERE supplier_id=" . floatval($supplier_id) . " AND supplier_gimage_id=" . intval($supplier_gimage_id));
                     $sql = $this->db->GetUpdateSQL($rs, addslashes_array($gimage_info));
                     $this->db->exec($sql);
                     //获取本地对应的goods信息
                     $goods = $this->db->selectrow("SELECT goods_id FROM sdb_gimages WHERE supplier_id=" . floatval($supplier_id) . " AND supplier_gimage_id=" . intval($supplier_gimage_id) . " ORDER BY goods_id DESC");
//.........这里部分代码省略.........
开发者ID:noikiy,项目名称:MyShop,代码行数:101,代码来源:mdl.syncjob.php

示例11: update_options

/**
 * update_options
 *
 * updates the options of a given category with a
 * given string of options
 *
 * @param array $options
 * @param string $category
 * @return bool
 */
function update_options($options, $category)
{
    if ($options == 0 || empty($options)) {
        return false;
    }
    $options = addslashes_array($options);
    if (count($options) != 0) {
        query('delete from ' . DB_OPTIONS . ' where category="' . $category . '"');
        $query = 'insert into ' . DB_OPTIONS . ' values ';
        $i = 0;
        foreach ($options as $option => $value) {
            ++$i;
            $query .= '("' . addslashes($option) . '","' . addslashes($value) . '","' . $category . '")';
            if (count($options) != $i) {
                $query .= ',';
            }
        }
        query($query);
    }
    return true;
}
开发者ID:letsdodjango,项目名称:furasta-org,代码行数:31,代码来源:db.php

示例12: elseif

    }
} elseif ($pmb_notice_controle_doublons != 0 && !$analysis_id) {
    //Si control de dédoublonnage activé
    $sign = new notice_doublon();
    $signature = $sign->gen_signature();
    $requete = "select signature, niveau_biblio ,notice_id from notices where signature='{$signature}'";
    if ($serial_id) {
        $requete .= " and notice_id != '{$analysis_id}' ";
    }
    //$requete.= " limit 1 ";
    $result = pmb_mysql_query($requete, $dbh);
    if ($dbls = pmb_mysql_num_rows($result)) {
        //affichage de l'erreur, en passant tous les param postés (serialise) pour l'éventuel forcage
        $tab = new stdClass();
        $tab->POST = addslashes_array($_POST);
        $tab->GET = addslashes_array($_GET);
        $ret_url = urlencode(serialize($tab));
        require_once "{$class_path}/mono_display.class.php";
        require_once "{$class_path}/serial_display.class.php";
        print "\n\t\t\t<br /><div class='erreur'>{$msg['540']}</div>\n\t\t\t<script type='text/javascript' src='./javascript/tablist.js'></script>\n\t\t\t<div class='row'>\n\t\t\t\t<div class='colonne10'>\n\t\t\t\t\t<img src='./images/error.gif' align='left'>\n\t\t\t\t</div>\n\t\t\t\t<div class='colonne80'>\n\t\t\t\t\t<strong>" . $msg["gen_signature_erreur_similaire"] . "</strong>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div class='row'>\n\t\t\t\t<form class='form-{$current_module}' name='dummy'  method='post' action='./catalog.php?categ=serials&sub=analysis&action=update&bul_id={$bul_id}&analysis_id={$analysis_id}'>\n\t\t\t\t\t<input type='hidden' name='forcage' value='1'>\n\t\t\t\t\t<input type='hidden' name='signature' value='{$signature}'>\n\t\t\t\t\t<input type='hidden' name='ret_url' value='{$ret_url}'>\n\t\t\t\t\t<input type='button' name='ok' class='bouton' value=' {$msg['76']} ' onClick='history.go(-1);'>\n\t\t\t\t\t<input type='submit' class='bouton' name='bt_forcage' value=' " . htmlentities($msg["gen_signature_forcage"], ENT_QUOTES, $charset) . " '>\n\t\t\t\t</form>\n\t\t\t\t\n\t\t\t</div>\n\t\t\t";
        if ($dbls < $nb_per_page_search) {
            $maxAffiche = $dbls;
            echo "<div class='row'><strong>" . sprintf($msg["gen_signature_erreur_similaire_nb"], $dbls, $dbls) . "</strong></div>";
        } else {
            $maxAffiche = $nb_per_page_search;
            echo "<div class='row'><strong>" . sprintf($msg["gen_signature_erreur_similaire_nb"], $maxAffiche, $dbls) . "</strong></div>";
        }
        $enCours = 1;
        while ($enCours <= $maxAffiche) {
            $r = pmb_mysql_fetch_object($result);
            if ($r->niveau_biblio != 's' && $r->niveau_biblio != 'a') {
开发者ID:hogsim,项目名称:PMB,代码行数:31,代码来源:analysis_update.inc.php

示例13: addslashes_array

/**
 * 对数组的元素添加转义
 *
 * @param array $array
 * @return array
 */
function addslashes_array($value)
{
    if (empty($value)) {
        return $value;
    } else {
        if (is_array($value)) {
            foreach ($value as $k => $v) {
                if (is_array($v)) {
                    $value[$k] = addslashes_array($v);
                } else {
                    $value[$k] = addslashes($v);
                }
            }
            return $value;
        } else {
            return addslashes($value);
        }
    }
}
开发者ID:noikiy,项目名称:shopex_tmall,代码行数:25,代码来源:func_ext.php

示例14: update

 /**
  * 更新配置
  *
  * @param array $data
  * @param int $filter
  * @return boolean
  */
 function update($data, $filter)
 {
     $rule = $data['rule'];
     unset($data['rule_id']);
     unset($data['rule']);
     unset($data['__']);
     $data['rule_name'] = $this->generateRuleName($rule);
     addslashes_array($data);
     // 新增同步配置记录
     if (!$this->_update($data, $filter)) {
         trigger_error('修改失败!', E_USER_ERROR);
     }
     // 删除规则记录
     $this->deleteRuleRelation($filter['rule_id']);
     // 加入规则记录
     $this->insertRuleRelation($filter['rule_id'], $rule);
     return true;
 }
开发者ID:noikiy,项目名称:MyShop,代码行数:25,代码来源:mdl.autosync.php

示例15: toAdd


//.........这里部分代码省略.........
             $products[$k]['bn'] = $_POST['bn'][$k];
             $products[$k]['store'] = trim($_POST['store'][$k]) === '' ? null : intval($_POST['store'][$k]);
             $products[$k]['alert'] = $_POST['alert'][$k];
             $products[$k]['cost'] = $_POST['cost'][$k];
             $products[$k]['weight'] = $_POST['weight'][$k];
             $products[$k]['mktprice'] = $_POST['mktprice'][$k];
             $products[$k]['store_place'] = $_POST['store_place'][$k];
             $products[$k]['marketable'] = $_POST['marketable'][$k];
             $data['mktprice'] = $data['mktprice'] ? min($_POST['mktprice'][$k], $data['mktprice']) : $_POST['mktprice'][$k];
             $newSpecI = 0;
             $proSpecFlag = '';
             foreach ($_POST['vars'] as $i => $v) {
                 $products[$k]['props']['spec'][$i] = urldecode(trim($_POST['val'][$i][$k]));
                 //array('规格(颜色)序号'=>'规格值(红色)')
                 $products[$k]['props']['spec_private_value_id'][$i] = trim($_POST['pSpecId'][$i][$k]);
                 $products[$k]['props']['spec_value_id'][$i] = trim($_POST['specVId'][$i][$k]);
                 if (trim($products[$k]['props']['spec'][$i]) === '') {
                     trigger_error(__('请为所有货品定义规格值'), E_USER_ERROR);
                     $this->end(false, __('请为所有货品定义规格值'));
                     exit;
                 }
                 $proSpecFlag .= $products[$k]['props']['spec_private_value_id'][$i] . '_';
             }
             if (in_array($proSpecFlag, $sameProFlag)) {
                 trigger_error(__('不能添加相同规格货品'), E_USER_ERROR);
                 $this->end(false, __('不能添加相同规格货品'));
                 exit;
             }
             $sameProFlag[$k] = $proSpecFlag;
             reset($proSpecFlag);
             reset($_POST['vars'], $_POST['pSpecId']);
             $products[$k]['pdt_desc'] = implode('、', $products[$k]['props']['spec']);
             //物品描述
             $products[$k]['pdt_desc'] = addslashes_array($products[$k]['pdt_desc']);
             foreach ($_POST['idata'] as $i => $v) {
                 $products[$k]['props']['idata'][$i] = $v[$k];
             }
             //设置会员价格
             if (is_array($_POST['mprice'])) {
                 foreach ($_POST['mprice'] as $levelid => $rows) {
                     $products[$k]['mprice'][$levelid] = floatval($rows[$k]);
                 }
             }
         }
         unset($sameProFlag);
         $data['products'] =& $products;
     } else {
         if (!$data['mktprice']) {
             $oMath =& $this->system->loadModel('system/math');
             if ($this->system->getConf('site.show_mark_price')) {
                 if ($this->system->getConf('site.market_price') == '1') {
                     $data['mktprice'] = $this->system->getConf('site.market_rate') * $oMath->getOperationNumber($data['price']);
                 }
                 if ($this->system->getConf('site.market_price') == '2') {
                     $data['mktprice'] = $this->system->getConf('site.market_rate') + $oMath->getOperationNumber($data['price']);
                 }
             }
         }
         $data['props']['idata'] = $_POST['idata'];
     }
     $objGoods =& $this->system->loadModel('trading/goods');
     foreach ($products as $k => $p) {
         if (empty($p['bn'])) {
             continue;
         }
         if ($objGoods->checkProductBn($p['bn'], $data['goods_id'])) {
开发者ID:noikiy,项目名称:MyShop,代码行数:67,代码来源:ctl.product.php


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