fix new gm domain

master
LMR 8 months ago
parent 229dc18b46
commit 7fe372f556

@ -397,7 +397,7 @@ $config['site'] = [
'jh' => ['site_code' => 'jh', 'site_id' => 186, 'site_lgc' => '1', 'sitemap_name' => '', 'site_image_url' => 'https://images.japanhighlights.com', 'site_url' => 'https://www.japanhighlights.com', 'site_sitemap' => '', 'site_authors' => ['X', 'sfx'], 'site_user' => [',ycc,sfx,X,']], 'jh' => ['site_code' => 'jh', 'site_id' => 186, 'site_lgc' => '1', 'sitemap_name' => '', 'site_image_url' => 'https://images.japanhighlights.com', 'site_url' => 'https://www.japanhighlights.com', 'site_sitemap' => '', 'site_authors' => ['X', 'sfx'], 'site_user' => [',ycc,sfx,X,']],
'htravel' => ['site_code' => 'htravel', 'site_id' => 187, 'site_lgc' => '1', 'sitemap_name' => '', 'site_image_url' => 'https://images.highlightstravel.com', 'site_url' => 'https://www.highlightstravel.com', 'site_sitemap' => '', 'site_authors' => ['X', 'sfx'], 'site_user' => [',ycc,sfx,X,']], 'htravel' => ['site_code' => 'htravel', 'site_id' => 187, 'site_lgc' => '1', 'sitemap_name' => '', 'site_image_url' => 'https://images.highlightstravel.com', 'site_url' => 'https://www.highlightstravel.com', 'site_sitemap' => '', 'site_authors' => ['X', 'sfx'], 'site_user' => [',ycc,sfx,X,']],
'gh' => ['site_code' => 'gh', 'site_id' => 163, 'site_lgc' => '1', 'sitemap_name' => '', 'site_image_url' => 'https://images.globalhighlights.com', 'site_url' => 'https://www.globalhighlights.com', 'site_sitemap' => '', 'site_authors' => ['X', 'sfx'], 'site_user' => [',ycc,sfx,X,']], 'gh' => ['site_code' => 'gh', 'site_id' => 163, 'site_lgc' => '1', 'sitemap_name' => '', 'site_image_url' => 'https://images.globalhighlights.com', 'site_url' => 'https://www.globalhighlights.com', 'site_sitemap' => '', 'site_authors' => ['X', 'sfx'], 'site_user' => [',ycc,sfx,X,']],
'gm' => ['site_code' => 'gm', 'site_id' => 22, 'site_lgc' => '4', 'site_url' => 'https://www.chinarundreisen.com', 'site_image_url' => '//bilder.chinarundreisen.com', 'site_authors' => ['DX', 'X', 'K', 'Lan', 'lmr', 'zyh', 'ZYHL', 'TDJ'], 'site_user' => ',ycc,lmr,B,zyh,DX,X,K,htc,zm,bhn,Lan,Tony,zyh,J,v,ZYHL,TDJ,LYY,shw,'], 'gm' => ['site_code' => 'gm', 'site_id' => 22, 'site_lgc' => '4', 'site_url' => 'https://www.chinahighlightstravel.de', 'site_image_url' => '//images.chinahighlightstravel.de', 'site_authors' => ['DX', 'X', 'K', 'Lan', 'lmr', 'zyh', 'ZYHL', 'TDJ'], 'site_user' => ',ycc,lmr,B,zyh,DX,X,K,htc,zm,bhn,Lan,Tony,zyh,J,v,ZYHL,TDJ,LYY,shw,'],
'gh_gm' => ['site_code' => 'gh_gm', 'site_id' => 178, 'site_lgc' => '4', 'site_url' => 'https://www.globalhighlights.de', 'site_image_url' => '//www.globalhighlights.de', 'site_authors' => ['DX', 'X', 'K', 'Lan', 'lmr', 'zyh', 'ZYHL', 'TDJ'], 'site_user' => ',ycc,lmr,B,zyh,DX,X,K,htc,zm,bhn,Lan,Tony,zyh,J,v,ZYHL,TDJ,LYY,shw,'], 'gh_gm' => ['site_code' => 'gh_gm', 'site_id' => 178, 'site_lgc' => '4', 'site_url' => 'https://www.globalhighlights.de', 'site_image_url' => '//www.globalhighlights.de', 'site_authors' => ['DX', 'X', 'K', 'Lan', 'lmr', 'zyh', 'ZYHL', 'TDJ'], 'site_user' => ',ycc,lmr,B,zyh,DX,X,K,htc,zm,bhn,Lan,Tony,zyh,J,v,ZYHL,TDJ,LYY,shw,'],
'vc' => ['site_code' => 'vc', 'site_id' => 30, 'site_lgc' => '5', 'site_url' => 'https://www.chinahighlights.fr', 'site_image_url' => '//images.chinahighlights.fr', 'site_authors' => ['JE', 'kq', 'lya', 'lyz', 'zyh'], 'site_user' => ',ycc,lmr, zyh,JE,htc,kq,lya,bhn,Tony,zyh,B,J,lyz,LYY,'], 'vc' => ['site_code' => 'vc', 'site_id' => 30, 'site_lgc' => '5', 'site_url' => 'https://www.chinahighlights.fr', 'site_image_url' => '//images.chinahighlights.fr', 'site_authors' => ['JE', 'kq', 'lya', 'lyz', 'zyh'], 'site_user' => ',ycc,lmr, zyh,JE,htc,kq,lya,bhn,Tony,zyh,B,J,lyz,LYY,'],
'gh_vc' => ['site_code' => 'gh_vc', 'site_id' => 180, 'site_lgc' => '5', 'site_url' => 'https://www.globalhighlights.fr', 'site_image_url' => '//www.globalhighlights.fr', 'site_authors' => ['JE', 'kq', 'lya', 'lyz', 'zyh'], 'site_user' => ',ycc,lmr, zyh,JE,htc,kq,lya,bhn,Tony,zyh,B,J,lyz,LYY,'], 'gh_vc' => ['site_code' => 'gh_vc', 'site_id' => 180, 'site_lgc' => '5', 'site_url' => 'https://www.globalhighlights.fr', 'site_image_url' => '//www.globalhighlights.fr', 'site_authors' => ['JE', 'kq', 'lya', 'lyz', 'zyh'], 'site_user' => ',ycc,lmr, zyh,JE,htc,kq,lya,bhn,Tony,zyh,B,J,lyz,LYY,'],
@ -450,7 +450,7 @@ $config['cache']['gh_it']['cache_path'] = 'D:\wwwcache-intl\globalhighlights.it
//静态文件站点域名 //静态文件站点域名
$config['cache']['jp']['site_url'] = 'https://www.arachina.com'; $config['cache']['jp']['site_url'] = 'https://www.arachina.com';
$config['cache']['gm']['site_url'] = 'https://www.chinarundreisen.com'; $config['cache']['gm']['site_url'] = 'https://www.chinahighlightstravel.de';
$config['cache']['vc']['site_url'] = 'https://www.chinahighlights.fr'; $config['cache']['vc']['site_url'] = 'https://www.chinahighlights.fr';
$config['cache']['vac']['site_url'] = 'https://www.chinahighlights.es'; $config['cache']['vac']['site_url'] = 'https://www.chinahighlights.es';
$config['cache']['ru']['site_url'] = 'https://www.chinahighlights.ru'; $config['cache']['ru']['site_url'] = 'https://www.chinahighlights.ru';
@ -534,7 +534,7 @@ $config['access_super_manage'] = ['ycc', 'lmr', 'lyj', 'rz', 'zp'];
$config['css_source_cht'] = 'https://data.chinahighlights.com/css/min.php?f=/public/css/global.min.css,/css/festival-detail.css'; $config['css_source_cht'] = 'https://data.chinahighlights.com/css/min.php?f=/public/css/global.min.css,/css/festival-detail.css';
$config['css_source_ch'] = 'https://data.chinahighlights.com/css/mobile-first.css'; $config['css_source_ch'] = 'https://data.chinahighlights.com/css/mobile-first.css';
$config['css_source_gm'] = 'https://data.chinarundreisen.com/public/pkg/css/baselAlRkXMnl750806T065919409Z.css'; $config['css_source_gm'] = 'https://data.chinahighlightstravel.de/public/pkg/css/baselAlRkXMnl750806T065919409Z.css';
$config['css_source_vc'] = 'https://data.chinahighlights.fr/information-view/tools/min/?v=20150611&f=/bootstrap/css/bootstrap.min.css,/information/css/base.css,/information/css/r/Header.css,/information/css/r/PublicContent.css,/information/css/r/footergray.css,/information/js/i18n/jquery.ui.datepicker/smoothness/jquery.min.css,/information/css/tip-yellowsimple/tip-yellowsimple.css,/information/css/private-vc.css'; $config['css_source_vc'] = 'https://data.chinahighlights.fr/information-view/tools/min/?v=20150611&f=/bootstrap/css/bootstrap.min.css,/information/css/base.css,/information/css/r/Header.css,/information/css/r/PublicContent.css,/information/css/r/footergray.css,/information/js/i18n/jquery.ui.datepicker/smoothness/jquery.min.css,/information/css/tip-yellowsimple/tip-yellowsimple.css,/information/css/private-vc.css';
$config['css_source_vac'] = 'https://data.viaje-a-china.com/information-view/tools/min/?v=20150611&f=/bootstrap/css/bootstrap.min.css,/information/css/base.css,/information/css/r/Header.css,/information/css/r/PublicContent.css,/information/css/r/footergray.css,/information/js/i18n/jquery.ui.datepicker/smoothness/jquery.min.css,/information/css/tip-yellowsimple/tip-yellowsimple.css,/information/css/private-vac.css'; $config['css_source_vac'] = 'https://data.viaje-a-china.com/information-view/tools/min/?v=20150611&f=/bootstrap/css/bootstrap.min.css,/information/css/base.css,/information/css/r/Header.css,/information/css/r/PublicContent.css,/information/css/r/footergray.css,/information/js/i18n/jquery.ui.datepicker/smoothness/jquery.min.css,/information/css/tip-yellowsimple/tip-yellowsimple.css,/information/css/private-vac.css';

@ -1,408 +1,405 @@
<?php <?php
if (!defined('BASEPATH')) if (! defined('BASEPATH')) {
exit('No direct script access allowed'); exit('No direct script access allowed');
}
class Welcome extends CI_Controller { class Welcome extends CI_Controller {
function __construct() { function __construct() {
parent::__construct(); parent::__construct();
$this->permission->is_admin(); $this->permission->is_admin();
//$this->output->enable_profiler(TRUE); //$this->output->enable_profiler(TRUE);
$this->load->model('Area_model'); $this->load->model('Area_model');
$this->load->model('InfoStructures_model'); $this->load->model('InfoStructures_model');
$this->load->model('Information_model'); $this->load->model('Information_model');
$this->load->model('InfoContents_model'); $this->load->model('InfoContents_model');
$this->load->model('Coupon_model'); $this->load->model('Coupon_model');
$this->load->model('Logs_model'); $this->load->model('Logs_model');
}
public function index() {
$data = [];
$data['countryList'] = $this->Area_model->get_country_list();
$data['provinceList'] = $this->Area_model->get_province_list();
$data['city_list'] = $this->Area_model->get_municipalities_list();
$data['lastEditList'] = $this->Information_model->get_last_edit_list();
$data['last_city_list'] = $this->Area_model->get_last_edit_city();
$data['groupList'] = $this->Information_model->group_list();
if (is_mobile_first()) {
$this->load->view('bootstrap3/header', $data);
$this->load->view('bootstrap3/welcome');
$this->load->view('bootstrap3/footer');
return;
} }
public function index() { if ($this->config->item('site_code') == 'pgr') {
$data=array(); $data['countryList'] = $this->Area_model->get_country_list_for_site("'589','645','632','517','31','28','609','630','9','708','709'");
$data['countryList'] = $this->Area_model->get_country_list();
$data['provinceList'] = $this->Area_model->get_province_list();
$data['city_list'] = $this->Area_model->get_municipalities_list();
$data['lastEditList'] = $this->Information_model->get_last_edit_list();
$data['last_city_list'] = $this->Area_model->get_last_edit_city();
$data['groupList']=$this->Information_model->group_list();
if(is_mobile_first() ){
$this->load->view('bootstrap3/header', $data);
$this->load->view('bootstrap3/welcome');
$this->load->view('bootstrap3/footer');
return;
}
if ($this->config->item('site_code') == 'pgr') {
$data['countryList'] = $this->Area_model->get_country_list_for_site("'589','645','632','517','31','28','609','630','9','708','709'");
}
$this->load->view('bootstrap/header', $data);
$this->load->view('bootstrap/welcome');
$this->load->view('bootstrap/footer');
} }
$this->load->view('bootstrap/header', $data);
$this->load->view('bootstrap/welcome');
$this->load->view('bootstrap/footer');
public function search($isrecommend = false) { }
//先搜索url如果找到唯一就跳走多于一条的则列出来一条没有的就去搜索信息
$data['keywords'] = $this->input->post('keywords'); public function search($isrecommend = false) {
$data['all_text_search'] = $this->input->post('all_text_search'); //全文搜索 //先搜索url如果找到唯一就跳走多于一条的则列出来一条没有的就去搜索信息
$search_url = str_replace($this->config->item('site_url'), "", $data['keywords']); $data['keywords'] = $this->input->post('keywords');
$data['search_list'] = $this->Information_model->search_url($search_url); $data['all_text_search'] = $this->input->post('all_text_search'); //全文搜索
if (count($data['search_list']) === 0) { $search_url = str_replace($this->config->item('site_url'), "", $data['keywords']);
if (!empty($data['all_text_search']) && $data['all_text_search'] == 'true') { $data['search_list'] = $this->Information_model->search_url($search_url);
$data['search_list'] = $this->Information_model->search_all_text($data['keywords'],48); if (count($data['search_list']) === 0) {
} else { if (! empty($data['all_text_search']) && $data['all_text_search'] == 'true') {
$data['search_list'] = $this->Information_model->search($data['keywords']); $data['search_list'] = $this->Information_model->search_all_text($data['keywords'], 48);
} } else {
} $data['search_list'] = $this->Information_model->search($data['keywords']);
}
if ($isrecommend) {
$data['ic_id_list'] = $this->input->post('ic_id_list') == '' ? '0' : $this->input->post('ic_id_list');
$this->load->view('bootstrap3/recommendlist', $data);
return TRUE;
} else if (count($data['search_list']) === 1) {
redirect(site_url('information/edit/' . $data['search_list'][0]->is_id));
}
$data['countryList'] = $this->Area_model->get_country_list();
$data['provinceList'] = $this->Area_model->get_province_list();
$data['city_list'] = $this->Area_model->get_municipalities_list();
$this->load->view('bootstrap/header', $data);
$this->load->view('bootstrap/welcome');
$this->load->view('bootstrap/footer');
} }
//获取所有信息URL,用来批量静态化更新 if ($isrecommend) {
public function create_all_urls($view=false) { $data['ic_id_list'] = $this->input->post('ic_id_list') == '' ? '0' : $this->input->post('ic_id_list');
set_time_limit(0); $this->load->view('bootstrap3/recommendlist', $data);
$this->output->enable_profiler(false); return TRUE;
$data['all_information'] = $this->Information_model->GetList('ic_status,ic_id,ic_url,ic_sitecode,is_id'); } else if (count($data['search_list']) === 1) {
if ($view == 'amp') { redirect(site_url('information/edit/' . $data['search_list'][0]->is_id));
$this->load->view('bootstrap3/header', $data);
$this->load->view('bootstrap3/refresh_amp_urls');
$this->load->view('bootstrap3/footer');
} else {
$this->load->view('bootstrap/header', $data);
$this->load->view('bootstrap/cache_url', $data);
$this->load->view('bootstrap/footer');
}
} }
//获取某个信息节点和子节点url $data['countryList'] = $this->Area_model->get_country_list();
//$is_parent_id 结构id或者是url $data['provinceList'] = $this->Area_model->get_province_list();
public function create_infomation_urls($is_parent_id, $view = false) { $data['city_list'] = $this->Area_model->get_municipalities_list();
$ic_url=$this->input->get_post('ic_url');
if(!empty($ic_url)){ $this->load->view('bootstrap/header', $data);
$structure = $this->Information_model->Detail($ic_url); $this->load->view('bootstrap/welcome');
}else{ $this->load->view('bootstrap/footer');
$structure = $this->InfoStructures_model->Detail($is_parent_id); }
}
//获取所有信息URL,用来批量静态化更新
if (empty($structure)) { public function create_all_urls($view = false) {
show_404(); set_time_limit(0);
return false; $this->output->enable_profiler(false);
} $data['all_information'] = $this->Information_model->GetList('ic_status,ic_id,ic_url,ic_sitecode,is_id');
$data['all_information'] = $this->Information_model->get_list_by_path($structure->is_path,false,false,'is_id,ic_url,ic_id,ic_status'); if ($view == 'amp') {
$this->load->view('bootstrap3/header', $data); $this->load->view('bootstrap3/header', $data);
switch ($view){ $this->load->view('bootstrap3/refresh_amp_urls');
case 'amp': $this->load->view('bootstrap3/footer');
$this->load->view('bootstrap3/refresh_amp_urls'); } else {
break; $this->load->view('bootstrap/header', $data);
case 'mobile-first': $this->load->view('bootstrap/cache_url', $data);
$this->load->view('bootstrap3/refresh_mobile_first_urls'); $this->load->view('bootstrap/footer');
break;
default:
$this->load->view('bootstrap/cache_url', $data);
}
$this->load->view('bootstrap/footer');
} }
}
//根据信息节点ID获取信息用于搜索结果的批量更新静态页面
public function create_infomation_urls_by_ids($view = false){ //获取某个信息节点和子节点url
$is_ids=$this->input->get('key'); //$is_parent_id 结构id或者是url
if (empty($is_ids)) { public function create_infomation_urls($is_parent_id, $view = false) {
show_404(); $ic_url = $this->input->get_post('ic_url');
return false; if (! empty($ic_url)) {
} $structure = $this->Information_model->Detail($ic_url);
$data['all_information'] = $this->Information_model->get_detail_by_ids($is_ids); } else {
if ($view == 'amp') { $structure = $this->InfoStructures_model->Detail($is_parent_id);
$this->load->view('bootstrap3/header', $data);
$this->load->view('bootstrap3/refresh_amp_urls');
$this->load->view('bootstrap3/footer');
} else {
$this->load->view('bootstrap/header', $data);
$this->load->view('bootstrap/cache_url', $data);
$this->load->view('bootstrap/footer');
}
}
public function get_infomation_urls($is_parent_id) {
$this->output->enable_profiler(FALSE);
$structure = $this->InfoStructures_model->Detail($is_parent_id);
if (empty($structure)) {
show_404();
return false;
}
$data['all_information'] = $this->Information_model->get_list_by_path($structure->is_path);
$this->load->view('bootstrap/header', $data);
$this->load->view('bootstrap/static_url', $data);
$this->load->view('bootstrap/footer');
} }
public function get_info_backup_id($info_id) { if (empty($structure)) {
$last_backup = $this->Logs_model->get_last_backup($info_id); show_404();
if (empty($last_backup)) { return false;
$this->echo_json(array(
'status' => 'error',
'logId' => 0,
'datetime' => 0,
'username' => 0
));
} else {
$this->echo_json(array(
'status' => 'success',
'logId' => $last_backup->log_id,
'datetime' => $last_backup->log_datetime,
'username' => $last_backup->log_ht_username
));
}
} }
$data['all_information'] = $this->Information_model->get_list_by_path($structure->is_path, false, false, 'is_id,ic_url,ic_id,ic_status');
public function change_static_url($info_id) { $this->load->view('bootstrap3/header', $data);
$information = $this->Information_model->Detail($info_id); switch ($view) {
$htm_doc = new DOMDocument(); case 'amp':
$htm_doc->encoding = 'UTF-8'; $this->load->view('bootstrap3/refresh_amp_urls');
libxml_use_internal_errors(true); break;
$htm_doc->strictErrorChecking = false; case 'mobile-first':
if (empty($information->ic_content)) { $this->load->view('bootstrap3/refresh_mobile_first_urls');
$this->echo_json(array( break;
'status' => 'error', default:
'infoId' => $info_id, $this->load->view('bootstrap/cache_url', $data);
'message' => 'info content is empty'
));
return;
}
$htm_doc->loadHTML(
mb_convert_encoding($information->ic_content, 'HTML-ENTITIES', 'UTF-8'));
$htm_doc->normalizeDocument();
$img_list = $htm_doc->getElementsByTagName('img');
foreach ($img_list as $img) {
$img_src = $img->getAttribute('src');
$img_src = $this->check_url($img_src);
$img->setAttribute('src', $img_src);
}
$anchor_list = $htm_doc->getElementsByTagName('a');
foreach ($anchor_list as $anchor) {
$a_href = $anchor->getAttribute('href');
echo 'a.href: ' . $a_href . '<br>';
$match_result = array();
preg_match('/^http:\/\/www.chinahighlights.com(.*)/', $a_href, $match_result);
$result_count = count($match_result);
if ($result_count == 2) {
$result = '//www.chinahighlights.com' . $match_result[1];
$anchor->setAttribute('href', $result);
echo $result . '<br>';
}
}
} }
$this->load->view('bootstrap/footer');
public function count_redirect_nofollow() { }
$include_redirece_info = $this->Information_model->search_all_text('&t=78002', 2000);
echo 'redirect count: ' . count($include_redirece_info) . '<br/>'; //根据信息节点ID获取信息用于搜索结果的批量更新静态页面
$redirect_nofollow_list = array(); public function create_infomation_urls_by_ids($view = false) {
$htm_doc = new DOMDocument(); $is_ids = $this->input->get('key');
$htm_doc->encoding = 'UTF-8'; if (empty($is_ids)) {
libxml_use_internal_errors(true); show_404();
$htm_doc->strictErrorChecking = false; return false;
foreach ($include_redirece_info as $info) {
$htm_doc->loadHTML(
mb_convert_encoding($info->ic_content, 'HTML-ENTITIES', 'UTF-8'));
$htm_doc->normalizeDocument();
$anchor_list = $htm_doc->getElementsByTagName('a');
foreach ($anchor_list as $anchor) {
$a_href = $anchor->getAttribute('href');
$a_rel = $anchor->getAttribute('rel');
$match_result = array();
preg_match('/.*&t=78002$/', $a_href, $match_result);
$result_count = count($match_result);
if ($result_count > 0 && $a_rel != 'nofollow') {
echo $info->ic_url . ' | ' . '(' . $info->ic_id . ',' . $info->is_id . ')' . '<br/>';
echo 'a.href: ' . $a_href . '; rel: ' . $a_rel . '<br>';
$redirect_nofollow_list[] = $info;
}
}
}
echo 'nofollow_count: ' . count($redirect_nofollow_list) . '<br/>';
return $redirect_nofollow_list;
} }
$data['all_information'] = $this->Information_model->get_detail_by_ids($is_ids);
public function transform_redirect_nofollow() { if ($view == 'amp') {
$redirect_nofollow_list = $this->count_redirect_nofollow(); $this->load->view('bootstrap3/header', $data);
$htm_doc = new DOMDocument(); $this->load->view('bootstrap3/refresh_amp_urls');
$htm_doc->encoding = 'UTF-8'; $this->load->view('bootstrap3/footer');
libxml_use_internal_errors(true); } else {
$htm_doc->strictErrorChecking = false; $this->load->view('bootstrap/header', $data);
$this->load->view('bootstrap/cache_url', $data);
foreach ($redirect_nofollow_list as $info) { $this->load->view('bootstrap/footer');
$htm_doc->loadHTML(
mb_convert_encoding($info->ic_content, 'HTML-ENTITIES', 'UTF-8'));
$htm_doc->normalizeDocument();
$anchor_list = $htm_doc->getElementsByTagName('a');
foreach ($anchor_list as $anchor) {
$a_rel = $anchor->getAttribute('rel');
$anchor->setAttribute('rel', 'nofollow');
$this->Logs_model->backup($info->is_id, $info->ic_content);
$info->ic_content = $htm_doc->saveHTML();
$this->InfoContents_model->Update(
$info->ic_id, $info->ic_url, $info->ic_url_title, $info->ic_type, $info->ic_title, $info->ic_content, $info->ic_summary, $info->ic_seo_title, $info->ic_seo_description, $info->ic_seo_keywords, $info->ic_show_bread_crumbs, $info->ic_status, $info->ic_template, $info->ic_photo, $info->ic_photo_width, $info->ic_photo_height, $info->ic_recommend_tours, $info->ic_recommend_packages, $info->ic_ht_area_id, $info->ic_ht_area_type, $info->ic_ht_product_id, $info->ic_ht_product_type, $info->ic_author);
}
}
echo 'update_nofollow_count: ' . count($redirect_nofollow_list) . '<br/>';
} }
}
public function count_http_of_href() {
$data['all_information'] = $this->Information_model->search_all_text('http://www.chinahighlights.com/', 2000); public function get_infomation_urls($is_parent_id) {
echo 'count: ' . count($data['all_information']) . '<br/>'; $this->output->enable_profiler(FALSE);
var_dump($data['all_information']); $structure = $this->InfoStructures_model->Detail($is_parent_id);
if (empty($structure)) {
show_404();
return false;
} }
$data['all_information'] = $this->Information_model->get_list_by_path($structure->is_path);
public function transform_href_to_https() {
$http_host = 'http://www.chinahighlights.com/'; $this->load->view('bootstrap/header', $data);
$https_host = 'https://www.chinahighlights.com/'; $this->load->view('bootstrap/static_url', $data);
$data['all_information'] = $this->Information_model->search_all_text($http_host, 200); $this->load->view('bootstrap/footer');
echo 'count: ' . count($data['all_information']) . '<br/>'; }
if (empty($data['all_information'])) {
echo 'nothing transform to https'; public function get_info_backup_id($info_id) {
} else { $last_backup = $this->Logs_model->get_last_backup($info_id);
foreach ($data['all_information'] as $item) { if (empty($last_backup)) {
$this->echo_json([
if (empty($item->ic_url)) { 'status' => 'error',
echo '<span style="color: red;">[' . $item->ic_title . '] [' . $item->ic_url . ']</span> <br/>'; 'logId' => 0,
continue; 'datetime' => 0,
} else { 'username' => 0,
echo $item->ic_url . ' | ' . $item->ic_title . '<br/>'; ]);
} } else {
$this->echo_json([
$this->Logs_model->backup($item->is_id, $item->ic_content); 'status' => 'success',
$item->ic_content = str_replace($http_host, $https_host, $item->ic_content); 'logId' => $last_backup->log_id,
$this->InfoContents_model->Update( 'datetime' => $last_backup->log_datetime,
$item->ic_id, $item->ic_url, $item->ic_url_title, $item->ic_type, $item->ic_title, $item->ic_content, $item->ic_summary, $item->ic_seo_title, $item->ic_seo_description, $item->ic_seo_keywords, $item->ic_show_bread_crumbs, $item->ic_status, $item->ic_template, $item->ic_photo, $item->ic_photo_width, $item->ic_photo_height, $item->ic_recommend_tours, $item->ic_recommend_packages, $item->ic_ht_area_id, $item->ic_ht_area_type, $item->ic_ht_product_id, $item->ic_ht_product_type, $item->ic_author 'username' => $last_backup->log_ht_username,
); ]);
}
}
} }
}
private function echo_json($obj) {
$this->output public function change_static_url($info_id) {
->set_content_type('application/json') $information = $this->Information_model->Detail($info_id);
->set_output(json_encode($obj)); $htm_doc = new DOMDocument();
$htm_doc->encoding = 'UTF-8';
libxml_use_internal_errors(true);
$htm_doc->strictErrorChecking = false;
if (empty($information->ic_content)) {
$this->echo_json([
'status' => 'error',
'infoId' => $info_id,
'message' => 'info content is empty',
]);
return;
} }
$htm_doc->loadHTML(
//批量替换二级域名如图片或者data域名 mb_convert_encoding($information->ic_content, 'HTML-ENTITIES', 'UTF-8'));
function replace_hostname($topnum) { $htm_doc->normalizeDocument();
$data = array(); $img_list = $htm_doc->getElementsByTagName('img');
$find_host = 'http://data.chinarundreisen.com/'; //http://bilder.chinarundreisen.com/ foreach ($img_list as $img) {
$new_host = '//data.chinarundreisen.com/'; $img_src = $img->getAttribute('src');
$data['all_information'] = $this->Information_model->search_all_text($find_host, $topnum); $img_src = $this->check_url($img_src);
if ($data['all_information']) { $img->setAttribute('src', $img_src);
foreach ($data['all_information'] as $item) {
echo $item->ic_url . '<br/>';
$item->ic_content = str_replace($find_host, $new_host, $item->ic_content);
$this->InfoContents_model->Update(
$item->ic_id, $item->ic_url, $item->ic_url_title, $item->ic_type, $item->ic_title, $item->ic_content, $item->ic_summary, $item->ic_seo_title, $item->ic_seo_description, $item->ic_seo_keywords, $item->ic_show_bread_crumbs, $item->ic_status, $item->ic_template, $item->ic_photo, $item->ic_photo_width, $item->ic_photo_height, $item->ic_recommend_tours, $item->ic_recommend_packages, $item->ic_ht_area_id, $item->ic_ht_area_type, $item->ic_ht_product_id, $item->ic_ht_product_type, $item->ic_author
);
}
} else {
echo 'all done';
}
} }
private function check_url($subject) { $anchor_list = $htm_doc->getElementsByTagName('a');
$result = $subject; foreach ($anchor_list as $anchor) {
$check_rules = array( $a_href = $anchor->getAttribute('href');
'/^\/image\/(.*)/' => '//data.chinahighlights.com/image/', echo 'a.href: ' . $a_href . '<br>';
'/^\/pic\/(.*)/' => '//data.chinahighlights.com/pic/',
'/^\/allpicture\/(.*)/' => '//data.chinahighlights.com/allpicture/', $match_result = [];
'/^http:\/\/images.chinahighlights.com(.*)/' => '//images.chinahighlights.com', preg_match('/^http:\/\/www.chinahighlights.com(.*)/', $a_href, $match_result);
'/^http:\/\/data.chinahighlights.com(.*)/' => '//data.chinahighlights.com', $result_count = count($match_result);
'/^http:\/\/www.chinahighlights.com(.*)/' => '//www.chinahighlights.com'); if ($result_count == 2) {
$result = '//www.chinahighlights.com' . $match_result[1];
foreach ($check_rules as $pattern => $replace) { $anchor->setAttribute('href', $result);
$result = $this->replace_url($pattern, $replace, $result); echo $result . '<br>';
} }
return $result;
} }
private function replace_url($pattern, $replace, $subject) { }
$result = $subject;
$match_result = array(); public function count_redirect_nofollow() {
preg_match($pattern, $subject, $match_result); $include_redirece_info = $this->Information_model->search_all_text('&t=78002', 2000);
echo 'redirect count: ' . count($include_redirece_info) . '<br/>';
$redirect_nofollow_list = [];
$htm_doc = new DOMDocument();
$htm_doc->encoding = 'UTF-8';
libxml_use_internal_errors(true);
$htm_doc->strictErrorChecking = false;
foreach ($include_redirece_info as $info) {
$htm_doc->loadHTML(
mb_convert_encoding($info->ic_content, 'HTML-ENTITIES', 'UTF-8'));
$htm_doc->normalizeDocument();
$anchor_list = $htm_doc->getElementsByTagName('a');
foreach ($anchor_list as $anchor) {
$a_href = $anchor->getAttribute('href');
$a_rel = $anchor->getAttribute('rel');
$match_result = [];
preg_match('/.*&t=78002$/', $a_href, $match_result);
$result_count = count($match_result); $result_count = count($match_result);
if ($result_count == 2) { if ($result_count > 0 && $a_rel != 'nofollow') {
$result = $replace . $match_result[1]; echo $info->ic_url . ' | ' . '(' . $info->ic_id . ',' . $info->is_id . ')' . '<br/>';
echo 'a.href: ' . $a_href . '; rel: ' . $a_rel . '<br>';
$redirect_nofollow_list[] = $info;
} }
return $result; }
}
echo 'nofollow_count: ' . count($redirect_nofollow_list) . '<br/>';
return $redirect_nofollow_list;
}
public function transform_redirect_nofollow() {
$redirect_nofollow_list = $this->count_redirect_nofollow();
$htm_doc = new DOMDocument();
$htm_doc->encoding = 'UTF-8';
libxml_use_internal_errors(true);
$htm_doc->strictErrorChecking = false;
foreach ($redirect_nofollow_list as $info) {
$htm_doc->loadHTML(
mb_convert_encoding($info->ic_content, 'HTML-ENTITIES', 'UTF-8'));
$htm_doc->normalizeDocument();
$anchor_list = $htm_doc->getElementsByTagName('a');
foreach ($anchor_list as $anchor) {
$a_rel = $anchor->getAttribute('rel');
$anchor->setAttribute('rel', 'nofollow');
$this->Logs_model->backup($info->is_id, $info->ic_content);
$info->ic_content = $htm_doc->saveHTML();
$this->InfoContents_model->Update(
$info->ic_id, $info->ic_url, $info->ic_url_title, $info->ic_type, $info->ic_title, $info->ic_content, $info->ic_summary, $info->ic_seo_title, $info->ic_seo_description, $info->ic_seo_keywords, $info->ic_show_bread_crumbs, $info->ic_status, $info->ic_template, $info->ic_photo, $info->ic_photo_width, $info->ic_photo_height, $info->ic_recommend_tours, $info->ic_recommend_packages, $info->ic_ht_area_id, $info->ic_ht_area_type, $info->ic_ht_product_id, $info->ic_ht_product_type, $info->ic_author);
}
} }
//生肖促销订单查询 echo 'update_nofollow_count: ' . count($redirect_nofollow_list) . '<br/>';
public function coupon() { }
$data['countryList'] = $this->Area_model->get_country_list();
$data['provinceList'] = $this->Area_model->get_province_list(); public function count_http_of_href() {
$data['city_list'] = $this->Area_model->get_municipalities_list(); $data['all_information'] = $this->Information_model->search_all_text('http://www.chinahighlights.com/', 2000);
$data['coupon'] = $this->Coupon_model->getlist(); echo 'count: ' . count($data['all_information']) . '<br/>';
var_dump($data['all_information']);
}
public function transform_href_to_https() {
$http_host = 'http://www.chinahighlights.com/';
$https_host = 'https://www.chinahighlights.com/';
$data['all_information'] = $this->Information_model->search_all_text($http_host, 200);
echo 'count: ' . count($data['all_information']) . '<br/>';
if (empty($data['all_information'])) {
echo 'nothing transform to https';
} else {
foreach ($data['all_information'] as $item) {
if (empty($item->ic_url)) {
echo '<span style="color: red;">[' . $item->ic_title . '] [' . $item->ic_url . ']</span> <br/>';
continue;
} else {
echo $item->ic_url . ' | ' . $item->ic_title . '<br/>';
}
$this->load->view('bootstrap/header', $data); $this->Logs_model->backup($item->is_id, $item->ic_content);
$this->load->view('bootstrap/welcome'); $item->ic_content = str_replace($http_host, $https_host, $item->ic_content);
$this->load->view('bootstrap/footer'); $this->InfoContents_model->Update(
$item->ic_id, $item->ic_url, $item->ic_url_title, $item->ic_type, $item->ic_title, $item->ic_content, $item->ic_summary, $item->ic_seo_title, $item->ic_seo_description, $item->ic_seo_keywords, $item->ic_show_bread_crumbs, $item->ic_status, $item->ic_template, $item->ic_photo, $item->ic_photo_width, $item->ic_photo_height, $item->ic_recommend_tours, $item->ic_recommend_packages, $item->ic_ht_area_id, $item->ic_ht_area_type, $item->ic_ht_product_id, $item->ic_ht_product_type, $item->ic_author
);
}
} }
}
public function set_path($is_id, $parent_path = '') {
$parent_path = str_replace('-', ',', $parent_path); private function echo_json($obj) {
$parent_path = trim($parent_path, ','); $this->output
if ($parent_path != '') ->set_content_type('application/json')
$parent_path .= ','; ->set_output(json_encode($obj));
$this->load->model('Import_model'); }
$this->Import_model->set_path($is_id, $parent_path);
echo 'ok'; //批量替换二级域名如图片或者data域名
function replace_hostname($topnum) {
$data = [];
$find_host = 'http://data.chinahighlightstravel.de/'; //http://images.chinahighlightstravel.de/
$new_host = '//data.chinahighlightstravel.de/';
$data['all_information'] = $this->Information_model->search_all_text($find_host, $topnum);
if ($data['all_information']) {
foreach ($data['all_information'] as $item) {
echo $item->ic_url . '<br/>';
$item->ic_content = str_replace($find_host, $new_host, $item->ic_content);
$this->InfoContents_model->Update(
$item->ic_id, $item->ic_url, $item->ic_url_title, $item->ic_type, $item->ic_title, $item->ic_content, $item->ic_summary, $item->ic_seo_title, $item->ic_seo_description, $item->ic_seo_keywords, $item->ic_show_bread_crumbs, $item->ic_status, $item->ic_template, $item->ic_photo, $item->ic_photo_width, $item->ic_photo_height, $item->ic_recommend_tours, $item->ic_recommend_packages, $item->ic_ht_area_id, $item->ic_ht_area_type, $item->ic_ht_product_id, $item->ic_ht_product_type, $item->ic_author
);
}
} else {
echo 'all done';
} }
}
public function search_by_icid() {
$ic_id_list = $this->input->post('ic_id_list'); private function check_url($subject) {
$ic_id_list = rtrim(trim($ic_id_list), ',') . ','; $result = $subject;
$this->load->model('InfoContents_model'); $check_rules = [
$data['search_list'] = $this->InfoContents_model->get_ic_contents_by_list($ic_id_list); '/^\/image\/(.*)/' => '//data.chinahighlights.com/image/',
$data['search_type'] = 'recommended'; '/^\/pic\/(.*)/' => '//data.chinahighlights.com/pic/',
$this->load->view('bootstrap3/recommendlist', $data); '/^\/allpicture\/(.*)/' => '//data.chinahighlights.com/allpicture/',
'/^http:\/\/images.chinahighlights.com(.*)/' => '//images.chinahighlights.com',
'/^http:\/\/data.chinahighlights.com(.*)/' => '//data.chinahighlights.com',
'/^http:\/\/www.chinahighlights.com(.*)/' => '//www.chinahighlights.com'];
foreach ($check_rules as $pattern => $replace) {
$result = $this->replace_url($pattern, $replace, $result);
} }
return $result;
/** }
* @description: 用于生成一个特殊的根结点is_level和is_sort都为0CT移动优先项目用
* @param {type} private function replace_url($pattern, $replace, $subject) {
* @return: $result = $subject;
* @Date Changed: $match_result = [];
*/ preg_match($pattern, $subject, $match_result);
public function AddRootNote(){ $result_count = count($match_result);
$this->InfoContents_model->Add('', 'NewRootNote', 'root', 'NewRootNote', '', '', '', '', '', 0, 0, '', '', 0, 0, '', '', '', '', 0, if ($result_count == 2) {
'',''); $result = $replace . $match_result[1];
$this->InfoStructures_model->AddRootNote($this->InfoContents_model->insert_id); }
$is_id = $this->InfoStructures_model->insert_id; return $result;
redirect(site_url('information/edit/' . $is_id)); }
//生肖促销订单查询
public function coupon() {
$data['countryList'] = $this->Area_model->get_country_list();
$data['provinceList'] = $this->Area_model->get_province_list();
$data['city_list'] = $this->Area_model->get_municipalities_list();
$data['coupon'] = $this->Coupon_model->getlist();
$this->load->view('bootstrap/header', $data);
$this->load->view('bootstrap/welcome');
$this->load->view('bootstrap/footer');
}
public function set_path($is_id, $parent_path = '') {
$parent_path = str_replace('-', ',', $parent_path);
$parent_path = trim($parent_path, ',');
if ($parent_path != '') {
$parent_path .= ',';
} }
$this->load->model('Import_model');
$this->Import_model->set_path($is_id, $parent_path);
echo 'ok';
}
public function search_by_icid() {
$ic_id_list = $this->input->post('ic_id_list');
$ic_id_list = rtrim(trim($ic_id_list), ',') . ',';
$this->load->model('InfoContents_model');
$data['search_list'] = $this->InfoContents_model->get_ic_contents_by_list($ic_id_list);
$data['search_type'] = 'recommended';
$this->load->view('bootstrap3/recommendlist', $data);
}
/**
* @description: 用于生成一个特殊的根结点is_level和is_sort都为0CT移动优先项目用
* @param {type}
* @return:
* @Date Changed:
*/
public function AddRootNote() {
$this->InfoContents_model->Add('', 'NewRootNote', 'root', 'NewRootNote', '', '', '', '', '', 0, 0, '', '', 0, 0, '', '', '', '', 0,
'', '');
$this->InfoStructures_model->AddRootNote($this->InfoContents_model->insert_id);
$is_id = $this->InfoStructures_model->insert_id;
redirect(site_url('information/edit/' . $is_id));
}
} }

