public function show() { $result = $support_client_arr = array(); $condition = ''; if ($site_id = intval($this->input['site_id'])) { $condition .= " AND c.site_id=" . $site_id; } if ($id = urldecode($this->input['id'])) { $condition .= " AND c.id in (" . $id . ")"; } else { if (isset($this->input['fid'])) { if ($this->input['fid'] > -1) { $fid = $this->input['fid']; $condition .= " AND c.fid in (" . $fid . ")"; } } } if (isset($this->input['client_type']) && $this->input['client_type']) { $support_client_arr = explode(',', urldecode($this->input['client_type'])); } $offset = intval($this->input['offset']); $count = intval($this->input['count']); $count = $count ? $count : 10; $sql = "SELECT s.sub_weburl,s.weburl,c.id,c.site_id,c.name,c.fid,c.parents,c.childs,c.depath,c.childdomain,c.father_domain,c.relate_dir,c.colindex,c.is_last,c.keywords,c.content AS brief,c.support_content_type,c.support_client FROM " . DB_PREFIX . "column c LEFT JOIN " . DB_PREFIX . "site s ON c.site_id=s.id WHERE 1" . $condition . ' ORDER BY c.order_id DESC LIMIT ' . $offset . ',' . $count; $info = $this->db->query($sql); $columnids = array(); $content_type_tag = ''; while ($row = $this->db->fetch_array($info)) { $row['column_url'] = mk_column_url($row); if (empty($support_client_arr)) { $result[] = $row; $columnids[] = $row['id']; if ($row['support_content_type']) { $content_type .= $content_type_tag . $row['support_content_type']; $content_type_tag = ','; } } else { if (array_intersect(explode(',', $row['support_client']), $support_client_arr)) { $result[] = $row; $columnids[] = $row['id']; if ($row['support_content_type']) { $content_type .= $content_type_tag . $row['support_content_type']; $content_type_tag = ','; } } } } if (!$columnids) { $this->errorOutput('NO_COLUMNS'); } //获取内容标识,名称 //$content_type_data = $this->pub_content->content_field_by_ids($content_type); $sql = "SELECT * FROM " . DB_PREFIX . "column_icon WHERE column_id in(" . implode(',', $columnids) . ")"; $info = $this->db->query($sql); while ($row = $this->db->fetch_array($info)) { $i_d = $a = $n_a = array(); if (!empty($row['icon_default'])) { $icon_default = unserialize($row['icon_default']); $i_d['host'] = $icon_default['host']; $i_d['dir'] = $icon_default['dir']; $i_d['filename'] = $icon_default['filename']; $i_d['filepath'] = $icon_default['filepath']; } if (!empty($row['activation'])) { $activation = unserialize($row['activation']); $a['host'] = $activation['host']; $a['dir'] = $activation['dir']; $a['filename'] = $activation['filename']; $a['filepath'] = $activation['filepath']; } if (!empty($row['no_activation'])) { $no_activation = unserialize($row['no_activation']); $n_a['host'] = $no_activation['host']; $n_a['dir'] = $no_activation['dir']; $n_a['filename'] = $no_activation['filename']; $n_a['filepath'] = $no_activation['filepath']; } $result_icon[$row['column_id']]['icon_' . $row['client']]['default'] = empty($i_d) ? '' : $i_d; $result_icon[$row['column_id']]['icon_' . $row['client']]['activation'] = empty($a) ? '' : $a; $result_icon[$row['column_id']]['icon_' . $row['client']]['no_activation'] = empty($n_a) ? '' : $n_a; } foreach ($result as $key => $value) { if ($value['support_content_type']) { $support_content_type_arr = explode(',', $value['support_content_type']); $value['support_content_type'] = array(); foreach ($support_content_type_arr as $content_type_id) { $value['support_content_type'][] = $content_type_data[$content_type_id]; } } else { $value['support_content_type'] = array(); } $value['icon'] = $result_icon[$value['id']]; $this->addItem($value); } $this->output(); }
public function get_node() { if ($this->user['group_type'] > MAX_ADMIN_TYPE) { $auth_node = $this->user['prms']['publish_prms']; $auth_node_str = $auth_node ? implode(',', $auth_node) : ''; if (!$auth_node_str && !$this->user['prms']['site_prms']) { $no_auth = 1; } $auth_node_parents = array(); if ($auth_node_str) { $sql = 'SELECT id,parents FROM ' . DB_PREFIX . 'column WHERE id IN(' . $auth_node_str . ')'; $query = $this->db->query($sql); while ($row = $this->db->fetch_array($query)) { $auth_node_parents[$row['id']] = explode(',', $row['parents']); } } } $con = ''; $site_id = intval($this->input['site_id']); $fid = intval($this->input['fid']); $offset = $this->input['offset'] ? $this->input['offset'] : 0; $count = $this->input['count'] ? $this->input['count'] : 1000; if (!$no_auth) { $sql = "select c.*,s.sub_weburl,s.weburl from " . DB_PREFIX . "column c left join " . DB_PREFIX . "site s on c.site_id=s.id where 1 "; if ($site_id) { $sql .= ' AND c.site_id=' . $site_id; } $sql .= ' AND c.fid=' . $fid; $sql .= " order by c.order_id "; $sql .= " limit {$offset},{$count} "; $info = $this->db->query($sql); while ($row = $this->db->fetch_array($info)) { $row['is_auth'] = 1; if ($auth_node && $this->user['group_type'] > MAX_ADMIN_TYPE) { ###############非管理员用户数据过滤开始 $row['is_auth'] = 0; //节点自身显示 if (in_array($row['id'], $auth_node)) { $row['is_auth'] = 1; } // if (!$row['is_auth'] && $auth_node_parents) { //父级节点显示 foreach ($auth_node_parents as $auth_node_id => $auth_node_parent) { if (in_array($row['id'], $auth_node_parent)) { $row['is_auth'] = 2; break; } } //孩子节点显示 if (array_intersect(explode(',', $row['parents']), $auth_node)) { $row['is_auth'] = 3; } } if ($this->user['prms']['site_prms'] && in_array($row['site_id'], $this->user['prms']['site_prms'])) { $row['is_auth'] = 1; } ###############非管理员用户数据过滤结束 } if ($row['is_auth']) { $r = array(); $r['id'] = $row['id']; $r['name'] = $row['name']; $r['fid'] = $row['fid']; $r['childs'] = $row['childs']; $r['parents'] = $row['parents']; $r['depath'] = $row['depath']; $r['is_last'] = $row['is_last']; $r['site_id'] = $row['site_id']; $r['url'] = mk_column_url($row + array('sub_weburl' => $row['sub_weburl'], 'weburl' => $row['weburl']), false, true); $column[] = $r; $rowlast = $row; } } } if (!$site_id) { if (!$rowlast['site_id']) { $this->addItem(array()); $this->output(); } $site_id = $rowlast['site_id']; } //取栏目的page_id include_once ROOT_PATH . 'lib/class/publishsys.class.php'; $this->pub_sys = new publishsys(); $page_data = $this->pub_sys->get_page_by_sign('column', $site_id); if ($page_data['id']) { $result['page'] = 'page_data_id' . $page_data['id'] . '_'; $result['main_page'] = 'page_id' . $page_data['id']; } $result['site_id'] = $site_id; if ($this->settings['App_mkpublish']) { $is_open_mk = 1; if ($this->user['group_type'] > MAX_ADMIN_TYPE) { $this->user['prms']['app_prms']['mkpublish']['action'] = is_array($this->user['prms']['app_prms']['mkpublish']['action']) ? $this->user['prms']['app_prms']['mkpublish']['action'] : array(); if (!in_array('manage', $this->user['prms']['app_prms']['mkpublish']['action'])) { $is_open_mk = 0; } } } else { $is_open_mk = 0; } $result['is_open_mk'] = $is_open_mk; $result['column'] = $column; $this->addItem($result); $this->output(); }
public function get_column_site_by_ids($field = '*', $column_ids) { $result = array(); if ($column_ids) { $sql = "SELECT c." . $field . ",s.sub_weburl,s.weburl,s.custom_content_dir FROM " . DB_PREFIX . "column c LEFT JOIN " . DB_PREFIX . "site s ON c.site_id=s.id WHERE c.id in(" . $column_ids . ")"; $info = $this->db->query($sql); while ($row = $this->db->fetch_array($info)) { $row['column_url'] = mk_column_url($row); $result[$row['id']] = $row; } } return $result; }
public function get_column_site_by_ids() { $result = array(); $field = urldecode($this->input['field']) ? urldecode($this->input['field']) : ' * '; $column_ids = urldecode($this->input['column_ids']); if ($column_ids) { $sql = "SELECT c." . $field . ",s.sub_weburl,s.weburl,s.custom_content_dir FROM " . DB_PREFIX . "column c LEFT JOIN " . DB_PREFIX . "site s ON c.site_id=s.id WHERE c.id in(" . $column_ids . ")"; $info = $this->db->query($sql); while ($row = $this->db->fetch_array($info)) { $row['column_url'] = mk_column_url($row); $result[$row['id']] = $row; } } $this->addItem($result); $this->output(); }
private function parse_column($row) { $row['client_pic'] = $row['client_pic'] ? unserialize($row['client_pic']) : array(); if ($row['pic']) { $pic = unserialize($row['pic']); $row['indexpic'] = array('id' => $pic['id'], 'host' => $pic['host'], 'dir' => $pic['dir'], 'filepath' => $pic['filepath'], 'filename' => $pic['filename']); } else { $row['indexpic'] = array(); } $row['column_url'] = mk_column_url($row); $row['column_domain'] = mk_column_url($row, false); if ($row['client_pic'][$this->user['appid']]) { $tpic = $row['client_pic'][$this->user['appid']]; $pic = array('host' => $tpic['host'], 'dir' => $tpic['dir'], 'filepath' => $tpic['filepath'], 'filename' => $tpic['filename']); } else { $pic = $row['indexpic']; } if ($pic) { $row['icon']['icon_1']['default'] = $pic; $row['icon']['icon_1']['activation'] = $pic; $row['icon']['icon_1']['no_activation'] = $pic; $row['icon']['icon_2']['default'] = $pic; $row['icon']['icon_2']['activation'] = $pic; $row['icon']['icon_2']['no_activation'] = $pic; } unset($row['client_pic'], $row['custom_content_dir'], $row['pic']); return $row; }