From 6997bb1b8e2c4a736b66cee126e58c047f94d459 Mon Sep 17 00:00:00 2001
From: joyqi
Date: Mon, 16 Dec 2013 09:39:08 +0800
Subject: [PATCH 1/4] fixed issue #129
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
根据实验,在某些web服务器上,对`urlencode`也就是RFC 3986的标准解释不同,它们将unicode字符转义为以百分号开头的小写字符,而php中则默认为大写字符。比如“你好”在php中被转义为`%E4%BD%A0%E5%A5%BD`而在某些服务器上被转义为`%e4%bd%a0%e5%a5%bd`。
这导致`Widget_Archive`中的`checkPermalink`函数将它们识别为不同的路径,从而循环重定向。
解决方法:在`checkPermalink`函数中直接比较`urldecode`以后的`path`
---
var/Widget/Archive.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/var/Widget/Archive.php b/var/Widget/Archive.php
index 508ecf89..9c98d100 100644
--- a/var/Widget/Archive.php
+++ b/var/Widget/Archive.php
@@ -621,7 +621,7 @@ class Widget_Archive extends Widget_Abstract_Contents
$src = parse_url($permalink);
$target = parse_url($requestUrl);
- if ($src['host'] != $target['host'] || $src['path'] != $target['path']) {
+ if ($src['host'] != $target['host'] || urldecode($src['path']) != urldecode($target['path'])) {
$this->response->redirect($permalink, true);
}
}
From 5abd03638b742ef5872ddf9ebd2bc8e71493bc50 Mon Sep 17 00:00:00 2001
From: Jakukyo Friel
Date: Mon, 16 Dec 2013 13:37:08 +0800
Subject: [PATCH 2/4] =?UTF-8?q?=E6=96=87=E5=AD=97=E7=9A=84=E5=B0=8F?=
=?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 密码建议使用符号、字母混合改为使用符号、字母、数字混合
- 授权说明改得更明确些,强调是在GPL的范围之内自由商业性或非商业性使用。
---
install.php | 2 +-
var/Widget/Users/Edit.php | 2 +-
var/Widget/Users/Profile.php | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/install.php b/install.php
index 128da8b2..4019dca5 100644
--- a/install.php
+++ b/install.php
@@ -595,7 +595,7 @@ Typecho_Db::set(\$db);
GPL 协议发布,我们允许用户在 GPL 协议许可的范围内使用,拷贝,修改和分发此程序.
-您可以自由地将其用于商业以及非商业用途.'); ?>
+在GPL许可的范围内,您可以自由地将其用于商业以及非商业用途.'); ?>
diff --git a/var/Widget/Users/Edit.php b/var/Widget/Users/Edit.php
index a40c81b0..a406fce7 100644
--- a/var/Widget/Users/Edit.php
+++ b/var/Widget/Users/Edit.php
@@ -110,7 +110,7 @@ class Widget_Users_Edit extends Widget_Abstract_Users implements Widget_Interfac
/** 用户密码 */
$password = new Typecho_Widget_Helper_Form_Element_Password('password', NULL, NULL, _t('用户密码'), _t('为此用户分配一个密码.')
- . '
' . _t('建议使用特殊字符与字母的混编样式,以增加系统安全性.'));
+ . '
' . _t('建议使用特殊字符与字母、数字的混编样式,以增加系统安全性.'));
$password->input->setAttribute('class', 'w-60');
$form->addInput($password);
diff --git a/var/Widget/Users/Profile.php b/var/Widget/Users/Profile.php
index 06a57300..cef6c36c 100644
--- a/var/Widget/Users/Profile.php
+++ b/var/Widget/Users/Profile.php
@@ -211,7 +211,7 @@ class Widget_Users_Profile extends Widget_Users_Edit implements Widget_Interface
/** 用户密码 */
$password = new Typecho_Widget_Helper_Form_Element_Password('password', NULL, NULL, _t('用户密码'), _t('为此用户分配一个密码.')
- . '
' . _t('建议使用特殊字符与字母的混编样式,以增加系统安全性.'));
+ . '
' . _t('建议使用特殊字符与字母、数字的混编样式,以增加系统安全性.'));
$password->input->setAttribute('class', 'w-60');
$form->addInput($password);
From 81b017a1185e2fef656a814cda81978ac7968bed Mon Sep 17 00:00:00 2001
From: joyqi
Date: Mon, 16 Dec 2013 14:37:33 +0800
Subject: [PATCH 3/4] =?UTF-8?q?=E7=94=9F=E6=88=90pot=E6=96=87=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
tools/Makefile | 28 +++++++++--------
tools/list.php | 81 ++++++++++++++------------------------------------
2 files changed, 38 insertions(+), 71 deletions(-)
diff --git a/tools/Makefile b/tools/Makefile
index 05c42c50..2dd80fbc 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -2,8 +2,6 @@
#define root directory
DIR=../
-TINYMCE=3_2_2
-
#update subversion
update:
@@ -11,8 +9,8 @@ update:
rm -Rf build/
git clone https://github.com/typecho/typecho-replica.git build
rm -Rf build/.git
- rm -Rf build/.gitignore
- rm -Rf build/.gitattributes
+ rm -f build/.gitignore
+ rm -f build/.gitattributes
for i in `find build/ -name '*.css'`; do echo $$i && java -Xmx32m -jar yuicompressor-2.4.2.jar $$i --charset UTF-8 -o $$i; done;
for i in `find build/admin/js/ -name '*.js'`; do echo $$i && java -Xmx32m -jar yuicompressor-2.4.2.jar $$i --charset UTF-8 -o $$i; done;
for i in `find build/ -name '*.php'`; do php -l $$i; done;
@@ -21,10 +19,10 @@ update:
package:
@echo 'package'
rm -Rf build/tools/
- rm -Rf build/todo.txt
- rm -Rf build/changelog.txt
- rm -Rf build/.travis.yml
- rm -Rf build/README.md
+ rm -f build/todo.txt
+ rm -f build/changelog.txt
+ rm -f build/.travis.yml
+ rm -f build/README.md
rm -Rf build/admin/scss
rm -Rf build/admin/img/editor
rm -Rf build/admin/img/icons
@@ -59,10 +57,10 @@ theme:
install:
make update
rm -Rf build/tools/
- rm -Rf build/todo.txt
- rm -Rf build/changelog.txt
- rm -Rf build/.travis.yml
- rm -Rf build/README.md
+ rm -f build/todo.txt
+ rm -f build/changelog.txt
+ rm -f build/.travis.yml
+ rm -f build/README.md
rm -Rf build/admin/scss
rm -Rf build/admin/img/editor
rm -Rf build/admin/img/icons
@@ -73,6 +71,12 @@ install:
make clear
+pot:
+ cd ../ && php tools/list.php ./ > tools/files.txt
+ cd ../ && xgettext --files-from=tools/files.txt -Lphp --from-code=UTF-8 --keyword=_t --keyword=_e --keyword=_n:1,2 --no-location --copyright-holder=Typecho --package-name=Typecho --package-version=`grep -E "VERSION = '(.*)'" ./var/Typecho/Common.php | cut -d "'" -f 2` --no-wrap --output=tools/messages.pot
+ rm -f files.txt
+
+
all:
make update
make package
diff --git a/tools/list.php b/tools/list.php
index dd8fc251..35f7b71c 100644
--- a/tools/list.php
+++ b/tools/list.php
@@ -6,68 +6,31 @@ if (!isset($argv[1])) {
exit(1);
}
-//获取一个目录下的文件
-function mgGetFile($inpath, $trim = false,$stamp = NULL)
-{
- $file = array();
+/**
+ * 获取所有文件
+ *
+ * @param string $dir
+ * @param string $pattern
+ * @return array
+ */
+function all_files($dir, $pattern = '*') {
+ $result = array();
- if(!is_dir($inpath))
- {
- return $file;
- }
+ $items = glob($dir . '/' . $pattern, GLOB_BRACE);
+ foreach ($items as $item) {
+ if (is_file($item)) {
+ $result[] = $item;
+ }
+ }
- $handle=opendir($inpath);
- if(NULL != $stamp)
- {
- $stamp = explode("|",$stamp);
- }
-
- while ($tmp = readdir($handle))
- {
- if(file_exists($inpath."/".$tmp) && eregi("^([_@0-9a-zA-Z\x80-\xff\^\.\%-]{0,})[\.]([0-9a-zA-Z]{1,})$",$tmp,$file_name))
- {
- if($stamp != NULL && in_array($file_name[2],$stamp))
- {
- $file[] = $trim ? $file_name[0] : $file_name[1];
- }
- else if($stamp == NULL)
- {
- $file[] = $trim ? $file_name[0] : $file_name[1];
- }
- }
- }
- closedir($handle);
- return $file;
-}
-
-//获取一个目录下的目录
-function mgGetDir($inpath)
-{
- $handle=opendir($inpath);
- $dir = array();
- while ($tmp = readdir($handle))
- {
- if(is_dir($inpath."/".$tmp) && $tmp != ".." && $tmp != "." && 0 !== stripos($tmp,'.'))
- {
- $dir[] = $tmp;
- }
- }
- closedir($handle);
- return $dir;
-}
-
-function listFile($inpath, $stamp)
-{
- $files = mgGetFile($inpath, true, $stamp);
- $dirs = mgGetDir($inpath);
-
- if ($dirs) {
- foreach ($dirs as $dir) {
- $files = array_merge($files, listFile($dir, $stamp));
+ $items = glob($dir . '/*', GLOB_ONLYDIR);
+ foreach ($items as $item) {
+ if (is_dir($item)) {
+ $result = array_merge($result, all_files($item, $pattern));
}
}
-
- return $files;
+
+ return $result;
}
-echo implode("\n", listFile($argv[1], 'php'));
+echo implode("\n", all_files($argv[1], '*.php'));
From cfa0caeb481812b088ca4c98fb8542e45f9bb6f6 Mon Sep 17 00:00:00 2001
From: joyqi
Date: Tue, 17 Dec 2013 10:13:00 +0800
Subject: [PATCH 4/4] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=AF=AD=E8=A8=80?=
=?UTF-8?q?=E9=A1=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
在安装程序中出现的语言翻译项不能使用换行符,那样不利于PO翻译软件识别。
---
install.php | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/install.php b/install.php
index 4019dca5..7eec260e 100644
--- a/install.php
+++ b/install.php
@@ -594,10 +594,11 @@ Typecho_Db::set(\$db);
- GPL 协议发布,我们允许用户在 GPL 协议许可的范围内使用,拷贝,修改和分发此程序.
-在GPL许可的范围内,您可以自由地将其用于商业以及非商业用途.'); ?>
-
+ GPL 协议发布, 我们允许用户在 GPL 协议许可的范围内使用, 拷贝, 修改和分发此程序.'); ?>
+
+
+
+