本文整理汇总了PHP中new_stripslashes函数的典型用法代码示例。如果您正苦于以下问题:PHP new_stripslashes函数的具体用法?PHP new_stripslashes怎么用?PHP new_stripslashes使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了new_stripslashes函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array2string
/**
* 将数组转换为字符串
*
* @param array $data 数组
* @param bool $isformdata 如果为0,则不使用new_stripslashes处理,可选参数,默认为1
* @return string 返回字符串,如果,data为空,则返回空
*/
function array2string($data, $isformdata = 1)
{
if ($data == '') {
return '';
}
if ($isformdata) {
$data = new_stripslashes($data);
}
return addslashes(var_export($data, TRUE));
}
示例2: new_stripslashes
/**
* 返回经stripslashes处理过的字符串或数组
* @param $string 需要处理的字符串或数组
* @return mixed
*/
function new_stripslashes($string)
{
if (!is_array($string)) {
return stripslashes($string);
}
foreach ($string as $key => $val) {
$string[$key] = new_stripslashes($val);
}
return $string;
}
示例3: array2string
/**
* 将数组转换为字符串
*
* @param array $data 数组
* @param bool $isformdata 如果为0,则不使用new_stripslashes处理,可选参数,默认为1
* @return string 返回字符串,如果,data为空,则返回空
*/
function array2string($data, $isformdata = 1)
{
if ($data == '' || empty($data)) {
return '';
}
if ($isformdata) {
$data = new_stripslashes($data);
}
if (strtolower(CHARSET) == 'gbk') {
$data = mult_iconv("GBK", "UTF-8", $data);
}
if (version_compare(PHP_VERSION, '5.3.0', '<')) {
return addslashes(json_encode($data));
} else {
return addslashes(json_encode($data, JSON_FORCE_OBJECT));
}
}
示例4: manage
public function manage()
{
if (isset($_POST['dosubmit'])) {
$_POST['info']['denyusername'] = isset($_POST['info']['denyusername']) ? new_stripslashes(trim($_POST['info']['denyusername'])) : '';
$_POST['info']['denyusername'] = explode("\r\n", $_POST['info']['denyusername']);
$_POST['info']['denyemail'] = isset($_POST['info']['denyemail']) ? new_stripslashes(trim($_POST['info']['denyemail'])) : '';
$_POST['info']['denyemail'] = explode("\r\n", $_POST['info']['denyemail']);
$this->db->set_setting('member', $_POST['info']);
S('member/member_setting', $_POST['info']);
showmessage(L('operation_success'), HTTP_REFERER);
} else {
$show_validator = $show_header = true;
$show_scroll = true;
$member_setting = $this->db->get_setting('member');
include $this->view('member_setting');
}
}
示例5: deleteuser
public function deleteuser($get, $post)
{
pc_base::load_app_func('global', 'admin');
pc_base::load_app_class('messagequeue', 'admin', 0);
$ids = new_stripslashes($get['ids']);
$s = $this->member_db->select("ucuserid in ({$ids})", "uid");
$this->member_db->delete("ucuserid in ({$ids})");
$noticedata['uids'] = array();
if ($s) {
foreach ($s as $key => $v) {
$noticedata['uids'][$key] = $v['uid'];
}
} else {
return API_RETURN_FAILED;
}
messagequeue::add('member_delete', $noticedata);
return API_RETURN_SUCCEED;
}
示例6: __construct
/**
* 构造函数
*/
public function __construct() {
$this->db = pc_base::load_model('member_model');
pc_base::load_app_func('global');
/*获取系统配置*/
$this->settings = getcache('settings', 'admin');
$this->applist = getcache('applist', 'admin');
if(isset($_GET) && is_array($_GET) && count($_GET) > 0) {
foreach($_GET as $k=>$v) {
if(!in_array($k, array('m','c','a'))) {
$_POST[$k] = $v;
}
}
}
if(isset($_POST['appid'])) {
$this->appid = intval($_POST['appid']);
} else {
exit('0');
}
if(isset($_POST['data'])) {
parse_str(sys_auth($_POST['data'], 'DECODE', $this->applist[$this->appid]['authkey']), $this->data);
if(get_magic_quotes_gpc()) {
$this->data = new_stripslashes($this->data);
}
if(!is_array($this->data)) {
exit('0');
}
} else {
exit('0');
}
if(isset($GLOBALS['HTTP_RAW_POST_DATA'])) {
$this->data['avatardata'] = $GLOBALS['HTTP_RAW_POST_DATA'];
if($this->applist[$this->appid]['authkey'] != $this->data['ps_auth_key']) {
exit('0');
}
}
}
示例7: init
/**
* 首页
*/
public function init()
{
if (isset($_POST['dosubmit'])) {
$denyusername = isset($_POST['denyusername']) ? new_stripslashes(trim($_POST['denyusername'])) : '';
$denyemail = isset($_POST['denyemail']) ? new_stripslashes(trim($_POST['denyemail'])) : '';
$denyemaildata = array2string(explode("\r\n", $denyemail));
$denyusernamedata = array2string(explode("\r\n", $denyusername));
$this->db->insert(array('name' => 'denyemail', 'data' => $denyemaildata), 1, 1);
$this->db->insert(array('name' => 'denyusername', 'data' => $denyusernamedata), 1, 1);
/*写入缓存*/
setcache('settings', array('denyemail' => explode("\r\n", $denyemail), 'denyusername' => explode("\r\n", $denyusername)));
showmessage(L('operation_success'), HTTP_REFERER);
}
$where = to_sqls(array('denyemail', 'denyusername'), '', 'name');
$settingarr = $this->db->listinfo($where);
foreach ($settingarr as $v) {
$setting[$v['name']] = string2array($v['data']);
}
include $this->admin_tpl('system');
}
示例8: template_url
/**
* 生成模板返回路径
* @param integer $id 碎片ID号
* @param string $template 风格
*/
public function template_url($id, $template = '') {
$filepath = CACHE_PATH.'caches_template'.DIRECTORY_SEPARATOR.'block'.DIRECTORY_SEPARATOR.$id.'.php';
$dir = dirname($filepath);
if ($template) {
if(!is_dir($dir)) {
mkdir($dir, 0777, true);
}
$tpl = pc_base::load_sys_class('template_cache');
$str = $tpl->template_parse(new_stripslashes($template));
@file_put_contents($filepath, $str);
} else {
if (!file_exists($filepath)) {
if(!is_dir($dir)) {
mkdir($dir, 0777, true);
}
$tpl = pc_base::load_sys_class('template_cache');
$str = $this->db->get_one(array('id'=>$id), 'template');
$str = $tpl->template_parse($str['template']);
@file_put_contents($filepath, $str);
}
}
return $filepath;
}
示例9: array2string
function array2string($data, $is_addslashes = true)
{
if ($data == '') {
return '';
}
// addslashes 数据需要 stripslashes
if ($is_addslashes) {
$data = new_stripslashes($data);
}
return addslashes(var_export($data, TRUE));
}
示例10: show
/**
* 生成内容页
* @param $file 文件地址
* @param $data 数据
* @param $array_merge 是否合并
* @param $action 方法
* @param $upgrade 是否是升级数据
*/
public function show($file, $data = '', $array_merge = 1, $action = 'add', $upgrade = 0)
{
if ($upgrade) {
$file = '/' . ltrim($file, WEB_PATH);
}
$allow_visitor = 1;
$id = $data['id'];
if ($array_merge) {
$data = new_stripslashes($data);
$data = array_merge($data['system'], $data['model']);
}
//通过rs获取原始值
$rs = $data;
if (isset($data['paginationtype'])) {
$paginationtype = $data['paginationtype'];
$maxcharperpage = $data['maxcharperpage'];
} else {
$paginationtype = 0;
}
$catid = $data['catid'];
$CATEGORYS = $this->categorys;
$CAT = $CATEGORYS[$catid];
$CAT['setting'] = string2array($CAT['setting']);
define('STYLE', $CAT['setting']['template_list']);
//最顶级栏目ID
$arrparentid = explode(',', $CAT['arrparentid']);
$top_parentid = $arrparentid[1] ? $arrparentid[1] : $catid;
//$file = '/'.$file;
//添加到发布点队列
//当站点为非系统站点
if ($this->siteid != 1) {
$site_dir = $this->sitelist[$this->siteid]['dirname'];
$file = $this->html_root . '/' . $site_dir . $file;
}
$this->queue->add_queue($action, $file, $this->siteid);
$modelid = $CAT['modelid'];
require_once CACHE_MODEL_PATH . 'content_output.class.php';
$content_output = new content_output($modelid, $catid, $CATEGORYS);
$output_data = $content_output->get($data);
extract($output_data);
if (module_exists('comment')) {
$allow_comment = isset($allow_comment) ? $allow_comment : 1;
} else {
$allow_comment = 0;
}
$this->db = pc_base::load_model('content_model');
$this->db->set_model($modelid);
//上一页
$previous_page = $this->db->get_one("`catid` = '{$catid}' AND `id`<'{$id}' AND `status`=99", '*', 'id DESC');
//下一页
$next_page = $this->db->get_one("`catid`= '{$catid}' AND `id`>'{$id}' AND `status`=99");
if (empty($previous_page)) {
$previous_page = array('title' => L('first_page', '', 'content'), 'thumb' => IMG_PATH . 'nopic_small.gif', 'url' => 'javascript:alert(\'' . L('first_page', '', 'content') . '\');');
}
if (empty($next_page)) {
$next_page = array('title' => L('last_page', '', 'content'), 'thumb' => IMG_PATH . 'nopic_small.gif', 'url' => 'javascript:alert(\'' . L('last_page', '', 'content') . '\');');
}
$title = strip_tags($title);
//SEO
$seo_keywords = '';
if (!empty($keywords)) {
$seo_keywords = implode(',', $keywords);
}
$siteid = $this->siteid;
$SEO = seo($siteid, $catid, $title, $description, $seo_keywords);
$ishtml = 1;
$template = $template ? $template : $CAT['setting']['show_template'];
//分页处理
$pages = $titles = '';
if ($paginationtype == 1) {
//自动分页
if ($maxcharperpage < 10) {
$maxcharperpage = 500;
}
$contentpage = pc_base::load_app_class('contentpage');
$content = $contentpage->get_data($content, $maxcharperpage);
}
if ($paginationtype != 0) {
//手动分页
$CONTENT_POS = strpos($content, '[page]');
if ($CONTENT_POS !== false) {
$this->url = pc_base::load_app_class('url', 'content');
$contents = array_filter(explode('[page]', $content));
$pagenumber = count($contents);
if (strpos($content, '[/page]') !== false && $CONTENT_POS < 7) {
$pagenumber--;
}
for ($i = 1; $i <= $pagenumber; $i++) {
$upgrade = $upgrade ? '/' . ltrim($file, WEB_PATH) : '';
$pageurls[$i] = $this->url->show($id, $i, $catid, $data['inputtime'], '', '', 'edit', $upgrade);
}
$END_POS = strpos($content, '[/page]');
//.........这里部分代码省略.........
示例11: download
/**
* 附件下载
* Enter description here ...
* @param $field 预留字段
* @param $value 传入下载内容
* @param $watermark 是否加入水印
* @param $ext 下载扩展名
* @param $absurl 绝对路径
* @param $basehref
*/
function download($field, $value, $watermark = '0', $ext = 'gif|jpg|jpeg|bmp|png', $absurl = '', $basehref = '')
{
global $image_d;
$this->att_db = pc_base::load_model('attachment_model');
$upload_url = pc_base::load_config('system', 'upload_url');
$this->field = $field;
$dir = date('Y/md/');
$uploadpath = $upload_url . $dir;
$uploaddir = $this->upload_root . $dir;
$string = new_stripslashes($value);
if (!preg_match_all("/(href|src)=([\"|']?)([^ \"'>]+\\.({$ext}))\\2/i", $string, $matches)) {
return $value;
}
$remotefileurls = array();
foreach ($matches[3] as $matche) {
if (strpos($matche, '://') === false) {
continue;
}
dir_create($uploaddir);
$remotefileurls[$matche] = $this->fillurl($matche, $absurl, $basehref);
}
unset($matches, $string);
$remotefileurls = array_unique($remotefileurls);
$oldpath = $newpath = array();
foreach ($remotefileurls as $k => $file) {
if (strpos($file, '://') === false || strpos($file, $upload_url) !== false) {
continue;
}
$filename = fileext($file);
$file_name = basename($file);
$filename = $this->getname($filename);
$newfile = $uploaddir . $filename;
$upload_func = $this->upload_func;
if ($upload_func($file, $newfile)) {
$oldpath[] = $k;
$GLOBALS['downloadfiles'][] = $newpath[] = $uploadpath . $filename;
@chmod($newfile, 0777);
$fileext = fileext($filename);
if ($watermark) {
watermark($newfile, $newfile, $this->siteid);
}
$filepath = $dir . $filename;
$downloadedfile = array('filename' => $filename, 'filepath' => $filepath, 'filesize' => filesize($newfile), 'fileext' => $fileext);
$aid = $this->add($downloadedfile);
$this->downloadedfiles[$aid] = $filepath;
}
}
return str_replace($oldpath, $newpath, $value);
}
示例12: array2string
/**
* 将数组转换为字符串
* @param array $data 数组
* @param bool $isformdata 如果为0,则不使用new_stripslashes处理,可选参数,默认为1
* @return string 返回字符串,如果,data为空,则返回空
*/
function array2string($data, $isformdata = 1)
{
if ($data == '') {
return '';
}
if ($isformdata) {
$data = new_stripslashes($data);
}
return serialize($data);
}
示例13: view
public function view() {
$url = isset($_GET['url']) && trim($_GET['url']) ? new_stripslashes(urldecode(trim($_GET['url']))) : showmessage(L('illegal_action'), HTTP_REFERER);
$url = str_replace("..","",$url);
if (!file_exists(ZLCMS_PATH.$url)) {
showmessage(L('file_not_exists'));
}
$html = file_get_contents(ZLCMS_PATH.$url);
//判断文件名,如果是database.php 对里面的关键字符进行替换
$basename = basename($url);
if($basename == "database.php"){
//$html = str_replace();
showmessage(L('重要文件,不允许在线查看!'));
}
$file_list = getcache('scan_bad_file', 'scan');
if (isset($file_list[$url]['func']) && is_array($file_list[$url]['func']) && !empty($file_list[$url]['func'])) foreach ($file_list[$url]['func'] as $key=>$val)
{
$func[$key] = strtolower($val[1]);
}
if (isset($file_list[$url]['code']) && is_array($file_list[$url]['code']) && !empty($file_list[$url]['code'])) foreach ($file_list[$url]['code'] as $key=>$val)
{
$code[$key] = strtolower($val[1]);
}
if (isset($func)) $func = array_unique($func);
if (isset($code)) $code = array_unique($code);
$show_header = true;
include $this->admin_tpl('public_view');
}
示例14: image_upload
function image_upload()
{
$field_id = $this->input->get_post('id');
$config = array('module' => 'shop_goods', 'isadmin' => 1, 'sts' => 0, 'class_id' => 1);
$this->load->library('ifile_lib', $config);
$this->ifile_lib->initialize();
//配置初始化文件
$this->ifile_lib->do_uploadfile($field_id);
//上传附件
$re_msg = $this->ifile_lib->error_data();
$re_data = $this->ifile_lib->file_data();
if (!empty($re_msg)) {
$res['error'] = $re_msg[0];
$json = cc_json_encode($res);
echo $json;
return false;
}
$this->file_id = $this->ifile_lib->save_data();
//保存数据到数据库
//if ($this->instance=='shop_goods'){
/**生成水印图片**/
// $wm_info=$this->a_shop_model->get_one(array('shop_id'=>$this->shop_id),'shop_watermark');
// if(isset($wm_info['wm_model'])&& intval($wm_info['wm_model']) >0){
// /**生成水印**/
// $this->load->library('ithumb_lib');
// $full_path=$re_data['full_path'];
// $path_arr=explode('.',$full_path);
// $config['img_path']=$path_arr[0].'_b.'.$path_arr[1];
// $config['wm_model']=$wm_info['wm_model'];
// $config['wm_post']=$wm_info['wm_model']=='1'?$wm_info['txt_pos']:$wm_info['image_pos'];
//
// $config['wm_txt']=$wm_info['txt'];
// $config['wm_txt_size']=$wm_info['txt_size'];
// $config['wm_txt_font']=$wm_info['txt_font'];
// $config['wm_txt_color']=$wm_info['txt_color'];
//
// $config['wm_image_path']=$wm_info['image_path'];
// $config['wm_opacity']=$wm_info['image_transition'];
// $this->ithumb_lib->initialize($config);
// $this->ithumb_lib->water_mark();
// }
//}
$res['msg'] = 'success';
$res['file_id'] = $this->file_id;
$res['realname'] = $re_data['client_name'];
$res['filename'] = $re_data['file_name'];
$base_path = str_replace('\\', '/', FCPATH);
$res['filepath'] = str_replace($base_path, '', $re_data['full_path']);
$json = cc_json_encode($res);
$json = new_stripslashes($json);
echo $json;
//$this->script="window.parent.do_uploadedfile('$json');";
//$this->upload_iframe();
return true;
}
示例15: public_view
public function public_view()
{
$id = isset($_GET['id']) && intval($_GET['id']) ? intval($_GET['id']) : exit('0');
if (!($data = $this->db->get_one(array('id' => $id)))) {
showmessage(L('nofound'));
}
if ($data['type'] == 1) {
exit('<script type="text/javascript">parent.showblock(' . $id . ', \'' . str_replace("\r\n", '', $_POST['data']) . '\')</script>');
} elseif ($data['type'] == 2) {
extract($data);
unset($data);
$title = isset($_POST['title']) ? $_POST['title'] : '';
$url = isset($_POST['url']) ? $_POST['url'] : '';
$thumb = isset($_POST['thumb']) ? $_POST['thumb'] : '';
$desc = isset($_POST['desc']) ? $_POST['desc'] : '';
$template = isset($_POST['template']) && trim($_POST['template']) ? trim($_POST['template']) : '';
$data = array();
foreach ($title as $key => $v) {
if (empty($v) || !isset($url[$key]) || empty($url[$key])) {
continue;
}
$data[$key] = array('title' => $v, 'url' => $url[$key], 'thumb' => $thumb[$key], 'desc' => str_replace(array(chr(13), chr(43)), array('<br />', ' '), $desc[$key]));
}
$tpl = pc_base::load_sys_class('template_cache');
$str = $tpl->template_parse(new_stripslashes($template));
$filepath = CACHE_PATH . 'caches_template' . DIRECTORY_SEPARATOR . 'block' . DIRECTORY_SEPARATOR . 'tmp_' . $id . '.php';
$dir = dirname($filepath);
if (!is_dir($dir)) {
@mkdir($dir, 0777, true);
}
if (@file_put_contents($filepath, $str)) {
ob_start();
include $filepath;
$html = ob_get_contents();
ob_clean();
@unlink($filepath);
}
exit('<script type="text/javascript">parent.showblock(' . $id . ', \'' . str_replace("\r\n", '', $html) . '\')</script>');
}
}