Exemplo n.º 1
0
 public function update_domain($data)
 {
     $sql = "SELECT id FROM " . DB_PREFIX . "domain WHERE type=" . $data['type'] . " AND from_id=" . $data['from_id'];
     $info = $this->db->query_first($sql);
     if (empty($info)) {
         common::insert_domain($data);
     } else {
         if ($data['path']) {
             hg_mkdir($data['path']);
         }
         $update_data = array('sub_domain' => $data['sub_domain'], 'domain' => $data['domain'], 'path' => $data['path'] ? realpath($data['path']) : '');
         $sql = "UPDATE " . DB_PREFIX . "domain SET";
         $sql_extra = $space = ' ';
         foreach ($update_data as $k => $v) {
             $sql_extra .= $space . $k . "='" . $v . "'";
             $space = ',';
         }
         $sql .= $sql_extra . " WHERE type=" . $data['type'] . " AND from_id=" . $data['from_id'];
         $this->db->query($sql);
     }
 }
Exemplo n.º 2
0
 public function operate_syn()
 {
     /*         * 权限判断 
             if ($this->user['group_type'] > MAX_ADMIN_TYPE)
             {
                 if (empty($this->user['prms']['app_prms'][APP_UNIQUEID]['setting']))
                 {
                     $this->errorOutput(NO_PRIVILEGE);
                 }
             }
     		*/
     $fast_add_column = urldecode($this->input['fast_add_column']);
     //表示ajax快速增加栏目请求过来
     $column_id = intval($this->input['column_id']);
     $column_fid = intval($this->input['column_fid']);
     $site_id = intval($this->input['site_id']);
     $data = array('site_id' => $site_id, 'shortname' => trim(urldecode($this->input['shortname'])), 'childdomain' => trim(urldecode($this->input['childdomain'])), 'is_outlink' => intval($this->input['is_outlink']), 'linkurl' => urldecode($this->input['linkurl']), 'keywords' => trim(urldecode($this->input['keywords'])), 'content' => trim(urldecode($this->input['content'])), 'colindex' => empty($this->input['colindex']) ? $this->settings['defalult_column_index_name'] : trim(urldecode($this->input['colindex'])), 'maketype' => $this->input['maketype'] ? intval($this->input['maketype']) : 1, 'col_con_maketype' => $this->input['col_con_maketype'] ? intval($this->input['col_con_maketype']) : 1, 'suffix' => urldecode($this->input['suffix']), 'column_dir' => trim(urldecode($this->input['column_dir'])), 'contentfilename' => trim(urldecode($this->input['contentfilename'])), 'folderformat' => $this->input['folderformat'] ? $this->input['folderformat'] : 'Y-m-d', 'titleformat' => urldecode($this->input['titleformat']), 'custom_content_dir' => trim($this->input['custom_content_dir']), 'column_file' => $this->input['column_file'] ? trim($this->input['column_file']) : 'index');
     if ($this->input['client_top_pic']) {
         foreach ($this->input['client_top_pic'] as $k => $v) {
             $client_pic[$k] = unserialize(html_entity_decode($v));
         }
         $data['client_pic'] = serialize($client_pic);
     } else {
         $data['client_pic'] = '';
     }
     if ($_FILES['Filedata']) {
         $file['Filedata'] = $_FILES['Filedata'];
         $pic_info = $this->material->addMaterial($file);
         //插入示意图
         if ($pic_info) {
             $arr = array('host' => $pic_info['host'], 'dir' => $pic_info['dir'], 'filepath' => $pic_info['filepath'], 'filename' => $pic_info['filename']);
             $data['pic'] = serialize($arr);
         }
     }
     if (intval($this->input['fileformatradio']) == 1) {
         $data['fileformat'] = '1-' . trim($this->input['fileformattext']);
     } else {
         $data['fileformat'] = $this->input['fileformat'] ? intval($this->input['fileformat']) : '1-';
     }
     $column_name = trim($this->input['column_name']);
     if (empty($column_name)) {
         $this->errorOutput("填写信息不全");
     }
     if ($column_id) {
         //查出这个栏目更新前的状态
         $old_coldetail = $this->obj->get_column_first(' * ', $column_id);
     }
     //先查询这个站点跟目录是否被应用
     if ($data['childdomain']) {
         $domain_data = array('type' => $this->settings['domain_type']['column'], 'from_id' => $column_id, 'sub_domain' => $data['childdomain'], 'domain' => $this->input['childdomain_suffix'], 'path' => $data['column_dir']);
         if (!common::check_domain($domain_data)) {
             $this->errorOutput("域名子域名已存在,请重新输入!");
         }
     } else {
         if ($old_coldetail['childdomain']) {
             //删除这个栏目域名
             common::delete_domain($this->settings['domain_type']['column'], $column_id);
         }
     }
     //获取栏目支持的客户端,如果为空,则取上级支持的客户端
     $data['support_client'] = $this->obj->get_column_support_client($data['support_client'], $site_id, $column_fid);
     if (!$data['support_client']) {
         $this->errorOutput("未取得客户端");
     }
     //取站点信息
     $site_detail = $this->obj->get_site_by_id($site_id);
     if ($column_id) {
         $id = $column_id;
         $dele_ids = '';
         unset($data['site_id']);
         $data['name'] = $column_name;
         if (!$this->obj->update_column($column_id, $data)) {
             $this->errorOutput("更新失败");
         }
         //查看栏目详细信息,看fid是否有改变,如果有改变,则调用节点方法更改
         $coldetail = $this->obj->get_column_first(' parents,fid ', $column_id);
         if ($coldetail['fid'] != $column_fid) {
             $this->col_node->update_node($column_id, $column_fid);
         }
         //计算出栏目的目录
         if ($column_fid) {
             $oth_coldetail = $this->obj->get_column_first(' column_dir,column_url,relate_dir ', $column_fid);
         }
         $column_self_dir = $data['column_dir'] ? $data['column_dir'] : $this->settings['defalult_column_dir'] . $column_id;
         $col_dir = (empty($oth_coldetail['column_dir']) ? '' : $oth_coldetail['column_dir']) . '/' . $column_self_dir;
         $this->obj->update_column($column_id, array('column_dir' => $col_dir));
         $now = $this->obj->get_column_first(' * ', $column_id);
         $this->change_dir($old_coldetail, $now, $column_id, $column_self_dir);
         //更新服务器生成页面栏目目录
         if ($old_coldetail['column_dir'] != $col_dir) {
             include ROOT_PATH . 'lib/class/mkpublish.class.php';
             $this->mkpublish = new mkpublish();
             $this->mkpublish->rename_folder(rtrim($site_detail['site_dir'], '/') . $old_coldetail['column_dir'], rtrim($site_detail['site_dir'], '/') . $col_dir);
         }
         //更新domain
         if ($data['childdomain']) {
             $domain_data['path'] = $col_dir;
             common::update_domain($domain_data);
         }
         if ($old_coldetail['childs']) {
             $childs_data = $this->obj->get_column_by_id(' * ', $old_coldetail['childs'], 'id');
             foreach (explode(',', $old_coldetail['childs']) as $cms_column_id) {
                 if ($cms_column_id) {
                     //栏目插入到cms并保存cms栏目id
                     $cms_column_data = array('column_id' => $cms_column_id, 'name' => $childs_data[$cms_column_id]['name'], 'brief' => $childs_data[$cms_column_id]['content'], 'cms_fid' => $childs_data[$cms_column_id]['fid'], 'cms_siteid' => $childs_data[$cms_column_id]['site_id'], 'column_dir' => $childs_data[$cms_column_id]['column_dir'], 'relate_dir' => $childs_data[$cms_column_id]['relate_dir'], 'linkurl' => $childs_data[$cms_column_id]['linkurl'], 'childdomain' => $childs_data[$cms_column_id]['childdomain'], 'colindex' => $childs_data[$cms_column_id]['colindex']);
                     $this->pub_cms->update_cms_column($cms_column_data);
                 }
             }
         }
         $new_coldetail = $this->obj->get_column_first(' * ', $column_id);
         $this->addLogs('更新栏目', $old_coldetail, $new_coldetail, $column_name);
     } else {
         if ($column_fid) {
             $oth_coldetail = $this->obj->get_column_first(' column_dir,column_url,relate_dir,father_domain ', $column_fid);
         }
         //先插入节点
         $data['content_update_time'] = TIMENOW;
         $id = $this->col_node->insert_node($column_name, $column_fid, $data);
         //更新order_id 排序id
         $this->obj->update_column($id, array('order_id' => $id, 'father_domain' => $oth_coldetail['father_domain']));
         //计算出栏目的目录
         $column_self_dir = $data['column_dir'] ? $data['column_dir'] : $this->settings['defalult_column_dir'] . $id;
         $col_dir = (empty($oth_coldetail['column_dir']) ? '' : $oth_coldetail['column_dir']) . '/' . $column_self_dir;
         //插入子域名
         if ($data['childdomain']) {
             $domain_data['path'] = $col_dir;
             common::insert_domain($domain_data + array('from_id' => $id));
         }
         //计算出栏目的相对路径
         if ($data['childdomain']) {
             $relate_dir = '';
         } else {
             $relate_dir = (empty($oth_coldetail['relate_dir']) ? '' : $oth_coldetail['relate_dir']) . '/' . $column_self_dir;
         }
         $this->obj->update_column($id, array('column_dir' => $col_dir, 'relate_dir' => $relate_dir));
         //栏目插入到cms并保存cms栏目id
         $cms_column_data = array('cms_columnid' => $id, 'name' => $column_name, 'brief' => $data['content'], 'cms_fid' => $column_fid, 'cms_siteid' => $site_id, 'column_dir' => $col_dir, 'linkurl' => $data['linkurl'], 'orderid' => $id, 'relate_dir' => $relate_dir, 'childdomain' => $data['childdomain'], 'colindex' => $data['colindex']);
         $cms_column_id = $this->pub_cms->insert_cms_column($cms_column_data);
         $new_coldetail = $this->obj->get_column_first(' * ', $id);
         $this->addLogs('新增栏目', '', $new_coldetail, $column_name);
         //插入图片
         //$this->insert_pic($id, $data['support_client']);
     }
     $data['site_id'] = $data['site_id'];
     $data['column_id'] = $column_id;
     $data['column_fid'] = $column_fid;
     $data['id'] = $id;
     $data['column_name'] = $column_name;
     //获取栏目支持的模块 from table app
     //		$data['module'] = common::get_module();
     if ($this->settings['is_syn_clouds']) {
         if (!$column_id) {
             if ($column_fid) {
                 $father_column = $this->obj->get_column_first(' syn_id ', $column_fid);
                 $syn_data['column_fid'] = $father_column['syn_id'];
             }
             $syn_data['column_name'] = $column_name;
             $syn_data['site_id'] = $site_detail['syn_id'];
         } else {
             $sql = "select c.name,c.syn_id,cc.syn_id as f_syn_id from " . DB_PREFIX . "column c left join " . DB_PREFIX . "column cc on c.fid=cc.id where c.id=" . $column_id;
             $newcolumn = $this->db->query_first($sql);
             $syn_data = $newcolumn;
             $syn_data['column_id'] = $newcolumn['syn_id'];
             $syn_data['column_fid'] = intval($newcolumn['f_syn_id']);
             $syn_data['column_name'] = $newcolumn['name'];
             $syn_data['site_id'] = $site_detail['syn_id'];
         }
         $this->syn_column($syn_data, $id);
     }
     if ($fast_add_column) {
         $this->addItem($id);
         $this->output();
     }
     $this->addItem($data);
     $this->output();
 }
