示例#1
0
 function delete()
 {
     $id = hg_filter_ids(urldecode($this->input['id']));
     if (!$id) {
         $this->errorOutput(OBJECT_NULL);
     }
     $sql = "DELETE FROM " . DB_PREFIX . "webapp_rank WHERE id IN(" . $id . ")";
     $this->db->query($sql);
     $this->addItem($id);
     $this->output();
 }
示例#2
0
 public function delete()
 {
     $ids = trim(urldecode($this->input['id']));
     $ids = hg_filter_ids($ids);
     if (empty($ids)) {
         $this->errorOutput(OBJECT_NULL);
     }
     $result = $this->webapp->delete($ids);
     $this->addItem($result);
     $this->output();
 }
示例#3
0
 public function get_condition()
 {
     $conditions = ' AND  fid = ' . intval($this->input['fid']);
     if (isset($this->input['k']) && !empty($this->input['k'])) {
         //	$condition .= ' AND name like \'%'.urldecode($this->input['k']).'%\'';
     }
     if (isset($this->input['id']) && $this->input['id']) {
         $this->input['id'] = hg_filter_ids($this->input['id']);
         $conditions .= ' AND id IN(' . trim(urldecode($this->input['id'])) . ')';
     }
     return $conditions;
 }
示例#4
0
文件: channel.php 项目: h3len/Project
 private function get_condition()
 {
     $condition = ' AND status = 1';
     if (isset($this->input['k']) && !empty($this->input['k'])) {
         $condition .= ' AND name like \'%' . trim($this->input['k']) . '%\'';
     }
     if (isset($this->input['id']) && $this->input['id']) {
         $this->input['id'] = hg_filter_ids($this->input['id']);
         $condition .= " AND id IN (" . trim($this->input['id']) . ")";
     }
     if (isset($this->input['channel_id']) && $this->input['channel_id']) {
         $this->input['channel_id'] = hg_filter_ids($this->input['channel_id']);
         $condition .= " AND id IN (" . trim($this->input['channel_id']) . ")";
     }
     if (isset($this->input['is_mobile_phone'])) {
         $condition .= " AND is_mobile_phone = " . intval($this->input['is_mobile_phone']);
     }
     if (isset($this->input['is_control'])) {
         $condition .= " AND is_control = " . intval($this->input['is_control']);
     }
     if (isset($this->input['is_audio'])) {
         $condition .= " AND is_audio = " . intval($this->input['is_audio']);
     }
     if (intval($this->input['get_record'])) {
         $condition .= " AND can_record = 1";
     }
     if (isset($this->input['audio_only'])) {
         $condition .= " AND is_audio = " . intval($this->input['audio_only']);
     }
     if (isset($this->input['is_sys']) && intval($this->input['is_sys']) != -1) {
         $condition .= " AND is_sys = " . intval($this->input['is_sys']);
     }
     if (isset($this->input['server_id'])) {
         $condition .= " AND server_id = " . intval($this->input['server_id']);
     }
     return $condition;
 }
示例#5
0
 function get_condition()
 {
     $condition = '';
     //默认只搜索出所有全局的广告内容
     if ($this->input['group']) {
         $group = explode(',', trim(urldecode($this->input['group'])));
         if ($group && !array_diff($group, $this->settings['hg_ad_flag'])) {
             $condition .= ' AND `group` in("' . implode('","', $group) . '")';
         } else {
             $condition .= ' AND `group` in("website")';
         }
     }
     //广告位ID条件
     if ($this->input['pid']) {
         $pids_str = hg_filter_ids($this->input['pid']);
         $condition .= ' AND p.pos_id in(' . $pids_str . ')';
     }
     /*
     //广告位英文标识
     if($this->input['flag'])
     {
     	$condition .= ' AND p.pos_flag in("'.str_replace(',', '","',trim(urldecode($this->input['flag']))).'")';
     }
     //广告位内容ID
     if($this->input['aid'])
     {
     	$condition .= ' AND p.ad_id in('.trim(urldecode($this->input['aid'])).')';
     }
     //广告动画ID
     if($this->input['aniid'])
     {
     	$condition .= ' AND p.ani_id in('.trim(urldecode($this->input['aniid'])).')';
     }
     //发布策略ID
     if($this->input['id'])
     {
     	$condition .= ' AND p.id in('.trim(urldecode($this->input['id'])).')';
     }
     //有效广告 时间段
     if(!$this->input['preview'])
     {
     	$condition .= ' AND c.start_time <= '.TIMENOW;
     	$condition .= ' AND c.status=1 ';
     }
     */
     //只读取分组启用的数据
     $condition .= ' AND g.is_use = 1 and c.status IN(1,3)';
     return $condition;
 }
