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,']],
'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,']],
'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,'],
'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,'],
@ -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']['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']['vac']['site_url'] = 'https://www.chinahighlights.es';
$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_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_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
if (!defined('BASEPATH'))
exit('No direct script access allowed');
if (! defined('BASEPATH')) {
exit('No direct script access allowed');
}
class Welcome extends CI_Controller {
function __construct() {
parent::__construct();
$this->permission->is_admin();
//$this->output->enable_profiler(TRUE);
$this->load->model('Area_model');
$this->load->model('InfoStructures_model');
$this->load->model('Information_model');
$this->load->model('InfoContents_model');
$this->load->model('Coupon_model');
$this->load->model('Logs_model');
function __construct() {
parent::__construct();
$this->permission->is_admin();
//$this->output->enable_profiler(TRUE);
$this->load->model('Area_model');
$this->load->model('InfoStructures_model');
$this->load->model('Information_model');
$this->load->model('InfoContents_model');
$this->load->model('Coupon_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() {
$data=array();
$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');
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'");
}
public function search($isrecommend = false) {
//先搜索url如果找到唯一就跳走多于一条的则列出来一条没有的就去搜索信息
$data['keywords'] = $this->input->post('keywords');
$data['all_text_search'] = $this->input->post('all_text_search'); //全文搜索
$search_url = str_replace($this->config->item('site_url'), "", $data['keywords']);
$data['search_list'] = $this->Information_model->search_url($search_url);
if (count($data['search_list']) === 0) {
if (!empty($data['all_text_search']) && $data['all_text_search'] == 'true') {
$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');
$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');
$data['all_text_search'] = $this->input->post('all_text_search'); //全文搜索
$search_url = str_replace($this->config->item('site_url'), "", $data['keywords']);
$data['search_list'] = $this->Information_model->search_url($search_url);
if (count($data['search_list']) === 0) {
if (! empty($data['all_text_search']) && $data['all_text_search'] == 'true') {
$data['search_list'] = $this->Information_model->search_all_text($data['keywords'], 48);
} else {
$data['search_list'] = $this->Information_model->search($data['keywords']);
}
}
//获取所有信息URL,用来批量静态化更新
public function create_all_urls($view=false) {
set_time_limit(0);
$this->output->enable_profiler(false);
$data['all_information'] = $this->Information_model->GetList('ic_status,ic_id,ic_url,ic_sitecode,is_id');
if ($view == 'amp') {
$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');
}
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));
}
//获取某个信息节点和子节点url
//$is_parent_id 结构id或者是url
public function create_infomation_urls($is_parent_id, $view = false) {
$ic_url=$this->input->get_post('ic_url');
if(!empty($ic_url)){
$structure = $this->Information_model->Detail($ic_url);
}else{
$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,false,false,'is_id,ic_url,ic_id,ic_status');
$this->load->view('bootstrap3/header', $data);
switch ($view){
case 'amp':
$this->load->view('bootstrap3/refresh_amp_urls');
break;
case 'mobile-first':
$this->load->view('bootstrap3/refresh_mobile_first_urls');
break;
default:
$this->load->view('bootstrap/cache_url', $data);
}
$this->load->view('bootstrap/footer');
$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,用来批量静态化更新
public function create_all_urls($view = false) {
set_time_limit(0);
$this->output->enable_profiler(false);
$data['all_information'] = $this->Information_model->GetList('ic_status,ic_id,ic_url,ic_sitecode,is_id');
if ($view == 'amp') {
$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');
}
//根据信息节点ID获取信息用于搜索结果的批量更新静态页面
public function create_infomation_urls_by_ids($view = false){
$is_ids=$this->input->get('key');
if (empty($is_ids)) {
show_404();
return false;
}
$data['all_information'] = $this->Information_model->get_detail_by_ids($is_ids);
if ($view == 'amp') {
$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');
}
//获取某个信息节点和子节点url
//$is_parent_id 结构id或者是url
public function create_infomation_urls($is_parent_id, $view = false) {
$ic_url = $this->input->get_post('ic_url');
if (! empty($ic_url)) {
$structure = $this->Information_model->Detail($ic_url);
} else {
$structure = $this->InfoStructures_model->Detail($is_parent_id);
}
public function get_info_backup_id($info_id) {
$last_backup = $this->Logs_model->get_last_backup($info_id);
if (empty($last_backup)) {
$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
));
}
if (empty($structure)) {
show_404();
return false;
}
public function change_static_url($info_id) {
$information = $this->Information_model->Detail($info_id);
$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(array(
'status' => 'error',
'infoId' => $info_id,
'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>';
}
}
$data['all_information'] = $this->Information_model->get_list_by_path($structure->is_path, false, false, 'is_id,ic_url,ic_id,ic_status');
$this->load->view('bootstrap3/header', $data);
switch ($view) {
case 'amp':
$this->load->view('bootstrap3/refresh_amp_urls');
break;
case 'mobile-first':
$this->load->view('bootstrap3/refresh_mobile_first_urls');
break;
default:
$this->load->view('bootstrap/cache_url', $data);
}
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/>';
$redirect_nofollow_list = array();
$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 = 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;
$this->load->view('bootstrap/footer');
}
//根据信息节点ID获取信息用于搜索结果的批量更新静态页面
public function create_infomation_urls_by_ids($view = false) {
$is_ids = $this->input->get('key');
if (empty($is_ids)) {
show_404();
return false;
}
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/>';
$data['all_information'] = $this->Information_model->get_detail_by_ids($is_ids);
if ($view == 'amp') {
$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 count_http_of_href() {
$data['all_information'] = $this->Information_model->search_all_text('http://www.chinahighlights.com/', 2000);
echo 'count: ' . count($data['all_information']) . '<br/>';
var_dump($data['all_information']);
}
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;
}
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->Logs_model->backup($item->is_id, $item->ic_content);
$item->ic_content = str_replace($http_host, $https_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
);
}
}
$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) {
$last_backup = $this->Logs_model->get_last_backup($info_id);
if (empty($last_backup)) {
$this->echo_json([
'status' => 'error',
'logId' => 0,
'datetime' => 0,
'username' => 0,
]);
} else {
$this->echo_json([
'status' => 'success',
'logId' => $last_backup->log_id,
'datetime' => $last_backup->log_datetime,
'username' => $last_backup->log_ht_username,
]);
}
private function echo_json($obj) {
$this->output
->set_content_type('application/json')
->set_output(json_encode($obj));
}
public function change_static_url($info_id) {
$information = $this->Information_model->Detail($info_id);
$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;
}
//批量替换二级域名如图片或者data域名
function replace_hostname($topnum) {
$data = array();
$find_host = 'http://data.chinarundreisen.com/'; //http://bilder.chinarundreisen.com/
$new_host = '//data.chinarundreisen.com/';
$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';
}
$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);
}
private function check_url($subject) {
$result = $subject;
$check_rules = array(
'/^\/image\/(.*)/' => '//data.chinahighlights.com/image/',
'/^\/pic\/(.*)/' => '//data.chinahighlights.com/pic/',
'/^\/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;
$anchor_list = $htm_doc->getElementsByTagName('a');
foreach ($anchor_list as $anchor) {
$a_href = $anchor->getAttribute('href');
echo 'a.href: ' . $a_href . '<br>';
$match_result = [];
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>';
}
}
private function replace_url($pattern, $replace, $subject) {
$result = $subject;
$match_result = array();
preg_match($pattern, $subject, $match_result);
}
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/>';
$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);
if ($result_count == 2) {
$result = $replace . $match_result[1];
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;
}
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);
}
}
//生肖促销订单查询
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();
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);
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->load->view('bootstrap/welcome');
$this->load->view('bootstrap/footer');
$this->Logs_model->backup($item->is_id, $item->ic_content);
$item->ic_content = str_replace($http_host, $https_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
);
}
}
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';
}
private function echo_json($obj) {
$this->output
->set_content_type('application/json')
->set_output(json_encode($obj));
}
//批量替换二级域名如图片或者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');
$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);
}
private function check_url($subject) {
$result = $subject;
$check_rules = [
'/^\/image\/(.*)/' => '//data.chinahighlights.com/image/',
'/^\/pic\/(.*)/' => '//data.chinahighlights.com/pic/',
'/^\/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);
}
/**
* @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));
return $result;
}
private function replace_url($pattern, $replace, $subject) {
$result = $subject;
$match_result = [];
preg_match($pattern, $subject, $match_result);
$result_count = count($match_result);
if ($result_count == 2) {
$result = $replace . $match_result[1];
}
return $result;
}
//生肖促销订单查询
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
if (!defined('BASEPATH'))
exit('No direct script access allowed');
if (! defined('BASEPATH')) {
exit('No direct script access allowed');
}
/*
* AMP的相关方法
*/
class Amplib
{
class Amplib {
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');
}
var $CI;
public function edit($ic_id)
{
$data = array();
$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 __construct() {
$this->CI = &get_instance();
$this->CI->load->model('Information_model');
$this->CI->load->model('InfoMetas_model');
$this->CI->load->model('Logs_model');
}
$this->CI->load->view('bootstrap3/header', $data);
$this->CI->load->view('amp_editor');
$this->CI->load->view('bootstrap3/footer');
public function edit($ic_id) {
$data = [];
$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)
{
$data = array();
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' => '找不到这个页面'));
}
$this->CI->load->view('bootstrap3/header', $data);
$this->CI->load->view('amp_editor');
$this->CI->load->view('bootstrap3/footer');
}
//144.76.185.44:8029
//根据站点不同,配置不同参数
$site_code = strtolower($this->CI->config->item('site_code'));
switch ($site_code) {
case 'ah':
//websitehost是表示资源下载的域名在网页代码中有/css/xxx.css之类的路径程序需要添加域名组成完整URL去下载文件一般是data域名或者www域名
$websitehost = 'https://data.asiahighlights.com';
$html_source_url = 'https://www.asiahighlights.com/index.php/information/detail/?no_cache=true&static_html_url=' . $data['information']->ic_url;
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 auto_create($ic_id) {
$data = [];
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(['result' => 'no', 'data' => '找不到这个页面']);
}
public function edit_save($ic_id = false, $textarea_htmlcode = false, $amp_status = false)
{
$data = array();
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');
//144.76.185.44:8029
//根据站点不同,配置不同参数
$site_code = strtolower($this->CI->config->item('site_code'));
switch ($site_code) {
case 'ah':
//websitehost是表示资源下载的域名在网页代码中有/css/xxx.css之类的路径程序需要添加域名组成完整URL去下载文件一般是data域名或者www域名
$websitehost = 'https://data.asiahighlights.com';
$html_source_url = 'https://www.asiahighlights.com/index.php/information/detail/?no_cache=true&static_html_url=' . $data['information']->ic_url;
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.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) {
show_404();
}
public function edit_save($ic_id = false, $textarea_htmlcode = false, $amp_status = false) {
$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内容在这里帮补上
$textarea_htmlcode = str_replace('<!--@CANONICAL@-->', $this->CI->config->item('site_url') . $data['information']->ic_url, $textarea_htmlcode);
//备份修改的代码
$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);
}
if ($data['information'] == FALSE) {
show_404();
}
$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);
}
//CH的页面没有canonical内容在这里帮补上
$textarea_htmlcode = str_replace('<!--@CANONICAL@-->', $this->CI->config->item('site_url') . $data['information']->ic_url, $textarea_htmlcode);
//备份修改的代码
$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
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Index_ah extends CI_Controller
{
public function __construct(){
parent::__construct();
$this->load->library('simple_html_dom_lib');
}
public function index(){
$this->load->view('welcome');
}
//选择处理方式
public function choose_way(){
$this->htmlsource = $this->input->post('htmlsource');
$this->websitehost = $this->input->post('websitehost');
$this->template_name = $this->input->post('template_name');
$this->create_amp = $this->input->post('create_amp');
$this->debug = $this->input->post('debug');
/*$this->htmlsource = file_get_contents('aa.htm');
$this->websitehost = 'https://data.chinarundreisen.com';
if (! defined('BASEPATH')) {
exit('No direct script access allowed');
}
class Index_ah extends CI_Controller {
public function __construct() {
parent::__construct();
$this->load->library('simple_html_dom_lib');
}
public function index() {
$this->load->view('welcome');
}
//选择处理方式
public function choose_way() {
$this->htmlsource = $this->input->post('htmlsource');
$this->websitehost = $this->input->post('websitehost');
$this->template_name = $this->input->post('template_name');
$this->create_amp = $this->input->post('create_amp');
$this->debug = $this->input->post('debug');
/*$this->htmlsource = file_get_contents('aa.htm');
$this->websitehost = 'https://data.chinahighlightstravel.de';
$this->create_amp = 'true';
$this->template_name = 'gm';*/
if (empty($this->htmlsource) || empty($this->websitehost)) {
$this->output->set_status_header(500);
echo 'error:htmlsource or websitehost is empty!';
log_message('error', "htmlsource or websitehost is empty! " . $this->websitehost);
return false;
if (empty($this->htmlsource) || empty($this->websitehost)) {
$this->output->set_status_header(500);
echo 'error:htmlsource or websitehost is empty!';
log_message('error', "htmlsource or websitehost is empty! " . $this->websitehost);
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写的内置样式
foreach ($this->html_object->find('style') as $style_css) {
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 (substr($this->websitehost, -1, 1) == '/') {
$this->websitehost = substr($this->websitehost, 0, -1);
if (strpos($link_script, '$') !== FALSE) {
$js_jquery_content .= $link_script->innertext;
} else {
$js_inline_content .= $link_script; //js的内容包含<script>
}
//进行页面解析
$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 = 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版本 用移动端版本生成
/*
$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;
//延迟加载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(['result' => 'ok', 'data' => ['html_object' => $this->html_object, 'js_content' => $js_content]]);
}
//生成AMP版本 用移动端版本生成
/*
1.加载站点AMP模板模板只有导航、头部、底部
2.删除全部js引用和内链代码
3.删除全部css引用内联css放入<style amp-custom>
@ -172,220 +173,220 @@ class Index_ah extends CI_Controller
8.todo:增加application/ld+json
要求: 图片文件必须带有域名,否则的获取尺寸会出错,如 https://data.asiahighlights.com/pic/abc.jpg
*/
function create_amp(){
//读取站点的AMP模板
$amp_template = $this->load->view('amp-template/' . $this->template_name, null, true);
//生成移动版本,删除多余元素
foreach ($this->html_object->find('.hidden-xs') as $hidden_item) {
$hidden_item->outertext = '';
}
foreach ($this->html_object->find('title') as $title) {
$amp_template = str_replace('<!--@TITLE@-->', $title->innertext, $amp_template);
}
foreach ($this->html_object->find('meta') as $meta) {
if ($meta->name == 'description') {
$amp_template = str_replace('<!--@DESCRIPTION@-->', $meta->content, $amp_template);
}
if ($meta->name == 'keywords') {
$amp_template = str_replace('<!--@KEYWORDS@-->', $meta->content, $amp_template);
}
}
foreach ($this->html_object->find('script') as $script) {
$script->outertext = '';
}
foreach ($this->html_object->find('noscript') as $noscript) {
$noscript->outertext = '';
}
foreach ($this->html_object->find('link') as $link) {
if ($link->rel == 'stylesheet' && !empty($link->href)) {
$link->outertext = '';
}
if ($link->rel == 'canonical' && !empty($link->href)) {
$amp_template = str_replace('<!--@CANONICAL@-->', $link->href, $amp_template);
}
}
//获取图片尺寸AMP要求必须填写width和height
//格式化图片URL
foreach ($this->html_object->find('img') as $image) {
if (!empty($image->src)) {
$img_src_host = parse_url($image->src, PHP_URL_HOST);
if (empty($img_src_host)) {
$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);
}
}
function create_amp() {
//读取站点的AMP模板
$amp_template = $this->load->view('amp-template/' . $this->template_name, null, true);
//拼接请求的图片url如 https://data.asiahighlights.com/imagesize.php?photo=/pic/logo-ah.png,/pic/ah-slide-logo.png
$request_size = array();
foreach ($this->html_object->find('img') as $image) {
$img_src = $image->src;
if (!empty($image->originalsrc)) {
$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'];
}
//生成移动版本,删除多余元素
foreach ($this->html_object->find('.hidden-xs') as $hidden_item) {
$hidden_item->outertext = '';
}
//请求图片尺寸
$image_sizes = array();
foreach ($request_size as $host => $path) {
$parse_url = "https://{$host}/imagesize.php?photo=" . urlencode(implode(',', $path));
$size_data = GET_HTTP($parse_url);
if (!empty($size_data)) {
$size_data = json_decode($size_data);
foreach ($size_data as $size_item) {
$size_item->photo = "https://{$host}" . $size_item->photo;
$image_sizes[$size_item->photo] = $size_item;
}
}
}
foreach ($this->html_object->find('title') as $title) {
$amp_template = str_replace('<!--@TITLE@-->', $title->innertext, $amp_template);
}
//获取图片尺寸 end
foreach ($this->html_object->find('img') as $image) {
$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;
}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精简提高速度
foreach ($this->html_object->find('#content_main') as $content_main) {
$amp_template = str_replace('<!--@CUSTOM-CONENT@-->', $content_main, $amp_template);
}
//产品页面多做一些特殊的处理
foreach ($this->html_object->find('.tab-nav') as $tabnav) {
$amp_template = str_replace($tabnav, '', $amp_template);
foreach ($this->html_object->find('meta') as $meta) {
if ($meta->name == 'description') {
$amp_template = str_replace('<!--@DESCRIPTION@-->', $meta->content, $amp_template);
}
if ($meta->name == 'keywords') {
$amp_template = str_replace('<!--@KEYWORDS@-->', $meta->content, $amp_template);
}
}
foreach ($this->html_object->find('script') as $script) {
$script->outertext = '';
}
foreach ($this->html_object->find('noscript') as $noscript) {
$noscript->outertext = '';
}
foreach ($this->html_object->find('link') as $link) {
if ($link->rel == 'stylesheet' && ! empty($link->href)) {
$link->outertext = '';
}
if ($link->rel == 'canonical' && ! empty($link->href)) {
$amp_template = str_replace('<!--@CANONICAL@-->', $link->href, $amp_template);
}
}
//获取图片尺寸AMP要求必须填写width和height
//格式化图片URL
foreach ($this->html_object->find('img') as $image) {
if (! empty($image->src)) {
$img_src_host = parse_url($image->src, PHP_URL_HOST);
if (empty($img_src_host)) {
$img_src_host = $this->websitehost;
}
//产品页面删除表单
foreach ($this->html_object->find('.sticky') as $sticky) {
$amp_template = str_replace($sticky, '@AMPFOOTER-BUTTON@', $amp_template);
$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;
}
foreach ($this->html_object->find('form') as $form) {
$amp_template = str_replace($form, '', $amp_template);
$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
$request_size = [];
foreach ($this->html_object->find('img') as $image) {
$img_src = $image->src;
if (! empty($image->originalsrc)) {
$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_sizes = [];
foreach ($request_size as $host => $path) {
$parse_url = "https://{$host}/imagesize.php?photo=" . urlencode(implode(',', $path));
$size_data = GET_HTTP($parse_url);
if (! empty($size_data)) {
$size_data = json_decode($size_data);
foreach ($size_data as $size_item) {
$size_item->photo = "https://{$host}" . $size_item->photo;
$image_sizes[$size_item->photo] = $size_item;
}
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>';
$amp_template = str_replace('<style amp-custom>',$replace_text, $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 = '';
}
}
//获取图片尺寸 end
foreach ($this->html_object->find('img') as $image) {
$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>";
}
//把网页内容和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(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 (! 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>";
}
}
}
if (substr($url, 0, 2) == '//') { //https或http
return urldecode('https://'.substr($url, 2, strlen($url)-2)); //只替换开头的//部分url不规范有//在url中间
}
//只将中间主要部分用于css精简提高速度
foreach ($this->html_object->find('#content_main') as $content_main) {
$amp_template = str_replace('<!--@CUSTOM-CONENT@-->', $content_main, $amp_template);
}
//产品页面多做一些特殊的处理
foreach ($this->html_object->find('.tab-nav') as $tabnav) {
$amp_template = str_replace($tabnav, '', $amp_template);
}
return urldecode($host . $url);
//产品页面删除表单
foreach ($this->html_object->find('.sticky') as $sticky) {
$amp_template = str_replace($sticky, '@AMPFOOTER-BUTTON@', $amp_template);
}
foreach ($this->html_object->find('form') as $form) {
$amp_template = str_replace($form, '', $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>';
$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;
}
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
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Index_gm extends CI_Controller
{
public function __construct(){
parent::__construct();
$this->load->library('simple_html_dom_lib');
}
public function index(){
$this->load->view('welcome');
}
//选择处理方式
public function choose_way(){
$this->htmlsource = $this->input->post('htmlsource');
$this->websitehost = $this->input->post('websitehost');
$this->template_name = $this->input->post('template_name');
$this->create_amp = $this->input->post('create_amp');
$this->debug = $this->input->post('debug');
/*$this->htmlsource = file_get_contents('aa.htm');
$this->websitehost = 'https://data.chinarundreisen.com';
if (! defined('BASEPATH')) {
exit('No direct script access allowed');
}
class Index_gm extends CI_Controller {
public function __construct() {
parent::__construct();
$this->load->library('simple_html_dom_lib');
}
public function index() {
$this->load->view('welcome');
}
//选择处理方式
public function choose_way() {
$this->htmlsource = $this->input->post('htmlsource');
$this->websitehost = $this->input->post('websitehost');
$this->template_name = $this->input->post('template_name');
$this->create_amp = $this->input->post('create_amp');
$this->debug = $this->input->post('debug');
/*$this->htmlsource = file_get_contents('aa.htm');
$this->websitehost = 'https://data.chinahighlightstravel.de';
$this->create_amp = 'true';
$this->template_name = 'gm';*/
if (empty($this->htmlsource) || empty($this->websitehost)) {
$this->output->set_status_header(500);
echo 'error:htmlsource or websitehost is empty!';
log_message('error', "htmlsource or websitehost is empty! " . $this->websitehost);
return false;
if (empty($this->htmlsource) || empty($this->websitehost)) {
$this->output->set_status_header(500);
echo 'error:htmlsource or websitehost is empty!';
log_message('error', "htmlsource or websitehost is empty! " . $this->websitehost);
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写的内置样式
foreach ($this->html_object->find('style') as $style_css) {
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 (substr($this->websitehost, -1, 1) == '/') {
$this->websitehost = substr($this->websitehost, 0, -1);
if (strpos($link_script, '$') !== FALSE) {
$js_jquery_content .= $link_script->innertext;
} else {
$js_inline_content .= $link_script; //js的内容包含<script>
}
//进行页面解析
$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 = 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版本 用移动端版本生成
/*
$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;
//延迟加载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(['result' => 'ok', 'data' => ['html_object' => $this->html_object, 'js_content' => $js_content]]);
}
//生成AMP版本 用移动端版本生成
/*
1.加载站点AMP模板模板只有导航、头部、底部
2.删除全部js引用和内链代码
3.删除全部css引用内联css放入<style amp-custom>
@ -172,220 +173,220 @@ class Index_gm extends CI_Controller
8.todo:增加application/ld+json
要求: 图片文件必须带有域名,否则的获取尺寸会出错,如 https://data.asiahighlights.com/pic/abc.jpg
*/
function create_amp(){
//读取站点的AMP模板
$amp_template = $this->load->view('amp-template/' . $this->template_name, null, true);
//生成移动版本,删除多余元素
foreach ($this->html_object->find('.hidden-xs') as $hidden_item) {
$hidden_item->outertext = '';
}
foreach ($this->html_object->find('title') as $title) {
$amp_template = str_replace('<!--@TITLE@-->', $title->innertext, $amp_template);
}
foreach ($this->html_object->find('meta') as $meta) {
if ($meta->name == 'description') {
$amp_template = str_replace('<!--@DESCRIPTION@-->', $meta->content, $amp_template);
}
if ($meta->name == 'keywords') {
$amp_template = str_replace('<!--@KEYWORDS@-->', $meta->content, $amp_template);
}
}
foreach ($this->html_object->find('script') as $script) {
$script->outertext = '';
}
foreach ($this->html_object->find('noscript') as $noscript) {
$noscript->outertext = '';
}
foreach ($this->html_object->find('link') as $link) {
if ($link->rel == 'stylesheet' && !empty($link->href)) {
$link->outertext = '';
}
if ($link->rel == 'canonical' && !empty($link->href)) {
$amp_template = str_replace('<!--@CANONICAL@-->', $link->href, $amp_template);
}
}
//获取图片尺寸AMP要求必须填写width和height
//格式化图片URL
foreach ($this->html_object->find('img') as $image) {
if (!empty($image->src)) {
$img_src_host = parse_url($image->src, PHP_URL_HOST);
if (empty($img_src_host)) {
$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);
}
}
function create_amp() {
//读取站点的AMP模板
$amp_template = $this->load->view('amp-template/' . $this->template_name, null, true);
//拼接请求的图片url如 https://data.asiahighlights.com/imagesize.php?photo=/pic/logo-ah.png,/pic/ah-slide-logo.png
$request_size = array();
foreach ($this->html_object->find('img') as $image) {
$img_src = $image->src;
if (!empty($image->originalsrc)) {
$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'];
}
//生成移动版本,删除多余元素
foreach ($this->html_object->find('.hidden-xs') as $hidden_item) {
$hidden_item->outertext = '';
}
//请求图片尺寸
$image_sizes = array();
foreach ($request_size as $host => $path) {
$parse_url = "https://{$host}/imagesize.php?photo=" . urlencode(implode(',', $path));
$size_data = GET_HTTP($parse_url);
if (!empty($size_data)) {
$size_data = json_decode($size_data);
foreach ($size_data as $size_item) {
$size_item->photo = "https://{$host}" . $size_item->photo;
$image_sizes[$size_item->photo] = $size_item;
}
}
}
foreach ($this->html_object->find('title') as $title) {
$amp_template = str_replace('<!--@TITLE@-->', $title->innertext, $amp_template);
}
//获取图片尺寸 end
foreach ($this->html_object->find('img') as $image) {
$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;
}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精简提高速度
foreach ($this->html_object->find('#content_main') as $content_main) {
$amp_template = str_replace('<!--@CUSTOM-CONENT@-->', $content_main, $amp_template);
}
//产品页面多做一些特殊的处理
foreach ($this->html_object->find('.tab-nav') as $tabnav) {
$amp_template = str_replace($tabnav, '', $amp_template);
foreach ($this->html_object->find('meta') as $meta) {
if ($meta->name == 'description') {
$amp_template = str_replace('<!--@DESCRIPTION@-->', $meta->content, $amp_template);
}
if ($meta->name == 'keywords') {
$amp_template = str_replace('<!--@KEYWORDS@-->', $meta->content, $amp_template);
}
}
foreach ($this->html_object->find('script') as $script) {
$script->outertext = '';
}
foreach ($this->html_object->find('noscript') as $noscript) {
$noscript->outertext = '';
}
foreach ($this->html_object->find('link') as $link) {
if ($link->rel == 'stylesheet' && ! empty($link->href)) {
$link->outertext = '';
}
if ($link->rel == 'canonical' && ! empty($link->href)) {
$amp_template = str_replace('<!--@CANONICAL@-->', $link->href, $amp_template);
}
}
//获取图片尺寸AMP要求必须填写width和height
//格式化图片URL
foreach ($this->html_object->find('img') as $image) {
if (! empty($image->src)) {
$img_src_host = parse_url($image->src, PHP_URL_HOST);
if (empty($img_src_host)) {
$img_src_host = $this->websitehost;
}
//产品页面删除表单
foreach ($this->html_object->find('.sticky') as $sticky) {
$amp_template = str_replace($sticky, '@AMPFOOTER-BUTTON@', $amp_template);
$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;
}
foreach ($this->html_object->find('form') as $form) {
$amp_template = str_replace($form, '', $amp_template);
$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
$request_size = [];
foreach ($this->html_object->find('img') as $image) {
$img_src = $image->src;
if (! empty($image->originalsrc)) {
$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_sizes = [];
foreach ($request_size as $host => $path) {
$parse_url = "https://{$host}/imagesize.php?photo=" . urlencode(implode(',', $path));
$size_data = GET_HTTP($parse_url);
if (! empty($size_data)) {
$size_data = json_decode($size_data);
foreach ($size_data as $size_item) {
$size_item->photo = "https://{$host}" . $size_item->photo;
$image_sizes[$size_item->photo] = $size_item;
}
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>';
$amp_template = str_replace('<style amp-custom>',$replace_text, $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 = '';
}
}
//获取图片尺寸 end
foreach ($this->html_object->find('img') as $image) {
$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>";
}
//把网页内容和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(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 (! 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>";
}
}
}
if (substr($url, 0, 2) == '//') { //https或http
return urldecode('https://'.substr($url, 2, strlen($url)-2)); //只替换开头的//部分url不规范有//在url中间
}
//只将中间主要部分用于css精简提高速度
foreach ($this->html_object->find('#content_main') as $content_main) {
$amp_template = str_replace('<!--@CUSTOM-CONENT@-->', $content_main, $amp_template);
}
//产品页面多做一些特殊的处理
foreach ($this->html_object->find('.tab-nav') as $tabnav) {
$amp_template = str_replace($tabnav, '', $amp_template);
}
return urldecode($host . $url);
//产品页面删除表单
foreach ($this->html_object->find('.sticky') as $sticky) {
$amp_template = str_replace($sticky, '@AMPFOOTER-BUTTON@', $amp_template);
}
foreach ($this->html_object->find('form') as $form) {
$amp_template = str_replace($form, '', $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>';
$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;
}
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@-->">
<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>
<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>
<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>
@ -37,8 +37,8 @@
<!--@CUSTOM-CONENT@-->
@AMP-COMMON-FOOTER@
@AMP-USERR-NOTIFICATION@
@AMP-COMMON-FOOTER@
@AMP-USERR-NOTIFICATION@
<div class="fixed-addthis"><amp-addthis width="320" height="48" layout="responsive" data-pub-id="ra-58255ecaa2c44e0d" data-widget-id="mip1"></amp-addthis></div>

@ -6,34 +6,34 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<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 href="https://data.chinarundreisen.com/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 src="https://data.chinarundreisen.com/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>
<link rel="stylesheet" href="//data.chinahighlightstravel.de/min/?f=/css/base.css,/css/header.css,/css/kunden-form.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.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.chinahighlightstravel.de/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-timepicker-addon.js" type="text/javascript"></script>
<!--[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]-->
<style type="text/css">.popover{background-color:#f2f600;}</style>
</head>
<body>
<div id="warp">
<!-- 移动端导航start -->
<!-- 移动端导航start -->
<div class="sidenav-box cbp-spmenu cbp-spmenu-vertical cbp-spmenu-left visible-sm visible-xs" id="menu" style="overflow-y: scroll;">
<div class="sidenav-top">
<ul>
<li><a href="/" class="home"></a></li>
<li><a href="/ueber-uns/" class="contact"></a></li>
<li><a href="/kontakt/" class="email"></a></li>
<li><a href="tel://800-8224462" class="cell"></a></li>
<li><a href="tel://800-8224462" class="cell"></a></li>
</ul>
<div class="clearfix"></div>
</div>
<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 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">
<li><a href="/chinareisen/">China Reisen 2018</a></li>
<li><a href="/china-individualreisen/">China Individualreisen</a></li>
@ -58,7 +58,7 @@
<li><a href="/ueber-uns/">über uns</a></li>
</ul>
</div>
<div class="phone-header cbp-spmenu-push visible-sm visible-xs" id="phoneheader">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse">
<i class="fa fa-navicon" id="showLeftPush"></i>
@ -66,14 +66,14 @@
<div class="phone-logo">Chinarundreisen</div>
<a href="/massgeschneiderte-china-reisen/" class="white-btn">Anfragen</a>
</div>
<!-- 移动端导航end -->
<!-- 移动端导航end -->
<!-- pc端导航start -->
<!-- pc端导航start -->
<div id="header" class="hidden-sm hidden-xs">
<div class="container">
<div class="logo">
<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>
</div>
<div class="top-content">
@ -90,14 +90,14 @@
<ul>
<li><a href="/">Home</a></li>
<li><a href="/china-rundreisen/">Chinarundreisen</a></li>
<li><a href="/massgeschneiderte-china-reisen/">Maßschneidern Ihrer Reise</a></li>
<li><a href="/reiseziele/">Reiseziele</a></li>
<li><a href="/guide-book/">Reiseführer</a></li>
<li><a href="/china-info/kultur.htm">Kultur</a></li>
</ul>
<div class="clearfix"></div>
</div>
</div>
<div class="nav-sub">
<div class="clearfix"></div>
</div>
@ -105,11 +105,11 @@
<div class="clearfix"></div>
</div>
</div>
<!-- pc端导航end -->
<!-- pc端导航end -->
<!-- content -->
<div class="bg-gray">
<div class="container">
<div class="container">
<div class="row mtop30">
<div class="col-xs-12 col-sm-12 col-md-8">
<h1>Vielen Dank für die Buchung bei Chinarundreisen!<br/>Bitte füllen Sie das folgende Formular aus</h1>
@ -117,7 +117,7 @@
<span class="note-tag">!</span>
Bitte prüfen Sie, ob Ihr Name richtig geschrieben ist (vollständiger Name wie im Reisepass) . Da wir die Folgekosten durch ein wegen falschem Namen stornierten Hotel oder Flugticketnicht tragen, ist die richtige Schreibweise Ihres Namens und Ihrer alle Daten unbedingt wichtig.
</div>
<form id="form-confirm-info" method="post" action="/secureinfoconfirm/confirm/save_confirm_info">
<div class="kunden-info-box ">
<h2>Fluginformationen</h2>
@ -149,7 +149,7 @@
</div>
</div>
</div>
<div class="kunden-info-box ">
<h2>Kundeninformationen</h2>
<div class="kunden-info ">
@ -210,12 +210,12 @@
<div class="clearfix"></div>
</div>
</div>
<p class="red addperson">
<a href="javacript:void(0);"><span class="add-btn">+</a> Mitreisende hinzufügen
</p>
<div class="b-text">
<div class="add-content">
<div class="form-group">
<label class="col-xs-12 col-sm-12 col-md-3 form-col">Kontakttelefon</label>
@ -240,17 +240,17 @@
</div>
</div>
</div>
<div class="kunden-info-box ">
<h2>Besondere Anforderungen</h2>
<div class="kunden-info ">
<textarea name="special_request" class="form-control" cols="30" rows="5" placeholder="Großes Bett für
Vegetarisches Essen für
Vegetarisches Essen für
Andere Abfahrts-/Ankunftszeit für
" required></textarea>
</div>
</div>
<div class="kunden-info-box ">
<h2>Kontaktinformationen für Notfälle<span class="font16"> (im Falle eines Notfalls während Ihrer Chinareise)</span></h2>
<div class="kunden-info ">
@ -287,22 +287,22 @@ Andere Abfahrts-/Ankunftszeit für
</div>
</div>
</div>
<div class=" text-center">
<input type="hidden" name="toname" value="<?php echo $userinfo[0]->OPI_FirstName; ?>">
<input type="hidden" name="tomail" value="<?php echo $userinfo[0]->OPI_Email; ?>">
<input type="hidden" name="tomail" value="<?php echo $userinfo[0]->OPI_Email; ?>">
<input type="hidden" name="COLI_ID" value="<?php echo $userinfo[0]->COLI_ID; ?>">
<input type="hidden" name="COLI_SN" value="<?php echo $userinfo[0]->COLI_SN; ?>">
<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>
<p><img src="https://data.chinarundreisen.com/pic/btn-text.jpg" width="311" height="30" /></p>
<button href="javascript:;" id="form-confirm-info" class="btn btn-danger btn-lg">Überprüfen & Absenden</button>
<p><img src="https://data.chinahighlightstravel.de/pic/btn-text.jpg" width="311" height="30" /></p>
</div>
<div class="form-footer">
Copyright © 2002. Chinarundreisen.com Alle Rechte vorbehalten.
</div>
</div>
</div>
</div>
</div>
</div>
@ -333,7 +333,7 @@ $(function(){
changeYear: false,
timeFormat: 'H:mm'
});
//用on来绑定防止新添加的元素无法相应初始化配置但是有一个bug如果第一次直接点击无法启用日历
$('body').on('click',function(){
//生日
@ -346,7 +346,7 @@ $(function(){
yearRange: '1920:2015',
timeFormat: 'mm/dd/yy'
});
//护照过期时间
$('.passport_expiration_date').datepicker({
controlType: 'select',
@ -357,17 +357,17 @@ $(function(){
timeFormat: 'mm/dd/yy'
});
});
//添加乘客
$('.addperson').click(function(){
var addhtml = '<div class="b-text"></div><div class="form-content"><div class="form-group"><label class="col-xs-12 col-sm-12 col-md-3 form-col">Name</label><div class="col-sm-6 col-md-5 form-col"><div class="gender-left"><select class="form-control" name="gender[]"><option value="100003"> Frau</option><option value="100001"> Herr</option></select></div><div class="gender-right"><input class="form-control require" name="sur_name[]" placeholder="Nachname" type="text"></div></div><div class="col-xs-12 col-sm-12 col-md-4 form-col"><input type="text" name="given_name[]" class="form-control" placeholder="Name"></div><div class="clearfix"></div></div><div class="form-group"><label class="col-xs-12 col-sm-12 col-md-3 form-col">Geburtstag</label><div class="col-sm-6 col-md-5 form-col"><input type="text" class="form-control calendar bd_datepicker" name="birthday[]"></div><div class="clearfix"></div></div><div class="form-group"><label class="col-xs-12 col-sm-12 col-md-3 form-col">Passnr.</label><div class="col-xs-12 col-sm-12 col-md-5 form-col"><input type="text" class="form-control" name="passport[]"></div><div class="clearfix"></div></div><div class="form-group"><label class="col-xs-12 col-sm-12 col-md-3 form-col line2">Verfallsdatum <br>des Reisepasses</label><div class="col-xs-12 col-sm-12 col-md-5 form-col"><input type="text" class="form-control calendar passport_expiration_date" name="passport_expiration_date[]"></div><div class="clearfix"></div></div><div class="form-group"><label class="col-xs-12 col-sm-12 col-md-3 form-col">Nationalität</label><div class="col-xs-12 col-sm-12 col-md-5 form-col"><select class="form-control" name="nationality[]"><option selected="selected" disabled="disabled"> Nationalität</option><option value="6"> Deutschland</option><option value="25"> Die Schweiz</option><option value="470"> Österreich</option><option value="572">Luxemburg</option><option value="5">Kanada</option><option value="8">Frankreich</option></select></div><div class="clearfix"></div></div></div>';
$(this).before(addhtml);
});
var coli_sn = <?php echo $userinfo[0]->COLI_SN;?>;
var coli_sn = <?php echo $userinfo[0]->COLI_SN; ?>;
//ajax获取新生成页面的url
$.ajax({
type: "post",
@ -376,7 +376,7 @@ $(function(){
$('.addmemeber').attr('href',return_url);
}
});
//提交信息
$("#form-confirm-info").submit(function(event){
event.preventDefault();

@ -6,16 +6,16 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<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.chinarundreisen.com/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/bootstrap/css/bootstrap.min.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.chinahighlightstravel.de/information-view/information/css/bootstrap-datetimepicker.min.css?v=201506022" rel="stylesheet" type="text/css"/>
<!--[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]-->
<script src="https://data.chinarundreisen.com/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.chinarundreisen.com/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.min.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.chinahighlightstravel.de/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-timepicker-addon.js" type="text/javascript"></script>
<style type="text/css">.popover{background-color:#f2f600;}</style>
</head>
@ -28,20 +28,24 @@
<div class="row">
<div class="col-lg-3 col-sm-4 logobox hidden-xs">
<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>
</div>
<div class="col-lg-14 col-sm-13 col-lg-offset-3 col-sm-offset-4">
<div class="navbar-header">
<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">Buchungsnummer: <?php echo $userinfo[0]->COLI_ID; ?></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">Buchungsnummer: <?php echo $userinfo[0]->COLI_ID; ?></div>
</div>
</div>
<div class="col-lg-7 col-sm-7 hidden-xs pull-right nopadding">
<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="currentNo col-sm-24 nopadding"> 800-822-4462(gebührenfrei aus Deutschland)</div>
</div>
@ -79,7 +83,7 @@
<div class="col-xs-18 nopadding-L" style="height:15px;">
<div class="col-xs-11 nopadding text-right">Nachname</div>
<div class="col-xs-1 nopadding text-right" style="font-size:18px;width:10px;">/</div>
<div class="col-xs-11 nopadding" style="padding-left: 2px !important;">Name</div>
<div class="col-xs-11 nopadding" style="padding-left: 2px !important;">Name</div>
</div>
</label>
</div>
@ -92,7 +96,7 @@
<div class="form-group col-sm-5 nopadding-R" style="margin-bottom:0px;">
<label class="" style="font-weight:normal">Verfallsdatum des Reisepasses</label>
</div>
<div class="form-group col-sm-4" style="margin-bottom:0px;">
<label class="" style="font-weight:normal">Nationalität</label>
</div>
@ -124,13 +128,13 @@
</div>
</div>
</div>
<div class="form-group col-sm-4 nopadding-R">
<div class="input-groups date " data-date="1970-05-20">
<input class="form-control input-sm common_input bd_datepicker" type="text" name="birthday[]" value="" data-trigger="manual" data-container="body" data-toggle="popover" data-placement="top" data-content="Bitte tragen Sie Ihr Geburtsdatum ein!" autocomplete="off" style="color:#333333 !important;">
</div>
</div>
<div class="form-group col-sm-4 nopadding-R">
<input type="text" class="form-control input-sm common_input" name="passport[]" value="" data-trigger="manual" data-container="body" data-toggle="popover" data-placement="top" data-content="Bitte tragen Sie Ihre Ausweisnummer ein!" autocomplete="off">
</div>
@ -141,7 +145,7 @@
</div>
</div>
<div class="form-group col-sm-4">
<div class="input-group">
@ -161,7 +165,7 @@
</option>
</optgroup>
<optgroup label="--Mehr Nationalitäten--">
<option value="5">
Kanada
</option>
@ -178,7 +182,7 @@
</span>
</div>
</div>
</div>
<div class="col-xs-24 add-personinfo-box">
@ -203,7 +207,7 @@
</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="input-group">
<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">
</div>
</div>
<?php } ?>
<?php }?>
</div>
</div>
@ -288,7 +292,7 @@
<div class="form-group">
<div class="col-xs-24 nopadding">
<textarea class="form-control input-sm" rows="5" name="special_request" placeholder="Großes Bett für
Vegetarisches Essen für
Vegetarisches Essen für
Andere Abfahrts-/Ankunftszeit für
"></textarea>
</div>
@ -299,27 +303,27 @@ Andere Abfahrts-/Ankunftszeit für
</div>
</div>
</div>
<?php if($userinfo[0]->COLI_CustomerType!=44003){ ?>
<?php if ($userinfo[0]->COLI_CustomerType != 44003) {?>
<div class="col-xs-24">
<div class="panel panel-default">
<div class="panel-body">
<div class="row panel-new-head">
<h4 class="text-red">
Kontaktinformationen für Notfälle
Kontaktinformationen für Notfälle
<span class="text-muted" style="font-size:15px;">(im Falle eines Notfalls während Ihrer Chinareise)</span>
</h4>
</div>
<div class="col-xs-24 new-form-horizontal emergencyx_box">
<div class="form-group col-sm-13">
<label class="col-sm-9 control-label nopadding-L">Kontaktsperson</label>
<div class="col-sm-13 nopadding">
<input type="text" class="form-control input-sm" name="emergency_person_name" value="" data-trigger="manual" data-container="body" data-toggle="popover" data-placement="top" data-content="Bitte tragen Sie Ihren Kontakt für Notfälle ein!">
</div>
</div>
<div class="form-group col-sm-11">
<label class="col-sm-7 control-label nopadding-L">Email Adresse</label>
<div class="col-sm-17 nopadding">
@ -347,18 +351,18 @@ Andere Abfahrts-/Ankunftszeit für
</div>
</div>
</div>
<?php } ?>
<?php }?>
<div class="col-xs-24">
<input type="hidden" name="toname" value="<?php echo $userinfo[0]->OPI_FirstName; ?>">
<input type="hidden" name="tomail" value="<?php echo $userinfo[0]->OPI_Email; ?>">
<input type="hidden" name="tomail" value="<?php echo $userinfo[0]->OPI_Email; ?>">
<input type="hidden" name="COLI_ID" value="<?php echo $userinfo[0]->COLI_ID; ?>">
<input type="hidden" name="COLI_SN" value="<?php echo $userinfo[0]->COLI_SN; ?>">
<input type="hidden" name="visitor_link" value="<?php echo $visitor_link; ?>">
<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>
</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>
</form>
@ -477,7 +481,7 @@ $(document).ready(function(){
$currentbox.find('input').val('');
$currentbox.find('.datepicker').removeClass('hasDatepicker').attr('id','');
$currentbox.find('.bd_datepicker').removeClass('hasDatepicker').attr('id','');
$('.datepicker').datepicker({
controlType: 'select',
oneLine: true,
@ -495,7 +499,7 @@ $(document).ready(function(){
yearRange: '1920:2015',
timeFormat: 'mm/dd/yy'
});
});
//日期初始化

@ -7,13 +7,13 @@
<meta name="robots" content="noindex,nofollow" />
<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.chinarundreisen.com/information-view/information/css/order.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.chinahighlightstravel.de/information-view/information/css/order.css" rel="stylesheet" type="text/css"/>
<!--[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]-->
<script src="https://data.chinarundreisen.com/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/information/js/jquery.min.js" type="text/javascript"></script>
<script src="https://data.chinahighlightstravel.de/information-view/bootstrap/js/bootstrap.js" type="text/javascript"></script>
</head>
@ -26,7 +26,7 @@
<div class="row">
<div class="col-lg-3 col-sm-4 logobox hidden-xs">
<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>
</div>
<div class="col-lg-16 col-sm-13 col-lg-offset-3 col-sm-offset-4">
@ -61,9 +61,9 @@
</div>
<div class="modal-body" style="height:150px;">
<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><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->

@ -15,13 +15,13 @@
<h3>静态化更新-系列站专用</h3>
</div>
<div class="modal-body">
<label>需要更新的页面</label>
<input type="text" class="span6" name="static_html_url" id="static_html_url" placeholder="如http://www.voyageschine.com/shanghai-voyage/" />
<input type="hidden" name="updatecdn_byhand" id="updatecdn_byhand" value="">
<p class="text-error" id="cache_refresh_modal_msg" name="cache_refresh_modal_msg"></p>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal">关闭</button>
@ -40,7 +40,7 @@
</div>
<div class="modal-body">
<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="">
<p class="text-danger" id="cdncache_refresh_modal_msg" name="cdncache_refresh_modal_msg"></p>

@ -44,7 +44,7 @@
</div>
<div class="modal-body">
<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="">
<p class="text-danger" id="cdncache_refresh_modal_msg" name="cdncache_refresh_modal_msg"></p>

@ -37,18 +37,18 @@
// window.KCFinder = {};
// window.KCFinder.callBack = function (url) {
// <?php
// switch ($this->config->item('site_code')) {
// case 'ah':
// echo "alert(url.replace('/kcfinder/upload/ah/','https://data.asiahighlights.com/'));";
// break;
// case 'gm':
// echo "alert(url.replace('/kcfinder/upload/gm/','https://data.chinarundreisen.com/'));";
// break;
// default:
// echo 'alert(url);';
// }
// ?>
// <?php
// switch ($this->config->item('site_code')) {
// case 'ah':
// echo "alert(url.replace('/kcfinder/upload/ah/','https://data.asiahighlights.com/'));";
// break;
// case 'gm':
// echo "alert(url.replace('/kcfinder/upload/gm/','https://data.chinahighlightstravel.de/'));";
// break;
// default:
// echo 'alert(url);';
// }
// ?>
// 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');
@ -202,21 +202,21 @@
<span class="input-group-btn">
<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
$admin_info = $this->session->userdata('session_admin');
echo 'https://multimedia.mycht.cn/authorise/' . $admin_info['OPI_SN'] . '/' . $this->config->item('site_code') ?>"
$admin_info = $this->session->userdata('session_admin');
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
class="glyphicon glyphicon-picture"></span></a>
<?php } else { ?>
<?php } else {?>
<a href="#" onclick="openKCFinder_singleFile_res();" class="btn btn-default btn-sm" title="快速上传图片"><span
class="glyphicon glyphicon-picture"></span></a>
<a target="_blank"
href="<?php
$admin_info = $this->session->userdata('session_admin');
echo 'https://multimedia.mycht.cn/authorise/' . $admin_info['OPI_SN'] . '/' . $this->config->item('site_code') ?>"
$admin_info = $this->session->userdata('session_admin');
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>
<?php } ?>
<?php }?>
<a href="#" title="静态化更新" class="btn btn-default btn-sm" data-toggle="modal"
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"
@ -226,29 +226,33 @@
</form>
<ul class="nav navbar-nav navbar-right">
<?php
$all_unread_sms = get_all_unread_sms();
$info_unread_sms = get_all_unread_sms('info');
if (isset($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]);
$all_unread_sms = get_all_unread_sms();
$info_unread_sms = get_all_unread_sms('info');
if (isset($information->ic_id)) {
$current_msg = $information->ic_id;
}
?>
<?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]);
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($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">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="icon-envelope icon-white pull-left" style="margin-top:3px;"></i> <span
@ -258,53 +262,53 @@
</a>
<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);"
onclick="set_allmsg_to_read($('#unreadinfomsg').val());">标记全部收录信息为已读</a>
<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); ?>">
<?php
$t_title = get_text_short($m[0]->t_title, 15);
echo '[' . $m[0]->ic_sitecode . '] ' . $t_title['content'] . ' (' . $m[0]->m_content . ')';
?>
$t_title = get_text_short($m[0]->t_title, 15);
echo '[' . $m[0]->ic_sitecode . '] ' . $t_title['content'] . ' (' . $m[0]->m_content . ')';
?>
</a>
</li>
<?php $unread_sms_ic_id .= ',' . $m[0]->m_object_id; ?>
<?php } ?>
<?php }?>
<li class="divider"></li>
<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); ?>">
<?php
$t_title = get_text_short($am[0]->t_title, 15);
echo $t_title['content'] . ' (' . count($am) . ')';
?>
$t_title = get_text_short($am[0]->t_title, 15);
echo $t_title['content'] . ' (' . count($am) . ')';
?>
</a>
</li>
<?php } ?>
<?php }?>
</ul>
</li>
<?php } ?>
<?php }?>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<?php
echo $this->config->item('site_code');
echo ' -';
$admin_info = $this->session->userdata('session_admin');
echo $admin_info['OPI_Name'];
echo $this->config->item('site_code');
echo ' -';
$admin_info = $this->session->userdata('session_admin');
echo $admin_info['OPI_Name'];
?>
<b class="caret"></b>
</a>
<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']); ?>">
<?php echo $site_item['site_code'] ?>
</a>
</li>
<?php } ?>
<?php }?>
<li><a href="<?php echo site_url('login/out'); ?>">退出</a></li>
</ul>
</li>

File diff suppressed because it is too large Load Diff

@ -366,7 +366,7 @@
<span class="followtitle">Language</span>
<div class="listtour" style="display: flex;">
<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.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>

@ -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.
|
*/
$config['base_url'] = '';
$config['base_url'] = '';
/*
|--------------------------------------------------------------------------
@ -44,7 +46,7 @@ $config['index_page'] = 'author.php';
| '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.
|
*/
$config['language'] = 'english';
$config['language'] = 'english';
/*
|--------------------------------------------------------------------------
@ -93,7 +95,6 @@ $config['charset'] = 'UTF-8';
*/
$config['enable_hooks'] = FALSE;
/*
|--------------------------------------------------------------------------
| Class Extension Prefix
@ -108,7 +109,6 @@ $config['enable_hooks'] = FALSE;
*/
$config['subclass_prefix'] = 'MY_';
/*
|--------------------------------------------------------------------------
| Allowed URL Characters
@ -128,7 +128,6 @@ $config['subclass_prefix'] = 'MY_';
*/
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
/*
|--------------------------------------------------------------------------
| Enable Query Strings
@ -154,11 +153,11 @@ $config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
| use segment based URLs.
|
*/
$config['allow_get_array'] = TRUE;
$config['allow_get_array'] = TRUE;
$config['enable_query_strings'] = FALSE;
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';
$config['directory_trigger'] = 'd'; // experimental not currently in use
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';
$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
|
*/
$config['sess_cookie_name'] = 'ci_session_author';
$config['sess_expiration'] = 7200;
$config['sess_expire_on_close'] = FALSE;
$config['sess_encrypt_cookie'] = true;
$config['sess_use_database'] = FALSE;
$config['sess_table_name'] = 'ci_sessions_author';
$config['sess_match_ip'] = FALSE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update'] = 300;
$config['sess_cookie_name'] = 'ci_session_author';
$config['sess_expiration'] = 7200;
$config['sess_expire_on_close'] = FALSE;
$config['sess_encrypt_cookie'] = true;
$config['sess_use_database'] = FALSE;
$config['sess_table_name'] = 'ci_sessions_author';
$config['sess_match_ip'] = FALSE;
$config['sess_match_useragent'] = TRUE;
$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.
|
*/
$config['cookie_prefix'] = "";
$config['cookie_domain'] = "";
$config['cookie_path'] = "/";
$config['cookie_secure'] = FALSE;
$config['cookie_prefix'] = "";
$config['cookie_domain'] = "";
$config['cookie_path'] = "/";
$config['cookie_secure'] = FALSE;
/*
|--------------------------------------------------------------------------
@ -293,10 +292,10 @@ $config['global_xss_filtering'] = FALSE;
| 'csrf_cookie_name' = The cookie name
| 'csrf_expire' = The number in seconds the token should expire.
*/
$config['csrf_protection'] = FALSE;
$config['csrf_token_name'] = 'csrf_test_name';
$config['csrf_protection'] = FALSE;
$config['csrf_token_name'] = 'csrf_test_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';
/*
|--------------------------------------------------------------------------
| Rewrite PHP Short Tags
@ -343,7 +341,6 @@ $config['time_reference'] = 'local';
*/
$config['rewrite_short_tags'] = FALSE;
/*
|--------------------------------------------------------------------------
| Reverse Proxy IPs
@ -357,7 +354,6 @@ $config['rewrite_short_tags'] = FALSE;
*/
$config['proxy_ips'] = '';
//多媒体中心的本地图片路径
//上传图片是异步上网的所以用此url进行本地预览
$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 */
/* Location: ./application/config/config.php */
$config['site'] = array(
'cht' => array('site_code' => 'cht', 'site_id' => 14, 'site_lgc' => '1', 'site_url' => 'http://www.chinahighlights.com'),
'gm' => array('site_code' => 'gm', 'site_id' => 22, 'site_lgc' => '4', 'site_url' => 'http://www.chinarundreisen.com'),
'vc' => array('site_code' => 'vc', 'site_id' => 30, 'site_lgc' => '5', 'site_url' => 'http://www.voyageschine.com'),
'jp' => array('site_code' => 'jp', 'site_id' => 88, 'site_lgc' => '3', 'site_url' => 'http://www.arachina.com'),
'vac' => array('site_code' => 'vac', 'site_id' => 95, 'site_lgc' => '6', 'site_url' => 'http://www.viaje-a-china.com'),
'it' => array('site_code' => 'it', 'site_id' => 168, 'site_lgc' => '8', 'site_url' => 'http://www.viaggio-in-cina.it'),
'ru' => array('site_code' => 'ru', 'site_id' => 102, 'site_lgc' => '7', 'site_url' => 'http://www.chinahighlights.ru'),
'wt' => array('site_code' => 'wt', 'site_id' => 172, 'site_lgc' => '2', 'site_url' => 'http://www.iiiyooo.com'),
'tbt' => array('site_code' => 'tbt', 'site_id' => 169, 'site_lgc' => '1', 'site_url' => 'http://www.tibettravel.info'),
'sht' => array('site_code' => 'sht', 'site_id' => 96, 'site_lgc' => '1', 'site_url' => 'http://www.shanghaihighlights.com'),
'yz' => array('site_code' => 'yz', 'site_id' => 89, 'site_lgc' => '1', 'site_url' => 'http://www.yangtzeriver.org'),
'gl' => array('site_code' => 'gl', 'site_id' => 90, 'site_lgc' => '1', 'site_url' => 'http://www.guilinchina.net'),
'mbj' => array('site_code' => 'mbj', 'site_id' => 98, 'site_lgc' => '1', 'site_url' => 'http://www.mybeijingchina.com'),
'ct' => array('site_code' => 'ct', 'site_id' => 1000, 'site_lgc' => '104', 'site_url' => 'http://www.chinatravel.com'),
'ah' => array('site_code' => 'ah', 'site_id' => 141, 'site_lgc' => '1', 'site_url' => 'https://www.asiahighlights.com/'),
'dct' => array('site_code' => 'dct', 'site_id' => 99, 'site_lgc' => '1', 'site_url' => 'http://www.diychinatours.com')
);
$config['auhtor_task_type'] = array(
'翻译' => 'translate',
'修改' => 'modify',
'审核' => 'review',
'投稿' => 'contribute'
);
$config['site'] = [
'cht' => ['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'],
'vc' => ['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'],
'vac' => ['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'],
'ru' => ['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'],
'tbt' => ['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'],
'yz' => ['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'],
'mbj' => ['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'],
'ah' => ['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'],
];
$config['auhtor_task_type'] = [
'翻译' => 'translate',
'修改' => 'modify',
'审核' => 'review',
'投稿' => 'contribute',
];
//当前站点代号默认是cht用户登录之后修改
$config['site_code']='cht';
$config['site_code'] = 'cht';

@ -1,115 +1,109 @@
<?php
//订单号 -> IP
//
//{
// "COLI_WebCode": "JP",
// "COLI_ID": "ZPL161028068",
// "COLI_ApplyDate": "2016-04-15 23:17:20",
// "COLI_SenderIP": "116.226.169.236"
//}
//
//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/
//
//
$order_id = isset($_GET['order_id']) ? $_GET['order_id'] : FALSE;
$order_id = isset($_POST['order_id']) ? $_POST['order_id'] : $order_id;
//$site = isset($_GET['site']) ? $_GET['site'] : FALSE;
//$site = isset($_POST['site']) ? $_POST['site'] : $site;
$ip = '255.255.255.255';
$web_code = FALSE;
$date = date('Y-m-d h:i:s');
$host = array(
'xx' => 'xx',
'jp' => 'JP',
'vc' => 'FR',
'vac' => 'ES',
//订单号 -> IP
//
//{
// "COLI_WebCode": "JP",
// "COLI_ID": "ZPL161028068",
// "COLI_ApplyDate": "2016-04-15 23:17:20",
// "COLI_SenderIP": "116.226.169.236"
//}
//
//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/
//
//
$order_id = isset($_GET['order_id']) ? $_GET['order_id'] : FALSE;
$order_id = isset($_POST['order_id']) ? $_POST['order_id'] : $order_id;
//$site = isset($_GET['site']) ? $_GET['site'] : FALSE;
//$site = isset($_POST['site']) ? $_POST['site'] : $site;
$ip = '255.255.255.255';
$web_code = FALSE;
$date = date('Y-m-d h:i:s');
$host = [
'xx' => 'xx',
'jp' => 'JP',
'vc' => 'FR',
'vac' => 'ES',
'train_vac' => 'ES',
'ru' => 'RU',
'train_ru' => 'RU',
'it' => 'IT',
'train_it' => 'IT',
'cht' => 'CHT',
'ct' => 'yincheng',
'gm' => 'gm-vps',
'ah' => 'AH',
);
$host_name = array(
'jp' => 'http://www.arachina.com',
'vc' => 'http://www.voyageschine.com',
'vac' => 'http://www.viaje-a-china.com',
'ru' => 'RU',
'train_ru' => 'RU',
'it' => 'IT',
'train_it' => 'IT',
'cht' => 'CHT',
'ct' => 'yincheng',
'gm' => 'gm-vps',
'ah' => 'AH',
];
$host_name = [
'jp' => 'http://www.arachina.com',
'vc' => 'http://www.voyageschine.com',
'vac' => 'http://www.viaje-a-china.com',
'train_vac' => 'http://www.viaje-a-china.com',
'ru' => 'http://www.chinahighlights.ru',
'train_ru' => 'http://www.chinahighlights.ru',
'it' => 'http://www.viaggio-in-cina.it',
'train_it' => 'http://www.viaggio-in-cina.it',
'cht' => 'http://www.chinahighlights.com',
'ct' => 'http://www.chinatravel.com',
'gm' => 'http://www.chinarundreisen.com',
'ah' => 'http://www.asiahighlights.com',
);
$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);
$order_txt = '';
$web_code = 'xx';
$order_date = '';
'ru' => 'http://www.chinahighlights.ru',
'train_ru' => 'http://www.chinahighlights.ru',
'it' => 'http://www.viaggio-in-cina.it',
'train_it' => 'http://www.viaggio-in-cina.it',
'cht' => 'http://www.chinahighlights.com',
'ct' => 'http://www.chinatravel.com',
'gm' => 'http://www.chinahighlightstravel.de',
'ah' => 'http://www.asiahighlights.com',
];
$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);
$order_txt = '';
$web_code = 'xx';
$order_date = '';
if ($order_id)
{
//if ($site == 'ch')
if ($order_id) {
//if ($site == 'ch')
//{
// $order = @file_get_contents('http://www.chinahighlights.com/api/api.php?method=order.json_by_lmr&order_id='.$order_id);
//}
//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')
{
$order = json_decode($order);
$ip = $order->COLI_SenderIP;
if (!$ip || $ip=='159.8.126.74' || $ip=='180.140.114.208')
{
$ip = null;
}
$web_code = $order->COLI_WebCode;
$order_date = $order->COLI_ApplyDate;
$date_time = strtotime($order->COLI_ApplyDate);
$bf_date = date('m/d/Y:00:00:00', $date_time - 3600*24*90);
$af_date = date('m/d/Y:00:00:00', $date_time + 3600*24*90);
$order_txt = $order->COLI_OrderDetailText;
if ($order && $order !== 'no data') {
$order = json_decode($order);
$ip = $order->COLI_SenderIP;
if (! $ip || $ip == '159.8.126.74' || $ip == '180.140.114.208') {
$ip = null;
}
$web_code = $order->COLI_WebCode;
$order_date = $order->COLI_ApplyDate;
$date_time = strtotime($order->COLI_ApplyDate);
$bf_date = date('m/d/Y:00:00:00', $date_time - 3600 * 24 * 90);
$af_date = date('m/d/Y:00:00:00', $date_time + 3600 * 24 * 90);
$order_txt = $order->COLI_OrderDetailText;
}
}
}
//连接Splunk SDK
require_once '../Splunk.php';
$connect_arguments = array(
'scheme' => 'https',
'host' => '192.155.250.125',
'port' => 8089,
//连接Splunk SDK
require_once '../Splunk.php';
$connect_arguments = [
'scheme' => 'https',
'host' => '192.155.250.125',
'port' => 8089,
'username' => 'haina',
'password' => '383d43GZ82[Ai',
);
$service = new Splunk_Service($connect_arguments);
$service->login();
];
$service = new Splunk_Service($connect_arguments);
$service->login();
//查询IP
//[EXA] host=ES "68.180.229.232" earliest="11/1/2016:00:00:00" latest="11/2/2016:00:00:00"
$results = array();
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")';
//查询IP
//[EXA] host=ES "68.180.229.232" earliest="11/1/2016:00:00:00" latest="11/2/2016:00:00:00"
$results = [];
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")';
//调用Spluck Search
$job = $service->getJobs()->create($search);
while (!$job->isDone())
{
while (! $job->isDone()) {
$job->refresh();
}
$results = $job->getResults();
}
}
?><!DOCTYPE html>
<html lang="en">
@ -155,41 +149,62 @@ pre {margin-top: 5px;font-size: 0.8em;}
<form class="form-inline" action="" method="post" id="sform">
<div class="form-group has-success">
<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>
<button type="submit" class="btn btn-primary" data-loading-text="Loading..." id="btn6">查询</button>
</form>
</div>
<div class="alert alert-info" role="alert" id="fix_alert">
<?php
if ($web_code) echo(' [站点:'.$web_code.']');
if ($order_date) echo(' [提交日期:'.$order_date.']');
if ($order_txt) echo('<pre>'.$order_txt.'</pre>');
//echo(' 【SPL'.$search.'】');
<?php
if ($web_code) {
echo(' [站点:' . $web_code . ']');
}
if ($order_date) {
echo(' [提交日期:' . $order_date . ']');
}
if ($order_txt) {
echo('<pre>' . $order_txt . '</pre>');
}
//echo(' 【SPL'.$search.'】');
?>
</div>
<!--nav>
<ul class="pagination">
<?php
$page = 1;
$page_count = 10;
$prev_cls = '';
if ($page == 1) $prev_cls = 'disabled';
$next_cls = '';
if ($page == $page_count) $next_cls = 'disabled';
$page = 1;
$page_count = 10;
$prev_cls = '';
if ($page == 1) {
$prev_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">
<span aria-hidden="true">&laquo;</span>
</a>
</li>
<?php for ($i=1; $i<=$page_count; $i++) {
$cls = '';
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);?>">
<?php for ($i = 1; $i <= $page_count; $i++) {
$cls = '';
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); ?>">
<a href="#" aria-label="Next" id="next">
<span aria-hidden="true">&raquo;</span>
</a>
@ -198,116 +213,101 @@ pre {margin-top: 5px;font-size: 0.8em;}
</nav-->
<table class="table table-bordered table-hover">
<?php
$messages = array();
$anyRows = FALSE;
$columnNames = NULL;
foreach($results as $result)
{
if ($result instanceof Splunk_ResultsFieldOrder)
{
//所有字段
$columnNames = $result->getFieldNames();
//所需字段
$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>';
foreach($columnNames as $columnName)
echo '<th>'.htmlspecialchars($columnName).
'</th>';
echo '</tr></thead>';
echo "\n";
}
else if ($result instanceof Splunk_ResultsMessage)
{
$messages = [];
$anyRows = FALSE;
$columnNames = NULL;
foreach ($results as $result) {
if ($result instanceof Splunk_ResultsFieldOrder) {
//所有字段
$columnNames = $result->getFieldNames();
//所需字段
$need_th = ['_serial', '_raw', '_time'];
//字段差集
$columnNames = array_intersect($need_th, $columnNames);
echo '<thead><tr><td colspan="3" class="tt">提示: “GET”表示正常访问“POST”表示从表单提交访问“标黄”表示订单相关的访问。</td></tr><tr>';
foreach ($columnNames as $columnName) {
echo '<th>' . htmlspecialchars($columnName) .
'</th>';
}
echo '</tr></thead>';
echo "\n";
} else if ($result instanceof Splunk_ResultsMessage) {
$messages[] = $result;
}
else if (is_array($result))
{
$anyRows = TRUE;
assert($columnNames !== NULL);
echo '<tr>';
foreach($columnNames as $columnName)
{
$cellValue = array_key_exists($columnName, $result) ? $result[$columnName] : NULL;
//nginx日志
if ($columnName == '_raw')
{
echo '<td><div class="_raw">';
if (is_array($cellValue))
{
$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"
//ip(1), visit(3), from(6), ua(7)
$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);
//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>';
} else if (is_array($result)) {
$anyRows = TRUE;
assert($columnNames !== NULL);
echo '<tr>';
foreach ($columnNames as $columnName) {
$cellValue = array_key_exists($columnName, $result) ? $result[$columnName] : NULL;
//nginx日志
if ($columnName == '_raw') {
echo '<td><div class="_raw">';
if (is_array($cellValue)) {
$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"
//ip(1), visit(3), from(6), ua(7)
$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);
//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;';
}
//日期
else if ($columnName == '_time')
{
echo '<td>';
$time = strtotime($cellValue);
echo date('Y-m-d h:i:s', $time);
echo '</td>';
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;';
}
//splunk记录
else
{
echo '<td>';
if ($cellValue !== NULL)
{
if (is_array($cellValue))
{
echo '<ul>';
foreach($cellValue as $value)
{
echo '<li>'.htmlspecialchars($value).'</li>';
}
echo '</ul>';
}
else
{
echo htmlspecialchars($cellValue);
}
if (! isset($matches[1])) {
echo $log;
}
}
echo '</div></td>';
}
//日期
else if ($columnName == '_time') {
echo '<td>';
$time = strtotime($cellValue);
echo date('Y-m-d h:i:s', $time);
echo '</td>';
}
//splunk记录
else {
echo '<td>';
if ($cellValue !== NULL) {
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>';
}
}
}
?>
</table>
?>
</table>
<?php if (count($messages) > 0): ?>
<ul>
<?php
foreach ($messages as $message)
{
echo '<li>[' . htmlspecialchars($message->getType()) . '] ';
echo htmlspecialchars($message->getText()) . '</li>';
}
?>
</ul>
<?php endif; ?>
<?php if (!$anyRows && (count($messages) === 0)): ?>
<?php if (count($messages) > 0): ?>
<ul>
<?php
foreach ($messages as $message) {
echo '<li>[' . htmlspecialchars($message->getType()) . '] ';
echo htmlspecialchars($message->getText()) . '</li>';
}
?>
</ul>
<?php endif; ?>
<?php if (! $anyRows && (count($messages) === 0)): ?>
<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.
|
*/
$config['base_url'] = '';
$config['base_url'] = '';
/*
|--------------------------------------------------------------------------
@ -44,7 +46,7 @@ $config['index_page'] = 'webht.php';
| '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.
|
*/
$config['language'] = 'english';
$config['language'] = 'english';
/*
|--------------------------------------------------------------------------
@ -93,7 +95,6 @@ $config['charset'] = 'UTF-8';
*/
$config['enable_hooks'] = FALSE;
/*
|--------------------------------------------------------------------------
| Class Extension Prefix
@ -108,7 +109,6 @@ $config['enable_hooks'] = FALSE;
*/
$config['subclass_prefix'] = 'MY_';
/*
|--------------------------------------------------------------------------
| Allowed URL Characters
@ -128,7 +128,6 @@ $config['subclass_prefix'] = 'MY_';
*/
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-u4e00-u9fa5';
/*
|--------------------------------------------------------------------------
| Enable Query Strings
@ -154,11 +153,11 @@ $config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-u4e00-u9fa5';
| use segment based URLs.
|
*/
$config['allow_get_array'] = TRUE;
$config['allow_get_array'] = TRUE;
$config['enable_query_strings'] = FALSE;
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';
$config['directory_trigger'] = 'd'; // experimental not currently in use
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';
$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
|
*/
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 0;
$config['sess_expire_on_close'] = FALSE;
$config['sess_encrypt_cookie'] = FALSE;
$config['sess_use_database'] = FALSE;
$config['sess_table_name'] = 'ci_sessions';
$config['sess_match_ip'] = FALSE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update'] = 300;
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 0;
$config['sess_expire_on_close'] = FALSE;
$config['sess_encrypt_cookie'] = FALSE;
$config['sess_use_database'] = FALSE;
$config['sess_table_name'] = 'ci_sessions';
$config['sess_match_ip'] = FALSE;
$config['sess_match_useragent'] = TRUE;
$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.
|
*/
$config['cookie_prefix'] = "";
$config['cookie_domain'] = "";
$config['cookie_path'] = "/";
$config['cookie_secure'] = FALSE;
$config['cookie_prefix'] = "";
$config['cookie_domain'] = "";
$config['cookie_path'] = "/";
$config['cookie_secure'] = FALSE;
/*
|--------------------------------------------------------------------------
@ -293,10 +292,10 @@ $config['global_xss_filtering'] = FALSE;
| 'csrf_cookie_name' = The cookie name
| 'csrf_expire' = The number in seconds the token should expire.
*/
$config['csrf_protection'] = FALSE;
$config['csrf_token_name'] = 'csrf_test_name';
$config['csrf_protection'] = FALSE;
$config['csrf_token_name'] = 'csrf_test_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';
/*
|--------------------------------------------------------------------------
| Rewrite PHP Short Tags
@ -343,7 +341,6 @@ $config['time_reference'] = 'local';
*/
$config['rewrite_short_tags'] = FALSE;
/*
|--------------------------------------------------------------------------
| Reverse Proxy IPs
@ -360,22 +357,21 @@ $config['proxy_ips'] = '';
/* End of file config.php */
/* Location: ./application/config/config.php */
$config['site'] = array(
'cht' => array('site_code' => 'cht', 'site_id' => 14, 'site_lgc' => '1', 'site_url' => 'https://www.chinahighlights.com'),
'gm' => array('site_code' => 'gm', 'site_id' => 22, 'site_lgc' => '4', 'site_url' => 'https://www.chinarundreisen.com'),
'vc' => array('site_code' => 'vc', 'site_id' => 30, 'site_lgc' => '5', 'site_url' => 'https://www.voyageschine.com'),
'jp' => array('site_code' => 'jp', 'site_id' => 88, 'site_lgc' => '3', 'site_url' => 'https://www.arachina.com'),
'vac' => array('site_code' => 'vac', 'site_id' => 95, 'site_lgc' => '6', 'site_url' => 'https://www.viaje-a-china.com'),
'it' => array('site_code' => 'it', 'site_id' => 168, 'site_lgc' => '8', 'site_url' => 'https://www.viaggio-in-cina.it'),
'ru' => array('site_code' => 'ru', 'site_id' => 102, 'site_lgc' => '7', 'site_url' => 'https://www.chinahighlights.ru'),
'wt' => array('site_code' => 'wt', 'site_id' => 172, 'site_lgc' => '2', 'site_url' => 'https://www.iiiyooo.com'),
'tbt' => array('site_code' => 'tbt', 'site_id' => 169, 'site_lgc' => '1', 'site_url' => 'https://www.tibettravel.info'),
'sht' => array('site_code' => 'sht', 'site_id' => 96, 'site_lgc' => '1', 'site_url' => 'https://www.shanghaihighlights.com'),
'yz' => array('site_code' => 'yz', 'site_id' => 89, 'site_lgc' => '1', 'site_url' => 'https://www.yangtzeriver.org'),
'gl' => array('site_code' => 'gl', 'site_id' => 90, 'site_lgc' => '1', 'site_url' => 'https://www.guilinchina.net'),
'mbj' => array('site_code' => 'mbj', 'site_id' => 98, 'site_lgc' => '1', 'site_url' => 'https://www.mybeijingchina.com'),
'ct' => array('site_code' => 'ct', 'site_id' => 1000, 'site_lgc' => '104', 'site_url' => 'https://www.chinatravel.com'),
'dct' => array('site_code' => 'dct', 'site_id' => 99, 'site_lgc' => '1', 'site_url' => 'https://www.diychinatours.com'),
'trippest' => array('site_code' => 'trippest', 'site_id' => 0, 'site_lgc' => '1', 'site_url' => 'https://www.trippest.com')
);
$config['site'] = [
'cht' => ['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'],
'vc' => ['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'],
'vac' => ['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'],
'ru' => ['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'],
'tbt' => ['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'],
'yz' => ['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'],
'mbj' => ['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'],
'dct' => ['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'],
];

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

@ -19,121 +19,121 @@ ini_set('display_errors', 0);
/*============================ General Settings =======================================*/
// https://ckeditor.com/docs/ckfinder/ckfinder3-php/configuration.html
$config = array();
$config = [];
/*============================ Enable PHP Connector HERE ==============================*/
// https://ckeditor.com/docs/ckfinder/ckfinder3-php/configuration.html#configuration_options_authentication
$config['authentication'] = function () {
return true;
return true;
};
/*============================ License Key ============================================*/
// https://ckeditor.com/docs/ckfinder/ckfinder3-php/configuration.html#configuration_options_licenseKey
$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 ============================*/
// https://ckeditor.com/docs/ckfinder/ckfinder3-php/configuration.html#configuration_options_privateDir
$config['privateDir'] = array(
'backend' => 'default',
'tags' => '.ckfinder/tags',
'logs' => '.ckfinder/logs',
'cache' => '.ckfinder/cache',
'thumbs' => '.ckfinder/cache/thumbs',
);
$config['privateDir'] = [
'backend' => 'default',
'tags' => '.ckfinder/tags',
'logs' => '.ckfinder/logs',
'cache' => '.ckfinder/cache',
'thumbs' => '.ckfinder/cache/thumbs',
];
/*============================ Images and Thumbnails ==================================*/
// https://ckeditor.com/docs/ckfinder/ckfinder3-php/configuration.html#configuration_options_images
$config['images'] = array(
'maxWidth' => 2560,
'maxHeight' => 1440,
'quality' => 0,
'sizes' => array(
'small' => array('width' => 480, 'height' => 320, 'quality' => 0),
'medium' => array('width' => 600, 'height' => 480, 'quality' => 0),
'large' => array('width' => 800, 'height' => 600, 'quality' => 0)
)
);
$config['images'] = [
'maxWidth' => 2560,
'maxHeight' => 1440,
'quality' => 0,
'sizes' => [
'small' => ['width' => 480, 'height' => 320, 'quality' => 0],
'medium' => ['width' => 600, 'height' => 480, 'quality' => 0],
'large' => ['width' => 800, 'height' => 600, 'quality' => 0],
],
];
/*=================================== Backends ========================================*/
// https://ckeditor.com/docs/ckfinder/ckfinder3-php/configuration.html#configuration_options_backends
$sitecode = 'empty';
if (!empty($_GET['sitecode'])) {
$sitecode = $_GET['sitecode'];
if (! empty($_GET['sitecode'])) {
$sitecode = $_GET['sitecode'];
}
switch ($sitecode) {
case 'cht':
$site_url = 'https://data.chinahighlights.com';
break;
case 'ch':
$site_url = 'https://data.chinahighlights.com';
break;
case 'gm':
$site_url = 'https://data.chinarundreisen.com';
break;
case 'gh':
$site_url = 'https://data.globalhighlights.com';
break;
case 'ah':
$site_url = 'https://data.asiahighlights.com';
break;
case 'vc':
$site_url = 'https://data.voyageschine.com/kcfinder/upload/vc';
break;
case 'jp':
$site_url = 'https://data.arachina.com/kcfinder/upload/jp';
break;
case 'vac':
$site_url = 'https://data.viaje-a-china.com/kcfinder/upload/vac';
break;
case 'it':
$site_url = 'https://data.viaggio-in-cina.it/kcfinder/upload/it';
break;
case 'ru':
$site_url = 'https://data.chinahighlights.ru/kcfinder/upload/ru';
break;
case 'ct':
$site_url = 'https://data.chinatravel.com';
break;
case 'chinatravel':
$site_url = 'https://data.chinatravel.com';
break;
case 'shanghai':
$site_url = 'https://data.shanghaihighlights.com';
break;
case 'beijing':
$site_url = 'https://www.mybeijingchina.com';
break;
default:
$site_url = '';
case 'cht':
$site_url = 'https://data.chinahighlights.com';
break;
case 'ch':
$site_url = 'https://data.chinahighlights.com';
break;
case 'gm':
$site_url = 'https://data.chinahighlightstravel.de';
break;
case 'gh':
$site_url = 'https://data.globalhighlights.com';
break;
case 'ah':
$site_url = 'https://data.asiahighlights.com';
break;
case 'vc':
$site_url = 'https://data.voyageschine.com/kcfinder/upload/vc';
break;
case 'jp':
$site_url = 'https://data.arachina.com/kcfinder/upload/jp';
break;
case 'vac':
$site_url = 'https://data.viaje-a-china.com/kcfinder/upload/vac';
break;
case 'it':
$site_url = 'https://data.viaggio-in-cina.it/kcfinder/upload/it';
break;
case 'ru':
$site_url = 'https://data.chinahighlights.ru/kcfinder/upload/ru';
break;
case 'ct':
$site_url = 'https://data.chinatravel.com';
break;
case 'chinatravel':
$site_url = 'https://data.chinatravel.com';
break;
case 'shanghai':
$site_url = 'https://data.shanghaihighlights.com';
break;
case 'beijing':
$site_url = 'https://www.mybeijingchina.com';
break;
default:
$site_url = '';
}
//文件上传目录,使用相对路径,在文件夹中建立虚拟目录指向真实文件夹
//创建指向目录 mklink /D D:\wwwroot\uploader-file\gh\image D:\wwwroot\origin-www.globalhighlights.com\image
//需要移出项目文件夹防止FTP访问到防止误删
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 {
$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(
'name' => 'default',
'adapter' => 'local',
'baseUrl' => $site_url,
'root' => $site_upload_dir, // Can be used to explicitly set the CKFinder user files directory.
'chmodFiles' => 0777,
'chmodFolders' => 0755,
'filesystemEncoding' => 'UTF-8',
'followSymlinks' => true,
);
$config['backends'][] = [
'name' => 'default',
'adapter' => 'local',
'baseUrl' => $site_url,
'root' => $site_upload_dir, // Can be used to explicitly set the CKFinder user files directory.
'chmodFiles' => 0777,
'chmodFolders' => 0755,
'filesystemEncoding' => 'UTF-8',
'followSymlinks' => true,
];
/*================================ Resource Types =====================================*/
// 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());
$config['resourceTypes'][] = array(
'name' => 'image', // Single quotes not allowed.
'directory' => 'image',
'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',
'deniedExtensions' => '',
'backend' => 'default'
);
$config['resourceTypes'][] = array(
'name' => 'pic', // Single quotes not allowed.
'directory' => 'pic',
'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',
'deniedExtensions' => '',
'backend' => 'default'
);
$config['resourceTypes'][] = [
'name' => 'image', // Single quotes not allowed.
'directory' => 'image',
'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',
'deniedExtensions' => '',
'backend' => 'default',
];
$config['resourceTypes'][] = [
'name' => 'pic', // Single quotes not allowed.
'directory' => 'pic',
'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',
'deniedExtensions' => '',
'backend' => 'default',
];
/*
$config['resourceTypes'][] = array(
@ -192,39 +192,38 @@ $config['resourceTypes'][] = array(
$config['roleSessionVar'] = 'CKFinder_UserRole';
// https://ckeditor.com/docs/ckfinder/ckfinder3-php/configuration.html#configuration_options_accessControl
$config['accessControl'][] = array(
'role' => '*',
'resourceType' => '*',
'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
);
$config['accessControl'][] = [
'role' => '*',
'resourceType' => '*',
'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,
];
/*================================ Other Settings =====================================*/
// https://ckeditor.com/docs/ckfinder/ckfinder3-php/configuration.html
$config['overwriteOnUpload'] = false;
$config['checkDoubleExtension'] = true;
$config['overwriteOnUpload'] = false;
$config['checkDoubleExtension'] = true;
$config['disallowUnsafeCharacters'] = true;
$config['secureImageUploads'] = true;
$config['checkSizeAfterScaling'] = true;
$config['htmlExtensions'] = array('html', 'htm', 'xml', 'js');
$config['hideFolders'] = array('.*', 'CVS', '__thumbs');
$config['hideFiles'] = array('.*');
$config['forceAscii'] = false;
$config['xSendfile'] = false;
$config['secureImageUploads'] = true;
$config['checkSizeAfterScaling'] = true;
$config['htmlExtensions'] = ['html', 'htm', 'xml', 'js'];
$config['hideFolders'] = ['.*', 'CVS', '__thumbs'];
$config['hideFiles'] = ['.*'];
$config['forceAscii'] = false;
$config['xSendfile'] = false;
// https://ckeditor.com/docs/ckfinder/ckfinder3-php/configuration.html#configuration_options_debug
$config['debug'] = false;
@ -233,16 +232,16 @@ $config['debug'] = false;
// https://ckeditor.com/docs/ckfinder/ckfinder3-php/configuration.html#configuration_options_plugins
$config['pluginsDirectory'] = __DIR__ . '/plugins';
$config['plugins'] = array();
$config['plugins'] = [];
/*================================ Cache settings =====================================*/
// https://ckeditor.com/docs/ckfinder/ckfinder3-php/configuration.html#configuration_options_cache
$config['cache'] = array(
'imagePreview' => 24 * 3600,
'thumbnails' => 24 * 3600 * 365,
'proxyCommand' => 0
);
$config['cache'] = [
'imagePreview' => 24 * 3600,
'thumbnails' => 24 * 3600 * 365,
'proxyCommand' => 0,
];
/*============================ Temp Directory settings ================================*/
// https://ckeditor.com/docs/ckfinder/ckfinder3-php/configuration.html#configuration_options_tempDirectory
@ -262,7 +261,7 @@ $config['csrfProtection'] = true;
/*===================================== Headers =======================================*/
// https://ckeditor.com/docs/ckfinder/ckfinder3-php/configuration.html#configuration_options_headers
$config['headers'] = array();
$config['headers'] = [];
/*============================== End of Configuration =================================*/

Loading…
Cancel
Save