|
|
<?php
|
|
|
|
|
|
if (!defined('BASEPATH'))
|
|
|
exit('No direct script access allowed');
|
|
|
|
|
|
class Information extends CI_Controller
|
|
|
{
|
|
|
|
|
|
function __construct()
|
|
|
{
|
|
|
parent::__construct();
|
|
|
$this->permission->is_admin();
|
|
|
//$this->output->enable_profiler(TRUE);
|
|
|
$this->load->model('Area_model');
|
|
|
$this->load->model('Information_model');
|
|
|
$this->load->model('InfoContents_model');
|
|
|
$this->load->model('InfoStructures_model');
|
|
|
$this->load->model('Landscape_model');
|
|
|
$this->load->model('Operator_model');
|
|
|
$this->load->model('Logs_model');
|
|
|
$this->load->model('InfoMetas_model');
|
|
|
$this->load->model('Infoauthors_model');
|
|
|
$this->load->model('InfoSMS_model');
|
|
|
$this->load->library('Amplib'); //加载AMP处理类
|
|
|
$this->load->library('html_optimize_lib'); //加载HTML优化类
|
|
|
}
|
|
|
|
|
|
public function index()
|
|
|
{
|
|
|
echo '信息首页';
|
|
|
}
|
|
|
|
|
|
public function add($is_parent_id)
|
|
|
{
|
|
|
//添加空内容.
|
|
|
$this->InfoContents_model->Add('', 'New Information', '', '', '', '', '', '', '', 0, 0, '', '', 0, 0, '', '', 0, '', 0, '', '');
|
|
|
$infocontent = $this->InfoContents_model->get_ic_contents($this->InfoContents_model->insert_id);
|
|
|
if (!empty($infocontent) && $this->InfoStructures_model->Add($is_parent_id, $this->InfoContents_model->insert_id)) {
|
|
|
$is_id = $this->InfoStructures_model->insert_id;
|
|
|
$InfoStructures = $this->InfoStructures_model->Detail($is_id);
|
|
|
$InfoStructures->is_id = $is_id;
|
|
|
$data[] = array('name' => 'ok', 'value' => $InfoStructures);
|
|
|
$this->Logs_model->add($this->InfoStructures_model->insert_id);
|
|
|
} else {
|
|
|
$data[] = array('name' => 'no', 'value' => $this->lang->line('form_info_error'));
|
|
|
}
|
|
|
echo json_encode($data);
|
|
|
return TRUE;
|
|
|
}
|
|
|
|
|
|
//移动结构顺序
|
|
|
public function move()
|
|
|
{
|
|
|
//网站会提交一个同级节点id列表字符串,按照这个去排序
|
|
|
$parent_id = $this->input->post('pid');
|
|
|
$idsStr = $this->input->post('ids');
|
|
|
$idsArray = explode(',', $idsStr);
|
|
|
foreach ($idsArray as $key => $value) {
|
|
|
if ($value) {
|
|
|
//设置排序
|
|
|
$this->InfoStructures_model->set_sort($value, $key);
|
|
|
//设置path
|
|
|
$this->InfoStructures_model->set_path($parent_id, $value);
|
|
|
}
|
|
|
}
|
|
|
$data[] = array('name' => 'ok', 'value' => $this->lang->line('structures_success_move'));
|
|
|
echo json_encode($data);
|
|
|
$this->Logs_model->move($idsStr);
|
|
|
return TRUE;
|
|
|
}
|
|
|
|
|
|
//把文章移动到任意板块文章下
|
|
|
//is_id 信息结构ID,is_parent_id即将转移到的信息结构id
|
|
|
public function move_by_is_id()
|
|
|
{
|
|
|
$data = array();
|
|
|
$is_id = $this->input->post('is_id');
|
|
|
$is_parent_id = $this->input->post('is_parent_id');
|
|
|
if ($is_id == $is_parent_id || empty($is_id) || empty($is_parent_id)) {
|
|
|
return false;
|
|
|
}
|
|
|
//即将移动到文章结构信息
|
|
|
$Structure = $this->InfoStructures_model->Detail($is_id);
|
|
|
//目标文章结构信息
|
|
|
$Structure_parent = $this->InfoStructures_model->Detail($is_parent_id);
|
|
|
//只能移动到本站点下
|
|
|
if ($Structure->is_sitecode == $Structure_parent->is_sitecode) {
|
|
|
//不能搬迁到自己的子节点下
|
|
|
if (strpos(',' . $Structure_parent->is_path, ',' . $is_id . ',') == false) {
|
|
|
$this->InfoStructures_model->set_path($is_parent_id, $is_id);
|
|
|
}
|
|
|
//信息的区域类型和id也要修改 todo
|
|
|
}
|
|
|
$data[] = array('name' => 'ok', 'value' => $this->lang->line('structures_success_move'));
|
|
|
echo json_encode($data);
|
|
|
$this->Logs_model->move($is_id);
|
|
|
return TRUE;
|
|
|
}
|
|
|
|
|
|
public function delete($is_id)
|
|
|
{
|
|
|
//查询结构信息
|
|
|
$Structure = $this->InfoStructures_model->Detail($is_id);
|
|
|
if ($Structure == FALSE) {
|
|
|
$data[] = array('name' => 'no', 'value' => $this->lang->line('structures_error_notfound'));
|
|
|
echo json_encode($data);
|
|
|
return false;
|
|
|
}
|
|
|
if ($this->InfoStructures_model->HasChild($Structure->is_id)) {
|
|
|
$data[] = array('name' => 'no', 'value' => $this->lang->line('structures_error_haschild'));
|
|
|
echo json_encode($data);
|
|
|
return false;
|
|
|
} else {
|
|
|
$info_detail = $this->Information_model->Detail($is_id);
|
|
|
|
|
|
//删除前,备份amp的meta标签-isid。
|
|
|
$meta_value = $this->InfoMetas_model->get($info_detail->ic_id, 'AMP_JSON');
|
|
|
if ($meta_value) {
|
|
|
$this->Logs_model->backup_meta($info_detail->ic_id, $meta_value, 'AMP_JSON_' . $is_id);
|
|
|
}
|
|
|
|
|
|
$this->Logs_model->delete($is_id, $info_detail->ic_content);
|
|
|
if (!empty($info_detail->ic_summary)) {
|
|
|
$this->Logs_model->backup_summary($is_id, $info_detail->ic_summary);
|
|
|
}
|
|
|
$this->InfoStructures_model->Delete($Structure->is_id);
|
|
|
$this->InfoContents_model->Delete($Structure->is_ic_id);
|
|
|
//如果是已经发布的页面,删除静态文件
|
|
|
if ($info_detail->ic_status == 1) {
|
|
|
$this->update_cache($info_detail->ic_url, true);
|
|
|
}
|
|
|
//删除成功后返回一个上级链接给用户
|
|
|
$drumpurl = site_url('information/edit/' . $Structure->is_parent_id);
|
|
|
if ($Structure->is_parent_id == 0)
|
|
|
$drumpurl = site_url('/');
|
|
|
$data[] = array('name' => 'ok', 'value' => $drumpurl);
|
|
|
echo json_encode($data);
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//移动优先的编辑
|
|
|
public function edit_mobile($is_id)
|
|
|
{
|
|
|
//查询结构信息
|
|
|
$Structure = $this->InfoStructures_model->Detail($is_id);
|
|
|
if ($Structure == FALSE) {
|
|
|
show_404();
|
|
|
}
|
|
|
|
|
|
//查询结构根节点
|
|
|
$rootStructure = $this->InfoStructures_model->GetParent($Structure->is_path, 1);
|
|
|
//没有根节点就从它本身开始查询
|
|
|
if ($rootStructure == false) {
|
|
|
$rootStructure_ID = $Structure->is_id;
|
|
|
} else {
|
|
|
$rootStructure_ID = $rootStructure->is_id;
|
|
|
}
|
|
|
|
|
|
//查询结构列表信息
|
|
|
$data['informationList'] = $this->Information_model->StructureList($rootStructure_ID);
|
|
|
|
|
|
//信息内容
|
|
|
$data['information'] = $this->Information_model->Detail($is_id);
|
|
|
|
|
|
$this->load->view('bootstrap3/header', $data);
|
|
|
$this->load->view('mobile_first/editor');
|
|
|
$this->load->view('bootstrap3/footer');
|
|
|
|
|
|
}
|
|
|
|
|
|
public function edit($is_id)
|
|
|
{
|
|
|
set_time_limit(30);
|
|
|
//$this->output->enable_profiler(true);
|
|
|
//查询结构信息
|
|
|
$Structure = $this->InfoStructures_model->Detail($is_id);
|
|
|
if ($Structure == FALSE) {
|
|
|
show_404();
|
|
|
}
|
|
|
//查询结构根节点
|
|
|
$rootStructure = $this->InfoStructures_model->GetParent($Structure->is_path, 1);
|
|
|
//没有根节点就从它本身开始查询
|
|
|
if ($rootStructure == false) {
|
|
|
$rootStructure_ID = $Structure->is_id;
|
|
|
} else {
|
|
|
$rootStructure_ID = $rootStructure->is_id;
|
|
|
}
|
|
|
|
|
|
//查询结构列表信息
|
|
|
$data['informationList'] = $this->Information_model->StructureList($rootStructure_ID);
|
|
|
|
|
|
//增加一项,属于这个区域,但是结构数据层次不准确的也要列出来
|
|
|
//todo:
|
|
|
//信息内容
|
|
|
$data['information'] = $this->Information_model->Detail($is_id);
|
|
|
|
|
|
//检查该信息是否已收录
|
|
|
$data['embody'] = 1;
|
|
|
if (isset($data['information']->ic_id)) {
|
|
|
$embody = $this->InfoMetas_model->get($data['information']->ic_id, 'meta_embody');
|
|
|
if ($embody && $embody != '1') {
|
|
|
$data['embody'] = 0;
|
|
|
}
|
|
|
//设置该信息所有未读消息为已读
|
|
|
$this->InfoSMS_model->readed_for_info($data['information']->ic_id);
|
|
|
}
|
|
|
|
|
|
//主节点信息
|
|
|
$data['rootInformation'] = $this->Information_model->Detail($rootStructure_ID);
|
|
|
//获取未绑定的景点,只有城市有,无视其它区域类型
|
|
|
$data['unlink_landscape_list'] = array();
|
|
|
|
|
|
//可选的展示模板
|
|
|
if (in_array($this->config->item('site_code'), array('vac', 'vc', 'jp', 'ru', 'it'))) {
|
|
|
$this->config->set_item('templates', $this->config->item('templates_i'));
|
|
|
}
|
|
|
|
|
|
if (in_array($this->config->item('site_code'), array('ah'))) {
|
|
|
$this->config->set_item('templates', $this->config->item('templates_ah'));
|
|
|
}
|
|
|
if (in_array($this->config->item('site_code'), array('pgr'))) {
|
|
|
$this->config->set_item('templates', $this->config->item('templates_pgr'));
|
|
|
}
|
|
|
if (in_array($this->config->item('site_code'), array('ts'))) {
|
|
|
$this->config->set_item('templates', $this->config->item('templates_ts'));
|
|
|
}
|
|
|
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'))) {
|
|
|
$this->config->set_item('templates', $this->config->item('templates_gm'));
|
|
|
}
|
|
|
|
|
|
|
|
|
if ($Structure->is_sitecode == 'ct') {
|
|
|
$data['infoTypeList'] = $this->config->item('InfoType_ct');
|
|
|
} elseif ($Structure->is_sitecode == 'ah') {
|
|
|
$data['infoTypeList'] = $this->config->item('InfoType_ah');
|
|
|
} else {
|
|
|
switch ($data['rootInformation']->ic_ht_area_type) {
|
|
|
case 'c': //城市
|
|
|
$data['infoTypeList'] = $this->config->item('InfoType_city');
|
|
|
$data['unlink_landscape_list'] = $this->Information_model->get_unlink_landscape_list($data['rootInformation']->ic_ht_area_id);
|
|
|
break;
|
|
|
case 'p': //省份
|
|
|
$data['infoTypeList'] = $this->config->item('InfoType_province');
|
|
|
break;
|
|
|
case 'n': //国家
|
|
|
$data['infoTypeList'] = $this->config->item('InfoType_country');
|
|
|
break;
|
|
|
case 't': //特殊区域
|
|
|
$data['infoTypeList'] = $this->config->item('InfoType_special');
|
|
|
break;
|
|
|
case 'e': //大洲
|
|
|
$data['infoTypeList'] = array();
|
|
|
break;
|
|
|
case 'z': //公民游
|
|
|
$data['infoTypeList'] = $this->config->item('InfoType_citizen');
|
|
|
break;
|
|
|
case 'v': //视频
|
|
|
$data['infoTypeList'] = $this->config->item('InfoType_video');
|
|
|
break;
|
|
|
case 'f': //节庆
|
|
|
$data['infoTypeList'] = $this->config->item('InfoType_festival');
|
|
|
break;
|
|
|
case 'pd': //产品管理
|
|
|
$data['infoTypeList'] = $this->config->item('InfoType_product');
|
|
|
//LMR 2016-7-14
|
|
|
if (in_array($this->config->item('site_code'), array('vac', 'vc', 'jp', 'ru', 'it'))) {
|
|
|
$this->config->set_item('templates', $this->config->item('templates_product_i'));
|
|
|
} else {
|
|
|
$this->config->set_item('templates', $this->config->item('templates_product'));
|
|
|
}
|
|
|
break;
|
|
|
default:
|
|
|
$data['infoTypeList'] = array('不设置' => 'none', '首页' => 'root');
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
$data['templateList'] = $this->config->item('templates');
|
|
|
//翰特产品类型
|
|
|
$data['productTypeList'] = $this->config->item('ProductType_HT');
|
|
|
//获取绑定的产品名称
|
|
|
switch ($data['information']->ic_ht_product_type) {
|
|
|
case 't':
|
|
|
$data['product_title'] = $this->Landscape_model->get_landscape_title($data['information']->ic_ht_product_id);
|
|
|
break;
|
|
|
default:
|
|
|
$data['product_title'] = '';
|
|
|
break;
|
|
|
}
|
|
|
//获取最后更新者信息
|
|
|
$data['last_edit_info'] = $this->Logs_model->get_last_edit($is_id);
|
|
|
|
|
|
//编辑列表
|
|
|
$sites = $this->config->item('site');
|
|
|
$data['editor_list'] = $this->Operator_model->get_site_user($this->config->item('site_code'));
|
|
|
//获取作者列表
|
|
|
$data['author_list'] = $this->Infoauthors_model->get_site_user($this->config->item('site_code'));
|
|
|
|
|
|
//获取备份信息记录
|
|
|
$data['content_backup_list'] = $this->Logs_model->get_backup_list($is_id);
|
|
|
|
|
|
//所属导航栏目
|
|
|
$data['setting_website_nav'] = $this->InfoMetas_model->get_list(0, 'setting_website_nav_' . strtolower($this->config->item('site_code')));
|
|
|
|
|
|
$data['my_tags'] = array();
|
|
|
$data['all_tags'] = array();
|
|
|
if (is_series_site()) {
|
|
|
//信息标签
|
|
|
//$this->InfoTags_model->ic_id = null;
|
|
|
//$data['all_tags'] = $this->InfoTags_model->list_tag();
|
|
|
//$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) {
|
|
|
$it = null;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
$data['all_tags'] = array_filter($data['all_tags']);
|
|
|
}
|
|
|
|
|
|
//获取移动优先的模板,如果有的话
|
|
|
//增加判断站点,每个站点需要读取的模板不一样。 20210311 zp
|
|
|
if ($this->config->item('site_code')=="ch"){
|
|
|
$mobile_first_template_path = 'mobile_first/' . $this->config->item('site_code');
|
|
|
if (is_file(APPPATH . 'views/' . $mobile_first_template_path . EXT)) {
|
|
|
$mobile_template_H1 = $this->call_mobile_template_H1($mobile_first_template_path, $data['information']->is_path, $data['information']->ic_author, $data['information']->ic_title, $data['information']->ic_photo);//H1模板替换
|
|
|
$data['mobile_first_template'] = $this->load->view($mobile_first_template_path, '', TRUE);
|
|
|
if (empty(get_meta($data['information']->ic_id, 'meta_product_code'))) {
|
|
|
$data['mobile_first_template'] = str_replace('<!--@HEAD_1@-->', $mobile_template_H1, $data['mobile_first_template']);
|
|
|
}
|
|
|
//主样式表,内联模式
|
|
|
$main_css_string=compress_css(GET_HTTP('https://proxy-data.chinahighlights.com/css/mobile-first.css'));
|
|
|
$data['mobile_first_template'] = str_replace('<!--@MAIN-CSS@-->', '<style type="text/css">' . $main_css_string . '</style>', $data['mobile_first_template']);
|
|
|
//查找是否有静态文件
|
|
|
if ($this->html_file_helper('find', $data['information']->ic_url)) {
|
|
|
$data['has_html_file'] = true;
|
|
|
}
|
|
|
} else {
|
|
|
$data['mobile_first_template'] = '没有找到移动模板';
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//CT判断是否生成静态文件
|
|
|
if ($this->config->item("site_code")=="chinatravel"){
|
|
|
//查找是否有静态文件
|
|
|
if ($this->html_file_helper('find', $data['information']->ic_url)) {
|
|
|
$data['has_html_file'] = true;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
$this->load->view('bootstrap3/header', $data);
|
|
|
$this->load->view('bootstrap3/information_edit');
|
|
|
$this->load->view('bootstrap3/footer');
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* public function redirect($jumpUrl){
|
|
|
*
|
|
|
* header('HTTP/1.1 301 Moved Permanently');
|
|
|
*
|
|
|
* header($jumpUrl);// 301 跳转到设置的 url
|
|
|
*
|
|
|
* exit();
|
|
|
*
|
|
|
* } */
|
|
|
public function test_proxy($url = false)
|
|
|
{
|
|
|
$curl = curl_init();
|
|
|
//curl_setopt($curl,CURLOPT_URL, "http://graph.facebook.com/?id=http://www.chinahighlights.com");
|
|
|
//curl_setopt($curl,CURLOPT_URL, 'http://graph.facebook.com/?id=http://www.mybeijingchina.com/beijing-attractions/beihai-park/');
|
|
|
curl_setopt($curl, CURLOPT_URL, $url);
|
|
|
curl_setopt($curl, CURLOPT_HEADER, 0);
|
|
|
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
|
|
curl_setopt($curl, CURLOPT_HTTPPROXYTUNNEL, 1);
|
|
|
curl_setopt($curl, CURLOPT_PROXY, "120.24.227.23:33333");
|
|
|
$request = curl_exec($curl);
|
|
|
curl_close($curl);
|
|
|
return $request;
|
|
|
//echo $request;
|
|
|
}
|
|
|
|
|
|
// 分享数 lzq
|
|
|
public function statistical_sharing()
|
|
|
{
|
|
|
|
|
|
//$info_ic = $this->Information_model->get_ic_url_by_code('mbj');
|
|
|
$info_ic = $this->Information_model->get_ic_url();
|
|
|
$ic_id = $info_ic->ic_id;
|
|
|
$ic_url = $info_ic->ic_url;
|
|
|
$ic_sitecode = $info_ic->ic_sitecode;
|
|
|
$site = $this->config->item('site');
|
|
|
|
|
|
if (!empty($ic_url)) {
|
|
|
|
|
|
$result = $this->Information_model->update_ic_date_by_code($ic_id);
|
|
|
//var_dump($site['mbj']['site_url']);
|
|
|
//$wz_url = 'http://graph.facebook.com/?id='.$site['mbj']['site_url'].$ic_url;
|
|
|
$complete_url = 'http://graph.facebook.com/?id=' . $site[$ic_sitecode]['site_url'] . $ic_url;
|
|
|
//echo $wz_url;
|
|
|
$api_return = $this->test_proxy($complete_url);
|
|
|
$api_return = json_decode($api_return);
|
|
|
if (empty($api_return->shares)) {
|
|
|
var_dump($api_return);
|
|
|
$shares = 0;
|
|
|
} else {
|
|
|
var_dump($api_return);
|
|
|
$shares = $api_return->shares;
|
|
|
}
|
|
|
|
|
|
//echo $asd->shares;
|
|
|
$result2 = $this->Information_model->insert_url_to_csi($info_ic->ic_url, $ic_id, $info_ic->ic_sitecode, $shares);
|
|
|
}
|
|
|
|
|
|
//$sstt = $this->config->item('site');
|
|
|
//foreach($infolist as $k=>$v){
|
|
|
// $aabb[] = $v->ic_sitecode;
|
|
|
//}
|
|
|
//$url_count = $this->Information_model->get_count_by_code('mbj');
|
|
|
//$surl = site_url('/information/fengxiangshu');
|
|
|
//redirect($surl,'refresh',301);
|
|
|
|
|
|
$this->load->view('bootstrap3/header');
|
|
|
$this->load->view('bootstrap3/statistical_sharing');
|
|
|
}
|
|
|
|
|
|
public function edit_save()
|
|
|
{
|
|
|
header('Cache-Control: no-cache');
|
|
|
$information = $this->Information_model->Detail($this->input->post('is_id'));
|
|
|
if ($information === false) {
|
|
|
$data[] = array('name' => 'no', 'value' => $this->lang->line('structures_error_notfound'));
|
|
|
echo json_encode($data);
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
$this->form_validation->set_rules('ic_url_title', 'lang:ic_url_title', 'required');
|
|
|
$this->form_validation->set_rules('ic_title', 'lang:ic_title', 'required');
|
|
|
$this->form_validation->set_rules('ic_author', 'lang:ic_author', 'required');
|
|
|
$this->form_validation->set_rules('ic_url', 'lang:ic_url', 'callback_ic_url_check');
|
|
|
//这里比较特别,检测两次ic_url,ci会冲掉第一个ic_url的规则,所以需要在下面也加上callback_ic_url_check
|
|
|
$this->form_validation->set_rules('ic_url', 'lang:ic_url_format', 'callback_ic_url_check|callback_ic_url_format');
|
|
|
|
|
|
if ($this->input->post('ignore_seo_check') === false) {
|
|
|
$this->form_validation->set_rules('ic_seo_title', 'lang:ic_seo_title', 'required');
|
|
|
$this->form_validation->set_rules('ic_seo_description', 'lang:ic_seo_description', 'required|max_length[250]');
|
|
|
}
|
|
|
if ($this->form_validation->run() == FALSE) {
|
|
|
$data = array();
|
|
|
foreach ($this->form_validation->_error_array as $key => $value) {
|
|
|
$data[] = array('name' => $key, 'value' => $value);
|
|
|
}
|
|
|
echo json_encode($data);
|
|
|
} 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'));
|
|
|
|
|
|
//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
|
|
|
//为新闻添加默认发布时间
|
|
|
$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()));
|
|
|
}
|
|
|
|
|
|
//如果URL有修改也删除静态文件
|
|
|
if ($this->input->post('ic_url') != $information->ic_url) {
|
|
|
$this->update_cache($information->ic_url, true);
|
|
|
}
|
|
|
|
|
|
//如果信息不发布则删除静态文件
|
|
|
if ($this->input->post('ic_status') == '0') {
|
|
|
$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, "ch") == 0 && !empty($auto_update_cache)) {
|
|
|
//读取模板生成PC和移动优先文件
|
|
|
$information_new = $this->Information_model->Detail($this->input->post('is_id'));
|
|
|
$this->make_www_cache('mobile', $information_new);
|
|
|
$this->make_www_cache('pc', $information_new);
|
|
|
}else if (strcasecmp($site_code, "chinatravel") == 0 && !empty($auto_update_cache)){
|
|
|
//chinatravel读取模板生成PC和移动优先文件
|
|
|
$information_new = $this->Information_model->Detail($this->input->post('is_id'));
|
|
|
$this->make_www_cache_ct('mobile', $information_new);
|
|
|
$this->make_www_cache_ct('pc', $information_new);
|
|
|
|
|
|
} else if (strcasecmp($site_code, "cht") == 0 && !empty($auto_update_cache)) {
|
|
|
$update_info_log = $this->update_cache($ic_url);
|
|
|
} else if (strcasecmp($site_code, "ah") == 0 && !empty($auto_update_cache)) {
|
|
|
$update_info_log = $this->update_cache($ic_url);
|
|
|
} else if (strcasecmp($site_code, "cht") != 0 && strcasecmp($site_code, "gm") != 0 && strcasecmp($site_code, "ah") != 0) { //非cht站点并且非GM并且非AH
|
|
|
$update_info_log = $this->update_cache($ic_url);
|
|
|
} else if (strcasecmp($site_code, "ct") == 0 && !empty($auto_update_cache)) {
|
|
|
$update_info_log = $this->update_cache($ic_url);
|
|
|
}
|
|
|
|
|
|
if (empty($update_info_log) || count($update_info_log) == 0 || !isset($update_info_log[0]['url'])) {
|
|
|
$update_info_log = 'not found update info log';
|
|
|
}
|
|
|
|
|
|
$data[] = array('name' => 'ok', 'value' => $this->lang->line('form_info_success'), 'update_info_log' => $update_info_log);
|
|
|
$this->Logs_model->backup($information->is_id, $this->input->post('ic_content'));
|
|
|
$this->Logs_model->backup_summary($information->is_id, $this->input->post('ic_summary'));
|
|
|
|
|
|
//作者个人页面更新
|
|
|
if ($this->config->item('site_code') == 'cht') {
|
|
|
$author_pages = array(
|
|
|
'zzy' => 'http://www.chinahighlights.com/author/ruru-zhou/',
|
|
|
'Gavin' => 'http://www.chinahighlights.com/author/gavin-van-hinsbergh/',
|
|
|
'WBL' => 'http://www.chinahighlights.com/author/annie-wu/',
|
|
|
'PKL' => 'http://www.chinahighlights.com/author/kelly/',
|
|
|
'210000017' => 'http://www.chinahighlights.com/author/lynne-buddin/',
|
|
|
'202000027' => 'http://www.chinahighlights.com/author/margaux/',
|
|
|
'202000019' => 'http://www.chinahighlights.com/author/anusuya-mitra/',
|
|
|
'210000018' => 'http://www.chinahighlights.com/author/connie/',
|
|
|
'210000016' => 'http://www.chinahighlights.com/author/ben/',
|
|
|
'200000008' => 'http://www.chinahighlights.com/author/pete-marchetto/',
|
|
|
'210000019' => 'http://www.chinahighlights.com/author/oscar/',
|
|
|
'210000021' => 'http://www.chinahighlights.com/author/matthew/',
|
|
|
'200000013' => 'http://www.chinahighlights.com/author/kit-onslow-smith/',
|
|
|
'202000018' => 'http://www.chinahighlights.com/author/klaus-capra/',
|
|
|
'202000017' => 'http://www.chinahighlights.com/author/christy-campbell/'
|
|
|
);
|
|
|
$key = $this->input->post('ic_author');
|
|
|
if (isset($author_pages[$key])) {
|
|
|
$this->update_cache($author_pages[$key]);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
echo json_encode($data);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//URL不重复检查
|
|
|
function ic_url_check()
|
|
|
{
|
|
|
if ($this->input->post('ignore_url_check')) {
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
$url = $this->input->post('ic_url');
|
|
|
if ($url === '') {
|
|
|
return true;
|
|
|
}
|
|
|
$is_id = $this->input->post('is_id');
|
|
|
return $this->Information_model->URLcheck($is_id, $url);
|
|
|
}
|
|
|
|
|
|
//URL格式检查,不能包含大小写、空格等特殊字符
|
|
|
function ic_url_format($url)
|
|
|
{
|
|
|
if ($url != mb_strtolower($url) || strpos($url, ' ') !== false || strpos($url, '--') !== false || strpos($url, ')') !== false || strpos($url, '(') !== false || strpos($url, '//') !== false || strpos($url, '\\') !== false) {
|
|
|
return false;
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
public function update_www_cache($ic_id)
|
|
|
{
|
|
|
$information = $this->Information_model->detail_by_ic_id($ic_id);
|
|
|
if (empty($information)) {
|
|
|
echo json_encode(array('name' => 'no', 'data' => '找不到这个页面'));
|
|
|
return false;
|
|
|
}
|
|
|
if ($this->html_file_helper('find', $information->ic_url)) {
|
|
|
//用于批量更新,CH和chinatravel分开 ,20210317 zp
|
|
|
if ($this->config->item('site_code') == 'ch'){
|
|
|
$this->make_www_cache('pc', $information);
|
|
|
$this->make_www_cache('mobile', $information);
|
|
|
}else if ($this->config->item('site_code') == 'chinatravel'){
|
|
|
$this->make_www_cache_ct('pc', $information);
|
|
|
$this->make_www_cache_ct('mobile', $information);
|
|
|
}
|
|
|
|
|
|
echo json_encode(array('name' => 'yes', 'data' => '更新成功!'));
|
|
|
return true;
|
|
|
} else {
|
|
|
echo json_encode(array('name' => 'no', 'data' => '没有发布静态页面'));
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//静态文件操作
|
|
|
function html_file_helper($active = 'find', $ic_url = false)
|
|
|
{
|
|
|
if (empty($ic_url)) {
|
|
|
$ic_url = $this->input->get_post('ic_url');
|
|
|
}
|
|
|
if (empty($ic_url)) {
|
|
|
return false;
|
|
|
}
|
|
|
$html_file = $this->config->item('cache')[$this->config->item('site_code')]['cache_path'] . $ic_url;
|
|
|
$html_file = str_replace("\\", "/", $html_file);
|
|
|
if (substr($html_file, -1, 1) == '/') {
|
|
|
$html_file = $html_file . 'index.htm';
|
|
|
}
|
|
|
$html_file_mobile = $html_file . '-mobile.htm';
|
|
|
$html_file_pc = $html_file . '-pc.htm';
|
|
|
|
|
|
switch ($active) {
|
|
|
case 'find': //寻找静态文件
|
|
|
if (is_file($html_file_mobile) || is_file($html_file_pc)) {
|
|
|
return true;
|
|
|
} else {
|
|
|
return false;
|
|
|
}
|
|
|
break;
|
|
|
case 'delete':
|
|
|
if (is_file($html_file_mobile)) {
|
|
|
unlink($html_file_mobile);
|
|
|
}
|
|
|
if (is_file($html_file_pc)) {
|
|
|
unlink($html_file_pc);
|
|
|
}
|
|
|
echo '删除静态文件成功! ' . $ic_url;
|
|
|
break;
|
|
|
default:
|
|
|
return false;
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
//生成静态文件 $device='mobile' or 'pc'
|
|
|
function make_www_cache($device, $information)
|
|
|
{
|
|
|
$data = array();
|
|
|
switch ($device) {
|
|
|
case 'mobile':
|
|
|
//获取移动优先的模板,如果有的话
|
|
|
$template_path = 'mobile_first/' . $this->config->item('site_code');
|
|
|
if (is_file(APPPATH . 'views/' . $template_path . EXT)) {
|
|
|
$template = $this->load->view($template_path, '', TRUE);
|
|
|
$html_path_ext = '-mobile.htm';
|
|
|
} else {
|
|
|
return false;
|
|
|
}
|
|
|
break;
|
|
|
case 'pc':
|
|
|
//获取PC的模板,如果有的话
|
|
|
$template_path = 'mobile_first/' . $this->config->item('site_code');
|
|
|
if (is_file(APPPATH . 'views/' . $template_path . '-pc' . EXT)) {
|
|
|
$template = $this->load->view($template_path . '-pc', '', TRUE);
|
|
|
$html_path_ext = '-pc.htm';
|
|
|
} else {
|
|
|
return false;
|
|
|
}
|
|
|
break;
|
|
|
default:
|
|
|
}
|
|
|
|
|
|
//替换模板中的标签
|
|
|
$template = str_replace('<!--@TITLE@-->', $information->ic_seo_title, $template);
|
|
|
$template = str_replace('<!--@DESCRIPTION@-->', $information->ic_seo_description, $template);
|
|
|
$template = str_replace('<!--@KEYWORDS@-->', $information->ic_seo_keywords, $template);
|
|
|
$template = str_replace('<!--@CANONICAL@-->', $this->config->item('site_url') . $information->ic_url, $template);
|
|
|
//非产品页面
|
|
|
if (empty(get_meta($information->ic_id, 'meta_product_code'))) {
|
|
|
$template_H1 = $this->call_mobile_template_H1($template_path, $information->is_path, $information->ic_author, $information->ic_title, $information->ic_photo);//H1模板替换
|
|
|
$template = str_replace('<!--@HEAD_1@-->', $template_H1, $template);
|
|
|
//信息推荐
|
|
|
$template_NEXT = $this->call_mobile_template_NEXT($template_path, $information->is_id);
|
|
|
$template = str_replace('<!--@ARTICLENEXT@-->', $template_NEXT, $template);
|
|
|
$addthis_widget=$this->load->view($template_path.'-add-this', false,true);
|
|
|
$template = str_replace('<!--@ADDTHIS-WIDGET@-->', $addthis_widget, $template);
|
|
|
} else {
|
|
|
$template = str_replace('<!--@PRODUCT-JS@-->', '<script src="https://data.chinahighlights.com/js/flatpickr.js"></script>', $template);
|
|
|
}
|
|
|
//顶部全屏大图
|
|
|
if($device=='mobile'){//移动端读取移动大图
|
|
|
$meta_addon_picture = get_meta($information->ic_id, 'meta_addon_picture_mobile');
|
|
|
}else{
|
|
|
$meta_addon_picture = get_meta($information->ic_id, 'meta_addon_picture');
|
|
|
}
|
|
|
$meta_addon_picture_url = get_meta($information->ic_id, 'meta_addon_picture_url');
|
|
|
if (!empty($meta_addon_picture)) {
|
|
|
if(!empty($meta_addon_picture_url)){
|
|
|
$template = str_replace('<!--@TOP-BANNER@-->', '<div class="detailtopbanner"><a href="'.$meta_addon_picture_url.'"> <img class="img-responsive" alt="' . $information->ic_title . '" src="' . $meta_addon_picture . '"></a></div>', $template);
|
|
|
}else{
|
|
|
$template = str_replace('<!--@TOP-BANNER@-->', '<div class="detailtopbanner"><img class="img-responsive" alt="' . $information->ic_title . '" src="' . $meta_addon_picture . '"></div>', $template);
|
|
|
}
|
|
|
}
|
|
|
//顶部视频
|
|
|
$meta_news_video = get_meta($information->ic_id, 'meta_news_video');
|
|
|
$meta_video_picture = get_meta($information->ic_id, 'meta_video_picture');
|
|
|
if (!empty($meta_news_video) && !empty($meta_video_picture)) {
|
|
|
$template = str_replace('<!--@TOP-VIDEO@-->', '<div class="detailtopbanner"><video autoplay="" controls="controls" id="bgvid" poster="' . $meta_video_picture . '" src="' . $meta_news_video . '" style="position: inherit;"> </video></div>', $template);
|
|
|
}
|
|
|
//主样式表,内联模式
|
|
|
$main_css_string=compress_css(GET_HTTP('https://proxy-data.chinahighlights.com/css/mobile-first.css'));
|
|
|
$template = str_replace('<!--@MAIN-CSS@-->', '<style type="text/css">' . $main_css_string . '</style>', $template);
|
|
|
//额外样式
|
|
|
$meta_addon_css = get_meta($information->ic_id, 'meta_addon_css');
|
|
|
if (!empty($meta_addon_css)) {
|
|
|
//引用方式 $template = str_replace('<!--@ADDON-CSS@-->', '<link href="' . $meta_addon_css . '" rel="stylesheet">', $template);
|
|
|
//内联方式
|
|
|
$meta_addon_css_string=compress_css(GET_HTTP($meta_addon_css));
|
|
|
$template = str_replace('<!--@ADDON-CSS@-->', '<style type="text/css">' . $meta_addon_css_string . '</style>', $template);
|
|
|
}
|
|
|
//额外js
|
|
|
$meta_addon_js = get_meta($information->ic_id, 'meta_addon_js');
|
|
|
if (!empty($meta_addon_js)) {
|
|
|
$template = str_replace('<!--@ADDON-JS@-->', '<script src="' . $meta_addon_js . '"></script>', $template);
|
|
|
}
|
|
|
$template = str_replace('<!--@CUSTOM-CONENT@-->', $information->ic_content, $template);
|
|
|
//Google广告代码
|
|
|
if (!empty(get_meta($information->ic_id, 'meta_google_ad_content'))) {
|
|
|
$template = str_replace('<!--@Match-Content-GOOGLE@-->', '<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><ins class="adsbygoogle" style="display:block" data-ad-format="autorelaxed" data-ad-client="ca-pub-4231674166786366" data-ad-slot="1447610161"></ins><script>(adsbygoogle = window.adsbygoogle || []).push({});</script>', $template);
|
|
|
}
|
|
|
if (!empty(get_meta($information->ic_id, 'meta_google_ad_article'))) {
|
|
|
$in_article_google=$this->load->view($template_path.'-google-ad', false,true);
|
|
|
$template = str_replace('<!--@IN-ARTICLE-GOOGLE@-->', $in_article_google, $template);
|
|
|
}
|
|
|
//社媒分享图片
|
|
|
if (!empty($information->ic_photo)) {
|
|
|
$full_ic_photo = $this->config->item('site_image_url') . $information->ic_photo;
|
|
|
$template = str_replace('<!--@OG:IMAGE@-->', '<meta property="og:image" content="' . $full_ic_photo . '"><meta property="og:image:secure_url" content="' . $full_ic_photo . '"><meta property="og:image:width" content="800"><meta property="og:image:height" content="450">', $template);
|
|
|
}
|
|
|
//设置图片尺寸
|
|
|
$template=$this->html_optimize_lib->set_image_size($template);
|
|
|
// /travelguide/chinese-zodiac/monthly-fortune-for-dog.htm
|
|
|
$html_path = $this->config->item('cache')[$this->config->item('site_code')]['cache_path'] . $information->ic_url;
|
|
|
$html_path = str_replace("\\", "/", $html_path);
|
|
|
if (substr($html_path, -1, 1) == '/') {
|
|
|
$html_path = $html_path . 'index.htm';
|
|
|
}
|
|
|
$html_path .= $html_path_ext;
|
|
|
create_folder_by_path(dirname($html_path));
|
|
|
file_put_contents($html_path, $template, LOCK_EX);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* @description: CT用的生成静态文件方法.有些内容的替换,CT这边不一样,需要单独处理 zp
|
|
|
* @param {type} $device='mobile' or 'pc'
|
|
|
* @return:
|
|
|
* @Date Changed:
|
|
|
*/
|
|
|
function make_www_cache_ct($device,$information){
|
|
|
$data = array();
|
|
|
//先准备数据,CT采用直接赋值视图然后返回视图字符串的模式,不使用一次次替换视图模板内容的模式。
|
|
|
$data["TITLE"] = $information->ic_seo_title;
|
|
|
$data["DESCRIPTION"] = $information->ic_seo_description;
|
|
|
$data["KEYWORDS"] = $information->ic_seo_keywords;
|
|
|
$data["CANONICAL"] = $this->config->item('site_url') . $information->ic_url;
|
|
|
|
|
|
/* 详细内容 */
|
|
|
$ic_content = $information->ic_content;
|
|
|
/**替换详细内容里面的价格
|
|
|
* // 一日游价格标签, "<!--@DayTripPrice:XASIC-41@-->" 或者<!--@DayTripPrice:XASIC-41,2@--> 逗号后面是人数
|
|
|
* //精华线路标签"<!--@TourPrice:ct-1@-->"
|
|
|
*/
|
|
|
$ic_content = preg_replace_callback('/<!--@DayTripPrice:(.*)@-->/i',function($match){
|
|
|
//处理一日游每次配备
|
|
|
$matchItem = $match[1];
|
|
|
return '<span class="js_getDayTripPrice" data="'.$matchItem.'"></span>';;
|
|
|
},$ic_content);
|
|
|
$ic_content = preg_replace_callback('/<!--@TourPrice:(.*)@-->/i',function($match){
|
|
|
//处理精华线路每次配备
|
|
|
$matchItem = $match[1];
|
|
|
return '<span class="js_getTourPrice" data="'.$matchItem.'"></span>';;
|
|
|
},$ic_content);
|
|
|
|
|
|
$data["CUSTOMCONENT"]=$ic_content;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//非产品页面
|
|
|
$data["PRODUCTJS"]="";
|
|
|
if (empty(get_meta($information->ic_id, 'meta_product_code'))) {
|
|
|
|
|
|
} else {
|
|
|
$data["PRODUCTJS"] = '<script src="https://data.chinatravel.com/js/mobile-first/flatpickr.js"></script>';
|
|
|
}
|
|
|
|
|
|
//顶部全屏大图
|
|
|
$data["TOPBANNER"] ="";
|
|
|
$ImgText = ""; //图文字
|
|
|
$meta_addon_picture_url = get_meta($information->ic_id, 'meta_addon_picture_url');
|
|
|
if($device=='mobile'){//移动端读取移动大图
|
|
|
$meta_addon_picture = get_meta($information->ic_id, 'meta_addon_picture_mobile');
|
|
|
$bannerImg = '<img class="img-responsive" width="750" height="650" alt="' . $information->ic_title . '" src="' . $meta_addon_picture . '">';
|
|
|
}else{
|
|
|
$meta_addon_picture = get_meta($information->ic_id, 'meta_addon_picture');
|
|
|
$bannerImg = '<img class="img-responsive" width="1920" height="720" alt="' . $information->ic_title . '" src="' . $meta_addon_picture . '">';
|
|
|
$meta_addon_picture_text = get_meta($information->ic_id,'meta_addon_picture_text');
|
|
|
if(!empty($meta_addon_picture_url)){
|
|
|
$ImgText = '<div class="carousel-caption"><p class="ads-title"><a href="'.$meta_addon_picture_url.'">'.$meta_addon_picture_text.'</a></p></div>';
|
|
|
}else{
|
|
|
$ImgText = '<div class="carousel-caption"><p class="ads-title">'.$meta_addon_picture_text.'</p></div>';
|
|
|
}
|
|
|
}
|
|
|
if (!empty($meta_addon_picture)) {
|
|
|
if(!empty($meta_addon_picture_url)){
|
|
|
$data["TOPBANNER"] = '<div class="banner"><a href="'.$meta_addon_picture_url.'">'.$bannerImg.' </a>'.$ImgText.'</div>';
|
|
|
}else{
|
|
|
$data["TOPBANNER"] = '<div class="banner">'.$bannerImg.$ImgText.'</div>';
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//顶部视频
|
|
|
$data["TOPVIDEO"]="";
|
|
|
$meta_news_video = get_meta($information->ic_id, 'meta_news_video');
|
|
|
$meta_video_picture = get_meta($information->ic_id, 'meta_video_picture');
|
|
|
if (!empty($meta_news_video) && !empty($meta_video_picture)) {
|
|
|
$data["TOPVIDEO"]='<div class="banner"><video autoplay="" controls="controls" id="bgvid" poster="' . $meta_video_picture . '" src="' . $meta_news_video . '" style="position: inherit;"> </video></div>';
|
|
|
}
|
|
|
|
|
|
|
|
|
//主样式表,内联模式
|
|
|
if ($device=="mobile"){
|
|
|
$cssUrl = "http://202.103.68.104/css/newcss3/base.css";
|
|
|
}else{
|
|
|
$cssUrl="http://202.103.68.104/css/newcss3/base.css";
|
|
|
}
|
|
|
$main_css_string=compress_css(GET_HTTP($cssUrl));
|
|
|
$data["MAINCSS"] = '<style type="text/css">' . $main_css_string . '</style>';
|
|
|
|
|
|
//额外样式
|
|
|
$data["ADDONCSS"]="";
|
|
|
$meta_addon_css = get_meta($information->ic_id, 'meta_addon_css');
|
|
|
if (!empty($meta_addon_css)) {
|
|
|
//引用方式
|
|
|
//$data["ADDONCSS"]= '<link href="' . $meta_addon_css . '" rel="stylesheet" />';
|
|
|
//内联方式
|
|
|
$meta_addon_css_string=compress_css(GET_HTTP($meta_addon_css));
|
|
|
$data["ADDONCSS"]='<style type="text/css">' . $meta_addon_css_string . '</style>';
|
|
|
|
|
|
}
|
|
|
|
|
|
//额外js
|
|
|
$data["ADDONJS"]="";
|
|
|
$meta_addon_js = get_meta($information->ic_id, 'meta_addon_js');
|
|
|
if (!empty($meta_addon_js)) {
|
|
|
$data["ADDONJS"]='<script src="' . $meta_addon_js . '"></script>';
|
|
|
}
|
|
|
|
|
|
//社媒分享图片
|
|
|
$data["OGIMAGE"]="";
|
|
|
if (!empty($information->ic_photo)) {
|
|
|
$full_ic_photo = $this->config->item('site_image_url') . $information->ic_photo;
|
|
|
$data["OGIMAGE"]= '<meta property="og:image" content="' . $full_ic_photo . '"><meta property="og:image:secure_url" content="' . $full_ic_photo . '"><meta property="og:image:width" content="800"><meta property="og:image:height" content="450">';
|
|
|
}
|
|
|
|
|
|
//结构化标签
|
|
|
$data["ConstructionCode"]="";
|
|
|
$meta_construction_code = get_meta($information->ic_id,'meta_construction_code');
|
|
|
if (!empty($meta_construction_code)){
|
|
|
$data["ConstructionCode"]=$meta_construction_code;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//两种模板
|
|
|
switch ($device) {
|
|
|
case 'mobile':
|
|
|
//获取移动优先的模板,如果有的话
|
|
|
$template_path = 'mobile_first/' . $this->config->item('site_code');
|
|
|
if (is_file(APPPATH . 'views/' . $template_path . EXT)) {
|
|
|
$template = $this->load->view($template_path, $data, TRUE);
|
|
|
$html_path_ext = '-mobile.htm';
|
|
|
} else {
|
|
|
return false;
|
|
|
}
|
|
|
break;
|
|
|
case 'pc':
|
|
|
//获取PC的模板,如果有的话
|
|
|
$template_path = 'mobile_first/' . $this->config->item('site_code');
|
|
|
if (is_file(APPPATH . 'views/' . $template_path . '-pc' . EXT)) {
|
|
|
$template = $this->load->view($template_path . '-pc', $data, TRUE);
|
|
|
$html_path_ext = '-pc.htm';
|
|
|
} else {
|
|
|
return false;
|
|
|
}
|
|
|
break;
|
|
|
default:
|
|
|
}
|
|
|
|
|
|
|
|
|
//生成静态文件
|
|
|
$html_path = $this->config->item('cache')[$this->config->item('site_code')]['cache_path'] . $information->ic_url;
|
|
|
$html_path = str_replace("\\", "/", $html_path);
|
|
|
if (substr($html_path, -1, 1) == '/') {
|
|
|
$html_path = $html_path . 'index.htm';
|
|
|
}
|
|
|
$html_path .= $html_path_ext;
|
|
|
create_folder_by_path(dirname($html_path));
|
|
|
file_put_contents($html_path, $template, LOCK_EX);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// //Google广告代码
|
|
|
// if (!empty(get_meta($information->ic_id, 'meta_google_ad_content'))) {
|
|
|
// $template = str_replace('<!--@Match-Content-GOOGLE@-->', '<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><ins class="adsbygoogle" style="display:block" data-ad-format="autorelaxed" data-ad-client="ca-pub-4231674166786366" data-ad-slot="1447610161"></ins><script>(adsbygoogle = window.adsbygoogle || []).push({});</script>', $template);
|
|
|
// }
|
|
|
// if (!empty(get_meta($information->ic_id, 'meta_google_ad_article'))) {
|
|
|
// $in_article_google=$this->load->view($template_path.'-google-ad', false,true);
|
|
|
// $template = str_replace('<!--@IN-ARTICLE-GOOGLE@-->', $in_article_google, $template);
|
|
|
// }
|
|
|
|
|
|
// //设置图片尺寸
|
|
|
// //$template=$this->html_optimize_lib->set_image_size($template);
|
|
|
// // /travelguide/chinese-zodiac/monthly-fortune-for-dog.htm
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
function call_mobile_template_H1($mobile_first_template_path, $is_path, $ic_author, $ic_title, $ic_photo)
|
|
|
{
|
|
|
$data['infocategory'] = $this->Information_model->get_detail_by_path($is_path, 1);//信息所属分类,获取信息顶级节点内容
|
|
|
$data['author'] = $this->Operator_model->get_author_nikename($ic_author);//获取作者信息
|
|
|
$data['ic_title'] = $ic_title;
|
|
|
$data['ic_photo'] = $ic_photo;
|
|
|
return $this->load->view($mobile_first_template_path . '-h1', $data, TRUE);
|
|
|
}
|
|
|
|
|
|
//通过内容找到第一张图片
|
|
|
function set_photo_content($ic_photo, $ic_content)
|
|
|
{
|
|
|
if (empty($ic_photo)) {
|
|
|
$images = get_image_url_by_source($ic_content);
|
|
|
if (!empty($images) and !empty($images[1])) {
|
|
|
return $images[1][0];
|
|
|
}
|
|
|
} else {
|
|
|
return $this->config->item('site_image_url') . $ic_photo;
|
|
|
}
|
|
|
return '';
|
|
|
}
|
|
|
|
|
|
function call_mobile_template_NEXT($template_path, $is_id)
|
|
|
{
|
|
|
$data['detail'] = $this->Information_model->Detail($is_id);
|
|
|
$data['type_detail'] = $this->Information_model->get_detail_by_path($data['detail']->is_path, 0);//信息所属分组,根据分组进行不同推荐
|
|
|
$data['root_detail'] = $this->Information_model->get_detail_by_path($data['detail']->is_path, 1);//信息所属分类,获取信息顶级节点内容
|
|
|
|
|
|
switch (strtolower($data['type_detail']->ic_url_title)) {
|
|
|
case 'inspiration':
|
|
|
//随机获取两个同级节点内容
|
|
|
$random_array = $this->Information_model->random(2, $data['detail']->is_parent_id, array($data['detail']->is_id));
|
|
|
if (!empty($random_array[0])) {
|
|
|
$data['info_howtoplan'] = $random_array[0];
|
|
|
$data['info_howtoplan_root'] = $data['root_detail'];
|
|
|
$data['info_howtoplan']->ic_photo = $this->set_photo_content($data['info_howtoplan']->ic_photo, $data['info_howtoplan']->ic_content);
|
|
|
}
|
|
|
if (!empty($random_array[1])) {
|
|
|
$data['info_besttime'] = $random_array[1];
|
|
|
$data['info_besttime_root'] = $data['root_detail'];
|
|
|
$data['info_besttime']->ic_photo = $this->set_photo_content($data['info_besttime']->ic_photo, $data['info_besttime']->ic_content);
|
|
|
}
|
|
|
//漏斗作用的页面,随机挑选一篇
|
|
|
$random_array = array(
|
|
|
'/travelguide/china-facts.htm',
|
|
|
'/travelguide/article-top-china-tourist-destination.htm',
|
|
|
'/travelguide/most-beautiful-places.htm',
|
|
|
'/weather/china-best-times.htm',
|
|
|
'/travelguide/article-10-movies-to-watch.htm',
|
|
|
'/travelguide/article-culture-shock-in-china.htm',
|
|
|
'/travelguide/article-what-chinese-eat-for-breakfast.htm',
|
|
|
'/travelguide/china-top-10-attractions.htm',
|
|
|
'/travelguide/chinese-food/eight-chinese-dishes.htm',
|
|
|
'/travelguide/china-travel-reopen-restrictions.htm'
|
|
|
);
|
|
|
$data['info_topthings'] = $this->Information_model->Detail($random_array[rand(0, count($random_array) - 1)]);
|
|
|
if (!empty($data['info_topthings'])) {
|
|
|
$data['info_topthings_root'] = $this->Information_model->get_detail_by_path($data['info_topthings']->is_path, 1);
|
|
|
$data['info_topthings']->ic_photo = $this->set_photo_content($data['info_topthings']->ic_photo, $data['info_topthings']->ic_content);
|
|
|
}
|
|
|
//文化板块的页面,随机挑选一篇
|
|
|
$random_array = array(
|
|
|
'/travelguide/chinese-zodiac/',
|
|
|
'/travelguide/culture/china-arts-crafts.htm',
|
|
|
'/beijing/forbidden-city/',
|
|
|
'/travelguide/culture/traditionalmedichine.htm',
|
|
|
'/travelguide/chinese-tea/',
|
|
|
'/travelguide/kungfu/',
|
|
|
'/travelguide/culture/china-history.htm',
|
|
|
'/travelguide/chinese-food/',
|
|
|
'/travelguide/chinese-language/'
|
|
|
);
|
|
|
$data['info_hotel'] = $this->Information_model->Detail($random_array[rand(0, count($random_array) - 1)]);
|
|
|
if (!empty($data['info_hotel'])) {
|
|
|
$data['info_hotel_root'] = $this->Information_model->get_detail_by_path($data['info_hotel']->is_path, 1);
|
|
|
$data['info_hotel']->ic_photo = $this->set_photo_content($data['info_hotel']->ic_photo, $data['info_hotel']->ic_content);
|
|
|
}
|
|
|
break;
|
|
|
case 'planing-1(guide)':
|
|
|
case 'planning-2 (decision tips)':
|
|
|
case 'destination': //url的第一段表示地区,根据第一段来搜索相关数据如/beijing/ 而不是根据is_parent_id因为可能信息和线路是在不同的分类下
|
|
|
$destination_url=trim($data['detail']->ic_url);
|
|
|
$destination_url=substr($destination_url,0,strpos($destination_url,'/',1)+1);
|
|
|
//how to plan
|
|
|
$data['info_howtoplan'] = $this->Information_model->search_by_words($destination_url, array('how', 'plan'),$data['detail']->is_id);
|
|
|
if (empty($data['info_howtoplan'])) {//找不到对应信息则显示备用
|
|
|
$data['info_howtoplan'] = $this->Information_model->Detail('/travelguide/plan-first-trip.htm');
|
|
|
}
|
|
|
$data['info_howtoplan_root'] = $this->Information_model->get_detail_by_path($data['info_howtoplan']->is_path, 1);//信息所属分类,获取信息顶级节点内容
|
|
|
if (!empty($data['info_howtoplan'])) {
|
|
|
$data['info_howtoplan']->ic_photo = $this->set_photo_content($data['info_howtoplan']->ic_photo, $data['info_howtoplan']->ic_content);
|
|
|
}
|
|
|
//best time to visit
|
|
|
$data['info_besttime'] = $this->Information_model->search_by_words($destination_url, array('best', 'time'),$data['detail']->is_id);
|
|
|
if (empty($data['info_besttime'])) {
|
|
|
$data['info_besttime'] = $this->Information_model->Detail('/weather/china-best-times.htm');
|
|
|
}
|
|
|
$data['info_besttime_root'] = $this->Information_model->get_detail_by_path($data['info_besttime']->is_path, 1);//信息所属分类,获取信息顶级节点内容
|
|
|
if (!empty($data['info_besttime'])) {
|
|
|
$data['info_besttime']->ic_photo = $this->set_photo_content($data['info_besttime']->ic_photo, $data['info_besttime']->ic_content);
|
|
|
}
|
|
|
//top things to do
|
|
|
$data['info_topthings'] = $this->Information_model->search_by_words($destination_url, array('top', 'things'),$data['detail']->is_id);
|
|
|
if (empty($data['info_topthings'])) {
|
|
|
$data['info_topthings'] = $this->Information_model->Detail('/travelguide/article-top-china-tourist-destination.htm');
|
|
|
}
|
|
|
$data['info_topthings_root'] = $this->Information_model->get_detail_by_path($data['info_topthings']->is_path, 1);//信息所属分类,获取信息顶级节点内容
|
|
|
if (!empty($data['info_topthings'])) {
|
|
|
$data['info_topthings']->ic_photo = $this->set_photo_content($data['info_topthings']->ic_photo, $data['info_topthings']->ic_content);
|
|
|
}
|
|
|
//第四篇,随机推荐下方url
|
|
|
$random_array = array(
|
|
|
'/feedback/',
|
|
|
'/travelguide/how-chinahighlights-selects-your-hotel.htm',
|
|
|
'/travelguide/article-private-tour-vs-group-tour.htm',
|
|
|
'/aboutus/who-recommended.htm',
|
|
|
'/aboutus/no-shops.htm',
|
|
|
'/aboutus/company-history.htm'
|
|
|
);
|
|
|
$data['info_hotel']=$this->Information_model->Detail($random_array[rand(0, count($random_array) - 1)]);
|
|
|
if (!empty($data['info_hotel'])) {
|
|
|
$data['info_hotel_root'] = $this->Information_model->get_detail_by_path($data['info_hotel']->is_path, 1);
|
|
|
$data['info_hotel']->ic_photo = $this->set_photo_content($data['info_hotel']->ic_photo, $data['info_hotel']->ic_content);
|
|
|
}
|
|
|
break;
|
|
|
default:
|
|
|
return '';
|
|
|
}
|
|
|
|
|
|
return $this->load->view($template_path . '-next', $data, TRUE);
|
|
|
}
|
|
|
|
|
|
//更新静态文件
|
|
|
//不用参数提交的原因是可能url带有特殊字符,CI会报错
|
|
|
public function update_cache($static_html_url = false, $delete_only = false)
|
|
|
{
|
|
|
$url = !empty($static_html_url) ? $static_html_url : $this->input->post('cache_url');
|
|
|
$url = str_replace($this->config->item('site_url'), '', $url);
|
|
|
$original_url = $url; //原始链接
|
|
|
$delete_only = !empty($delete_only) ? $delete_only : $this->input->get_post('delete_only');
|
|
|
|
|
|
switch ($this->config->item('site_code')) {
|
|
|
case 'cht':
|
|
|
$search_list = $this->Information_model->search_url($url);
|
|
|
$amp_request = FALSE;
|
|
|
foreach ($search_list as $key => $req_url) {
|
|
|
$meta_amp_status = get_meta($req_url->ic_id, 'AMP_STATUS');
|
|
|
if ($meta_amp_status) {
|
|
|
$amp_request = TRUE;
|
|
|
}
|
|
|
}
|
|
|
if ($amp_request) {
|
|
|
$url = 'http://169.54.167.189:22224/ampreq' . $url;
|
|
|
} else {
|
|
|
$url = 'http://169.54.167.189:22224' . $url;
|
|
|
}
|
|
|
break;
|
|
|
case 'ah':
|
|
|
if ($delete_only === true) {
|
|
|
$url = 'https://www.asiahighlights.com/index.php/information/delete_cache_8X913mksJ/?static_html_url=' . $url;
|
|
|
} else { // static_html_optimize=comeon 启用静态化压缩和js、css延迟加载
|
|
|
$url = 'https://www.asiahighlights.com/index.php/information/detail/?static_html_url=' . $url . '&static_html_optimize=comeon';
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
case 'gm':
|
|
|
//GET_HTTP("http://148.251.35.42:3300/create-cache/?url=" . urlencode($url)); //请求nodejs静态化更新页面,删除缓存,因为部分页面没有进入信息平台
|
|
|
//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));
|
|
|
$url = "http://144.76.185.44:8029/gm.php/information/detail/?static_html_url=" . $url;
|
|
|
//}
|
|
|
break;
|
|
|
|
|
|
case 'vac': //国际站
|
|
|
case 'vc':
|
|
|
case 'it':
|
|
|
case 'ru':
|
|
|
case 'jp':
|
|
|
$information = $this->Information_model->Detail($url);
|
|
|
if ($delete_only || !$information || $information->ic_ht_area_type === 'q') {
|
|
|
//只删除操作,在url修改和不发布信息的时候使用
|
|
|
$url = $this->config->item('site_url') . '/index.php/welcome/update_cache/delete_only?static_html_url=' . $url;
|
|
|
} else {
|
|
|
$tmp = $url;
|
|
|
//判断是否是更新信息
|
|
|
// 产品页面不能生成静态页面,比如/beijing/hotel/只是为了在导航显示一个链接,如果生成了静态页面,网前只会显示一个空白页面了
|
|
|
if (!empty($information->ic_content)) {
|
|
|
$url = $this->config->item('site_url') . '/index.php/information/detail/?static_html_url=' . $url;
|
|
|
} else {
|
|
|
//先尝试删除静态文件。
|
|
|
//$try_del = $this->config->item('site_url') . '/index.php/welcome/update_cache/delete_only?static_html_url=' . $url;
|
|
|
//file_get_contents($try_del);
|
|
|
$url = $this->config->item('site_url') . '/index.php/welcome/update_cache/?static_html_url=' . $url;
|
|
|
}
|
|
|
if (isset($information->ic_type) && $information->ic_type == 'product') {
|
|
|
$url = $this->config->item('site_url') . '/index.php/welcome/update_cache/?static_html_url=' . $tmp;
|
|
|
}
|
|
|
//int return direct
|
|
|
$cache_url = $this->input->post('cache_url');
|
|
|
if ($url && !$cache_url) {
|
|
|
/*
|
|
|
ignore_user_abort(true);
|
|
|
$ch = curl_init();
|
|
|
curl_setopt($ch, CURLOPT_URL, $url);
|
|
|
curl_setopt($ch, CURLOPT_TIMEOUT, 1);
|
|
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); // 对认证证书来源的检查
|
|
|
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); // 从证书中检查SSL加密算法是否存在
|
|
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //禁止直接显示获取的内容
|
|
|
curl_setopt($ch, CURLOPT_HEADER, 0); //不需要HEAD
|
|
|
curl_setopt($ch, CURLOPT_FRESH_CONNECT, 1);
|
|
|
curl_setopt($ch, CURLOPT_NOBODY, 1);
|
|
|
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
|
|
|
curl_exec($ch);
|
|
|
curl_close($ch);
|
|
|
*/
|
|
|
$data['async_update'] = $url;
|
|
|
$data[] = array('name' => 'ok', 'value' => '信息保存成功,请在8秒后检查更新页面。', 'url' => $url);
|
|
|
//如果是外部调用就返回结果,内部就不返回了
|
|
|
if ($cache_url) {
|
|
|
echo json_encode($data);
|
|
|
}
|
|
|
return $data;
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
case 'ct': //子站点使用
|
|
|
$url = 'http://50.97.246.187:22223' . $url;
|
|
|
break;
|
|
|
case 'sht':
|
|
|
case 'gl':
|
|
|
case 'mbj':
|
|
|
case 'yz':
|
|
|
$url = $this->config->item('site_url') . $url . '@cache@refresh';
|
|
|
break;
|
|
|
default:
|
|
|
return false;
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
$content = GET_HTTP($url);
|
|
|
if ($content === false) {
|
|
|
$data[] = array('name' => 'no', 'value' => sprintf($this->lang->line('update_cache_failed'), $url));
|
|
|
} else {
|
|
|
//手动更新的话,接着更新CDN缓存
|
|
|
$msg = $this->lang->line('update_cache_success');
|
|
|
|
|
|
if ($this->input->post('updatecdn') == 1) {
|
|
|
$notice = $this->update_cdn();
|
|
|
if ($notice == 200) {
|
|
|
$msg .= $this->lang->line('update_cdn_success');
|
|
|
} else {
|
|
|
$msg .= $this->lang->line('update_cdn_failed') . '<br>' . $notice;
|
|
|
}
|
|
|
}
|
|
|
$data[] = array('name' => 'ok', 'value' => $msg, 'url' => $url);
|
|
|
}
|
|
|
//如果是外部调用就返回结果,内部就不返回了
|
|
|
if ($this->input->post('cache_url')) {
|
|
|
echo json_encode($data);
|
|
|
}
|
|
|
return $data;
|
|
|
}
|
|
|
|
|
|
//更新CDN缓存
|
|
|
public function update_cdn($static_html_url = false)
|
|
|
{
|
|
|
$flag = false; //false:不更新,true:更新
|
|
|
$update_site = array('jp', 'ru'); //需要更新CDN的站点
|
|
|
//需要更新的url
|
|
|
$url = $static_html_url;
|
|
|
if (empty($url))
|
|
|
$url = $this->input->post('cache_url');
|
|
|
|
|
|
//如果传递进来的url是带有域名,则对域名进行判断
|
|
|
$tempu = parse_url($url);
|
|
|
if (isset($tempu['host'])) {
|
|
|
$url = isset($tempu['path']) ? $tempu['path'] : '/';
|
|
|
$pad = $tempu['host'];
|
|
|
$flag = true;
|
|
|
} //如果传递进来的url没有域名,则使用当前站点的信息进行判断
|
|
|
else {
|
|
|
$url = str_replace($this->config->item('site_url'), '', $url);
|
|
|
$pad = str_replace('http://', '', $this->config->item('site_url'));
|
|
|
if (in_array($this->config->item('site_code'), $update_site))
|
|
|
$flag = TRUE;
|
|
|
}
|
|
|
|
|
|
//默认更新成功,如果不成功,则返回错误提示信息
|
|
|
$notice = 200;
|
|
|
if ($flag) {
|
|
|
$result = GET_HTTP('https://openapi.us.cdnetworks.com/purge/rest/doPurge?user=ycc@chinahighlights.com&pass=cXi2UbsTrw9Urv@&pad=' . $pad . '&type=item&path=' . $url . '&output=json');
|
|
|
$result = json_decode($result, true);
|
|
|
if ($result['resultCode'] != 200)
|
|
|
$notice = $result['notice'] . $result['details'];
|
|
|
}
|
|
|
return $notice;
|
|
|
}
|
|
|
|
|
|
//获取产品信息,提供给用户选择进行绑定
|
|
|
function get_products()
|
|
|
{
|
|
|
$HT_productType = $this->input->post('product_type');
|
|
|
$HT_productName = $this->input->post('product_name');
|
|
|
//产品类型
|
|
|
switch ($HT_productType) {
|
|
|
case 't':
|
|
|
$data['productList'] = $this->Landscape_model->search_list($HT_productName);
|
|
|
break;
|
|
|
default:
|
|
|
$data['productList'] = array();
|
|
|
break;
|
|
|
}
|
|
|
$data['product_type'] = $HT_productType;
|
|
|
$product_list_page = $this->load->view('bootstrap/information_select_product', $data, true);
|
|
|
$data = array();
|
|
|
$data[] = array('name' => 'ok', 'value' => $product_list_page);
|
|
|
echo json_encode($data);
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
//显示备份的内容
|
|
|
function backup_content($log_id)
|
|
|
{
|
|
|
$data['log_info'] = $this->Logs_model->read($log_id);
|
|
|
if ($data['log_info']->log_action == 'backup_amp') {
|
|
|
$data['log_list'] = $this->Logs_model->get_all_backup_list($data['log_info']->log_res_id, true);
|
|
|
} else {
|
|
|
$data['log_list'] = $this->Logs_model->get_all_backup_list($data['log_info']->log_res_id);
|
|
|
}
|
|
|
$this->load->view('bootstrap/header', $data);
|
|
|
$this->load->view('bootstrap/information_backup_content');
|
|
|
$this->load->view('bootstrap/footer');
|
|
|
}
|
|
|
|
|
|
//保存自定义配置
|
|
|
function save_meta()
|
|
|
{
|
|
|
$im_ic_id = $this->input->post('im_ic_id');
|
|
|
$im_key = $this->input->post('im_key');
|
|
|
$im_value = $this->input->post('im_value');
|
|
|
if ($im_ic_id && $im_key && $im_value !== false) {
|
|
|
$meta = $this->InfoMetas_model->get($im_ic_id, $im_key);
|
|
|
if ($meta === false) {
|
|
|
$this->InfoMetas_model->add($im_ic_id, $im_key, $im_value);
|
|
|
} else {
|
|
|
$this->InfoMetas_model->update($im_ic_id, $im_key, $im_value);
|
|
|
}
|
|
|
$data[] = array('name' => 'ok', 'value' => $this->lang->line('media_save_success'));
|
|
|
} else {
|
|
|
$data[] = array('name' => 'no', 'value' => $this->lang->line('media_save_error'));
|
|
|
}
|
|
|
echo json_encode($data);
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
//保存自定义配置
|
|
|
function delete_meta()
|
|
|
{
|
|
|
$im_ic_id = $this->input->post('im_ic_id');
|
|
|
$im_key = $this->input->post('im_key');
|
|
|
if ($im_ic_id && $im_key) {
|
|
|
|
|
|
$this->InfoMetas_model->delete($im_ic_id, $im_key);
|
|
|
$data[] = array('name' => 'ok', 'value' => $this->lang->line('media_delete_success'));
|
|
|
} else {
|
|
|
$data[] = array('name' => 'no', 'value' => $this->lang->line('media_save_error'));
|
|
|
}
|
|
|
echo json_encode($data);
|
|
|
return true;
|
|
|
}
|
|
|
}
|