示例#6
0
文件: channel.php 项目: h3len/Project
 private function get_condition()
 {
     $condition = ' AND status = 1';
     if (isset($this->input['k']) && !empty($this->input['k'])) {
         $condition .= ' AND name like \'%' . trim($this->input['k']) . '%\'';
     }
     if (isset($this->input['id']) && $this->input['id']) {
         $this->input['id'] = hg_filter_ids($this->input['id']);
         $condition .= " AND id IN (" . trim($this->input['id']) . ")";
     }
     if (isset($this->input['channel_id']) && $this->input['channel_id']) {
         $this->input['channel_id'] = hg_filter_ids($this->input['channel_id']);
         $condition .= " AND id IN (" . trim($this->input['channel_id']) . ")";
     }
     if (isset($this->input['code']) && $this->input['code']) {
         $condition .= " AND code = '" . trim($this->input['code']) . "' ";
     }
     if (isset($this->input['is_mobile_phone'])) {
         $condition .= " AND is_mobile_phone = " . intval($this->input['is_mobile_phone']);
     }
     if (isset($this->input['is_control'])) {
         $condition .= " AND is_control = " . intval($this->input['is_control']);
     }
     if (intval($this->input['get_record'])) {
         $condition .= " AND can_record = 1";
     }
     if (isset($this->input['is_audio'])) {
         $condition .= " AND is_audio = " . intval($this->input['is_audio']);
     }
     if (isset($this->input['audio_only'])) {
         $condition .= " AND is_audio = " . intval($this->input['audio_only']);
     }
     if (isset($this->input['status'])) {
         $condition .= " AND status = " . intval($this->input['status']);
     }
     if (isset($this->input['not_id']) && $this->input['not_id']) {
         $condition .= " AND id NOT IN (" . trim($this->input['not_id']) . ")";
     }
     if (isset($this->input['node_id']) && $this->input['node_id']) {
         $sql = "SELECT * FROM " . DB_PREFIX . "channel_node WHERE id IN(" . trim($this->input['node_id']) . ")";
         $q = $this->db->query($sql);
         $all_node = $space = '';
         while ($row = $this->db->fetch_array($q)) {
             if ($row['childs']) {
                 $all_node .= $space . $row['childs'];
                 $space = ',';
             }
         }
         if ($all_node) {
             $all_node .= ',' . trim($this->input['node_id']);
             $node_id = implode(',', array_unique(explode(',', $all_node)));
         } else {
             $node_id = trim($this->input['node_id']);
         }
         $condition .= " AND node_id IN (" . $node_id . ")";
     }
     if (isset($this->input['server_id'])) {
         $condition .= " AND server_id = " . intval($this->input['server_id']);
     }
     return $condition;
 }
