Esempio n. 1
0
 /**
  * 查看内容类型
  * @name show
  * @access public
  */
 public function show()
 {
     $site_id = intval($this->input['site_id']) ? intval($this->input['site_id']) : 1;
     $page_id = intval($this->input['page_id']);
     $page_data_id = intval($this->input['page_id']);
     $fid = intval($this->input['fid']);
     if ($site_id && !$page_id) {
         $page = common::get_page_manage($site_id);
         if (is_array($page) && count($page) > 0) {
             foreach ($page as $k => $v) {
                 $this->addItem($v);
             }
             $this->output();
         }
     } else {
         if ($site_id && $page_id) {
             $page_data = common::get_page_data($page_id, 0, 1000, $fid);
             if (is_array($page_data['page_data']) && count($page_data['page_data']) > 0) {
                 foreach ($page_data['page_data'] as $k => $v) {
                     $v['page_id'] = $page_id;
                     $v['page_data_id'] = $v['id'];
                     $this->addItem($v);
                 }
                 $this->output();
             }
         } else {
             $this->output();
         }
     }
 }
Esempio n. 2
0
 public function show()
 {
     $fid = $this->input['fid'];
     include_once CUR_CONF_PATH . 'lib/common.php';
     if (empty($fid)) {
         $sites = $this->pub_config->get_site(' id,site_name ');
         foreach ($sites as $k => $v) {
             $m = array('id' => 'site' . $v['id'] . $this->settings['separator'] . $v['site_name'], "name" => $v['site_name'], "fid" => 0, "depth" => 1);
             //获取页面类型
             $page_type = common::get_page_manage($v['id']);
             if (empty($page_type)) {
                 $m['is_last'] = 1;
             }
             $this->addItem($m);
         }
     } else {
         if (strstr($fid, "site") !== false) {
             //点击的站点
             $site_id = str_replace('site', '', $fid);
             $get_page = explode($this->settings['separator'], $site_id);
             $page_type = common::get_page_manage($get_page[0]);
             foreach ($page_type as $k => $v) {
                 $m = array('id' => 'page_id' . $v['id'] . $this->settings['separator'] . $v['title'], "name" => $v['title'], "fid" => 'page_id' . $v['id'] . $this->settings['separator'] . $v['title'], "depth" => 1);
                 $page_data = common::get_page_data($v['id'], 0, 1);
                 if (empty($page_data['page_data'])) {
                     $m['is_last'] = 1;
                 }
                 $this->addItem($m);
             }
         } else {
             if (strstr($fid, "page_id") !== false) {
                 //点击的页面类型
                 $page_id = str_replace('page_id', '', $fid);
                 $get_page = explode($this->settings['separator'], $page_id);
                 $page_data = common::get_page_data($get_page[0], 0, 100);
                 foreach ($page_data['page_data'] as $k => $v) {
                     $m_id = 'page_data_id' . $page_data['page_info']['id'] . $this->settings['separator'] . $v[$page_data['page_info']['field']] . $this->settings['separator'] . $v[$page_data['page_info']['name_field']];
                     $m = array('id' => $m_id, "name" => $v[$page_data['page_info']['name_field']], "fid" => $m_id, "depth" => 1);
                     $m['is_last'] = $v[$page_data['page_info']['last_field']];
                     $this->addItem($m);
                 }
             } else {
                 if (strstr($fid, "page_data_id") !== false) {
                     //点击的页面数据
                     $page_data_id = str_replace('page_data_id', '', $fid);
                     $get_page = explode($this->settings['separator'], $page_data_id);
                     $page_data = common::get_page_data($get_page[0], '', '', $get_page[1]);
                     foreach ($page_data['page_data'] as $k => $v) {
                         $m_id = 'page_data_id' . $page_data['page_info']['id'] . $this->settings['separator'] . $v[$page_data['page_info']['field']] . $this->settings['separator'] . $v[$page_data['page_info']['name_field']];
                         $m = array('id' => $m_id, "name" => $v[$page_data['page_info']['name_field']], "fid" => $m_id, "depth" => 1);
                         $m['is_last'] = $v[$page_data['page_info']['last_field']];
                         $this->addItem($m);
                     }
                 }
             }
         }
     }
     $this->output();
 }
Esempio n. 3
0
 /**
  * 魔力视图中切换页面
  */
 public function changeColumn()
 {
     $site_id = $this->input['site_id'];
     $page_id = $this->input['page_id'];
     $page_data_id = $this->input['page_data_id'];
     if (!$site_id) {
         $this->errorOutput('站点id为空');
     }
     include_once ROOT_PATH . 'lib/class/publishcontent.class.php';
     $this->publishcontent = new publishcontent();
     $set_type = $this->settings['site_col_template'];
     //有页面类型则取页面下栏目,没有取此站点下页面####
     if ($page_id) {
         $page_data = common::get_page_data($page_id, 0, 300, $page_data_id);
         if (is_array($page_data['page_data']) && count($page_data['page_data']) > 0) {
             ####取出此页面的内容类型####
             if ($page_data['page_info']['has_content']) {
                 $types = $this->publishcontent->get_all_content_type();
                 if (is_array($types) && count($types) > 0) {
                     foreach ($types as $kk => $vv) {
                         $set_type[$vv['id']] = $vv['content_type'];
                     }
                 }
             }
             foreach ($page_data['page_data'] as $k => $v) {
                 $m = array('id' => $v['id'], 'title' => $v['name'], 'site_id' => $page_data['page_info']['site_id'], 'page_id' => $page_data['page_info']['id'], 'page_data_id' => $v['id'], 'content_types' => $set_type, 'is_last' => $v[$page_data['page_info']['last_field']]);
                 $this->addItem($m);
             }
         }
     } else {
         $pages = common::get_page_manage($site_id);
         if (is_array($pages) && count($pages) > 0) {
             //内容类型
             foreach ($pages as $k => $v) {
                 if ($v['has_content']) {
                     //有内容,查出内容类型
                     $types = $this->publishcontent->get_all_content_type();
                     if (is_array($types) && count($types) > 0) {
                         foreach ($types as $kk => $vv) {
                             $set_type[$vv['id']] = $vv['content_type'];
                         }
                     }
                     $v['content_types'] = $set_type;
                 }
                 $m = array('id' => $v['id'], 'title' => $v['title'], 'site_id' => $v['site_id'], 'page_id' => $v['page_id'], 'page_data_id' => $v['page_data_id'], 'content_types' => $set_type, 'is_last' => 0);
                 $page_data = common::get_page_data($v['id'], 0, 1);
                 if (empty($page_data['page_data'])) {
                     $m['is_last'] = 1;
                 }
                 $this->addItem($m);
             }
         }
     }
     $this->output();
 }