@ -1,152 +1,149 @@
<?php <?php
if (!defined('BASEPATH')) if (! defined('BASEPATH')) {
exit('No direct script access allowed'); exit('No direct script access allowed');
}
/* /*
* AMP的相关方法 * AMP的相关方法
*/ */
class Amplib class Amplib {
{
var $CI; var $CI;
public function __construct()
{
$this->CI = &get_instance();
$this->CI->load->model('Information_model');
$this->CI->load->model('InfoMetas_model');
$this->CI->load->model('Logs_model');
}
public function edit($ic_id) public function __construct() {
{ $this->CI = &get_instance();
$data = array(); $this->CI->load->model('Information_model');
$data['information'] = $this->CI->Information_model->detail_by_ic_id($ic_id); $this->CI->load->model('InfoMetas_model');
if ($data['information'] == FALSE) { $this->CI->load->model('Logs_model');
show_404(); }
}
//查询上一次保存记录
$amp_log = $this->CI->Logs_model->get_last_edit_amp($ic_id);
if (!empty($amp_log)) {
$data['last_edit_amp_id'] = $amp_log->log_id;
} else {
$data['last_edit_amp_id'] = '';
}
$this->CI->load->view('bootstrap3/header', $data); public function edit($ic_id) {
$this->CI->load->view('amp_editor'); $data = [];
$this->CI->load->view('bootstrap3/footer'); $data['information'] = $this->CI->Information_model->detail_by_ic_id($ic_id);
if ($data['information'] == FALSE) {
show_404();
}
//查询上一次保存记录
$amp_log = $this->CI->Logs_model->get_last_edit_amp($ic_id);
if (! empty($amp_log)) {
$data['last_edit_amp_id'] = $amp_log->log_id;
} else {
$data['last_edit_amp_id'] = '';
} }
public function auto_create($ic_id) $this->CI->load->view('bootstrap3/header', $data);
{ $this->CI->load->view('amp_editor');
$data = array(); $this->CI->load->view('bootstrap3/footer');
if (strtolower($this->CI->config->item('site_code')) == 'cht') { }
$this->CI->Information_model->ic_type = "AND ic.ic_type != 'none'";
}
$data['information'] = $this->CI->Information_model->detail_by_ic_id($ic_id);
if ($data['information'] == FALSE) {
return json_encode(array('result' => 'no', 'data' => '找不到这个页面'));
}
//144.76.185.44:8029 public function auto_create($ic_id) {
//根据站点不同,配置不同参数 $data = [];
$site_code = strtolower($this->CI->config->item('site_code')); if (strtolower($this->CI->config->item('site_code')) == 'cht') {
switch ($site_code) { $this->CI->Information_model->ic_type = "AND ic.ic_type != 'none'";
case 'ah': }
//websitehost是表示资源下载的域名在网页代码中有/css/xxx.css之类的路径程序需要添加域名组成完整URL去下载文件一般是data域名或者www域名 $data['information'] = $this->CI->Information_model->detail_by_ic_id($ic_id);
$websitehost = 'https://data.asiahighlights.com'; if ($data['information'] == FALSE) {
$html_source_url = 'https://www.asiahighlights.com/index.php/information/detail/?no_cache=true&static_html_url=' . $data['information']->ic_url; return json_encode(['result' => 'no', 'data' => '找不到这个页面']);
break;
case 'cht':
$websitehost = 'https://data.chinahighlights.com';
$html_source_url = 'http://169.54.172.35:3588' . $data['information']->ic_url;
break;
case 'gm':
$websitehost = 'https://data.chinarundreisen.com';
$html_source_url = 'https://www.chinarundreisen.com/' . $data['information']->ic_url;
break;
case 'ct':
$websitehost = 'https://data.chinatravel.com';
$html_source_url = 'http://158.85.210.78:2222' . $data['information']->ic_url;
break;
default:
$websitehost = $this->CI->config->item('site_url');
$html_source_url = $this->CI->config->item('site_url') . $data['information']->ic_url;
}
//获取网页当前源码,然后发送到信息平台
$html_source = GET_HTTP($html_source_url);
if (!empty($html_source)) {
$post_data = array('websitehost' => $websitehost, 'template_name' => $site_code, 'create_amp' => 'true', 'htmlsource' => $html_source);
//德语站点走另外一个控制器,其他站点还是走原来的流程
if ($site_code == 'gm') {
if ($data['information']->ic_url == '/massgeschneiderte-china-reisen/') {
return json_encode(array());
} else {
return GET_HTTP(site_url('/apps/htmlcompressor/index_gm/choose_way'), $post_data, 'POST');
}
} elseif ($site_code == 'ah') {
return GET_HTTP(site_url('/apps/htmlcompressor/index_ah/choose_way'), $post_data, 'POST');
} else {
return GET_HTTP(site_url('/apps/htmlcompressor/index/optimize'), $post_data, 'POST');
}
}
return json_encode(array('result' => 'no', 'data' => '不知道哪里错了,看代码'));
} }
public function edit_save($ic_id = false, $textarea_htmlcode = false, $amp_status = false) //144.76.185.44:8029
{ //根据站点不同,配置不同参数
$data = array(); $site_code = strtolower($this->CI->config->item('site_code'));
if ($ic_id === false) { switch ($site_code) {
$ic_id = $this->CI->input->post('ic_id'); case 'ah':
} //websitehost是表示资源下载的域名在网页代码中有/css/xxx.css之类的路径程序需要添加域名组成完整URL去下载文件一般是data域名或者www域名
if ($textarea_htmlcode === false) { $websitehost = 'https://data.asiahighlights.com';
$textarea_htmlcode = $this->CI->input->post('textarea_htmlcode'); $html_source_url = 'https://www.asiahighlights.com/index.php/information/detail/?no_cache=true&static_html_url=' . $data['information']->ic_url;
} break;
if ($amp_status === false) { case 'cht':
$amp_status = $this->CI->input->post('amp_status'); $websitehost = 'https://data.chinahighlights.com';
$html_source_url = 'http://169.54.172.35:3588' . $data['information']->ic_url;
break;
case 'gm':
$websitehost = 'https://data.chinahighlightstravel.de';
$html_source_url = 'https://www.chinarundreisen.com/' . $data['information']->ic_url;
break;
case 'ct':
$websitehost = 'https://data.chinatravel.com';
$html_source_url = 'http://158.85.210.78:2222' . $data['information']->ic_url;
break;
default:
$websitehost = $this->CI->config->item('site_url');
$html_source_url = $this->CI->config->item('site_url') . $data['information']->ic_url;
}
//获取网页当前源码,然后发送到信息平台
$html_source = GET_HTTP($html_source_url);
if (! empty($html_source)) {
$post_data = ['websitehost' => $websitehost, 'template_name' => $site_code, 'create_amp' => 'true', 'htmlsource' => $html_source];
//德语站点走另外一个控制器,其他站点还是走原来的流程
if ($site_code == 'gm') {
if ($data['information']->ic_url == '/massgeschneiderte-china-reisen/') {
return json_encode([]);
} else {
return GET_HTTP(site_url('/apps/htmlcompressor/index_gm/choose_way'), $post_data, 'POST');
} }
$data['information'] = $this->CI->Information_model->detail_by_ic_id($ic_id); } elseif ($site_code == 'ah') {
return GET_HTTP(site_url('/apps/htmlcompressor/index_ah/choose_way'), $post_data, 'POST');
} else {
return GET_HTTP(site_url('/apps/htmlcompressor/index/optimize'), $post_data, 'POST');
}
}
return json_encode(['result' => 'no', 'data' => '不知道哪里错了,看代码']);
}
if ($data['information'] == FALSE) { public function edit_save($ic_id = false, $textarea_htmlcode = false, $amp_status = false) {
show_404(); $data = [];
} if ($ic_id === false) {
$ic_id = $this->CI->input->post('ic_id');
}
if ($textarea_htmlcode === false) {
$textarea_htmlcode = $this->CI->input->post('textarea_htmlcode');
}
if ($amp_status === false) {
$amp_status = $this->CI->input->post('amp_status');
}
$data['information'] = $this->CI->Information_model->detail_by_ic_id($ic_id);
//CH的页面没有canonical内容在这里帮补上 if ($data['information'] == FALSE) {
$textarea_htmlcode = str_replace('<!--@CANONICAL@-->', $this->CI->config->item('site_url') . $data['information']->ic_url, $textarea_htmlcode); show_404();
}
//备份修改的代码
$this->CI->Logs_model->write('backup_amp', $ic_id, $textarea_htmlcode);
//AMP格式验证
if ($amp_status !== '0') {//只有发布的时候才需要验证
//把AMP网页内容到purifycss处理内置了AMP-Validator
$purifycss_server = 'http://169.54.167.189:33033/';
if ($this->CI->config->item('site_code' == 'gm')) {//德语站点使用自己的css处理服务器
$purifycss_server = 'http://158.177.67.52:33033/';
}
$validator_result = GET_HTTP($purifycss_server, 'amp_source=' . urlencode($textarea_htmlcode), 'POST');
$validator_result = json_decode($validator_result);
if ($validator_result->status == 'FAIL') {
return json_encode(array('name' => 'no', 'value' => $validator_result->errors));
}
}
$amp = $this->CI->InfoMetas_model->get($ic_id, 'AMP');
if ($amp === false) {
$this->CI->InfoMetas_model->add($ic_id, 'AMP', $textarea_htmlcode);
} else {
$this->CI->InfoMetas_model->update($ic_id, 'AMP', $textarea_htmlcode);
}
$amp_status_value = $this->CI->InfoMetas_model->get($ic_id, 'AMP_STATUS'); //CH的页面没有canonical内容在这里帮补上
if ($amp_status_value === false) { $textarea_htmlcode = str_replace('<!--@CANONICAL@-->', $this->CI->config->item('site_url') . $data['information']->ic_url, $textarea_htmlcode);
$this->CI->InfoMetas_model->add($ic_id, 'AMP_STATUS', $amp_status);
} else { //备份修改的代码
$this->CI->InfoMetas_model->update($ic_id, 'AMP_STATUS', $amp_status); $this->CI->Logs_model->write('backup_amp', $ic_id, $textarea_htmlcode);
}
//AMP格式验证
if ($amp_status !== '0') { //只有发布的时候才需要验证
//把AMP网页内容到purifycss处理内置了AMP-Validator
$purifycss_server = 'http://169.54.167.189:33033/';
if ($this->CI->config->item('site_code' == 'gm')) { //德语站点使用自己的css处理服务器
$purifycss_server = 'http://158.177.67.52:33033/';
}
$validator_result = GET_HTTP($purifycss_server, 'amp_source=' . urlencode($textarea_htmlcode), 'POST');
$validator_result = json_decode($validator_result);
if ($validator_result->status == 'FAIL') {
return json_encode(['name' => 'no', 'value' => $validator_result->errors]);
}
}
$amp = $this->CI->InfoMetas_model->get($ic_id, 'AMP');
if ($amp === false) {
$this->CI->InfoMetas_model->add($ic_id, 'AMP', $textarea_htmlcode);
} else {
$this->CI->InfoMetas_model->update($ic_id, 'AMP', $textarea_htmlcode);
}
return json_encode(array('name' => 'ok', 'value' => $this->CI->lang->line('form_info_success'))); $amp_status_value = $this->CI->InfoMetas_model->get($ic_id, 'AMP_STATUS');
if ($amp_status_value === false) {
$this->CI->InfoMetas_model->add($ic_id, 'AMP_STATUS', $amp_status);
} else {
$this->CI->InfoMetas_model->update($ic_id, 'AMP_STATUS', $amp_status);
} }
return json_encode(['name' => 'ok', 'value' => $this->CI->lang->line('form_info_success')]);
}
} }

