Example #1
0
 function get_content_type()
 {
     $site_id = intval($this->input['site_id']);
     $page_id = intval($this->input['page_id']);
     $page_data_id = intval($this->input['page_data_id']);
     $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_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 {
             $this->errorOutput('NO_PAGE_ID');
         }
     }
     $result['set_type'] = $set_type;
     $result['site_id'] = $site_id;
     $result['page_id'] = $page_id;
     $result['page_data_id'] = $page_data_id;
     $this->addItem($result);
     $this->output();
 }
Example #2
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();
 }
Example #3
0
 function update_tem()
 {
     /*if($this->user['group_type'] > MAX_ADMIN_TYPE)
     		{
     			$action = $this->user['prms']['app_prms'][APP_UNIQUEID]['nodes'];
     			if(!in_array('deploy_tem',$action))
     			{
     				$this->errorOutput("NO_PRIVILEGE");
     			}
     		}*/
     /*模板 权限验证预处理 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*/
     $data = json_decode(html_entity_decode($this->input['data']), true);
     if ($data['title'] && is_array($data['title'])) {
         include_once CUR_CONF_PATH . "lib/rebuild_deploy.class.php";
         $rebuild_deploy = new rebuilddeploy();
         $group_id = intval($this->input['group_id']);
         if (!$group_id) {
             $sql = "select group_id from " . DB_PREFIX . "deploy_template order by group_id DESC limit 1";
             $groupdetail = $this->db->query_first($sql);
             $group_id = intval($groupdetail['group_id']) + 1;
         } else {
             $sql = "delete from " . DB_PREFIX . "deploy_template where group_id={$group_id}";
             $this->db->query($sql);
         }
         foreach ($data['title'] as $k => $v) {
             $fid = $v['id'];
             $page_id = 0;
             $page_data_id = 0;
             if (strstr($fid, "site") !== false) {
                 $site_id = str_replace('site', '', $fid);
             } else {
                 if (strstr($fid, "page_id") !== false) {
                     $page_id = intval(str_replace('page_id', '', $fid));
                     $page_detail = common::get_page_by_id($page_id);
                     $site_id = $page_detail['site_id'];
                 } 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_id = $get_page[0];
                         $page_data_id = $get_page[1];
                         $page_detail = common::get_page_by_id($page_id);
                         $site_id = $page_detail['site_id'];
                     } else {
                         continue;
                     }
                 }
             }
             $sql = "delete from " . DB_PREFIX . "deploy_template where site_id={$site_id} and page_id={$page_id} and page_data_id={$page_data_id}";
             $this->db->query($sql);
             if ($data['page'] && is_array($data['page'])) {
                 foreach ($data['page'] as $kk => $vv) {
                     $this->update($site_id, $page_id, $page_data_id, $vv['content_type'], $vv['sign'], $v['title'], $v['full_title'], $group_id);
                 }
             }
             $rebuild_deploy->rebuild_deploy($site_id, $page_id, $page_data_id);
         }
     }
     $content_type = $this->pub_content->get_all_content_type();
     $ret['site'] = common::get_deploy_templates($site_id, 0, 0);
     if ($need_auth) {
         if (!in_array($site_id, $auth_site_self)) {
             $ret['no_auth_site'] = 1;
             //是否已经授权站点
         }
     }
     $page_info = array();
     $sql = "select * from " . DB_PREFIX . "deploy_template where site_id=" . $site_id . " and page_id!=0 order by group_id DESC,content_type,id";
     $info = $this->db->query($sql);
     while ($row = $this->db->fetch_array($info)) {
         if ($need_auth) {
             //只显示授权节点和授权节点孩子节点
             if ($row['site_id'] && !$row['page_id'] && !$row['page_data_id']) {
                 //授权节点本身 显示
                 if (!in_array($row['site_id'], $auth_site_self)) {
                     continue;
                 }
             }
             if ($row['site_id'] && $row['page_id'] && !$row['page_data_id']) {
                 //授权节点本身或者孩子节点 显示
                 if (!in_array($row['page_id'], $auth_page_self) && !in_array($row['site_id'], $auth_site_self)) {
                     continue;
                 }
             }
             if ($row['site_id'] && $row['page_id'] && $row['page_data_id']) {
                 $cur_page_auth_column = isset($auth_column[$row['page_id']]) ? $auth_column[$row['page_id']] : array();
                 //授权节点本身或者孩子节点 显示
                 if (!in_array($row['page_data_id'], $cur_page_auth_column) && !in_array($row['page_id'], $auth_page_self) && !in_array($row['site_id'], $auth_site_self)) {
                     $page_data = common::get_page_data($row['page_id'], 0, 1, 0, $page_info[$row['page_id']], $row['page_data_id']);
                     $page_info[$row['page_id']] = $page_data['page_info'];
                     //记录page信息 下次调用common::get_page_data方法时使用
                     foreach ((array) $page_data['page_data'] as $k => $v) {
                         $auth_column_parents[$v['id']] = $v['parents'];
                     }
                     //栏目孩子节点显示
                     if (!array_intersect(explode(',', $auth_column_parents[$row['page_data_id']]), $cur_page_auth_column)) {
                         continue;
                     }
                 }
             }
         }
         $use_content_type[$row['content_type']] = $row['content_type'];
         if ($row['site_id'] && !$row['page_id'] && !$row['page_data_id']) {
             continue;
             $page_title_id = 'site' . $row['site_id'];
         } else {
             if ($row['page_id'] && !$row['page_data_id']) {
                 $page_title_id = 'page_id' . $row['page_id'];
             } else {
                 $page_title_id = 'page_data_id' . $row['page_id'] . '_' . $row['page_data_id'];
             }
         }
         if (!isset($page_title_c[$row['group_id']][$row['site_id']][$row['page_id']][$row['page_data_id']])) {
             $page_title[$row['group_id']][] = array('id' => $page_title_id, 'title' => $row['title'], 'full_title' => $row['full_title']);
             $page_title_c[$row['group_id']][$row['site_id']][$row['page_id']][$row['page_data_id']] = $row['id'];
         }
         if ($row['content_type'] > 0) {
             $page[$row['group_id']][$row['content_type']] = array('content_type' => $content_type[$row['content_type']], 'dep' => $row);
         } else {
             $page[$row['group_id']][$row['content_type']] = array('content_type' => array('content_type' => !$row['content_type'] ? '首页' : '列表页'), 'dep' => $row);
         }
     }
     $ret['content_type'] = $content_type;
     $ret['page_title'] = $page_title;
     $ret['page'] = $page;
     $this->addItem($ret);
     $this->output();
 }
