Merge branch 'master' of git.mycht.cn:developers/information-system

hotfix/远程访问多媒体中心
尹诚诚 8 years ago
commit 8dab12832e

@ -1,137 +1,194 @@
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Cache extends CI_Controller
{
//缓存文件绝对路径
private $dir = '';
//存放缓存文件的数组
private $file = array();
//存放缓存文件夹的数组
private $path = array();
//缓存更新接口
private $cache_api = '';
//缓存更新参数
private $post_para = '';
//当前站点域名
private $current_domain = '';
//文件更新日期
private $file_time = array();
function __construct()
{
parent::__construct();
$this->permission->is_admin();
$this->load->model('Area_model');
$this->load->model('InfoStructures_model');
$this->load->model('Information_model');
$this->site_code = $this->config->item('site_code');
}
/**
*
* 公有函数:扫描已有缓存文件并更新。
*
* 必要参数:
* @param String $site_code
*
*/
public function update()
{
//设置缓存文件文件夹
$cache_config = $this->config->item('cache');
$current_cache_config = $cache_config[$this->site_code];
$this->dir = $current_cache_config['cache_path'];
//设置当前站点
$this->current_domain = $this->config->item('site_url');
//设置缓存更新接口及POST参数
$this->cache_api = $current_cache_config['cache_api'];
$this->post_para = $current_cache_config['cache_api_para'];
//遍历缓存文件夹
$this->tree($this->dir, $this->file, $this->path, $this->file_time);
//按目录筛选结果
$this->filter($this->file, $this->path);
//整理需要传递到视图的数据
$data['file'] = $this->file;
$data['path'] = $this->path;
$data['file_time'] = $this->file_time;
$data['cache_api'] = $this->cache_api;
$data['post_para'] = $this->post_para;
//视图
$this->load->view('cache/update', $data);
}
/**
*
* 私有函数:递归遍历缓存文件夹,将目录存放到$path文件存放到$file。
*
* 必要参数:
* @param String $dir - 需要遍历的目录
* @param Array $file - 存放文件结果的数组引用
* @param Array $path - 存放路径结果的数组引用
* @param Array $file_time - 存放文件更新日期的数组引用
*
*/
private function tree($dir, &$file, &$path, &$file_time)
{
$mydir = dir($dir);
while($f = $mydir->read())
{
if(is_dir("$dir/$f") && $f!="." && $f!=".." && (strpos($dir, '/cn/')==false))
{
$path[] = "$dir/$f";
$this->tree("$dir/$f", $file, $path, $file_time);
}
else
{
if ($f!='.' && $f!='..' && (strpos($dir, '/cn/')==false))
{
$file_temp = str_ireplace('index.htm###', '', $f.'###');
$file_temp = str_ireplace('###', '', $file_temp);
$path_temp = str_ireplace($this->dir, '', $dir);
$url_temp = $this->current_domain.$path_temp.'/'.$file_temp;
$file_time[$url_temp] = date("F d Y H:i:s", filemtime("$dir/$f"));
$file[] = $url_temp;
}
}
}
$mydir->close();
}
/**
*
* 私有函数:筛选目录和文件。
*
* 必要参数:
* @param Array $file - 存放文件结果的数组引用
* @param Array $path - 存放路径结果的数组引用
*
* 可选参数POST参数 - $_POST['p']
*
*/
private function filter(&$file, &$path)
{
if (isset($_POST['p']) && !empty($_POST['p']))
{
//删选文件
foreach ($file as &$f)
{
(stripos($f, $_POST['p'])!==false) or $f = false;
}
$file = array_filter($file);
//删选目录
foreach ($path as &$p)
{
(stripos($p, $_POST['p'])!==false) or $p = false;
}
$path = array_filter($path);
}
}
}
//end of Cache
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Cache extends CI_Controller
{
//缓存文件绝对路径
private $dir = '';
//存放缓存文件的数组
private $file = array();
//存放缓存文件夹的数组
private $path = array();
//缓存更新接口
private $cache_api = '';
//缓存更新参数
private $post_para = '';
//当前站点域名
private $current_domain = '';
//文件更新日期
private $file_time = array();
function __construct()
{
parent::__construct();
$this->permission->is_admin();
$this->load->model('Area_model');
$this->load->model('InfoStructures_model');
$this->load->model('Information_model');
$this->site_code = $this->config->item('site_code');
}
/**
*
* 公有函数:扫描已有缓存文件并更新。
*
* 必要参数:
* @param String $site_code
*
*/
public function update()
{
//设置缓存文件文件夹
$cache_config = $this->config->item('cache');
$current_cache_config = $cache_config[$this->site_code];
$this->dir = $current_cache_config['cache_path'];
//设置当前站点
$this->current_domain = $this->config->item('site_url');
//echo $this->config->item('site_url');
//设置缓存更新接口及POST参数
$this->cache_api = $current_cache_config['cache_api'];
$this->post_para = $current_cache_config['cache_api_para'];
//遍历缓存文件夹
$this->tree($this->dir, $this->file, $this->path, $this->file_time);
//按目录筛选结果
$this->filter($this->file, $this->path);
//整理需要传递到视图的数据
$data['file'] = $this->file;
$data['path'] = $this->path;
$data['file_time'] = $this->file_time;
$data['cache_api'] = $this->cache_api;
$data['post_para'] = $this->post_para;
//视图
$this->load->view('cache/update', $data);
}
/**
*
* 公有函数:扫描已有缓存文件并更新。
*
* 必要参数:
* @param String $site_code
*
*/
public function sitemap()
{
header("Content-type:text/xml");
//设置缓存文件文件夹
$cache_config = $this->config->item('cache');
$current_cache_config = $cache_config[$this->site_code];
$this->dir = $current_cache_config['cache_path'];
//设置当前站点
$this->current_domain = $this->config->item('site_url');
//设置缓存更新接口及POST参数
$this->cache_api = $current_cache_config['cache_api'];
$this->post_para = $current_cache_config['cache_api_para'];
//遍历缓存文件夹
$this->tree($this->dir, $this->file, $this->path, $this->file_time);
//按目录筛选结果
$this->filter($this->file, $this->path);
//整理需要传递到视图的数据
$data['file'] = $this->file;
$data['path'] = $this->path;
$data['file_time'] = $this->file_time;
$data['cache_api'] = $this->cache_api;
$data['post_para'] = $this->post_para;
//排序file数组
sort ($data['file']);
//生成sitemap
$dom = new DomDocument('1.0', 'utf-8');
$urlset = $dom->createElement('urlset');
$urlset->setAttribute('xmlns', 'http://www.sitemaps.org/schemas/sitemap/0.9');
$dom->appendchild($urlset);
foreach ($data['file'] as $f)
{
$url = $dom->createElement('url');
$loc = $dom->createElement('loc');
$text = $dom->createTextNode($f);
$loc->appendchild($text);
$url->appendchild($loc);
$urlset->appendchild($url);
}
echo($dom->saveXML());
}
/**
*
* 私有函数:递归遍历缓存文件夹,将目录存放到$path文件存放到$file。
*
* 必要参数:
* @param String $dir - 需要遍历的目录
* @param Array $file - 存放文件结果的数组引用
* @param Array $path - 存放路径结果的数组引用
* @param Array $file_time - 存放文件更新日期的数组引用
*
*/
private function tree($dir, &$file, &$path, &$file_time)
{
$mydir = dir($dir);
while($f = $mydir->read())
{
if(is_dir("$dir/$f") && $f!="." && $f!=".." && (strpos($dir, '/cn/')==false))
{
$path[] = "$dir/$f";
$this->tree("$dir/$f", $file, $path, $file_time);
}
else
{
if ($f!='.' && $f!='..' && (strpos($dir, '/cn/')==false) && (strpos($f, '.pdf')===false))
{
$file_temp = str_ireplace('index.htm###', '', $f.'###');
$file_temp = str_ireplace('###', '', $file_temp);
$path_temp = str_ireplace($this->dir, '', $dir);
$url_temp = $this->current_domain.$path_temp.'/'.$file_temp;
$file_time[$url_temp] = date("F d Y H:i:s", filemtime("$dir/$f"));
$file[] = $url_temp;
}
}
}
$mydir->close();
}
/**
*
* 私有函数:筛选目录和文件。
*
* 必要参数:
* @param Array $file - 存放文件结果的数组引用
* @param Array $path - 存放路径结果的数组引用
*
* 可选参数POST参数 - $_POST['p']
*
*/
private function filter(&$file, &$path)
{
if (isset($_POST['p']) && !empty($_POST['p']))
{
//删选文件
foreach ($file as &$f)
{
(stripos($f, $_POST['p'])!==false) or $f = false;
}
$file = array_filter($file);
//删选目录
foreach ($path as &$p)
{
(stripos($p, $_POST['p'])!==false) or $p = false;
}
$path = array_filter($path);
}
}
}
//end of Cache