@ -1,167 +1,168 @@
<?php <?php
if (!defined('BASEPATH')) exit('No direct script access allowed'); if (! defined('BASEPATH')) {
exit('No direct script access allowed');
}
class Index_ah extends CI_Controller class Index_ah extends CI_Controller {
{
public function __construct(){ public function __construct() {
parent::__construct(); parent::__construct();
$this->load->library('simple_html_dom_lib'); $this->load->library('simple_html_dom_lib');
} }
public function index(){ public function index() {
$this->load->view('welcome'); $this->load->view('welcome');
} }
//选择处理方式 //选择处理方式
public function choose_way(){ public function choose_way() {
$this->htmlsource = $this->input->post('htmlsource'); $this->htmlsource = $this->input->post('htmlsource');
$this->websitehost = $this->input->post('websitehost'); $this->websitehost = $this->input->post('websitehost');
$this->template_name = $this->input->post('template_name'); $this->template_name = $this->input->post('template_name');
$this->create_amp = $this->input->post('create_amp'); $this->create_amp = $this->input->post('create_amp');
$this->debug = $this->input->post('debug'); $this->debug = $this->input->post('debug');
/*$this->htmlsource = file_get_contents('aa.htm'); /*$this->htmlsource = file_get_contents('aa.htm');
$this->websitehost = 'https://data.chinarundreisen.com'; $this->websitehost = 'https://data.chinahighlightstravel.de';
$this->create_amp = 'true'; $this->create_amp = 'true';
$this->template_name = 'gm';*/ $this->template_name = 'gm';*/
if (empty($this->htmlsource) || empty($this->websitehost)) { if (empty($this->htmlsource) || empty($this->websitehost)) {
$this->output->set_status_header(500); $this->output->set_status_header(500);
echo 'error:htmlsource or websitehost is empty!'; echo 'error:htmlsource or websitehost is empty!';
log_message('error', "htmlsource or websitehost is empty! " . $this->websitehost); log_message('error', "htmlsource or websitehost is empty! " . $this->websitehost);
return false; return false;
} }
//域名后面不能有/
if (substr($this->websitehost, -1, 1) == '/') {
$this->websitehost = substr($this->websitehost, 0, -1);
}
//进行页面解析
$this->html_object = str_get_html($this->htmlsource);
//PC或AMP的构造方式
if (! empty($this->create_amp)) {
echo $this->create_amp();
return;
} else {
echo $this->optimize();
return;
}
}
//html优化处理
function optimize() {
//提取css样式地址
$link_css_array = [];
$css_content = '';
foreach ($this->html_object->find('link') as $link_css) {
//将所有的样式链接存储为一个数组
if ($link_css->rel == 'stylesheet' && ! empty($link_css->href)) {
$link_css_array[] = $link_css->href;
$link_css->outertext = ''; //删除链接
}
}
//循环下载所有的css样式拼接成字符串
foreach ($link_css_array as $item) {
$get_http_temp = GET_HTTP($this->format_url($item, $this->websitehost));
if ($get_http_temp == false) {
$this->output->set_status_header(404);
echo 'CSS文件下载错误';
log_message('error', "optimize CSS文件下载错误! " . $item);
return FALSE;
}
$css_content .= $get_http_temp;
}
//域名后面不能有/ //找出所有style写的内置样式
if (substr($this->websitehost, -1, 1) == '/') { foreach ($this->html_object->find('style') as $style_css) {
$this->websitehost = substr($this->websitehost, 0, -1); if ($style_css->type == "text/css") {
$css_content .= $style_css->innertext;
}
}
//提取和下载所有JS脚本包括链接文件和页面脚本
$link_js_array = [];
$js_inline_content = '';
$js_jquery_content = '';
foreach ($this->html_object->find('script') as $link_script) {
if (! empty($link_script->src)) {
if (empty($link_script->defer) && empty($link_script->async)) { //没有defer标记的才处理否则让js延后加载
$link_js_array[] = $link_script->src;
$link_script->outertext = ''; //删除链接,移动到页底
}
} else {
//网页内的js不需要提取
//$js_content.= $link_script->innertext;//js的内容
// $js_content.= $link_script;//js的内容包含<script>
//含有$表示调用了jquery的函数添加延迟加载defer
//包含gtm的js引入就跳出本次循环
if (strpos($link_script, 'https://www.googletagmanager.com/gtm.js')) {
continue;
}
if (strpos($link_script, '$') !== FALSE) {
$js_jquery_content .= $link_script->innertext;
} else {
$js_inline_content .= $link_script; //js的内容包含<script>
} }
$link_script->outertext = ''; //删除js移动到页底
}
}
$js_scr_content = '';
foreach ($link_js_array as $item) {
$get_http_temp = GET_HTTP($this->format_url($item, $this->websitehost));
if ($get_http_temp == false) {
$this->output->set_status_header(404);
echo 'JS文件下载错误';
log_message('error', "optimize js文件下载错误! " . $item);
return FALSE;
}
$js_scr_content .= $get_http_temp;
}
//把网页内容和css提交到purifycss处理
$purifycss_server = 'http://169.54.167.189:33033/';
$optimize_css = GET_HTTP($purifycss_server, 'html_source=' . urlencode($this->htmlsource) . '&html_css=' . urlencode($css_content), 'POST');
if (empty($optimize_css)) {
$this->output->set_status_header(500);
echo 'css精简错误';
return FALSE;
}
//把精简的css添加到head前面
$this->html_object = str_replace('</head>', '<style type="text/css">' . $optimize_css . "</style></head>", $this->html_object);
//删除多余空格和换行符
$this->html_object = str_replace([" ", "\t", "\n", "\r"], " ", $this->html_object);
//循环n次把双空格替换为一个空格
for ($i = 0; $i <= 4; $i++) {
$this->html_object = str_replace(" ", " ", $this->html_object);
}
//在最后加载原始css文件和js文件
//把css移动到页面底部延迟加载
$lastload_js = '<noscript id="deferred-styles">';
foreach ($link_css_array as $item) {
$lastload_js .= '<link rel="stylesheet" type="text/css" href="' . $item . '"/>';
}
$lastload_js .= '</noscript><script>var loadDeferredStyles=function(){var addStylesNode=document.getElementById("deferred-styles");var replacement=document.createElement("div");replacement.innerHTML=addStylesNode.textContent;document.body.appendChild(replacement);addStylesNode.parentElement.removeChild(addStylesNode)};var raf=requestAnimationFrame||mozRequestAnimationFrame||webkitRequestAnimationFrame||msRequestAnimationFrame;if(raf){raf(function(){window.setTimeout(loadDeferredStyles,0)})}else{window.addEventListener("load",loadDeferredStyles)};</script>';
//进行页面解析 $js_content = $js_scr_content . $js_jquery_content;
$this->html_object = str_get_html($this->htmlsource); //延迟加载js需要把返回的js代码保存到一个文件中然后替换占位符以便加载js文件
$lastload_js .= '<script async src="##DEFERSCRIPTDEFER##"></script>';
//PC或AMP的构造方式 $lastload_js .= $js_inline_content;
if (!empty($this->create_amp)) {
echo $this->create_amp(); $this->html_object = str_replace('</body>', $lastload_js . '</body>', $this->html_object);
return; echo json_encode(['result' => 'ok', 'data' => ['html_object' => $this->html_object, 'js_content' => $js_content]]);
}else{ }
echo $this->optimize();
return; //生成AMP版本 用移动端版本生成
} /*
}
//html优化处理
function optimize(){
//提取css样式地址
$link_css_array = array();
$css_content = '';
foreach ($this->html_object->find('link') as $link_css) {
//将所有的样式链接存储为一个数组
if ($link_css->rel == 'stylesheet' && !empty($link_css->href)) {
$link_css_array[] = $link_css->href;
$link_css->outertext = ''; //删除链接
}
}
//循环下载所有的css样式拼接成字符串
foreach ($link_css_array as $item) {
$get_http_temp = GET_HTTP($this->format_url($item, $this->websitehost));
if ($get_http_temp == false) {
$this->output->set_status_header(404);
echo 'CSS文件下载错误';
log_message('error', "optimize CSS文件下载错误! " . $item);
return FALSE;
}
$css_content .= $get_http_temp;
}
//找出所有style写的内置样式
foreach ($this->html_object->find('style') as $style_css) {
if ($style_css->type == "text/css") {
$css_content .= $style_css->innertext;
}
}
//提取和下载所有JS脚本包括链接文件和页面脚本
$link_js_array = array();
$js_inline_content = '';
$js_jquery_content = '';
foreach ($this->html_object->find('script') as $link_script) {
if (!empty($link_script->src)) {
if (empty($link_script->defer) && empty($link_script->async)) { //没有defer标记的才处理否则让js延后加载
$link_js_array[] = $link_script->src;
$link_script->outertext = ''; //删除链接,移动到页底
}
} else {
//网页内的js不需要提取
//$js_content.= $link_script->innertext;//js的内容
// $js_content.= $link_script;//js的内容包含<script>
//含有$表示调用了jquery的函数添加延迟加载defer
//包含gtm的js引入就跳出本次循环
if(strpos($link_script, 'https://www.googletagmanager.com/gtm.js')){
continue;
}
if (strpos($link_script, '$') !== FALSE) {
$js_jquery_content .= $link_script->innertext;
} else {
$js_inline_content .= $link_script; //js的内容包含<script>
}
$link_script->outertext = ''; //删除js移动到页底
}
}
$js_scr_content = '';
foreach ($link_js_array as $item) {
$get_http_temp = GET_HTTP($this->format_url($item, $this->websitehost));
if ($get_http_temp == false) {
$this->output->set_status_header(404);
echo 'JS文件下载错误';
log_message('error', "optimize js文件下载错误! " . $item);
return FALSE;
}
$js_scr_content .= $get_http_temp;
}
//把网页内容和css提交到purifycss处理
$purifycss_server = 'http://169.54.167.189:33033/';
$optimize_css = GET_HTTP($purifycss_server, 'html_source=' . urlencode($this->htmlsource) . '&html_css=' . urlencode($css_content), 'POST');
if (empty($optimize_css)) {
$this->output->set_status_header(500);
echo 'css精简错误';
return FALSE;
}
//把精简的css添加到head前面
$this->html_object = str_replace('</head>', '<style type="text/css">' . $optimize_css . "</style></head>", $this->html_object);
//删除多余空格和换行符
$this->html_object = str_replace(array(" ", "\t", "\n", "\r"), " ", $this->html_object);
//循环n次把双空格替换为一个空格
for ($i = 0; $i <= 4; $i++) {
$this->html_object = str_replace(" ", " ", $this->html_object);
}
//在最后加载原始css文件和js文件
//把css移动到页面底部延迟加载
$lastload_js = '<noscript id="deferred-styles">';
foreach ($link_css_array as $item) {
$lastload_js .= '<link rel="stylesheet" type="text/css" href="' . $item . '"/>';
}
$lastload_js .= '</noscript><script>var loadDeferredStyles=function(){var addStylesNode=document.getElementById("deferred-styles");var replacement=document.createElement("div");replacement.innerHTML=addStylesNode.textContent;document.body.appendChild(replacement);addStylesNode.parentElement.removeChild(addStylesNode)};var raf=requestAnimationFrame||mozRequestAnimationFrame||webkitRequestAnimationFrame||msRequestAnimationFrame;if(raf){raf(function(){window.setTimeout(loadDeferredStyles,0)})}else{window.addEventListener("load",loadDeferredStyles)};</script>';
$js_content = $js_scr_content . $js_jquery_content;
//延迟加载js需要把返回的js代码保存到一个文件中然后替换占位符以便加载js文件
$lastload_js .= '<script async src="##DEFERSCRIPTDEFER##"></script>';
$lastload_js .= $js_inline_content;
$this->html_object = str_replace('</body>', $lastload_js . '</body>', $this->html_object);
echo json_encode(array('result' => 'ok', 'data' => array('html_object' => $this->html_object, 'js_content' => $js_content)));
}
//生成AMP版本 用移动端版本生成
/*
1.加载站点AMP模板模板只有导航、头部、底部 1.加载站点AMP模板模板只有导航、头部、底部
2.删除全部js引用和内链代码 2.删除全部js引用和内链代码
3.删除全部css引用内联css放入<style amp-custom> 3.删除全部css引用内联css放入<style amp-custom>
@ -172,220 +173,220 @@ class Index_ah extends CI_Controller
8.todo:增加application/ld+json 8.todo:增加application/ld+json
要求: 图片文件必须带有域名,否则的获取尺寸会出错,如 https://data.asiahighlights.com/pic/abc.jpg 要求: 图片文件必须带有域名,否则的获取尺寸会出错,如 https://data.asiahighlights.com/pic/abc.jpg
*/ */
function create_amp(){ function create_amp() {
//读取站点的AMP模板 //读取站点的AMP模板
$amp_template = $this->load->view('amp-template/' . $this->template_name, null, true); $amp_template = $this->load->view('amp-template/' . $this->template_name, null, true);
//生成移动版本,删除多余元素 //生成移动版本,删除多余元素
foreach ($this->html_object->find('.hidden-xs') as $hidden_item) { foreach ($this->html_object->find('.hidden-xs') as $hidden_item) {
$hidden_item->outertext = ''; $hidden_item->outertext = '';
} }
foreach ($this->html_object->find('title') as $title) { foreach ($this->html_object->find('title') as $title) {
$amp_template = str_replace('<!--@TITLE@-->', $title->innertext, $amp_template); $amp_template = str_replace('<!--@TITLE@-->', $title->innertext, $amp_template);
} }
foreach ($this->html_object->find('meta') as $meta) { foreach ($this->html_object->find('meta') as $meta) {
if ($meta->name == 'description') { if ($meta->name == 'description') {
$amp_template = str_replace('<!--@DESCRIPTION@-->', $meta->content, $amp_template); $amp_template = str_replace('<!--@DESCRIPTION@-->', $meta->content, $amp_template);
} }
if ($meta->name == 'keywords') { if ($meta->name == 'keywords') {
$amp_template = str_replace('<!--@KEYWORDS@-->', $meta->content, $amp_template); $amp_template = str_replace('<!--@KEYWORDS@-->', $meta->content, $amp_template);
} }
} }
foreach ($this->html_object->find('script') as $script) { foreach ($this->html_object->find('script') as $script) {
$script->outertext = ''; $script->outertext = '';
} }
foreach ($this->html_object->find('noscript') as $noscript) { foreach ($this->html_object->find('noscript') as $noscript) {
$noscript->outertext = ''; $noscript->outertext = '';
} }
foreach ($this->html_object->find('link') as $link) { foreach ($this->html_object->find('link') as $link) {
if ($link->rel == 'stylesheet' && !empty($link->href)) { if ($link->rel == 'stylesheet' && ! empty($link->href)) {
$link->outertext = ''; $link->outertext = '';
} }
if ($link->rel == 'canonical' && !empty($link->href)) { if ($link->rel == 'canonical' && ! empty($link->href)) {
$amp_template = str_replace('<!--@CANONICAL@-->', $link->href, $amp_template); $amp_template = str_replace('<!--@CANONICAL@-->', $link->href, $amp_template);
} }
} }
//获取图片尺寸AMP要求必须填写width和height //获取图片尺寸AMP要求必须填写width和height
//格式化图片URL //格式化图片URL
foreach ($this->html_object->find('img') as $image) { foreach ($this->html_object->find('img') as $image) {
if (!empty($image->src)) { if (! empty($image->src)) {
$img_src_host = parse_url($image->src, PHP_URL_HOST); $img_src_host = parse_url($image->src, PHP_URL_HOST);
if (empty($img_src_host)) { if (empty($img_src_host)) {
$img_src_host = $this->websitehost; $img_src_host = $this->websitehost;
}
$image->src = $this->format_url($image->src, $img_src_host);
}
if (!empty($image->originalsrc)) {
$img_src_host = parse_url($image->src, PHP_URL_HOST);
if (empty($img_src_host)) {
$img_src_host = $websitehost;
}
$image->originalsrc = $this->format_url($image->originalsrc, $img_src_host);
}
} }
$image->src = $this->format_url($image->src, $img_src_host);
//拼接请求的图片url如 https://data.asiahighlights.com/imagesize.php?photo=/pic/logo-ah.png,/pic/ah-slide-logo.png }
$request_size = array(); if (! empty($image->originalsrc)) {
foreach ($this->html_object->find('img') as $image) { $img_src_host = parse_url($image->src, PHP_URL_HOST);
$img_src = $image->src; if (empty($img_src_host)) {
if (!empty($image->originalsrc)) { $img_src_host = $websitehost;
$img_src = $image->originalsrc;
}
if (strpos($img_src, 'facebook.com') !== false || strpos($img_src, 'dmca.com') !== false) {//facebook dmca会添加一个跟踪代码需要删除掉否则获取图片尺寸会报错
$image->outertext = '';
continue;
}
$img_src_urls = parse_url($img_src);
$request_size[$img_src_urls['host']][] = $img_src_urls['path'];
} }
$image->originalsrc = $this->format_url($image->originalsrc, $img_src_host);
}
}
//请求图片尺寸 //拼接请求的图片url如 https://data.asiahighlights.com/imagesize.php?photo=/pic/logo-ah.png,/pic/ah-slide-logo.png
$image_sizes = array(); $request_size = [];
foreach ($request_size as $host => $path) { foreach ($this->html_object->find('img') as $image) {
$parse_url = "https://{$host}/imagesize.php?photo=" . urlencode(implode(',', $path)); $img_src = $image->src;
$size_data = GET_HTTP($parse_url); if (! empty($image->originalsrc)) {
if (!empty($size_data)) { $img_src = $image->originalsrc;
$size_data = json_decode($size_data); }
foreach ($size_data as $size_item) { if (strpos($img_src, 'facebook.com') !== false || strpos($img_src, 'dmca.com') !== false) { //facebook dmca会添加一个跟踪代码需要删除掉否则获取图片尺寸会报错
$size_item->photo = "https://{$host}" . $size_item->photo; $image->outertext = '';
$image_sizes[$size_item->photo] = $size_item; continue;
} }
} $img_src_urls = parse_url($img_src);
} $request_size[$img_src_urls['host']][] = $img_src_urls['path'];
}
//获取图片尺寸 end //请求图片尺寸
foreach ($this->html_object->find('img') as $image) { $image_sizes = [];
$img_src = $image->src; foreach ($request_size as $host => $path) {
if (!empty($image->originalsrc)) { $parse_url = "https://{$host}/imagesize.php?photo=" . urlencode(implode(',', $path));
$img_src = $image->originalsrc; $size_data = GET_HTTP($parse_url);
} if (! empty($size_data)) {
if(empty($image_sizes[$img_src])){ $size_data = json_decode($size_data);
//如果尺寸不存在则跳过 foreach ($size_data as $size_item) {
continue; $size_item->photo = "https://{$host}" . $size_item->photo;
} $image_sizes[$size_item->photo] = $size_item;
$img_size = $image_sizes[$img_src];
$img_alt = $image->alt;
$img_class = $image->class;
if (!empty($img_size)) {
//添加webp图片支持
$img_src_webp='';
$layout = 'responsive';
if(substr($img_src, -4) == '.jpg'){
if($img_size->width < 400){
$layout = 'fixed';
}
$img_src_jpg=" <amp-img fallback layout=\"{$layout}\" class=\"{$img_class}\" alt=\"{$img_alt}\" src=\"{$img_src}\" width=\"{$img_size->width}\" height=\"{$img_size->height}\"></amp-img>";
$img_src_webp=substr($img_src, 0, strlen($img_src) - 4).'.webp';
$img_src_webp = " <amp-img layout=\"{$layout}\" class=\"{$img_class}\" alt=\"{$img_alt}\" src=\"{$img_src_webp}\" width=\"{$img_size->width}\" height=\"{$img_size->height}\">{$img_src_jpg}</amp-img>";
}
if(!empty($img_src_webp)){
$image->outertext =$img_src_webp;
}else{
$image->outertext = " <amp-img layout=\"{$layout}\" class=\"{$img_class}\" alt=\"{$img_alt}\" src=\"{$img_src}\" width=\"{$img_size->width}\" height=\"{$img_size->height}\"></amp-img>";
}
}
} }
}
}
//只将中间主要部分用于css精简提高速度 //获取图片尺寸 end
foreach ($this->html_object->find('#content_main') as $content_main) { foreach ($this->html_object->find('img') as $image) {
$amp_template = str_replace('<!--@CUSTOM-CONENT@-->', $content_main, $amp_template); $img_src = $image->src;
if (! empty($image->originalsrc)) {
$img_src = $image->originalsrc;
}
if (empty($image_sizes[$img_src])) {
//如果尺寸不存在则跳过
continue;
}
$img_size = $image_sizes[$img_src];
$img_alt = $image->alt;
$img_class = $image->class;
if (! empty($img_size)) {
//添加webp图片支持
$img_src_webp = '';
$layout = 'responsive';
if (substr($img_src, -4) == '.jpg') {
if ($img_size->width < 400) {
$layout = 'fixed';
}
$img_src_jpg = " <amp-img fallback layout=\"{$layout}\" class=\"{$img_class}\" alt=\"{$img_alt}\" src=\"{$img_src}\" width=\"{$img_size->width}\" height=\"{$img_size->height}\"></amp-img>";
$img_src_webp = substr($img_src, 0, strlen($img_src) - 4) . '.webp';
$img_src_webp = " <amp-img layout=\"{$layout}\" class=\"{$img_class}\" alt=\"{$img_alt}\" src=\"{$img_src_webp}\" width=\"{$img_size->width}\" height=\"{$img_size->height}\">{$img_src_jpg}</amp-img>";
} }
if (! empty($img_src_webp)) {
//产品页面多做一些特殊的处理 $image->outertext = $img_src_webp;
foreach ($this->html_object->find('.tab-nav') as $tabnav) { } else {
$amp_template = str_replace($tabnav, '', $amp_template); $image->outertext = " <amp-img layout=\"{$layout}\" class=\"{$img_class}\" alt=\"{$img_alt}\" src=\"{$img_src}\" width=\"{$img_size->width}\" height=\"{$img_size->height}\"></amp-img>";
} }
}
}
//产品页面删除表单 //只将中间主要部分用于css精简提高速度
foreach ($this->html_object->find('.sticky') as $sticky) { foreach ($this->html_object->find('#content_main') as $content_main) {
$amp_template = str_replace($sticky, '@AMPFOOTER-BUTTON@', $amp_template); $amp_template = str_replace('<!--@CUSTOM-CONENT@-->', $content_main, $amp_template);
} }
foreach ($this->html_object->find('form') as $form) { //产品页面多做一些特殊的处理
$amp_template = str_replace($form, '', $amp_template); foreach ($this->html_object->find('.tab-nav') as $tabnav) {
} $amp_template = str_replace($tabnav, '', $amp_template);
}
if(!empty($form)){ //产品页面删除表单
$replace_text = '<script async="" custom-element="amp-form" src="https://cdn.ampproject.org/v0/amp-form-0.1.js"></script><style amp-custom>'; foreach ($this->html_object->find('.sticky') as $sticky) {
$amp_template = str_replace('<style amp-custom>',$replace_text, $amp_template); $amp_template = str_replace($sticky, '@AMPFOOTER-BUTTON@', $amp_template);
} }
//产品页面处理结束
$link_css_array = array();
$css_content = '';
foreach ($this->html_object->find('link') as $link_css) {
//将所有的样式链接存储为一个数组
if ($link_css->rel == 'stylesheet' && !empty($link_css->href)) {
$link_css_array[] = $link_css->href;
$link_css->outertext = ''; //删除链接
}
}
//循环下载所有的css样式拼接成字符串
foreach ($link_css_array as $item) {
//排除一定不会用到的css提高精简的速度
if(strpos($item,'base.css')){
$item = 'https://data.chinarundreisen.com/min/?f=/css/base.css';
}
if(strpos($item,'reiseroute.css')){
$item = 'https://data.chinarundreisen.com/min/?f=/css/reiseroute-amp.css';
}
$get_http_temp = GET_HTTP($this->format_url($item, $this->websitehost));
if ($get_http_temp == false) {
$this->output->set_status_header(404);
echo 'CSS文件下载错误';
log_message('error', "optimize CSS文件下载错误! " . $item);
return FALSE;
}
$css_content .= $get_http_temp;
}
foreach ($this->html_object->find('style') as $style) {
$css_content .= $style->innertext;
$style->outertext = '';
}
//把网页内容和css提交到purifycss处理 foreach ($this->html_object->find('form') as $form) {
$purifycss_server = 'http://169.54.167.189:33033/'; $amp_template = str_replace($form, '', $amp_template);
$optimize_css = GET_HTTP($purifycss_server, 'html_source=' . urlencode($content_main) . '&html_css=' . urlencode($css_content), 'POST'); }
if (empty($optimize_css)) {
$this->output->set_status_header(500);
echo 'css精简错误';
return FALSE;
}
$optimize_css = str_replace('!important', '', $optimize_css);
$optimize_css = str_replace('@charset "utf-8";', '', $optimize_css);
$amp_template = str_replace('/*@CUSTOM-CSS@*/', $optimize_css, $amp_template);
//替换掉写在组件上的样式
$amp_template = preg_replace('/style=.+?[\'|"]/i', '', $amp_template);
echo json_encode(array('result' => 'ok', 'data' => array('amp' => $amp_template)));
}
//格式化url保证请求的URL有域名//更换为对应的域名路径
function format_url($url, $host = ''){
if (substr($url, 0, 8) == 'https://' || substr($url, 0, 7) == 'http://') {
$url = str_replace('http://', 'https://', $url);//http要改为https
return urldecode($url);
}
if (substr($url, 0, 2) == '//') { //https或http if (! empty($form)) {
return urldecode('https://'.substr($url, 2, strlen($url)-2)); //只替换开头的//部分url不规范有//在url中间 $replace_text = '<script async="" custom-element="amp-form" src="https://cdn.ampproject.org/v0/amp-form-0.1.js"></script><style amp-custom>';
} $amp_template = str_replace('<style amp-custom>', $replace_text, $amp_template);
}
//产品页面处理结束
$link_css_array = [];
$css_content = '';
foreach ($this->html_object->find('link') as $link_css) {
//将所有的样式链接存储为一个数组
if ($link_css->rel == 'stylesheet' && ! empty($link_css->href)) {
$link_css_array[] = $link_css->href;
$link_css->outertext = ''; //删除链接
}
}
//循环下载所有的css样式拼接成字符串
foreach ($link_css_array as $item) {
//排除一定不会用到的css提高精简的速度
if (strpos($item, 'base.css')) {
$item = 'https://data.chinahighlightstravel.de/min/?f=/css/base.css';
}
if (strpos($item, 'reiseroute.css')) {
$item = 'https://data.chinahighlightstravel.de/min/?f=/css/reiseroute-amp.css';
}
$get_http_temp = GET_HTTP($this->format_url($item, $this->websitehost));
if ($get_http_temp == false) {
$this->output->set_status_header(404);
echo 'CSS文件下载错误';
log_message('error', "optimize CSS文件下载错误! " . $item);
return FALSE;
}
$css_content .= $get_http_temp;
}
return urldecode($host . $url); foreach ($this->html_object->find('style') as $style) {
$css_content .= $style->innertext;
$style->outertext = '';
} }
//把网页内容和css提交到purifycss处理
$purifycss_server = 'http://169.54.167.189:33033/';
$optimize_css = GET_HTTP($purifycss_server, 'html_source=' . urlencode($content_main) . '&html_css=' . urlencode($css_content), 'POST');
if (empty($optimize_css)) {
$this->output->set_status_header(500);
echo 'css精简错误';
return FALSE;
}
$optimize_css = str_replace('!important', '', $optimize_css);
$optimize_css = str_replace('@charset "utf-8";', '', $optimize_css);
$amp_template = str_replace('/*@CUSTOM-CSS@*/', $optimize_css, $amp_template);
//替换掉写在组件上的样式
$amp_template = preg_replace('/style=.+?[\'|"]/i', '', $amp_template);
echo json_encode(['result' => 'ok', 'data' => ['amp' => $amp_template]]);
}
//格式化url保证请求的URL有域名//更换为对应的域名路径
function format_url($url, $host = '') {
if (substr($url, 0, 8) == 'https://' || substr($url, 0, 7) == 'http://') {
$url = str_replace('http://', 'https://', $url); //http要改为https
return urldecode($url);
}
if (substr($url, 0, 2) == '//') { //https或http
return urldecode('https://' . substr($url, 2, strlen($url) - 2)); //只替换开头的//部分url不规范有//在url中间
}
return urldecode($host . $url);
}
} }