Esempio n. 4
0
 public function pageNode()
 {
     include_once ROOT_PATH . 'lib/class/publishconfig.class.php';
     $this->pub_config = new publishconfig();
     include_once CUR_CONF_PATH . 'lib/common.php';
     $data = array();
     $fid = $this->input['fid'] ? $this->input['fid'] : '';
     $offset = $this->input['offset'] ? intval($this->input['offset']) : 0;
     $count = $this->input['count'] ? intval($this->input['count']) : 1000;
     $data['item'] = $total = array();
     if (strstr($fid, "page_id") !== false) {
         //点击的页面类型
         $page_id = str_replace('page_id', '', $fid);
         $get_page = explode($this->settings['separator'], $page_id);
         $page_data = common::get_page_data($get_page[1], $offset, $count);
         foreach ($page_data['page_data'] as $k => $v) {
             $m_id = 'page_data_id' . $get_page[0] . $this->settings['separator'] . $page_data['page_info']['id'] . $this->settings['separator'] . $v['id'] . $this->settings['separator'] . $v['name'];
             $page = array('id' => $m_id, "name" => $v['name'], "fid" => 'page_data_id' . $page_data['page_info']['id'], "depth" => 1);
             $page['is_last'] = $v['is_last'];
             $data['item'][] = $page;
         }
     } else {
         if (strstr($fid, "page_data_id") !== false) {
             //点击的页面数据
             $page_data_id = str_replace('page_data_id', '', $fid);
             $get_page = explode($this->settings['separator'], $page_data_id);
             $page_data = common::get_page_data($get_page[1], $offset, $count, $get_page[2]);
             foreach ($page_data['page_data'] as $k => $v) {
                 $m_id = 'page_data_id' . $get_page[0] . $this->settings['separator'] . $page_data['page_info']['id'] . $this->settings['separator'] . $v['id'] . $this->settings['separator'] . $v['name'];
                 $column = array('id' => $m_id, "name" => $v['name'], "fid" => 'page_data_id' . $page_data['page_info']['id'], "depth" => 1);
                 $column['is_last'] = $v['is_last'];
                 $data['item'][] = $column;
             }
         } else {
             if ($fid) {
                 //点击的站点
                 $site_id = intval(str_replace('site', '', $fid));
                 if (!$site_id) {
                     $this->errorOutput('NO_SITE_ID');
                 }
                 $get_page = explode($this->settings['separator'], $site_id);
                 $page_type = common::get_page_manage($get_page[0]);
                 foreach ($page_type as $k => $v) {
                     //                if ($v['sign'] == 'special')
                     //                {
                     //                    continue;
                     //                }
                     $page = array('id' => 'page_id' . $site_id . $this->settings['separator'] . $v['id'] . $this->settings['separator'] . $v['title'], "name" => $v['title'], "fid" => 'page_id' . $v['id'], "depth" => 1);
                     $page_data = common::get_page_data($v['id'], 0, 1);
                     if (empty($page_data['page_data'])) {
                         $page['is_last'] = 1;
                     } else {
                         $page['is_last'] = 0;
                     }
                     $data['item'][] = $page;
                 }
             } else {
                 $sites = $this->pub_config->get_site(' id,site_name ', $offset, $count, '', $this->input['key']);
                 if (is_array($sites) && count($sites) > 0) {
                     foreach ((array) $sites as $k => $v) {
                         $site = array('id' => 'site' . $v['id'] . $this->settings['separator'] . $v['site_name'], "name" => $v['site_name'], "fid" => 0, "depth" => 1);
                         //获取页面类型
                         $page_type = common::get_page_manage($v['id']);
                         if (empty($page_type)) {
                             $site['is_last'] = 1;
                         } else {
                             $site['is_last'] = 0;
                         }
                         $data['item'][] = $site;
                     }
                 }
                 $total = $this->pub_config->get_site_count($this->input['key']);
             }
         }
     }
     if ($total) {
         $pagearr = array();
         $pagearr['total'] = isset($total['total']) ? $total['total'] : 0;
         $pagearr['page_num'] = $count;
         $pagearr['total_num'] = $pagearr['total'];
         $pagearr['total_page'] = ceil($pagearr['total'] / $count);
         $pagearr['current_page'] = floor($offset / $count) + 1;
         $data['page'] = $pagearr;
     }
     $this->addItem($data);
     $this->output();
 }