Example #4
0
 public function get_page_by_id()
 {
     $id = $this->input['id'];
     $in = $this->input['in'];
     $key = $this->input['key'];
     $result = common::get_page_by_id($id, $in, $key);
     $this->addItem($result);
     $this->output();
 }
Example #5
0
 public function update()
 {
     $defaulttype = array();
     $site_id = intval($this->input['site_id']);
     $page_id = intval($this->input['page_id']);
     $page_data_id = intval($this->input['page_data_id']);
     $page_data_fid = intval($this->input['page_data_fid']);
     $title = $this->input['title'];
     //获取站点支持的客户端
     $site_detail = $this->pub_config->get_site_client($site_id);
     $support_client = explode(',', $site_detail['site']['support_client']);
     $set_type = $this->settings['site_col_template'];
     if ($site_id && !$page_id) {
         //有内容,查出内容类型
         $content_type = $this->pub_content->get_all_content_type();
         foreach ($content_type as $k => $v) {
             $set_type[$v['id']] = $v['content_type'];
         }
     } else {
         if ($page_id) {
             //表示对页面类型进行部署 OR 表示对页面数据进行部署
             $page_info = common::get_page_by_id($page_id);
             $site_id = $page_info['site_id'];
             if ($page_info['has_content']) {
                 //有内容,查出内容类型
                 $content_type = $this->pub_content->get_all_content_type();
                 foreach ($content_type as $k => $v) {
                     $set_type[$v['id']] = $v['content_type'];
                 }
             }
         } else {
             $this->errorOutput('NO_PAGE_ID');
         }
     }
     $data = array('site_id' => $site_id, 'page_id' => $page_id, 'page_data_id' => $page_data_id, 'page_data_fid' => $page_data_fid, 'title' => $title);
     $dep_tem = $this->obj->get_deploy_template($site_id, $this->settings['tem_style_default'], $page_id, $page_data_id);
     foreach ($support_client as $kc => $vc) {
         foreach ($set_type as $k => $v) {
             //判断文本框里有没有值,没有值则代表没有选择模板,置模板id为0
             if (!urldecode($this->input['tem_' . $vc . '_' . $k])) {
                 if (!empty($dep_tem[$site_id][$page_id][$page_data_id][$vc][$k])) {
                     //删除
                     $dep_tem_id = $dep_tem[$site_id][$page_id][$page_data_id][$vc][$k]['id'];
                     $this->obj->delete('deploy_template', $dep_tem_id);
                 }
                 continue;
             } else {
                 $data['template_sign'] = $this->input['temid_' . $vc . '_' . $k];
                 $data['client_id'] = $vc;
             }
             $data['content_type'] = $k;
             //先查看有没有此记录,没有则插入,有则更新
             if (empty($dep_tem[$site_id][$page_id][$page_data_id][$vc][$k])) {
                 $this->obj->insert_col_tem($data);
             } else {
                 $update_data = array('template_sign' => $data['template_sign'], 'page_data_fid' => $data['page_data_fid'], 'title' => $title);
                 $dep_tem_id = $dep_tem[$site_id][$page_id][$page_data_id][$vc][$k]['id'];
                 $this->obj->update('deploy_template', $dep_tem_id, $update_data);
             }
         }
     }
     //重建缓存
     include_once CUR_CONF_PATH . "lib/rebuild_deploy.class.php";
     $rebuild_deploy = new rebuilddeploy();
     $rebuild_deploy->rebuild_deploy($site_id, $page_id, $page_data_id, $site_detail['site']);
     $this->addItem(1);
     $this->output();
 }
