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


PHP helper::escape_stripslashes方法代码示例

本文整理汇总了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>&nbsp;&nbsp;';
             }
         }
         //如果文章图片为空,把资源的第一个图片放到文章图片上
         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;
 }
开发者ID:cranefly,项目名称:crane,代码行数:101,代码来源:common.class.php

示例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":"删除成功"}');
}
开发者ID:cranefly,项目名称:crane,代码行数:69,代码来源:resource.php

示例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":"分类排序修改成功"}');
}
开发者ID:cranefly,项目名称:crane,代码行数:14,代码来源:category.php

示例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('~"~', '&#34;', $_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":"保存成功"}');
}
开发者ID:cranefly,项目名称:crane,代码行数:61,代码来源:ad.php


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