Esempio n. 1
0
 public function search()
 {
     //获取地址栏参数并读取栏目缓存信息
     $url = get_url_where();
     $list = F('_gxcms/channel');
     $channel = $list[999];
     //搜索条件
     if ($url['wd']) {
         $search['title'] = array('like', '%' . $url['wd'] . '%');
         $search['remark'] = array('like', '%' . $url['wd'] . '%');
         $jumpurl['wd'] = urlencode($url['wd']);
     }
     if ($url['id']) {
         if (get_channel_son($url['id'])) {
             $where['cid'] = $url['id'];
         } else {
             $where['cid'] = get_channel_sqlin($url['id']);
         }
         $jumpurl['id'] = $url['id'];
     }
     if (isset($search)) {
         $search['_logic'] = 'or';
         $where['_complex'] = $search;
     }
     if ($url['order'] != 'addtime') {
         $jumpurl['order'] = $url['order'];
     }
     $where['status'] = array('eq', 1);
     $rs = M('Info');
     $count = $rs->where($where)->count('id');
     //组合分页信息(强制为动态模式)
     C('url_html_channel', 0);
     $jumpurl['p'] = '';
     $totalpages = ceil($count / $channel['info']);
     if ($url['page'] > $totalpages) {
         $url['page'] = $totalpages;
     }
     $pages = '共' . $count . '篇文章 当前:' . $url['page'] . '/' . $totalpages . '页 ';
     $pages .= get_cms_page_css($url['page'], $totalpages, C('web_home_pagenum'), str_replace('/lists', '/search', get_show_url('info', $jumpurl, 2)), false);
     //前台模板变量赋值
     $channel['cid'] = $url['id'];
     $channel['keyword'] = $url['wd'];
     $channel['order'] = $url['order'];
     $channel['count'] = $count;
     $channel['page'] = $url['page'];
     $channel['pages'] = $pages;
     if ($url['page'] > 1) {
         $channel['webtitle'] = '搜索 ' . $url['wd'] . ' 的结果列表 -第' . $url['page'] . '页-' . C('web_name');
     } else {
         $channel['webtitle'] = '搜索 ' . $url['wd'] . ' 的结果列表 -' . C('web_name');
     }
     $channel['navtitle'] = '<a href="' . C('web_path') . '">首页</a> &gt; <span>搜索页</span>';
     //先给bdsearch标签传值后再输出模板
     C('bdsearch_page', $url['page']);
     C('bdsearch_where', $where);
     $this->assign($channel);
     $this->display('info_search');
 }