@ -0,0 +1,80 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Sendmail_model extends CI_Model {
function __construct()
{
parent::__construct();
$this->HT = $this->load->database('HT', TRUE);
}
function SendMailToTable($fromName,$fromEmail,$toName,$toEmail,$subject,$body)
{
if($this->validEmail($toEmail))
{
$data = array(
"M_ReplyToName" => $fromName, //回复人
"M_ReplyToEmail" => $fromEmail, //回复地址
"M_ToName" => $toName, //收件人名
"M_ToEmail" => $toEmail, //收件邮件地址
"M_Title" => $subject, //主题
"M_Body" => $body, //邮件正文
"M_Web" => "CHT", //所属站点
"M_FromName" => "Chinahighlights.com", //站点名称
"M_State" => 0,
);
$this->HT->insert('Email_AutomaticSend',$data);
return TRUE;
}else{
return FALSE;
}
}
public function validEmail($email){
$isValid = true;
$atIndex = strrpos($email, "@");
if (is_bool($atIndex) && !$atIndex){
$isValid = false;
}else{
$domain = substr($email, $atIndex+1);
$local = substr($email, 0, $atIndex);
$localLen = strlen($local);
$domainLen = strlen($domain);
if ($localLen < 1 || $localLen > 64){
// local part length exceeded
$isValid = false;
}else if ($domainLen < 1 || $domainLen > 255){
// domain part length exceeded
$isValid = false;
}else if ($local[0] == '.' || $local[$localLen-1] == '.'){
// local part starts or ends with '.'
$isValid = false;
}else if (preg_match('/\\.\\./', $local)){
// local part has two consecutive dots
$isValid = false;
}else if (!preg_match('/^[A-Za-z0-9\\-\\.]+$/', $domain)){
// character not valid in domain part
$isValid = false;
}else if (preg_match('/\\.\\./', $domain)){
// domain part has two consecutive dots
$isValid = false;
}else if(!preg_match('/^(\\\\.|[A-Za-z0-9!#%&`_=\\/$\'*+?^{}|~.-])+$/',str_replace("\\\\","",$local))){
// character not valid in local part unless
// local part is quoted
if (!preg_match('/^"(\\\\"|[^"])+"$/',str_replace("\\\\","",$local))){
$isValid = false;
}
}
/*
不检查是否有DNS解析
if ($isValid && !(checkdnsrr($domain,"MX") || checkdnsrr($domain,"A"))){
// domain not found in DNS
$isValid = false;
}
*/
}
return $isValid;
}
}

