hotfix/远程访问多媒体中心
赵鹏 7 years ago
commit 289e4ec007

1
.gitignore vendored

@ -7,3 +7,4 @@
/kcfinder/cache/*
*/cache/*
/author/document/*
/application/libraries/composer

@ -663,21 +663,22 @@ $config['check_access'] = TRUE;
$config['access_super_manage'] = array('ycc', 'lmr');
//编辑器预览样式路径
$config['css_source_cht'] = '<link href="http://data.chinahighlights.com/css/min.php?f=/public/css/global.min.css,/css/festival-detail.css" rel="stylesheet">';
$config['css_source_cht'] = '<link href="https://data.chinahighlights.com/css/min.php?f=/public/css/global.min.css,/css/festival-detail.css" rel="stylesheet">';
$config['css_source_gm'] = '<link rel="stylesheet" href="http://data.chinarundreisen.com/public/pkg/css/baselAlRkXMnl750806T065919409Z.css">';
$config['css_source_gm'] = '<link rel="stylesheet" href="//data.chinarundreisen.com/public/pkg/css/baselAlRkXMnl750806T065919409Z.css">';
$config['css_source_vc'] = '<link href="http://data.voyageschine.com/information-view/tools/min/?v=20150611&amp;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" rel="stylesheet" type="text/css">';
$config['css_source_vac'] = '<link href="http://data.viaje-a-china.com/information-view/tools/min/?v=20150611&amp;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" rel="stylesheet" type="text/css">';
$config['css_source_ru'] = '<link href="http://data.chinahighlights.ru/information-view/tools/min/?v=20150611&amp;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-ru.css" rel="stylesheet" type="text/css">';
$config['css_source_it'] = '<link href="http://data.viaggio-in-cina.it/information-view/tools/min/?v=20150611&amp;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-it.css" rel="stylesheet" type="text/css">';
$config['css_source_jp'] = '<link href="http://data.arachina.com/information-view/tools/min/?v=20150611&amp;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-jp.css" rel="stylesheet" type="text/css">';
$config['css_source_vc'] = '<link href="//data.voyageschine.com/information-view/tools/min/?v=20150611&amp;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" rel="stylesheet" type="text/css">';
$config['css_source_vac'] = '<link href="//data.viaje-a-china.com/information-view/tools/min/?v=20150611&amp;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" rel="stylesheet" type="text/css">';
$config['css_source_ru'] = '<link href="//data.chinahighlights.ru/information-view/tools/min/?v=20150611&amp;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-ru.css" rel="stylesheet" type="text/css">';
$config['css_source_it'] = '<link href="//data.viaggio-in-cina.it/information-view/tools/min/?v=20150611&amp;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-it.css" rel="stylesheet" type="text/css">';
$config['css_source_jp'] = '<link href="//data.arachina.com/information-view/tools/min/?v=20150611&amp;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-jp.css" rel="stylesheet" type="text/css">';
$config['css_source_sht'] = '<link href="http://www.shanghaihighlights.com/css/css3/bootstrap/bootstrap.css" rel="stylesheet"><link href="http://www.shanghaihighlights.com/css/css3/style.css" rel="stylesheet"><link href="http://www.shanghaihighlights.com/css/css3/facts.css" rel="stylesheet">';
$config['css_source_gl'] = '<link href="http://www.guilinchina.net/css/css3/bootstrap/bootstrap.css" rel="stylesheet"><link href="http://www.guilinchina.net/css/css3/style.css" rel="stylesheet"><link href="http://www.guilinchina.net/css/css3/destination.css" rel="stylesheet">';
$config['css_source_tbt'] = '<link href="http://www.tibetguru.com/css/style.css" rel="stylesheet"><link href="http://www.tibetguru.com/css/guide.css" rel="stylesheet">';
$config['css_source_mbj'] = '<link href="http://www.mybeijingchina.com/css/layout.css" rel="stylesheet"><link type="text/css" href="http://www.mybeijingchina.com/css/travelguide.css" rel="stylesheet"><link href="http://www.mybeijingchina.com/css/css/attractions.css" rel="stylesheet" type="text/css">';
$config['css_source_yz'] = '<link href="http://www.yangtzeriver.org/css/css3/bootstrap/bootstrap.css" rel="stylesheet" type="text/css"><link href="http://www.yangtzeriver.org/css/css3/bootstrap/style.css" rel="stylesheet" type="text/css"><link href="http://www.yangtzeriver.org/css/css3/bootstrap/facts.css" rel="stylesheet" type="text/css">';
$config['css_source_sht'] = '<link href="//www.shanghaihighlights.com/css/css3/bootstrap/bootstrap.css" rel="stylesheet"><link href="//www.shanghaihighlights.com/css/css3/style.css" rel="stylesheet"><link href="//www.shanghaihighlights.com/css/css3/facts.css" rel="stylesheet">';
$config['css_source_gl'] = '<link href="//www.guilinchina.net/css/css3/bootstrap/bootstrap.css" rel="stylesheet"><link href="//www.guilinchina.net/css/css3/style.css" rel="stylesheet"><link href="//www.guilinchina.net/css/css3/destination.css" rel="stylesheet">';
$config['css_source_tbt'] = '<link href="//www.tibetguru.com/css/style.css" rel="stylesheet"><link href="//www.tibetguru.com/css/guide.css" rel="stylesheet">';
$config['css_source_mbj'] = '<link href="//www.mybeijingchina.com/css/layout.css" rel="stylesheet"><link type="text/css" href="//www.mybeijingchina.com/css/travelguide.css" rel="stylesheet"><link href="//www.mybeijingchina.com/css/css/attractions.css" rel="stylesheet" type="text/css">';
$config['css_source_yz'] = '<link href="//www.yangtzeriver.org/css/css3/bootstrap/bootstrap.css" rel="stylesheet" type="text/css"><link href="//www.yangtzeriver.org/css/css3/bootstrap/style.css" rel="stylesheet" type="text/css"><link href="//www.yangtzeriver.org/css/css3/bootstrap/facts.css" rel="stylesheet" type="text/css">';
$config['css_source_ah'] = '<link href="https://www.asiahighlights.com/min/?f=/css/global.min.css,/js/bootstrap-datepicker/css/bootstrap-datepicker3.standalone.css,/css/basic.css,/css/homepage.css,/css/contact.css,/css/tailor-make.css,/css/tour.css,/css/tour-detail.css,/css/inquiry-form.css,/css/missing.css" rel="stylesheet">';
@ -1041,9 +1042,6 @@ $config['media_image_url_org'] = 'http://photo.chtcdn.com:3581/upload';
$config['media_image_url_remote'] = 'http://photo.chtcdn.com/upload';
$config['media_image_url_remote2'] = 'http://116.251.217.48:3581/upload';
//编辑器预览样式路径
$config['css_source_cht'] = '<link href="http://data.chinahighlights.com/css/min.php?f=/public/css/global.min.css,/css/festival-detail.css&amp;v=20140915" rel="stylesheet">';
$config['css_source_ah'] = '<link href="https://www.asiahighlights.com/min/?f=/css/global.min.css,/js/bootstrap-datepicker/css/bootstrap-datepicker3.standalone.css,/css/basic.css,/css/homepage.css,/css/contact.css,/css/tailor-make.css,/css/tour.css,/css/tour-detail.css,/css/inquiry-form.css,/css/missing.css" rel="stylesheet">';
/* End of file config.php */
/* Location: ./application/config/config.php */

@ -21,15 +21,15 @@ class Amp extends CI_Controller {
}
public function edit($ic_id) {
$this->amplib->edit($ic_id);
$this->amplib->edit($ic_id);
}
public function auto_create($ic_id) {
echo $this->amplib->auto_create($ic_id);
echo $this->amplib->auto_create($ic_id);
}
public function edit_save() {
echo $this->amplib->edit_save();
echo $this->amplib->edit_save();
}
}