Esempio n. 5
0
File: mk.php Progetto: h3len/Project
 public function build_mk_cache()
 {
     //获取站点信息
     $this->site = $this->pub_config->get_site_first('*', $this->site_id);
     $css_js_filein_tem = true;
     //获取客户端详细信息
     $this->client = $this->pub_config->get_client_first($this->client_type);
     //设置文件生成方式
     $this->page_info['file_mktype'] = $this->site['produce_format'];
     $this->page_info['filename'] = $this->site['indexname'] ? $this->site['indexname'] : 'index';
     $this->page_info['weburl'] = $this->site['site_info']['url'];
     $this->page_info['dir'] = $this->site['site_dir'];
     $this->page_info['custom_content_dir'] = $this->site['custom_content_dir'];
     $this->page_info['custom_content_dir'] = $this->site['custom_content_dir'];
     $this->page_info['tem_material_dir'] = get_site_temdir($this->site);
     $this->page_info['tem_material_url'] = get_site_temurl($this->site);
     //如果有页面id
     if ($this->page_id) {
         $page_type = common::get_page_manage($this->site_id, $this->page_id, 'id');
         $page_type_detail = $page_type[$this->page_id];
         if ($page_type_detail['sign'] == 'special') {
             //查询专题的生成目录
         } else {
             if ($page_type_detail['sign']) {
                 //设置文件生成方式
                 $this->page_info['file_mktype'] = isset($page_type_detail['maketype']) ? $page_type_detail['maketype'] : 1;
                 $this->page_info['filename'] = isset($page_type_detail['colindex']) ? $page_type_detail['colindex'] : 'index';
                 $this->page_info['weburl'] = $page_type_detail['column_domain'];
                 $this->page_info['dir'] .= $page_type_detail['column_dir'];
             }
         }
         //如果有页面数据id,
         if ($this->page_data_id && $page_type_detail['sign'] != 'special') {
             $page_data = common::get_page_data($this->page_id, '', '', '', $page_type_detail, $this->page_data_id);
             $page_data_detail = $page_data['page_data'][0];
             if (!$page_data_detail) {
                 $this->set_error('未取得page_data_id:' . $this->page_id . '_' . $this->page_data_id . var_export($page_data, true) . '详细信息');
             }
             $this->column = $page_data_detail;
             //设置文件生成方式
             if (in_array($this->content_type, $this->content_type_true)) {
                 $this->page_info['file_mktype'] = $page_data_detail['maketype'];
             } else {
                 $this->page_info['file_mktype'] = $page_data_detail['col_con_maketype'];
                 //表示内容正文(目前生成分页正文全文链接有作用)
                 $this->page_info['page_content_type'] = 1;
             }
             //设置文件生成方式
             $this->page_info['filename'] = $page_data_detail['colindex'];
             $this->page_info['weburl'] = $page_data_detail['column_domain'];
             $this->page_info['dir'] .= $page_data_detail['column_dir'];
             $this->page_info['column_dir'] .= $page_data_detail['column_dir'];
             $this->page_info['relate_dir'] .= $page_data_detail['relate_dir'];
         }
     }
     $this->page_info['suffix'] = $this->page_info['file_mktype'] == 1 ? '.html' : '.php';
     //内容页计算出内容的url
     if (in_array($this->content_type, $this->content_type_true)) {
         $this->is_page_content = false;
     }
     //取单元,设有缓存
     if ($this->page_id_c && $this->page_data_id_c) {
         //专题模块查询出该专题详细信息
         include_once ROOT_PATH . 'lib/class/special.class.php';
         $special_obj = new special();
         $this->special_detail = $special_obj->get_special_by_id($this->page_data_id_c);
         //$cell_ret             = common::get_special_cell_list($this->page_data_id_c, $this->template_sign, 0, $this->page_info['tem_material_url'] . '/' . $this->settings['template_name']);
         $cell_ret = common::getTemplateAndCell(0, 0, $this->page_data_id_c, 0, $this->page_info['tem_material_url'] . '/' . $this->settings['template_name'], $this->template_sign);
         if (is_array($this->special_detail) && $this->special_detail) {
             //$this->page_info['column_dir'] .= $this->special_detail['column_dir'];
             $this->page_info['file_mktype'] = $this->special_detail['maketype'];
             $this->page_info['suffix'] = $this->page_info['file_mktype'] == 1 ? '.html' : '.php';
         }
         //表示内容正文(目前生成分页正文全文链接有作用)
         $this->page_info['page_content_type'] = 0;
     } else {
         if ($page_type_detail['sign'] == 'special') {
             //专题模块查询出该专题详细信息
             include_once ROOT_PATH . 'lib/class/special.class.php';
             $special_obj = new special();
             //根据专题子栏目查询出专题
             $this->special_detail = $special_obj->get_mkspecial('', $this->page_data_id);
             //查询出这个专题的发布目录
             if ($this->special_detail && is_array($this->special_detail)) {
                 $this->special_column = $this->special_detail['special_column'];
                 $this->page_info['column_dir'] .= $this->special_detail['column_dir'];
                 $this->page_info['relate_dir'] = $this->special_detail['relate_dir'];
                 $this->page_info['special_dir'] = $this->special_detail['special_dir'];
                 $this->page_info['file_mktype'] = $this->special_detail['maketype'];
                 $this->page_info['filename'] = $this->special_detail['colindex'];
                 $this->page_info['dir'] .= $this->special_detail['column_dir'];
                 $this->page_info['suffix'] = $this->page_info['file_mktype'] == 1 ? '.html' : '.php';
                 $this->page_info['page_type'] = 'special';
                 $this->template_sign = $this->special_detail['template_sign'];
                 $this->column['name'] = $this->special_detail['title'];
                 $this->column['keywords'] = $this->special_detail['keywords'];
                 $this->column['content'] = $this->special_detail['brief'];
                 $this->page_data_id_s = $this->special_detail['id'];
                 $this->content_type_s = $this->page_data_id . 's';
             } else {
                 $this->set_error('未取到专题信息,专题的栏目id:' . $this->page_data_id . ';专题返回数据(get_mkspecial):' . var_export($this->special_detail, true));
             }
             //$cell_ret = common::get_special_cell_list($this->special_detail['id'], $this->template_sign, $this->page_data_id, $this->page_info['tem_material_url'] . '/' . $this->settings['template_name']);
             $cell_ret = common::getTemplateAndCell(0, 0, $this->special_detail['id'], $this->page_data_id, $this->page_info['tem_material_url'] . '/' . $this->settings['template_name'], $this->template_sign);
         } else {
             //$cell_ret = common::get_cell_list($this->site_id, $this->page_id, $this->page_data_id, $this->content_type, $this->template_sign);
             $cell_ret = common::getTemplateAndCell($this->site_id, $this->page_id, $this->page_data_id, $this->content_type, $this->page_info['tem_material_url'] . '/' . $this->settings['template_name']);
         }
     }
     /**
             foreach($cell_ret['default_cell'] as $k=>$v)
             {
        if($v['layout_id'])
        {
            $cell_ret['default_cell'][$k]['id']=$v['id'].'_'.$v['layout_id'];
        }
             }
     */
     //当前使用中的套系标识
     $template_style = $cell_ret['curr_style'] ? $cell_ret['curr_style'] : 'default';
     //当前模板标识
     $template_sign = $cell_ret['template_sign'];
     //获取模板,设有缓存
     if ($this->page_id_c && $this->page_data_id_c || $page_type_detail['sign'] == 'special') {
         foreach ($cell_ret['default_cell'] as $k => $v) {
             if ($v['layout_id']) {
                 $cell_ret['default_cell'][$k]['id'] = $v['id'] . '_' . $v['layout_id'];
             }
         }
         $this->template_set = $cell_ret['template'];
         //$this->template_set = common::get_template_cache($template_sign, $template_style, $this->settings['special_template']['site_id'], $this->page_info['tem_material_url'] . '/' . $this->settings['template_name']);
     } else {
         $this->template_set = $cell_ret['template'];
         //$this->template_set = common::get_template_cache($template_sign, $template_style, $this->site_id, $this->page_info['tem_material_url'] . '/' . $this->settings['template_name']);
     }
     //页面标题关键字描述的插入到模板中
     if (!$this->is_page_content) {
         $this->template_set = template_process($this->template_set, $this->site, $this->column);
     } else {
         $this->template_set = template_process($this->template_set, $this->site, $this->column, true);
     }
     //取出单元用到的数据源,样式
     $this->cell_process($cell_ret);
     //js加入栏目信息到源码中
     $column_detail_codearr = array('id' => $page_data_detail['id'], 'title' => $page_data_detail['name'], 'keywords' => $page_data_detail['keywords']);
     $column_detail_codestr = "\n" . "<script type=\"text/javascript\">var m2o_column=" . json_encode($column_detail_codearr) . ";";
     $m2o_content_detail_codearr = '<?php 
                     $m2o_content_detail_codearr = array(
                     \'id\' => $__info[\'content\'][\'content_id\'],
                     \'title\' => $__info[\'content\'][\'title\'],
                     \'keywords\' => $__info[\'content\'][\'keywords\'],
                     \'bundle_id\' => $__info[\'content\'][\'bundle_id\'],
                     \'module_id\' => $__info[\'content\'][\'module_id\'],
                     \'content_id\' => $__info[\'content\'][\'content_id\'],
                     \'content_fromid\' => $__info[\'content\'][\'content_fromid\'],
                     \'rid\' => $__info[\'content\'][\'rid\'],
                 );
                 echo json_encode($m2o_content_detail_codearr);
                 ?>';
     $column_detail_codestr .= "var m2o_content = '" . $m2o_content_detail_codearr . "';";
     $column_detail_codestr .= "</script>" . "\n";
     $this->template_set = str_ireplace('</head>', $column_detail_codestr . '</head>', $this->template_set);
     //css加载到模板中
     if (!$this->is_page_content) {
         $this->template_set = str_ireplace('</head>', $this->css . "\n" . '</head>', $this->template_set);
         $this->css = '';
     } else {
         //计算js,css路径,外链到模板head中去
         //页面素材域名
         if ($this->page_id_c && $this->page_data_id_c) {
             $mar_dir = $this->page_id_c . '/' . $this->page_data_id_c . '/' . $this->content_type . '/';
             $css_filename = $this->page_id_c . '_' . $this->page_data_id_c . '_' . $this->content_type . '_' . $this->client_type . '.css';
         } else {
             $mar_dir = $this->page_id . '/' . $this->page_data_id . '/' . $this->content_type . '/';
             $css_filename = $this->page_id . '_' . $this->page_data_id . '_' . $this->content_type . '_' . $this->client_type . '.css';
         }
         //计算css路径
         $this->mar_css['mar_css_dir'] = $this->page_info['tem_material_dir'] . '/' . $this->settings['template_name'] . '/' . $mar_dir;
         $this->mar_css['mar_css_filename'] = $css_filename;
         $css_link = '<link  rel="stylesheet" type="text/css" href="' . $this->page_info['tem_material_url'] . '/' . $this->settings['template_name'] . '/' . $mar_dir . $css_filename . '" />';
         $this->template_set = str_ireplace('</head>', $css_link . "\n" . '</head>', $this->template_set);
     }
     //js添加到</body>之前
     if ($this->js) {
         $this->template_set = str_ireplace('</body>', $this->js . "\n" . '</body>', $this->template_set);
         $this->js = '';
     }
     //生成头部文件
     $this->include_head($cell_ret);
     //生成缓存文件
     $this->set_cache();
     //复制数据源缓存到lib/m2o/include
     if (is_dir(CUR_CONF_PATH . 'cache/datasource')) {
         if (!file_copy(CUR_CONF_PATH . 'cache/datasource', CUR_CONF_PATH . 'lib/m2o/include', array())) {
             $this->set_error('模板服务器:' . realpath(CUR_CONF_PATH . 'lib/m2o/include') . '目录不可写');
         }
     }
 }