@ -0,0 +1,70 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style>
*{ font-family:Verdana, Geneva, sans-serif;}
h1{ font-size:18px; text-align:center; color:#545454; margin:0 0 10px 0!important;}
p{ font-size:14px; color:#545454; line-height:22px; margin-bottom:12px!important;}
table.table{ width:90%; border-width:1px 1px 0 1px; border-color:#d1d1d1; border-style: solid; margin-bottom:15px;}
table.table th{ background:#f1f1f1; color:#666; border-bottom:1px solid #d1d1d1; width:180px; font-size:14px; text-align:left; padding:8px 10px 8px 10px;}
table.table td{ padding:8px 0 8px 10px; border-bottom:1px solid #d1d1d1; font-size:14px; color:#545454;}
</style>
</head>
<body>
<h1>China Highlights Booking Confirmation</h1>
<p>Dear <?php echo $user[0]->GUT_LastName?>,</p>
<p>Thanks for payment US$145 . The train tickets have already been issued. </p>
<p> You can collect the paper ticket(s) from now at any train station in mainland China. </p>
<p> Please present all passenger(s) original passport(s) and Ticket Pick Up No.E601014106 &nbsp;at any ticket collecting counters (in Chinese 取票窗口)of any railway stations in mainland China. They will then issue your paper train ticket(s). </p>
<table border="0" cellpadding="0" cellspacing="0" class="table">
<tr>
<th>Passenger(s)</th>
<td><p>2 adult(s)
</p>
<p> 1. ALEXANDER JAMES JOHNSON , passport number 503406354<br />
2. SIAN MARIE JOHNSON , passport number 528876517</p></td>
</tr>
</table>
<p>Train 1:</p>
<table border="0" cellpadding="0" cellspacing="0" class="table">
<tr>
<th><strong>Ticket Pick Up No.</strong></th>
<td>E601014106&nbsp; </td>
</tr>
<tr>
<th><strong>Train No.</strong></th>
<td>Z19</td>
</tr>
<tr>
<th><strong>Departure</strong></th>
<td>20:40 Jun.06 Beijing Xi (West) Station(in Chinese 北京西火车站)</td>
</tr>
<tr>
<th><strong>Arrival</strong></th>
<td>08:31AM Jun.07 Xi'an Station(in Chinese 西安火车站) </td>
</tr>
<tr>
<th><strong>Class</strong></th>
<td>Soft Sleeper </td>
</tr>
</table>
<p>Kindly note below:</p>
<p> 1. The same passport that was used for booking should also be used for ticket collection. A renewed passport won't be acceptable even if the holder is the same person. The system does not allow us to change passport number or passenger name after issue ticket. Have to issue new ticket if wrong passport number or name.</p>
<p> 2. There is no further fee if collect train ticket(s) at the DEPARTURE station shown on your ticket(s). RMB 5 per ticket will be charged at a ticket counter at other stations. E.g. if you have booked Beijing-Shanghai and Shanghai-Beijing ticket(s), and you collect them all at Beijing, you will be charged RMB 5 per ticket for the Shanghai-Beijing ticket(s), but if you pick up the return leg ticket(s) separately in Shanghai you will avoid the charge.</p>
<p> 3. On departure day, please time your arrival wisely. If you are going to collect your tickets on departure day, we suggest you be at the station at least 1.5 hours ahead of the stated departure time to allow for waiting in queue at the ticket-counter, for security checks and for ticket checks.<br />
If you&rsquo;ve already collected before the departure day, it is also wise to be at the station at least 40 minutes ahead. </p>
<p> 4. Download railway station instructions, maps and tips at <a href="http://www.chinahighlights.com/china-trains/station-map.htm">http://www.chinahighlights.com/china-trains/station-map.htm</a> <br />
<br />
5.Terms &amp; Conditions. <a href="http://www.chinahighlights.com/china-trains/booking-policy.htm">http://www.chinahighlights.com/china-trains/booking-policy.htm</a></p>
<p> Best Regards!<br />
Iris Wang, Travel Advisor<br />
Tel: +86-773-2801368 &nbsp;Mobile:+86-18775900313 <br />
Fax: 86-773-2827424, 86-773-2885308 <br />
E-mail: <a href="mailto:iris@chinahighlights.me">iris@chinahighlights.me</a><br />
<a href="http://www.chinahighlights.com">www.chinahighlights.com</a> <br />
Address: Building 6, Chuangyi Business Park, 70 Qilidian Road, Guilin, Guangxi, 541004, China<br />
If you wish to share anything with my supervisor (Ms. Alex Yang), please feel free to send your email to <a href="mailto:alex@chinahighlights.net">alex@chinahighlights.net</a>. </p>
</body>
</html>

File diff suppressed because it is too large Load Diff

@ -23,7 +23,7 @@
$(function() {
//更新静态页,异步请求队列(setp_set个)
var setp_set = 20;
var setp_set = 6;
$('#update').on('click', function() {
var $data = $('.data');
for(var i=0; i<setp_set; i++) {

Loading…
Cancel
Save