Skip to content

Commit 7d56bff

Browse files
committed
Merge pull request #1 from liu21st/master
merge
2 parents f182fe0 + 6d459f0 commit 7d56bff

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+3648
-796
lines changed

Extend/Behavior/CheckLangBehavior.class.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ private function checkLanguage() {
5353
}elseif(cookie('think_language')){// 获取上次用户的选择
5454
$langSet = cookie('think_language');
5555
}elseif(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){// 自动侦测浏览器语言
56-
preg_match('/^([a-z\-]+)/i', $_SERVER['HTTP_ACCEPT_LANGUAGE'], $matches);
56+
preg_match('/^([a-z\d\-]+)/i', $_SERVER['HTTP_ACCEPT_LANGUAGE'], $matches);
5757
$langSet = $matches[1];
5858
cookie('think_language',$langSet,3600);
5959
}
@@ -78,4 +78,4 @@ private function checkLanguage() {
7878
if (is_file($lang_path.$group.strtolower(MODULE_NAME).'.php'))
7979
L(include $lang_path.$group.strtolower(MODULE_NAME).'.php');
8080
}
81-
}
81+
}

Extend/Driver/Cache/CacheRedis.class.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ public function __construct($options=array()) {
5656
*/
5757
public function get($name) {
5858
N('cache_read',1);
59-
return $this->handler->get($this->options['prefix'].$name);
59+
$value = $this->handler->get($this->options['prefix'].$name);
60+
$jsonData = json_decode( $value, true );
61+
return ($jsonData === NULL) ? $value : $jsonData; //检测是否为JSON数据 true 返回JSON解析数组, false返回源数据
6062
}
6163

6264
/**
@@ -73,6 +75,8 @@ public function set($name, $value, $expire = null) {
7375
$expire = $this->options['expire'];
7476
}
7577
$name = $this->options['prefix'].$name;
78+
//对数组/对象数据进行缓存处理,保证数据完整性
79+
$value = (is_object($value) || is_array($value)) ? json_encode($value) : $value;
7680
if(is_int($expire)) {
7781
$result = $this->handler->setex($name, $expire, $value);
7882
}else{

Extend/Driver/Cache/CacheSqlite.class.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ public function get($name) {
7575
*/
7676
public function set($name, $value,$expire=null) {
7777
N('cache_write',1);
78-
$expire = !empty($expireTime)? $expireTime : C('DATA_CACHE_TIME');
7978
$name = $this->options['prefix'].sqlite_escape_string($name);
8079
$value = sqlite_escape_string(serialize($value));
8180
if(is_null($expire)) {

Extend/Driver/Db/DbIbase.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ public function close() {
299299
* @return string
300300
*/
301301
public function error() {
302-
$this->error = ibase_errmsg();
302+
$this->error = ibase_errcode().':'.ibase_errmsg();
303303
if('' != $this->queryStr){
304304
$this->error .= "\n [ SQL语句 ] : ".$this->queryStr;
305305
}

0 commit comments

Comments
 (0)