@ -1,167 +1,168 @@
<?php <?php
if (!defined('BASEPATH')) exit('No direct script access allowed'); if (! defined('BASEPATH')) {
exit('No direct script access allowed');
}
class Index_gm extends CI_Controller class Index_gm extends CI_Controller {
{
public function __construct(){ public function __construct() {
parent::__construct(); parent::__construct();
$this->load->library('simple_html_dom_lib'); $this->load->library('simple_html_dom_lib');
} }
public function index(){ public function index() {
$this->load->view('welcome'); $this->load->view('welcome');
} }
//选择处理方式 //选择处理方式
public function choose_way(){ public function choose_way() {
$this->htmlsource = $this->input->post('htmlsource'); $this->htmlsource = $this->input->post('htmlsource');
$this->websitehost = $this->input->post('websitehost'); $this->websitehost = $this->input->post('websitehost');
$this->template_name = $this->input->post('template_name'); $this->template_name = $this->input->post('template_name');
$this->create_amp = $this->input->post('create_amp'); $this->create_amp = $this->input->post('create_amp');
$this->debug = $this->input->post('debug'); $this->debug = $this->input->post('debug');
/*$this->htmlsource = file_get_contents('aa.htm'); /*$this->htmlsource = file_get_contents('aa.htm');
$this->websitehost = 'https://data.chinarundreisen.com'; $this->websitehost = 'https://data.chinahighlightstravel.de';
$this->create_amp = 'true'; $this->create_amp = 'true';
$this->template_name = 'gm';*/ $this->template_name = 'gm';*/
if (empty($this->htmlsource) || empty($this->websitehost)) { if (empty($this->htmlsource) || empty($this->websitehost)) {
$this->output->set_status_header(500); $this->output->set_status_header(500);
echo 'error:htmlsource or websitehost is empty!'; echo 'error:htmlsource or websitehost is empty!';
log_message('error', "htmlsource or websitehost is empty! " . $this->websitehost); log_message('error', "htmlsource or websitehost is empty! " . $this->websitehost);
return false; return false;
} }
//域名后面不能有/
if (substr($this->websitehost, -1, 1) == '/') {
$this->websitehost = substr($this->websitehost, 0, -1);
}
//进行页面解析
$this->html_object = str_get_html($this->htmlsource);
//PC或AMP的构造方式
if (! empty($this->create_amp)) {
echo $this->create_amp();
return;
} else {
echo $this->optimize();
return;
}
}
//html优化处理
function optimize() {
//提取css样式地址
$link_css_array = [];
$css_content = '';
foreach ($this->html_object->find('link') as $link_css) {
//将所有的样式链接存储为一个数组
if ($link_css->rel == 'stylesheet' && ! empty($link_css->href)) {
$link_css_array[] = $link_css->href;
$link_css->outertext = ''; //删除链接
}
}
//循环下载所有的css样式拼接成字符串
foreach ($link_css_array as $item) {
$get_http_temp = GET_HTTP($this->format_url($item, $this->websitehost));
if ($get_http_temp == false) {
$this->output->set_status_header(404);
echo 'CSS文件下载错误';
log_message('error', "optimize CSS文件下载错误! " . $item);
return FALSE;
}
$css_content .= $get_http_temp;
}
//域名后面不能有/ //找出所有style写的内置样式
if (substr($this->websitehost, -1, 1) == '/') { foreach ($this->html_object->find('style') as $style_css) {
$this->websitehost = substr($this->websitehost, 0, -1); if ($style_css->type == "text/css") {
$css_content .= $style_css->innertext;
}
}
//提取和下载所有JS脚本包括链接文件和页面脚本
$link_js_array = [];
$js_inline_content = '';
$js_jquery_content = '';
foreach ($this->html_object->find('script') as $link_script) {
if (! empty($link_script->src)) {
if (empty($link_script->defer) && empty($link_script->async)) { //没有defer标记的才处理否则让js延后加载
$link_js_array[] = $link_script->src;
$link_script->outertext = ''; //删除链接,移动到页底
}
} else {
//网页内的js不需要提取
//$js_content.= $link_script->innertext;//js的内容
// $js_content.= $link_script;//js的内容包含<script>
//含有$表示调用了jquery的函数添加延迟加载defer
//包含gtm的js引入就跳出本次循环
if (strpos($link_script, 'https://www.googletagmanager.com/gtm.js')) {
continue;
}
if (strpos($link_script, '$') !== FALSE) {
$js_jquery_content .= $link_script->innertext;
} else {
$js_inline_content .= $link_script; //js的内容包含<script>
} }
$link_script->outertext = ''; //删除js移动到页底
}
}
$js_scr_content = '';
foreach ($link_js_array as $item) {
$get_http_temp = GET_HTTP($this->format_url($item, $this->websitehost));
if ($get_http_temp == false) {
$this->output->set_status_header(404);
echo 'JS文件下载错误';
log_message('error', "optimize js文件下载错误! " . $item);
return FALSE;
}
$js_scr_content .= $get_http_temp;
}
//把网页内容和css提交到purifycss处理
$purifycss_server = 'http://158.177.67.52:33033/';
$optimize_css = GET_HTTP($purifycss_server, 'html_source=' . urlencode($this->htmlsource) . '&html_css=' . urlencode($css_content), 'POST');
if (empty($optimize_css)) {
$this->output->set_status_header(500);
echo 'css精简错误';
return FALSE;
}
//把精简的css添加到head前面
$this->html_object = str_replace('</head>', '<style type="text/css">' . $optimize_css . "</style></head>", $this->html_object);
//删除多余空格和换行符
$this->html_object = str_replace([" ", "\t", "\n", "\r"], " ", $this->html_object);
//循环n次把双空格替换为一个空格
for ($i = 0; $i <= 4; $i++) {
$this->html_object = str_replace(" ", " ", $this->html_object);
}
//在最后加载原始css文件和js文件
//把css移动到页面底部延迟加载
$lastload_js = '<noscript id="deferred-styles">';
foreach ($link_css_array as $item) {
$lastload_js .= '<link rel="stylesheet" type="text/css" href="' . $item . '"/>';
}
$lastload_js .= '</noscript><script>var loadDeferredStyles=function(){var addStylesNode=document.getElementById("deferred-styles");var replacement=document.createElement("div");replacement.innerHTML=addStylesNode.textContent;document.body.appendChild(replacement);addStylesNode.parentElement.removeChild(addStylesNode)};var raf=requestAnimationFrame||mozRequestAnimationFrame||webkitRequestAnimationFrame||msRequestAnimationFrame;if(raf){raf(function(){window.setTimeout(loadDeferredStyles,0)})}else{window.addEventListener("load",loadDeferredStyles)};</script>';
//进行页面解析 $js_content = $js_scr_content . $js_jquery_content;
$this->html_object = str_get_html($this->htmlsource); //延迟加载js需要把返回的js代码保存到一个文件中然后替换占位符以便加载js文件
$lastload_js .= '<script async src="##DEFERSCRIPTDEFER##"></script>';
//PC或AMP的构造方式 $lastload_js .= $js_inline_content;
if (!empty($this->create_amp)) {
echo $this->create_amp(); $this->html_object = str_replace('</body>', $lastload_js . '</body>', $this->html_object);
return; echo json_encode(['result' => 'ok', 'data' => ['html_object' => $this->html_object, 'js_content' => $js_content]]);
}else{ }
echo $this->optimize();
return; //生成AMP版本 用移动端版本生成
} /*
}
//html优化处理
function optimize(){
//提取css样式地址
$link_css_array = array();
$css_content = '';
foreach ($this->html_object->find('link') as $link_css) {
//将所有的样式链接存储为一个数组
if ($link_css->rel == 'stylesheet' && !empty($link_css->href)) {
$link_css_array[] = $link_css->href;
$link_css->outertext = ''; //删除链接
}
}
//循环下载所有的css样式拼接成字符串
foreach ($link_css_array as $item) {
$get_http_temp = GET_HTTP($this->format_url($item, $this->websitehost));
if ($get_http_temp == false) {
$this->output->set_status_header(404);
echo 'CSS文件下载错误';
log_message('error', "optimize CSS文件下载错误! " . $item);
return FALSE;
}
$css_content .= $get_http_temp;
}
//找出所有style写的内置样式
foreach ($this->html_object->find('style') as $style_css) {
if ($style_css->type == "text/css") {
$css_content .= $style_css->innertext;
}
}
//提取和下载所有JS脚本包括链接文件和页面脚本
$link_js_array = array();
$js_inline_content = '';
$js_jquery_content = '';
foreach ($this->html_object->find('script') as $link_script) {
if (!empty($link_script->src)) {
if (empty($link_script->defer) && empty($link_script->async)) { //没有defer标记的才处理否则让js延后加载
$link_js_array[] = $link_script->src;
$link_script->outertext = ''; //删除链接,移动到页底
}
} else {
//网页内的js不需要提取
//$js_content.= $link_script->innertext;//js的内容
// $js_content.= $link_script;//js的内容包含<script>
//含有$表示调用了jquery的函数添加延迟加载defer
//包含gtm的js引入就跳出本次循环
if(strpos($link_script, 'https://www.googletagmanager.com/gtm.js')){
continue;
}
if (strpos($link_script, '$') !== FALSE) {
$js_jquery_content .= $link_script->innertext;
} else {
$js_inline_content .= $link_script; //js的内容包含<script>
}
$link_script->outertext = ''; //删除js移动到页底
}
}
$js_scr_content = '';
foreach ($link_js_array as $item) {
$get_http_temp = GET_HTTP($this->format_url($item, $this->websitehost));
if ($get_http_temp == false) {
$this->output->set_status_header(404);
echo 'JS文件下载错误';
log_message('error', "optimize js文件下载错误! " . $item);
return FALSE;
}
$js_scr_content .= $get_http_temp;
}
//把网页内容和css提交到purifycss处理
$purifycss_server = 'http://158.177.67.52:33033/';
$optimize_css = GET_HTTP($purifycss_server, 'html_source=' . urlencode($this->htmlsource) . '&html_css=' . urlencode($css_content), 'POST');
if (empty($optimize_css)) {
$this->output->set_status_header(500);
echo 'css精简错误';
return FALSE;
}
//把精简的css添加到head前面
$this->html_object = str_replace('</head>', '<style type="text/css">' . $optimize_css . "</style></head>", $this->html_object);
//删除多余空格和换行符
$this->html_object = str_replace(array(" ", "\t", "\n", "\r"), " ", $this->html_object);
//循环n次把双空格替换为一个空格
for ($i = 0; $i <= 4; $i++) {
$this->html_object = str_replace(" ", " ", $this->html_object);
}
//在最后加载原始css文件和js文件
//把css移动到页面底部延迟加载
$lastload_js = '<noscript id="deferred-styles">';
foreach ($link_css_array as $item) {
$lastload_js .= '<link rel="stylesheet" type="text/css" href="' . $item . '"/>';
}
$lastload_js .= '</noscript><script>var loadDeferredStyles=function(){var addStylesNode=document.getElementById("deferred-styles");var replacement=document.createElement("div");replacement.innerHTML=addStylesNode.textContent;document.body.appendChild(replacement);addStylesNode.parentElement.removeChild(addStylesNode)};var raf=requestAnimationFrame||mozRequestAnimationFrame||webkitRequestAnimationFrame||msRequestAnimationFrame;if(raf){raf(function(){window.setTimeout(loadDeferredStyles,0)})}else{window.addEventListener("load",loadDeferredStyles)};</script>';
$js_content = $js_scr_content . $js_jquery_content;
//延迟加载js需要把返回的js代码保存到一个文件中然后替换占位符以便加载js文件
$lastload_js .= '<script async src="##DEFERSCRIPTDEFER##"></script>';
$lastload_js .= $js_inline_content;
$this->html_object = str_replace('</body>', $lastload_js . '</body>', $this->html_object);
echo json_encode(array('result' => 'ok', 'data' => array('html_object' => $this->html_object, 'js_content' => $js_content)));
}
//生成AMP版本 用移动端版本生成
/*
1.加载站点AMP模板模板只有导航、头部、底部 1.加载站点AMP模板模板只有导航、头部、底部
2.删除全部js引用和内链代码 2.删除全部js引用和内链代码
3.删除全部css引用内联css放入<style amp-custom> 3.删除全部css引用内联css放入<style amp-custom>
@ -172,220 +173,220 @@ class Index_gm extends CI_Controller
8.todo:增加application/ld+json 8.todo:增加application/ld+json
要求: 图片文件必须带有域名,否则的获取尺寸会出错,如 https://data.asiahighlights.com/pic/abc.jpg 要求: 图片文件必须带有域名,否则的获取尺寸会出错,如 https://data.asiahighlights.com/pic/abc.jpg
*/ */
function create_amp(){ function create_amp() {
//读取站点的AMP模板 //读取站点的AMP模板
$amp_template = $this->load->view('amp-template/' . $this->template_name, null, true); $amp_template = $this->load->view('amp-template/' . $this->template_name, null, true);
//生成移动版本,删除多余元素 //生成移动版本,删除多余元素
foreach ($this->html_object->find('.hidden-xs') as $hidden_item) { foreach ($this->html_object->find('.hidden-xs') as $hidden_item) {
$hidden_item->outertext = ''; $hidden_item->outertext = '';
} }
foreach ($this->html_object->find('title') as $title) { foreach ($this->html_object->find('title') as $title) {
$amp_template = str_replace('<!--@TITLE@-->', $title->innertext, $amp_template); $amp_template = str_replace('<!--@TITLE@-->', $title->innertext, $amp_template);
} }
foreach ($this->html_object->find('meta') as $meta) { foreach ($this->html_object->find('meta') as $meta) {
if ($meta->name == 'description') { if ($meta->name == 'description') {
$amp_template = str_replace('<!--@DESCRIPTION@-->', $meta->content, $amp_template); $amp_template = str_replace('<!--@DESCRIPTION@-->', $meta->content, $amp_template);
} }
if ($meta->name == 'keywords') { if ($meta->name == 'keywords') {
$amp_template = str_replace('<!--@KEYWORDS@-->', $meta->content, $amp_template); $amp_template = str_replace('<!--@KEYWORDS@-->', $meta->content, $amp_template);
} }
} }
foreach ($this->html_object->find('script') as $script) { foreach ($this->html_object->find('script') as $script) {
$script->outertext = ''; $script->outertext = '';
} }
foreach ($this->html_object->find('noscript') as $noscript) { foreach ($this->html_object->find('noscript') as $noscript) {
$noscript->outertext = ''; $noscript->outertext = '';
} }
foreach ($this->html_object->find('link') as $link) { foreach ($this->html_object->find('link') as $link) {
if ($link->rel == 'stylesheet' && !empty($link->href)) { if ($link->rel == 'stylesheet' && ! empty($link->href)) {
$link->outertext = ''; $link->outertext = '';
} }
if ($link->rel == 'canonical' && !empty($link->href)) { if ($link->rel == 'canonical' && ! empty($link->href)) {
$amp_template = str_replace('<!--@CANONICAL@-->', $link->href, $amp_template); $amp_template = str_replace('<!--@CANONICAL@-->', $link->href, $amp_template);
} }
} }
//获取图片尺寸AMP要求必须填写width和height //获取图片尺寸AMP要求必须填写width和height
//格式化图片URL //格式化图片URL
foreach ($this->html_object->find('img') as $image) { foreach ($this->html_object->find('img') as $image) {
if (!empty($image->src)) { if (! empty($image->src)) {
$img_src_host = parse_url($image->src, PHP_URL_HOST); $img_src_host = parse_url($image->src, PHP_URL_HOST);
if (empty($img_src_host)) { if (empty($img_src_host)) {
$img_src_host = $this->websitehost; $img_src_host = $this->websitehost;
}
$image->src = $this->format_url($image->src, $img_src_host);
}
if (!empty($image->originalsrc)) {
$img_src_host = parse_url($image->src, PHP_URL_HOST);
if (empty($img_src_host)) {
$img_src_host = $websitehost;
}
$image->originalsrc = $this->format_url($image->originalsrc, $img_src_host);
}
} }
$image->src = $this->format_url($image->src, $img_src_host);
//拼接请求的图片url如 https://data.asiahighlights.com/imagesize.php?photo=/pic/logo-ah.png,/pic/ah-slide-logo.png }
$request_size = array(); if (! empty($image->originalsrc)) {
foreach ($this->html_object->find('img') as $image) { $img_src_host = parse_url($image->src, PHP_URL_HOST);
$img_src = $image->src; if (empty($img_src_host)) {
if (!empty($image->originalsrc)) { $img_src_host = $websitehost;
$img_src = $image->originalsrc;
}
if (strpos($img_src, 'facebook.com') !== false || strpos($img_src, 'dmca.com') !== false) {//facebook dmca会添加一个跟踪代码需要删除掉否则获取图片尺寸会报错
$image->outertext = '';
continue;
}
$img_src_urls = parse_url($img_src);
$request_size[$img_src_urls['host']][] = $img_src_urls['path'];
} }
$image->originalsrc = $this->format_url($image->originalsrc, $img_src_host);
}
}
//请求图片尺寸 //拼接请求的图片url如 https://data.asiahighlights.com/imagesize.php?photo=/pic/logo-ah.png,/pic/ah-slide-logo.png
$image_sizes = array(); $request_size = [];
foreach ($request_size as $host => $path) { foreach ($this->html_object->find('img') as $image) {
$parse_url = "https://{$host}/imagesize.php?photo=" . urlencode(implode(',', $path)); $img_src = $image->src;
$size_data = GET_HTTP($parse_url); if (! empty($image->originalsrc)) {
if (!empty($size_data)) { $img_src = $image->originalsrc;
$size_data = json_decode($size_data); }
foreach ($size_data as $size_item) { if (strpos($img_src, 'facebook.com') !== false || strpos($img_src, 'dmca.com') !== false) { //facebook dmca会添加一个跟踪代码需要删除掉否则获取图片尺寸会报错
$size_item->photo = "https://{$host}" . $size_item->photo; $image->outertext = '';
$image_sizes[$size_item->photo] = $size_item; continue;
} }
} $img_src_urls = parse_url($img_src);
} $request_size[$img_src_urls['host']][] = $img_src_urls['path'];
}
//获取图片尺寸 end //请求图片尺寸
foreach ($this->html_object->find('img') as $image) { $image_sizes = [];
$img_src = $image->src; foreach ($request_size as $host => $path) {
if (!empty($image->originalsrc)) { $parse_url = "https://{$host}/imagesize.php?photo=" . urlencode(implode(',', $path));
$img_src = $image->originalsrc; $size_data = GET_HTTP($parse_url);
} if (! empty($size_data)) {
if(empty($image_sizes[$img_src])){ $size_data = json_decode($size_data);
//如果尺寸不存在则跳过 foreach ($size_data as $size_item) {
continue; $size_item->photo = "https://{$host}" . $size_item->photo;
} $image_sizes[$size_item->photo] = $size_item;
$img_size = $image_sizes[$img_src];
$img_alt = $image->alt;
$img_class = $image->class;
if (!empty($img_size)) {
//添加webp图片支持
$img_src_webp='';
$layout = 'responsive';
if(substr($img_src, -4) == '.jpg'){
if($img_size->width < 400){
$layout = 'fixed';
}
$img_src_jpg=" <amp-img fallback layout=\"{$layout}\" class=\"{$img_class}\" alt=\"{$img_alt}\" src=\"{$img_src}\" width=\"{$img_size->width}\" height=\"{$img_size->height}\"></amp-img>";
$img_src_webp=substr($img_src, 0, strlen($img_src) - 4).'.webp';
$img_src_webp = " <amp-img layout=\"{$layout}\" class=\"{$img_class}\" alt=\"{$img_alt}\" src=\"{$img_src_webp}\" width=\"{$img_size->width}\" height=\"{$img_size->height}\">{$img_src_jpg}</amp-img>";
}
if(!empty($img_src_webp)){
$image->outertext =$img_src_webp;
}else{
$image->outertext = " <amp-img layout=\"{$layout}\" class=\"{$img_class}\" alt=\"{$img_alt}\" src=\"{$img_src}\" width=\"{$img_size->width}\" height=\"{$img_size->height}\"></amp-img>";
}
}
} }
}
}
//只将中间主要部分用于css精简提高速度 //获取图片尺寸 end
foreach ($this->html_object->find('#content_main') as $content_main) { foreach ($this->html_object->find('img') as $image) {
$amp_template = str_replace('<!--@CUSTOM-CONENT@-->', $content_main, $amp_template); $img_src = $image->src;
if (! empty($image->originalsrc)) {
$img_src = $image->originalsrc;
}
if (empty($image_sizes[$img_src])) {
//如果尺寸不存在则跳过
continue;
}
$img_size = $image_sizes[$img_src];
$img_alt = $image->alt;
$img_class = $image->class;
if (! empty($img_size)) {
//添加webp图片支持
$img_src_webp = '';
$layout = 'responsive';
if (substr($img_src, -4) == '.jpg') {
if ($img_size->width < 400) {
$layout = 'fixed';
}
$img_src_jpg = " <amp-img fallback layout=\"{$layout}\" class=\"{$img_class}\" alt=\"{$img_alt}\" src=\"{$img_src}\" width=\"{$img_size->width}\" height=\"{$img_size->height}\"></amp-img>";
$img_src_webp = substr($img_src, 0, strlen($img_src) - 4) . '.webp';
$img_src_webp = " <amp-img layout=\"{$layout}\" class=\"{$img_class}\" alt=\"{$img_alt}\" src=\"{$img_src_webp}\" width=\"{$img_size->width}\" height=\"{$img_size->height}\">{$img_src_jpg}</amp-img>";
} }
if (! empty($img_src_webp)) {
//产品页面多做一些特殊的处理 $image->outertext = $img_src_webp;
foreach ($this->html_object->find('.tab-nav') as $tabnav) { } else {
$amp_template = str_replace($tabnav, '', $amp_template); $image->outertext = " <amp-img layout=\"{$layout}\" class=\"{$img_class}\" alt=\"{$img_alt}\" src=\"{$img_src}\" width=\"{$img_size->width}\" height=\"{$img_size->height}\"></amp-img>";
} }
}
}
//产品页面删除表单 //只将中间主要部分用于css精简提高速度
foreach ($this->html_object->find('.sticky') as $sticky) { foreach ($this->html_object->find('#content_main') as $content_main) {
$amp_template = str_replace($sticky, '@AMPFOOTER-BUTTON@', $amp_template); $amp_template = str_replace('<!--@CUSTOM-CONENT@-->', $content_main, $amp_template);
} }
foreach ($this->html_object->find('form') as $form) { //产品页面多做一些特殊的处理
$amp_template = str_replace($form, '', $amp_template); foreach ($this->html_object->find('.tab-nav') as $tabnav) {
} $amp_template = str_replace($tabnav, '', $amp_template);
}
if(!empty($form)){ //产品页面删除表单
$replace_text = '<script async="" custom-element="amp-form" src="https://cdn.ampproject.org/v0/amp-form-0.1.js"></script><style amp-custom>'; foreach ($this->html_object->find('.sticky') as $sticky) {
$amp_template = str_replace('<style amp-custom>',$replace_text, $amp_template); $amp_template = str_replace($sticky, '@AMPFOOTER-BUTTON@', $amp_template);
} }
//产品页面处理结束
$link_css_array = array();
$css_content = '';
foreach ($this->html_object->find('link') as $link_css) {
//将所有的样式链接存储为一个数组
if ($link_css->rel == 'stylesheet' && !empty($link_css->href)) {
$link_css_array[] = $link_css->href;
$link_css->outertext = ''; //删除链接
}
}
//循环下载所有的css样式拼接成字符串
foreach ($link_css_array as $item) {
//排除一定不会用到的css提高精简的速度
if(strpos($item,'base.css')){
$item = 'https://data.chinarundreisen.com/min/?f=/css/base.css';
}
if(strpos($item,'reiseroute.css')){
$item = 'https://data.chinarundreisen.com/min/?f=/css/reiseroute-amp.css';
}
$get_http_temp = GET_HTTP($this->format_url($item, $this->websitehost));
if ($get_http_temp == false) {
$this->output->set_status_header(404);
echo 'CSS文件下载错误';
log_message('error', "optimize CSS文件下载错误! " . $item);
return FALSE;
}
$css_content .= $get_http_temp;
}
foreach ($this->html_object->find('style') as $style) {
$css_content .= $style->innertext;
$style->outertext = '';
}
//把网页内容和css提交到purifycss处理 foreach ($this->html_object->find('form') as $form) {
$purifycss_server = 'http://158.177.67.52:33033/'; $amp_template = str_replace($form, '', $amp_template);
$optimize_css = GET_HTTP($purifycss_server, 'html_source=' . urlencode($content_main) . '&html_css=' . urlencode($css_content), 'POST'); }
if (empty($optimize_css)) {
$this->output->set_status_header(500);
echo 'css精简错误';
return FALSE;
}
$optimize_css = str_replace('!important', '', $optimize_css);
$optimize_css = str_replace('@charset "utf-8";', '', $optimize_css);
$amp_template = str_replace('/*@CUSTOM-CSS@*/', $optimize_css, $amp_template);
//替换掉写在组件上的样式
$amp_template = preg_replace('/style=.+?[\'|"]/i', '', $amp_template);
echo json_encode(array('result' => 'ok', 'data' => array('amp' => $amp_template)));
}
//格式化url保证请求的URL有域名//更换为对应的域名路径
function format_url($url, $host = ''){
if (substr($url, 0, 8) == 'https://' || substr($url, 0, 7) == 'http://') {
$url = str_replace('http://', 'https://', $url);//http要改为https
return urldecode($url);
}
if (substr($url, 0, 2) == '//') { //https或http if (! empty($form)) {
return urldecode('https://'.substr($url, 2, strlen($url)-2)); //只替换开头的//部分url不规范有//在url中间 $replace_text = '<script async="" custom-element="amp-form" src="https://cdn.ampproject.org/v0/amp-form-0.1.js"></script><style amp-custom>';
} $amp_template = str_replace('<style amp-custom>', $replace_text, $amp_template);
}
//产品页面处理结束
$link_css_array = [];
$css_content = '';
foreach ($this->html_object->find('link') as $link_css) {
//将所有的样式链接存储为一个数组
if ($link_css->rel == 'stylesheet' && ! empty($link_css->href)) {
$link_css_array[] = $link_css->href;
$link_css->outertext = ''; //删除链接
}
}
//循环下载所有的css样式拼接成字符串
foreach ($link_css_array as $item) {
//排除一定不会用到的css提高精简的速度
if (strpos($item, 'base.css')) {
$item = 'https://data.chinahighlightstravel.de/min/?f=/css/base.css';
}
if (strpos($item, 'reiseroute.css')) {
$item = 'https://data.chinahighlightstravel.de/min/?f=/css/reiseroute-amp.css';
}
$get_http_temp = GET_HTTP($this->format_url($item, $this->websitehost));
if ($get_http_temp == false) {
$this->output->set_status_header(404);
echo 'CSS文件下载错误';
log_message('error', "optimize CSS文件下载错误! " . $item);
return FALSE;
}
$css_content .= $get_http_temp;
}
return urldecode($host . $url); foreach ($this->html_object->find('style') as $style) {
$css_content .= $style->innertext;
$style->outertext = '';
} }
//把网页内容和css提交到purifycss处理
$purifycss_server = 'http://158.177.67.52:33033/';
$optimize_css = GET_HTTP($purifycss_server, 'html_source=' . urlencode($content_main) . '&html_css=' . urlencode($css_content), 'POST');
if (empty($optimize_css)) {
$this->output->set_status_header(500);
echo 'css精简错误';
return FALSE;
}
$optimize_css = str_replace('!important', '', $optimize_css);
$optimize_css = str_replace('@charset "utf-8";', '', $optimize_css);
$amp_template = str_replace('/*@CUSTOM-CSS@*/', $optimize_css, $amp_template);
//替换掉写在组件上的样式
$amp_template = preg_replace('/style=.+?[\'|"]/i', '', $amp_template);
echo json_encode(['result' => 'ok', 'data' => ['amp' => $amp_template]]);
}
//格式化url保证请求的URL有域名//更换为对应的域名路径
function format_url($url, $host = '') {
if (substr($url, 0, 8) == 'https://' || substr($url, 0, 7) == 'http://') {
$url = str_replace('http://', 'https://', $url); //http要改为https
return urldecode($url);
}
if (substr($url, 0, 2) == '//') { //https或http
return urldecode('https://' . substr($url, 2, strlen($url) - 2)); //只替换开头的//部分url不规范有//在url中间
}
return urldecode($host . $url);
}
} }

