Merge branch 'develop' of git.mycht.cn:developers/asiahighlights.com into develop

master
csk 9 years ago
commit 0d76ae8e24

@ -358,7 +358,7 @@ $config['rewrite_short_tags'] = FALSE;
| Comma-delimited, e.g. '10.0.1.200,10.0.1.201' | Comma-delimited, e.g. '10.0.1.200,10.0.1.201'
| |
*/ */
$config['proxy_ips'] = '75.126.42.90,106.186.113.181,82.194.72.163,78.47.247.200,144.76.95.112,78.47.16.163,188.120.225.171,92.243.4.190,199.195.192.27,176.67.169.200,46.166.147.149,46.166.155.152,106.187.95.194,88.198.111.123'; $config['proxy_ips'] = '75.126.42.90,106.186.113.181,82.194.72.163,78.47.247.200,144.76.95.112,78.47.16.163,188.120.225.171,92.243.4.190,199.195.192.27,176.67.169.200,46.166.147.149,46.166.155.152,106.187.95.194,88.198.111.123,169.45.101.56';
//设置站点信息 //设置站点信息
$config['Site_Domain'] = 'www.asiahighlights.com'; $config['Site_Domain'] = 'www.asiahighlights.com';

@ -1,11 +1,12 @@
<?php <?php
//加载第三方用于解析html的类
require '/lib/simple_html_dom.php';
if (!defined('BASEPATH')) if (!defined('BASEPATH'))
exit('No direct script access allowed'); exit('No direct script access allowed');
class MY_Output extends CI_Output class MY_Output extends CI_Output {
{
// -------------------------------------------------------------------- // --------------------------------------------------------------------
/** /**
@ -15,93 +16,96 @@ class MY_Output extends CI_Output
* @param string * @param string
* @return void * @return void
*/ */
function _write_cache($output) function _write_cache($output) {
{
$cache_path = 'd:/Dropbox/wwwcache/asiahighlights.com'; $cache_path = 'd:/Dropbox/wwwcache/asiahighlights.com';
if ( ! is_dir($cache_path) OR ! is_really_writable($cache_path)) if (!is_dir($cache_path) OR ! is_really_writable($cache_path)) {
{ log_message('error', "Unable to write cache file: " . $cache_path);
log_message('error', "Unable to write cache file: ".$cache_path);
return; return;
} }
///////改成按照URL保存缓存 ///////改成按照URL保存缓存
//优先使用提交过来的static_html_url做文件名这是主动生成静态文件用的参数 //优先使用提交过来的static_html_url做文件名这是主动生成静态文件用的参数
if(empty($_GET['static_html_url'])) if (empty($_GET['static_html_url'])) {
{
return FALSE; return FALSE;
} }
$cache_path=$cache_path.$_GET['static_html_url']; $cache_path = $cache_path . $_GET['static_html_url'];
if(mb_substr($cache_path,-1,1)=='/') if (mb_substr($cache_path, -1, 1) == '/') {
{
$cache_path.='index.htm'; $cache_path.='index.htm';
} }
$this->create_folder_by_path(dirname($cache_path)); $this->create_folder_by_path(dirname($cache_path));
//如果文件存在,先判断是否为缓存文件,防止覆盖原始程序文件 //如果文件存在,先判断是否为缓存文件,防止覆盖原始程序文件
if (@file_exists($cache_path)) if (@file_exists($cache_path)) {
{ if (!$fp_read = @fopen($cache_path, FOPEN_READ)) {
if ( ! $fp_read = @fopen($cache_path, FOPEN_READ))
{
return FALSE; return FALSE;
} }
flock($fp_read, LOCK_SH); flock($fp_read, LOCK_SH);
$cache = ''; $cache = '';
if (filesize($cache_path) > 0) if (filesize($cache_path) > 0) {
{
$cache = fread($fp_read, filesize($cache_path)); $cache = fread($fp_read, filesize($cache_path));
} }
flock($fp_read, LOCK_UN); flock($fp_read, LOCK_UN);
fclose($fp_read); fclose($fp_read);
if(strpos($cache,'<!-- Generated by ')===false) if (strpos($cache, '<!-- Generated by ') === false) {
{ log_message('error', "is not cache file." . $cache_path);
log_message('error', "is not cache file.".$cache_path);
return FALSE; return FALSE;
} }
} }
/////// ///////
if ( ! $fp = @fopen($cache_path, FOPEN_WRITE_CREATE_DESTRUCTIVE)) if (!$fp = @fopen($cache_path, FOPEN_WRITE_CREATE_DESTRUCTIVE)) {
{ log_message('error', "Unable to write cache file: " . $cache_path);
log_message('error', "Unable to write cache file: ".$cache_path);
return; return;
} }
if (flock($fp, LOCK_EX)) //解析html生成不同版本的静态文件
{ //替换图片地址用CDN分发
fwrite($fp, $output.'<!-- Generated by '.$_SERVER['HTTP_HOST'].' ('.date('c').') -->'); $html_object = str_get_html($output);
flock($fp, LOCK_UN); if (!empty($html_object)) {
foreach ($html_object->find('img') as $image) {
if (strpos($image->src, '/pic/') !== false) {
$image->src = 'https://data.asiahighlights.com' . $image->src;
} else if (strpos($image->src, '/image/') !== false) {
$image->src = 'https://data.asiahighlights.com' . $image->src;
}
}
$output = $html_object->save();
} }
else //删除多余空格和换行符
{ $output = str_replace(array(" ", "\t", "\n", "\r"), " ", $output);
log_message('error', "Unable to secure a file lock for file at: ".$cache_path); $output = str_replace(" ", " ", $output);
//////
if (flock($fp, LOCK_EX)) {
fwrite($fp, $output . '<!-- Generated by ' . $_SERVER['HTTP_HOST'] . ' (' . date('c') . ') -->');
flock($fp, LOCK_UN);
} else {
log_message('error', "Unable to secure a file lock for file at: " . $cache_path);
return; return;
} }
fclose($fp); fclose($fp);
@chmod($cache_path, FILE_WRITE_MODE); @chmod($cache_path, FILE_WRITE_MODE);
log_message('debug', "Cache file written: ".$cache_path); log_message('debug', "Cache file written: " . $cache_path);
} }
// -------------------------------------------------------------------- // --------------------------------------------------------------------
/* /*
* 递归创建文件夹 * 递归创建文件夹
*/ */
function create_folder_by_path($dir, $mode = 0777) function create_folder_by_path($dir, $mode = 0777) {
{ if (!is_dir($dir)) {
if (!is_dir($dir))
{
return @mkdir($dir, $mode, true); return @mkdir($dir, $mode, true);
} }
return; return;
} }
} }