Esempio n. 6
0
 public function get_node()
 {
     $offset = $this->input['offset'] ? intval(urldecode($this->input['offset'])) : 0;
     $count = $this->input['count'] ? intval(urldecode($this->input['count'])) : 5000;
     $siteid = intval($this->input['siteid']);
     if (!($fid = $this->input['fid'])) {
         if ($siteid) {
             $fid = 'site' . $siteid;
         }
     }
     if (empty($fid)) {
         $fid = 'site1';
     }
     if (empty($fid)) {
         $sites = $this->pub_config->get_site(' id,site_name ');
         foreach ($sites as $k => $v) {
             $m = array('id' => 'site' . $v['id'] . $this->settings['separator'] . $v['site_name'], "name" => $v['site_name'], "fid" => 0, "depth" => 1);
             //获取页面类型
             $page_type = common::get_page_manage($v['id']);
             $page_type = $this->pub_sys->get_page_manage($v['id']);
             if (empty($page_type)) {
                 $m['is_last'] = 1;
             } else {
                 $m['is_last'] = 0;
             }
             $this->addItem($m);
         }
     } else {
         if (strstr($fid, "site") !== false) {
             //点击的站点
             $site_id = str_replace('site', '', $fid);
             $get_page = explode($this->settings['separator'], $site_id);
             $page_type = $this->pub_sys->get_page_manage($get_page[0]);
             foreach ($page_type as $k => $v) {
                 $m = array('id' => 'page_id' . $v['id'] . $this->settings['separator'] . $v['title'], "name" => $v['title'], "fid" => 'page_id' . $v['id'], "depth" => 1);
                 $page_data = $this->pub_sys->get_page_data($v['id'], 0, 1);
                 if (empty($page_data['page_data'])) {
                     $m['is_last'] = 1;
                 } else {
                     $m['is_last'] = 0;
                 }
                 if ($v['sign'] != 'column') {
                     $m['can_select'] = 1;
                 }
                 $this->addItem($m);
             }
         } else {
             if (strstr($fid, "page_id") !== false) {
                 //点击的页面类型
                 $page_id = str_replace('page_id', '', $fid);
                 $get_page = explode($this->settings['separator'], $page_id);
                 $page_data = $this->pub_sys->get_page_data($get_page[0], $offset, $count);
                 foreach ($page_data['page_data'] as $k => $v) {
                     $m_id = 'page_data_id' . $page_data['page_info']['id'] . $this->settings['separator'] . $v['id'] . $this->settings['separator'] . $v['name'];
                     $m = array('id' => $m_id, "name" => $v['name'], "fid" => 'page_data_id' . $page_data['page_info']['id'], "depth" => 1, "can_select" => $v['can_select']);
                     $m['is_last'] = $v['is_last'];
                     if (is_array($page_data['page_info'])) {
                         if ($page_data['page_info']['sign'] != 'column') {
                             $m['can_select'] = 1;
                         }
                     }
                     $this->addItem($m);
                 }
             } else {
                 if (strstr($fid, "page_data_id") !== false) {
                     //点击的页面数据
                     $page_data_id = str_replace('page_data_id', '', $fid);
                     $get_page = explode($this->settings['separator'], $page_data_id);
                     $page_data = $this->pub_sys->get_page_data($get_page[0], $offset, $count, $get_page[1]);
                     foreach ($page_data['page_data'] as $k => $v) {
                         $m_id = 'page_data_id' . $page_data['page_info']['id'] . $this->settings['separator'] . $v['id'] . $this->settings['separator'] . $v['name'];
                         $m = array('id' => $m_id, "name" => $v['name'], "fid" => 'page_data_id' . $page_data['page_info']['id'], "depth" => 1, "can_select" => $v['can_select']);
                         $m['is_last'] = $v['is_last'];
                         $this->addItem($m);
                     }
                 }
             }
         }
     }
     $this->output();
 }