Exemplo n.º 3
0
 public function operate()
 {
     /*         * 权限判断 */
     if ($this->user['group_type'] > MAX_ADMIN_TYPE) {
         if (empty($this->user['prms']['app_prms'][APP_UNIQUEID]['setting'])) {
             $this->errorOutput(NO_PRIVILEGE);
         }
     }
     $site_id = intval($this->input['site_id']);
     $data = array('support_client' => $this->input['client'], 'site_name' => $this->input['site_name'], 'site_keywords' => str_replace(' ', ',', trim($this->input['keywords'])), 'content' => urldecode($this->input['content']), 'sub_weburl' => trim(urldecode($this->input['sub_weburl']), '/'), 'sub_wdir' => urldecode($this->input['sub_wdir']), 'weburl' => trim(urldecode($this->input['weburl']), '/'), 'site_dir' => urldecode(trim($this->input['site_dir'])), 'produce_format' => urldecode($this->input['produce_format']), 'indexname' => urldecode($this->input['indexname']), 'suffix' => urldecode($this->input['suffix']), 'tem_material_url' => urldecode($this->input['tem_material_url']), 'tem_material_dir' => urldecode($this->input['tem_material_dir']), 'program_dir' => $this->input['program_dir'] ? $this->input['program_dir'] : 'm2o', 'program_url' => urldecode($this->input['program_url']), 'jsphpdir' => urldecode($this->input['jsphpdir']), 'jsphpurl' => urldecode($this->input['jsphpurl']), 'support_module' => empty($this->input['support_module']) ? '' : implode(',', $this->input['support_module']), 'support_content_type' => empty($this->input['support_content_type']) ? '' : implode(',', $this->input['support_content_type']), 'is_video_record' => intval($this->input['is_video_record']), 'user_email' => $this->input['user_email'], 'custom_content_dir' => $this->input['custom_content_dir'] ? trim($this->input['custom_content_dir'], '/') . '/' : '', 'custom_content_url' => trim($this->input['custom_content_url']));
     if (empty($data['site_name'])) {
         $this->errorOutput("填写信息不全,请检测站点名称,站点域名,站点子域名是否填写");
     }
     if ($site_id) {
         $old_site_detail = $this->obj->get_site_by_id($site_id);
     }
     //先查询这个站点跟目录是否被应用
     if ($data['domain']) {
         $domain_data = array('type' => $this->settings['domain_type']['site'], 'from_id' => $site_id, 'sub_domain' => $data['sub_weburl'], 'domain' => $data['weburl'], 'path' => $data['site_dir']);
         if (!common::check_domain($domain_data)) {
             $this->errorOutput("域名子域名已存在,请重新输入!");
         }
     } else {
         if ($old_site_detail['domain']) {
             //删除这个栏目域名
             common::delete_domain($this->settings['domain_type']['site'], $site_id);
         }
     }
     if (empty($data['support_client'])) {
         $allclient = $this->obj->get_client();
         foreach ($allclient as $k => $v) {
             $client_ids .= $v['id'] . ',';
         }
         $client_ids = trim($client_ids, ',');
         $data['support_client'] = $client_ids;
     } else {
         $data['support_client'] = implode(',', $data['support_client']);
     }
     //站点百度视频收录处理
     if ($data['is_video_record']) {
         $data['is_video_record'] = 1;
         $data['video_record_count'] = empty($this->input['video_record_count']) ? 500 : intval($this->input['video_record_count']);
         //建立视频收录目录
         //			if($data['video_record_url'])
         //			{
         //				hg_mkdir($data['video_record_url']);
         //			}
         $data['video_record_url'] = $this->input['video_record_url'];
         $data['video_update_peri'] = intval($this->input['video_update_peri']);
         $data['video_record_filename'] = $this->input['video_record_filename'];
     }
     if ($site_id) {
         //更新
         if (!($site = $this->obj->update_site($site_id, $data))) {
             $this->errorOutput("更新失败!");
         }
         //更新domain
         if ($data['domain']) {
             common::update_domain($domain_data);
         }
         //查询出站点详细信息
         //$site_detail = $this->obj->get_site_by_id($site_id);
         //站点插入到cms并保存cms站点id
         $cms_site_data = array('cms_siteid' => $site_id, 'site_name' => $data['site_name'], 'content' => $data['content'], 'sitedir' => $data['site_dir'], 'weburl' => 'http://' . ($data['sub_weburl'] ? $data['sub_weburl'] . '.' : '') . rtrim($data['weburl'], '/') . '/', 'site_keywords' => $data['site_keywords'], 'produce_format' => $data['produce_format'], 'indexname' => $data['indexname'], 'suffix' => $data['suffix'], 'material_fmt' => $data['material_fmt'], 'material_url' => $data['material_url'], 'tem_material_url' => $data['tem_material_url'], 'tem_material_dir' => $data['tem_material_dir'], 'program_dir' => $data['program_dir'], 'program_url' => $data['program_url'], 'jsphpdir' => $data['jsphpdir']);
         $cms_site_id = $this->pub_cms->update_cms_site($cms_site_data);
         $allclient = $this->obj->get_client();
         //获取所有模块
         //$data['module'] = common::get_module();
         //获取站点可以支持的内容类型
         //$data['content_type'] = $this->pub_content->get_content_type_by_colid($site_id,'','1');
         $data['site'] = $site;
         $data['client'] = $allclient;
         $this->addLogs('更新站点', $old_site_detail, $data, $old_site_detail['site_name']);
     } else {
         $data['create_time'] = TIMENOW;
         $data['user_id'] = $this->user['user_id'];
         $data['user_name'] = $this->user['user_name'];
         //插入
         if ($site_id = $this->obj->insert_site($data)) {
             common::insert_domain($data + array('type' => $this->settings['domain_type']['site'], 'from_id' => $site_id, 'path' => $data['site_dir']));
             //站点插入到cms并保存cms站点id
             $cms_site_data = array('site_id' => $site_id, 'site_name' => $data['site_name'], 'content' => $data['content'], 'sitedir' => $data['site_dir'], 'weburl' => 'http://' . ($data['sub_weburl'] ? $data['sub_weburl'] . '.' : '') . rtrim($data['weburl'], '/') . '/', 'site_keywords' => $data['site_keywords'], 'material_fmt' => $data['material_fmt'], 'material_url' => $data['material_url'], 'tem_material_url' => $data['tem_material_url'], 'program_dir' => $data['program_dir'], 'program_url' => $data['program_url'], 'jsphpdir' => $data['jsphpdir']);
             $cms_site_id = $this->pub_cms->insert_cms_site($cms_site_data);
             //$this->obj->update_site($site_id,array('cms_site_id'=>$cms_site_id));
             $this->addLogs('新增站点', '', $data, $data['name']);
         } else {
             $this->errorOutput("添加失败!");
         }
         $allclient = $this->obj->get_client();
         $data['client'] = $allclient;
         $data['site_id'] = $site_id;
     }
     if ($this->settings['is_syn_clouds']) {
         if (!$this->input['site_id']) {
             $syn_data['site_name'] = $data['site_name'];
         } else {
             $syn_data = $this->obj->get_site_by_id($site_id, ' id,syn_id,site_name ');
             $syn_data = $syn_data + $data;
             $syn_data['id'] = $syn_data['syn_id'];
             $syn_data['site_id'] = $syn_data['syn_id'];
         }
         $this->syn_site($syn_data, $site_id);
     }
     $data['id'] = $site_id;
     $data['site_id'] = $site_id;
     $this->addItem($data);
     $this->output();
 }