@ -23,7 +23,6 @@
$(function() { $(function() {
$("#form_tour_detail").stick_in_parent({parent: "#mcontent",bottoming:false}); $("#form_tour_detail").stick_in_parent({parent: "#mcontent",bottoming:false});
// $("#footerBtn").stick_in_parent({parent: "body",stickyClass:"ff"});
if(IsPC()){ if(IsPC()){
$(".dropdown-menu-ah-csk").mouseover(function() { $(".dropdown-menu-ah-csk").mouseover(function() {
$(this).addClass('open'); $(this).addClass('open');

@ -1,53 +0,0 @@
<form action="http://www.chinahighlights.com/forms/booking-form-pay1.asp" id="formquestion" method="post" novalidate="novalidate" class="is_stuck" style="">
<div id="InquiryPay">
<div class="PayBoxTop"></div><div class="PayInfo">
<span class="BookTitle"><?php echo $pd_tour->CLI2_Name ?></span>
<ul class="tourList">
<li><strong>Duration:</strong> 10 hours (approx.)</li>
<li>Tour Type: Private Tour</li>
</ul>
<div class="promoPrice"> <a class="priceLink" href="#gotoprice">See price details</a></div>
<div class="PayInfoBottom"><img src="http://data.chinahighlights.com/pic/pay-form-bottom.png"></div>
</div>
<div class="PayBox">
<div class="infoRequired">
<p>
<input type="text" id="Starting_Date" name="Starting_Date" value="" placeholder="Travel Date">
<span id="dateerrmsg" class="hidden"></span>
</p>
</div>
<input name="season" type="hidden" value="2">
<input name="grade" type="hidden" value="<?php echo $pd_tour->CLI_Grade; ?>">
<input name="cli_no" type="hidden" value="<?php echo $pd_tour->CLI_NO; ?>">
<input type="submit" value="Reserve Your Date" id="form_sumbit_button" class="sendButton">
</div>
</div>
</form>
<script type="text/javascript">
$(function() {
$("#formquestion").stick_in_parent({parent: "#mcontent"});
//form valid
$('#form_sumbit_button').click(function() {
var stdate = $('input[name="Starting_Date"]').val();
if (stdate == '') {
$('#dateerrmsg').html('<span style="color:#c00">Please select prefered time</span>');
$('#dateerrmsg').removeClass('hidden');
return false;
}
});
$("#Starting_Date").datepicker({
showAnim: "fadeIn",
duration: 0,
minDate: 7,
maxDate: "2y",
numberOfMonths: 2,
showButtonPanel: true
});
});
</script>

@ -1,67 +0,0 @@
<form action="http://www.chinahighlights.com/forms/reserve-tour-simple-save.asp" id="formquestion" method="post" novalidate="novalidate">
<div id="questionBox">
<div class="questionContent">
<span class="interested">What's Your Style?</span> <span class="interest-label">Each tour can be tailored.</span>
<div class="infoRequired">
<div class="yourStyle hidden-xs">
<input type="radio" name="travelstyle" value="Comfort" /> Comfort <input type="radio" name="travelstyle" value="Discovery" /> Discovery <input type="radio" name="travelstyle" value="Essential" /> Essential
</div>
<p style="display:block;">
<label for="realname" style="opacity:1;">Full Name: </label> <input name="realname" type="text" id="realname" value="" />
</p>
<p style="display:block;">
<label for="yemail">Email: </label> <input name="yemail" type="text" id="yemail" value="" />
</p>
<p class="des" style="display:block;">
<label for="Aquestion">Tell us your tour ideas: where to visit, how many people and days... </label>
<textarea name="Aquestion" id="Aquestion"></textarea>
<input type="hidden" name="Q_URL" id="Q_URL" value="<?php echo $detail->ic_url; ?>" />
<input type="hidden" value="<?php echo $pd_tour->CLI_NO; ?>" name="clino" />
</p>
</div>
<input type="submit" value="Send" class="sendButton" />
</div>
</div>
</form>
<script>
$(function() {
$("#formquestion").stick_in_parent({parent: "#mcontent"});
$(document).on("click", ".error", function() {
$(this).parent("p").find(".arrowDownTest").remove();
});
$("#formquestion").validate({
rules: {
realname: {
required: true,
minlength: 1
},
yemail: {
required: true,
email: true
}
},
messages: {
realname: "Please enter a real name",
yemail: "Please enter a valid email address."
},
errorLabelContainer: "#questionBox .infoRequired p .arrowDownTest",
errorPlacement: function(error, element) {
var error_tip = "<div class=\"arrowDownTest\"><div class=\"arrowDown\"><img src=\"/css/images/whiteArrow.png\"></div></div>";
element.parent().append(error_tip);
error.appendTo(element.parent().find(".arrowDownTest"));
},
focusInvalid: true,
submitHandler: function(form) {
//form.find(".arrowDownTest").show();
form.submit();
},
//debug: true
});
//---------------------------------------------------------------------------------------------------------------------------------------
})
</script>

File diff suppressed because it is too large Load Diff

@ -102,7 +102,7 @@ $min_serveOptions['bubbleCssImports'] = false;
* Note: Despite this setting, if you include a number at the end of the * Note: Despite this setting, if you include a number at the end of the
* querystring, maxAge will be set to one year. E.g. /min/f=hello.css&123456 * querystring, maxAge will be set to one year. E.g. /min/f=hello.css&123456
*/ */
$min_serveOptions['maxAge'] = 1800; $min_serveOptions['maxAge'] = 10080;
/** /**

@ -0,0 +1,2 @@
User-agent:*
Disallow: /index.php/*
Loading…
Cancel
Save