Esempio n. 7
0
 public function rebuild_deploy($site_id, $page_id, $page_data_id, $site_detail = array())
 {
     if (!$site_id && !$page_id) {
         return false;
     }
     if (!$site_detail) {
         //查出这个站点使用的套系
         $site_detail = $this->pub_config->get_site_first('id,site_name,tem_style,support_client', $site_id);
         $support_client = explode(',', $site_detail['support_client']);
         if (!$support_client) {
             return false;
         }
     } else {
         $support_client = explode(',', $site_detail['support_client']);
     }
     $set_type_content = array();
     //默认的模板类型
     $set_type_default = $this->settings['site_col_template'];
     //有内容,查出内容类型
     $content_type = $this->get_content_type();
     include_once CUR_CONF_PATH . 'lib/cache.class.php';
     $this->cache = new cache();
     if ($site_id && !$page_id) {
         //先查出这个站点的部署信息
         $site_deploy_tem = $this->obj->get_deploy_template($site_id, $this->settings['tem_style_default'], 0, 0);
         $this->cache->initialize(CUR_CONF_PATH . 'cache/deploy');
         $this->cache->set($site_id, $site_deploy_tem[$site_id][0][0]);
         //取出站点下面的页面
         $page_manage = common::get_page_manage($site_id);
         //取出所有页面类型的模板部署
         $page_deploy_tems = $this->obj->get_deploy_template_all($site_id, "'" . $site_detail['tem_style'] . "'");
         foreach ($page_manage as $k => $v) {
             $set_type_use = array();
             //给页面类型部署(如果没有,则继承站点部署)
             $set_type_use = $v['has_content'] ? $set_type_default + $content_type : $set_type_default;
             foreach ($support_client as $k1 => $v1) {
                 foreach ($set_type_use as $k2 => $v2) {
                     //页面类型部署
                     if (empty($page_deploy_tems[$site_id][$v['id']][0][$v1][$k2])) {
                         if (!empty($site_deploy_tem[$site_id][0][0][$v1][$k2])) {
                             $page_deploy_tems[$site_id][$v['id']][0][$v1][$k2] = $site_deploy_tem[$site_id][0][0][$v1][$k2];
                         } else {
                             $page_deploy_tems[$site_id][$v['id']][0][$v1][$k2] = array();
                         }
                     }
                 }
             }
             $this->cache->initialize(CUR_CONF_PATH . 'cache/deploy');
             $this->cache->set($site_id . '_' . $v['id'], $page_deploy_tems[$site_id][$v['id']][0]);
             //给页面数据部署
             $this->rebuild_page_data($support_client, $set_type_use, $site_id, $v, $page_deploy_tems, $page_deploy_tems[$site_id][$v['id']][0], $site_detail, 0, 0, 1000);
         }
     } else {
         if ($page_id && !$page_data_id) {
             $father_deploy_tem = array();
             //查询出页面类型详情
             $page_info = common::get_page_by_id($page_id);
             $set_type_use = $page_info['has_content'] ? $set_type_default + $content_type : $set_type_default;
             //取出所有页面类型的模板部署
             $page_deploy_tems = $this->obj->get_deploy_template_all($site_id, "'" . $site_detail['tem_style'] . "'", $page_id);
             //当前页面类型的模板部署
             $this->cache->initialize(CUR_CONF_PATH . 'cache/deploy');
             $page_type_deploy_tem_cache = $this->cache->get($site_id . '_' . $page_id);
             $page_deploy_tems[$site_id][$page_id][0] = $page_deploy_tems[$site_id][$page_id][0] ? $page_deploy_tems[$site_id][$page_id][0] : array();
             if (empty($page_type_deploy_tem_cache) && empty($page_deploy_tems[$site_id][$page_id][0])) {
                 //取站点缓存部署
                 $this->cache->initialize(CUR_CONF_PATH . 'cache/deploy');
                 $site_deploy_tem_cache = $this->cache->get($site_id);
                 if (!empty($site_deploy_tem_cache)) {
                     $page_deploy_tems[$site_id][$page_id][0] = $site_deploy_tem_cache;
                 }
             }
             $father_deploy_tem = multi_array_merge($page_type_deploy_tem_cache, $page_deploy_tems[$site_id][$page_id][0]);
             $this->cache->initialize(CUR_CONF_PATH . 'cache/deploy');
             $this->cache->set($site_id . '_' . $page_id, $father_deploy_tem);
             //给页面数据部署
             $this->rebuild_page_data($support_client, $set_type_use, $site_id, $page_info, $page_deploy_tems, $father_deploy_tem, $site_detail, 0, 0, 1000);
         } else {
             if ($page_data_id) {
                 $father_deploy_tem = array();
                 //查询出页面类型详情
                 $page_info = common::get_page_by_id($page_id);
                 $set_type_use = $page_info['has_content'] ? $set_type_default + $content_type : $set_type_default;
                 //取出所有页面类型的模板部署
                 if (!is_numeric($page_data_id)) {
                     return;
                 }
                 $page_deploy_tems = $this->obj->get_deploy_template_all($site_id, "'" . $site_detail['tem_style'] . "'", $page_id, $page_data_id);
                 //当前页面类型的模板部署
                 $this->cache->initialize(CUR_CONF_PATH . 'cache/deploy');
                 $page_data_deploy_tem_cache = $this->cache->get($site_id . '_' . $page_id . '_' . $page_data_id);
                 $page_data_deploy_tem_cache = empty($page_data_deploy_tem_cache) ? array() : $page_data_deploy_tem_cache;
                 $page_deploy_tems[$site_id][$page_id][$page_data_id] = $page_deploy_tems[$site_id][$page_id][$page_data_id] ? $page_deploy_tems[$site_id][$page_id][$page_data_id] : array();
                 if (empty($page_data_deploy_tem_cache) && empty($page_deploy_tems[$site_id][$page_id][$page_data_id])) {
                     $this->rebuild_deploy($site_id, $page_id, 0, $site_detail);
                     $this->cache->initialize(CUR_CONF_PATH . 'cache/deploy');
                     $page_data_deploy_tem_cache = $this->cache->get($site_id . '_' . $page_id . '_' . $page_data_id);
                     $page_data_deploy_tem_cache = empty($page_data_deploy_tem_cache) ? array() : $page_data_deploy_tem_cache;
                     $page_deploy_tems[$site_id][$page_id][$page_data_id] = $page_deploy_tems[$site_id][$page_id][$page_data_id] ? $page_deploy_tems[$site_id][$page_id][$page_data_id] : array();
                 }
                 $father_deploy_tem = multi_array_merge($page_data_deploy_tem_cache, $page_deploy_tems[$site_id][$page_id][$page_data_id]);
                 $this->cache->initialize(CUR_CONF_PATH . 'cache/deploy');
                 $this->cache->set($site_id . '_' . $page_id . '_' . $page_data_id, $father_deploy_tem);
                 //给页面数据部署
                 $this->rebuild_page_data($support_client, $set_type_use, $site_id, $page_info, $page_deploy_tems, $father_deploy_tem, $site_detail, $page_data_id, 0, 1000);
             }
         }
     }
 }
