public function create() { #####节点权限认证需要将节点数据放在nodes=>标志=>节点id=>节点所有父级节点 /*if($this->user['group_type'] > MAX_ADMIN_TYPE) { $action = $this->user['prms']['app_prms'][APP_UNIQUEID]['nodes']; if(!in_array('template',$action)) { $this->errorOutput("NO_PRIVILEGE"); } }*/ #####节点权限认证需要将节点数据放在nodes=>标志=>节点id=>节点所有父级节点 $data = array('title' => trim($this->input['title']), 'create_time' => TIMENOW, 'user_id' => $this->user['user_id'], 'user_name' => $this->user['user_name']); //栏目id特殊处理 if ($this->input['column_id']) { include_once ROOT_PATH . 'lib/class/publishconfig.class.php'; $publishconfig = new publishconfig(); $pub_column_id = $publishconfig->get_column_by_ids('id, childs', $this->input['column_id']); foreach ((array) $pub_column_id as $k => $v) { $column_id[] = $v['childs']; } $column_id = implode("','", $column_id); } //xml_id特殊处理 if ($this->input['xml_id']) { if (substr(trim($this->input['xml_id']), 0, 1) == '_') { $type_id = trim($this->input['xml_id'], '_'); $sql = "SELECT id FROM " . DB_PREFIX . "xml WHERE type_id = " . $type_id; $query = $this->db->query($sql); $xml_id = ''; while ($row = $this->db->fetch_array($query)) { $xml_id .= $row['id'] . ','; } $xml_id = trim($xml_id, ','); } else { $xml_id = $this->input['xml_id']; } } else { $this->errorOutput('请选择模板'); } // $map = array(0 => array('name' => 'key', 'value' => $this->input['key']), 1 => array('name' => 'pub_column_id', 'value' => $column_id), 2 => array('name' => 'add_user_name', 'value' => $this->input['add_user_name']), 3 => array('name' => 'start_time', 'value' => $this->input['start_time']), 4 => array('name' => 'end_time', 'value' => $this->input['end_time']), 5 => array('name' => 'start_weight', 'value' => $this->input['start_weight'] ? $this->input['start_weight'] : '0'), 6 => array('name' => 'end_weight', 'value' => $this->input['end_weight'] ? $this->input['end_weight'] : '100'), 7 => array('name' => 'xml_id', 'value' => $xml_id), 8 => array('name' => 'xml_name', 'value' => $this->input['xml_name']), 9 => array('name' => 'need_file', 'value' => $this->input['need_file'] ? 1 : 0), 10 => array('name' => 'vod_sort_id', 'value' => implode(',', $this->input['district_id'])), 11 => array('name' => 'column_name', 'value' => $this->input['column_name']), 12 => array('name' => 'file_num', 'value' => $this->input['file_num'])); foreach ((array) $map as $k => $v) { $val[$v['name']] = $v['value']; } //$data['tag_val'] = $val ? addslashes(serialize($val)) : ''; $data['config'] = $val ? serialize($val) : ''; //$sql = "INSERT INTO " .DB_PREFIX. "export_config SET "; //$vid = $this->mode->create($data); $vid = $this->db->insert_data($data, 'export_config'); if ($vid) { $sql = " UPDATE " . DB_PREFIX . "export_config SET order_id = {$vid} WHERE id = {$vid}"; $this->db->query($sql); $data['id'] = $vid; //$this->addLogs('创建',$data,'','创建' . $vid);此处是日志,自己根据情况加一下 $this->addItem('success'); $this->output(); } }
private function get_condition() { $condition = ""; if ($this->input['vod_sort_id']) { $sql = " SELECT childs, fid FROM " . DB_PREFIX . "vod_media_node WHERE id = '" . $this->input['vod_sort_id'] . "'"; $arr = $this->db->query_first($sql); if ($arr) { $condition .= " AND v.vod_sort_id IN (" . $arr['childs'] . ")"; } } ####增加权限控制 用于显示#### if ($this->input['id']) { $condition .= " AND v.id in (" . $this->input['id'] . ")"; } if ($this->input['user_name']) { $condition .= " AND v.addperson = '" . $this->input['user_name'] . "' "; } if ($this->input['user_id']) { $condition .= " AND v.user_id = '" . $this->input['user_id'] . "' "; } if ($this->input['title'] || trim($this->input['title']) == '0') { $condition .= ' AND v.title LIKE "%' . $this->input['title'] . '%"'; } if ($this->input['k'] || trim($this->input['k']) == '0') { $condition .= ' AND v.title LIKE "%' . $this->input['k'] . '%"'; } if ($this->input['status']) { $condition .= " AND v.status IN (" . $this->input['status'] . ")"; } if ($this->input['is_forcecode']) { $condition .= " AND v.is_forcecode = 1 "; } if ($this->input['start_time']) { $start_time = strtotime(trim($this->input['start_time'])); $condition .= " AND v.create_time >= '" . $start_time . "'"; } if ($this->input['end_time']) { $end_time = strtotime(trim($this->input['end_time'])); $condition .= " AND v.create_time <= '" . $end_time . "'"; } //权重 if ($this->input['start_weight'] && $this->input['start_weight'] != -1) { $condition .= " AND v.weight >=" . $this->input['start_weight']; } if ($this->input['end_weight'] && $this->input['end_weight'] != -2) { $condition .= " AND v.weight <= " . $this->input['end_weight']; } 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 v.create_time > '" . $yesterday . "' AND v.create_time < '" . $today . "'"; break; case 3: //今天的数据 $condition .= " AND v.create_time > '" . $today . "' AND v.create_time < '" . $tomorrow . "'"; break; case 4: //最近3天 $last_threeday = strtotime(date('y-m-d', TIMENOW - 2 * 24 * 3600)); $condition .= " AND v.create_time > '" . $last_threeday . "' AND v.create_time < '" . $tomorrow . "'"; break; case 5: //最近7天 $last_sevenday = strtotime(date('y-m-d', TIMENOW - 6 * 24 * 3600)); $condition .= " AND v.create_time > '" . $last_sevenday . "' AND v.create_time < '" . $tomorrow . "'"; break; default: //所有时间段 break; } } if ($this->input['pub_column_id']) { include_once ROOT_PATH . 'lib/class/publishconfig.class.php'; $publishconfig = new publishconfig(); $pub_column_id = $publishconfig->get_column_by_ids('id, childs', $this->input['pub_column_id']); foreach ((array) $pub_column_id as $k => $v) { $column_id[] = $v['childs']; } $column_id = implode("','", $column_id); if ($column_id) { $condition .= " AND pc.column_id IN('" . $column_id . "')"; } } return $condition; }
public function get_condition() { $condition = ""; ####增加权限控制 用于显示#### if ($this->user['group_type'] > MAX_ADMIN_TYPE) { if (!$this->user['prms']['default_setting']['show_other_data']) { $condition .= ' AND v.user_id = ' . $this->user['user_id']; } else { if ($this->user['prms']['default_setting']['show_other_data'] == 1 && $this->user['slave_group']) { $condition .= ' AND v.org_id IN(' . $this->user['slave_org'] . ')'; } } $authnode = $this->user['prms']['app_prms'][APP_UNIQUEID]['nodes']; if ($authnode) { $authnode_str = $authnode ? implode(',', $authnode) : ''; if ($authnode_str) { $sql = 'SELECT id,childs FROM ' . DB_PREFIX . 'vod_media_node WHERE id IN(' . $authnode_str . ')'; $query = $this->db->query($sql); $authnode_array = array(); while ($row = $this->db->fetch_array($query)) { $authnode_array[$row['id']] = explode(',', $row['childs']); } //算出所有允许的节点 $auth_nodes = array(); foreach ($authnode_array as $k => $v) { $auth_nodes = array_merge($auth_nodes, $v); } //如果没有_id就查询出所有权限所允许的节点下的视频包括其后代元素 if (!$this->input['vod_sort_id']) { $condition .= " AND v.vod_sort_id IN (" . implode(',', $auth_nodes) . ")"; } else { if (in_array($this->input['vod_sort_id'], $auth_nodes)) { if (isset($authnode_array[$this->input['vod_sort_id']]) && $authnode_array[$this->input['vod_sort_id']]) { $condition .= " AND v.vod_sort_id IN (" . implode(',', $authnode_array[$this->input['vod_sort_id']]) . ")"; } else { $sql = "SELECT id,childs FROM " . DB_PREFIX . "vod_media_node WHERE id = '" . $this->input['vod_sort_id'] . "'"; $childs_nodes = $this->db->query_first($sql); $condition .= " AND v.vod_sort_id IN (" . $childs_nodes['childs'] . ")"; } } else { $this->errorOutput(NO_PRIVILEGE); } } } } } else { if ($this->input['vod_sort_id']) { $sql = " SELECT childs, fid FROM " . DB_PREFIX . "vod_media_node WHERE id = '" . $this->input['vod_sort_id'] . "'"; $arr = $this->db->query_first($sql); if ($arr) { $condition .= " AND v.vod_sort_id IN (" . $arr['childs'] . ")"; } } } ####增加权限控制 用于显示#### if ($this->input['k'] || trim($this->input['k']) == '0') { $condition .= ' AND v.title LIKE "%' . trim($this->input['k']) . '%"'; } if ($this->input['start_time']) { $start_time = strtotime(trim($this->input['start_time'])); $condition .= " AND v.create_time >= '" . $start_time . "'"; } if ($this->input['end_time']) { $end_time = strtotime(trim($this->input['end_time'])); $condition .= " AND v.create_time <= '" . $end_time . "'"; } if ($this->input['vod_leixing']) { $sql .= " AND v.vod_leixing = " . intval($this->input['vod_leixing']); } if ($this->input['user_name']) { $condition .= " AND v.addperson = '" . $this->input['user_name'] . "' "; } //权重 if ($this->input['start_weight'] && $this->input['start_weight'] != -1) { $condition .= " AND v.weight >=" . $this->input['start_weight']; } if ($this->input['end_weight'] && $this->input['end_weight'] != -2) { $condition .= " AND v.weight <= " . $this->input['end_weight']; } if ($this->input['trans_status'] && $this->input['trans_status'] != -2) { $condition .= " AND v.status = '" . $this->input['trans_status'] . "'"; } else { if ($this->input['trans_status'] == '0') { $condition .= " AND v.status = 0 "; } } 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 v.create_time > '" . $yesterday . "' AND v.create_time < '" . $today . "'"; break; case 3: //今天的数据 $condition .= " AND v.create_time > '" . $today . "' AND v.create_time < '" . $tomorrow . "'"; break; case 4: //最近3天 $last_threeday = strtotime(date('y-m-d', TIMENOW - 2 * 24 * 3600)); $condition .= " AND v.create_time > '" . $last_threeday . "' AND v.create_time < '" . $tomorrow . "'"; break; case 5: //最近7天 $last_sevenday = strtotime(date('y-m-d', TIMENOW - 6 * 24 * 3600)); $condition .= " AND v.create_time > '" . $last_sevenday . "' AND v.create_time < '" . $tomorrow . "'"; break; default: //所有时间段 break; } } //加限制显示来自于哪些应用的视频 if (defined('LIMIT_NOT_SHOW') && LIMIT_NOT_SHOW) { $_limit_app = explode(',', LIMIT_NOT_SHOW); foreach ($_limit_app as $_k => $_v) { $condition .= " AND v.app_uniqueid != '" . $_v . "' "; } } //根据发布库栏目搜索 if ($this->input['pub_column_id']) { include_once ROOT_PATH . 'lib/class/publishconfig.class.php'; $publishconfig = new publishconfig(); $pub_column_id = $publishconfig->get_column_by_ids('id, childs', $this->input['pub_column_id']); foreach ((array) $pub_column_id as $k => $v) { $column_id[] = $v['childs']; } $column_id = implode(",", $column_id); if ($column_id) { $condition .= " AND pc.column_id IN(" . $column_id . ")"; } } return $condition; }
/** * 检索条件 关键字,时间,状态,标题,发布时间,图片,附件,视频 * * @name get_condition * @access private * @category hogesoft * @copyright hogesoft */ private function get_condition() { $condition = ''; //搜索标签 if ($this->input['searchtag_id']) { $searchtag = $this->searchtag_detail(intval($this->input['searchtag_id'])); foreach ((array) $searchtag['tag_val'] as $k => $v) { if (in_array($k, array('_id'))) { //防止左边栏分类搜索无效 continue; } $this->input[$k] = hg_clean_value($v); } } //搜索标签 ####增加权限控制 用于显示#### if ($this->user['group_type'] > MAX_ADMIN_TYPE) { if (!$this->user['prms']['default_setting']['show_other_data']) { $condition .= ' AND user_id = ' . $this->user['user_id']; } else { //组织以内 if ($this->user['prms']['default_setting']['show_other_data'] == 1 && $this->user['slave_group']) { $condition .= ' AND org_id IN(' . $this->user['slave_org'] . ')'; } } if ($authnode = $this->user['prms']['app_prms'][APP_UNIQUEID]['nodes']) { $authnode_str = $authnode ? implode(',', $authnode) : ''; if ($authnode_str === '0') { $condition .= ' AND a.sort_id IN(' . $authnode_str . ')'; } if ($authnode_str && $authnode_str != -1) { $authnode_str = intval($this->input['_id']) ? $authnode_str . ',' . $this->input['_id'] : $authnode_str; $sql = 'SELECT id,childs FROM ' . DB_PREFIX . 'sort WHERE id IN(' . $authnode_str . ')'; $query = $this->db->query($sql); $authnode_array = array(); while ($row = $this->db->fetch_array($query)) { $authnode_array[$row['id']] = explode(',', $row['childs']); } $authnode_str = ''; foreach ($authnode_array as $node_id => $n) { if ($node_id == intval($this->input['_id'])) { $node_father_array = $n; if (!in_array(intval($this->input['_id']), $authnode)) { continue; } } $authnode_str .= implode(',', $n) . ','; } $authnode_str = TRUE ? $authnode_str . '0' : trim($authnode_str, ','); if (!$this->input['_id']) { $condition .= ' AND a.sort_id IN(' . $authnode_str . ')'; } else { $authnode_array = explode(',', $authnode_str); if (!in_array($this->input['_id'], $authnode_array)) { // if (!($auth_child_node_array = array_intersect($node_father_array, $authnode_array))) { $this->errorOutput(NO_PRIVILEGE); } //$this->errorOutput(var_export($auth_child_node_array,1)); $condition .= ' AND a.sort_id IN(' . implode(',', $auth_child_node_array) . ')'; } } } } } if ($this->input['_id']) { $sql = "SELECT childs FROM " . DB_PREFIX . "sort WHERE id = " . intval($this->input['_id']); $ret = $this->db->query_first($sql); $condition .= " AND a.sort_id in (" . $ret['childs'] . ")"; } ####增加权限控制 用于显示#### if ($this->input['max_id']) { $condition .= " AND a.id >" . intval($this->input['max_id']); } //查询 if ($this->input['key']) { if (stripos($this->input['key'], '_') !== FALSE) { $this->input['key'] = addcslashes($this->input['key'], '_'); } if (stripos($this->input['key'], '%') !== FALSE) { $this->input['key'] = addcslashes($this->input['key'], '%'); } if ($this->input['key'] == '#') { $condition .= " AND a.title REGEXP '[^&]#' OR a.title LIKE '#%' "; } else { $condition .= " AND a.title LIKE '%" . addslashes(trim($this->input['key'])) . "%' "; } } if ($this->input['user_name']) { $condition .= " AND a.user_name = '" . trim($this->input['user_name']) . "' "; } if ($this->input['author']) { $condition .= " AND a.author = '" . trim($this->input['author']) . "'"; } //查询分组 if ($this->input['sort_id'] && $this->input['sort_id'] != -1) { $condition .= " AND a.sort_id = '" . intval($this->input['sort_id']) . "'"; } if ($this->input['para']) { $condition .= " AND a.para = '" . intval($this->input['para']) . "'"; } if ($this->input['start_time'] == $this->input['end_time']) { $his = date('His', strtotime($this->input['start_time'])); if (!intval($his)) { $this->input['start_time'] = date('Y-m-d', strtotime($this->input['start_time'])) . ' 00:00'; $this->input['end_time'] = date('Y-m-d', strtotime($this->input['end_time'])) . ' 23:59'; } } //查询创建的起始时间 if ($this->input['start_time']) { $start_time = strtotime($this->input['start_time']); $condition .= " AND a.create_time > " . $start_time; } //查询创建的结束时间 if ($this->input['end_time']) { $end_time = strtotime($this->input['end_time']); $condition .= " AND a.create_time < " . $end_time; $start_time > $end_time && $this->errorOutput('搜索开始时间不能大于结束时间'); } //查询权重 if ($this->input['start_weight'] && $this->input['start_weight'] != -1) { $condition .= " AND a.weight >= " . $this->input['start_weight']; } if ($this->input['end_weight'] && $this->input['end_weight'] != -1) { $condition .= " AND a.weight <= " . $this->input['end_weight']; } if ($this->input['outlink'] == 1) { $condition .= " AND a.outlink != '' "; } if ($this->input['outlink_status']) { switch ($this->input['outlink_status']) { case 1: $condition .= " AND a.outlink != '' "; break; case 2: $condition .= " AND a.outlink = '' "; break; } } //查询发布的时间 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 a.create_time > '" . $yesterday . "' AND a.create_time < '" . $today . "'"; break; case 3: //今天的数据 $condition .= " AND a.create_time > '" . $today . "' AND a.create_time < '" . $tomorrow . "'"; break; case 4: //最近3天 $last_threeday = strtotime(date('y-m-d', TIMENOW - 2 * 24 * 3600)); $condition .= " AND a.create_time > '" . $last_threeday . "' AND a.create_time < '" . $tomorrow . "'"; break; case 5: //最近7天 $last_sevenday = strtotime(date('y-m-d', TIMENOW - 6 * 24 * 3600)); $condition .= " AND a.create_time > '" . $last_sevenday . "' AND a.create_time < '" . $tomorrow . "'"; break; default: //所有时间段 break; } } //查询文章的状态 if (isset($this->input['status'])) { switch (intval($this->input['status'])) { case 0: $condition .= " "; break; case 1: //待审核 $condition .= " AND a.state= 0"; break; case 2: //已审核 $condition .= " AND a.state = 1"; break; case 3: //已打回 $condition .= " AND a.state = 2"; default: break; } } //根据是否有图片查询 if (isset($this->input['is_img'])) { switch (intval($this->input['is_img'])) { case 1: //不限制 $condition .= " "; break; case 2: //没有图片 $condition .= " AND a.is_img = 0"; break; case 3: //有图片 $condition .= " AND a.is_img = 1"; break; default: break; } } //根据是否有附件查询 if (isset($this->input['is_affix'])) { switch (intval($this->input['is_affix'])) { case 1: //不限制 $condition .= " "; break; case 2: //没有附件 $condition .= " AND a.is_affix = 0"; break; case 3: //有附件 $condition .= " AND a.is_affix = 1"; break; default: break; } } //根据是否有视频查询 if (isset($this->input['is_video'])) { switch (intval($this->input['is_video'])) { case 1: //不限制 $condition .= " "; break; case 2: //没有视频 $condition .= " AND a.is_video = 0"; break; case 3: //有视频 $condition .= " AND a.is_video = 1"; break; default: break; } } //过滤掉自动草稿 $condition .= " AND a.state != -1"; //根据发布库栏目搜索 if ($this->input['pub_column_id']) { include_once ROOT_PATH . 'lib/class/publishconfig.class.php'; $publishconfig = new publishconfig(); $pub_column_id = $publishconfig->get_column_by_ids('id, childs', $this->input['pub_column_id']); foreach ((array) $pub_column_id as $k => $v) { $column_id[] = $v['childs']; } $column_id = implode("','", $column_id); if ($column_id) { $condition .= " AND pc.column_id IN('" . $column_id . "')"; } $condition .= " GROUP BY a.id"; } return $condition; }
/** * 删除模块 * * @access public * @param id:模块的id * * @return array */ public function delete() { $id = trim(urldecode($this->input['id'])); $id_arr = explode(',', $id); $id_arr = array_filter($id_arr, 'filter_arr'); if (!$id_arr) { $this->errorOutput(NOID); } $ids = implode(',', $id_arr); //检验是否为自己的APP的模块 $queryData = array('count' => -1, 'condition' => array('id' => $ids, 'uid' => $this->user['user_id'])); $module_info = $this->api->show($queryData); if (!$module_info) { $this->errorOutput(MODULE_NOT_EXISTS); } $validate_ids = $column_ids = array(); foreach ($module_info as $module) { $validate_ids[] = $module['id']; $column_ids[] = $module['column_id']; } $validate_ids = implode(',', $validate_ids); //删除绑定的界面对应的属性 $this->api->delete('ui_value', array('module_id' => $validate_ids)); //删除栏目 if ($column_ids) { $parent_ids = $column_ids; //顶级栏目id $column_ids = implode(',', $column_ids); $publish = new publishconfig(); $column_info = $publish->get_column_by_ids('*', $column_ids); if ($column_info) { $childs_id = ''; foreach ($column_info as $v) { $childs_id .= ',' . $v['childs']; } //去除顶级栏目id $childs_id = trim($childs_id, ','); $childs_id = explode(',', $childs_id); $all_childs = array_diff($childs_id, $parent_ids); //删除子集栏目 if ($all_childs) { $all_childs = implode(',', $all_childs); $result = $publish->delete_column($all_childs); if ($result != 'success') { $this->errorOutput(FAILED); } } //删除顶级栏目 $result = $publish->delete_column(implode(',', $parent_ids)); if ($result != 'success') { $this->errorOutput(FAILED); } } } //删除模块数据 $result = $this->api->delete('app_module', array('id' => $validate_ids)); $this->addItem($result); $this->output(); }
public function get_condition() { $condition = ''; //搜索标签 if ($this->input['searchtag_id']) { $searchtag = $this->searchtag_detail(intval($this->input['searchtag_id'])); foreach ((array) $searchtag['tag_val'] as $k => $v) { if (in_array($k, array('_id'))) { //防止左边栏分类搜索无效 continue; } $this->input[$k] = $v; } } //搜索标签 ####增加权限控制 用于显示#### if ($this->user['group_type'] > MAX_ADMIN_TYPE) { if (!$this->user['prms']['default_setting']['show_other_data']) { $condition .= ' AND t.user_id = ' . $this->user['user_id']; } else { if ($this->user['prms']['default_setting']['show_other_data'] == 1 && $this->user['slave_group']) { $condition .= ' AND t.org_id IN(' . $this->user['slave_org'] . ')'; } } $authnode = $this->user['prms']['app_prms'][APP_UNIQUEID]['nodes']; if ($authnode) { $authnode_str = $authnode ? implode(',', $authnode) : ''; if ($authnode_str && $authnode_str != -1) { $sql = 'SELECT id,childs FROM ' . DB_PREFIX . 'tuji_node WHERE id IN(' . $authnode_str . ')'; $query = $this->db->query($sql); $authnode_array = array(); while ($row = $this->db->fetch_array($query)) { $authnode_array[$row['id']] = explode(',', $row['childs']); } //算出所有允许的节点 $auth_nodes = array(); foreach ($authnode_array as $k => $v) { $auth_nodes = array_merge($auth_nodes, $v); } //如果没有_id就查询出所有权限所允许的节点下的视频包括其后代元素 if (!$this->input['_id']) { $condition .= " AND t.tuji_sort_id IN (" . implode(',', $auth_nodes) . ",0)"; } else { if (in_array($this->input['_id'], $auth_nodes)) { if (isset($authnode_array[$this->input['_id']]) && $authnode_array[$this->input['_id']]) { $condition .= " AND t.tuji_sort_id IN (" . implode(',', $authnode_array[$this->input['_id']]) . ")"; } else { $sql = "SELECT id,childs FROM " . DB_PREFIX . "tuji_node WHERE id = '" . $this->input['_id'] . "'"; $childs_nodes = $this->db->query_first($sql); $condition .= " AND t.tuji_sort_id IN (" . $childs_nodes['childs'] . ")"; } } else { $this->errorOutput(NO_PRIVILEGE); } } } else { if ($authnode_str == -1) { if ($this->input['_id']) { $sql = " SELECT childs, fid FROM " . DB_PREFIX . "tuji_node WHERE id = '" . $this->input['_id'] . "'"; $arr = $this->db->query_first($sql); if ($arr) { $condition .= " AND t.tuji_sort_id IN (" . $arr['childs'] . ")"; } } } } } } else { if ($this->input['_id']) { $sql = " SELECT childs, fid FROM " . DB_PREFIX . "tuji_node WHERE id = '" . $this->input['_id'] . "'"; $arr = $this->db->query_first($sql); if ($arr) { $condition .= " AND t.tuji_sort_id IN (" . $arr['childs'] . ")"; } } } if ($this->input['id']) { $condition .= ' AND t.id = ' . intval($this->input['id']); } if ($this->input['max_id']) { $condition .= " AND t.id >" . intval($this->input['max_id']); } if (trim($this->input['key']) || trim(urldecode($this->input['key'])) == '0') { $condition .= ' AND t.title LIKE "%' . trim($this->input['key']) . '%"'; } if ($this->input['user_name']) { $condition .= " AND t.user_name = '" . $this->input['user_name'] . "' "; } if ($this->input['user_id']) { $condition .= " AND t.user_id = '" . $this->input['user_id'] . "' "; } if ($this->input['comment']) { $condition .= ' AND t.comment LIKE "%' . urldecode($this->input['comment']) . '%"'; } if (intval($this->input['status'])) { $condition .= " AND t.status = '" . intval($this->input['status']) . "'"; } if ($this->input['start_time'] == $this->input['end_time']) { //处理时间相等 $his = date('His', strtotime($this->input['start_time'])); if (!intval($his)) { $this->input['start_time'] = date('Y-m-d', strtotime($this->input['start_time'])) . ' 00:00'; $this->input['end_time'] = date('Y-m-d', strtotime($this->input['end_time'])) . ' 23:59:59'; } } if ($this->input['start_time']) { $start_time = strtotime(trim(urldecode($this->input['start_time']))); $condition .= " AND t.create_time >= '" . $start_time . "'"; } if ($this->input['end_time']) { $end_time = strtotime(trim(urldecode($this->input['end_time']))); $condition .= " AND t.create_time <= '" . $end_time . "'"; } //权重 if ($this->input['start_weight'] && $this->input['start_weight'] != -1) { $condition .= " AND t.weight >= " . $this->input['start_weight']; } if ($this->input['end_weight'] && $this->input['end_weight'] != -1) { $condition .= " AND t.weight <= " . $this->input['end_weight']; } 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 t.create_time > '" . $yesterday . "' AND t.create_time < '" . $today . "'"; break; case 3: //今天的数据 $condition .= " AND t.create_time > '" . $today . "' AND t.create_time < '" . $tomorrow . "'"; break; case 4: //最近3天 $last_threeday = strtotime(date('y-m-d', TIMENOW - 2 * 24 * 3600)); $condition .= " AND t.create_time > '" . $last_threeday . "' AND t.create_time < '" . $tomorrow . "'"; break; case 5: //最近7天 $last_sevenday = strtotime(date('y-m-d', TIMENOW - 6 * 24 * 3600)); $condition .= " AND t.create_time > '" . $last_sevenday . "' AND t.create_time < '" . $tomorrow . "'"; break; default: //所有时间段 break; } } if ($this->input['pub_column_id']) { include_once ROOT_PATH . 'lib/class/publishconfig.class.php'; $publishconfig = new publishconfig(); $pub_column_id = $publishconfig->get_column_by_ids('id, childs', $this->input['pub_column_id']); foreach ((array) $pub_column_id as $k => $v) { $column_id[] = $v['childs']; } $column_id = implode("','", $column_id); if ($column_id) { $condition .= " AND pc.column_id IN('" . $column_id . "')"; } } return $condition; }