Esempio n. 2
0
 public function show()
 {
     $where = array();
     $cid = $_REQUEST['cid'];
     $keyword = urldecode(trim($_REQUEST['keyword']));
     if ($cid) {
         if (get_channel_son($cid)) {
             $where['cid'] = $cid;
         } else {
             $where['cid'] = get_channel_sqlin($cid);
         }
     }
     if ($keyword) {
         $search['title'] = array('like', '%' . $keyword . '%');
         $map = $search;
         $map['_logic'] = 'or';
         $where['_complex'] = $map;
     }
     $info['type'] = !empty($_GET['type']) ? $_GET['type'] : C('web_admin_ordertype');
     $info['order'] = !empty($_GET['order']) ? $_GET['order'] : 'desc';
     $order = $info["type"] . ' ' . $info['order'];
     //分页开始
     $news_count = $this->InfoDB->where($where)->count('id');
     $news_page = !empty($_GET['p']) ? intval($_GET['p']) : 1;
     $news_page = get_cms_page_max($news_count, C('web_admin_pagenum'), $news_page);
     $news_url = U('Admin-Info/Show', array('cid' => $cid, 'type' => $info['type'], 'order' => $info['order'], 'keyword' => urlencode($keyword), 'p' => ''), false, false);
     $listpages = get_cms_page($news_count, C('web_admin_pagenum'), $news_page, $news_url, '条文章');
     $_SESSION['info_reurl'] = $news_url . $news_page;
     //查询数据
     $list = $this->InfoDB->where($where)->order($order)->limit(C('web_admin_pagenum'))->page($news_page)->select();
     if (empty($list)) {
         if ($cid || $keyword) {
             $this->assign("jumpUrl", C('cms_admin') . '?s=Admin/Info/Show');
             $this->error('没有查询到您所筛选的文章资讯,请重新选择条件!');
         } else {
             $this->assign("jumpUrl", C('cms_admin') . '?s=Admin/Info/Add');
             $this->error('还没有任何资讯,请先添加!');
         }
     }
     foreach ($list as $key => $val) {
         $list[$key]['cname'] = get_channel_name($list[$key]['cid']);
         $list[$key]['channelurl'] = U('Admin-Info/Show', array('cid' => $list[$key]['cid']), false, false);
         $list[$key]['infourl'] = get_read_url('info', $list[$key]['id'], $list[$key]['cid'], $list[$key]['jumpurl']);
         $list[$key]['stararr'] = get_star_arr($list[$key]['stars']);
     }
     $this->assign($listpages);
     $this->assign('order', $order);
     $this->assign('cid', $cid);
     $this->assign('keyword', $keyword);
     $this->assign('list_channel_info', F('_gxcms/channelinfo'));
     $this->assign('list_info', $list);
     $this->display('views/admin/info_show.html');
 }
 public function show()
 {
     $cid = intval($_GET['id']);
     if ($cid) {
         $where['id'] = get_channel_sqlin($cid);
     }
     $list = $this->ChannelDB->where($where)->order('oid asc')->select();
     if ($list) {
         $this->assign('listtree', list_to_tree($list, 'id', 'pid', 'son', 0));
         $this->display('./views/admin/channel_show.html');
     } else {
         $this->assign("jumpUrl", C('cms_admin') . '?s=Admin/Channel/Add');
         $this->success('暂无栏目分类,请先添加!');
     }
 }
 function SearchCon($Get)
 {
     if ($Get['cid']) {
         if (get_channel_son($Get['cid'])) {
             $where['cid'] = $Get['cid'];
         } else {
             $where['cid'] = get_channel_sqlin($Get['cid']);
         }
     }
     if ($Get['status'] || $Get['status'] === '0') {
         $where['status'] = array('eq', intval($Get['status']));
     }
     if ($Get['keyword']) {
         $search['title'] = array('like', '%' . $Get['keyword'] . '%');
         $search['intro'] = array('like', '%' . $Get['keyword'] . '%');
         $search['actor'] = array('like', '%' . $Get['keyword'] . '%');
         $search['director'] = array('like', '%' . $Get['keyword'] . '%');
         $search['_logic'] = 'or';
         $where['_complex'] = $search;
     }
     //
     return $where;
 }