Esempio n. 8
0
 /**
  * 设置分页、站点、页面、栏目、专题、专题栏目信息
  */
 private function setPaginationInfo()
 {
     if (!$this->arSiteInfo && $this->intSiteId) {
         include_once ROOT_PATH . 'lib/class/publishconfig.class.php';
         $this->objPub = new publishconfig();
         $this->arSiteInfo = $this->objPub->get_site_first('*', $this->intSiteId);
     }
     //设置文件生成方式
     if ($this->intSiteId) {
         $needPageInfo['file_mktype'] = $this->arSiteInfo['produce_format'];
         $needPageInfo['page_filename'] = $this->arSiteInfo['indexname'];
         $needPageInfo['page_url'] = $this->arSiteInfo['site_info']['url'];
         $needPageInfo['dir'] = $this->arSiteInfo['site_dir'];
     }
     if ($this->intPageId) {
         $arPageType = common::get_page_manage($this->intSiteId, $this->intPageId, 'id');
         $arPageTypeDetail = $arPageType[$this->intPageId];
         //设置文件生成方式
         $needPageInfo['file_mktype'] = $arPageTypeDetail['maketype'];
         $needPageInfo['page_filename'] = $arPageTypeDetail['colindex'];
         $needPageInfo['page_url'] = $arPageTypeDetail['column_domain'];
         $needPageInfo['dir'] .= $arPageTypeDetail['column_dir'];
     }
     if ($this->intPageDataId) {
         empty($this->arPageInfo) && ($this->arPageInfo = common::getPageBySign('special', 'id'));
         if ($this->intPageId == $this->arPageInfo['id']) {
             //专题信息
             $arSpecialInfo = common::get_special_info($this->intPageDataId);
             if ($this->intContentType) {
                 $arSpecialColumnInfo = common::get_special_column_info($this->intContentType);
             }
         } else {
             $arPageData = common::get_page_data($this->intPageId, '', '', '', '', $this->intPageDataId);
             $arColumnInfo = $arPageData['page_data'][0];
             //设置文件生成方式
             $needPageInfo['file_mktype'] = $arColumnInfo['maketype'];
             $needPageInfo['page_filename'] = $arColumnInfo['colindex'];
             $needPageInfo['page_url'] = $arColumnInfo['column_domain'];
             $needPageInfo['dir'] .= $arColumnInfo['column_dir'];
         }
     }
     if ($this->intClientType) {
         if (!class_exists('publishconfig')) {
             include_once ROOT_PATH . 'lib/class/publishconfig.class.php';
         }
         $this->objPub = new publishconfig();
         $this->arPageClientInfo = $this->objPub->get_client_first($this->intClientType);
     }
     $this->arNeedPageInfo = $needPageInfo;
     $this->arPageSiteInfo = $this->arSiteInfo;
     $this->arPageColumnInfo = $arColumnInfo;
     $this->arPageSpecialInfo = $arSpecialInfo;
     $this->arPageSpecialColumnInfo = $arSpecialColumnInfo;
 }