@ -9,7 +9,7 @@
<link rel="canonical" href="<!--@CANONICAL@-->"> <link rel="canonical" href="<!--@CANONICAL@-->">
<script async src="https://cdn.ampproject.org/v0.js"></script> <script async src="https://cdn.ampproject.org/v0.js"></script>
<script async custom-element="amp-analytics" src="https://cdn.ampproject.org/v0/amp-analytics-0.1.js"></script> <script async custom-element="amp-analytics" src="https://cdn.ampproject.org/v0/amp-analytics-0.1.js"></script>
<link rel="shortcut icon" href="https://www.chinarundreisen.com/favicon.ico" /> <link rel="shortcut icon" href="https://www.chinahighlightstravel.de/favicon.ico" />
<style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript> <style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript>
<script custom-element="amp-sidebar" src="https://cdn.ampproject.org/v0/amp-sidebar-0.1.js" async></script> <script custom-element="amp-sidebar" src="https://cdn.ampproject.org/v0/amp-sidebar-0.1.js" async></script>
<script async custom-element="amp-accordion" src="https://cdn.ampproject.org/v0/amp-accordion-0.1.js"></script> <script async custom-element="amp-accordion" src="https://cdn.ampproject.org/v0/amp-accordion-0.1.js"></script>

@ -6,13 +6,13 @@
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title>China Reisen und China Rundreisen individuell | Chinarundreisen.com</title> <title>China Reisen und China Rundreisen individuell | Chinarundreisen.com</title>
<link rel="stylesheet" href="//data.chinarundreisen.com/min/?f=/css/base.css,/css/header.css,/css/kunden-form.css"/> <link rel="stylesheet" href="//data.chinahighlightstravel.de/min/?f=/css/base.css,/css/header.css,/css/kunden-form.css"/>
<link href="https://data.chinarundreisen.com/information-view/information/css/bootstrap-datetimepicker.min.css?v=201506022" rel="stylesheet" type="text/css"/> <link href="https://data.chinahighlightstravel.de/information-view/information/css/bootstrap-datetimepicker.min.css?v=201506022" rel="stylesheet" type="text/css"/>
<script language="javascript" src="//data.chinarundreisen.com/min/?f=/js/base.js,/js/bootstrap.min.3.3.5.js,/js/lazyload.js,/js/common.js,/js/gotop.js" type="text/javascript"></script> <script language="javascript" src="//data.chinahighlightstravel.de/min/?f=/js/base.js,/js/bootstrap.min.3.3.5.js,/js/lazyload.js,/js/common.js,/js/gotop.js" type="text/javascript"></script>
<script src="https://data.chinarundreisen.com/information-view/information/js/jquery-ui.min.1-11-3.js" type="text/javascript"></script> <script src="https://data.chinahighlightstravel.de/information-view/information/js/jquery-ui.min.1-11-3.js" type="text/javascript"></script>
<script src="https://data.chinarundreisen.com/information-view/information/js/jquery-ui-timepicker-addon.js" type="text/javascript"></script> <script src="https://data.chinahighlightstravel.de/information-view/information/js/jquery-ui-timepicker-addon.js" type="text/javascript"></script>
<!--[if lt IE 9]> <!--[if lt IE 9]>
<script src="https://data.chinarundreisen.com/information-view/bootstrap/js/respond.min.js" type="text/javascript"></script> <script src="https://data.chinahighlightstravel.de/information-view/bootstrap/js/respond.min.js" type="text/javascript"></script>
<![endif]--> <![endif]-->
<style type="text/css">.popover{background-color:#f2f600;}</style> <style type="text/css">.popover{background-color:#f2f600;}</style>
</head> </head>
@ -30,10 +30,10 @@
<div class="clearfix"></div> <div class="clearfix"></div>
</div> </div>
<ul class="sidenav-menu"> <ul class="sidenav-menu">
<li> <a href="//www.chinarundreisen.com/massgeschneiderte-china-reisen/" class="active" style="margin-left:30px !important; padding-right: 50px;">Maßschneidern Ihrer Reise</a> <li> <a href="//www.chinahighlightstravel.de/massgeschneiderte-china-reisen/" class="active" style="margin-left:30px !important; padding-right: 50px;">Maßschneidern Ihrer Reise</a>
</li> </li>
<li style="position:relative"><span class="close-btn"></span> <li style="position:relative"><span class="close-btn"></span>
<a href="//www.chinarundreisen.com/china-rundreisen/" class="active">Chinarundreisen<span class="phone-arrow"></span></a> <a href="//www.chinahighlightstravel.de/china-rundreisen/" class="active">Chinarundreisen<span class="phone-arrow"></span></a>
<ul class="sidenav-dropdown" style="display:none"> <ul class="sidenav-dropdown" style="display:none">
<li><a href="/chinareisen/">China Reisen 2018</a></li> <li><a href="/chinareisen/">China Reisen 2018</a></li>
<li><a href="/china-individualreisen/">China Individualreisen</a></li> <li><a href="/china-individualreisen/">China Individualreisen</a></li>
@ -73,7 +73,7 @@
<div class="container"> <div class="container">
<div class="logo"> <div class="logo">
<a href="/"> <a href="/">
<img src="http://data.chinarundreisen.com/public/pic/common/widget/header/pic/logo1_3d64397.jpg" alt="China Highlights" /> <img src="http://data.chinahighlightstravel.de/public/pic/common/widget/header/pic/logo1_3d64397.jpg" alt="China Highlights" />
</a> </a>
</div> </div>
<div class="top-content"> <div class="top-content">
@ -295,7 +295,7 @@ Andere Abfahrts-/Ankunftszeit für
<input type="hidden" name="COLI_SN" value="<?php echo $userinfo[0]->COLI_SN; ?>"> <input type="hidden" name="COLI_SN" value="<?php echo $userinfo[0]->COLI_SN; ?>">
<input type="hidden" name="visitor_link" value="<?php echo $visitor_link; ?>"> <input type="hidden" name="visitor_link" value="<?php echo $visitor_link; ?>">
<button href="javascript:;" id="form-confirm-info" class="btn btn-danger btn-lg">Überprüfen & Absenden</button> <button href="javascript:;" id="form-confirm-info" class="btn btn-danger btn-lg">Überprüfen & Absenden</button>
<p><img src="https://data.chinarundreisen.com/pic/btn-text.jpg" width="311" height="30" /></p> <p><img src="https://data.chinahighlightstravel.de/pic/btn-text.jpg" width="311" height="30" /></p>
</div> </div>
<div class="form-footer"> <div class="form-footer">
@ -366,7 +366,7 @@ $(function(){
}); });
var coli_sn = <?php echo $userinfo[0]->COLI_SN;?>; var coli_sn = <?php echo $userinfo[0]->COLI_SN; ?>;
//ajax获取新生成页面的url //ajax获取新生成页面的url
$.ajax({ $.ajax({

@ -6,16 +6,16 @@
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title>China Reisen und China Rundreisen individuell | Chinarundreisen.com</title> <title>China Reisen und China Rundreisen individuell | Chinarundreisen.com</title>
<link href="https://data.chinarundreisen.com/information-view/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"/> <link href="https://data.chinahighlightstravel.de/information-view/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
<link href="https://data.chinarundreisen.com/information-view/information/css/order.css" rel="stylesheet" type="text/css"/> <link href="https://data.chinahighlightstravel.de/information-view/information/css/order.css" rel="stylesheet" type="text/css"/>
<link href="https://data.chinarundreisen.com/information-view/information/css/bootstrap-datetimepicker.min.css?v=201506022" rel="stylesheet" type="text/css"/> <link href="https://data.chinahighlightstravel.de/information-view/information/css/bootstrap-datetimepicker.min.css?v=201506022" rel="stylesheet" type="text/css"/>
<!--[if lt IE 9]> <!--[if lt IE 9]>
<script src="https://data.chinarundreisen.com/information-view/bootstrap/js/respond.min.js" type="text/javascript"></script> <script src="https://data.chinahighlightstravel.de/information-view/bootstrap/js/respond.min.js" type="text/javascript"></script>
<![endif]--> <![endif]-->
<script src="https://data.chinarundreisen.com/information-view/information/js/jquery.min.js" type="text/javascript"></script> <script src="https://data.chinahighlightstravel.de/information-view/information/js/jquery.min.js" type="text/javascript"></script>
<script src="https://data.chinarundreisen.com/information-view/bootstrap/js/bootstrap.js" type="text/javascript"></script> <script src="https://data.chinahighlightstravel.de/information-view/bootstrap/js/bootstrap.js" type="text/javascript"></script>
<script src="https://data.chinarundreisen.com/information-view/information/js/jquery-ui.min.1-11-3.js" type="text/javascript"></script> <script src="https://data.chinahighlightstravel.de/information-view/information/js/jquery-ui.min.1-11-3.js" type="text/javascript"></script>
<script src="https://data.chinarundreisen.com/information-view/information/js/jquery-ui-timepicker-addon.js" type="text/javascript"></script> <script src="https://data.chinahighlightstravel.de/information-view/information/js/jquery-ui-timepicker-addon.js" type="text/javascript"></script>
<style type="text/css">.popover{background-color:#f2f600;}</style> <style type="text/css">.popover{background-color:#f2f600;}</style>
</head> </head>
@ -28,20 +28,24 @@
<div class="row"> <div class="row">
<div class="col-lg-3 col-sm-4 logobox hidden-xs"> <div class="col-lg-3 col-sm-4 logobox hidden-xs">
<a href="/"> <a href="/">
<img width="135" src="http://data.chinarundreisen.com/public/pic/common/widget/header/pic/logo1_3d64397.jpg" alt="logo"> <img width="135" src="http://data.chinahighlightstravel.de/public/pic/common/widget/header/pic/logo1_3d64397.jpg" alt="logo">
</a> </a>
</div> </div>
<div class="col-lg-14 col-sm-13 col-lg-offset-3 col-sm-offset-4"> <div class="col-lg-14 col-sm-13 col-lg-offset-3 col-sm-offset-4">
<div class="navbar-header"> <div class="navbar-header">
<div class="col-xs-24 btn-lg"></div> <div class="col-xs-24 btn-lg"></div>
<div class="col-xs-24 text-white"><?php if(!isset($dear)) $dear='Liebe/r'; echo $dear; ?> <?php echo $username; ?></div> <div class="col-xs-24 text-white"><?php if (! isset($dear)) {
<div class="col-xs-24 text-white">Buchungsnummer: <?php echo $userinfo[0]->COLI_ID; ?></div> $dear = 'Liebe/r';
}
echo $dear; ?><?php echo $username; ?></div>
<div class="col-xs-24 text-white">Buchungsnummer: <?php echo $userinfo[0]->COLI_ID; ?></div>
</div> </div>
</div> </div>
<div class="col-lg-7 col-sm-7 hidden-xs pull-right nopadding"> <div class="col-lg-7 col-sm-7 hidden-xs pull-right nopadding">
<div class="tollfree pull-right" style="padding-top:10px;"> <div class="tollfree pull-right" style="padding-top:10px;">
<div class="currentNo col-sm-24 nopadding"><span class="glyphicon glyphicon-earphone" style="font-size:12px;"></span> +86 773 <?php echo $userinfo[0]->OPI_Telephone; ?>(GMT+8)</div> <div class="currentNo col-sm-24 nopadding"><span class="glyphicon glyphicon-earphone" style="font-size:12px;"></span> +86 773 <?php echo $userinfo[0]->OPI_Telephone; ?>(GMT+8)</div>
<div class="col-sm-24"> <div class="col-sm-24">
<div class="currentNo col-sm-24 nopadding"> 800-822-4462(gebührenfrei aus Deutschland)</div> <div class="currentNo col-sm-24 nopadding"> 800-822-4462(gebührenfrei aus Deutschland)</div>
</div> </div>
@ -203,7 +207,7 @@
</div> </div>
</div> </div>
</div> </div>
<?php if($userinfo[0]->COLI_CustomerType!=44003){ ?> <?php if ($userinfo[0]->COLI_CustomerType != 44003) {?>
<div class="form-group col-xs-24 Home-Address"> <div class="form-group col-xs-24 Home-Address">
<div class="input-group"> <div class="input-group">
<span class="input-group-addon" style="min-width:120px;"> <span class="input-group-addon" style="min-width:120px;">
@ -229,7 +233,7 @@
<input class="form-control input-sm visible-xs-block" name="home_address"> <input class="form-control input-sm visible-xs-block" name="home_address">
</div> </div>
</div> </div>
<?php } ?> <?php }?>
</div> </div>
</div> </div>
@ -299,7 +303,7 @@ Andere Abfahrts-/Ankunftszeit für
</div> </div>
</div> </div>
</div> </div>
<?php if($userinfo[0]->COLI_CustomerType!=44003){ ?> <?php if ($userinfo[0]->COLI_CustomerType != 44003) {?>
<div class="col-xs-24"> <div class="col-xs-24">
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-body"> <div class="panel-body">
@ -347,7 +351,7 @@ Andere Abfahrts-/Ankunftszeit für
</div> </div>
</div> </div>
</div> </div>
<?php } ?> <?php }?>
<div class="col-xs-24"> <div class="col-xs-24">
<input type="hidden" name="toname" value="<?php echo $userinfo[0]->OPI_FirstName; ?>"> <input type="hidden" name="toname" value="<?php echo $userinfo[0]->OPI_FirstName; ?>">
@ -358,7 +362,7 @@ Andere Abfahrts-/Ankunftszeit für
<div class="col-sm-15 col-xs-24 nopadding"> <div class="col-sm-15 col-xs-24 nopadding">
<button type="submit" id="btn-add-userinfo" class="btn btn-danger btn-lg col-sm-9 col-xs-24 pull-right" style="min-width:300px;font-size:24px;">Überprüfen & Absenden</button> <button type="submit" id="btn-add-userinfo" class="btn btn-danger btn-lg col-sm-9 col-xs-24 pull-right" style="min-width:300px;font-size:24px;">Überprüfen & Absenden</button>
</div> </div>
<div class="partner-text col-sm-9 col-xs-24 text-left">Danke! Mit besten Grüßen, <?php echo $userinfo[0]->OPI_FirstName; ?></div> <div class="partner-text col-sm-9 col-xs-24 text-left">Danke! Mit besten Grüßen, <?php echo $userinfo[0]->OPI_FirstName; ?></div>
</div> </div>
</form> </form>

@ -7,13 +7,13 @@
<meta name="robots" content="noindex,nofollow" /> <meta name="robots" content="noindex,nofollow" />
<title>China Reisen und China Rundreisen individuell | Chinarundreisen.com</title> <title>China Reisen und China Rundreisen individuell | Chinarundreisen.com</title>
<link href="https://data.chinarundreisen.com/information-view/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"/> <link href="https://data.chinahighlightstravel.de/information-view/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
<link href="https://data.chinarundreisen.com/information-view/information/css/order.css" rel="stylesheet" type="text/css"/> <link href="https://data.chinahighlightstravel.de/information-view/information/css/order.css" rel="stylesheet" type="text/css"/>
<!--[if lt IE 9]> <!--[if lt IE 9]>
<script src="https://data.chinarundreisen.com/information-view/bootstrap/js/respond.min.js" type="text/javascript"></script> <script src="https://data.chinahighlightstravel.de/information-view/bootstrap/js/respond.min.js" type="text/javascript"></script>
<![endif]--> <![endif]-->
<script src="https://data.chinarundreisen.com/information-view/information/js/jquery.min.js" type="text/javascript"></script> <script src="https://data.chinahighlightstravel.de/information-view/information/js/jquery.min.js" type="text/javascript"></script>
<script src="https://data.chinarundreisen.com/information-view/bootstrap/js/bootstrap.js" type="text/javascript"></script> <script src="https://data.chinahighlightstravel.de/information-view/bootstrap/js/bootstrap.js" type="text/javascript"></script>
</head> </head>
@ -26,7 +26,7 @@
<div class="row"> <div class="row">
<div class="col-lg-3 col-sm-4 logobox hidden-xs"> <div class="col-lg-3 col-sm-4 logobox hidden-xs">
<a href="/"> <a href="/">
<img width="135" src="http://data.chinarundreisen.com/public/pic/common/widget/header/pic/logo1_3d64397.jpg" alt="logo"> <img width="135" src="http://data.chinahighlightstravel.de/public/pic/common/widget/header/pic/logo1_3d64397.jpg" alt="logo">
</a> </a>
</div> </div>
<div class="col-lg-16 col-sm-13 col-lg-offset-3 col-sm-offset-4"> <div class="col-lg-16 col-sm-13 col-lg-offset-3 col-sm-offset-4">
@ -61,7 +61,7 @@
</div> </div>
<div class="modal-body" style="height:150px;"> <div class="modal-body" style="height:150px;">
<h4 style="padding-top:10px;">Für jeglichen Grund kontaktieren Sie bitte Ihren Reiseführer.</h4> <h4 style="padding-top:10px;">Für jeglichen Grund kontaktieren Sie bitte Ihren Reiseführer.</h4>
<p>----<a href="http://www.chinarundreisen.com" class="">www.chinarundreisen.com</a></p> <p>----<a href="http://www.chinahighlightstravel.de" class="">www.chinahighlightstravel.de</a></p>
</div> </div>
</div><!-- /.modal-content --> </div><!-- /.modal-content -->

@ -40,7 +40,7 @@
</div> </div>
<div class="modal-body"> <div class="modal-body">
<label>需要更新的URL</label> <label>需要更新的URL</label>
<input type="text" class="form-control" name="cdn_url" id="cdn_url" placeholder="如https://data.chinarundreisen.com/min/?f=/css/tailorbox.css" style="width:98%"/> <input type="text" class="form-control" name="cdn_url" id="cdn_url" placeholder="如https://data.chinahighlightstravel.de/min/?f=/css/tailorbox.css" style="width:98%"/>
<input type="hidden" name="updatecdn_byhand" id="updatecdn_byhand" value=""> <input type="hidden" name="updatecdn_byhand" id="updatecdn_byhand" value="">
<p class="text-danger" id="cdncache_refresh_modal_msg" name="cdncache_refresh_modal_msg"></p> <p class="text-danger" id="cdncache_refresh_modal_msg" name="cdncache_refresh_modal_msg"></p>

@ -44,7 +44,7 @@
</div> </div>
<div class="modal-body"> <div class="modal-body">
<label>需要更新的URL</label> <label>需要更新的URL</label>
<input type="text" class="form-control" name="cdn_url" id="cdn_url" placeholder="如https://data.chinarundreisen.com/min/?f=/css/tailorbox.css" /> <input type="text" class="form-control" name="cdn_url" id="cdn_url" placeholder="如https://data.chinahighlightstravel.de/min/?f=/css/tailorbox.css" />
<input type="hidden" name="updatecdn_byhand" id="updatecdn_byhand" value=""> <input type="hidden" name="updatecdn_byhand" id="updatecdn_byhand" value="">
<p class="text-danger" id="cdncache_refresh_modal_msg" name="cdncache_refresh_modal_msg"></p> <p class="text-danger" id="cdncache_refresh_modal_msg" name="cdncache_refresh_modal_msg"></p>

@ -37,18 +37,18 @@
// window.KCFinder = {}; // window.KCFinder = {};
// window.KCFinder.callBack = function (url) { // window.KCFinder.callBack = function (url) {
// <?php // <?php
// switch ($this->config->item('site_code')) { // switch ($this->config->item('site_code')) {
// case 'ah': // case 'ah':
// echo "alert(url.replace('/kcfinder/upload/ah/','https://data.asiahighlights.com/'));"; // echo "alert(url.replace('/kcfinder/upload/ah/','https://data.asiahighlights.com/'));";
// break; // break;
// case 'gm': // case 'gm':
// echo "alert(url.replace('/kcfinder/upload/gm/','https://data.chinarundreisen.com/'));"; // echo "alert(url.replace('/kcfinder/upload/gm/','https://data.chinahighlightstravel.de/'));";
// break; // break;
// default: // default:
// echo 'alert(url);'; // echo 'alert(url);';
// } // }
// ?> // ?>
// window.KCFinder = null; // window.KCFinder = null;
// }; // };
// window.open('/kcfinder/browse.php?type=<?php echo $this->config->item('site_code'); ?>', 'kcfinder_textbox', 'status=0, toolbar=0, location=0, menubar=0, directories=0,resizable=1, scrollbars=0, width=800, height=600'); // window.open('/kcfinder/browse.php?type=<?php echo $this->config->item('site_code'); ?>', 'kcfinder_textbox', 'status=0, toolbar=0, location=0, menubar=0, directories=0,resizable=1, scrollbars=0, width=800, height=600');
@ -202,21 +202,21 @@
<span class="input-group-btn"> <span class="input-group-btn">
<button class="btn btn-default btn-sm" type="submit">搜索</button> <button class="btn btn-default btn-sm" type="submit">搜索</button>
<?php if (in_array($this->config->item('site_code'), array('jp', 'gm', 'vc', 'vac', 'ru', 'it', 'gh_jp', 'gh_gm', 'gh_vc', 'gh_vac', 'gh_ru', 'gh_it'))) { ?> <?php if (in_array($this->config->item('site_code'), ['jp', 'gm', 'vc', 'vac', 'ru', 'it', 'gh_jp', 'gh_gm', 'gh_vc', 'gh_vac', 'gh_ru', 'gh_it'])) {?>
<a href="<?php <a href="<?php
$admin_info = $this->session->userdata('session_admin'); $admin_info = $this->session->userdata('session_admin');
echo 'https://multimedia.mycht.cn/authorise/' . $admin_info['OPI_SN'] . '/' . $this->config->item('site_code') ?>" echo 'https://multimedia.mycht.cn/authorise/' . $admin_info['OPI_SN'] . '/' . $this->config->item('site_code')?>"
target="_blank" class="btn btn-default btn-sm" title="多媒体图片"><span target="_blank" class="btn btn-default btn-sm" title="多媒体图片"><span
class="glyphicon glyphicon-picture"></span></a> class="glyphicon glyphicon-picture"></span></a>
<?php } else { ?> <?php } else {?>
<a href="#" onclick="openKCFinder_singleFile_res();" class="btn btn-default btn-sm" title="快速上传图片"><span <a href="#" onclick="openKCFinder_singleFile_res();" class="btn btn-default btn-sm" title="快速上传图片"><span
class="glyphicon glyphicon-picture"></span></a> class="glyphicon glyphicon-picture"></span></a>
<a target="_blank" <a target="_blank"
href="<?php href="<?php
$admin_info = $this->session->userdata('session_admin'); $admin_info = $this->session->userdata('session_admin');
echo 'https://multimedia.mycht.cn/authorise/' . $admin_info['OPI_SN'] . '/' . $this->config->item('site_code') ?>" echo 'https://multimedia.mycht.cn/authorise/' . $admin_info['OPI_SN'] . '/' . $this->config->item('site_code')?>"
class="btn btn-default btn-sm" title="多媒体图片"><span class="glyphicon glyphicon-new-window"></span></a> class="btn btn-default btn-sm" title="多媒体图片"><span class="glyphicon glyphicon-new-window"></span></a>
<?php } ?> <?php }?>
<a href="#" title="静态化更新" class="btn btn-default btn-sm" data-toggle="modal" <a href="#" title="静态化更新" class="btn btn-default btn-sm" data-toggle="modal"
data-target="#cache_refresh_modal"><span class="glyphicon glyphicon-repeat"></span></a> data-target="#cache_refresh_modal"><span class="glyphicon glyphicon-repeat"></span></a>
<a href="#" title="cdn缓存清理" class="btn btn-default btn-sm" data-toggle="modal" <a href="#" title="cdn缓存清理" class="btn btn-default btn-sm" data-toggle="modal"
@ -226,29 +226,33 @@
</form> </form>
<ul class="nav navbar-nav navbar-right"> <ul class="nav navbar-nav navbar-right">
<?php <?php
$all_unread_sms = get_all_unread_sms(); $all_unread_sms = get_all_unread_sms();
$info_unread_sms = get_all_unread_sms('info'); $info_unread_sms = get_all_unread_sms('info');
if (isset($information->ic_id)) if (isset($information->ic_id)) {
$current_msg = $information->ic_id; $current_msg = $information->ic_id;
if (isset($task->t_id))
$current_msg = $task->t_id;
$total_count = $all_unread_sms['sms_count'] + $info_unread_sms['sms_count']; //计算未读消息总数
$unread_sms_ic_id = 0; //用于设置所有收录消息为已读
if ($total_count != 0) {
?>
<!-- 如果当前页面存在未读消息,则消息数减一 -->
<?php
if (isset($current_msg) && isset($all_unread_sms['sms'][$current_msg])) {
$total_count = $total_count - count($all_unread_sms['sms'][$current_msg]);
unset($all_unread_sms['sms'][$current_msg]);
} }
?>
<?php if (isset($task->t_id)) {
if (isset($current_msg) && isset($info_unread_sms['sms'][$current_msg])) { $current_msg = $task->t_id;
$total_count = $total_count - count($info_unread_sms['sms'][$current_msg]);
unset($info_unread_sms['sms'][$current_msg]);
} }
$total_count = $all_unread_sms['sms_count'] + $info_unread_sms['sms_count']; //计算未读消息总数
$unread_sms_ic_id = 0; //用于设置所有收录消息为已读
if ($total_count != 0) {
?> ?>
<!-- 如果当前页面存在未读消息,则消息数减一 -->
<?php
if (isset($current_msg) && isset($all_unread_sms['sms'][$current_msg])) {
$total_count = $total_count - count($all_unread_sms['sms'][$current_msg]);
unset($all_unread_sms['sms'][$current_msg]);
}
?>
<?php
if (isset($current_msg) && isset($info_unread_sms['sms'][$current_msg])) {
$total_count = $total_count - count($info_unread_sms['sms'][$current_msg]);
unset($info_unread_sms['sms'][$current_msg]);
}
?>
<li class="dropdown"> <li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="icon-envelope icon-white pull-left" style="margin-top:3px;"></i> <span <i class="icon-envelope icon-white pull-left" style="margin-top:3px;"></i> <span
@ -258,53 +262,53 @@
</a> </a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<!-- 信息平台的消息 --> <!-- 信息平台的消息 -->
<?php if (isset($info_unread_sms['sms']) && !empty($info_unread_sms['sms'])) { ?> <?php if (isset($info_unread_sms['sms']) && ! empty($info_unread_sms['sms'])) {?>
<a style="padding-left:20px;" href="javascript:void(0);" <a style="padding-left:20px;" href="javascript:void(0);"
onclick="set_allmsg_to_read($('#unreadinfomsg').val());">标记全部收录信息为已读</a> onclick="set_allmsg_to_read($('#unreadinfomsg').val());">标记全部收录信息为已读</a>
<li class="divider"></li> <li class="divider"></li>
<?php foreach ($info_unread_sms['sms'] as $m) { ?> <?php foreach ($info_unread_sms['sms'] as $m) {?>
<li><a href="<?php echo site_url('information/edit/' . $m[0]->is_id); ?>"> <li><a href="<?php echo site_url('information/edit/' . $m[0]->is_id); ?>">
<?php <?php
$t_title = get_text_short($m[0]->t_title, 15); $t_title = get_text_short($m[0]->t_title, 15);
echo '[' . $m[0]->ic_sitecode . '] ' . $t_title['content'] . ' (' . $m[0]->m_content . ')'; echo '[' . $m[0]->ic_sitecode . '] ' . $t_title['content'] . ' (' . $m[0]->m_content . ')';
?> ?>
</a> </a>
</li> </li>
<?php $unread_sms_ic_id .= ',' . $m[0]->m_object_id; ?> <?php $unread_sms_ic_id .= ',' . $m[0]->m_object_id; ?>
<?php } ?> <?php }?>
<li class="divider"></li> <li class="divider"></li>
<input type="hidden" name="unreadinfomsg" id="unreadinfomsg" value="<?php echo $unread_sms_ic_id; ?>"> <input type="hidden" name="unreadinfomsg" id="unreadinfomsg" value="<?php echo $unread_sms_ic_id; ?>">
<?php } ?> <?php }?>
<!--作者平台的消息--> <!--作者平台的消息-->
<?php foreach ($all_unread_sms['sms'] as $am) { ?> <?php foreach ($all_unread_sms['sms'] as $am) {?>
<li><a href="<?php echo site_url('author/edit_task/' . $am[0]->m_object_id); ?>"> <li><a href="<?php echo site_url('author/edit_task/' . $am[0]->m_object_id); ?>">
<?php <?php
$t_title = get_text_short($am[0]->t_title, 15); $t_title = get_text_short($am[0]->t_title, 15);
echo $t_title['content'] . ' (' . count($am) . ')'; echo $t_title['content'] . ' (' . count($am) . ')';
?> ?>
</a> </a>
</li> </li>
<?php } ?> <?php }?>
</ul> </ul>
</li> </li>
<?php } ?> <?php }?>
<li class="dropdown"> <li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">
<?php <?php
echo $this->config->item('site_code'); echo $this->config->item('site_code');
echo ' -'; echo ' -';
$admin_info = $this->session->userdata('session_admin'); $admin_info = $this->session->userdata('session_admin');
echo $admin_info['OPI_Name']; echo $admin_info['OPI_Name'];
?> ?>
<b class="caret"></b> <b class="caret"></b>
</a> </a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<?php foreach ($this->config->item('site') as $site_item) { ?> <?php foreach ($this->config->item('site') as $site_item) {?>
<li> <a href="<?php echo site_url('login/change_site/' . $site_item['site_code']); ?>"> <li> <a href="<?php echo site_url('login/change_site/' . $site_item['site_code']); ?>">
<?php echo $site_item['site_code'] ?> <?php echo $site_item['site_code'] ?>
</a> </a>
</li> </li>
<?php } ?> <?php }?>
<li><a href="<?php echo site_url('login/out'); ?>">退出</a></li> <li><a href="<?php echo site_url('login/out'); ?>">退出</a></li>
</ul> </ul>
</li> </li>

File diff suppressed because it is too large Load Diff

@ -366,7 +366,7 @@
<span class="followtitle">Language</span> <span class="followtitle">Language</span>
<div class="listtour" style="display: flex;"> <div class="listtour" style="display: flex;">
<div> <div>
<ul style="width:185px;"> <ul style="width:185px;www.chinahighlightstravel.de
<li><a href="https://www.chinarundreisen.com/" target="_blank" rel="nofollow">Deutsch</a></li> <li><a href="https://www.chinarundreisen.com/" target="_blank" rel="nofollow">Deutsch</a></li>
<li><a href="https://www.voyageschine.com/" target="_blank" rel="nofollow">Français</a></li> <li><a href="https://www.voyageschine.com/" target="_blank" rel="nofollow">Français</a></li>
<li><a href="https://www.chinahighlights.es/" target="_blank" rel="nofollow">Español</a></li> <li><a href="https://www.chinahighlights.es/" target="_blank" rel="nofollow">Español</a></li>

@ -1,4 +1,6 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); <?php if (! defined('BASEPATH')) {
exit('No direct script access allowed');
}
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -14,7 +16,7 @@
| path to your installation. | path to your installation.
| |
*/ */
$config['base_url'] = ''; $config['base_url'] = '';
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -44,7 +46,7 @@ $config['index_page'] = 'author.php';
| 'ORIG_PATH_INFO' Uses the ORIG_PATH_INFO | 'ORIG_PATH_INFO' Uses the ORIG_PATH_INFO
| |
*/ */
$config['uri_protocol'] = 'AUTO'; $config['uri_protocol'] = 'AUTO';
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -69,7 +71,7 @@ $config['url_suffix'] = '';
| than english. | than english.
| |
*/ */
$config['language'] = 'english'; $config['language'] = 'english';
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -93,7 +95,6 @@ $config['charset'] = 'UTF-8';
*/ */
$config['enable_hooks'] = FALSE; $config['enable_hooks'] = FALSE;
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Class Extension Prefix | Class Extension Prefix
@ -108,7 +109,6 @@ $config['enable_hooks'] = FALSE;
*/ */
$config['subclass_prefix'] = 'MY_'; $config['subclass_prefix'] = 'MY_';
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Allowed URL Characters | Allowed URL Characters
@ -128,7 +128,6 @@ $config['subclass_prefix'] = 'MY_';
*/ */
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-'; $config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Enable Query Strings | Enable Query Strings
@ -154,11 +153,11 @@ $config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
| use segment based URLs. | use segment based URLs.
| |
*/ */
$config['allow_get_array'] = TRUE; $config['allow_get_array'] = TRUE;
$config['enable_query_strings'] = FALSE; $config['enable_query_strings'] = FALSE;
$config['controller_trigger'] = 'c'; $config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm'; $config['function_trigger'] = 'm';
$config['directory_trigger'] = 'd'; // experimental not currently in use $config['directory_trigger'] = 'd'; // experimental not currently in use
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -244,15 +243,15 @@ $config['encryption_key'] = 'pliy3rgYcV9lXeKWaO6P_author';
| 'sess_time_to_update' = how many seconds between CI refreshing Session Information | 'sess_time_to_update' = how many seconds between CI refreshing Session Information
| |
*/ */
$config['sess_cookie_name'] = 'ci_session_author'; $config['sess_cookie_name'] = 'ci_session_author';
$config['sess_expiration'] = 7200; $config['sess_expiration'] = 7200;
$config['sess_expire_on_close'] = FALSE; $config['sess_expire_on_close'] = FALSE;
$config['sess_encrypt_cookie'] = true; $config['sess_encrypt_cookie'] = true;
$config['sess_use_database'] = FALSE; $config['sess_use_database'] = FALSE;
$config['sess_table_name'] = 'ci_sessions_author'; $config['sess_table_name'] = 'ci_sessions_author';
$config['sess_match_ip'] = FALSE; $config['sess_match_ip'] = FALSE;
$config['sess_match_useragent'] = TRUE; $config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update'] = 300; $config['sess_time_to_update'] = 300;
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -265,10 +264,10 @@ $config['sess_time_to_update'] = 300;
| 'cookie_secure' = Cookies will only be set if a secure HTTPS connection exists. | 'cookie_secure' = Cookies will only be set if a secure HTTPS connection exists.
| |
*/ */
$config['cookie_prefix'] = ""; $config['cookie_prefix'] = "";
$config['cookie_domain'] = ""; $config['cookie_domain'] = "";
$config['cookie_path'] = "/"; $config['cookie_path'] = "/";
$config['cookie_secure'] = FALSE; $config['cookie_secure'] = FALSE;
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -293,10 +292,10 @@ $config['global_xss_filtering'] = FALSE;
| 'csrf_cookie_name' = The cookie name | 'csrf_cookie_name' = The cookie name
| 'csrf_expire' = The number in seconds the token should expire. | 'csrf_expire' = The number in seconds the token should expire.
*/ */
$config['csrf_protection'] = FALSE; $config['csrf_protection'] = FALSE;
$config['csrf_token_name'] = 'csrf_test_name'; $config['csrf_token_name'] = 'csrf_test_name';
$config['csrf_cookie_name'] = 'csrf_cookie_name'; $config['csrf_cookie_name'] = 'csrf_cookie_name';
$config['csrf_expire'] = 7200; $config['csrf_expire'] = 7200;
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -330,7 +329,6 @@ $config['compress_output'] = FALSE;
*/ */
$config['time_reference'] = 'local'; $config['time_reference'] = 'local';
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Rewrite PHP Short Tags | Rewrite PHP Short Tags
@ -343,7 +341,6 @@ $config['time_reference'] = 'local';
*/ */
$config['rewrite_short_tags'] = FALSE; $config['rewrite_short_tags'] = FALSE;
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Reverse Proxy IPs | Reverse Proxy IPs
@ -357,7 +354,6 @@ $config['rewrite_short_tags'] = FALSE;
*/ */
$config['proxy_ips'] = ''; $config['proxy_ips'] = '';
//多媒体中心的本地图片路径 //多媒体中心的本地图片路径
//上传图片是异步上网的所以用此url进行本地预览 //上传图片是异步上网的所以用此url进行本地预览
$config['media_image_url'] = 'http://photo.chtcdn.com:3581/upload'; $config['media_image_url'] = 'http://photo.chtcdn.com:3581/upload';
@ -365,32 +361,31 @@ $config['media_image_url'] = 'http://photo.chtcdn.com:3581/upload';
/* End of file config.php */ /* End of file config.php */
/* Location: ./application/config/config.php */ /* Location: ./application/config/config.php */
$config['site'] = [
$config['site'] = array( 'cht' => ['site_code' => 'cht', 'site_id' => 14, 'site_lgc' => '1', 'site_url' => 'http://www.chinahighlights.com'],
'cht' => array('site_code' => 'cht', 'site_id' => 14, 'site_lgc' => '1', 'site_url' => 'http://www.chinahighlights.com'), 'gm' => ['site_code' => 'gm', 'site_id' => 22, 'site_lgc' => '4', 'site_url' => 'http://www.chinahighlightstravel.de'],
'gm' => array('site_code' => 'gm', 'site_id' => 22, 'site_lgc' => '4', 'site_url' => 'http://www.chinarundreisen.com'), 'vc' => ['site_code' => 'vc', 'site_id' => 30, 'site_lgc' => '5', 'site_url' => 'http://www.voyageschine.com'],
'vc' => array('site_code' => 'vc', 'site_id' => 30, 'site_lgc' => '5', 'site_url' => 'http://www.voyageschine.com'), 'jp' => ['site_code' => 'jp', 'site_id' => 88, 'site_lgc' => '3', 'site_url' => 'http://www.arachina.com'],
'jp' => array('site_code' => 'jp', 'site_id' => 88, 'site_lgc' => '3', 'site_url' => 'http://www.arachina.com'), 'vac' => ['site_code' => 'vac', 'site_id' => 95, 'site_lgc' => '6', 'site_url' => 'http://www.viaje-a-china.com'],
'vac' => array('site_code' => 'vac', 'site_id' => 95, 'site_lgc' => '6', 'site_url' => 'http://www.viaje-a-china.com'), 'it' => ['site_code' => 'it', 'site_id' => 168, 'site_lgc' => '8', 'site_url' => 'http://www.viaggio-in-cina.it'],
'it' => array('site_code' => 'it', 'site_id' => 168, 'site_lgc' => '8', 'site_url' => 'http://www.viaggio-in-cina.it'), 'ru' => ['site_code' => 'ru', 'site_id' => 102, 'site_lgc' => '7', 'site_url' => 'http://www.chinahighlights.ru'],
'ru' => array('site_code' => 'ru', 'site_id' => 102, 'site_lgc' => '7', 'site_url' => 'http://www.chinahighlights.ru'), 'wt' => ['site_code' => 'wt', 'site_id' => 172, 'site_lgc' => '2', 'site_url' => 'http://www.iiiyooo.com'],
'wt' => array('site_code' => 'wt', 'site_id' => 172, 'site_lgc' => '2', 'site_url' => 'http://www.iiiyooo.com'), 'tbt' => ['site_code' => 'tbt', 'site_id' => 169, 'site_lgc' => '1', 'site_url' => 'http://www.tibettravel.info'],
'tbt' => array('site_code' => 'tbt', 'site_id' => 169, 'site_lgc' => '1', 'site_url' => 'http://www.tibettravel.info'), 'sht' => ['site_code' => 'sht', 'site_id' => 96, 'site_lgc' => '1', 'site_url' => 'http://www.shanghaihighlights.com'],
'sht' => array('site_code' => 'sht', 'site_id' => 96, 'site_lgc' => '1', 'site_url' => 'http://www.shanghaihighlights.com'), 'yz' => ['site_code' => 'yz', 'site_id' => 89, 'site_lgc' => '1', 'site_url' => 'http://www.yangtzeriver.org'],
'yz' => array('site_code' => 'yz', 'site_id' => 89, 'site_lgc' => '1', 'site_url' => 'http://www.yangtzeriver.org'), 'gl' => ['site_code' => 'gl', 'site_id' => 90, 'site_lgc' => '1', 'site_url' => 'http://www.guilinchina.net'],
'gl' => array('site_code' => 'gl', 'site_id' => 90, 'site_lgc' => '1', 'site_url' => 'http://www.guilinchina.net'), 'mbj' => ['site_code' => 'mbj', 'site_id' => 98, 'site_lgc' => '1', 'site_url' => 'http://www.mybeijingchina.com'],
'mbj' => array('site_code' => 'mbj', 'site_id' => 98, 'site_lgc' => '1', 'site_url' => 'http://www.mybeijingchina.com'), 'ct' => ['site_code' => 'ct', 'site_id' => 1000, 'site_lgc' => '104', 'site_url' => 'http://www.chinatravel.com'],
'ct' => array('site_code' => 'ct', 'site_id' => 1000, 'site_lgc' => '104', 'site_url' => 'http://www.chinatravel.com'), 'ah' => ['site_code' => 'ah', 'site_id' => 141, 'site_lgc' => '1', 'site_url' => 'https://www.asiahighlights.com/'],
'ah' => array('site_code' => 'ah', 'site_id' => 141, 'site_lgc' => '1', 'site_url' => 'https://www.asiahighlights.com/'), 'dct' => ['site_code' => 'dct', 'site_id' => 99, 'site_lgc' => '1', 'site_url' => 'http://www.diychinatours.com'],
'dct' => array('site_code' => 'dct', 'site_id' => 99, 'site_lgc' => '1', 'site_url' => 'http://www.diychinatours.com') ];
);
$config['auhtor_task_type'] = [
$config['auhtor_task_type'] = array( '翻译' => 'translate',
'翻译' => 'translate', '修改' => 'modify',
'修改' => 'modify', '审核' => 'review',
'审核' => 'review', '投稿' => 'contribute',
'投稿' => 'contribute' ];
);
//当前站点代号默认是cht用户登录之后修改 //当前站点代号默认是cht用户登录之后修改
$config['site_code']='cht'; $config['site_code'] = 'cht';

@ -1,115 +1,109 @@
<?php <?php
//订单号 -> IP //订单号 -> IP
// //
//{ //{
// "COLI_WebCode": "JP", // "COLI_WebCode": "JP",
// "COLI_ID": "ZPL161028068", // "COLI_ID": "ZPL161028068",
// "COLI_ApplyDate": "2016-04-15 23:17:20", // "COLI_ApplyDate": "2016-04-15 23:17:20",
// "COLI_SenderIP": "116.226.169.236" // "COLI_SenderIP": "116.226.169.236"
//} //}
// //
//CHT:http://www.chinahighlights.com/api/api.php?method=order.json_by_lmr&order_id=hy161104033 //CHT:http://www.chinahighlights.com/api/api.php?method=order.json_by_lmr&order_id=hy161104033
//国际:http://www.viaje-a-china.com/index.php/ajax/ajax_order_datas/ //国际:http://www.viaje-a-china.com/index.php/ajax/ajax_order_datas/
// //
// //
$order_id = isset($_GET['order_id']) ? $_GET['order_id'] : FALSE; $order_id = isset($_GET['order_id']) ? $_GET['order_id'] : FALSE;
$order_id = isset($_POST['order_id']) ? $_POST['order_id'] : $order_id; $order_id = isset($_POST['order_id']) ? $_POST['order_id'] : $order_id;
//$site = isset($_GET['site']) ? $_GET['site'] : FALSE; //$site = isset($_GET['site']) ? $_GET['site'] : FALSE;
//$site = isset($_POST['site']) ? $_POST['site'] : $site; //$site = isset($_POST['site']) ? $_POST['site'] : $site;
$ip = '255.255.255.255'; $ip = '255.255.255.255';
$web_code = FALSE; $web_code = FALSE;
$date = date('Y-m-d h:i:s'); $date = date('Y-m-d h:i:s');
$host = array( $host = [
'xx' => 'xx', 'xx' => 'xx',
'jp' => 'JP', 'jp' => 'JP',
'vc' => 'FR', 'vc' => 'FR',
'vac' => 'ES', 'vac' => 'ES',
'train_vac' => 'ES', 'train_vac' => 'ES',
'ru' => 'RU', 'ru' => 'RU',
'train_ru' => 'RU', 'train_ru' => 'RU',
'it' => 'IT', 'it' => 'IT',
'train_it' => 'IT', 'train_it' => 'IT',
'cht' => 'CHT', 'cht' => 'CHT',
'ct' => 'yincheng', 'ct' => 'yincheng',
'gm' => 'gm-vps', 'gm' => 'gm-vps',
'ah' => 'AH', 'ah' => 'AH',
); ];
$host_name = array( $host_name = [
'jp' => 'http://www.arachina.com', 'jp' => 'http://www.arachina.com',
'vc' => 'http://www.voyageschine.com', 'vc' => 'http://www.voyageschine.com',
'vac' => 'http://www.viaje-a-china.com', 'vac' => 'http://www.viaje-a-china.com',
'train_vac' => 'http://www.viaje-a-china.com', 'train_vac' => 'http://www.viaje-a-china.com',
'ru' => 'http://www.chinahighlights.ru', 'ru' => 'http://www.chinahighlights.ru',
'train_ru' => 'http://www.chinahighlights.ru', 'train_ru' => 'http://www.chinahighlights.ru',
'it' => 'http://www.viaggio-in-cina.it', 'it' => 'http://www.viaggio-in-cina.it',
'train_it' => 'http://www.viaggio-in-cina.it', 'train_it' => 'http://www.viaggio-in-cina.it',
'cht' => 'http://www.chinahighlights.com', 'cht' => 'http://www.chinahighlights.com',
'ct' => 'http://www.chinatravel.com', 'ct' => 'http://www.chinatravel.com',
'gm' => 'http://www.chinarundreisen.com', 'gm' => 'http://www.chinahighlightstravel.de',
'ah' => 'http://www.asiahighlights.com', 'ah' => 'http://www.asiahighlights.com',
); ];
$bf_date = date('m/d/Y:00:00:00', time() - 3600*24*90); $bf_date = date('m/d/Y:00:00:00', time() - 3600 * 24 * 90);
$af_date = date('m/d/Y:00:00:00', time() + 3600*24*90); $af_date = date('m/d/Y:00:00:00', time() + 3600 * 24 * 90);
$order_txt = ''; $order_txt = '';
$web_code = 'xx'; $web_code = 'xx';
$order_date = ''; $order_date = '';
if ($order_id) if ($order_id) {
{
//if ($site == 'ch') //if ($site == 'ch')
//{ //{
// $order = @file_get_contents('http://www.chinahighlights.com/api/api.php?method=order.json_by_lmr&order_id='.$order_id); // $order = @file_get_contents('http://www.chinahighlights.com/api/api.php?method=order.json_by_lmr&order_id='.$order_id);
//} //}
//else //else
//{ //{
$order = @file_get_contents('http://www.viaje-a-china.com/index.php/ajax/ajax_order_datas/'.$order_id); $order = @file_get_contents('http://www.viaje-a-china.com/index.php/ajax/ajax_order_datas/' . $order_id);
//} //}
if ($order && $order !== 'no data') if ($order && $order !== 'no data') {
{ $order = json_decode($order);
$order = json_decode($order); $ip = $order->COLI_SenderIP;
$ip = $order->COLI_SenderIP; if (! $ip || $ip == '159.8.126.74' || $ip == '180.140.114.208') {
if (!$ip || $ip=='159.8.126.74' || $ip=='180.140.114.208') $ip = null;
{ }
$ip = null; $web_code = $order->COLI_WebCode;
} $order_date = $order->COLI_ApplyDate;
$web_code = $order->COLI_WebCode; $date_time = strtotime($order->COLI_ApplyDate);
$order_date = $order->COLI_ApplyDate; $bf_date = date('m/d/Y:00:00:00', $date_time - 3600 * 24 * 90);
$date_time = strtotime($order->COLI_ApplyDate); $af_date = date('m/d/Y:00:00:00', $date_time + 3600 * 24 * 90);
$bf_date = date('m/d/Y:00:00:00', $date_time - 3600*24*90); $order_txt = $order->COLI_OrderDetailText;
$af_date = date('m/d/Y:00:00:00', $date_time + 3600*24*90);
$order_txt = $order->COLI_OrderDetailText;
} }
} }
//连接Splunk SDK //连接Splunk SDK
require_once '../Splunk.php'; require_once '../Splunk.php';
$connect_arguments = array( $connect_arguments = [
'scheme' => 'https', 'scheme' => 'https',
'host' => '192.155.250.125', 'host' => '192.155.250.125',
'port' => 8089, 'port' => 8089,
'username' => 'haina', 'username' => 'haina',
'password' => '383d43GZ82[Ai', 'password' => '383d43GZ82[Ai',
); ];
$service = new Splunk_Service($connect_arguments); $service = new Splunk_Service($connect_arguments);
$service->login(); $service->login();
//查询IP //查询IP
//[EXA] host=ES "68.180.229.232" earliest="11/1/2016:00:00:00" latest="11/2/2016:00:00:00" //[EXA] host=ES "68.180.229.232" earliest="11/1/2016:00:00:00" latest="11/2/2016:00:00:00"
$results = array(); $results = [];
if ($ip) if ($ip) {
{ $search = 'search host=' . $host[strtolower($web_code)] . ' "' . $ip . '" earliest="' . $bf_date . '" latest="' . $af_date . '" NOT("/ngx_pagespeed_beacon" OR "/tourprice" OR "/include" OR "/api" OR "/ajax" OR "/image" OR "/common" OR "/ckplayer" OR ".css" OR ".js" OR ".ico" OR ".gif" OR ".jpg" OR ".png" OR ".json" OR ".xml" OR ".ttf" OR ".woff" OR ".eot" OR "webhtmllog" OR "asphttp_accept_language" OR "down.asp" OR "verifyemail" OR "test")';
$search = 'search host='.$host[strtolower($web_code)].' "'.$ip.'" earliest="'.$bf_date.'" latest="'.$af_date.'" NOT("/ngx_pagespeed_beacon" OR "/tourprice" OR "/include" OR "/api" OR "/ajax" OR "/image" OR "/common" OR "/ckplayer" OR ".css" OR ".js" OR ".ico" OR ".gif" OR ".jpg" OR ".png" OR ".json" OR ".xml" OR ".ttf" OR ".woff" OR ".eot" OR "webhtmllog" OR "asphttp_accept_language" OR "down.asp" OR "verifyemail" OR "test")';
//调用Spluck Search //调用Spluck Search
$job = $service->getJobs()->create($search); $job = $service->getJobs()->create($search);
while (!$job->isDone()) while (! $job->isDone()) {
{
$job->refresh(); $job->refresh();
} }
$results = $job->getResults(); $results = $job->getResults();
} }
?><!DOCTYPE html> ?><!DOCTYPE html>
<html lang="en"> <html lang="en">
@ -155,41 +149,62 @@ pre {margin-top: 5px;font-size: 0.8em;}
<form class="form-inline" action="" method="post" id="sform"> <form class="form-inline" action="" method="post" id="sform">
<div class="form-group has-success"> <div class="form-group has-success">
<label class="sr-only" for="order_id">订单号</label> <label class="sr-only" for="order_id">订单号</label>
<input type="text" name="order_id" class="form-control" id="order_id" placeholder="输入订单号" value="<?php if ($order_id) echo($order_id); ?>"> <input type="text" name="order_id" class="form-control" id="order_id" placeholder="输入订单号" value="<?php if ($order_id) {
echo($order_id);
}
?>">
</div> </div>
<button type="submit" class="btn btn-primary" data-loading-text="Loading..." id="btn6">查询</button> <button type="submit" class="btn btn-primary" data-loading-text="Loading..." id="btn6">查询</button>
</form> </form>
</div> </div>
<div class="alert alert-info" role="alert" id="fix_alert"> <div class="alert alert-info" role="alert" id="fix_alert">
<?php <?php
if ($web_code) echo(' [站点:'.$web_code.']'); if ($web_code) {
if ($order_date) echo(' [提交日期:'.$order_date.']'); echo(' [站点:' . $web_code . ']');
if ($order_txt) echo('<pre>'.$order_txt.'</pre>'); }
//echo(' 【SPL'.$search.'】');
if ($order_date) {
echo(' [提交日期:' . $order_date . ']');
}
if ($order_txt) {
echo('<pre>' . $order_txt . '</pre>');
}
//echo(' 【SPL'.$search.'】');
?> ?>
</div> </div>
<!--nav> <!--nav>
<ul class="pagination"> <ul class="pagination">
<?php <?php
$page = 1; $page = 1;
$page_count = 10; $page_count = 10;
$prev_cls = ''; $prev_cls = '';
if ($page == 1) $prev_cls = 'disabled'; if ($page == 1) {
$next_cls = ''; $prev_cls = 'disabled';
if ($page == $page_count) $next_cls = 'disabled'; }
$next_cls = '';
if ($page == $page_count) {
$next_cls = 'disabled';
}
?> ?>
<li class="<?php echo($prev_cls);?>"> <li class="<?php echo($prev_cls); ?>">
<a href="#" aria-label="Previous" id="prev"> <a href="#" aria-label="Previous" id="prev">
<span aria-hidden="true">&laquo;</span> <span aria-hidden="true">&laquo;</span>
</a> </a>
</li> </li>
<?php for ($i=1; $i<=$page_count; $i++) { <?php for ($i = 1; $i <= $page_count; $i++) {
$cls = ''; $cls = '';
if ($i == $page) $cls = 'active'; if ($i == $page) {
?> $cls = 'active';
<li class="<?php echo($cls);?>"><a href="javascript:;" class="page_a" data-action="/train/china-trains/search/logs/<?php echo($i);?>"><?php echo($i);?></a></li> }
<?php } ?>
<li class="<?php echo($next_cls);?>"> ?>
<li class="<?php echo($cls); ?>"><a href="javascript:;" class="page_a" data-action="/train/china-trains/search/logs/<?php echo($i); ?>"><?php echo($i); ?></a></li>
<?php }?>
<li class="<?php echo($next_cls); ?>">
<a href="#" aria-label="Next" id="next"> <a href="#" aria-label="Next" id="next">
<span aria-hidden="true">&raquo;</span> <span aria-hidden="true">&raquo;</span>
</a> </a>
@ -198,116 +213,101 @@ pre {margin-top: 5px;font-size: 0.8em;}
</nav--> </nav-->
<table class="table table-bordered table-hover"> <table class="table table-bordered table-hover">
<?php <?php
$messages = array(); $messages = [];
$anyRows = FALSE; $anyRows = FALSE;
$columnNames = NULL; $columnNames = NULL;
foreach($results as $result) foreach ($results as $result) {
{ if ($result instanceof Splunk_ResultsFieldOrder) {
if ($result instanceof Splunk_ResultsFieldOrder) //所有字段
{ $columnNames = $result->getFieldNames();
//所有字段 //所需字段
$columnNames = $result->getFieldNames(); $need_th = ['_serial', '_raw', '_time'];
//所需字段 //字段差集
$need_th = array('_serial', '_raw', '_time'); $columnNames = array_intersect($need_th, $columnNames);
//字段差集 echo '<thead><tr><td colspan="3" class="tt">提示: “GET”表示正常访问“POST”表示从表单提交访问“标黄”表示订单相关的访问。</td></tr><tr>';
$columnNames = array_intersect($need_th, $columnNames); foreach ($columnNames as $columnName) {
echo '<thead><tr><td colspan="3" class="tt">提示: “GET”表示正常访问“POST”表示从表单提交访问“标黄”表示订单相关的访问。</td></tr><tr>'; echo '<th>' . htmlspecialchars($columnName) .
foreach($columnNames as $columnName) '</th>';
echo '<th>'.htmlspecialchars($columnName). }
'</th>';
echo '</tr></thead>'; echo '</tr></thead>';
echo "\n"; echo "\n";
} } else if ($result instanceof Splunk_ResultsMessage) {
else if ($result instanceof Splunk_ResultsMessage)
{
$messages[] = $result; $messages[] = $result;
} } else if (is_array($result)) {
else if (is_array($result)) $anyRows = TRUE;
{ assert($columnNames !== NULL);
$anyRows = TRUE; echo '<tr>';
assert($columnNames !== NULL); foreach ($columnNames as $columnName) {
echo '<tr>'; $cellValue = array_key_exists($columnName, $result) ? $result[$columnName] : NULL;
foreach($columnNames as $columnName) //nginx日志
{ if ($columnName == '_raw') {
$cellValue = array_key_exists($columnName, $result) ? $result[$columnName] : NULL; echo '<td><div class="_raw">';
//nginx日志 if (is_array($cellValue)) {
if ($columnName == '_raw') $log = implode('', $cellValue);
{ //116.226.169.236 - - [27/Oct/2016:07:35:39 -0500] "GET / HTTP/1.1" 200 8857 "-" "Mozilla/5.0 (iPhone; CPU iPhone OS 10_0_2 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) Version/10.0 Mobile/14A456 Safari/602.1"
echo '<td><div class="_raw">'; //ip(1), visit(3), from(6), ua(7)
if (is_array($cellValue)) $p = '/^(\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3})\s-\s-\s\[(.*)\]\s\"(.*)\"\s(\d{3})\s(\d+)\s\"(.*)\"\s\"(.*)\"$/';
{ preg_match($p, $log, $matches);
$log = implode('', $cellValue); //print_r($matches);
//116.226.169.236 - - [27/Oct/2016:07:35:39 -0500] "GET / HTTP/1.1" 200 8857 "-" "Mozilla/5.0 (iPhone; CPU iPhone OS 10_0_2 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) Version/10.0 Mobile/14A456 Safari/602.1" if (isset($matches[3])) {
//ip(1), visit(3), from(6), ua(7) $tmp_a = explode(' ', $matches[3]);
$p = '/^(\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3})\s-\s-\s\[(.*)\]\s\"(.*)\"\s(\d{3})\s(\d+)\s\"(.*)\"\s\"(.*)\"$/'; echo '<a href="' . $host_name[strtolower($web_code)] . @$tmp_a[1] . '" class="btn btn-sm btn-primary" type="button" target="_blank"><span class="badge">visit</span> ' . urldecode($matches[3]) . '</a> &nbsp;';
preg_match($p, $log, $matches);
//print_r($matches);
if (isset($matches[3]))
{
$tmp_a = explode(' ', $matches[3]);
echo '<a href="'.$host_name[strtolower($web_code)].@$tmp_a[1].'" class="btn btn-sm btn-primary" type="button" target="_blank"><span class="badge">visit</span> '.urldecode($matches[3]).'</a> &nbsp;';
}
if (isset($matches[6]))
{
if ($matches[6]=='-') $matches[6] = '从收藏夹、历史记录或地址栏直接访问';
echo '<a href="'.$matches[6].'" class="btn btn-sm btn-default" type="button" target="_blank"><span class="badge">from</span> '.urldecode($matches[6]).'</a> &nbsp;';
}
if (!isset($matches[1]))
{
echo $log;
}
}
echo '</div></td>';
} }
//日期 if (isset($matches[6])) {
else if ($columnName == '_time') if ($matches[6] == '-') {
{ $matches[6] = '从收藏夹、历史记录或地址栏直接访问';
echo '<td>'; }
$time = strtotime($cellValue);
echo date('Y-m-d h:i:s', $time); echo '<a href="' . $matches[6] . '" class="btn btn-sm btn-default" type="button" target="_blank"><span class="badge">from</span> ' . urldecode($matches[6]) . '</a> &nbsp;';
echo '</td>';
} }
//splunk记录 if (! isset($matches[1])) {
else echo $log;
{ }
echo '<td>'; }
if ($cellValue !== NULL) echo '</div></td>';
{ }
if (is_array($cellValue)) //日期
{ else if ($columnName == '_time') {
echo '<ul>'; echo '<td>';
foreach($cellValue as $value) $time = strtotime($cellValue);
{ echo date('Y-m-d h:i:s', $time);
echo '<li>'.htmlspecialchars($value).'</li>'; echo '</td>';
} }
echo '</ul>'; //splunk记录
} else {
else echo '<td>';
{ if ($cellValue !== NULL) {
echo htmlspecialchars($cellValue); if (is_array($cellValue)) {
} echo '<ul>';
foreach ($cellValue as $value) {
echo '<li>' . htmlspecialchars($value) . '</li>';
} }
echo '</td>'; echo '</ul>';
} else {
echo htmlspecialchars($cellValue);
}
} }
echo '</td>';
}
} }
echo '</tr>'; echo '</tr>';
}
} }
} ?>
?> </table>
</table>
<?php if (count($messages) > 0): ?> <?php if (count($messages) > 0): ?>
<ul> <ul>
<?php <?php
foreach ($messages as $message) foreach ($messages as $message) {
{ echo '<li>[' . htmlspecialchars($message->getType()) . '] ';
echo '<li>[' . htmlspecialchars($message->getType()) . '] '; echo htmlspecialchars($message->getText()) . '</li>';
echo htmlspecialchars($message->getText()) . '</li>'; }
} ?>
?> </ul>
</ul> <?php endif; ?>
<?php endif; ?> <?php if (! $anyRows && (count($messages) === 0)): ?>
<?php if (!$anyRows && (count($messages) === 0)): ?>
<p> <p>
没有查到相关日志 没有查到相关日志
</p> </p>