Esempio n. 5
0
function get_tag_gxcms($tag)
{
    $table = !empty($tag['name']) ? trim($tag['name']) : 'video';
    $field = !empty($tag['field']) ? trim($tag['field']) : '*';
    $limit = !empty($tag['limit']) ? trim($tag['limit']) : '10';
    if ($table == 'self' && !$tag['order']) {
        $tag['order'] = 'orders desc';
    }
    $order = !empty($tag['order']) ? trim($tag['order']) : 'addtime desc';
    if ($table != 'link' && $table != 'self') {
        $where['status'] = array('eq', 1);
    }
    if ($tag['time']) {
        $where['addtime'] = array('gt', xtime($tag['time']));
    }
    if ($tag['hits']) {
        $hits = explode(',', trim($tag['hits']));
        if (count($hits) > 1) {
            $where['hits'] = array('between', $hits[0] . ',' . $hits[1]);
        } else {
            $where['hits'] = array('gt', $hits[0]);
        }
    }
    //根据索引规则放置CID前
    if ($tag['cid']) {
        $cids = explode(',', trim($tag['cid']));
        if ($table == 'self') {
            $where['cid'] = array('eq', $tag['cid']);
        } else {
            if (count($cids) > 1) {
                $where['cid'] = array('in', get_channel_remove($cids));
            } else {
                $where['cid'] = get_channel_sqlin($tag['cid']);
            }
        }
    }
    if ($tag['sid']) {
        $sid = $tag['sid'];
        $sidArr = explode(',', $sid);
        if (count($sidArr > 0)) {
            foreach ($sidArr as $v) {
                $where['_string'] = "FIND_IN_SET('{$v}',stype_mcid)";
            }
        } else {
            $where['_string'] = "FIND_IN_SET('{$sid}',stype_mcid)";
        }
    }
    if ($tag['ids']) {
        $where['id'] = array('in', trim($tag['ids']));
    }
    if ($tag['stars']) {
        $where['stars'] = array('in', trim($tag['stars']));
    }
    if ($tag['letter']) {
        $where['letter'] = array('eq', trim($tag['letter']));
    }
    if ($tag['keyword']) {
        $keyword = trim($tag['keyword']);
        $where['title'] = array('like', '%' . $keyword . '%');
    }
    if ($tag['serial'] && $table == 'video') {
        $serial = trim($tag['serial']);
        if ('all' == $serial) {
            $where['serial'] = array('neq', 0);
        } else {
            $where['serial'] = array('gt', $serial);
        }
    }
    if ($tag['up']) {
        $up = explode(',', trim($tag['up']));
        if (count($up) > 1) {
            $where['up'] = array('between', $up[0] . ',' . $up[1]);
        } else {
            $where['up'] = array('gt', $up[0]);
        }
    }
    if ($tag['down']) {
        $down = explode(',', trim($tag['down']));
        if (count($down) > 1) {
            $where['down'] = array('between', $down[0] . ',' . $down[1]);
        } else {
            $where['down'] = array('gt', $down[0]);
        }
    }
    if ($tag['score']) {
        $score = explode(',', trim($tag['score']));
        if (count($score) > 1) {
            $where['score'] = array('between', $score[0] . ',' . $score[1]);
        } else {
            $where['score'] = array('gt', $score[0]);
        }
    }
    if ($tag['scoreer']) {
        $scoreer = explode(',', trim($tag['scoreer']));
        if (count($scoreer) > 1) {
            $where['scoreer'] = array('between', $scoreer[0] . ',' . $scoreer[1]);
        } else {
            $where['scoreer'] = array('gt', $scoreer[0]);
        }
    }
    $rs = M($table);
    $list = $rs->field($field)->where($where)->order($order)->limit($limit)->select();
    //dump($rs->getLastSql());
    if ('special' == $table) {
        foreach ($list as $key => $val) {
            $list[$key]['readurl'] = get_read_url($table, $list[$key]['id'], $list[$key]['cid']);
            $list[$key]['logo'] = get_img_url($list[$key]['logo']);
            $list[$key]['banner'] = get_img_url_s($list[$key]['banner']);
        }
    } else {
        foreach ($list as $key => $val) {
            $list[$key]['showname'] = get_channel_name($list[$key]['cid']);
            $list[$key]['showurl'] = get_show_url($table, array('id' => $list[$key]['cid']), 1);
            $list[$key]['readurl'] = get_read_url($table, $list[$key]['id'], $list[$key]['cid'], $list[$key]['jumpurl']);
            $list[$key]['playerurl'] = get_play_url($list[$key]['id'], $list[$key]['cid'], 1);
            $list[$key]['picurlsmall'] = get_img_url_s($list[$key]['picurl'], $list[$key]['content']);
            $list[$key]['picurl'] = get_img_url($list[$key]['picurl'], $list[$key]['content']);
        }
    }
    if ($table == 'special') {
        var_dump($list);
    }
    return $list;
}
Esempio n. 6
0
 public function show()
 {
     //get params
     $where = array();
     $cid = $_REQUEST['cid'];
     $status = $_REQUEST['status'];
     $serial = $_REQUEST['serial'];
     $picurl = $_REQUEST['picurl'];
     $keyword = urldecode(trim($_REQUEST['keyword']));
     //search condition
     if ($cid) {
         if (get_channel_son($cid)) {
             $where['cid'] = $cid;
         } else {
             $where['cid'] = get_channel_sqlin($cid);
         }
     }
     if ($status || $status === '0') {
         $where['status'] = array('eq', intval($status));
     }
     if ($serial) {
         $where['serial'] = array('neq', 0);
     }
     if ($picurl) {
         $where['Left(picurl,7)'] = array('eq', 'fail://');
     }
     if ($keyword) {
         $search['title'] = array('like', '%' . $keyword . '%');
         $search['intro'] = array('like', '%' . $keyword . '%');
         $search['actor'] = array('like', '%' . $keyword . '%');
         $search['director'] = array('like', '%' . $keyword . '%');
         $search['_logic'] = 'or';
         $where['_complex'] = $search;
     }
     //
     $video['type'] = !empty($_GET['type']) ? $_GET['type'] : C('web_admin_ordertype');
     $video['order'] = !empty($_GET['order']) ? $_GET['order'] : 'desc';
     $order = $video["type"] . ' ' . $video['order'];
     //
     $video_count = $this->VideoDB->where($where)->count('id');
     $video_page = !empty($_GET['p']) ? intval($_GET['p']) : 1;
     $video_page = get_cms_page_max($video_count, C('web_admin_pagenum'), $video_page);
     $video_url = U('Admin-Video/Show', array('cid' => $cid, 'status' => $status, 'serial' => $serial, 'picurl' => $picurl, 'type' => $video['type'], 'order' => $video['order'], 'keyword' => urlencode($keyword), 'p' => ''), false, false);
     $listpages = get_cms_page($video_count, C('web_admin_pagenum'), $video_page, $video_url, '部影片');
     $_SESSION['video_reurl'] = $video_url . $video_page;
     //
     $list = $this->VideoDB->where($where)->order($order)->limit(C('web_admin_pagenum'))->page($video_page)->select();
     if (empty($list)) {
         if ($status || $serial || $cid || $keyword) {
             $this->assign("jumpUrl", C('cms_admin') . '?s=Admin/Video/Show');
             $this->error('没有查询到您所筛选的影片信息,请重新选择条件!');
         } else {
             $this->assign("jumpUrl", C('cms_admin') . '?s=Admin/Video/Add');
             if (empty($picurl)) {
                 $this->error('还没有任何影片,请先添加一部影片!');
             }
         }
     }
     foreach ($list as $key => $val) {
         $list[$key]['cname'] = get_channel_name($list[$key]['cid']);
         $list[$key]['channelurl'] = U('Admin-Video/Show', array('cid' => $list[$key]['cid']), false, false);
         $list[$key]['videourl'] = get_read_url('video', $list[$key]['id'], $list[$key]['cid']);
         $list[$key]['stararr'] = get_star_arr($list[$key]['stars']);
     }
     //dump($this->VideoDB->getLastSql());
     $this->assign($listpages);
     $this->assign('order', $order);
     $this->assign('cid', $cid);
     $this->assign('keyword', $keyword);
     $this->assign('list_channel_video', F('_gxcms/channelvideo'));
     $this->assign('list_video', $list);
     $this->display('views/admin/video_show.html');
 }