示例#7
0
文件: content.php 项目: h3len/Project
 public function get_content_condition($to_count = false)
 {
     $condition = $other_field = '';
     $condition .= " WHERE 1 ";
     if ($client_type = intval($this->input['client_type'])) {
         $condition .= " AND cr.client_type='" . $client_type . "'";
     }
     $condition .= " AND r.is_complete=1 ";
     if ($this->settings['is_need_audit']) {
         $condition .= " AND r.status=1";
     }
     //支持多个栏目
     if ($min_id = intval($this->input['min_id'])) {
         $condition .= " AND r.id>" . $min_id;
     }
     if ($this->input['id']) {
         $ids = hg_filter_ids($this->input['id']);
         $condition .= " AND r.id IN (" . $ids . ')';
     }
     if ($site_id = intval($this->input['site_id'])) {
         $condition .= " AND r.site_id=" . $site_id;
     }
     $column_id = urldecode($this->input['column_id']);
     if (!$column_id && ($column_name = trim($this->input['column_name']))) {
         $fid = intval($this->input['fid']);
         $column_name = explode(',', $column_name);
         if (!$this->input['child_column']) {
             $sql = 'SELECT parents FROM ' . DB_PREFIX . "column  WHERE id=" . $fid;
             $info = $this->db->query_first($sql);
             if ($info['parents']) {
                 $parents = explode(',', $info['parents']);
                 $fid = $parents[count($parents) - 1];
             }
             if ($fid) {
                 $sql = 'SELECT id FROM ' . DB_PREFIX . "column  WHERE concat(',', parents, ',') LIKE '%," . $fid . ",%' AND  name IN ('" . implode("','", $column_name) . "')";
             } else {
                 $sql = 'SELECT id FROM ' . DB_PREFIX . "column  WHERE  name IN ('" . implode("','", $column_name) . "')";
             }
         } else {
             $sql = 'SELECT id FROM ' . DB_PREFIX . "column  WHERE fid={$fid} AND  name IN ('" . implode("','", $column_name) . "')";
         }
         $tmp_column = array();
         $info = $this->db->query($sql);
         while ($row = $this->db->fetch_array($info)) {
             $tmp_column[] = $row['id'];
         }
         $column_id = implode(',', $tmp_column);
         if (!$column_id && $fid) {
             $column_id = $fid;
         }
     }
     if ($column_id) {
         $column_ids = '';
         $column_id = explode(',', $column_id);
         $column_id = "'" . implode("','", $column_id) . "'";
         if (!$this->input['not_need_child_column']) {
             $columns_data = $this->column->get_column_by_id(' id,name,fid,parents,childs,content_num ', $column_id, 'id');
             $tag = '';
             if (is_array($columns_data) && $columns_data) {
                 foreach ($columns_data as $k => $v) {
                     $column_ids .= $tag . $v['childs'];
                     $tag = ',';
                 }
             }
         } else {
             $column_ids = $column_id;
         }
         if ($column_ids) {
             $column_idarr = @array_unique(explode(',', $column_ids));
             $column_ids = implode(',', $column_idarr);
             $condition .= " AND r.column_id in (" . $column_ids . ")";
         } else {
             $this->errorOutput(NO_COLUMN_ID);
         }
     }
     if ($bundle_id = urldecode($this->input['bundle_id'])) {
         $bundle_idarr = explode(',', $bundle_id);
         $condition .= " AND r.bundle_id in ('" . implode("','", $bundle_idarr) . "')";
     }
     if ($this->input['exclude_special']) {
         $condition .= " AND r.bundle_id != '" . $this->input['exclude_special'] . "'";
     }
     if ($this->input['exclude_bundle']) {
         $exclude_bundle = explode(',', $this->input['exclude_bundle']);
         $condition .= " AND r.bundle_id NOT IN('" . implode("','", $exclude_bundle) . "')";
     }
     if ($module_id = urldecode($this->input['module_id'])) {
         $condition .= " AND r.module_id='" . $module_id . "'";
     }
     if (isset($this->input['weight']) && $this->input['weight'] !== '' && $this->input['weight'] != -1) {
         $condition .= " AND r.weight='" . intval($this->input['weight']) . "'";
     }
     if ($exclude_id = $this->input['exclude_id']) {
         $condition .= " AND r.content_id not in (" . $exclude_id . ")";
     }
     if ($cid = $this->input['cid']) {
         $cid = hg_filter_ids($this->input['cid']);
         $condition .= " AND r.content_id in (" . $cid . ")";
     }
     //查询权重
     if (isset($this->input['start_weight']) && intval($this->input['start_weight']) >= 0) {
         $condition .= " AND r.weight >= " . $this->input['start_weight'];
     }
     if (isset($this->input['end_weight']) && intval($this->input['end_weight']) >= 0) {
         $condition .= " AND r.weight <= " . $this->input['end_weight'];
     }
     if (isset($this->input['except_weight']) && $this->input['except_weight'] !== '') {
         $condition .= " AND r.weight != " . intval($this->input['except_weight']);
     }
     if (isset($this->input['is_have_indexpic']) && $this->input['is_have_indexpic'] !== '') {
         $condition .= " AND r.is_have_indexpic=" . intval($this->input['is_have_indexpic']);
     }
     if (isset($this->input['is_have_video']) && $this->input['is_have_video'] !== '') {
         $condition .= " AND r.is_have_video=" . intval($this->input['is_have_video']);
     }
     if ($start_time = trim(urldecode($this->input['starttime']))) {
         if ($start_time = strtotime($start_time)) {
             $condition .= " AND r.publish_time >= '" . $start_time . "'";
         }
     }
     if ($end_time = trim(urldecode($this->input['endtime']))) {
         if ($end_time = strtotime($end_time)) {
             $condition .= " AND r.publish_time <= '" . $end_time . "'";
         }
     }
     if ($create_user = trim($this->input['create_user'], ' ')) {
         $condition .= " AND r.create_user='******'create_user'] . "' ";
     }
     if ($publish_user = trim($this->input['publish_user'], ' ')) {
         $condition .= " AND r.publish_user='******'publish_user'] . "' ";
     }
     //查询发布的时间
     if ($this->input['date_search']) {
         $today = strtotime(date('Y-m-d'));
         $tomorrow = strtotime(date('Y-m-d', TIMENOW + 24 * 3600));
         switch (intval($this->input['date_search'])) {
             case 1:
                 //所有时间段
                 break;
             case 2:
                 //昨天的数据
                 $yesterday = strtotime(date('y-m-d', TIMENOW - 24 * 3600));
                 $condition .= " AND  r.publish_time > '" . $yesterday . "' AND r.publish_time < '" . $today . "'";
                 break;
             case 3:
                 //今天的数据
                 $condition .= " AND  r.publish_time > '" . $today . "' AND r.publish_time < '" . $tomorrow . "'";
                 break;
             case 4:
                 //最近3天
                 $last_threeday = strtotime(date('y-m-d', TIMENOW - 2 * 24 * 3600));
                 $condition .= " AND r.publish_time > '" . $last_threeday . "' AND r.publish_time < '" . $tomorrow . "'";
                 break;
             case 5:
                 //最近7天
                 $last_sevenday = strtotime(date('y-m-d', TIMENOW - 6 * 24 * 3600));
                 $condition .= " AND  r.publish_time > '" . $last_sevenday . "' AND r.publish_time < '" . $tomorrow . "'";
                 break;
             default:
                 //所有时间段
                 break;
         }
     }
     //标题
     if ($this->input['k'] || $this->input['title']) {
         $title = $this->input['title'] ? $this->input['title'] : $this->input['k'];
         $title = $this->get_titleResult($title . ' ');
         if ($title) {
             if ($this->settings['App_textsearch'] && !$this->input['normal_search']) {
                 $condition .= " AND MATCH (title_unicode) AGAINST ('" . $title . "' IN BOOLEAN MODE )";
                 $other_field = ",MATCH (title_unicode) AGAINST ('" . $title . "' IN BOOLEAN MODE ) AS title_score";
             } else {
                 $condition .= " AND r.title_unicode like '%" . $title . "%'";
                 $not_use_title_score = true;
             }
         }
     }
     if ($keywords = urldecode($this->input['keywords'])) {
         $keywordsstr = str_utf8_unicode($keywords);
         if ($keywordsstr) {
             if ($this->settings['App_textsearch'] && !$this->input['normal_search']) {
                 $condition .= " AND MATCH (keywords_unicode) AGAINST ('" . $keywordsstr . "' IN BOOLEAN MODE )";
                 $other_field = ",MATCH (keywords_unicode) AGAINST ('" . $keywordsstr . "' IN BOOLEAN MODE ) AS score";
             } else {
                 $condition .= " AND r.keywords_unicode like '%" . $keywordsstr . "%'";
                 $not_use_score = true;
             }
         }
     }
     if ($title_pinyin_str = urldecode($this->input['spell_title'])) {
         $title_pinyin_str = get_spell_title($title_pinyin_str);
         if ($title_pinyin_str) {
             $condition .= " AND MATCH (title_pinyin) AGAINST ('" . $title_pinyin_str . "' IN BOOLEAN MODE )";
             $other_field = ",MATCH (title_pinyin) AGAINST ('" . $title_pinyin_str . "' IN BOOLEAN MODE ) AS title_pinyin";
         }
     }
     if ($this->input['need_group_cid']) {
         $condition .= " GROUP BY r.content_id ";
     }
     if (!$to_count) {
         $order_tag = true;
         $condition .= " ORDER BY ";
         if ($keywordsstr && !$not_use_score) {
             $condition .= " score DESC ";
             $order_tag = false;
         } else {
             if ($title && !$not_use_title_score) {
                 $condition .= " title_score DESC ";
                 $order_tag = false;
             } else {
                 if ($spell_title_str) {
                     $condition .= " title_pinyin DESC ";
                     $order_tag = false;
                 }
             }
         }
         //排序
         if ($sort_field = urldecode($this->input['sort_field'])) {
             if (in_array($sort_field, array('weight', 'id', 'order_id', 'publish_time'))) {
                 $condition .= ($order_tag ? " " : ",") . 'r.' . $sort_field . ' ';
                 $order_tag = false;
                 if ($sort_type = urldecode($this->input['sort_type'])) {
                     $condition .= in_array($sort_type, $this->settings['sort_keyword']) ? $sort_type : 'DESC';
                 }
                 if ($sort_field == 'weight') {
                     $condition .= ' ,r.order_id DESC';
                 }
             } else {
                 if (in_array($sort_field, $this->settings['content_field'])) {
                     $condition .= ($order_tag ? " " : ",") . 'r.' . $sort_field . ' ';
                     $order_tag = false;
                     if ($sort_type = urldecode($this->input['sort_type'])) {
                         $condition .= in_array($sort_type, $this->settings['sort_keyword']) ? $sort_type : 'DESC';
                     }
                 } else {
                     $condition .= ($order_tag ? ' ' : ',') . "r.publish_time DESC ";
                     $order_tag = false;
                 }
             }
         } else {
             $condition .= ($order_tag ? ' ' : ',') . "r.order_id DESC ";
         }
         //$condition .= ($order_tag ? ' ' : ',') . "cr.id DESC ";
     }
     $result['condition'] = $condition;
     $result['other_field'] = $other_field;
     return $result;
 }