@ -14,8 +14,10 @@ class Info_amp extends CI_Controller
$this->load->model('InfoContents_model');
$this->load->model('Information_model');
$this->site_code = $this->config->item('site_code');
//CORS TEST
header('Access-Control-Allow-Origin:*');
//CORS
header('Access-Control-Allow-Origin:*');
header('Access-Control-Allow-Methods:GET,PUT,POST,DELETE,OPTIONS');
header('Access-Control-Allow-Headers:Content-Type,Authorization,Content-Length,X-Requested-With,Accept,x-csrf-token,origin');
}
public function save_amp()
@ -329,4 +331,181 @@ class Info_amp extends CI_Controller
));
}
}
public function handel_png_source() {
//ini_set('memory_limit', '50M');
$png_base64 = $this->input->post('png_base64');
//$png_base64 = 'iVBORw0KGgoAAAANSUhEUgAAABwAAAASCAMAAAB/2U7WAAAABlBMVEUAAAD///+l2Z/dAAAASUlEQVR4XqWQUQoAIAxC2/0vXZDrEX4IJTRkb7lobNUStXsB0jIXIAMSsQnWlsV+wULF4Avk9fLq2r8a5HSE35Q3eO2XP1A1wQkZSgETvDtKdQAAAABJRU5ErkJggg==';
$file = md5($png_base64).'.jpg';
$path = realpath('../cht-system/views/information/word_img').'/'.$file;
$png_base64 = str_replace('data:image/png;base64,', '', $png_base64);
$png_base64 = str_replace('data:image/jpg;base64,', '', $png_base64);
$png_base64 = base64_decode($png_base64);
$im = imagecreatefromstring($png_base64);
//保存图像
imagejpeg($im, $path);
//释放内存
imagedestroy($im);
$size = getimagesize($path);
if($png_base64 && $size) {
echo(json_encode(array(
'status' => 'success',
'path' => '/information-view/information/word_img/'.$file,
'width' => $size[0],
'height' => $size[1]
)));
} else {
echo(json_encode(array(
'status' => 'error'
)));
}
}
public function handel_image_source() {
@ini_set('memory_limit', '256M');
$file = $_FILES['file'];
if (!$file) {
echo(json_encode(array(
'status' => 'error',
'msg' => "图片上传失败。"
)));
return;
}
$usr = $this->input->post('usr');
$icid = $this->input->post('icid');
//转移文件
$md5_file = md5($usr.$icid.$file['name']);
//ext
$ext = mb_strtolower(strrchr($file["name"],'.'));
if ($ext != '.jpg') {
echo(json_encode(array(
'status' => 'error',
'msg' => '只能接收(.jpg)图片。',
'filename' => $file["name"]
)));
return;
}
$md5_name = $md5_file.$ext;
//临时docx文件
$image_path = realpath('../cht-system/views/information/word_img').'/'.basename($md5_name);
$html = 'to use mammoth';
if (move_uploaded_file($file['tmp_name'], $image_path)) {
//图片处理
$im = imagecreatefromjpeg($image_path);
imagejpeg($im, $image_path);
imagedestroy($im);
$size = getimagesize($image_path);
if($size) {
echo(json_encode(array(
'status' => 'success',
'path' => '/information-view/information/word_img/'.$md5_name,
'width' => $size[0],
'height' => $size[1]
)));
} else {
echo(json_encode(array(
'status' => 'error'
)));
}
} else {
echo(json_encode(array(
'status' => 'error',
'msg' => "图片文件解析失败。"
)));
}
}
public function handel_word_source() {
@ini_set('memory_limit', '256M');
$file = $_FILES['file'];
if (!$file) {
echo(json_encode(array(
'status' => 'error',
'msg' => "文件上传失败。"
)));
return;
}
$usr = $this->input->post('usr');
$icid = $this->input->post('icid');
//转移文件
$md5_file = md5($usr.$icid.$file['name']);
//ext
$ext = mb_strtolower(strrchr($file["name"],'.'));
if ($ext != '.docx') {
echo(json_encode(array(
'status' => 'error',
'msg' => '只能接收word(.docx)文档。'
)));
return;
}
$md5_name = $md5_file.$ext;
//临时docx文件
$docx_path = realpath('../cht-system/views/information/word_source').'/'.basename($md5_name);
$html = 'to use mammoth';
if (move_uploaded_file($file['tmp_name'], $docx_path)) {
$docx_dir = realpath('../cht-system/views/information/word_source');
//图片及html目录
$img_dir = $docx_dir.'/'.$md5_file;
is_dir($img_dir) || mkdir($img_dir, 0777);
//临时html文件
$docx_parh = $img_dir.'/'.$md5_name;
$html_parh = str_ireplace('.docx', '.html', $docx_parh);
//运行docx转化插件
if ($_SERVER['SERVER_NAME'] == 'localhost' || $_SERVER['SERVER_NAME'] == '202.103.68.62') {
$yarnbin = 'C:\Users\cht77\AppData\Local\Yarn\bin\mammoth ';
$test_host = '//202.103.68.62:9096';
} else {
$yarnbin = 'C:\Users\lmr\AppData\Local\Yarn\bin\mammoth ';
$test_host = '';
}
$command = $yarnbin.$docx_path.' --output-dir='.$img_dir. ' 2>&1';
//$command = 'C:\Users\lmr\AppData\Local\Yarn\bin\mammoth -h 2>&1';
exec($command, $rs, $st);
//图片处理
$scan_img = scandir($img_dir);
$tmp = '';
foreach($scan_img as $f) {
$tmp_ext = mb_strtolower(strrchr($f, '.'));
if ($tmp_ext == '.jpeg') {
$tmp_img = $img_dir.'/'.$f;
$tmp_jpg = str_ireplace('.jpeg', '.jpg', $tmp_img);
$im = imagecreatefromjpeg($tmp_img);
imagejpeg($im, $tmp_jpg);
imagedestroy($im);
//删除临时图片
@unlink($tmp_img);
//$tmp .= $f . ' # ';
}
}
//html处理
if (file_exists($html_parh)) {
$html = file_get_contents($html_parh);
} else {
echo(json_encode(array(
'status' => 'error',
'html' => $command.' # '.$html_parh,
'rs' => print_r($rs, true).' # '.$st
)));
return;
}
$html = preg_replace('/src="([\d]+).jpeg"/i', 'src="'.$test_host.'/information-view/information/word_source/'.$md5_file.'/$1.jpg"', $html);
//删除临时html
@unlink($html_parh);
//删除docx文档
@unlink($docx_path);
if ($html) {
echo(json_encode(array(
'status' => 'success',
'path' => $docx_path,
'html' => $html
)));
}
} else {
echo(json_encode(array(
'status' => 'error',
'msg' => "word文件解析失败。"
)));
}
}
}

File diff suppressed because it is too large Load Diff