Exemplo n.º 4
0
 public function create_update()
 {
     $site_id = intval($this->input['site_id']);
     $data = array('site_name' => urldecode($this->input['site_name']), 'site_keywords' => urldecode($this->input['site_keywords']), 'content' => urldecode($this->input['content']), 'weburl' => urldecode($this->input['weburl']), 'site_dir' => urldecode($this->input['site_dir']), 'produce_format' => urldecode($this->input['produce_format']), 'indexname' => urldecode($this->input['indexname']), 'suffix' => urldecode($this->input['suffix']), 'material_fmt' => urldecode($this->input['material_fmt']), 'material_url' => urldecode($this->input['material_url']), 'tem_material_url' => urldecode($this->input['tem_material_url']), 'tem_material_dir' => urldecode($this->input['tem_material_dir']), 'program_dir' => urldecode($this->input['program_dir']), 'jsphpdir' => urldecode($this->input['jsphpdir']), 'imagewidth' => intval($this->input['imagewidth']), 'imageheight' => intval($this->input['imageheight']), 'pro_page_num' => intval($this->input['pro_page_num']));
     if (empty($data['site_name']) || empty($data['weburl'])) {
         $this->errorOutput("填写信息不全");
     }
     if ($site_id) {
         //先查询这个站点跟目录是否被应用
         if (!common::check_domain($data['weburl'], $data['site_dir'], $this->settings['domain_type']['site'], $site_id)) {
             $this->errorOutput("域名或对应目录存在,请重新输入!");
         }
         //更新
         if (!($site = $this->obj->update_site($site_id, $data))) {
             $this->errorOutput("更新失败!");
         }
         $this->addItem($site);
         $this->output();
     } else {
         //先查询这个站点跟目录是否被应用
         if (!common::check_domain($data['weburl'], $data['site_dir'])) {
             $this->errorOutput("域名或对应目录存在,请重新输入!");
         }
         //插入
         if ($site_id = $this->obj->insert_site($data)) {
             common::insert_domain($data['weburl'], $data['site_dir'], $this->settings['domain_type']['site'], $site_id);
         } else {
             $this->errorOutput("添加失败!");
         }
     }
 }