@ -1,4 +1,6 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); <?php if (! defined('BASEPATH')) {
exit('No direct script access allowed');
}
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -14,7 +16,7 @@
| path to your installation. | path to your installation.
| |
*/ */
$config['base_url'] = ''; $config['base_url'] = '';
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -44,7 +46,7 @@ $config['index_page'] = 'webht.php';
| 'ORIG_PATH_INFO' Uses the ORIG_PATH_INFO | 'ORIG_PATH_INFO' Uses the ORIG_PATH_INFO
| |
*/ */
$config['uri_protocol'] = 'AUTO'; $config['uri_protocol'] = 'AUTO';
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -69,7 +71,7 @@ $config['url_suffix'] = '';
| than english. | than english.
| |
*/ */
$config['language'] = 'english'; $config['language'] = 'english';
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -93,7 +95,6 @@ $config['charset'] = 'UTF-8';
*/ */
$config['enable_hooks'] = FALSE; $config['enable_hooks'] = FALSE;
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Class Extension Prefix | Class Extension Prefix
@ -108,7 +109,6 @@ $config['enable_hooks'] = FALSE;
*/ */
$config['subclass_prefix'] = 'MY_'; $config['subclass_prefix'] = 'MY_';
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Allowed URL Characters | Allowed URL Characters
@ -128,7 +128,6 @@ $config['subclass_prefix'] = 'MY_';
*/ */
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-u4e00-u9fa5'; $config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-u4e00-u9fa5';
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Enable Query Strings | Enable Query Strings
@ -154,11 +153,11 @@ $config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-u4e00-u9fa5';
| use segment based URLs. | use segment based URLs.
| |
*/ */
$config['allow_get_array'] = TRUE; $config['allow_get_array'] = TRUE;
$config['enable_query_strings'] = FALSE; $config['enable_query_strings'] = FALSE;
$config['controller_trigger'] = 'c'; $config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm'; $config['function_trigger'] = 'm';
$config['directory_trigger'] = 'd'; // experimental not currently in use $config['directory_trigger'] = 'd'; // experimental not currently in use
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -244,15 +243,15 @@ $config['encryption_key'] = 'pliy3rgYcV9lXeKWaO6P_author';
| 'sess_time_to_update' = how many seconds between CI refreshing Session Information | 'sess_time_to_update' = how many seconds between CI refreshing Session Information
| |
*/ */
$config['sess_cookie_name'] = 'ci_session'; $config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 0; $config['sess_expiration'] = 0;
$config['sess_expire_on_close'] = FALSE; $config['sess_expire_on_close'] = FALSE;
$config['sess_encrypt_cookie'] = FALSE; $config['sess_encrypt_cookie'] = FALSE;
$config['sess_use_database'] = FALSE; $config['sess_use_database'] = FALSE;
$config['sess_table_name'] = 'ci_sessions'; $config['sess_table_name'] = 'ci_sessions';
$config['sess_match_ip'] = FALSE; $config['sess_match_ip'] = FALSE;
$config['sess_match_useragent'] = TRUE; $config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update'] = 300; $config['sess_time_to_update'] = 300;
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -265,10 +264,10 @@ $config['sess_time_to_update'] = 300;
| 'cookie_secure' = Cookies will only be set if a secure HTTPS connection exists. | 'cookie_secure' = Cookies will only be set if a secure HTTPS connection exists.
| |
*/ */
$config['cookie_prefix'] = ""; $config['cookie_prefix'] = "";
$config['cookie_domain'] = ""; $config['cookie_domain'] = "";
$config['cookie_path'] = "/"; $config['cookie_path'] = "/";
$config['cookie_secure'] = FALSE; $config['cookie_secure'] = FALSE;
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -293,10 +292,10 @@ $config['global_xss_filtering'] = FALSE;
| 'csrf_cookie_name' = The cookie name | 'csrf_cookie_name' = The cookie name
| 'csrf_expire' = The number in seconds the token should expire. | 'csrf_expire' = The number in seconds the token should expire.
*/ */
$config['csrf_protection'] = FALSE; $config['csrf_protection'] = FALSE;
$config['csrf_token_name'] = 'csrf_test_name'; $config['csrf_token_name'] = 'csrf_test_name';
$config['csrf_cookie_name'] = 'csrf_cookie_name'; $config['csrf_cookie_name'] = 'csrf_cookie_name';
$config['csrf_expire'] = 7200; $config['csrf_expire'] = 7200;
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -330,7 +329,6 @@ $config['compress_output'] = FALSE;
*/ */
$config['time_reference'] = 'local'; $config['time_reference'] = 'local';
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Rewrite PHP Short Tags | Rewrite PHP Short Tags
@ -343,7 +341,6 @@ $config['time_reference'] = 'local';
*/ */
$config['rewrite_short_tags'] = FALSE; $config['rewrite_short_tags'] = FALSE;
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Reverse Proxy IPs | Reverse Proxy IPs
@ -360,22 +357,21 @@ $config['proxy_ips'] = '';
/* End of file config.php */ /* End of file config.php */
/* Location: ./application/config/config.php */ /* Location: ./application/config/config.php */
$config['site'] = [
$config['site'] = array( 'cht' => ['site_code' => 'cht', 'site_id' => 14, 'site_lgc' => '1', 'site_url' => 'https://www.chinahighlights.com'],
'cht' => array('site_code' => 'cht', 'site_id' => 14, 'site_lgc' => '1', 'site_url' => 'https://www.chinahighlights.com'), 'gm' => ['site_code' => 'gm', 'site_id' => 22, 'site_lgc' => '4', 'site_url' => 'https://www.chinahighlightstravel.de'],
'gm' => array('site_code' => 'gm', 'site_id' => 22, 'site_lgc' => '4', 'site_url' => 'https://www.chinarundreisen.com'), 'vc' => ['site_code' => 'vc', 'site_id' => 30, 'site_lgc' => '5', 'site_url' => 'https://www.voyageschine.com'],
'vc' => array('site_code' => 'vc', 'site_id' => 30, 'site_lgc' => '5', 'site_url' => 'https://www.voyageschine.com'), 'jp' => ['site_code' => 'jp', 'site_id' => 88, 'site_lgc' => '3', 'site_url' => 'https://www.arachina.com'],
'jp' => array('site_code' => 'jp', 'site_id' => 88, 'site_lgc' => '3', 'site_url' => 'https://www.arachina.com'), 'vac' => ['site_code' => 'vac', 'site_id' => 95, 'site_lgc' => '6', 'site_url' => 'https://www.viaje-a-china.com'],
'vac' => array('site_code' => 'vac', 'site_id' => 95, 'site_lgc' => '6', 'site_url' => 'https://www.viaje-a-china.com'), 'it' => ['site_code' => 'it', 'site_id' => 168, 'site_lgc' => '8', 'site_url' => 'https://www.viaggio-in-cina.it'],
'it' => array('site_code' => 'it', 'site_id' => 168, 'site_lgc' => '8', 'site_url' => 'https://www.viaggio-in-cina.it'), 'ru' => ['site_code' => 'ru', 'site_id' => 102, 'site_lgc' => '7', 'site_url' => 'https://www.chinahighlights.ru'],
'ru' => array('site_code' => 'ru', 'site_id' => 102, 'site_lgc' => '7', 'site_url' => 'https://www.chinahighlights.ru'), 'wt' => ['site_code' => 'wt', 'site_id' => 172, 'site_lgc' => '2', 'site_url' => 'https://www.iiiyooo.com'],
'wt' => array('site_code' => 'wt', 'site_id' => 172, 'site_lgc' => '2', 'site_url' => 'https://www.iiiyooo.com'), 'tbt' => ['site_code' => 'tbt', 'site_id' => 169, 'site_lgc' => '1', 'site_url' => 'https://www.tibettravel.info'],
'tbt' => array('site_code' => 'tbt', 'site_id' => 169, 'site_lgc' => '1', 'site_url' => 'https://www.tibettravel.info'), 'sht' => ['site_code' => 'sht', 'site_id' => 96, 'site_lgc' => '1', 'site_url' => 'https://www.shanghaihighlights.com'],
'sht' => array('site_code' => 'sht', 'site_id' => 96, 'site_lgc' => '1', 'site_url' => 'https://www.shanghaihighlights.com'), 'yz' => ['site_code' => 'yz', 'site_id' => 89, 'site_lgc' => '1', 'site_url' => 'https://www.yangtzeriver.org'],
'yz' => array('site_code' => 'yz', 'site_id' => 89, 'site_lgc' => '1', 'site_url' => 'https://www.yangtzeriver.org'), 'gl' => ['site_code' => 'gl', 'site_id' => 90, 'site_lgc' => '1', 'site_url' => 'https://www.guilinchina.net'],
'gl' => array('site_code' => 'gl', 'site_id' => 90, 'site_lgc' => '1', 'site_url' => 'https://www.guilinchina.net'), 'mbj' => ['site_code' => 'mbj', 'site_id' => 98, 'site_lgc' => '1', 'site_url' => 'https://www.mybeijingchina.com'],
'mbj' => array('site_code' => 'mbj', 'site_id' => 98, 'site_lgc' => '1', 'site_url' => 'https://www.mybeijingchina.com'), 'ct' => ['site_code' => 'ct', 'site_id' => 1000, 'site_lgc' => '104', 'site_url' => 'https://www.chinatravel.com'],
'ct' => array('site_code' => 'ct', 'site_id' => 1000, 'site_lgc' => '104', 'site_url' => 'https://www.chinatravel.com'), 'dct' => ['site_code' => 'dct', 'site_id' => 99, 'site_lgc' => '1', 'site_url' => 'https://www.diychinatours.com'],
'dct' => array('site_code' => 'dct', 'site_id' => 99, 'site_lgc' => '1', 'site_url' => 'https://www.diychinatours.com'), 'trippest' => ['site_code' => 'trippest', 'site_id' => 0, 'site_lgc' => '1', 'site_url' => 'https://www.trippest.com'],
'trippest' => array('site_code' => 'trippest', 'site_id' => 0, 'site_lgc' => '1', 'site_url' => 'https://www.trippest.com') ];
);

