Esempio n. 1
0
 public function show()
 {
     /*模板 权限验证预处理 start*/
     $need_auth = 0;
     //$auth_page_self存储授权页面本身、$auth_page_parents存储授权栏目父级页面
     $auth_site = $auth_site_self = $auth_page = $auth_column = $auth_page_self = $auth_page_parents = array();
     if ($this->user['group_type'] > MAX_ADMIN_TYPE) {
         $need_auth = 1;
         $auth_node = $this->user['prms']['app_prms'][APP_UNIQUEID]['nodes'];
         if ((is_array($auth_node) ? implode(',', $auth_node) : $auth_node) == 1) {
             $need_auth = 0;
             //1表示全选  不需要验证权限
         }
         $auth_node = is_array($auth_node) ? $auth_node : explode(',', $auth_node);
         if ($need_auth) {
             foreach ((array) $auth_node as $k => $v) {
                 switch ($v) {
                     case strstr($v, "site") !== false:
                         $v = str_replace("site", "", $v);
                         $v = explode($this->settings['separator'], $v);
                         $auth_site[] = $auth_site_self[] = $v[0];
                         break;
                     case strstr($v, "page_id") !== false:
                         $v = str_replace("page_id", "", $v);
                         $v = explode($this->settings['separator'], $v);
                         $auth_site[] = $v[0];
                         $auth_page[] = $auth_page_self[] = $v[1];
                         break;
                     case strstr($v, "page_data_id") !== false:
                         $v = str_replace("page_data_id", "", $v);
                         $v = explode($this->settings['separator'], $v);
                         $auth_site[] = $v[0];
                         $auth_page[] = $auth_page_parents[] = $v[1];
                         $auth_column[$v[1]][] = $v[2];
                         break;
                     default:
                         break;
                 }
             }
         }
     }
     /*模板 权限验证预处理 end*/
     $through_auth = 0;
     $fid = $this->input['_id'];
     if (strstr($fid, "site") !== false) {
         $fid = str_replace('site', '', $fid);
         $fid = explode($this->settings['separator'], $fid);
         $site_id = $fid[0];
         if ($need_auth) {
             //授权节点
             if (in_array($site_id, $auth_site_self)) {
                 $through_auth = 1;
             }
         }
     } else {
         if (strstr($fid, "page_id") !== false) {
             $fid = str_replace('page_id', '', $fid);
             $fid = explode($this->settings['separator'], $fid);
             $site_id = $fid[0];
             $page_id = $fid[1];
             if ($need_auth) {
                 if (in_array($page_id, $auth_page_self) || in_array($site_id, $auth_site_self)) {
                     $through_auth = 1;
                 }
             }
         } else {
             if (strstr($fid, "page_data_id") !== false) {
                 $fid = str_replace('page_data_id', '', $fid);
                 $fid = explode($this->settings['separator'], $fid);
                 $site_id = $fid[0];
                 $page_id = $fid[1];
                 $page_data_id = $fid[2];
                 if ($need_auth) {
                     $auth_column = isset($auth_column[$page_id]) ? $auth_column[$page_id] : array();
                     //授权节点本身或者孩子节点 显示
                     if (in_array($page_data_id, $auth_column) || in_array($page_id, $auth_page_self) || in_array($site_id, $auth_site_self)) {
                         $through_auth = 1;
                     } else {
                         $page_data = common::get_page_data($page_id, 0, 1, 0, '', $page_data_id);
                         foreach ((array) $page_data['page_data'] as $k => $v) {
                             $auth_column_parents[$v['id']] = $v['parents'];
                         }
                         //栏目孩子节点显示
                         if (array_intersect(explode(',', $auth_column_parents[$page_data_id]), $auth_column)) {
                             $through_auth = 1;
                         }
                     }
                 }
             }
         }
     }
     $set_type = array();
     if ($through_auth || !$need_auth) {
         $set_type = $this->settings['site_col_template'];
         include_once ROOT_PATH . 'lib/class/publishcontent.class.php';
         $this->publishcontent = new publishcontent();
         if ($site_id && !$page_id && !$page_data_id) {
             //有内容,查出内容类型
             $content_type = $this->publishcontent->get_all_content_type();
             foreach ($content_type as $k => $v) {
                 $set_type[$v['id']] = $v['content_type'];
             }
         } else {
             if ($page_id && !$page_data_id) {
                 $page_info = common::get_page_by_id($page_id);
                 $site_id = $page_info['site_id'];
                 if ($page_info['has_content']) {
                     //有内容,查出内容类型
                     $content_type = $this->publishcontent->get_all_content_type();
                     foreach ($content_type as $k => $v) {
                         $set_type[$v['id']] = $v['content_type'];
                     }
                 }
             } else {
                 if ($page_data_id) {
                     if (strstr($page_data_id, 'sort') !== false) {
                         $page_data_id = str_replace('sort', '', $page_data_id);
                         $set_type = array();
                     } else {
                         if (strstr($page_data_id, 'spe') !== false) {
                             $page_data_id = str_replace('spe', '', $page_data_id);
                             if (!class_exists('special')) {
                                 include ROOT_PATH . 'lib/class/special.class.php';
                             }
                             $special = new special();
                             $specail_info = $special->detail($page_data_id);
                             $template_id = $specail_info['template_sign'];
                             $set_type = array('0' => '首页');
                         } else {
                             if (strstr($page_data_id, 'col') !== false) {
                                 $content_type = str_replace('col', '', $page_data_id);
                                 if (!class_exists('special')) {
                                     include ROOT_PATH . 'lib/class/special.class.php';
                                 }
                                 $special = new special();
                                 $special_column_info = $special->special_column_info($content_type);
                                 $page_data_id = $special_column_info['special_id'];
                                 $specail_info = $special->detail($page_data_id);
                                 $template_id = $specail_info['template_sign'];
                                 $set_type = array($content_type => '首页');
                             } else {
                                 $page_info = common::get_page_by_id($page_id);
                                 $site_id = $page_info['site_id'];
                                 if ($page_info['has_content']) {
                                     //有内容,查出内容类型
                                     $content_type = $this->publishcontent->get_all_content_type();
                                     foreach ($content_type as $k => $v) {
                                         $set_type[$v['id']] = $v['content_type'];
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     $result['set_type'] = $site_id ? $set_type : array();
     $result['site_id'] = $site_id;
     $result['page_id'] = $page_id;
     $result['page_data_id'] = $page_data_id;
     $result['template_id'] = $template_id;
     $this->addItem($result);
     $this->output();
 }
Esempio n. 2
0
     $info['column_id'] = array_keys($info['column_id']);
     $info['column_id'] = implode(',', $info['column_id']);
 }
 if ($info['img_info']) {
     $info['img_info'] = unserialize($info['img_info']);
 }
 if ($info['ori_url']) {
     $info['outlink'] = $this->videoUrlParser($info['ori_url']);
 }
 return $info;