Esempio n. 9
0
 public function show($plan, $content_data = array(), $is_from_sys = false)
 {
     $html = '';
     $this->setPlan($plan);
     if (!in_array($plan['content_type'], $this->content_type_true) && !$is_from_sys) {
         if ($plan['count'] === 0) {
             echo "所取内容条数为0条,不生成";
             exit;
         } else {
             if ($plan['count']) {
                 $count = $plan['count'] <= $this->settings['content_num_time'] ? $plan['count'] : $this->settings['content_num_time'];
                 $this->setTimecount($count);
                 $nextcount = $plan['count'] - $count;
                 $is_copy_plan = $nextcount > 0 ? true : false;
                 $offset = $plan['offset'] + $count;
             } else {
                 $offset = $plan['offset'] + $this->settings['content_num_time'];
                 //表示全部生成
                 $this->setTimecount($this->settings['content_num_time']);
                 $is_copy_plan = true;
             }
         }
     }
     //获取站点信息
     $site = $this->pub_config->get_site_first('*', $plan['site_id']);
     $this->setSite($site);
     if (!$site['tem_material_url']) {
         $site['tem_material_url'] = rtrim($site['sub_weburl'], '/') . '.' . $site['weburl'];
     }
     $this->setPagedir($site['site_dir']);
     $this->setMktype($site['produce_format']);
     $this->setFilename($site['indexname']);
     /**页面生成方式  1为静态生成 2为动态生成   
     			$page_mk_type页面生成方式  $page_content_mk_type内容生成方式
     			$dir 该页面生成的目录
     		*/
     if ($plan['page_id']) {
         $page_type = common::get_page_manage($plan['site_id'], $plan['page_id'], 'id');
         $page_type_detail = $page_type[$plan['page_id']];
         if ($page_type_detail['sign'] != 'column') {
             $this->setPagedir($page_type_detail['sign']);
         }
     }
     if ($plan['page_data_id']) {
         $page_data = common::get_page_data($plan['page_id'], '', '', '', $page_type_detail, $plan['page_data_id']);
         $page_data_detail = $page_data['page_data'][0];
         $this->setFilename($page_data_detail['colindex']);
         $this->setPagedir($page_data_detail['column_dir']);
         $this->setColumn($page_data_detail);
         if (in_array($plan['content_type'], $this->content_type_true)) {
             $this->setMktype($page_data_detail['maketype']);
         } else {
             $this->setMktype($page_data_detail['col_con_maketype']);
         }
     }
     $this->setWeburl();
     //获取对应模板,单元
     $cell_ret = common::merge_cell($plan['site_id'], $plan['page_id'], $plan['page_data_id'], $plan['content_type'], $site);
     if (MK_DEBUG) {
         file_in('../cache/log/', '处理前所有单元.txt', var_export($cell_ret, 1), true, true);
     }
     $template_style = $cell_ret['curr_style'];
     //当前使用中的套系标识
     $template_sign = $cell_ret['template_sign'];
     //当前模板标识
     //获取模板
     //		$site['tem_material_url'] = $site['tem_material_url']?$site['tem_material_url']:(rtrim($site['sub_weburl'],'/').'/'.rtrim($site['weburl'],'/').'/'.'templates');
     $template = common::get_template_cache($template_sign, $template_style, $plan['site_id'], $site['tem_material_url'] . '/t');
     if (MK_DEBUG) {
         file_in('../cache/log/', '处理前的模板.txt', $template, true, true);
     }
     //页面标题关键字描述的插入到模板中
     $template = template_process($template, $this->site, $this->column);
     if (MK_DEBUG) {
         file_in('../cache/log/', '处理head后模板.txt', $template, true, true);
     }
     if (empty($template)) {
         echo "没有部署模板";
         exit;
     }
     if (is_array($cell_ret['default_cell'])) {
         //			print_r($cell_ret['default_cell']);exit;
         //获取所有样式
         foreach ($cell_ret['default_cell'] as $k => $v) {
             if ($v['cell_mode']) {
                 $mode_idarr[$v['cell_mode']] = $v['cell_mode'];
             }
             if ($v['data_source']) {
                 $datasourceid[$v['data_source']] = $v['data_source'];
             }
         }
         //取样式的详细信息
         if ($mode_idarr) {
             $mode_id_str = implode(',', $mode_idarr);
             $mode_data = common::get_mode_infos($mode_id_str, '', 'id');
             //获取样式参数
             $mode_variables = common::get_mode_variable($mode_id_str);
             //加载css
             $cssstr = '<style type="text/css">';
             foreach ($mode_data as $k => $v) {
                 $cssstr .= $v['css'] . ' ';
             }
             $cssstr .= '</style>';
             $template = str_ireplace('</head>', $cssstr . '</head>', $template);
         }
         if (MK_DEBUG) {
             file_in('../cache/log/', '处理过样式后模板.txt', $template, true, true);
         }
         /**
          * 首页,列表的单元处理
          * */
         if (in_array($plan['content_type'], $this->content_type_true)) {
             $index_cell = $this->index_cell($cell_ret, $mode_data, $datasourceid, $mode_variables);
             $tem_cell = $index_cell['tem_cell'];
         } else {
             //取正文
             if ($is_from_sys) {
                 $content_list[0] = $content_data;
             } else {
                 //找到能取列表的数据源
                 $content_list_ds = common::get_datasource_by_sign(0, $page_type_detail['sign']);
                 $datasource_param = array();
                 if ($content_list_ds) {
                     $content_list_ds['argument'] = unserialize($content_list_ds['argument']);
                     $datasource_param = datasource_param($content_list_ds['argument']);
                 }
                 $plan['content_param']['site_id'] = $plan['site_id'];
                 $plan['content_param']['column_id'] = $plan['page_data_id'];
                 $plan['content_param']['count'] = $this->timecount;
                 $plan['content_param']['offset'] = $plan['offset'];
                 if ($content_list_ds) {
                     $content_list = common::get_content_by_datasource($content_list_ds['id'], $plan['content_param'] + $datasource_param);
                     //						print_r($content_list);
                 }
                 $new_plan = $plan;
                 unset($new_plan['id']);
                 $new_plan['offset'] = $offset;
                 $new_plan['count'] = $nextcount;
                 $new_plan['content_param'] = serialize($plan['content_param']);
                 if (empty($content_list)) {
                     $content_list = array(0 => array());
                     echo "没有可生成的内容";
                     exit;
                 } else {
                     if ($is_copy_plan) {
                         if (count($content_list) >= $this->settings['content_num_time']) {
                             $this->obj->insert('mkpublish_plan', $new_plan);
                         }
                     }
                 }
             }
             $index_cell = $this->content_cell($cell_ret, $mode_data, $content_list, $datasourceid, $page_type_detail);
             $tem_cell = $index_cell['tem_cell'];
             $tem_cell_file = $index_cell['tem_cell_file'];
             //				print_r($tem_cell);exit;
         }
     }
     //		$this->pagedir = '../cache/www/aaa/bbb/';
     foreach ($tem_cell as $kk => $vv) {
         $this->html = '';
         if ($this->mktype == 2) {
             //动态生成页面
             if (in_array($plan['content_type'], $this->content_type_true)) {
                 $this->include_conf($datasourceid, $site['site_dir'], $this->pagedir);
             } else {
                 $this->include_conf($datasourceid, $site['site_dir'], $tem_cell_file[$kk]['file_dir']);
             }
         } else {
             //静态生成页面
             $this->include_head($datasourceid, $site['site_dir']);
         }
         $parse_tem_cell_find = $parse_tem_cell_replace = array();
         if ($vv) {
             foreach ($vv as $k => $v) {
                 $parse_tem_cell_find[] = '/<span[\\s]+(?:id|class)="livcms_cell".+?>liv_' . $v['name'] . '<\\/span>/';
                 $parse_tem_cell_replace[] = $v['program'];
             }
             $new_template = preg_replace($parse_tem_cell_find, $parse_tem_cell_replace, $template);
         }
         $this->setHtml($new_template);
         //表示首页或者列表页
         if ($this->mktype == 2) {
             //动态生成页面
             if (in_array($plan['content_type'], $this->content_type_true)) {
                 file_in($this->pagedir, $this->filename . ".php", $this->html, true, true, $this->filename . ".html");
             } else {
                 file_in($tem_cell_file[$kk]['file_dir'], rtrim($tem_cell_file[$kk]['file_name'], '.html') . '.php', $this->html, true, true, rtrim($tem_cell_file[$kk]['file_name'], '.html') . '.html');
             }
         } else {
             //静态生成页面
             $cache_filename = md5(uniqid()) . '.php';
             file_put_contents(CUR_CONF_PATH . "cache/{$cache_filename}", $this->html);
             $result = $this->include_file(CUR_CONF_PATH . "cache/{$cache_filename}");
             chmod(CUR_CONF_PATH . "cache/{$cache_filename}", 0777);
             unlink(CUR_CONF_PATH . "cache/{$cache_filename}");
             if (in_array($plan['content_type'], $this->content_type_true)) {
                 if ($this->is_need_page) {
                     if ($this->plan['page_num']) {
                         $this->filename .= '_' . $this->plan['page_num'];
                     }
                 }
                 file_in($this->pagedir, $this->filename . ".html", $result, true, true, $this->filename . ".php");
             } else {
                 file_in($tem_cell_file[$kk]['file_dir'], $tem_cell_file[$kk]['file_name'], $result, true, true, rtrim($tem_cell_file[$kk]['file_name'], '.html') . '.php');
             }
         }
         echo "已生成" . $this->pagedir . $this->filename . ".html";
     }
 }