Exemplo n.º 5
0
 public function operate()
 {
     if ($this->mNeedCheckIn && !$this->prms['create_update']) {
         $this->errorOutput(NO_OPRATION_PRIVILEGE);
     }
     $site_id = intval($this->input['site_id']);
     $data = array('support_client' => $this->input['client'], 'site_name' => $this->input['site_name'], 'site_keywords' => urldecode($this->input['site_keywords']), 'content' => urldecode($this->input['content']), 'sub_weburl' => trim(urldecode($this->input['sub_weburl']), '/'), 'weburl' => trim(urldecode($this->input['weburl']), '/'), 'site_dir' => urldecode($this->input['site_dir']), 'produce_format' => urldecode($this->input['produce_format']), 'indexname' => urldecode($this->input['indexname']), 'suffix' => urldecode($this->input['suffix']), 'tem_material_url' => urldecode($this->input['tem_material_url']), 'tem_material_dir' => urldecode($this->input['tem_material_dir']), 'program_dir' => urldecode($this->input['program_dir']), 'program_url' => urldecode($this->input['program_url']), 'jsphpdir' => urldecode($this->input['jsphpdir']), 'support_module' => empty($this->input['support_module']) ? '' : implode(',', $this->input['support_module']), 'support_content_type' => empty($this->input['support_content_type']) ? '' : implode(',', $this->input['support_content_type']), 'is_video_record' => intval($this->input['is_video_record']), 'user_email' => $this->input['user_email']);
     if (empty($data['site_name']) || empty($data['weburl']) || empty($data['sub_weburl'])) {
         $this->errorOutput("填写信息不全,请检测站点名称,站点域名,站点子域名是否填写");
     }
     //先查询这个站点跟目录是否被应用
     $domain_data = array('type' => $this->settings['domain_type']['site'], 'from_id' => $site_id, 'sub_domain' => $data['sub_weburl'], 'domain' => $data['weburl'], 'path' => $data['site_dir']);
     if (!common::check_domain($domain_data)) {
         $this->errorOutput("域名子域名已存在,请重新输入!");
     }
     if (empty($data['support_client'])) {
         $allclient = $this->obj->get_client();
         foreach ($allclient as $k => $v) {
             $client_ids .= $v['id'] . ',';
         }
         $client_ids = trim($client_ids, ',');
         $data['support_client'] = $client_ids;
     } else {
         $data['support_client'] = implode(',', $data['support_client']);
     }
     //站点百度视频收录处理
     if ($data['is_video_record']) {
         $data['is_video_record'] = 1;
         $data['video_record_count'] = empty($this->input['video_record_count']) ? 500 : intval($this->input['video_record_count']);
         //建立视频收录目录
         //			if($data['video_record_url'])
         //			{
         //				hg_mkdir($data['video_record_url']);
         //			}
         $data['video_record_url'] = $this->input['video_record_url'];
         $data['video_update_peri'] = intval($this->input['video_update_peri']);
         $data['video_record_filename'] = $this->input['video_record_filename'];
     }
     if ($site_id) {
         //更新
         if (!($site = $this->obj->update_site($site_id, $data))) {
             $this->errorOutput("更新失败!");
         }
         //更新domain
         common::update_domain($domain_data);
         //查询出站点详细信息
         //$site_detail = $this->obj->get_site_by_id($site_id);
         //站点插入到cms并保存cms站点id
         $cms_site_data = array('cms_siteid' => $site_id, 'site_name' => $data['site_name'], 'content' => $data['content'], 'sitedir' => $data['site_dir'], 'weburl' => 'http://' . ($data['sub_weburl'] ? $data['sub_weburl'] . '.' : '') . rtrim($data['weburl'], '/') . '/', 'site_keywords' => $data['site_keywords'], 'produce_format' => $data['produce_format'], 'indexname' => $data['indexname'], 'suffix' => $data['suffix'], 'material_fmt' => $data['material_fmt'], 'material_url' => $data['material_url'], 'tem_material_url' => $data['tem_material_url'], 'tem_material_dir' => $data['tem_material_dir'], 'program_dir' => $data['program_dir'], 'program_url' => $data['program_url'], 'jsphpdir' => $data['jsphpdir']);
         $cms_site_id = $this->pub_cms->update_cms_site($cms_site_data);
         $allclient = $this->obj->get_client();
         //获取所有模块
         //$data['module'] = common::get_module();
         //获取站点可以支持的内容类型
         //$data['content_type'] = $this->pub_content->get_content_type_by_colid($site_id,'','1');
         $data['site'] = $site;
         $data['client'] = $allclient;
         $this->addItem($data);
         $this->output();
     } else {
         $data['create_time'] = TIMENOW;
         //插入
         if ($site_id = $this->obj->insert_site($data)) {
             common::insert_domain($data + array('type' => $this->settings['domain_type']['site'], 'from_id' => $site_id, 'path' => $data['site_dir']));
             //站点插入到cms并保存cms站点id
             $cms_site_data = array('site_id' => $site_id, 'site_name' => $data['site_name'], 'content' => $data['content'], 'sitedir' => $data['site_dir'], 'weburl' => 'http://' . ($data['sub_weburl'] ? $data['sub_weburl'] . '.' : '') . rtrim($data['weburl'], '/') . '/', 'site_keywords' => $data['site_keywords'], 'material_fmt' => $data['material_fmt'], 'material_url' => $data['material_url'], 'tem_material_url' => $data['tem_material_url'], 'program_dir' => $data['program_dir'], 'program_url' => $data['program_url'], 'jsphpdir' => $data['jsphpdir']);
             $cms_site_id = $this->pub_cms->insert_cms_site($cms_site_data);
             //$this->obj->update_site($site_id,array('cms_site_id'=>$cms_site_id));
         } else {
             $this->errorOutput("添加失败!");
         }
         $allclient = $this->obj->get_client();
         $data['client'] = $allclient;
         $this->addItem($data);
         $this->output();
     }
 }