Esempio n. 7
0
 public function inforead()
 {
     $go = intval($_GET['go']);
     $arid = intval($_REQUEST["arid"]);
     $this->checkhtml(C('url_html'), '文章内容', '?s=Admin/Html/Infoshow/asid/0/go/' . $go);
     echo '<div class="htmllist" id="show" style="font-size:12px;">';
     $rs = M("Info");
     $where['status'] = 1;
     if ($arid) {
         if (get_channel_son($arid)) {
             $where['cid'] = $arid;
         } else {
             $where['cid'] = get_channel_sqlin($arid);
         }
     }
     $count = $rs->where($where)->count('id');
     $listRows = C('url_create_num');
     //每页生成数
     $totalpages = ceil($count / $listRows);
     //总生成页数
     //当前页数
     $nowpage = !empty($_GET['page']) ? $_GET['page'] : 1;
     $nowpage = intval($nowpage);
     if (!empty($totalpages) && $nowpage > $totalpages) {
         $nowpage = $totalpages;
     }
     echo '<li>总共需要生成<span>' . $count . '</span>篇文章,每页生成<span>' . $listRows . '</span>篇,共需要分<span>' . $totalpages . '</span>页生成,当前正在生成第<span>' . $nowpage . '</span>页。</li>';
     $list = $rs->where($where)->order('addtime desc')->limit($listRows)->page($nowpage)->select();
     foreach ($list as $key => $value) {
         $this->createinfo($value);
     }
     echo '</div><script>document.getElementById("show").style.display="none";</script>';
     if ($nowpage < $totalpages) {
         //是否生成完成
         $this->assign("waitSecond", C('url_create_time'));
         $this->assign("jumpUrl", C('cms_admin') . '?s=Admin/Html/Inforead/arid/' . $arid . '/page/' . ($nowpage + 1) . '/go/' . $go);
         $this->success('第(' . $nowpage . ')页已经完成,正在准备下一个,请稍等!');
     } else {
         if ($go) {
             $this->assign("jumpUrl", C('cms_admin') . '?s=Admin/Html/Infoshow/asid/0/go/' . $go);
             $this->success('恭喜您!所有新闻内容页已经生成完毕,正在准备生成新闻栏目页,请稍等!');
         } else {
             $this->assign("jumpUrl", C('cms_admin') . '?s=Admin/Html/Show');
             $this->success('恭喜您!所有静态化网页的任务已经完成!');
         }
     }
 }