@ -18,13 +18,8 @@ class Information extends CI_Controller {
$this->load->model('Logs_model');
$this->load->model('InfoMetas_model');
$this->load->model('Infoauthors_model');
$this->load->model('InfoKeywordsanalytics_model', 'analytics_model');
$this->load->model('InfoSMS_model');
if (is_series_site()) {
//$this->load->model('InfoTags_model');
}
$this->load->library('Amplib'); //加载AMP处理类
$this->load->library('Accesscheck');
$this->accesscheck->check_access();
}
@ -196,7 +191,7 @@ class Information extends CI_Controller {
if (in_array($this->config->item('site_code'), array('cht'))) {
$this->config->set_item('templates', $this->config->item('templates_cht'));
}
if (in_array($this->config->item('site_code'), array('gm'))) {
if (in_array($this->config->item('site_code'), array('gm'))) {
$this->config->set_item('templates', $this->config->item('templates_gm'));
}
@ -280,12 +275,9 @@ class Information extends CI_Controller {
//$this->InfoTags_model->ic_id = $data['information']->ic_id;
//$data['my_tags'] = $this->InfoTags_model->list_tag();
//差集
foreach ($data['all_tags'] as & $it)
{
foreach ($data['my_tags'] as $it2)
{
if ($it->it_id == $it2->icit_it_id)
{
foreach ($data['all_tags'] as & $it) {
foreach ($data['my_tags'] as $it2) {
if ($it->it_id == $it2->icit_it_id) {
$it = null;
break;
}
@ -396,26 +388,31 @@ class Information extends CI_Controller {
} else {
$this->InfoContents_model->Update($information->is_ic_id, $this->input->post('ic_url'), $this->input->post('ic_url_title'), $this->input->post('ic_type'), $this->input->post('ic_title'), $this->input->post('ic_content'), $this->input->post('ic_summary'), $this->input->post('ic_seo_title'), $this->input->post('ic_seo_description'), $this->input->post('ic_seo_keywords'), $this->input->post('ic_show_bread_crumbs'), $this->input->post('ic_status'), $this->input->post('ic_template'), $this->input->post('ic_photo'), $this->input->post('ic_photo_width'), $this->input->post('ic_photo_height'), $this->input->post('ic_recommend_tours'), $this->input->post('ic_recommend_packages'), $this->input->post('ic_ht_area_id'), $this->input->post('ic_ht_area_type'), $this->input->post('ic_ht_product_id'), $this->input->post('ic_ht_product_type'), $this->input->post('ic_author'));
//收录查询,只在发布上线并且url不为空的时候检查
$embody_url = $this->input->post('ic_url');
$embody_url = trim($embody_url);
if ($this->input->post('ic_status') == 1 & & $embody_url != '') {
$embody = $this->InfoMetas_model->get($information->is_ic_id, 'meta_embody');
if (empty($embody)) {
$times = date('Y-m-d H:i:s');
$this->InfoMetas_model->add($information->is_ic_id, 'meta_embody', $times);
//AMP更新和生成 beign
$auto_update_amp = $this->input->get_post('auto_update_amp');
if (!empty($auto_update_amp) & & $auto_update_amp == 'true' & & $this->input->post('ic_status') == 1) {
$amp_result=$this->amplib->auto_create($information->ic_id);
if (!empty($amp_result)) {
$amp_result = json_decode($amp_result);
if($amp_result->result=='ok'){
$amp_save_result= $this->amplib->edit_save($information->ic_id,$amp_result->data->amp,'1');
if(!empty($amp_save_result)){
$amp_save_result = json_decode($amp_save_result);
if($amp_save_result->name=='no'){
echo json_encode(array('name' => 'no', 'value' => 'AMP转换语法错误, 请重新进入AMP编辑器检查'));
return;
}
}
}
}
}
//AMP更新和生成 end
//为新闻添加默认发布时间
//if($information->ic_ht_area_type=='s' || $information->ic_type=='c_article')
//{
$meta_news_createdate = get_meta($information->ic_id, 'meta_news_createdate');
if (empty($meta_news_createdate)) {
add_meta($information->ic_id, 'meta_news_createdate', date('m/d/Y', time()));
}
//}
// if (is_series_site()) {
//如果URL有修改也删除静态文件
if ($this->input->post('ic_url') != $information->ic_url) {
$this->update_cache($information->ic_url, true);
@ -426,11 +423,11 @@ class Information extends CI_Controller {
$this->update_cache($this->input->post('ic_url'), true);
}
//德语站FAQ版块需要删除原来的文件才能更新静态
$site_code = $this->config->item('site_code');
$ic_url = $this->input->post('ic_url');
$auto_update_cache = $this->input->get_post('auto_update_cache_checkbox');
if (strcasecmp($site_code, "gm") == 0 & & !empty($auto_update_cache)) {
$update_info_log = $this->update_cache($ic_url, true);
} else if (strcasecmp($site_code, "cht") == 0 & & !empty($auto_update_cache)) {
@ -535,8 +532,8 @@ class Information extends CI_Controller {
if ($delete_only) {
$url = "http://144.76.185.44:8029/gm.php/information/delete_cache_23Xd913mddkgssODII?static_html_url=" . urlencode($url);
} else {
//先删除再生成,部分页面没有在信息平台中
GET_HTTP("http://144.76.185.44:8029/gm.php/information/delete_cache_23Xd913mddkgssODII?static_html_url=" . urlencode($url));
//先删除再生成,部分页面没有在信息平台中
GET_HTTP("http://144.76.185.44:8029/gm.php/information/delete_cache_23Xd913mddkgssODII?static_html_url=" . urlencode($url));
$url = "http://144.76.185.44:8029" . $url;
}
break;
@ -553,7 +550,7 @@ class Information extends CI_Controller {
$information = $this->Information_model->Detail($url);
$tmp = $url;
//判断是否是更新信息
// 产品页面不能生成静态页面,比如/beijing/hotel/只是为了在导航显示一个链接,如果生成了静态页面,网前只会显示一个空白页面了
// 产品页面不能生成静态页面,比如/beijing/hotel/只是为了在导航显示一个链接,如果生成了静态页面,网前只会显示一个空白页面了
if (!empty($information->ic_content)) {
$url = $this->config->item('site_url') . '/index.php/information/detail/?static_html_url=' . $url;
} else {
@ -579,10 +576,6 @@ class Information extends CI_Controller {
break;
}
//关闭错误提示, 防止file_get_contents请求特殊字符的时候会报错或者404、500,特殊字符需要用urlencode编码第一个/后面的url
//error_reporting(NULL);
//ini_set('display_errors', 'Off');
$content = GET_HTTP($url);
if ($content === false) {
$data[] = array('name' => 'no', 'value' => sprintf($this->lang->line('update_cache_failed'), $url));
@ -593,9 +586,9 @@ class Information extends CI_Controller {
if ($this->input->post('updatecdn') == 1) {
$notice = $this->update_cdn();
if ($notice == 200) {
$msg.=$this->lang->line('update_cdn_success');
$msg .= $this->lang->line('update_cdn_success');
} else {
$msg.=$this->lang->line('update_cdn_failed') . '< br > ' . $notice;
$msg .= $this->lang->line('update_cdn_failed') . '< br > ' . $notice;
}
}
$data[] = array('name' => 'ok', 'value' => $msg, 'url' => $url);
@ -672,40 +665,6 @@ class Information extends CI_Controller {
$this->load->view('bootstrap/footer');
}
//增加新景点到景点概述下
//先找到当前城市的景点概述根节点,然后新增加
//$lsi_sn 翰特景点id
function add_landscape($area_id, $lsi_sn) {
//获取景点概述节点
$root_landscape = $this->Information_model->get_type_detail('c_attraction', 'c', $area_id);
if ($root_landscape == FALSE) {
$data[] = array('name' => 'no', 'value' => $this->lang->line('root_landscape_notfound'));
echo json_encode($data);
return false;
}
//获取景点详细内容
$Landscape = $this->Landscape_model->get_detail($lsi_sn);
if ($root_landscape == FALSE) {
$data[] = array('name' => 'no', 'value' => $this->lang->line('landscape_notfound'));
echo json_encode($data);
return false;
}
//添加空内容
$this->InfoContents_model->Add($Landscape->LSI2_Name, $Landscape->LSI2_Name, '', $Landscape->LSI2_Name, $Landscape->LSI2_ShortIntro, '', '', '', '', 0, 0, '', '', 0, 0, '', '', $area_id, 'c', $lsi_sn, 't', '');
if ($this->InfoStructures_model->Add($root_landscape->is_id, $this->InfoContents_model->insert_id)) {
$data[] = array('name' => 'ok', 'value' => site_url('information/edit/' . $this->InfoStructures_model->insert_id));
} else {
$data[] = array('name' => 'no', 'value' => $this->lang->line('form_info_error'));
}
echo json_encode($data);
$this->Logs_model->add($this->InfoStructures_model->insert_id);
return true;
}
//保存自定义配置
function save_meta() {
$im_ic_id = $this->input->post('im_ic_id');