diff --git a/classes/security/Password.class.php b/classes/security/Password.class.php
index c0a1da502..993314f87 100644
--- a/classes/security/Password.class.php
+++ b/classes/security/Password.class.php
@@ -58,7 +58,22 @@ class Password
{
return Rhymix\Framework\Password::getRandomPassword($length);
}
-
+
+ public function createSignature($string)
+ {
+ return Rhymix\Framework\Security::createSignature($string);
+ }
+
+ public function checkSignature($string, $signature)
+ {
+ return Rhymix\Framework\Security::verifySignature($string, $signature);
+ }
+
+ public function getSecretKey()
+ {
+ return config('crypto.authentication_key');
+ }
+
public function pbkdf2($password, $salt, $algorithm = 'sha256', $iterations = 8192, $length = 24)
{
$hash = Rhymix\Framework\Security::pbkdf2($password, $salt, $algorithm, $iterations, $length);
diff --git a/classes/validator/Validator.class.php b/classes/validator/Validator.class.php
index 5c630c30c..2afbcb96d 100644
--- a/classes/validator/Validator.class.php
+++ b/classes/validator/Validator.class.php
@@ -91,7 +91,8 @@ class Validator
'url' => '/^(https?|ftp|mms):\/\/[0-9a-z-]+(\.[_0-9a-z-]+)+(:\d+)?/',
'alpha' => '/^[a-z]*$/i',
'alpha_number' => '/^[a-z][a-z0-9_]*$/i',
- 'number' => '/^(?:[1-9]\\d*|0)$/'
+ 'number' => '/^(?:[1-9]\\d*|0)$/',
+ 'float' => '/^\d+(\.\d+)?$/'
));
$this->_has_mb_func = is_callable('mb_strlen');
@@ -714,7 +715,7 @@ class Validator
{
$name = strtolower($name);
- if(in_array($name, array('email', 'userid', 'url', 'alpha', 'alpha_number', 'number')))
+ if(in_array($name, array('email', 'userid', 'url', 'alpha', 'alpha_number', 'number', 'float')))
{
continue;
}
diff --git a/common/constants.php b/common/constants.php
index a7201c857..83cb9525d 100644
--- a/common/constants.php
+++ b/common/constants.php
@@ -3,7 +3,7 @@
/**
* RX_VERSION is the version number of the Rhymix CMS.
*/
-define('RX_VERSION', '1.8.22');
+define('RX_VERSION', '1.8.23');
/**
* RX_MICROTIME is the startup time of the current script, in microseconds since the Unix epoch.
diff --git a/common/framework/parsers/configparser.php b/common/framework/parsers/configparser.php
index 3c4edce18..cfa60dbac 100644
--- a/common/framework/parsers/configparser.php
+++ b/common/framework/parsers/configparser.php
@@ -160,7 +160,7 @@ class ConfigParser
// Create new crypto keys.
$config['crypto']['encryption_key'] = Security::getRandom(64, 'alnum');
- $config['crypto']['authentication_key'] = Security::getRandom(64, 'alnum');
+ $config['crypto']['authentication_key'] = $db_info->secret_key ?: Security::getRandom(64, 'alnum');
$config['crypto']['session_key'] = Security::getRandom(64, 'alnum');
// Convert language configuration.
diff --git a/common/framework/security.php b/common/framework/security.php
index a474acb58..5a2803c2d 100644
--- a/common/framework/security.php
+++ b/common/framework/security.php
@@ -112,6 +112,40 @@ class Security
return \CryptoCompat::decrypt($ciphertext, $key);
}
+ /**
+ * Create a digital signature to verify the authenticity of a string.
+ *
+ * @param string $string
+ * @return string
+ */
+ public static function createSignature($string)
+ {
+ $key = config('crypto.authentication_key');
+ $salt = self::getRandom(8, 'alnum');
+ $hash = substr(base64_encode(hash_hmac('sha256', hash_hmac('sha256', $string, $salt), $key, true)), 0, 32);
+ return $salt . strtr($hash, '+/', '-_');
+ }
+
+ /**
+ * Check whether a signature is valid.
+ *
+ * @param string $string
+ * @param string $signature
+ * @return bool
+ */
+ public static function verifySignature($string, $signature)
+ {
+ if(strlen($signature) !== 40)
+ {
+ return false;
+ }
+
+ $key = config('crypto.authentication_key');
+ $salt = substr($signature, 0, 8);
+ $hash = substr(base64_encode(hash_hmac('sha256', hash_hmac('sha256', $string, $salt), $key, true)), 0, 32);
+ return self::compareStrings(substr($signature, 8), strtr($hash, '+/', '-_'));
+ }
+
/**
* Generate a cryptographically secure random string.
*
diff --git a/common/js/common.js b/common/js/common.js
index 0448b32d1..a420790b0 100644
--- a/common/js/common.js
+++ b/common/js/common.js
@@ -294,12 +294,17 @@ jQuery(function($) {
}
}
- re = /http:\/\/([^:\/]+)(:\d+|)/i;
+ re = /https?:\/\/([^:\/]+)(:\d+|)/i;
if (bUseSSL && re.test(uri)) {
toReplace = 'https://'+RegExp.$1;
if (window.https_port && https_port != 443) toReplace += ':' + https_port;
uri = uri.replace(re, toReplace);
}
+ if (!bUseSSL && re.test(uri)) {
+ toReplace = 'http://'+RegExp.$1;
+ if (window.http_port && http_port != 80) toReplace += ':' + http_port;
+ uri = uri.replace(re, toReplace);
+ }
// insert index.php if it isn't included
uri = uri.replace(/\/(index\.php)?\?/, '/index.php?');
diff --git a/common/js/xml_js_filter.js b/common/js/xml_js_filter.js
index 537fbde11..17108540b 100644
--- a/common/js/xml_js_filter.js
+++ b/common/js/xml_js_filter.js
@@ -51,6 +51,10 @@
// number
var regNum = /^[0-9]*$/;
this.cast('ADD_RULE', ['number', regNum]);
+
+ // float
+ var regFloat = /^\d+(\.\d+)?$/;
+ this.cast('ADD_RULE', ['float', regFloat]);
// }}} add filters
},
// run validator
diff --git a/common/lang/en.php b/common/lang/en.php
index 0b7e1abaf..65429151c 100644
--- a/common/lang/en.php
+++ b/common/lang/en.php
@@ -310,6 +310,7 @@ $lang->filter['invalid_alpha'] = 'The format of %s is invalid. Please enter Engl
$lang->filter['invalid_alpha_number'] = 'The format of %s is invalid. Please enter English alphabets and numbers only.';
$lang->filter['invalid_mid'] = 'The format of %s is invalid. Module ID should be begun with a letter. Subsequent characters may be letters, digits or underscore characters.';
$lang->filter['invalid_number'] = 'The format of %s is invalid. Please enter numbers only.';
+$lang->filter['invalid_float'] = 'The format of %s is invalid. Please enter numbers only.';
$lang->filter['invalid_extension'] = 'The format of %s is invalid. e.g.) *.* or *.jpg;*.gif;.';
$lang->security_warning_embed = 'Due to security concern, administrators are not allowed to view embedded items.
To view them, please use another non-administrator ID.';
$lang->msg_pc_to_mobile = 'View mobile optimized version of this page';
diff --git a/common/lang/ja.php b/common/lang/ja.php
index ab81bae9c..e6b81a3b8 100644
--- a/common/lang/ja.php
+++ b/common/lang/ja.php
@@ -293,6 +293,7 @@ $lang->filter['invalid_alpha'] = '%sの形式が正しくありません。半
$lang->filter['invalid_alpha_number'] = '%sの形式が正しくありません。半角英数字で入力してください。';
$lang->filter['invalid_mid'] = '%sの形式が正しくありません。 最初の文字は英文から始め、「英文+数字+_」組合せで入力が必要です。';
$lang->filter['invalid_number'] = '%sの形式が正しくありません。半角数字で入力してください。';
+$lang->filter['invalid_float'] = '%sの形式が正しくありません。半角数字で入力してください。';
$lang->security_warning_embed = 'セキュリティ問題のため、管理者IDではembedを見ることができません。
他のIDでログインしてください。';
$lang->msg_pc_to_mobile = 'このページは、モバイル表示が可能です。モバイル表示へ移動しますか?';
$lang->cmd_yes = 'はい';
diff --git a/common/lang/ko.php b/common/lang/ko.php
index e9290c67d..720909c06 100644
--- a/common/lang/ko.php
+++ b/common/lang/ko.php
@@ -310,6 +310,7 @@ $lang->filter['invalid_alpha'] = '%s의 형식이 잘못되었습니다. 영문
$lang->filter['invalid_alpha_number'] = '%s의 형식이 잘못되었습니다. 영문과 숫자로만 입력해야 합니다.';
$lang->filter['invalid_mid'] = '%s의 형식이 잘못되었습니다. 첫 글자는 영문으로 시작해야 하며 \'영문+숫자+_\'로만 입력해야 합니다.';
$lang->filter['invalid_number'] = '%s의 형식이 잘못되었습니다. 숫자로만 입력해야 합니다.';
+$lang->filter['invalid_float'] = '%s의 형식이 잘못되었습니다. 숫자로만 입력해야 합니다.';
$lang->filter['invalid_extension'] = '%s의 형식이 잘못되었습니다. *.* 나 *.jpg;*.gif; 처럼 입력해야 합니다.';
$lang->security_invalid_session = '바르지 않은 접근입니다. 인증을 위해 다시 로그인해야 합니다.';
$lang->security_warning_embed = '보안 문제로 관리자 아이디로는 embed를 볼 수 없습니다. 확인하려면 다른 아이디로 접속하세요';
diff --git a/common/lang/zh-CN.php b/common/lang/zh-CN.php
index cc43b14a6..936207cdd 100644
--- a/common/lang/zh-CN.php
+++ b/common/lang/zh-CN.php
@@ -277,6 +277,7 @@ $lang->filter['invalid_alpha'] = '%s只能输入英文字母';
$lang->filter['invalid_alpha_number'] = '%s只能输入英文或数字';
$lang->filter['invalid_mid'] = '%s 格式错误。 模块名称只能用英文、数字及下划线,开头必须是英文。';
$lang->filter['invalid_number'] = '%s只能输入数字';
+$lang->filter['invalid_float'] = '%s只能输入数字';
$lang->security_warning_embed = '由于安全问题,不允许用系统管理员ID操作embed对象,请使用其他拥有管理权限的ID操作。';
$lang->cmd_yes = '是';
$lang->cmd_no = '否';
diff --git a/common/lang/zh-TW.php b/common/lang/zh-TW.php
index c10602414..a6a4083ed 100644
--- a/common/lang/zh-TW.php
+++ b/common/lang/zh-TW.php
@@ -276,6 +276,7 @@ $lang->filter['invalid_alpha'] = '%s只能輸入英文字母';
$lang->filter['invalid_alpha_number'] = '%s只能輸入英文或數字';
$lang->filter['invalid_mid'] = '%s 格式錯誤。 模組名稱只能使用英文、數字及底線,開頭必須是英文。';
$lang->filter['invalid_number'] = '%s只能輸入數字';
+$lang->filter['invalid_float'] = '%s只能輸入數字';
$lang->security_warning_embed = '基於安全因素,管理員無法檢視嵌入的物件。
請使用其他非管理員帳號檢視。';
$lang->msg_pc_to_mobile = '此頁面有手機頁面,要移至手機頁面嗎?';
$lang->cmd_yes = '是';
diff --git a/modules/board/board.mobile.php b/modules/board/board.mobile.php
index a036a0156..22d67b195 100644
--- a/modules/board/board.mobile.php
+++ b/modules/board/board.mobile.php
@@ -55,7 +55,7 @@ class boardMobile extends boardView
* check the consultation function, if the user is admin then swich off consultation function
* if the user is not logged, then disppear write document/write comment./ view document
**/
- if($this->module_info->consultation == 'Y' && !$this->grant->manager)
+ if($this->module_info->consultation == 'Y' && !$this->grant->manager && !$this->grant->consultation_read)
{
$this->consultation = true;
if(!Context::get('is_logged')) $this->grant->list = $this->grant->write_document = $this->grant->write_comment = $this->grant->view = false;
diff --git a/modules/board/board.view.php b/modules/board/board.view.php
index 6c5dab7ce..41af3c945 100644
--- a/modules/board/board.view.php
+++ b/modules/board/board.view.php
@@ -74,7 +74,7 @@ class boardView extends board
* check the consultation function, if the user is admin then swich off consultation function
* if the user is not logged, then disppear write document/write comment./ view document
**/
- if($this->module_info->consultation == 'Y' && !$this->grant->manager)
+ if($this->module_info->consultation == 'Y' && !$this->grant->manager && !$this->grant->consultation_read)
{
$this->consultation = TRUE;
if(!Context::get('is_logged'))
diff --git a/modules/board/conf/module.xml b/modules/board/conf/module.xml
index dfa619e9b..7e2981f00 100644
--- a/modules/board/conf/module.xml
+++ b/modules/board/conf/module.xml
@@ -44,6 +44,11 @@