Example #6
0
 public function open_url()
 {
     $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 = intval($this->input['content_type']);
     $site = $this->pub_config->get_site_first('*', $site_id);
     $sub_weburl = $site['sub_weburl'];
     $web_url = $site['weburl'];
     $web_dir = '';
     $indexname = $site['indexname'] . ($site['produce_format'] == 1 ? '.html' : '.php');
     if ($page_id) {
         $page_data = common::get_page_by_id($page_id);
         if ($page_data['next_domain'] || $page_data['domain']) {
             $sub_weburl = $page_data['next_domain'];
             $web_url = $page_data['domain'];
             $web_dir = '';
         } else {
             $web_dir .= $page_data['sign'];
         }
     }
     if ($page_data_id) {
         $page_datas = common::get_page_data($page_id, '', '', 0, $page_data, $page_data_id);
         $page_data_detail = $page_datas['page_data'][0];
         if ($page_data_detail['father_domain']) {
             $sub_weburl = $page_data_detail['father_domain'];
         }
         $web_dir .= $page_data_detail['relate_dir'];
         $indexname = $page_data_detail['colindex'] . $page_data_detail['suffix'];
     }
     $url = $sub_weburl;
     if ($web_url) {
         $url .= rtrim($web_url, '/');
     }
     if ($web_dir) {
         $url .= '/' . rtrim($web_dir, '/');
     }
     $url .= '/' . $indexname;
     echo $url;
     exit;
     $result['url'] = $url;
     $this->addItem($result);
     $this->output();
 }
Example #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);
             }
         }
     }
 }
Example #8
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);
     }
 }