@ -15,9 +15,6 @@ class Keyworlds extends CI_Controller {
}
public function index($kw_is_id = '') {
$this->load->library('Accesscheck');
$this->accesscheck->check_access();
$this->permission->is_admin();
//查询结构列表信息
$data['keyworldsList'] = $this->Keywords_model->get_structure_list();

@ -61,10 +61,6 @@ class Login extends CI_Controller {
$admin_info = $this->session->userdata('session_admin');
if ($this->accesscheck->check_access($site_code)) {
$this->session->set_userdata('session_site', $site_item);
$this->session->unset_userdata('access_module');
$this->session->unset_userdata('access_read_list');
$this->session->unset_userdata('access_write_list');
$this->session->unset_userdata('access_sitecode');
}
}
//跳转到指定页面。

@ -19,8 +19,6 @@ class Province extends CI_Controller
public function index($province_id=0)
{
$this->load->library('Accesscheck');
$this->accesscheck->check_access();
//查询不到省份信息则显示错误
$data['province'] = $this->Area_model->get_province($province_id);
if ($data['province'] == FALSE)

@ -14,8 +14,6 @@ class Seo extends CI_Controller {
$this->load->model('InfoContents_model');
$this->load->model('InfoStructures_model');
$this->load->model('InfoSEOs_model');
$this->load->library('Accesscheck');
$this->accesscheck->check_access();
}
public function index() {

@ -18,16 +18,9 @@ class Accesscheck extends CI_Controller
return true;
}
if ($this->session->userdata('access_module') === false){
$this->init_accessdata();
}
$this->session->set_userdata('access_sitecode', $this->Access_model->get_user_site_list($userdata['OPI_Code']));
//用户拥有权限de站点、模块&需要权限认证的模块
$access_module = $this->session->userdata('access_module');
$user_controller = $access_module['user_controller'];
$user_action = $access_module['user_action'];
$iaa_controller_list = $access_module['iaa_controller_list'];
$iaa_action_list = $access_module['iaa_action_list'];
$user_site_list = $this->session->userdata('access_sitecode');
$user_site_list = $this->session->userdata('access_sitecode');
//检测用户是否能访问当前站点,如果不能,则跳转到该用户有权限的站点
if($site_code=='')$site_code=$this->config->item('site_code');
@ -35,86 +28,9 @@ class Accesscheck extends CI_Controller
header('Location: '.$_SERVER['HTTP_REFERER']);
exit();
}
//判断当前操作是否需要认证
$flag=true;
if ($module!='') {
$module_array=explode('/', trim($module));
$this->router->class= $module_array[0];
$this->router->method= $module_array[1];
}
//判断当前模块是否需要认证
if (in_array($this->router->class, $iaa_controller_list)) {
//如果需要认证,判断是否有权限操作当前模块
if (in_array($this->router->class,$user_controller)) {
//判断是否能编辑不同省份信息
/*if($this->router->class=='province'){
$province=str_replace('/province/', '', $this->uri->uri_string());
$province=trim($province);
if (!isset($user_action[$this->router->class]) || !in_array($province, $user_action[$this->router->class])) {
$flag = false;//没有权限查看当前省份!
}
}
//判断当前方法是否需要认证
else*/
if (isset($iaa_action_list[$this->router->class]) && in_array($this->router->method, $iaa_action_list[$this->router->class])) {
//如果当前方法需要认证,则判断是否有权限
if (!isset($user_action[$this->router->class]) || !in_array($this->router->method, $user_action[$this->router->class])) {
$flag = false;//没有权限执行当前方法!
}
}
}else {
$flag = false;//没有权限执行当前控制器模块!
}
}
if ($module =='' && !$flag) {
redirect(site_url('Login/refuse'));
exit();
}
return $flag;
return true;
}
public function init_accessdata(){
$userdata=$this->session->userdata('session_admin');
//根据usercode获取用户角色、可读、可写列表
$user_access=$this->Access_model->get_user_access($userdata['OPI_Code'],$this->config->item('site_code'));
//根据角色字符串获取用户有权限的操作
$user_node=$this->Access_model->get_node_list($user_access->iao_role.'0');
//把用户拥有的所有角色id组装成一个数组集合
$node_str='';
foreach ($user_node as $node) {
$node_str.=$node->ian_iaa_id;
}
$node_array=explode(',', substr($node_str, 0,-1));
//用户拥有权限de站点、模块&需要权限认证的模块
$user_controller = array();
$user_action = array();
$iaa_controller_list = array();
$iaa_action_list = array();
//所有需要认证的模块、方法
$action_list=$this->Access_model->get_action_list();
foreach ($action_list as $a) {
//用户拥有的权限模块、方法
if (in_array($a->iaa_id, $node_array) && $a->iaa_controller!='') {
$user_controller[] = $a->iaa_controller;
$user_action[$a->iaa_controller][] = $a->iaa_action;
}
//需要认证的控制器和方法
if(!empty($a->iaa_controller))$iaa_controller_list[]=$a->iaa_controller;
if(!empty($a->iaa_action))$iaa_action_list[$a->iaa_controller][]=$a->iaa_action;
}
$access_module['user_controller'] = $user_controller;
$access_module['user_action'] = $user_action;
$access_module['iaa_controller_list'] = $iaa_controller_list;
$access_module['iaa_action_list'] = $iaa_action_list;
$this->session->set_userdata('access_read_list', $user_access->iao_read);
$this->session->set_userdata('access_write_list', $user_access->iao_write);
$this->session->set_userdata('access_sitecode', $this->Access_model->get_user_site_list($userdata['OPI_Code']));
$this->session->set_userdata('access_module', $access_module);
}
//获取角色等级(角色树形结构的等级)
public function get_role_level($site_code='',$author=''){

@ -14,6 +14,7 @@ class Amplib {
$this->CI = & get_instance();
$this->CI->load->model('Information_model');
$this->CI->load->model('InfoMetas_model');
$this->CI->load->model('Logs_model');
}
public function edit($ic_id) {
@ -63,7 +64,12 @@ class Amplib {
$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);
return GET_HTTP(site_url('/apps/htmlcompressor/index/optimize'), $post_data, 'POST');
//德语站点走另外一个控制器,其他站点还是走原来的流程
if($site_code == 'gm'){
return GET_HTTP(site_url('/apps/htmlcompressor/index_gm/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' => '不知道哪里错了,看代码'));
}
@ -88,6 +94,9 @@ class Amplib {
//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

@ -0,0 +1,555 @@
<?php
//============================================================+
// File name : class.wordphp.php
// Begin : 2014-03-09
// Last Update : 2018-06-22
// Version : 1.1
// License : GNU LGPL (http://www.gnu.org/copyleft/lesser.html)
// ----------------------------------------------------------------------------
// Copyright (C) 2014 Ricardo Pinto
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 2.1 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
//
// Description : PHP class to read DOCX file into HTML format
//
// Author: Ricardo Pinto
//
// (c) Copyright:
// Ricardo Pinto
//============================================================+
class WordPHP
{
private $debug = false;
private $file;
private $rels_xml;
private $doc_xml;
private $doc_media = array();
private $last = 'none';
private $encoding = 'UTF-8';
private $tmpDir = 'tmp';
//图片目录和前缀
public $img_dir = '';
public $img_prex = '';
/**
* CONSTRUCTOR
*
* @param Boolean $debug Debug mode or not
* @return void
*/
public function __construct($debug_=null, $encoding=null)
{
if($debug_ != null) {
$this->debug = $debug_;
}
if ($encoding != null) {
$this->encoding = $encoding;
}
$this->tmpDir = dirname(__FILE__);
}
/**
* Sets the tmp directory where images will be stored
*
* @param string $tmp The location
* @return void
*/
private function setTmpDir($tmp)
{
$this->tmpDir = $tmp;
}
/**
* READS The Document and Relationships into separated XML files
*
* @param var $object The class variable to set as DOMDocument
* @param var $xml The xml file
* @param string $encoding The encoding to be used
* @return void
*/
private function setXmlParts(&$object, $xml, $encoding)
{
$object = new DOMDocument();
$object->encoding = $encoding;
$object->preserveWhiteSpace = false;
$object->formatOutput = true;
$object->loadXML($xml);
$object->saveXML();
}
/**
* READS The Document and Relationships into separated XML files
*
* @param String $filename The filename
* @return void
*/
private function readZipPart($filename)
{
$zip = new ZipArchive();
$_xml = 'word/document.xml';
$_xml_rels = 'word/_rels/document.xml.rels';
if (true === $zip->open($filename)) {
if (($index = $zip->locateName($_xml)) !== false) {
$xml = $zip->getFromIndex($index);
}
//Get the relationships
if (($index = $zip->locateName($_xml_rels)) !== false) {
$xml_rels = $zip->getFromIndex($index);
}
// load all images if they exist
for ($i=0; $i<$zip->numFiles;$i++) {
$zip_element = $zip->statIndex($i);
if(preg_match("([^\s]+(\.(?i)(jpg|jpeg|png|gif|bmp))$)",$zip_element['name'])) {
$this->doc_media[$zip_element['name']] = $zip_element['name'];
}
}
$zip->close();
} else die('non zip file');
$enc = mb_detect_encoding($xml);
$this->setXmlParts($this->doc_xml, $xml, $enc);
$this->setXmlParts($this->rels_xml, $xml_rels, $enc);
if($this->debug) {
echo "<textarea style='width:100%; height: 200px;'>";
echo $this->doc_xml->saveXML();
echo "</textarea>";
echo "<textarea style='width:100%; height: 200px;'>";
echo $this->rels_xml->saveXML();
echo "</textarea>";
}
}
/**
* CHECKS THE FONT FORMATTING OF A GIVEN ELEMENT
* Currently checks and formats: bold, italic, underline, background color and font family
*
* @param XML $xml The XML node
* @return String HTML formatted code
*/
private function checkFormating(&$xml)
{
$node = trim($xml->readOuterXML());
$t = '';
// add <br> tags
if (mb_strstr($node,'<w:br ')) $t = '<br>';
// look for formatting tags
$f = "<span style='";
$reader = new XMLReader();
$reader->XML($node);
$img = null;
while ($reader->read()) {
if($reader->name == "w:b") {
$f .= "font-weight: bold,";
}
if($reader->name == "w:i") {
$f .= "text-decoration: underline,";
}
if($reader->name == "w:color") {
$f .="color: #".$reader->getAttribute("w:val").",";
}
if($reader->name == "w:rFont") {
$f .="font-family: #".$reader->getAttribute("w:ascii").",";
}
if($reader->name == "w:shd" && $reader->getAttribute("w:val") != "clear" && $reader->getAttribute("w:fill") != "000000") {
$f .="background-color: #".$reader->getAttribute("w:fill").",";
}
$temp_rx = $reader->readInnerXml();
if($reader->name == 'w:drawing' && !empty($temp_rx)) {
$r = $this->checkImageFormating($reader);
$img = $r !== null ? "<image src='".$r."' />" : null;
}
}
$f = rtrim($f, ',');
$f .= "'>";
$t .= ($img !== null ? $img : htmlentities($xml->expand()->textContent));
return $f.$t."</span>";
}
/**
* CHECKS THE ELEMENT FOR UL ELEMENTS
* Currently under development
*
* @param XML $xml The XML node
* @return String HTML formatted code
*/
private function getListFormating(&$xml)
{
$node = trim($xml->readOuterXML());
$reader = new XMLReader();
$reader->XML($node);
$ret="";
$close = "";
while ($reader->read()){
if($reader->name == "w:numPr" && $reader->nodeType == XMLReader::ELEMENT ) {
}
if($reader->name == "w:numId" && $reader->hasAttributes) {
switch($reader->getAttribute("w:val")) {
case 1:
$ret['open'] = "<ol><li>";
$ret['close'] = "</li></ol>";
break;
case 2:
$ret['open'] = "<ul><li>";
$ret['close'] = "</li></ul>";
break;
}
}
}
return $ret;
}
/**
* CHECKS IF THERE IS AN IMAGE PRESENT
* Currently under development
*
* @param XML $xml The XML node
* @return String The location of the image
*/
private function checkImageFormating(&$xml)
{
$content = trim($xml->readInnerXml());
if (!empty($content)) {
$relId;
$notfound = true;
$reader = new XMLReader();
$reader->XML($content);
while ($reader->read() && $notfound) {
if ($reader->name == "a:blip") {
$relId = $reader->getAttribute("r:embed");
$notfound = false;
}
}
// image id found, get the image location
if (!$notfound && $relId) {
$reader = new XMLReader();
$reader->XML($this->rels_xml->saveXML());
while ($reader->read()) {
if ($reader->nodeType == XMLREADER::ELEMENT && $reader->name=='Relationship') {
if($reader->getAttribute("Id") == $relId) {
$link = "word/".$reader->getAttribute('Target');
break;
}
}
}
$zip = new ZipArchive();
$im = null;
if (true === $zip->open($this->file)) {
$im = $this->createImage($zip->getFromName($link), $relId, $link);
}
$zip->close();
return $im;
}
}
return null;
}
/**
* Creates an image in the filesystem
*
* @param objetc $image The image object
* @param string $relId The image relationship Id
* @param string $name The image name
* @return Array With HTML open and closing tag definition
*/
private function createImage($image, $relId, $name)
{
$arr = explode('.', $name);
$l = count($arr);
$ext = mb_strtolower($arr[$l-1]);
$im = imagecreatefromstring($image);
if (empty($this->img_dir)) {
$fname = $this->tmpDir.'/tmp/'.$relId.'.'.$ext;
} else {
$ext = str_ireplace('jpeg', 'jpg', $ext);
$fname = $this->img_dir.'/'.$this->img_prex.'_'.mb_strtolower($relId).'.'.$ext;
}
switch ($ext) {
case 'png':
imagepng($im, $fname);
break;
case 'bmp':
imagebmp($im, $fname);
break;
case 'gif':
imagegif($im, $fname);
break;
case 'jpeg':
case 'jpg':
imagejpeg($im, $fname);
break;
default:
return null;
}
return $fname;
}
/**
* CHECKS IF ELEMENT IS AN HYPERLINK
*
* @param XML $xml The XML node
* @return Array With HTML open and closing tag definition
*/
private function getHyperlink(&$xml)
{
$ret = array('open'=>'<ul>','close'=>'</ul>');
$link ='';
if($xml->hasAttributes) {
$attribute = "";
while($xml->moveToNextAttribute()) {
if($xml->name == "r:id")
$attribute = $xml->value;
}
if($attribute != "") {
$reader = new XMLReader();
$reader->XML($this->rels_xml->saveXML());
while ($reader->read()) {
if ($reader->nodeType == XMLREADER::ELEMENT && $reader->name=='Relationship') {
if($reader->getAttribute("Id") == $attribute) {
$link = $reader->getAttribute('Target');
break;
}
}
}
}
}
if($link != "") {
$ret['open'] = "<a href='".$link."' target='_blank'>";
$ret['close'] = "</a>";
}
return $ret;
}
/**
* PROCESS TABLE CONTENT
*
* @param XML $xml The XML node
* @return THe HTML code of the table
*/
private function checkTableFormating(&$xml)
{
$table = "<table><tbody>";
while ($xml->read()) {
if ($xml->nodeType == XMLREADER::ELEMENT && $xml->name === 'w:tr') { //table row
$tc = $ts = "";
$tr = new XMLReader;
$tr->xml(trim($xml->readOuterXML()));
while ($tr->read()) {
if ($tr->nodeType == XMLREADER::ELEMENT && $tr->name === 'w:tcPr') { //table element properties
$ts = $this->processTableStyle(trim($tr->readOuterXML()));
}
if ($tr->nodeType == XMLREADER::ELEMENT && $tr->name === 'w:tc') { //table column
$tc .= $this->processTableRow(trim($tr->readOuterXML()));
}
}
$table .= '<tr style="'.$ts.'">'.$tc.'</tr>';
}
}
$table .= "</tbody></table>";
return $table;
}
/**
* PROCESS THE TABLE ROW STYLE
*
* @param string $content The XML node content
* @return THe HTML code of the table
*/
private function processTableStyle($content)
{
/*border-collapse:collapse;
border-bottom:4px dashed #0000FF;
border-top:6px double #FF0000;
border-left:5px solid #00FF00;
border-right:5px solid #666666;*/
$tc = new XMLReader;
$tc->xml($content);
$style = "border-collapse:collapse;";
while ($tc->read()) {
if ($tc->name === "w:tcBorders") {
$tc2 = new SimpleXMLElement($tc->readOuterXML());
foreach ($tc2->children('w',true) as $ch) {
if (in_array($ch->getName(), array('left','top','botom','right'))) {
$line = $this->convertLine($ch['val']);
$style .= " border-".$ch->getName().":".$ch['sz']."px $line #".$ch['color'].";";
}
}
$tc->next();
}
}
return $style;
}
private function convertLine($in)
{
if (in_array($in, array('dotted')))
return "dashed";
if (in_array($in, array('dotDash','dotdotDash','dotted','dashDotStroked','dashed','dashSmallGap')))
return "dashed";
if (in_array($in, array('double','triple','threeDEmboss','threeDEngrave','thick')))
return "double";
if (in_array($in, array('nil','none')))
return "none";
return "solid";
}
/**
* PROCESS THE TABLE ROW
*
* @param string $content The XML node content
* @return THe HTML code of the table
*/
private function processTableRow($content)
{
$tc = new XMLReader;
$tc->xml($content);
$ct = "";
while ($tc->read()) {
if ($tc->name === "w:r") {
$ct .= "<td>".$this->checkFormating($tc)."</td>";
$tc->next();
}
}
return $ct;
}
/**
* READS THE GIVEN DOCX FILE INTO HTML FORMAT
*
* @param String $filename The DOCX file name
* @return String With HTML code
*/
public function readDocument($filename)
{
$this->file = $filename;
$this->readZipPart($filename);
$reader = new XMLReader();
$reader->XML($this->doc_xml->saveXML());
$text = ''; $list_format="";
$formatting['header'] = 0;
// loop through docx xml dom
while ($reader->read()) {
// look for new paragraphs
$paragraph = new XMLReader;
$p = $reader->readOuterXML();
//return $p;
if ($reader->nodeType == XMLREADER::ELEMENT && $reader->name === 'w:p') {
// set up new instance of XMLReader for parsing paragraph independantly
$paragraph->xml($p);
preg_match('/<w:pStyle w:val="(Heading.*?[1-6])"/',$p,$matches);
if(isset($matches[1])) {
switch($matches[1]){
case 'Heading1': $formatting['header'] = 1; break;
case 'Heading2': $formatting['header'] = 2; break;
case 'Heading3': $formatting['header'] = 3; break;
case 'Heading4': $formatting['header'] = 4; break;
case 'Heading5': $formatting['header'] = 5; break;
case 'Heading6': $formatting['header'] = 6; break;
default: $formatting['header'] = 0; break;
}
}
// open h-tag or paragraph
$text .= ($formatting['header'] > 0) ? '<h'.$formatting['header'].'>' : '<p>';
// loop through paragraph dom
while ($paragraph->read()) {
// look for elements
if ($paragraph->nodeType == XMLREADER::ELEMENT && $paragraph->name === 'w:r') {
if($list_format == "")
$text .= $this->checkFormating($paragraph);
else {
$text .= $list_format['open'];
$text .= $this->checkFormating($paragraph);
$text .= $list_format['close'];
}
$list_format ="";
$paragraph->next();
}
else if($paragraph->nodeType == XMLREADER::ELEMENT && $paragraph->name === 'w:pPr') { //lists
$list_format = $this->getListFormating($paragraph);
$paragraph->next();
}
else if($paragraph->nodeType == XMLREADER::ELEMENT && $paragraph->name === 'w:drawing') { //images
$text .= $this->checkImageFormating($paragraph);
$paragraph->next();
}
else if ($paragraph->nodeType == XMLREADER::ELEMENT && $paragraph->name === 'w:hyperlink') {
$hyperlink = $this->getHyperlink($paragraph);
$text .= $hyperlink['open'];
$text .= $this->checkFormating($paragraph);
$text .= $hyperlink['close'];
$paragraph->next();
}
}
$text .= ($formatting['header'] > 0) ? '</h'.$formatting['header'].'>' : '</p>';
}
else if ($reader->nodeType == XMLREADER::ELEMENT && $reader->name === 'w:tbl') { //tables
$paragraph->xml($p);
$text .= $this->checkTableFormating($paragraph);
$reader->next();
}
}
$reader->close();
if($this->debug) {
echo "<div style='width:100%; height: 200px;'>";
echo mb_convert_encoding($text, $this->encoding);
echo "</div>";
}
return mb_convert_encoding($text, $this->encoding);
}
}

@ -57,16 +57,16 @@ class ctrip_train extends CI_Controller{
}
//转换三字码为中文
$FromCode = $this->ctrip_model->ReplaceCodeToName($from);
$ToCode = $this->ctrip_model->ReplaceCodeToName($to);
$FromName = $this->ctrip_model->ReplaceCodeToName($from);
$ToName = $this->ctrip_model->ReplaceCodeToName($to);
if(!$FromCode || !$ToCode){
if(!$FromName || !$ToName){
header("HTTP/1.1 404 Not Found");
exit('{"httpstatus":404,"data":{"seven":false,"cache":false,"result":[],"map":{}}}');
}else{
$from = $FromCode->station_name;
$to = $ToCode->station_name;
$from = $FromName->station_name;
$to = $ToName->station_name;
}
//生成请求链接
@ -125,7 +125,7 @@ class ctrip_train extends CI_Controller{
if($Seats->SeatName == '软座'){
$rzPrice = $Seats->Price * 10;
$SeaType .= '"4":"'.$rzPrice.'","A4":"¥'.$Seats->Price.'",';
$SeaType .= '"2":"'.$rzPrice.'","A2":"¥'.$Seats->Price.'",';
$rzNum = $Seats->TicketLeft;
}
@ -204,7 +204,7 @@ class ctrip_train extends CI_Controller{
}
//查询经停站
public function GetStopStation(){
public function getstopstation(){
//接收参数
$DepartDate = $this->input->get_post('DepartDate');
$TrainNo = $this->input->get_post('TrainNo');
@ -217,13 +217,40 @@ class ctrip_train extends CI_Controller{
$Sign = md5($TimeStamp.DATAKEY);
$url = JSONRETURN.'GetStopStations/?DepartDate='.$DepartDate.'&TrainNo='.$TrainNo.'&User='.DATAUSER.'&TimeStamp='.$TimeStamp.'&Sign='.$Sign;
echo $url;
$ResponseJson = post_ctrip($url,'','GET');
$ResponseData = json_decode($ResponseJson);
//构造12306格式
$ReturnData = array();
$ReturnData['validateMessagesShowId'] = '_validatorMessage';
$ReturnData['status'] = true;
$ReturnData['httpstatus'] = 200;
$ReturnData['data'] = array();
$i = 0;
$Last_num = count($ResponseData->StopStations);
foreach($ResponseData->StopStations as $items){
if($i == 0){
$ReturnData['data']['data'][$i]['start_station_name'] = $items->StationName;
$ReturnData['data']['data'][$i]['station_train_code'] = $TrainNo;
$ReturnData['data']['data'][$i]['end_station_name'] = $ResponseData->StopStations[$Last_num-1]->StationName;
}
$ReturnData['data']['data'][$i]['arrive_time'] = $items->ArrivalTime;
$ReturnData['data']['data'][$i]['station_name'] = $items->StationName;
$ReturnData['data']['data'][$i]['start_time'] = $items->StartTime;
$ReturnData['data']['data'][$i]['stopover_time'] = $items->StopMinutes;
$ReturnData['data']['data'][$i]['station_no'] = $items->StationNo;
$ReturnData['data']['data'][$i]['isEnabled'] = true;
$i++;
}
$ReturnData['messages'] = array();
$ReturnData['validateMessages'] = new stdClass();
print_r(json_encode($ReturnData));
}
}
//获取所有站点信息
public function GetAllStation(){
public function getallstation(){
//生成请求参数
$TimeStamp = time();
$Sign = md5($TimeStamp.DATAKEY);
@ -245,20 +272,30 @@ class ctrip_train extends CI_Controller{
}
}
//获取回调信息
public function receiveinfo(){
echo '<?xml version="1.0"?>
<OrderProcessRequest xsi="http://www.w3.org/2001/XMLSchema-instance">
<TrainOrderService>
<OrderInfo>
<OrderNumber>hainatravel123</OrderNumber>
</OrderInfo>
</TrainOrderService>
</OrderProcessRequest>
';
$back_xml = file_get_contents('php://input');
$xml = simplexml_load_string($back_xml);
$json = json_encode($xml);
log_message('error','携程回调信息:'.$json);
//查询中转方案
public function gettraintrainsfer(){
$FromCode = $this->input->get_post('FromCode');
$ToCode = $this->input->get_post('ToCode');
$DepartDate = $this->input->get_post('DepartDate');
if(!$FromCode || !$ToCode || !$DepartDate){
exit('传参错误!');
}else{
$TimeStamp = time();
$Sign = md5($TimeStamp.DATAKEY);
$FromName = $this->ctrip_model->ReplaceCodeToName($FromCode);
$ToName = $this->ctrip_model->ReplaceCodeToName($ToCode);
$From = $FromName->station_name;
$To = $ToName->station_name;
$url = JSONRETURN.'GetTrainTransfer?User='.DATAUSER.'&TimeStamp='.$TimeStamp.'&Sign='.$Sign.'&From='.urlencode($From).'&To='.urlencode($To).'&DepartDate='.$DepartDate;
$ResponseJson = post_ctrip($url,'','GET');
//$ResponseData = json_decode($ResponseJson);
print_r($ResponseJson);
}
}
}

@ -49,11 +49,15 @@
//发送请求函数
function post_ctrip($url, $data = '', $method = 'GET') {
$user_agent = "Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1";
if(isset($_SERVER['HTTP_USER_AGENT'])) {
$user_agent = $_SERVER['HTTP_USER_AGENT'];
}
$curl = curl_init(); // 启动一个CURL会话
curl_setopt($curl, CURLOPT_URL, $url); // 要访问的地址
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); // 对认证证书来源的检查
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); // 从证书中检查SSL加密算法是否存在
curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); // 模拟用户使用的浏览器
curl_setopt($curl, CURLOPT_USERAGENT, $user_agent); // 模拟用户使用的浏览器
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); // 使用自动跳转
curl_setopt($curl, CURLOPT_AUTOREFERER, 1); // 自动设置Referer
if ($method == 'POST' && !empty($data)) {

@ -80,6 +80,10 @@ class Index extends CI_Controller
//$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 {

@ -0,0 +1,390 @@
<?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';
$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 (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 = 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://184.172.113.216:33033/';
if (strpos($this->websitehost, 'chinarundreisen.com') !== false) {//德语站点使用自己的css处理服务器
$purifycss_server = 'http://158.177.67.52:33033/';
}
$optimize_css = GET_HTTP($purifycss_server, 'html_source=' . urlencode($this->htmlsource) . '&html_css=' . urlencode($css_content), 'POST');
if (empty($optimize_css)) {
$this->output->set_status_header(500);
echo 'css精简错误';
return FALSE;
}
//把精简的css添加到head前面
$this->html_object = str_replace('</head>', '<style type="text/css">' . $optimize_css . "</style></head>", $this->html_object);
//删除多余空格和换行符
$this->html_object = str_replace(array(" ", "\t", "\n", "\r"), " ", $this->html_object);
//循环n次把双空格替换为一个空格
for ($i = 0; $i <= 4; $i++) {
$this->html_object = str_replace(" ", " ", $this->html_object);
}
//在最后加载原始css文件和js文件
//把css移动到页面底部延迟加载
$lastload_js = '<noscript id="deferred-styles">';
foreach ($link_css_array as $item) {
$lastload_js .= '<link rel="stylesheet" type="text/css" href="' . $item . '"/>';
}
$lastload_js .= '</noscript><script>var loadDeferredStyles=function(){var addStylesNode=document.getElementById("deferred-styles");var replacement=document.createElement("div");replacement.innerHTML=addStylesNode.textContent;document.body.appendChild(replacement);addStylesNode.parentElement.removeChild(addStylesNode)};var raf=requestAnimationFrame||mozRequestAnimationFrame||webkitRequestAnimationFrame||msRequestAnimationFrame;if(raf){raf(function(){window.setTimeout(loadDeferredStyles,0)})}else{window.addEventListener("load",loadDeferredStyles)};</script>';
$js_content = $js_scr_content . $js_jquery_content;
//延迟加载js需要把返回的js代码保存到一个文件中然后替换占位符以便加载js文件
$lastload_js .= '<script async src="##DEFERSCRIPTDEFER##"></script>';
$lastload_js .= $js_inline_content;
$this->html_object = str_replace('</body>', $lastload_js . '</body>', $this->html_object);
echo json_encode(array('result' => 'ok', 'data' => array('html_object' => $this->html_object, 'js_content' => $js_content)));
}
//生成AMP版本 用移动端版本生成
/*
1.加载站点AMP模板模板只有导航、头部、底部
2.删除全部js引用和内链代码
3.删除全部css引用内联css放入<style amp-custom>
4.图片全部替换成amp-img设置宽高设置layout="responsive"
5.去掉所有元素中的style
6.去掉样式表中的!important
7.替换读取源文件title description keywords canonical
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);
}
}
//拼接请求的图片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'];
}
//请求图片尺寸
$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;
}
}
}
//获取图片尺寸 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='';
if(substr($img_src, -4) == '.jpg'){
$img_src_jpg=" <amp-img fallback layout=\"responsive\" 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=\"responsive\" 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=\"responsive\" 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('.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 = array();
$css_content = '';
foreach ($this->html_object->find('link') as $link_css) {
//将所有的样式链接存储为一个数组
if ($link_css->rel == 'stylesheet' && !empty($link_css->href)) {
$link_css_array[] = $link_css->href;
$link_css->outertext = ''; //删除链接
}
}
//循环下载所有的css样式拼接成字符串
foreach ($link_css_array as $item) {
//排除一定不会用到的css提高精简的速度
if(strpos($item,'base.css')){
$item = 'https://data.chinarundreisen.com/min/?f=/css/base.css';
}
if(strpos($item,'reiseroute.css')){
$item = 'https://data.chinarundreisen.com/min/?f=/css/reiseroute-amp.css';
}
$get_http_temp = GET_HTTP($this->format_url($item, $this->websitehost));
if ($get_http_temp == false) {
$this->output->set_status_header(404);
echo 'CSS文件下载错误';
log_message('error', "optimize CSS文件下载错误! " . $item);
return FALSE;
}
$css_content .= $get_http_temp;
}
foreach ($this->html_object->find('style') as $style) {
$css_content .= $style->innertext;
$style->outertext = '';
}
//把网页内容和css提交到purifycss处理
$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 (substr($url, 0, 2) == '//') { //https或http
return urldecode('https://'.substr($url, 2, strlen($url)-2)); //只替换开头的//部分url不规范有//在url中间
}
return urldecode($host . $url);
}
}

@ -121,7 +121,7 @@
</div>
<footer>
<div class="footerLink"><a href="/contactus/" >Contact us</a> | <a href="/aboutus/" >About us</a></div>
<div class="copyright">© 1998-2018 China Highlights</div>
<div class="copyright">© 1998-2019 China Highlights</div>
</footer>
<!-- Google Analytics -->
<amp-analytics type="googleanalytics">

File diff suppressed because one or more lines are too long

@ -326,6 +326,7 @@ class search extends CI_Controller{
$seat_info = $this->BIZ_intel_train_model->get_seat_info($key);
$obj->seat_info->$key = $seat_info;
}
$obj->arriveTime = $obj->localarriveTime;
print_r(json_encode($obj));
}

@ -73,7 +73,8 @@ class BIZ_intel_train_model extends CI_Model {
SELECT
*,
(select s_country from TrainStation_intel where trainFromCode = s_code ) as From_country,
(select s_country from TrainStation_intel where trainToCode = s_code ) as To_country
(select s_country from TrainStation_intel where trainToCode = s_code ) as To_country,
(select top 1 trainArrive from trainlistDetail where train_no = tl.train_no order by trainOrder desc) as localarriveTime
FROM
trainlist tl
LEFT JOIN

@ -1,7 +1,7 @@
<link rel="stylesheet" href="http://data.chtcdn.com/js/jquery-ui/smoothness/jquery-ui-1.8.21.custom.css" type="text/css" />
<link rel="stylesheet" href="http://data.chtcdn.com/js/start_rate/rating_simple.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="http://data.chtcdn.com/js/jquery-ui/jquery-ui-1.8.21.custom.min.js"></script>
<script type="text/javascript" src="http://data.chtcdn.com/js/start_rate/rating_simple.js"></script>
<link rel="stylesheet" href="/js/jquery-ui/smoothness/jquery-ui-1.8.21.custom.css" type="text/css" />
<link rel="stylesheet" href="/js/start_rate/rating_simple.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="/js/jquery-ui/jquery-ui-1.8.21.custom.min.js"></script>
<script type="text/javascript" src="/js/start_rate/rating_simple.js"></script>
<script src="/js/ace/ace.js" type="text/javascript" charset="utf-8"></script>
<script>
$(function() {
@ -448,7 +448,7 @@
if (isset($rating[$k])) {
for ($i = 0; $i < $rating[$k]; $i++) {
?>
<img src="http://data.chtcdn.com/js/start_rate/sth.gif">
<img src="/js/start_rate/sth.gif">
<?php
}
}

@ -3,7 +3,7 @@
<head>
<title>URLS</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="http://data.chtcdn.com/css/information-system.css" type="text/css" />
<link rel="stylesheet" href="/css/information-system.css" type="text/css" />
</head>
<body>

@ -34,6 +34,32 @@
</div>
<!-- 静态化更新窗口 -->
<!-- 国际展异步更新窗口 -->
<div class="modal fade" id="icht_async_modal" tabindex="-2" role="dialog" data-backdrop="false">
<div class="modal-dialog" role="document">
<div class="modal-content" >
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 style="margin:0;">静态化更新</h3>
</div>
<div class="modal-body">
<!--label class="text-info">信息保存成功。</label-->
<div id="icht_async_msg_waiting">
<p class="text-danger">正在更新静态页面请稍等4~8秒。</p>
<img src="http://img10.cache.hxsd.com/news/2015/11/12/691442_1447295058_5.gif" width="100%">
</div>
<div id="icht_async_msg_success">
<p class="text-success">静态页面更新成功,请打开页面检查。</p>
<img src="http://pic39.photophoto.cn/20160620/1155116868658436_b.jpg" width="100%">
</div>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal">关闭</button>
</div>
</div>
</div>
</div>
<!-- 国际展异步更新窗口 -->

@ -5,7 +5,7 @@
<meta charset="utf-8">
<title>信息平台</title>
<link rel="stylesheet" href="/css/information-system3.css?v=201508112" type="text/css" />
<script type="text/javascript" src="/min/?f=/js/information-system3.min.js,/js/common.js&v=2018022601"></script>
<script type="text/javascript" src="/min/?f=/js/information-system3.min.js,/js/common.js&v=20190128"></script>
<script type="text/javascript" src="/js/kindeditor/kindeditor.js?v=20180730"></script>
<link rel="shortcut icon" href="/bootstrap/img/glyphicons_290_skull.png">

@ -435,6 +435,7 @@
change_seo_count('ic_seo_title');
change_seo_count('ic_seo_description');
change_seo_count('meta_note');
change_seo_count('meta_note_ogtitle');
init_recommend_popover("#meta_recommend_info", ".meta_recommend_info_box");
init_recommend_popover("#meta_related_info", ".meta_related_info_box");
@ -526,7 +527,7 @@
<div class="col-xs-24 btn-sm"></div>
<div class="col-xs-7">
<label>
信息标题 & ID: <?php echo $information->ic_id; ?>
信息标题 & IC_ID: <?php echo $information->ic_id; ?>
</label>
</div>
<div class="col-xs-17 text-right">
@ -548,9 +549,9 @@
?>
<style type="text/css">#PcAmp{color:#069;cursor: pointer;}#PcAmp input{position: relative;top: 2px;}</style>
<label id="PcAmp">
<input type="checkbox" <?php echo($PcAmpChecked); ?>>
<input type="checkbox" <?php echo($PcAmpChecked); ?>>
PC端页面也使用构建工具发布
</label> |
</label> |
<label title="AMP页面编辑">
<a href="<?php echo($amp_build_url); ?>" target="_blank"> HTML构建工具 </a>
</label> |
@ -704,7 +705,13 @@
<div id="customize" class="col-xs-24" style="display:none;">
<!-- 自定义选项 -->
<label>
结构化标签
<a href="javascript:void(0);" onclick="meta('delete', '<?php echo $information->ic_id; ?>', 'meta_construction_code', $('#meta_construction_code').val())"><i class="text-muted glyphicon glyphtext-muted glyphicon glyphicon-remove"></i></a>
<a href="javascript:void(0);" onclick="meta('save', '<?php echo $information->ic_id; ?>', 'meta_construction_code', $('#meta_construction_code').val())"><i class="text-muted glyphicon glyphtext-muted glyphicon glyphicon-hdd"></i></a>
</label>
<textarea class="form-control" id="meta_construction_code" name="meta_construction_code" ><?php echo get_meta($information->ic_id, 'meta_construction_code'); ?></textarea>
<div class="row">
<div class="col-sm-5">
<label>展示列表图片
@ -872,13 +879,23 @@
</div>
<?php } ?>
<label>og:title
<a href="javascript:void(0);" onclick="meta('delete', '<?php echo $information->ic_id; ?>', 'meta_note_ogtitle', $('#meta_note_ogtitle').val())"><i class="text-muted glyphicon glyphicon-remove"></i></a>
<a href="javascript:void(0);"
onclick="if(count_valid('meta_note_ogtitle', 'og:title', 20, 60) == true) { meta('save', '<?php echo $information->ic_id; ?>', 'meta_note_ogtitle', $('#meta_note_ogtitle').val()) }">
<i class="text-muted glyphicon glyphicon-hdd"></i>
</a>
<a href="javascript:void(0);" title="为信息添加og:title."><i class="text-muted glyphicon glyphicon-question-sign"></i></a>
<em class="pull-right muted" id="meta_note_ogtitle_count"></em>
</label>
<input name="meta_note_ogtitle" id="meta_note_ogtitle" onkeyup="change_seo_count(this.id);" type="text" class="form-control" value="<?php echo get_meta($information->ic_id, 'meta_note_ogtitle'); ?>" />
<label>og:description
<a href="javascript:void(0);" onclick="meta('delete', '<?php echo $information->ic_id; ?>', 'meta_note', $('#meta_note').val())"><i class="text-muted glyphicon glyphicon-remove"></i></a>
<a href="javascript:void(0);" onclick="meta('save', '<?php echo $information->ic_id; ?>', 'meta_note', $('#meta_note').val())"><i class="text-muted glyphicon glyphicon-hdd"></i></a>
<a href="javascript:void(0);" onclick="if(count_valid('meta_note', 'og:description', 80, 160) == true) { meta('save', '<?php echo $information->ic_id; ?>', 'meta_note', $('#meta_note').val()) }"><i class="text-muted glyphicon glyphicon-hdd"></i></a>
<a href="javascript:void(0);" title="为信息添加备注功能."><i class="text-muted glyphicon glyphicon-question-sign"></i></a>
<em class="pull-right muted" id="meta_note_count"></em>
</label>
@ -1271,7 +1288,7 @@
<input type="checkbox" name="auto_update_cache_checkbox" id="auto_update_cache_checkbox" onclick="get_update_cache_url();" value="<?php echo $information->ic_url; ?>" />静态更新
</label>
<?php } ?>
<?php if (in_array($this->config->item('site_code'),array('cht','ah','gm'))) { ?>
<label class="checkbox col-xs-24" style="font-weight: normal;margin-top:0;padding-left: 21px;">
<input type="checkbox" name="auto_update_amp" id="auto_update_amp" <?php if($information->amp_status==='2'){echo 'disabled';} ?> value="true" />AMP更新 <?php if($information->amp_status==='2'){echo '<i class="glyphicon glyphicon-hand-up" title="手动管理,不会自动更新"></i>'; } ?>
@ -1280,11 +1297,7 @@
<div class="clearfix"></div>
<div class="btn-group col-xs-24 nopadding pull-right <?php
if ($is_writeable == 0) {
echo 'hide';
}
?>">
<div class="btn-group col-xs-24 nopadding pull-right">
<input type="hidden" name="rule_check_flag" id="rule_check_flag" value="1">
<a href="javascript:void(0);" class="btn btn-primary col-xs-19" onclick="editor.sync();
if (editor.html() != '' && editor.text() == '') {
@ -1304,7 +1317,7 @@
<?php if (get_meta($information->ic_id, 'AMP_JSON') && get_meta($information->ic_id, 'AMP_STATUS') && get_meta($information->ic_id, 'AMP_BODY_PC_STATUS') === 'yes') { ?>
if (editor && editor.text() == '') {
editor.html('From HTML-Generator');
editor.sync();
editor.sync();
}
<?php } ?>
if (information_check() != false) {

@ -11,6 +11,13 @@
dataType: "json",
url: "<?php echo site_url('amp/auto_create/') ?>/" + ic_id,
success: function (result, textStatus) {
//当result为空的时候跳过
if(result.length == 0 || result =='' || undefined || null){
$(msg_obj).html("<a href='javascript:void(0);' onclick='create_amp_data(" + index + ");' >发生错误,请重试</a>");
create_amp_data(++index);
return;
}
$.each(result, function (i, field) {
if (i === 'data') {
amp_code = field.amp;

@ -3,9 +3,9 @@
<head>
<title>更新静态页-v1.0a</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link href="http://europe.chtcdn.com/bootstrap/css/bootstrap.min.css" rel="stylesheet"/>
<script type="text/javascript" src="http://europe.chtcdn.com/js/jquery.js"></script>
<script type="text/javascript" src="http://europe.chtcdn.com/bootstrap/js/bootstrap.min.js"></script>
<link href="//int.mycht.cn/bootstrap/css/bootstrap.min.css" rel="stylesheet"/>
<script type="text/javascript" src="//int.mycht.cn/js/jquery.js"></script>
<script type="text/javascript" src="//int.mycht.cn/bootstrap/js/bootstrap.min.js"></script>
<style type="text/css">
.show-grid {padding: 15px; background: #efefef; border-radius: 5px;}
.mr10 {margin-right: 10px;}

@ -3,23 +3,23 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>信息管理</title>
<link rel="stylesheet" href="http://data.chtcdn.com/js/poshytip/tip-yellow/tip-yellow.css" type="text/css" />
<link rel="stylesheet" href="http://data.chtcdn.com/js/zTree/zTreeStyle/zTreeStyle.css" type="text/css" />
<link rel="stylesheet" href="http://data.chtcdn.com/js/zTree/demo.css" type="text/css" />
<link rel="stylesheet" href="http://data.chtcdn.com/js/modaldialog/css/jquery.modaldialog.css" type="text/css" />
<link rel="stylesheet" href="http://data.chtcdn.com/js/kindeditor/themes/default/default.css" type="text/css" media="screen" />
<link rel="stylesheet" href="http://data.chtcdn.com/css/layout.css" type="text/css" />
<link rel="stylesheet" href="http://data.chtcdn.com/js/jquery-ui/smoothness/jquery-ui-1.8.21.custom.css" type="text/css" />
<script type="text/javascript" src="http://data.chtcdn.com/js/jquery.js"></script>
<script type="text/javascript" src="http://data.chtcdn.com/js/jquery-ui/jquery-ui-1.8.21.custom.min.js"></script>
<script type="text/javascript" src="http://data.chtcdn.com/js/jquery.form.min.js"></script>
<script type="text/javascript" src="http://data.chtcdn.com/js/poshytip/jquery.poshytip.min.js"></script>
<script type="text/javascript" src="http://data.chtcdn.com/js/zTree/jquery.ztree.all.min.js"></script>
<script type="text/javascript" src="http://data.chtcdn.com/js/modaldialog/jquery.modaldialog.js"></script>
<script type="text/javascript" src="http://data.chtcdn.com/js/kindeditor/kindeditor-min.js"></script>
<script type="text/javascript" src="http://data.chtcdn.com/js/kindeditor/lang/zh_CN.js"></script>
<script type="text/javascript" src="http://data.chtcdn.com/js/basic.js"></script>
<link rel="shortcut icon" href="http://data.chtcdn.com/bootstrap/img/glyphicons_290_skull.png">
<link rel="stylesheet" href="/js/poshytip/tip-yellow/tip-yellow.css" type="text/css" />
<link rel="stylesheet" href="/js/zTree/zTreeStyle/zTreeStyle.css" type="text/css" />
<link rel="stylesheet" href="/js/zTree/demo.css" type="text/css" />
<link rel="stylesheet" href="/js/modaldialog/css/jquery.modaldialog.css" type="text/css" />
<link rel="stylesheet" href="/js/kindeditor/themes/default/default.css" type="text/css" media="screen" />
<link rel="stylesheet" href="/css/layout.css" type="text/css" />
<link rel="stylesheet" href="/js/jquery-ui/smoothness/jquery-ui-1.8.21.custom.css" type="text/css" />
<script type="text/javascript" src="/js/jquery.js"></script>
<script type="text/javascript" src="/js/jquery-ui/jquery-ui-1.8.21.custom.min.js"></script>
<script type="text/javascript" src="/js/jquery.form.min.js"></script>
<script type="text/javascript" src="/js/poshytip/jquery.poshytip.min.js"></script>
<script type="text/javascript" src="/js/zTree/jquery.ztree.all.min.js"></script>
<script type="text/javascript" src="/js/modaldialog/jquery.modaldialog.js"></script>
<script type="text/javascript" src="/js/kindeditor/kindeditor-min.js"></script>
<script type="text/javascript" src="/js/kindeditor/lang/zh_CN.js"></script>
<script type="text/javascript" src="/js/basic.js"></script>
<link rel="shortcut icon" href="/bootstrap/img/glyphicons_290_skull.png">
<script language="javascript">
//快速图片上传

@ -1043,7 +1043,7 @@
<span id="mobile_friendly_status"></span>
</p>
<div class="btn-group col-xs-24 nopadding pull-right <?php if ($is_writeable == 0) echo 'hide'; ?>">
<div class="btn-group col-xs-24 nopadding pull-right ">
<a href="javascript:void(0);" class="btn btn-primary col-xs-19" onclick="editor.sync();if(information_check()!=false){submitForm('form_information_edit');}">保存修改</a>
<button class="btn dropdown-toggle btn-primary col-xs-5" data-toggle="dropdown">
<span class="caret"></span>

@ -3,18 +3,18 @@
<head>
<meta charset="utf-8">
<title>CHT Author</title>
<link href="http://data.chtcdn.com/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="http://data.chtcdn.com/js/poshytip/tip-yellow/tip-yellow.css" type="text/css" />
<link rel="stylesheet" href="http://data.chtcdn.com/js/modaldialog/css/jquery.modaldialog.css" type="text/css" />
<link rel="stylesheet" href="http://data.chtcdn.com/js/kindeditor/themes/default/default.css" type="text/css" media="screen" />
<script type="text/javascript" src="http://data.chtcdn.com/js/jquery.js"></script>
<script type="text/javascript" src="http://data.chtcdn.com/bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="http://data.chtcdn.com/js/poshytip/jquery.poshytip.min.js"></script>
<script type="text/javascript" src="http://data.chtcdn.com/js/jquery.form.min.js"></script>
<script type="text/javascript" src="http://data.chtcdn.com/js/modaldialog/jquery.modaldialog.js"></script>
<link href="/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="/js/poshytip/tip-yellow/tip-yellow.css" type="text/css" />
<link rel="stylesheet" href="/js/modaldialog/css/jquery.modaldialog.css" type="text/css" />
<link rel="stylesheet" href="/js/kindeditor/themes/default/default.css" type="text/css" media="screen" />
<script type="text/javascript" src="/js/jquery.js"></script>
<script type="text/javascript" src="/bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/js/poshytip/jquery.poshytip.min.js"></script>
<script type="text/javascript" src="/js/jquery.form.min.js"></script>
<script type="text/javascript" src="/js/modaldialog/jquery.modaldialog.js"></script>
<script type="text/javascript" src="/js/kindeditor/kindeditor.js"></script>
<script type="text/javascript" src="http://data.chtcdn.com/js/basic.js"></script>
<script src="http://data.chtcdn.com/js/ace/ace.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" src="/js/basic.js"></script>
<script src="/js/ace/ace.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>

@ -295,7 +295,17 @@ function successfun(responseText, statusText, xhr, form) {
$.modaldialog.success(responseText[key].value + "n" + "\u9759\u6001\u9875\u9762\u66f4\u65b0\u4e2d...");
updateCache($("#auto_update_cache_checkbox").val(), "")
} else {
$.modaldialog.success(responseText[key].value)
var update_info_log = responseText[key].update_info_log;
if (update_info_log && update_info_log.async_update) {
//国际站使用异步更新缓存
$('#icht_async_modal').modal('show');
$.get(update_info_log.async_update, function() {
$('#icht_async_msg_waiting').slideDown(400);
$('#icht_async_msg_success').slideUp(400);
});
} else {
$.modaldialog.success(responseText[key].value)
}
}
} else {
if (responseText[key].name == "ok_go") {

@ -293,6 +293,9 @@ function information_check() {
return true
}
function submitForm(form) {
//国际站使用异步更新缓存
$('#icht_async_msg_waiting').show();
$('#icht_async_msg_success').hide();
$("#" + form).ajaxSubmit({
success: successfun,
error: errorfun,
@ -307,7 +310,17 @@ function errorfun(responseText, statusText, xhr, form) {
function successfun(responseText, statusText, xhr, form) {
for (var key in responseText) {
if (responseText[key].name == "ok") {
$.modaldialog.success(responseText[key].value)
var update_info_log = responseText[key].update_info_log;
if (update_info_log && update_info_log.async_update) {
//国际站使用异步更新缓存
$('#icht_async_modal').modal('show');
$.get(update_info_log.async_update,{"r": new Date().getTime()}, function() {
$('#icht_async_msg_waiting').slideUp(400);
$('#icht_async_msg_success').slideDown(400);
});
} else {
$.modaldialog.success(responseText[key].value);
}
} else {
if (responseText[key].name == "ok_go") {
$.modaldialog.success('提交成功,正在跳转到下个页面...');
@ -496,6 +509,14 @@ function get_string_length(str) {
}
return realLength
}
function get_string_length_site(element) {
var length = get_string_length($("#" + element).val());
var sitecode = $("#is_sitecode").val();
if (sitecode == "jp" || sitecode == "ru") {
length = parseInt(length / 2)
}
return length;
}
function change_seo_count(element) {
var length = get_string_length($("#" + element).val());
var sitecode = $("#is_sitecode").val();
@ -515,6 +536,15 @@ function get_ajax_reviewed_list(formid, container, flag) {
}
$("#" + container).load(url + " #" + container, data)
};
function count_valid(element, element_text, from, to) {
if (from <= 0) { return true;}
var element_value_cnt = get_string_length_site(element) ;
if (element_value_cnt < from) {
$.modaldialog.error(element_text + "长度必须大于" + from + "个字符")
return false
}
return true;
}
/* basic end*/
function mobile_friendly(refresh){
var ic_url = $("#ic_url").val();

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<staticContent>
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="30.00:00:00" />
</staticContent>
</system.webServer>
</configuration>

@ -115,7 +115,7 @@ function is_remote_ip()
<?php if (isset($_GET['remote']) || is_remote_ip()){ ?>
<iframe id="test" frameborder="0" src="http://photo.chtcdn.com:3581/OutputApp/searchpicture.aspx?<?php echo($rwidth);?>webcode=<?php echo $media_site_code; ?>&lgc=<?php echo $_GET['site_lgc'];?>&apptype=translate&uname=ycc&upass=ycc&lmisn=1&WebUrl=<?php echo isset($_GET['WebUrl'])?$_GET['WebUrl']:false;?>&redirecturl=http://<?php echo $_SERVER['HTTP_HOST']; ?>/media/transitval.php" > </iframe>
<?php }else{ ?>
<iframe id="test" frameborder="0" src="http://video.chtcdn.com/OutputApp/searchpicture.aspx?<?php echo($rwidth);?>webcode=<?php echo $media_site_code; ?>&lgc=<?php echo $_GET['site_lgc'];?>&apptype=infomation&WebUrl=<?php echo isset($_GET['WebUrl'])?$_GET['WebUrl']:false;?>&redirecturl=http://<?php echo $_SERVER['HTTP_HOST']; ?>/media/transitval.php" > </iframe>
<iframe id="test" frameborder="0" src="https://video.chtcdn.com/OutputApp/searchpicture.aspx?<?php echo($rwidth);?>webcode=<?php echo $media_site_code; ?>&lgc=<?php echo $_GET['site_lgc'];?>&apptype=infomation&WebUrl=<?php echo isset($_GET['WebUrl'])?$_GET['WebUrl']:false;?>&redirecturl=https://<?php echo $_SERVER['HTTP_HOST']; ?>/media/transitval.php" > </iframe>
<?php } ?>
</body>
</html>

@ -0,0 +1,13 @@
fs.js:115
throw err;
^
Error: EPERM: operation not permitted, lstat 'C:\Users\lmr'
at Object.realpathSync (fs.js:1457:7)
at toRealPath (internal/modules/cjs/loader.js:202:13)
at Function.Module._findPath (internal/modules/cjs/loader.js:268:22)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:578:25)
at Function.Module._load (internal/modules/cjs/loader.js:507:25)
at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)
Loading…
Cancel
Save