Exemplo n.º 6
0
 public function operate()
 {
     if ($this->mNeedCheckIn && !$this->prms['create']) {
         $this->errorOutput(NO_OPRATION_PRIVILEGE);
     }
     $fast_add_column = urldecode($this->input['fast_add_column']);
     //表示ajax快速增加栏目请求过来
     $column_id = intval($this->input['column_id']);
     $column_fid = intval($this->input['column_fid']);
     $site_id = intval($this->input['site_id']);
     $data = array('site_id' => $site_id, 'shortname' => urldecode($this->input['shortname']), 'childdomain' => urldecode($this->input['childdomain']), 'is_outlink' => intval($this->input['is_outlink']), 'linkurl' => urldecode($this->input['linkurl']), 'keywords' => urldecode($this->input['keywords']), 'content' => trim(urldecode($this->input['content'])), 'colindex' => empty($this->input['colindex']) ? $this->settings['defalult_column_index_name'] : trim(urldecode($this->input['colindex'])), 'maketype' => urldecode($this->input['maketype']), 'col_con_maketype' => urldecode($this->input['col_con_maketype']), 'suffix' => urldecode($this->input['suffix']), 'column_dir' => trim(urldecode($this->input['column_dir'])), 'contentfilename' => trim(urldecode($this->input['contentfilename'])), 'folderformat' => urldecode($this->input['folderformat']), 'titleformat' => urldecode($this->input['titleformat']), 'needartstat' => urldecode($this->input['needartstat']), 'needcolstat' => urldecode($this->input['needcolstat']), 'needartadv' => urldecode($this->input['needartadv']), 'article_maketype' => urldecode($this->input['article_maketype']), 'support_module' => empty($this->input['support_module']) ? '' : implode(',', $this->input['support_module']), 'support_content_type' => empty($this->input['support_content_type']) ? '' : implode(',', $this->input['support_content_type']), 'support_client' => empty($this->input['support_client']) ? '' : implode(',', $this->input['support_client']));
     if (intval($this->input['fileformatradio']) == 1) {
         $data['fileformat'] = '1-' . trim($this->input['fileformattext']);
     } else {
         $data['fileformat'] = intval($this->input['fileformat']);
     }
     $column_name = $this->input['column_name'];
     if (empty($column_name)) {
         $this->errorOutput("填写信息不全");
     }
     if ($column_id) {
         //查出这个栏目更新前的状态
         $old_coldetail = $this->obj->get_column_first(' * ', $column_id);
     }
     //先查询这个站点跟目录是否被应用
     if ($data['childdomain']) {
         $domain_data = array('type' => $this->settings['domain_type']['column'], 'from_id' => $column_id, 'sub_domain' => $data['childdomain'], 'domain' => $this->input['childdomain_suffix'], 'path' => $data['column_dir']);
         if (!common::check_domain($domain_data)) {
             $this->errorOutput("域名子域名已存在,请重新输入!");
         }
     } else {
         if ($old_coldetail['childdomain']) {
             //删除这个栏目域名
             common::delete_domain($this->settings['domain_type']['column'], $column_id);
         }
     }
     //获取栏目支持的客户端,如果为空,则取上级支持的客户端
     $data['support_client'] = $this->obj->get_column_support_client($data['support_client'], $site_id, $column_fid);
     if (!$data['support_client']) {
         $this->errorOutput("未取得客户端");
     }
     //取站点信息
     $site_detail = $this->obj->get_site_by_id($site_id);
     if ($column_id) {
         $dele_ids = '';
         unset($data['site_id']);
         $data['name'] = $column_name;
         if (!$this->obj->update_column($column_id, $data)) {
             $this->errorOutput("更新失败");
         }
         //查看栏目详细信息,看fid是否有改变,如果有改变,则调用节点方法更改
         $coldetail = $this->obj->get_column_first(' parents,fid ', $column_id);
         if ($coldetail['fid'] != $column_fid) {
             $this->col_node->update_node($column_id, $column_fid);
         }
         //计算出栏目的目录
         if ($column_fid) {
             $oth_coldetail = $this->obj->get_column_first(' column_dir,column_url,relate_dir ', $column_fid);
         }
         $column_self_dir = $data['column_dir'] ? $data['column_dir'] : $this->settings['defalult_column_dir'] . $column_id;
         $col_dir = (empty($oth_coldetail['column_dir']) ? '' : $oth_coldetail['column_dir']) . '/' . $column_self_dir;
         $this->obj->update_column($column_id, array('column_dir' => $col_dir));
         $now = $this->obj->get_column_first(' * ', $column_id);
         $this->change_dir($old_coldetail, $now, $column_id, $column_self_dir);
         //更新domain
         if ($data['childdomain']) {
             $domain_data['path'] = $col_dir;
             common::update_domain($domain_data);
         }
         if ($old_coldetail['childs']) {
             $childs_data = $this->obj->get_column_by_id(' * ', $old_coldetail['childs'], 'id');
             foreach (explode(',', $old_coldetail['childs']) as $cms_column_id) {
                 if ($cms_column_id) {
                     //栏目插入到cms并保存cms栏目id
                     $cms_column_data = array('column_id' => $cms_column_id, 'name' => $childs_data[$cms_column_id]['name'], 'brief' => $childs_data[$cms_column_id]['content'], 'cms_fid' => $childs_data[$cms_column_id]['fid'], 'cms_siteid' => $childs_data[$cms_column_id]['site_id'], 'column_dir' => $childs_data[$cms_column_id]['column_dir'], 'relate_dir' => $childs_data[$cms_column_id]['relate_dir'], 'linkurl' => $childs_data[$cms_column_id]['linkurl'], 'childdomain' => $childs_data[$cms_column_id]['childdomain'], 'colindex' => $childs_data[$cms_column_id]['colindex']);
                     $this->pub_cms->update_cms_column($cms_column_data);
                 }
             }
         }
         //删除部署里栏目未支持的内容类型,同时处理对应支持模块来删除对应的支持内容类型
         //			$new_con_type = $this->pub_content->get_content_type_by_colid($column_id,1);
         //			foreach($new_con_type as $k=>$v)
         //			{
         //				$new_con_typestr .= $v['id'].',';
         //			}
         //			$new_con_typestr = trim($new_con_typestr,',');
         //			if($new_con_typestr)
         //			{
         //				$sedata = array('support_content_type'=>$new_con_typestr);
         //				//根据栏目支持的模块更新栏目支持的内容类型
         //				$this->obj->update_column($column_id,$sedata);
         //			}
         //			$this->pub_sys->delete_column_template($column_id,empty($this->input['support_content_type'])?'':implode(',',$this->input['support_content_type']));
         //更新图片
         $this->update_pic($column_id, $data['support_client']);
     } else {
         //先插入节点
         $id = $this->col_node->insert_node($column_name, $column_fid, $data);
         //更新sort_id 排序id
         $this->obj->update_column($id, array('sort_id' => $id));
         //计算出栏目的目录
         if ($column_fid) {
             $oth_coldetail = $this->obj->get_column_first(' column_dir,column_url,relate_dir ', $column_fid);
         }
         $column_self_dir = $data['column_dir'] ? $data['column_dir'] : $this->settings['defalult_column_dir'] . $id;
         $col_dir = (empty($oth_coldetail['column_dir']) ? '' : $oth_coldetail['column_dir']) . '/' . $column_self_dir;
         //插入子域名
         if ($data['childdomain']) {
             $domain_data['path'] = $col_dir;
             common::insert_domain($domain_data + array('from_id' => $id));
         }
         //计算出栏目的相对路径
         if ($data['childdomain']) {
             $relate_dir = '';
         } else {
             $relate_dir = (empty($oth_coldetail['relate_dir']) ? '' : $oth_coldetail['relate_dir']) . '/' . $column_self_dir;
         }
         $this->obj->update_column($id, array('column_dir' => $col_dir, 'relate_dir' => $relate_dir));
         //栏目插入到cms并保存cms栏目id
         $cms_column_data = array('cms_columnid' => $id, 'name' => $column_name, 'brief' => $data['content'], 'cms_fid' => $column_fid, 'cms_siteid' => $site_id, 'column_dir' => $col_dir, 'linkurl' => $data['linkurl'], 'orderid' => $id, 'relate_dir' => $relate_dir, 'childdomain' => $data['childdomain'], 'colindex' => $data['colindex']);
         $cms_column_id = $this->pub_cms->insert_cms_column($cms_column_data);
         if ($fast_add_column) {
             $this->addItem($id);
             $this->output();
         }
         //插入图片
         $this->insert_pic($id, $data['support_client']);
     }
     $data['site_id'] = $data['site_id'];
     $data['column_id'] = $column_id;
     $data['column_fid'] = $column_fid;
     //获取栏目支持的模块 from table app
     //		$data['module'] = common::get_module();
     $this->addItem($data);
     $this->output();
 }