@ -1,7 +1,7 @@
<?php <?php
$lang['logo'] = "https://www.chinarundreisen.com/pic/homepage/logo.png"; $lang['logo'] = "https://www.chinahighlightstravel.de/pic/homepage/logo.png";
$lang['logo_url'] = "https://www.chinarundreisen.com/"; $lang['logo_url'] = "https://www.chinahighlightstravel.de/";
$lang['right'] = '<div class="pay_footer text-right"> $lang['right'] = '<div class="pay_footer text-right">
<p>© 1998 China Highlights. <p>© 1998 China Highlights.
<a href="https://www.chinahighlights.com/privacy.htm" rel="nofollow">Privacy Statement</a> <a href="https://www.chinahighlights.com/privacy.htm" rel="nofollow">Privacy Statement</a>

@ -19,121 +19,121 @@ ini_set('display_errors', 0);
/*============================ General Settings =======================================*/ /*============================ General Settings =======================================*/
// https://ckeditor.com/docs/ckfinder/ckfinder3-php/configuration.html // https://ckeditor.com/docs/ckfinder/ckfinder3-php/configuration.html
$config = array(); $config = [];
/*============================ Enable PHP Connector HERE ==============================*/ /*============================ Enable PHP Connector HERE ==============================*/
// https://ckeditor.com/docs/ckfinder/ckfinder3-php/configuration.html#configuration_options_authentication // https://ckeditor.com/docs/ckfinder/ckfinder3-php/configuration.html#configuration_options_authentication
$config['authentication'] = function () { $config['authentication'] = function () {
return true; return true;
}; };
/*============================ License Key ============================================*/ /*============================ License Key ============================================*/
// https://ckeditor.com/docs/ckfinder/ckfinder3-php/configuration.html#configuration_options_licenseKey // https://ckeditor.com/docs/ckfinder/ckfinder3-php/configuration.html#configuration_options_licenseKey
$config['licenseName'] = 'www.iro.com'; $config['licenseName'] = 'www.iro.com';
$config['licenseKey'] = '*J?L-*1**-C**X-*D**-*B**-Z*6*-3**J'; $config['licenseKey'] = '*J?L-*1**-C**X-*D**-*B**-Z*6*-3**J';
/*============================ CKFinder Internal Directory ============================*/ /*============================ CKFinder Internal Directory ============================*/
// https://ckeditor.com/docs/ckfinder/ckfinder3-php/configuration.html#configuration_options_privateDir // https://ckeditor.com/docs/ckfinder/ckfinder3-php/configuration.html#configuration_options_privateDir
$config['privateDir'] = array( $config['privateDir'] = [
'backend' => 'default', 'backend' => 'default',
'tags' => '.ckfinder/tags', 'tags' => '.ckfinder/tags',
'logs' => '.ckfinder/logs', 'logs' => '.ckfinder/logs',
'cache' => '.ckfinder/cache', 'cache' => '.ckfinder/cache',
'thumbs' => '.ckfinder/cache/thumbs', 'thumbs' => '.ckfinder/cache/thumbs',
); ];
/*============================ Images and Thumbnails ==================================*/ /*============================ Images and Thumbnails ==================================*/
// https://ckeditor.com/docs/ckfinder/ckfinder3-php/configuration.html#configuration_options_images // https://ckeditor.com/docs/ckfinder/ckfinder3-php/configuration.html#configuration_options_images
$config['images'] = array( $config['images'] = [
'maxWidth' => 2560, 'maxWidth' => 2560,
'maxHeight' => 1440, 'maxHeight' => 1440,
'quality' => 0, 'quality' => 0,
'sizes' => array( 'sizes' => [
'small' => array('width' => 480, 'height' => 320, 'quality' => 0), 'small' => ['width' => 480, 'height' => 320, 'quality' => 0],
'medium' => array('width' => 600, 'height' => 480, 'quality' => 0), 'medium' => ['width' => 600, 'height' => 480, 'quality' => 0],
'large' => array('width' => 800, 'height' => 600, 'quality' => 0) 'large' => ['width' => 800, 'height' => 600, 'quality' => 0],
) ],
); ];
/*=================================== Backends ========================================*/ /*=================================== Backends ========================================*/
// https://ckeditor.com/docs/ckfinder/ckfinder3-php/configuration.html#configuration_options_backends // https://ckeditor.com/docs/ckfinder/ckfinder3-php/configuration.html#configuration_options_backends
$sitecode = 'empty'; $sitecode = 'empty';
if (!empty($_GET['sitecode'])) { if (! empty($_GET['sitecode'])) {
$sitecode = $_GET['sitecode']; $sitecode = $_GET['sitecode'];
} }
switch ($sitecode) { switch ($sitecode) {
case 'cht': case 'cht':
$site_url = 'https://data.chinahighlights.com'; $site_url = 'https://data.chinahighlights.com';
break; break;
case 'ch': case 'ch':
$site_url = 'https://data.chinahighlights.com'; $site_url = 'https://data.chinahighlights.com';
break; break;
case 'gm': case 'gm':
$site_url = 'https://data.chinarundreisen.com'; $site_url = 'https://data.chinahighlightstravel.de';
break; break;
case 'gh': case 'gh':
$site_url = 'https://data.globalhighlights.com'; $site_url = 'https://data.globalhighlights.com';
break; break;
case 'ah': case 'ah':
$site_url = 'https://data.asiahighlights.com'; $site_url = 'https://data.asiahighlights.com';
break; break;
case 'vc': case 'vc':
$site_url = 'https://data.voyageschine.com/kcfinder/upload/vc'; $site_url = 'https://data.voyageschine.com/kcfinder/upload/vc';
break; break;
case 'jp': case 'jp':
$site_url = 'https://data.arachina.com/kcfinder/upload/jp'; $site_url = 'https://data.arachina.com/kcfinder/upload/jp';
break; break;
case 'vac': case 'vac':
$site_url = 'https://data.viaje-a-china.com/kcfinder/upload/vac'; $site_url = 'https://data.viaje-a-china.com/kcfinder/upload/vac';
break; break;
case 'it': case 'it':
$site_url = 'https://data.viaggio-in-cina.it/kcfinder/upload/it'; $site_url = 'https://data.viaggio-in-cina.it/kcfinder/upload/it';
break; break;
case 'ru': case 'ru':
$site_url = 'https://data.chinahighlights.ru/kcfinder/upload/ru'; $site_url = 'https://data.chinahighlights.ru/kcfinder/upload/ru';
break; break;
case 'ct': case 'ct':
$site_url = 'https://data.chinatravel.com'; $site_url = 'https://data.chinatravel.com';
break; break;
case 'chinatravel': case 'chinatravel':
$site_url = 'https://data.chinatravel.com'; $site_url = 'https://data.chinatravel.com';
break; break;
case 'shanghai': case 'shanghai':
$site_url = 'https://data.shanghaihighlights.com'; $site_url = 'https://data.shanghaihighlights.com';
break; break;
case 'beijing': case 'beijing':
$site_url = 'https://www.mybeijingchina.com'; $site_url = 'https://www.mybeijingchina.com';
break; break;
default: default:
$site_url = ''; $site_url = '';
} }
//文件上传目录,使用相对路径,在文件夹中建立虚拟目录指向真实文件夹 //文件上传目录,使用相对路径,在文件夹中建立虚拟目录指向真实文件夹
//创建指向目录 mklink /D D:\wwwroot\uploader-file\gh\image D:\wwwroot\origin-www.globalhighlights.com\image //创建指向目录 mklink /D D:\wwwroot\uploader-file\gh\image D:\wwwroot\origin-www.globalhighlights.com\image
//需要移出项目文件夹防止FTP访问到防止误删 //需要移出项目文件夹防止FTP访问到防止误删
if ('gh-int.mycht.cn' == $_SERVER["SERVER_NAME"] || 'origin-gm.mycht.cn' == $_SERVER["SERVER_NAME"]) { if ('gh-int.mycht.cn' == $_SERVER["SERVER_NAME"] || 'origin-gm.mycht.cn' == $_SERVER["SERVER_NAME"]) {
// 国际站和德语站不需要更改目录 // 国际站和德语站不需要更改目录
$site_upload_dir = dirname(__FILE__) . ('/userfiles/') . $sitecode; $site_upload_dir = dirname(__FILE__) . ('/userfiles/') . $sitecode;
} else { } else {
$site_upload_dir = dirname(dirname(dirname(dirname(__FILE__)))) . '/uploader-file/' . $sitecode; $site_upload_dir = dirname(dirname(dirname(dirname(__FILE__)))) . '/uploader-file/' . $sitecode;
} }
$config['backends'][] = array( $config['backends'][] = [
'name' => 'default', 'name' => 'default',
'adapter' => 'local', 'adapter' => 'local',
'baseUrl' => $site_url, 'baseUrl' => $site_url,
'root' => $site_upload_dir, // Can be used to explicitly set the CKFinder user files directory. 'root' => $site_upload_dir, // Can be used to explicitly set the CKFinder user files directory.
'chmodFiles' => 0777, 'chmodFiles' => 0777,
'chmodFolders' => 0755, 'chmodFolders' => 0755,
'filesystemEncoding' => 'UTF-8', 'filesystemEncoding' => 'UTF-8',
'followSymlinks' => true, 'followSymlinks' => true,
); ];
/*================================ Resource Types =====================================*/ /*================================ Resource Types =====================================*/
// https://ckeditor.com/docs/ckfinder/ckfinder3-php/configuration.html#configuration_options_resourceTypes // https://ckeditor.com/docs/ckfinder/ckfinder3-php/configuration.html#configuration_options_resourceTypes
@ -142,22 +142,22 @@ $config['defaultResourceTypes'] = '';
//按日期生成不同文件夹,每周一个文件夹 //按日期生成不同文件夹,每周一个文件夹
//$week_folder= date("Y-m_W", time()); //$week_folder= date("Y-m_W", time());
$config['resourceTypes'][] = array( $config['resourceTypes'][] = [
'name' => 'image', // Single quotes not allowed. 'name' => 'image', // Single quotes not allowed.
'directory' => 'image', 'directory' => 'image',
'maxSize' => 0, 'maxSize' => 0,
'allowedExtensions' => '7z,aiff,asf,avi,bmp,csv,doc,docx,fla,flv,gif,gz,gzip,jpeg,jpg,mid,mov,mp3,mp4,mpc,mpeg,mpg,ods,odt,pdf,png,ppt,pptx,pxd,qt,ram,rar,rm,rmi,rmvb,rtf,sdc,sitd,swf,sxc,sxw,tar,tgz,tif,tiff,txt,vsd,wav,wma,wmv,xls,xlsx,zip,svg', 'allowedExtensions' => '7z,aiff,asf,avi,bmp,csv,doc,docx,fla,flv,gif,gz,gzip,jpeg,jpg,mid,mov,mp3,mp4,mpc,mpeg,mpg,ods,odt,pdf,png,ppt,pptx,pxd,qt,ram,rar,rm,rmi,rmvb,rtf,sdc,sitd,swf,sxc,sxw,tar,tgz,tif,tiff,txt,vsd,wav,wma,wmv,xls,xlsx,zip,svg',
'deniedExtensions' => '', 'deniedExtensions' => '',
'backend' => 'default' 'backend' => 'default',
); ];
$config['resourceTypes'][] = array( $config['resourceTypes'][] = [
'name' => 'pic', // Single quotes not allowed. 'name' => 'pic', // Single quotes not allowed.
'directory' => 'pic', 'directory' => 'pic',
'maxSize' => 0, 'maxSize' => 0,
'allowedExtensions' => '7z,aiff,asf,avi,bmp,csv,doc,docx,fla,flv,gif,gz,gzip,jpeg,jpg,mid,mov,mp3,mp4,mpc,mpeg,mpg,ods,odt,pdf,png,ppt,pptx,pxd,qt,ram,rar,rm,rmi,rmvb,rtf,sdc,sitd,swf,sxc,sxw,tar,tgz,tif,tiff,txt,vsd,wav,wma,wmv,xls,xlsx,zip,svg', 'allowedExtensions' => '7z,aiff,asf,avi,bmp,csv,doc,docx,fla,flv,gif,gz,gzip,jpeg,jpg,mid,mov,mp3,mp4,mpc,mpeg,mpg,ods,odt,pdf,png,ppt,pptx,pxd,qt,ram,rar,rm,rmi,rmvb,rtf,sdc,sitd,swf,sxc,sxw,tar,tgz,tif,tiff,txt,vsd,wav,wma,wmv,xls,xlsx,zip,svg',
'deniedExtensions' => '', 'deniedExtensions' => '',
'backend' => 'default' 'backend' => 'default',
); ];
/* /*
$config['resourceTypes'][] = array( $config['resourceTypes'][] = array(
@ -192,39 +192,38 @@ $config['resourceTypes'][] = array(
$config['roleSessionVar'] = 'CKFinder_UserRole'; $config['roleSessionVar'] = 'CKFinder_UserRole';
// https://ckeditor.com/docs/ckfinder/ckfinder3-php/configuration.html#configuration_options_accessControl // https://ckeditor.com/docs/ckfinder/ckfinder3-php/configuration.html#configuration_options_accessControl
$config['accessControl'][] = array( $config['accessControl'][] = [
'role' => '*', 'role' => '*',
'resourceType' => '*', 'resourceType' => '*',
'folder' => '/', 'folder' => '/',
'FOLDER_VIEW' => true,
'FOLDER_CREATE' => true,
'FOLDER_RENAME' => true,
'FOLDER_DELETE' => false,
'FILE_VIEW' => true,
'FILE_CREATE' => true,
'FILE_RENAME' => true,
'FILE_DELETE' => true,
'IMAGE_RESIZE' => true,
'IMAGE_RESIZE_CUSTOM' => true
);
'FOLDER_VIEW' => true,
'FOLDER_CREATE' => true,
'FOLDER_RENAME' => true,
'FOLDER_DELETE' => false,
'FILE_VIEW' => true,
'FILE_CREATE' => true,
'FILE_RENAME' => true,
'FILE_DELETE' => true,
'IMAGE_RESIZE' => true,
'IMAGE_RESIZE_CUSTOM' => true,
];
/*================================ Other Settings =====================================*/ /*================================ Other Settings =====================================*/
// https://ckeditor.com/docs/ckfinder/ckfinder3-php/configuration.html // https://ckeditor.com/docs/ckfinder/ckfinder3-php/configuration.html
$config['overwriteOnUpload'] = false; $config['overwriteOnUpload'] = false;
$config['checkDoubleExtension'] = true; $config['checkDoubleExtension'] = true;
$config['disallowUnsafeCharacters'] = true; $config['disallowUnsafeCharacters'] = true;
$config['secureImageUploads'] = true; $config['secureImageUploads'] = true;
$config['checkSizeAfterScaling'] = true; $config['checkSizeAfterScaling'] = true;
$config['htmlExtensions'] = array('html', 'htm', 'xml', 'js'); $config['htmlExtensions'] = ['html', 'htm', 'xml', 'js'];
$config['hideFolders'] = array('.*', 'CVS', '__thumbs'); $config['hideFolders'] = ['.*', 'CVS', '__thumbs'];
$config['hideFiles'] = array('.*'); $config['hideFiles'] = ['.*'];
$config['forceAscii'] = false; $config['forceAscii'] = false;
$config['xSendfile'] = false; $config['xSendfile'] = false;
// https://ckeditor.com/docs/ckfinder/ckfinder3-php/configuration.html#configuration_options_debug // https://ckeditor.com/docs/ckfinder/ckfinder3-php/configuration.html#configuration_options_debug
$config['debug'] = false; $config['debug'] = false;
@ -233,16 +232,16 @@ $config['debug'] = false;
// https://ckeditor.com/docs/ckfinder/ckfinder3-php/configuration.html#configuration_options_plugins // https://ckeditor.com/docs/ckfinder/ckfinder3-php/configuration.html#configuration_options_plugins
$config['pluginsDirectory'] = __DIR__ . '/plugins'; $config['pluginsDirectory'] = __DIR__ . '/plugins';
$config['plugins'] = array(); $config['plugins'] = [];
/*================================ Cache settings =====================================*/ /*================================ Cache settings =====================================*/
// https://ckeditor.com/docs/ckfinder/ckfinder3-php/configuration.html#configuration_options_cache // https://ckeditor.com/docs/ckfinder/ckfinder3-php/configuration.html#configuration_options_cache
$config['cache'] = array( $config['cache'] = [
'imagePreview' => 24 * 3600, 'imagePreview' => 24 * 3600,
'thumbnails' => 24 * 3600 * 365, 'thumbnails' => 24 * 3600 * 365,
'proxyCommand' => 0 'proxyCommand' => 0,
); ];
/*============================ Temp Directory settings ================================*/ /*============================ Temp Directory settings ================================*/
// https://ckeditor.com/docs/ckfinder/ckfinder3-php/configuration.html#configuration_options_tempDirectory // https://ckeditor.com/docs/ckfinder/ckfinder3-php/configuration.html#configuration_options_tempDirectory
@ -262,7 +261,7 @@ $config['csrfProtection'] = true;
/*===================================== Headers =======================================*/ /*===================================== Headers =======================================*/
// https://ckeditor.com/docs/ckfinder/ckfinder3-php/configuration.html#configuration_options_headers // https://ckeditor.com/docs/ckfinder/ckfinder3-php/configuration.html#configuration_options_headers
$config['headers'] = array(); $config['headers'] = [];
/*============================== End of Configuration =================================*/ /*============================== End of Configuration =================================*/

Loading…
Cancel
Save