Esempio n. 10
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*/
     $fid = $this->input['fid'];
     include_once CUR_CONF_PATH . 'lib/common.php';
     if (empty($fid)) {
         if ($need_auth) {
             $auth_site_str = implode(',', array_unique($auth_site));
         }
         $sites = $this->pub_config->get_site(' id,site_name ', '', '', $auth_site_str);
         foreach ($sites as $k => $v) {
             $m = array('id' => 'site' . $v['id'] . $this->settings['separator'] . $v['site_name'], "name" => $v['site_name'], "fid" => 0, "depth" => 1);
             //获取页面类型
             $page_type = common::get_page_manage($v['id']);
             if (empty($page_type)) {
                 $m['is_last'] = 1;
             }
             $this->addItem($m);
         }
     } else {
         if (strstr($fid, "site") !== false) {
             //点击的站点
             $site_id = str_replace('site', '', $fid);
             $get_page = explode($this->settings['separator'], $site_id);
             $page_type = common::get_page_manage($get_page[0]);
             foreach ((array) $page_type as $k => $v) {
                 if ($need_auth) {
                     $v['is_auth'] = 0;
                     $v['is_auth'] = $need_auth ? 0 : 1;
                     //授权页面本身 显示
                     if (in_array($v['id'], $auth_page_self)) {
                         $v['is_auth'] = 1;
                     }
                     if (!$v['is_auth']) {
                         //授权栏目父级页面 显示
                         if (in_array($v['id'], array_diff($auth_page_parents, $auth_page_self))) {
                             $v['is_auth'] = 2;
                         }
                         //授权站点子集页面 显示
                         if (in_array($v['site_id'], $auth_site_self)) {
                             $v['is_auth'] = 3;
                         }
                     }
                 }
                 if ($v['is_auth'] || !$need_auth) {
                     $m = array('id' => 'page_id' . $v['site_id'] . $this->settings['separator'] . $v['id'] . $this->settings['separator'] . $v['title'], "name" => $v['title'], "fid" => 'page_id' . $v['id'] . $this->settings['separator'] . $v['title'], "depth" => 1);
                     $page_data = common::get_page_data($v['id'], 0, 1);
                     if (empty($page_data['page_data'])) {
                         $m['is_last'] = 1;
                     }
                     $this->addItem($m);
                 }
             }
         } else {
             if (($has_page_id = strstr($fid, "page_id")) !== false || ($has_page_data_id = strstr($fid, "page_data_id")) !== false) {
                 //点击的页面类型
                 $id = str_replace(array('page_id', 'page_data_id'), array('', ''), $fid);
                 $get_page = explode($this->settings['separator'], $id);
                 $page_data = common::get_page_data($get_page[1], 0, 1000, $get_page[2]);
                 //                print_r($page_data);exit;
                 if ($auth_column) {
                     //过滤部署与本页面的栏目ID
                     $auth_column = isset($auth_column[$get_page[1]]) ? $auth_column[$get_page[1]] : array();
                     $auth_column_str = implode(',', $auth_column);
                 }
                 foreach ((array) $page_data['page_data'] as $k => $v) {
                     if (in_array($v['id'], $auth_column)) {
                         $auth_column_parents[$v['id']] = explode(',', $v['parents']);
                     }
                 }
                 foreach ((array) $page_data['page_data'] as $k => $v) {
                     if ($need_auth) {
                         $v['is_auth'] = 0;
                         //授权节点自身
                         if (in_array($v['id'], $auth_column)) {
                             $v['is_auth'] = 1;
                         }
                         if (!$v['is_auth']) {
                             //父级节点  显示
                             foreach ((array) $auth_column_parents as $column_id => $column_parent) {
                                 if (in_array($v['id'], $column_parent)) {
                                     $v['is_auth'] = 2;
                                     break;
                                 }
                             }
                             //栏目孩子节点显示
                             //                            echo $v['parents']; print_R($auth_column);
                             if (array_intersect(explode(',', $v['parents']), $auth_column)) {
                                 $v['is_auth'] = 3;
                             }
                             //页面孩子节点显示
                             if (!$v['is_auth'] && in_array($get_page[1], $auth_page_self)) {
                                 $v['is_auth'] = 3;
                             }
                             //站点孩子节点 显示
                             if (!$v['is_auth'] && in_array($get_page[0], $auth_site_self)) {
                                 $v['is_auth'] = 3;
                             }
                         }
                     }
                     if ($v['is_auth'] || !$need_auth) {
                         $id_field = $page_data['page_info']['field'] ? $page_data['page_info']['field'] : 'id';
                         $name_field = $page_data['page_info']['name_field'] ? $page_data['page_info']['name_field'] : 'name';
                         $m_id = 'page_data_id' . $get_page[0] . $this->settings['separator'] . $get_page[1] . $this->settings['separator'] . $v[$id_field] . $this->settings['separator'] . $v[$name_field];
                         $m = array('id' => $m_id, "name" => $v[$name_field], "fid" => $m_id, "depth" => 1);
                         $m['is_last'] = $v[$page_data['page_info']['last_field']];
                         $this->addItem($m);
                     }
                 }
             }
         }
     }
     $this->output();
 }
Esempio n. 11
0
 public function get_page_manage()
 {
     $site_id = intval($this->input['site_id']);
     include_once CUR_CONF_PATH . 'lib/common.php';
     $page_type = common::get_page_manage($site_id);
     $this->addItem($page_type);
     $this->output();
 }
Esempio n. 12
0
 public function create()
 {
     $site_id = intval($this->input['site_id']);
     $page_id = intval($this->input['page_id']);
     $page_data_id = intval($this->input['page_data_id']);
     $content_type = $this->input['content_type'];
     $content_mk_num = intval($this->input['content_mk_num']);
     $page_data_idarr = $page_data_id ? explode(',', $page_data_id) : array();
     $is_contain_child = intval($this->input['is_contain_child']);
     //0不支持 1支持
     $this->set_content_mk_num($content_mk_num);
     $this->set_publish_user(trim($this->input['publish_user']));
     $this->set_publish_time($this->input['publish_time']);
     //内容参数
     $content_param = array();
     foreach ($this->input as $k => $v) {
         if (strpos($k, 'mkcontent_') !== 0) {
             continue;
         }
         $content_param[str_replace('mkcontent_', '', $k)] = $v;
     }
     if ($content_param) {
         $this->set_content_param(serialize($content_param));
     }
     if (!$content_type) {
         $this->errorOutput('请选择需要生成发布的内容类型');
     }
     if ($site_id && !$page_id) {
         if ($is_contain_child) {
             /**发布子级*/
             //查出站点下的页面类型
             $page_type = common::get_page_manage($site_id);
             if (is_array($page_type) && $page_type) {
                 $this->mk_plan_page_type($content_type, $page_type, $is_contain_child);
             }
         } else {
             /**不发布子级*/
             foreach ($content_type as $k => $v) {
                 $this->set_sqlarr($site_id, 0, 0, $v);
             }
         }
     }
     if ($page_id && !$page_data_idarr) {
         //判断站点有没有,如有,是不是站点包含子级生成发布过了
         if ($site_id && $is_contain_child) {
             break;
         }
         $page_type = common::get_page_by_id($page_id, true);
         if (is_array($page_type) && $page_type) {
             $this->mk_plan_page_type($content_type, $page_type, $is_contain_child);
         }
     }
     if ($page_data_idarr) {
         //判断站点有没有,如有,是不是站点包含子级生成发布过了
         if ($site_id && $is_contain_child) {
             break;
         }
         $page_type = common::get_page_by_id($page_id, true, 'id');
         if ($page_type && is_array($page_type)) {
             foreach ($page_data_idarr as $k => $v) {
                 //					$page_id;#!!!!!
                 $page_data_id = $v;
                 #!!!!!
                 foreach ($content_type as $kk => $vv) {
                     $this->set_sqlarr($page_type[$page_id]['site_id'], $page_id, $page_data_id, $vv);
                 }
                 if ($is_contain_child) {
                     $this->mk_plan_page_data($content_type, $page_type[$page_id], $page_data_id, $is_contain_child);
                 }
             }
         }
     }
     //入库
     if ($this->sqlarr) {
         $this->obj->insert_plan($this->sqlarr);
     }
 }