本文整理匯總了PHP中helper::escape_stripslashes方法的典型用法代碼示例。如果您正苦於以下問題:PHP helper::escape_stripslashes方法的具體用法?PHP helper::escape_stripslashes怎麽用?PHP helper::escape_stripslashes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類helper
的用法示例。
在下文中一共展示了helper::escape_stripslashes方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: get_content
//.........這裏部分代碼省略.........
// 資訊簡介
if ($content['info_desc'] == '') {
$content['info_desc'] = helper::utf8_substr(preg_replace('~(<style[^>]*>[\\w\\W]*?</style>)|(<[^>]*>)|(\\r)|(\\n)|(\\t)~', '', $content['info_body']), 0, 220);
}
$content['resource'] = $this->get_resource($id);
// 取外部資源
//查詢關係表中的關鍵字ID
$sql = "select keyword_id from " . TB_PREFIX . "keyword_relation where info_id= '{$id}'";
$r = $this->dbm->query($sql);
$ids = array();
for ($i = 0; $i < count($r['list']); $i++) {
$ids[] = $r['list'][$i]['keyword_id'];
}
if (is_array($ids) && !empty($ids)) {
$content['keword_ids'] = implode(',', $ids) . ',';
}
$sql = "select * from " . TB_PREFIX . "keyword where keyword_id in (" . implode(',', $ids) . ")";
$ret = $this->dbm->query($sql);
$content['tags_html'] = '';
if (count($ret['list']) > 0) {
$content['tags'] = array();
foreach ($ret['list'] as $k => $v) {
$content['tags'][] = $v['keyword'];
$content['tags_html'] .= '<a href="' . $this->url->encode('tag_index', array('host' => SITE_PATH, 'extid' => $this->categories[$content['last_cate_id']]['extern_id'], 'id' => $v['keyword_id'])) . '" target="_blank">' . $v['keyword'] . '</a> ';
}
}
//如果文章圖片為空,把資源的第一個圖片放到文章圖片上
if (empty($content['info_img']) && count($content['resource']) > 0) {
$content['info_img'] = isset($content['resource'][0]['resource_url']) ? $content['resource'][0]['resource_url'] : '';
}
// 取上下篇
$rs_next = $this->get_list(array('type' => 0, 'cate_id' => $content['last_cate_id'], 'where' => " info_id>" . $id . " and info_url=''", 'pagesize' => 1, 'order' => 'order by info_id asc', 'no_cache' => $no_cache));
$rs_prev = $this->get_list(array('type' => 0, 'cate_id' => $content['last_cate_id'], 'where' => " info_id<" . $id . " and info_url=''", 'pagesize' => 1, 'order' => 'order by info_id desc', 'no_cache' => $no_cache));
$content['next']['surl'] = '';
$content['next']['info_title'] = '';
if (count($rs_next['list']) > 0) {
$content['next']['surl'] = $rs_next['list'][0]['surl'];
$content['next']['info_title'] = $rs_next['list'][0]['info_stitle'] == '' ? $rs_next['list'][0]['info_title'] : $rs_next['list'][0]['info_stitle'];
}
$content['prev']['surl'] = '';
$content['prev']['info_title'] = '';
if (count($rs_prev['list']) > 0) {
$content['prev']['surl'] = $rs_prev['list'][0]['surl'];
$content['prev']['info_title'] = $rs_prev['list'][0]['info_stitle'] == '' ? $rs_prev['list'][0]['info_title'] : $rs_prev['list'][0]['info_stitle'];
}
$surl_domain = $this->bind_domain($content['last_cate_id']);
$content['surl'] = ($surl_domain == '' ? $this->url_recheck() : $surl_domain) . $this->url->encode('content_info', array('host' => SITE_PATH, 'id' => $id));
// 是否生成正文內鏈
if (CONTENT_NLINK == '1') {
$content['info_body'] = $this->nlink($content['info_body']);
}
//資訊正文手工分頁
if ($is_page == 1) {
$pattern = '~<div style="page-break-after: always;">(.*)</div>~isU';
if (preg_match($pattern, $content['info_body'], $arr)) {
$content['info_body'] = helper::escape_stripslashes($content['info_body']);
$content_arr = preg_split($pattern, $content['info_body']);
$_html = '<div class="pagebar" style="margin:10px 0 0 0;padding:0;">';
$content_total = count($content_arr);
$pageno = isset($_GET['p']) ? intval($_GET['p']) : 1;
if (is_numeric($pageno) && $pageno < 1) {
$pageno = 1;
}
if ($pageno > $content_total) {
$pageno = $content_total;
}
for ($i = 1; $i <= $content_total; $i++) {
if ($pageno == $i) {
$_html .= '<span class="now_class">' . $i . '</span>';
} else {
//$_nurl = helper :: url_replace($i, 'pageno');
$_nurl = $this->url->encode('content_info_page', array('host' => SITE_PATH, 'id' => $id, 'p' => $i));
//$_nurl = $id.'_'.$i.'.html';
$_html .= '<a href="' . $_nurl . '">' . $i . '</a>';
}
}
$_html .= '</div><br /><br />';
$content['info_body'] = $content_arr[$pageno - 1] . $_html;
}
}
// 取擴展表
//$extern = $this -> get_extern_by_cate_id($content['last_cate_id']);
/*$content['extern'] = array();
if ($extern['extern_name'] != '') {
$content['extern'] = $this -> get_extern($extern['extern_name'],$id);
}*/
}
$p = isset($_GET['p']) ? $_GET['p'] : 1;
// 取評論代碼
if (defined('COMMENT_CODE') && COMMENT_CODE != '') {
$content['comment_code'] = COMMENT_CODE;
} else {
$content['comment_code'] = '';
if (file_exists(dirname(__FILE__) . "/../plugins/gov.comment/comment_html.php")) {
require_once dirname(__FILE__) . "/../plugins/gov.comment/comment_html.php";
$content['comment_code'] = '<div id="comment_list">' . get_comments($id, $p) . getcomment_form($id, 'comment') . '</div>';
}
}
return $content;
}
示例2: m__del
/**
* 刪除選中的數據
* 支持單個刪除 根據post數據來獲取需要刪除的數據的信息
*/
function m__del()
{
global $l_obj;
//判斷操作權限
check_level("E08");
global $dbm;
//print_r($_POST);
foreach ($_POST as $k => $v) {
if (!is_array($v)) {
$_POST[$k] = helper::escape_stripslashes($v);
}
}
//判斷是否是單張圖片的刪除
if (isset($_POST['info']) && !is_array($_POST['info'])) {
$_POST['resource_info'] = array();
$_POST['resource_info'][] = json_decode($_POST['info'], true);
}
//去反斜杠
$arr = $_POST['resource_info'];
//循環刪除
foreach ($arr as $v) {
//拚接圖片的路徑
$img_path = str_replace('\\', '/', dirname(__FILE__)) . '/..' . $v['resource_url'];
//file_put_contents('log.php',$img_path);exit;
//刪除圖片
@unlink($img_path);
//刪除圖片縮略圖
$x = strripos($img_path, '/');
$thumb_img = substr($img_path, 0, $x + 1) . "thumb_" . substr($img_path, $x + 1);
@unlink($thumb_img);
//在刪除網站配置的圖片時會因為它們沒有縮略圖而報Warning
//嘗試刪除文件所在目錄,若為空,且有權限則刪除。
@rmdir(dirname($thumb_img));
//刪除圖片資源記錄
$where = " id = '" . $v['resource_id'] . "'";
if ($v['resource_id'] == 'undefined') {
//是網站配置的圖片
$where = " resource_url like '%" . $v['resource_url'] . "%'";
//將對應網站配置設置為空
$config = $_SERVER['DOCUMENT_ROOT'] . SITE_PATH . '/core/config.php';
$cf = file_get_contents($config);
set_config($v['id_zhi'], '', $cf);
file_put_contents($config, $cf);
}
$res = $dbm->single_del(TB_PREFIX . "resource_list", $where);
if (!empty($res['error'])) {
continue;
}
//print_r($v);
//刪除圖片資源關聯的數據 若是分類則不刪除分類數據
if ($v['table_name'] != 'undefined' && $v['table_name'] != 'category') {
//圖片關聯到了其它表中的數據
$where = " " . $v['id_name'] . " = '" . $v['id_zhi'] . "'";
if ($v['id_name'] == 'area_html') {
$where = " " . $v['id_name'] . " like '%" . $v['id_zhi'] . "%'";
}
$res = $dbm->single_del(TB_PREFIX . $v['table_name'], $where);
if (!empty($res['error'])) {
continue;
}
}
}
$l_obj->insert("刪除資源成功");
die('{"code":"0","msg":"刪除成功"}');
}
示例3: m__cate_order
function m__cate_order()
{
global $dbm, $c;
//判斷操作權限
check_level("C0403");
$_POST['params'] = helper::escape_stripslashes($_POST['params'], 1);
$ids = json_decode($_POST['params'], 1);
foreach ($ids as $a) {
$dbm->single_update(TB_PREFIX . "category", array('corder' => $a['val']), "cate_id='" . $a['id'] . "'");
}
$c->update_cate();
logs("修改分類排序成功");
die('{"code":"0","msg":"分類排序修改成功"}');
}
示例4: m__save_attr
function m__save_attr()
{
global $dbm;
//判斷操作權限
check_level("E0403");
$area_id = isset($_GET['area_id']) ? intval($_GET['area_id']) : 0;
if ($area_id == 0) {
die('{"code":1,"msg":"廣告位不存在"}');
}
$a = $dbm->query("select * from " . TB_PREFIX . "recommend_area where area_id='{$area_id}'");
if (count($a['list']) < 1) {
die('{"code":1,"msg":"廣告位不存在"}');
}
$area = $a['list'][0];
//模型
$attr = unserialize($area['area_html']);
// 初始化數據
foreach ($_POST as $a => $b) {
$_POST[$a] = helper::sqlxss($b, 1);
$_POST[$a] = preg_replace('~"~', '"', $_POST[$a]);
$_POST[$a] = helper::escape_stripslashes($_POST[$a]);
if ($a == 'tag' && $b == '') {
die('{"code":1,"msg":"標識不能為空,並且不可重複"}');
}
//if($a=='img' && $b=='') die('{"code":1,"msg":"圖片不能為空"}');
}
unset($_POST['hashtoken']);
//去掉不必要的參數
if (isset($_POST['flash_file'])) {
unset($_POST['flash_file']);
}
// 如果是代碼廣告
if (isset($_POST['area_html'])) {
$attr['list'] = $_POST['area_html'];
} else {
// 判斷屬性是否存在
$attr_has = '-1';
foreach ($attr['list'] as $k => $v) {
if (!isset($attr['list'][$k]['tag'])) {
$attr['list'][$k]['tag'] = $attr['list'][$k]['title'];
}
if ($attr['list'][$k]['tag'] == $_POST['tag']) {
$attr_has = $k;
break;
}
}
if ($attr_has == '-1') {
array_push($attr['list'], $_POST);
//新增
} else {
$attr['list'][$attr_has] = $_POST;
//修改
}
}
$attr_content = serialize($attr);
$attr_content = preg_replace("~'~", "\\'", $attr_content);
// 寫入數據庫
$res = $dbm->query_update("update " . TB_PREFIX . "recommend_area set area_html='{$attr_content}' where area_id='{$area_id}'");
logs("修改管理廣告位ID為:" . $area_id . "下麵的廣告成功" . $attr_content);
die('{"code":0,"msg":"保存成功"}');
}