From a05298a32923d5b6aa4d62d607d006206aa85ab0 Mon Sep 17 00:00:00 2001
From: ZhaiSoul <842607283@qq.com>
Date: Mon, 1 Jul 2019 00:15:07 +0800
Subject: [PATCH 01/15] =?UTF-8?q?=E4=B8=BA=E4=BB=BB=E5=8A=A1=E3=80=81?=
=?UTF-8?q?=E8=AF=84=E5=88=86=E4=B8=8E=E9=81=93=E5=85=B7=E6=B7=BB=E5=8A=A0?=
=?UTF-8?q?=E9=94=81=E9=98=B2=E6=AD=A2=E5=B9=B6=E5=8F=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
upload/source/class/class_task.php | 5 +++++
upload/source/function/function_magic.php | 2 ++
upload/source/language/home/lang_template.php | 1 +
upload/source/language/lang_message.php | 2 ++
upload/source/module/forum/forum_misc.php | 5 +++++
upload/source/module/home/home_magic.php | 4 ++++
6 files changed, 19 insertions(+)
diff --git a/upload/source/class/class_task.php b/upload/source/class/class_task.php
index d25b59aa9..9c4f46ecf 100644
--- a/upload/source/class/class_task.php
+++ b/upload/source/class/class_task.php
@@ -394,6 +394,9 @@ class task {
}
if($result === TRUE) {
+ if(discuz_process::islocked('task_'.$_G['uid'].'_'.$id)){
+ showmessage('task_locked', 'home.php?mod=task&do=view&id='.$id);
+ }
if($this->task['reward']) {
$rewards = $this->reward();
@@ -430,6 +433,8 @@ class task {
C::t('common_mytask')->update($_G['uid'], $id, array('status' => 1, 'csc' => 100, 'dateline' => $_G['timestamp']));
C::t('common_task')->update_achievers($id, 1);
+ discuz_process::unlock('task_'.$_G['uid'].'_'.$id);
+
if($_G['inajax']) {
$this->message('100', $this->task['reward'] ? 'task_reward_'.$this->task['reward'] : 'task_completed', array(
'creditbonus' => $_G['setting']['extcredits'][$this->task['prize']]['title'].' '.$this->task['bonus'].' '.$_G['setting']['extcredits'][$this->task['prize']]['unit'],
diff --git a/upload/source/function/function_magic.php b/upload/source/function/function_magic.php
index b7938216c..7ab05f90d 100644
--- a/upload/source/function/function_magic.php
+++ b/upload/source/function/function_magic.php
@@ -212,6 +212,8 @@ function updatemagiclog($magicid, $action, $amount, $price, $targetuid = 0, $idt
'targetuid' => $targetuid
);
C::t('common_magiclog')->insert($data);
+
+ discuz_process::unlock('magiclock_'.$_G['uid'].'_'.$magicid);
}
diff --git a/upload/source/language/home/lang_template.php b/upload/source/language/home/lang_template.php
index d4675020e..45e76ea97 100644
--- a/upload/source/language/home/lang_template.php
+++ b/upload/source/language/home/lang_template.php
@@ -560,6 +560,7 @@ $lang = array (
'magics_outofperoid_4' => '24 小时内',
'magics_outofperoid_noperm' => '您无法再使用本道具了',
'magics_outofperoid_value' => '您还能使用 $useperoid 次本道具',
+ 'magics_locked' => '当前道具正在使用中,请稍后再试。',
'magics_present_message' => '赠送留言',
'magics_present_message_text' => '送您一个{$magic[name]},{$magic[description]},希望您能喜欢 ',
'magics_select' => '选择道具',
diff --git a/upload/source/language/lang_message.php b/upload/source/language/lang_message.php
index ceceebbf2..e20393d0b 100644
--- a/upload/source/language/lang_message.php
+++ b/upload/source/language/lang_message.php
@@ -235,6 +235,7 @@ $lang = array (
'task_nonexistence' => '抱歉,该任务不存在或已被删除',
'task_not_found' => '任务文件丢失,{taskclassname}',
'task_not_underway' => '不是进行中的任务',
+ 'task_locked' => '抱歉,当前任务正在完成中,请稍后再试',
'user_banned' => '抱歉,您的 IP 地址不在允许范围内,或您的账号被禁用,无法访问本站点',
'submit_seccode_invalid' => '抱歉,验证码填写错误',
'submit_invalid' => '抱歉,您的请求来路不正确或表单验证串不符,无法提交',
@@ -336,6 +337,7 @@ $lang = array (
'thread_rate_range_self_invalid' => '抱歉,您的{extcreditstitle}不足,无法评分',
'thread_rate_ctrl' => '抱歉,24 小时评分数超过限制',
'thread_rate_succeed' => '感谢您的参与,现在将转入评分前页面',
+ 'thread_rate_locked' => '抱歉,当前评分不可用,请稍后再试',
'no_privilege_removerate' => '抱歉,您没有权限撤销评分',
'thread_rate_removesucceed' => '评分撤销成功 ',
'member_no_found' => '该用户未找到',
diff --git a/upload/source/module/forum/forum_misc.php b/upload/source/module/forum/forum_misc.php
index bc3f1dc76..35cd373fe 100644
--- a/upload/source/module/forum/forum_misc.php
+++ b/upload/source/module/forum/forum_misc.php
@@ -676,6 +676,9 @@ if($_GET['action'] == 'votepoll' && submitcheck('pollsubmit', 1)) {
include template('forum/rate');
} else {
+ if(discuz_process::islocked('ratelock_'.$_G['uid'].'_'.$_GET['pid'])){
+ showmessage('thread_rate_locked','');
+ }
$reason = checkreasonpm();
$rate = $ratetimes = 0;
@@ -766,6 +769,8 @@ if($_GET['action'] == 'votepoll' && submitcheck('pollsubmit', 1)) {
C::t('forum_postcache')->delete($_GET['pid']);
writelog('ratelog', $logs);
+ discuz_process::unlock('ratelock_'.$_G['uid'].'_'.$_GET['pid']);
+
showmessage('thread_rate_succeed', dreferer());
}
} elseif($_GET['action'] == 'removerate' && $_GET['pid']) {
diff --git a/upload/source/module/home/home_magic.php b/upload/source/module/home/home_magic.php
index 4259bde57..8efca8226 100644
--- a/upload/source/module/home/home_magic.php
+++ b/upload/source/module/home/home_magic.php
@@ -341,6 +341,10 @@ if($action == 'shop') {
$useperoid = magic_peroid($magic, $_G['uid']);
if(submitcheck('usesubmit')) {
+ if(discuz_process::islocked('magiclock_'.$_G['uid'].'_'.$magicid)){
+ showmessage('magics_locked','');
+ }
+
if($useperoid !== true && $useperoid <= 0) {
showmessage('magics_outofperoid_'.$magic['useperoid'], '', array('usenum' => $magic['usenum']));
}
--
Gitee
From 99b9ef3e69a35add497d65b72e17f21ce41b9057 Mon Sep 17 00:00:00 2001
From: ZhaiSoul <842607283@qq.com>
Date: Mon, 1 Jul 2019 00:16:10 +0800
Subject: [PATCH 02/15] =?UTF-8?q?=E8=B0=83=E6=95=B4discuz=5Fprocess?=
=?UTF-8?q?=E6=9C=BA=E5=88=B6=EF=BC=8C=E4=BF=9D=E8=AF=81=E9=94=81=E7=9A=84?=
=?UTF-8?q?=E4=B8=8D=E5=8F=AF=E9=87=8D=E5=A4=8D=E6=80=A7?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
upload/source/class/discuz/discuz_memory.php | 10 ++++++++
upload/source/class/discuz/discuz_process.php | 23 +++++++++++--------
.../class/memory/memory_driver_memcache.php | 4 ++++
.../class/memory/memory_driver_memcached.php | 4 ++++
.../class/memory/memory_driver_redis.php | 4 ++++
.../class/table/table_common_process.php | 9 ++++++++
upload/source/function/function_core.php | 7 +++---
7 files changed, 48 insertions(+), 13 deletions(-)
diff --git a/upload/source/class/discuz/discuz_memory.php b/upload/source/class/discuz/discuz_memory.php
index b67f283cd..7570cd7b3 100644
--- a/upload/source/class/discuz/discuz_memory.php
+++ b/upload/source/class/discuz/discuz_memory.php
@@ -90,6 +90,16 @@ class discuz_memory extends discuz_base
}
return $ret;
}
+
+ public function add($key, $value, $ttl = 0, $prefix = '') {
+ $ret = false;
+ if($value === false) $value = '';
+ if($this->enable) {
+ $this->userprefix = $prefix;
+ $ret = $this->memory->add($this->_key($key), $value, $ttl);
+ }
+ return $ret;
+ }
public function rm($key, $prefix = '') {
$ret = false;
diff --git a/upload/source/class/discuz/discuz_process.php b/upload/source/class/discuz/discuz_process.php
index 007774939..e586318cf 100644
--- a/upload/source/class/discuz/discuz_process.php
+++ b/upload/source/class/discuz/discuz_process.php
@@ -26,7 +26,7 @@ class discuz_process
private static function _status($action, $process) {
static $plist = array();
switch ($action) {
- case 'set' : $plist[$process] = true; break;
+ case 'add' : $plist[$process] = true; break;
case 'get' : return !empty($plist[$process]); break;
case 'rm' : $plist[$process] = null; break;
case 'clear' : $plist = array(); break;
@@ -37,20 +37,23 @@ class discuz_process
private static function _find($name, $ttl) {
if(!discuz_process::_cmd('get', $name)) {
- discuz_process::_cmd('set', $name, $ttl);
- $ret = false;
+ if(discuz_process::_cmd('add', $name, $ttl) == true) {
+ $ret = false;
+ } else {
+ $ret = true;
+ }
} else {
$ret = true;
}
- discuz_process::_status('set', $name);
+ discuz_process::_status('add', $name);
return $ret;
}
private static function _cmd($cmd, $name, $ttl = 0) {
static $allowmem;
if($allowmem === null) {
- $mc = memory('check');
- $allowmem = $mc == 'memcache' || $mc == 'redis';
+ $mc = strtolower(memory('check'));
+ $allowmem = $mc == 'memcache' || $mc == 'redis' || $mc == 'memcached';
}
if($allowmem) {
return discuz_process::_process_cmd_memory($cmd, $name, $ttl);
@@ -62,8 +65,8 @@ class discuz_process
private static function _process_cmd_memory($cmd, $name, $ttl = 0) {
$ret = '';
switch ($cmd) {
- case 'set' :
- $ret = memory('set', 'process_lock_'.$name, time(), $ttl);
+ case 'add' :
+ $ret = memory('add', 'process_lock_'.$name, time(), $ttl);
break;
case 'get' :
$ret = memory('get', 'process_lock_'.$name);
@@ -77,8 +80,8 @@ class discuz_process
private static function _process_cmd_db($cmd, $name, $ttl = 0) {
$ret = '';
switch ($cmd) {
- case 'set':
- $ret = C::t('common_process')->insert(array('processid' => $name, 'expiry' => time() + $ttl), FALSE, true);
+ case 'add':
+ $ret = C::t('common_process')->insert($name, (time() + $ttl));
break;
case 'get':
$ret = C::t('common_process')->fetch($name);
diff --git a/upload/source/class/memory/memory_driver_memcache.php b/upload/source/class/memory/memory_driver_memcache.php
index 21b9dfe89..2ae026abe 100644
--- a/upload/source/class/memory/memory_driver_memcache.php
+++ b/upload/source/class/memory/memory_driver_memcache.php
@@ -48,6 +48,10 @@ class memory_driver_memcache {
return $this->obj->set($key, $value, MEMCACHE_COMPRESSED, $ttl);
}
+ public function add($key, $value, $ttl = 0) {
+ return $this->obj->add($key, $value, MEMCACHE_COMPRESSED, $ttl);
+ }
+
public function rm($key) {
return $this->obj->delete($key);
}
diff --git a/upload/source/class/memory/memory_driver_memcached.php b/upload/source/class/memory/memory_driver_memcached.php
index ce455b2c2..4868304cd 100644
--- a/upload/source/class/memory/memory_driver_memcached.php
+++ b/upload/source/class/memory/memory_driver_memcached.php
@@ -44,6 +44,10 @@ class memory_driver_memcached
return $this->obj->set($key, $value, $ttl);
}
+ public function add($key, $value, $ttl = 0) {
+ return $this->obj->add($key, $value, $ttl);
+ }
+
public function rm($key) {
return $this->obj->delete($key);
}
diff --git a/upload/source/class/memory/memory_driver_redis.php b/upload/source/class/memory/memory_driver_redis.php
index 23b78a524..56b1a5399 100644
--- a/upload/source/class/memory/memory_driver_redis.php
+++ b/upload/source/class/memory/memory_driver_redis.php
@@ -89,6 +89,10 @@ class memory_driver_redis {
}
}
+ function add($key, $value, $ttl = 0) {
+ return $this->obj->set($key, $value, ['nx', 'ex' => $ttl]);
+ }
+
function rm($key) {
return $this->obj->delete($key);
}
diff --git a/upload/source/class/table/table_common_process.php b/upload/source/class/table/table_common_process.php
index 4975a8735..7daad33fc 100644
--- a/upload/source/class/table/table_common_process.php
+++ b/upload/source/class/table/table_common_process.php
@@ -25,6 +25,15 @@ class table_common_process extends discuz_table
$name = addslashes($name);
return DB::delete('common_process', "processid='$name' OR expiry<".intval($time));
}
+
+ public function insert($name, $expiry) {
+ try{
+ DB::query('INSERT '.DB::table($this->_table)." (`processid`, `expiry`) VALUES ('$name', '$expiry') ");
+ return true;
+ }catch(Exception $exc){
+ return false;
+ }
+ }
}
?>
\ No newline at end of file
diff --git a/upload/source/function/function_core.php b/upload/source/function/function_core.php
index 4093561e3..4326460a7 100644
--- a/upload/source/function/function_core.php
+++ b/upload/source/function/function_core.php
@@ -1698,18 +1698,19 @@ function getposttable($tableid = 0, $prefix = false) {
function memory($cmd, $key='', $value='', $ttl = 0, $prefix = '') {
if($cmd == 'check') {
return C::memory()->enable ? C::memory()->type : '';
- } elseif(C::memory()->enable && in_array($cmd, array('set', 'get', 'rm', 'inc', 'dec'))) {
+ } elseif(C::memory()->enable && in_array($cmd, array('set', 'add', 'get', 'rm', 'inc', 'dec'))) {
if(defined('DISCUZ_DEBUG') && DISCUZ_DEBUG) {
if(is_array($key)) {
foreach($key as $k) {
- C::memory()->debug[$cmd][] = ($cmd == 'get' || $cmd == 'rm' ? $value : '').$prefix.$k;
+ C::memory()->debug[$cmd][] = ($cmd == 'get' || $cmd == 'rm' || $cmd == 'add' ? $value : '').$prefix.$k;
}
} else {
- C::memory()->debug[$cmd][] = ($cmd == 'get' || $cmd == 'rm' ? $value : '').$prefix.$key;
+ C::memory()->debug[$cmd][] = ($cmd == 'get' || $cmd == 'rm' || $cmd == 'add' ? $value : '').$prefix.$key;
}
}
switch ($cmd) {
case 'set': return C::memory()->set($key, $value, $ttl, $prefix); break;
+ case 'add': return C::memory()->add($key, $value, $ttl, $prefix); break;
case 'get': return C::memory()->get($key, $value); break;
case 'rm': return C::memory()->rm($key, $value); break;
case 'inc': return C::memory()->inc($key, $value ? $value : 1); break;
--
Gitee
From 0debcebf595219145835f14a306390c3e3d67efd Mon Sep 17 00:00:00 2001
From: ZhaiSoul <842607283@qq.com>
Date: Wed, 12 Feb 2020 19:13:28 +0800
Subject: [PATCH 03/15] =?UTF-8?q?Revert=20"=E4=B8=BA=E4=BB=BB=E5=8A=A1?=
=?UTF-8?q?=E3=80=81=E8=AF=84=E5=88=86=E4=B8=8E=E9=81=93=E5=85=B7=E6=B7=BB?=
=?UTF-8?q?=E5=8A=A0=E9=94=81=E9=98=B2=E6=AD=A2=E5=B9=B6=E5=8F=91"?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This reverts commit a05298a32923d5b6aa4d62d607d006206aa85ab0.
---
upload/source/class/class_task.php | 5 -----
upload/source/function/function_magic.php | 2 --
upload/source/language/home/lang_template.php | 1 -
upload/source/language/lang_message.php | 2 --
upload/source/module/forum/forum_misc.php | 5 -----
upload/source/module/home/home_magic.php | 4 ----
6 files changed, 19 deletions(-)
diff --git a/upload/source/class/class_task.php b/upload/source/class/class_task.php
index 9c4f46ecf..d25b59aa9 100644
--- a/upload/source/class/class_task.php
+++ b/upload/source/class/class_task.php
@@ -394,9 +394,6 @@ class task {
}
if($result === TRUE) {
- if(discuz_process::islocked('task_'.$_G['uid'].'_'.$id)){
- showmessage('task_locked', 'home.php?mod=task&do=view&id='.$id);
- }
if($this->task['reward']) {
$rewards = $this->reward();
@@ -433,8 +430,6 @@ class task {
C::t('common_mytask')->update($_G['uid'], $id, array('status' => 1, 'csc' => 100, 'dateline' => $_G['timestamp']));
C::t('common_task')->update_achievers($id, 1);
- discuz_process::unlock('task_'.$_G['uid'].'_'.$id);
-
if($_G['inajax']) {
$this->message('100', $this->task['reward'] ? 'task_reward_'.$this->task['reward'] : 'task_completed', array(
'creditbonus' => $_G['setting']['extcredits'][$this->task['prize']]['title'].' '.$this->task['bonus'].' '.$_G['setting']['extcredits'][$this->task['prize']]['unit'],
diff --git a/upload/source/function/function_magic.php b/upload/source/function/function_magic.php
index 7ab05f90d..b7938216c 100644
--- a/upload/source/function/function_magic.php
+++ b/upload/source/function/function_magic.php
@@ -212,8 +212,6 @@ function updatemagiclog($magicid, $action, $amount, $price, $targetuid = 0, $idt
'targetuid' => $targetuid
);
C::t('common_magiclog')->insert($data);
-
- discuz_process::unlock('magiclock_'.$_G['uid'].'_'.$magicid);
}
diff --git a/upload/source/language/home/lang_template.php b/upload/source/language/home/lang_template.php
index 45e76ea97..d4675020e 100644
--- a/upload/source/language/home/lang_template.php
+++ b/upload/source/language/home/lang_template.php
@@ -560,7 +560,6 @@ $lang = array (
'magics_outofperoid_4' => '24 小时内',
'magics_outofperoid_noperm' => '您无法再使用本道具了',
'magics_outofperoid_value' => '您还能使用 $useperoid 次本道具',
- 'magics_locked' => '当前道具正在使用中,请稍后再试。',
'magics_present_message' => '赠送留言',
'magics_present_message_text' => '送您一个{$magic[name]},{$magic[description]},希望您能喜欢 ',
'magics_select' => '选择道具',
diff --git a/upload/source/language/lang_message.php b/upload/source/language/lang_message.php
index e20393d0b..ceceebbf2 100644
--- a/upload/source/language/lang_message.php
+++ b/upload/source/language/lang_message.php
@@ -235,7 +235,6 @@ $lang = array (
'task_nonexistence' => '抱歉,该任务不存在或已被删除',
'task_not_found' => '任务文件丢失,{taskclassname}',
'task_not_underway' => '不是进行中的任务',
- 'task_locked' => '抱歉,当前任务正在完成中,请稍后再试',
'user_banned' => '抱歉,您的 IP 地址不在允许范围内,或您的账号被禁用,无法访问本站点',
'submit_seccode_invalid' => '抱歉,验证码填写错误',
'submit_invalid' => '抱歉,您的请求来路不正确或表单验证串不符,无法提交',
@@ -337,7 +336,6 @@ $lang = array (
'thread_rate_range_self_invalid' => '抱歉,您的{extcreditstitle}不足,无法评分',
'thread_rate_ctrl' => '抱歉,24 小时评分数超过限制',
'thread_rate_succeed' => '感谢您的参与,现在将转入评分前页面',
- 'thread_rate_locked' => '抱歉,当前评分不可用,请稍后再试',
'no_privilege_removerate' => '抱歉,您没有权限撤销评分',
'thread_rate_removesucceed' => '评分撤销成功 ',
'member_no_found' => '该用户未找到',
diff --git a/upload/source/module/forum/forum_misc.php b/upload/source/module/forum/forum_misc.php
index 35cd373fe..bc3f1dc76 100644
--- a/upload/source/module/forum/forum_misc.php
+++ b/upload/source/module/forum/forum_misc.php
@@ -676,9 +676,6 @@ if($_GET['action'] == 'votepoll' && submitcheck('pollsubmit', 1)) {
include template('forum/rate');
} else {
- if(discuz_process::islocked('ratelock_'.$_G['uid'].'_'.$_GET['pid'])){
- showmessage('thread_rate_locked','');
- }
$reason = checkreasonpm();
$rate = $ratetimes = 0;
@@ -769,8 +766,6 @@ if($_GET['action'] == 'votepoll' && submitcheck('pollsubmit', 1)) {
C::t('forum_postcache')->delete($_GET['pid']);
writelog('ratelog', $logs);
- discuz_process::unlock('ratelock_'.$_G['uid'].'_'.$_GET['pid']);
-
showmessage('thread_rate_succeed', dreferer());
}
} elseif($_GET['action'] == 'removerate' && $_GET['pid']) {
diff --git a/upload/source/module/home/home_magic.php b/upload/source/module/home/home_magic.php
index 8efca8226..4259bde57 100644
--- a/upload/source/module/home/home_magic.php
+++ b/upload/source/module/home/home_magic.php
@@ -341,10 +341,6 @@ if($action == 'shop') {
$useperoid = magic_peroid($magic, $_G['uid']);
if(submitcheck('usesubmit')) {
- if(discuz_process::islocked('magiclock_'.$_G['uid'].'_'.$magicid)){
- showmessage('magics_locked','');
- }
-
if($useperoid !== true && $useperoid <= 0) {
showmessage('magics_outofperoid_'.$magic['useperoid'], '', array('usenum' => $magic['usenum']));
}
--
Gitee
From a8862bd94a748d813cc6b39c1d1d12566b1509cd Mon Sep 17 00:00:00 2001
From: ZhaiSoul <842607283@qq.com>
Date: Wed, 12 Feb 2020 19:22:48 +0800
Subject: [PATCH 04/15] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=94=81=E7=9A=84?=
=?UTF-8?q?=E9=80=BB=E8=BE=91=EF=BC=8C=E4=BF=AE=E6=94=B9=E4=B8=BA=E5=9C=A8?=
=?UTF-8?q?submitcheck=E5=A4=84=E6=B7=BB=E5=8A=A0=E9=94=81=EF=BC=88?=
=?UTF-8?q?=E5=8F=AF=E8=83=BD=E4=BC=9A=E5=BD=B1=E5=93=8D=E5=88=B0=E4=B8=80?=
=?UTF-8?q?=E4=BA=9B=E6=8F=92=E4=BB=B6=EF=BC=8C=E6=8F=92=E4=BB=B6=E5=BC=80?=
=?UTF-8?q?=E5=8F=91=E8=80=85=E9=9C=80=E8=A6=81=E5=9C=A8=E8=B0=83=E7=94=A8?=
=?UTF-8?q?=E6=9F=90=E4=BA=9B=E5=87=BD=E6=95=B0=E5=89=8D=E6=89=8B=E5=8A=A8?=
=?UTF-8?q?=E8=A7=A3=E9=94=81=E4=B8=80=E4=B8=8B=EF=BC=89?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
upload/source/function/function_core.php | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/upload/source/function/function_core.php b/upload/source/function/function_core.php
index 4326460a7..9eb30ccc1 100644
--- a/upload/source/function/function_core.php
+++ b/upload/source/function/function_core.php
@@ -1420,13 +1420,22 @@ function showmessage($message, $url_forward = '', $values = array(), $extraparam
}
function submitcheck($var, $allowget = 0, $seccodecheck = 0, $secqaacheck = 0) {
+ global $_G;
if(!getgpc($var)) {
return FALSE;
} else {
- return helper_form::submitcheck($var, $allowget, $seccodecheck, $secqaacheck);
+ register_shutdown_function('submitcheck_unlock', $var);
+ if(!discuz_process::islocked($var.'_'.$_G['uid'].'_locked')) {
+ return helper_form::submitcheck($var, $allowget, $seccodecheck, $secqaacheck);
+ }
}
}
+function submitcheck_unlock($var) {
+ global $_G;
+ discuz_process::unlock($var.'_'.$_G['uid'].'_locked');
+}
+
function multi($num, $perpage, $curpage, $mpurl, $maxpages = 0, $page = 10, $autogoto = FALSE, $simple = FALSE, $jsfunc = FALSE) {
return $num > $perpage ? helper_page::multi($num, $perpage, $curpage, $mpurl, $maxpages, $page, $autogoto, $simple, $jsfunc) : '';
}
--
Gitee
From ae360f2f9b413bf0d5d1478f63e22cadd84b4b39 Mon Sep 17 00:00:00 2001
From: ZhaiSoul <842607283@qq.com>
Date: Tue, 24 Mar 2020 16:57:44 +0800
Subject: [PATCH 05/15] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E8=B0=83=E6=95=B4?=
=?UTF-8?q?=E9=80=BB=E8=BE=91=E9=94=81=E7=9A=84=E9=80=BB=E8=BE=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
upload/source/class/helper/helper_form.php | 32 ++++++++++++++--------
upload/source/function/function_core.php | 9 +-----
2 files changed, 22 insertions(+), 19 deletions(-)
diff --git a/upload/source/class/helper/helper_form.php b/upload/source/class/helper/helper_form.php
index 4b03de8df..de5205ba7 100644
--- a/upload/source/class/helper/helper_form.php
+++ b/upload/source/class/helper/helper_form.php
@@ -19,23 +19,33 @@ class helper_form {
return FALSE;
} else {
global $_G;
- if($allowget || ($_SERVER['REQUEST_METHOD'] == 'POST' && !empty($_GET['formhash']) && $_GET['formhash'] == formhash() && empty($_SERVER['HTTP_X_FLASH_VERSION']) && (empty($_SERVER['HTTP_REFERER']) ||
- strncmp($_SERVER['HTTP_REFERER'], 'http://wsq.discuz.com/', 22) === 0 || preg_replace("/https?:\/\/([^\:\/]+).*/i", "\\1", $_SERVER['HTTP_REFERER']) == preg_replace("/([^\:]+).*/", "\\1", $_SERVER['HTTP_HOST'])))) {
- if(checkperm('seccode')) {
- if($secqaacheck && !check_secqaa($_GET['secanswer'], $_GET['secqaahash'])) {
- showmessage('submit_secqaa_invalid');
- }
- if($seccodecheck && !check_seccode($_GET['seccodeverify'], $_GET['seccodehash'], 0, $_GET['seccodemodid'])) {
- showmessage('submit_seccode_invalid');
+ register_shutdown_function('helper_form::submitcheck_unlock', $var);
+ self::submitcheck_unlock($var);
+ if(!discuz_process::islocked($var.'_'.$_G['uid'].'_locked', 60)) {
+ if($allowget || ($_SERVER['REQUEST_METHOD'] == 'POST' && !empty($_GET['formhash']) && $_GET['formhash'] == formhash() && empty($_SERVER['HTTP_X_FLASH_VERSION']) && (empty($_SERVER['HTTP_REFERER']) ||
+ strncmp($_SERVER['HTTP_REFERER'], 'http://wsq.discuz.com/', 22) === 0 || preg_replace("/https?:\/\/([^\:\/]+).*/i", "\\1", $_SERVER['HTTP_REFERER']) == preg_replace("/([^\:]+).*/", "\\1", $_SERVER['HTTP_HOST'])))) {
+ if(checkperm('seccode')) {
+ if($secqaacheck && !check_secqaa($_GET['secanswer'], $_GET['secqaahash'])) {
+ showmessage('submit_secqaa_invalid');
+ }
+ if($seccodecheck && !check_seccode($_GET['seccodeverify'], $_GET['seccodehash'], 0, $_GET['seccodemodid'])) {
+ showmessage('submit_seccode_invalid');
+ }
}
+ self::submitcheck_unlock($var);
+ return TRUE;
+ } else {
+ showmessage('submit_invalid');
}
- return TRUE;
- } else {
- showmessage('submit_invalid');
}
}
}
+ private static function submitcheck_unlock($var) {
+ global $_G;
+ discuz_process::unlock($var.'_'.$_G['uid'].'_locked');
+ }
+
public static function censor($message, $modword = NULL, $return = FALSE) {
global $_G;
$censor = discuz_censor::instance();
diff --git a/upload/source/function/function_core.php b/upload/source/function/function_core.php
index 9eb30ccc1..d7e0246f7 100644
--- a/upload/source/function/function_core.php
+++ b/upload/source/function/function_core.php
@@ -1424,17 +1424,10 @@ function submitcheck($var, $allowget = 0, $seccodecheck = 0, $secqaacheck = 0) {
if(!getgpc($var)) {
return FALSE;
} else {
- register_shutdown_function('submitcheck_unlock', $var);
- if(!discuz_process::islocked($var.'_'.$_G['uid'].'_locked')) {
- return helper_form::submitcheck($var, $allowget, $seccodecheck, $secqaacheck);
- }
+ return helper_form::submitcheck($var, $allowget, $seccodecheck, $secqaacheck);
}
}
-function submitcheck_unlock($var) {
- global $_G;
- discuz_process::unlock($var.'_'.$_G['uid'].'_locked');
-}
function multi($num, $perpage, $curpage, $mpurl, $maxpages = 0, $page = 10, $autogoto = FALSE, $simple = FALSE, $jsfunc = FALSE) {
return $num > $perpage ? helper_page::multi($num, $perpage, $curpage, $mpurl, $maxpages, $page, $autogoto, $simple, $jsfunc) : '';
--
Gitee
From 3a10f59ac7ea4724dbb381c02bd7aca9ef37f673 Mon Sep 17 00:00:00 2001
From: ZhaiSoul <842607283@qq.com>
Date: Sat, 28 Mar 2020 18:26:53 +0800
Subject: [PATCH 06/15] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E5=8E=BB=E6=8E=89?=
=?UTF-8?q?=E6=B5=8B=E8=AF=95=E7=94=A8=E7=9A=84=E4=BB=A3=E7=A0=81=E5=B9=B6?=
=?UTF-8?q?=E6=B8=85=E7=90=86=E6=8E=89=E6=97=A0=E7=94=A8=E7=9A=84=E4=BB=A3?=
=?UTF-8?q?=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
upload/source/class/helper/helper_form.php | 1 -
upload/source/function/function_core.php | 2 --
2 files changed, 3 deletions(-)
diff --git a/upload/source/class/helper/helper_form.php b/upload/source/class/helper/helper_form.php
index de5205ba7..08058b0bf 100644
--- a/upload/source/class/helper/helper_form.php
+++ b/upload/source/class/helper/helper_form.php
@@ -20,7 +20,6 @@ class helper_form {
} else {
global $_G;
register_shutdown_function('helper_form::submitcheck_unlock', $var);
- self::submitcheck_unlock($var);
if(!discuz_process::islocked($var.'_'.$_G['uid'].'_locked', 60)) {
if($allowget || ($_SERVER['REQUEST_METHOD'] == 'POST' && !empty($_GET['formhash']) && $_GET['formhash'] == formhash() && empty($_SERVER['HTTP_X_FLASH_VERSION']) && (empty($_SERVER['HTTP_REFERER']) ||
strncmp($_SERVER['HTTP_REFERER'], 'http://wsq.discuz.com/', 22) === 0 || preg_replace("/https?:\/\/([^\:\/]+).*/i", "\\1", $_SERVER['HTTP_REFERER']) == preg_replace("/([^\:]+).*/", "\\1", $_SERVER['HTTP_HOST'])))) {
diff --git a/upload/source/function/function_core.php b/upload/source/function/function_core.php
index d7e0246f7..4326460a7 100644
--- a/upload/source/function/function_core.php
+++ b/upload/source/function/function_core.php
@@ -1420,7 +1420,6 @@ function showmessage($message, $url_forward = '', $values = array(), $extraparam
}
function submitcheck($var, $allowget = 0, $seccodecheck = 0, $secqaacheck = 0) {
- global $_G;
if(!getgpc($var)) {
return FALSE;
} else {
@@ -1428,7 +1427,6 @@ function submitcheck($var, $allowget = 0, $seccodecheck = 0, $secqaacheck = 0) {
}
}
-
function multi($num, $perpage, $curpage, $mpurl, $maxpages = 0, $page = 10, $autogoto = FALSE, $simple = FALSE, $jsfunc = FALSE) {
return $num > $perpage ? helper_page::multi($num, $perpage, $curpage, $mpurl, $maxpages, $page, $autogoto, $simple, $jsfunc) : '';
}
--
Gitee
From 931aa591c277f8f498bcaf9508e7ae2a6e8bea5c Mon Sep 17 00:00:00 2001
From: ZhaiSoul <842607283@qq.com>
Date: Sat, 28 Mar 2020 20:35:23 +0800
Subject: [PATCH 07/15] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E6=B7=BB=E5=8A=A0?=
=?UTF-8?q?=E5=A6=82=E6=9E=9C=E8=A2=AB=E9=94=81=E5=90=8E=E7=9A=84=E6=8F=90?=
=?UTF-8?q?=E7=A4=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
upload/source/class/helper/helper_form.php | 3 ++-
upload/source/language/lang_message.php | 1 +
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/upload/source/class/helper/helper_form.php b/upload/source/class/helper/helper_form.php
index 08058b0bf..1bbf55299 100644
--- a/upload/source/class/helper/helper_form.php
+++ b/upload/source/class/helper/helper_form.php
@@ -31,11 +31,12 @@ class helper_form {
showmessage('submit_seccode_invalid');
}
}
- self::submitcheck_unlock($var);
return TRUE;
} else {
showmessage('submit_invalid');
}
+ } else {
+ showmessage('submit_islocked');
}
}
}
diff --git a/upload/source/language/lang_message.php b/upload/source/language/lang_message.php
index ceceebbf2..85e4e5a7e 100644
--- a/upload/source/language/lang_message.php
+++ b/upload/source/language/lang_message.php
@@ -238,6 +238,7 @@ $lang = array (
'user_banned' => '抱歉,您的 IP 地址不在允许范围内,或您的账号被禁用,无法访问本站点',
'submit_seccode_invalid' => '抱歉,验证码填写错误',
'submit_invalid' => '抱歉,您的请求来路不正确或表单验证串不符,无法提交',
+ 'submit_islocked' => '抱歉,您当前的请求正在进行中,请勿重复提交',
'word_banned' => '抱歉,您填写的内容包含不良信息而无法提交',
'magics_use_success' => '道具 {magicname} 使用成功 ',
'magicuse_object_once_limit' => '抱歉,已对该对象使用过此道具,不能重复使用',
--
Gitee
From c23ceb557787fdda4eebaac856d303415f844e74 Mon Sep 17 00:00:00 2001
From: ZhaiSoul <842607283@qq.com>
Date: Sat, 28 Mar 2020 21:07:11 +0800
Subject: [PATCH 08/15] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E4=B8=BA=E5=B9=B6?=
=?UTF-8?q?=E5=8F=91=E9=94=81=E5=A2=9E=E5=8A=A0=E8=AE=BE=E7=BD=AE=E9=80=89?=
=?UTF-8?q?=E9=A1=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
upload/source/admincp/admincp_setting.php | 1 +
upload/source/class/helper/helper_form.php | 6 +++---
upload/source/language/lang_admincp.php | 2 ++
3 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/upload/source/admincp/admincp_setting.php b/upload/source/admincp/admincp_setting.php
index 0bee514a7..eeb27f789 100644
--- a/upload/source/admincp/admincp_setting.php
+++ b/upload/source/admincp/admincp_setting.php
@@ -1299,6 +1299,7 @@ EOF;
showsetting('setting_functions_other_pwdsafety', 'settingnew[pwdsafety]', $setting['pwdsafety'], 'radio');
showsetting('setting_functions_other_uidlogin', 'settingnew[uidlogin]', $setting['uidlogin'], 'radio');
showsetting('setting_functions_other_autoidselect', 'settingnew[autoidselect]', $setting['autoidselect'], 'radio');
+ showsetting('setting_functions_other_submitlock', 'settingnew[submitlock]', $setting['submitlock'], 'radio');
showsetting('setting_functions_other_rssstatus', 'settingnew[rssstatus]', $setting['rssstatus'], 'radio');
showsetting('setting_functions_other_rssttl', 'settingnew[rssttl]', $setting['rssttl'], 'text');
showsetting('setting_functions_other_oltimespan', 'settingnew[oltimespan]', $setting['oltimespan'], 'text');
diff --git a/upload/source/class/helper/helper_form.php b/upload/source/class/helper/helper_form.php
index 1bbf55299..959ee903c 100644
--- a/upload/source/class/helper/helper_form.php
+++ b/upload/source/class/helper/helper_form.php
@@ -20,7 +20,9 @@ class helper_form {
} else {
global $_G;
register_shutdown_function('helper_form::submitcheck_unlock', $var);
- if(!discuz_process::islocked($var.'_'.$_G['uid'].'_locked', 60)) {
+ if($_G['setting']['submitlock'] && discuz_process::islocked($var.'_'.$_G['uid'].'_locked', 60)) {
+ showmessage('submit_islocked');
+ } else {
if($allowget || ($_SERVER['REQUEST_METHOD'] == 'POST' && !empty($_GET['formhash']) && $_GET['formhash'] == formhash() && empty($_SERVER['HTTP_X_FLASH_VERSION']) && (empty($_SERVER['HTTP_REFERER']) ||
strncmp($_SERVER['HTTP_REFERER'], 'http://wsq.discuz.com/', 22) === 0 || preg_replace("/https?:\/\/([^\:\/]+).*/i", "\\1", $_SERVER['HTTP_REFERER']) == preg_replace("/([^\:]+).*/", "\\1", $_SERVER['HTTP_HOST'])))) {
if(checkperm('seccode')) {
@@ -35,8 +37,6 @@ class helper_form {
} else {
showmessage('submit_invalid');
}
- } else {
- showmessage('submit_islocked');
}
}
}
diff --git a/upload/source/language/lang_admincp.php b/upload/source/language/lang_admincp.php
index c0d502e80..2c261098e 100644
--- a/upload/source/language/lang_admincp.php
+++ b/upload/source/language/lang_admincp.php
@@ -1810,6 +1810,8 @@ $lang = array
'setting_functions_other_uidlogin_comment' => '选择“是”,站点登录时允许通过 UID的方式登录验证',
'setting_functions_other_autoidselect' => '启用登录自动选择帐号',
'setting_functions_other_autoidselect_comment' => '选择“是”,站点登录时的将自动按 UID、E-mail、用户名的顺序逐一去匹配,其中UID验证只有UID登录方式被启用后才有效',
+ 'setting_functions_other_submitlock' => '启用表单防并发功能',
+ 'setting_functions_other_submitlock_comment' => '选择“是”,将会防止用户同一时间提交多次表单,可有效防止可能刷分的问题。注意: 在未使用内存缓存(Redis、Memcached)的情况下,本功能可能会加重服务器负担',
'setting_functions_other_rssstatus' => '启用 RSS',
'setting_functions_other_rssstatus_comment' => '选择“是”,将允许用户使用 RSS 客户端软件接收最新的帖子、文章更新。注意: 在分类很多的情况下,本功能可能会加重服务器负担',
'setting_functions_other_rssttl' => 'RSS TTL(分钟)',
--
Gitee
From e8cac8d9e08840ffe5b90205a013a9d3af2efcee Mon Sep 17 00:00:00 2001
From: ZhaiSoul <842607283@qq.com>
Date: Sun, 29 Mar 2020 11:06:36 +0800
Subject: [PATCH 09/15] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20=E4=BD=BF=E7=94=A8?=
=?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E4=BD=9C=E4=B8=BA=E5=B9=B6=E5=8F=91?=
=?UTF-8?q?=E9=94=81=E7=9A=84=E6=97=B6=E5=80=99=E6=97=A0=E6=B3=95=E6=8F=92?=
=?UTF-8?q?=E5=85=A5=E7=9A=84=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
upload/source/class/discuz/discuz_process.php | 1 +
1 file changed, 1 insertion(+)
diff --git a/upload/source/class/discuz/discuz_process.php b/upload/source/class/discuz/discuz_process.php
index e586318cf..7021d6ae1 100644
--- a/upload/source/class/discuz/discuz_process.php
+++ b/upload/source/class/discuz/discuz_process.php
@@ -86,6 +86,7 @@ class discuz_process
case 'get':
$ret = C::t('common_process')->fetch($name);
if(empty($ret) || $ret['expiry'] < time()) {
+ C::t('common_process')->delete_process($name, time());
$ret = false;
} else {
$ret = true;
--
Gitee
From 84adab6dcfa45c0e1f7d9b20ff877ed4059e2dfb Mon Sep 17 00:00:00 2001
From: ZhaiSoul <842607283@qq.com>
Date: Sat, 11 Apr 2020 15:22:51 +0800
Subject: [PATCH 10/15] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E8=B0=83=E6=95=B4?=
=?UTF-8?q?=E9=94=81=E9=80=BB=E8=BE=91=EF=BC=8C=E5=A2=9E=E5=8A=A0=E8=87=AA?=
=?UTF-8?q?=E5=8A=A8=E8=A7=A3=E9=94=81=E5=8F=82=E6=95=B0=EF=BC=8C=E4=B8=BA?=
=?UTF-8?q?=E8=AF=84=E5=88=86=E3=80=81=E4=BB=BB=E5=8A=A1=E3=80=81=E7=A7=AF?=
=?UTF-8?q?=E5=88=86=E5=85=91=E6=8D=A2=E7=AD=89=E5=9C=B0=E6=96=B9=E5=A2=9E?=
=?UTF-8?q?=E5=8A=A0=E9=94=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
upload/source/class/class_task.php | 3 ++
upload/source/class/discuz/discuz_process.php | 12 +++++--
upload/source/class/helper/helper_form.php | 34 +++++++------------
.../include/spacecp/spacecp_credit_base.php | 3 ++
upload/source/language/home/lang_template.php | 1 +
upload/source/language/lang_message.php | 3 ++
upload/source/module/forum/forum_misc.php | 3 ++
upload/source/module/home/home_magic.php | 11 +++++-
8 files changed, 44 insertions(+), 26 deletions(-)
diff --git a/upload/source/class/class_task.php b/upload/source/class/class_task.php
index d25b59aa9..28b253325 100644
--- a/upload/source/class/class_task.php
+++ b/upload/source/class/class_task.php
@@ -394,6 +394,9 @@ class task {
}
if($result === TRUE) {
+ if($_G['setting']['submitlock'] && discuz_process::islocked('task_'.$_G['uid'].'_'.$id, 0, 1)) {
+ showmessage('task_locked', 'home.php?mod=task&do=view&id='.$id);
+ }
if($this->task['reward']) {
$rewards = $this->reward();
diff --git a/upload/source/class/discuz/discuz_process.php b/upload/source/class/discuz/discuz_process.php
index 7021d6ae1..17a10c758 100644
--- a/upload/source/class/discuz/discuz_process.php
+++ b/upload/source/class/discuz/discuz_process.php
@@ -13,11 +13,17 @@ if(!defined('IN_DISCUZ')) {
class discuz_process
{
- public static function islocked($process, $ttl = 0) {
+ public static function islocked($process, $ttl = 0, $autounlock = 0) {
$ttl = $ttl < 1 ? 600 : intval($ttl);
- return discuz_process::_status('get', $process) || discuz_process::_find($process, $ttl);
- }
+ $status = discuz_process::_status('get', $process) || discuz_process::_find($process, $ttl);
+
+ if($autounlock && !$status) {
+ register_shutdown_function('discuz_process::unlock', $process);
+ }
+ return $status;
+ }
+
public static function unlock($process) {
discuz_process::_status('rm', $process);
discuz_process::_cmd('rm', $process);
diff --git a/upload/source/class/helper/helper_form.php b/upload/source/class/helper/helper_form.php
index 959ee903c..0f7814e9c 100644
--- a/upload/source/class/helper/helper_form.php
+++ b/upload/source/class/helper/helper_form.php
@@ -18,34 +18,24 @@ class helper_form {
if(!getgpc($var)) {
return FALSE;
} else {
- global $_G;
- register_shutdown_function('helper_form::submitcheck_unlock', $var);
- if($_G['setting']['submitlock'] && discuz_process::islocked($var.'_'.$_G['uid'].'_locked', 60)) {
- showmessage('submit_islocked');
- } else {
- if($allowget || ($_SERVER['REQUEST_METHOD'] == 'POST' && !empty($_GET['formhash']) && $_GET['formhash'] == formhash() && empty($_SERVER['HTTP_X_FLASH_VERSION']) && (empty($_SERVER['HTTP_REFERER']) ||
- strncmp($_SERVER['HTTP_REFERER'], 'http://wsq.discuz.com/', 22) === 0 || preg_replace("/https?:\/\/([^\:\/]+).*/i", "\\1", $_SERVER['HTTP_REFERER']) == preg_replace("/([^\:]+).*/", "\\1", $_SERVER['HTTP_HOST'])))) {
- if(checkperm('seccode')) {
- if($secqaacheck && !check_secqaa($_GET['secanswer'], $_GET['secqaahash'])) {
- showmessage('submit_secqaa_invalid');
- }
- if($seccodecheck && !check_seccode($_GET['seccodeverify'], $_GET['seccodehash'], 0, $_GET['seccodemodid'])) {
- showmessage('submit_seccode_invalid');
- }
+ if($allowget || ($_SERVER['REQUEST_METHOD'] == 'POST' && !empty($_GET['formhash']) && $_GET['formhash'] == formhash() && empty($_SERVER['HTTP_X_FLASH_VERSION']) && (empty($_SERVER['HTTP_REFERER']) ||
+ strncmp($_SERVER['HTTP_REFERER'], 'http://wsq.discuz.com/', 22) === 0 || preg_replace("/https?:\/\/([^\:\/]+).*/i", "\\1", $_SERVER['HTTP_REFERER']) == preg_replace("/([^\:]+).*/", "\\1", $_SERVER['HTTP_HOST'])))) {
+ if(checkperm('seccode')) {
+ if($secqaacheck && !check_secqaa($_GET['secanswer'], $_GET['secqaahash'])) {
+ showmessage('submit_secqaa_invalid');
+ }
+ if($seccodecheck && !check_seccode($_GET['seccodeverify'], $_GET['seccodehash'], 0, $_GET['seccodemodid'])) {
+ showmessage('submit_seccode_invalid');
}
- return TRUE;
- } else {
- showmessage('submit_invalid');
}
+ return TRUE;
+ } else {
+ showmessage('submit_invalid');
}
+
}
}
- private static function submitcheck_unlock($var) {
- global $_G;
- discuz_process::unlock($var.'_'.$_G['uid'].'_locked');
- }
-
public static function censor($message, $modword = NULL, $return = FALSE) {
global $_G;
$censor = discuz_censor::instance();
diff --git a/upload/source/include/spacecp/spacecp_credit_base.php b/upload/source/include/spacecp/spacecp_credit_base.php
index 7f897e51c..fbaaf4036 100644
--- a/upload/source/include/spacecp/spacecp_credit_base.php
+++ b/upload/source/include/spacecp/spacecp_credit_base.php
@@ -211,6 +211,9 @@ if($_GET['op'] == 'base') {
}
if(submitcheck('exchangesubmit')) {
+ if($_G['setting']['submitlock'] && discuz_process::islocked('exchangelock_'.$_G['uid'], 0, 1)){
+ showmessage('memcp_credits_exchange_msg_locked', '', array(), array('showdialog' => 1, 'showmsg' => true, 'closetime' => true));
+ }
$tocredits = $_GET['tocredits'];
$fromcredits = $_GET['fromcredits'];
diff --git a/upload/source/language/home/lang_template.php b/upload/source/language/home/lang_template.php
index d4675020e..f45873c8e 100644
--- a/upload/source/language/home/lang_template.php
+++ b/upload/source/language/home/lang_template.php
@@ -560,6 +560,7 @@ $lang = array (
'magics_outofperoid_4' => '24 小时内',
'magics_outofperoid_noperm' => '您无法再使用本道具了',
'magics_outofperoid_value' => '您还能使用 $useperoid 次本道具',
+ 'magics_locked' => '当前道具正在使用/卖出/赠送中,请稍后再试。',
'magics_present_message' => '赠送留言',
'magics_present_message_text' => '送您一个{$magic[name]},{$magic[description]},希望您能喜欢 ',
'magics_select' => '选择道具',
diff --git a/upload/source/language/lang_message.php b/upload/source/language/lang_message.php
index 85e4e5a7e..d56082474 100644
--- a/upload/source/language/lang_message.php
+++ b/upload/source/language/lang_message.php
@@ -336,6 +336,7 @@ $lang = array (
'thread_rate_duplicate' => '抱歉,您不能对同一个帖子重复评分',
'thread_rate_range_self_invalid' => '抱歉,您的{extcreditstitle}不足,无法评分',
'thread_rate_ctrl' => '抱歉,24 小时评分数超过限制',
+ 'thread_rate_locked' => '抱歉,当前评分正在进行中,请稍后再试',
'thread_rate_succeed' => '感谢您的参与,现在将转入评分前页面',
'no_privilege_removerate' => '抱歉,您没有权限撤销评分',
'thread_rate_removesucceed' => '评分撤销成功 ',
@@ -450,6 +451,7 @@ $lang = array (
'task_failed' => '抱歉,您没能在指定时间内完成任务',
'task_completed' => '恭喜您,任务已成功完成,您将收到奖励通知,请注意查收',
'task_giveup' => '您已放弃此任务',
+ 'task_locked' => '抱歉,当前任务正在领取奖励中,请稍后再试。',
'activate_succeed' => '您好,{username},您的帐号已被成功激活,现在将转入站点首页',
@@ -718,6 +720,7 @@ $lang = array (
'memcp_credits_card_msg_succeed' => '{extcreditsval}{extcreditstitle},充值成功 ',
'memcp_credits_addfunds_msg_incorrect' => '抱歉,您尚未输入需要充值的数量',
'memcp_credits_addfunds_msg_notype' => '抱歉,您尚未选择支付方式',
+ 'memcp_credits_exchange_msg_locked' => '抱歉,正在进行其他的积分兑换操作,兑换失败,请稍后再试',
'credits_addfunds_amount_invalid' => '您单次购买的积分数量超出最大值 {ec_maxcredits} 或最小值 {ec_mincredits} 的限制',
'memcp_credits_transfer_msg_self_incorrect' => '您无需给自己转账',
'credits_transfer_balance_insufficient' => '抱歉,转账后 {title}不足 {minbalance}',
diff --git a/upload/source/module/forum/forum_misc.php b/upload/source/module/forum/forum_misc.php
index bc3f1dc76..6240564f7 100644
--- a/upload/source/module/forum/forum_misc.php
+++ b/upload/source/module/forum/forum_misc.php
@@ -676,6 +676,9 @@ if($_GET['action'] == 'votepoll' && submitcheck('pollsubmit', 1)) {
include template('forum/rate');
} else {
+ if($_G['setting']['submitlock'] && discuz_process::islocked('ratelock_'.$_G['uid'].'_'.$_GET['pid'], 0, 1)){
+ showmessage('thread_rate_locked');
+ }
$reason = checkreasonpm();
$rate = $ratetimes = 0;
diff --git a/upload/source/module/home/home_magic.php b/upload/source/module/home/home_magic.php
index 4259bde57..abc97fd12 100644
--- a/upload/source/module/home/home_magic.php
+++ b/upload/source/module/home/home_magic.php
@@ -341,6 +341,9 @@ if($action == 'shop') {
$useperoid = magic_peroid($magic, $_G['uid']);
if(submitcheck('usesubmit')) {
+ if(discuz_process::islocked('magiclock_'.$_G['uid'].'_'.$magicid, 0, 1)) {
+ showmessage('magics_locked');
+ }
if($useperoid !== true && $useperoid <= 0) {
showmessage('magics_outofperoid_'.$magic['useperoid'], '', array('usenum' => $magic['usenum']));
}
@@ -360,6 +363,10 @@ if($action == 'shop') {
include template('home/space_magic_mybox_opreation');
dexit();
} else {
+ if(discuz_process::islocked('magiclock_'.$_G['uid'].'_'.$magicid, 0, 1)) {
+ showmessage('magics_locked');
+ }
+
$magicnum = intval($_GET['magicnum']);
if(!$magicnum || $magicnum < 0) {
@@ -407,7 +414,9 @@ if($action == 'shop') {
dexit();
} else {
-
+ if($_G['setting']['submitlock'] && discuz_process::islocked('magiclock_'.$_G['uid'].'_'.$magicid, 0, 1)) {
+ showmessage('magics_locked');
+ }
$magicnum = intval($_GET['magicnum']);
$toname = dhtmlspecialchars(trim($_GET['tousername']));
if(!$toname) {
--
Gitee
From d2d30747392be57042ac7121994b07c21cf6b4da Mon Sep 17 00:00:00 2001
From: ZhaiSoul <842607283@qq.com>
Date: Tue, 14 Apr 2020 19:11:49 +0800
Subject: [PATCH 11/15] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E5=A2=9E=E5=8A=A0?=
=?UTF-8?q?=E8=BD=AC=E8=B4=A6=E7=9A=84=E9=94=81=EF=BC=8C=E5=8E=BB=E6=8E=89?=
=?UTF-8?q?=E4=BB=BB=E5=8A=A1=E7=9A=84=E9=94=81=E4=B8=8E=E4=BF=AE=E6=94=B9?=
=?UTF-8?q?=E8=AF=AD=E8=A8=80=E6=96=87=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
upload/source/class/class_task.php | 5 +----
upload/source/class/table/table_common_process.php | 9 ---------
upload/source/include/spacecp/spacecp_credit_base.php | 3 +++
upload/source/language/home/lang_template.php | 1 -
upload/source/language/lang_message.php | 3 ++-
5 files changed, 6 insertions(+), 15 deletions(-)
diff --git a/upload/source/class/class_task.php b/upload/source/class/class_task.php
index 28b253325..35cef9399 100644
--- a/upload/source/class/class_task.php
+++ b/upload/source/class/class_task.php
@@ -394,10 +394,7 @@ class task {
}
if($result === TRUE) {
- if($_G['setting']['submitlock'] && discuz_process::islocked('task_'.$_G['uid'].'_'.$id, 0, 1)) {
- showmessage('task_locked', 'home.php?mod=task&do=view&id='.$id);
- }
-
+
if($this->task['reward']) {
$rewards = $this->reward();
$notification = $this->task['reward'];
diff --git a/upload/source/class/table/table_common_process.php b/upload/source/class/table/table_common_process.php
index 7daad33fc..4975a8735 100644
--- a/upload/source/class/table/table_common_process.php
+++ b/upload/source/class/table/table_common_process.php
@@ -25,15 +25,6 @@ class table_common_process extends discuz_table
$name = addslashes($name);
return DB::delete('common_process', "processid='$name' OR expiry<".intval($time));
}
-
- public function insert($name, $expiry) {
- try{
- DB::query('INSERT '.DB::table($this->_table)." (`processid`, `expiry`) VALUES ('$name', '$expiry') ");
- return true;
- }catch(Exception $exc){
- return false;
- }
- }
}
?>
\ No newline at end of file
diff --git a/upload/source/include/spacecp/spacecp_credit_base.php b/upload/source/include/spacecp/spacecp_credit_base.php
index fbaaf4036..240ef4b18 100644
--- a/upload/source/include/spacecp/spacecp_credit_base.php
+++ b/upload/source/include/spacecp/spacecp_credit_base.php
@@ -160,6 +160,9 @@ if($_GET['op'] == 'base') {
}
} elseif ($_GET['op'] == 'transfer') {
+ if($_G['setting']['submitlock'] && discuz_process::islocked('transferlock_'.$_G['uid'], 0, 1)){
+ showmessage('credits_transfer_msg_locked', '', array(), array('showdialog' => 1, 'showmsg' => true, 'closetime' => true));
+ }
if(!($_G['setting']['transferstatus'] && $_G['group']['allowtransfer'])) {
showmessage('action_closed', NULL);
diff --git a/upload/source/language/home/lang_template.php b/upload/source/language/home/lang_template.php
index f45873c8e..d4675020e 100644
--- a/upload/source/language/home/lang_template.php
+++ b/upload/source/language/home/lang_template.php
@@ -560,7 +560,6 @@ $lang = array (
'magics_outofperoid_4' => '24 小时内',
'magics_outofperoid_noperm' => '您无法再使用本道具了',
'magics_outofperoid_value' => '您还能使用 $useperoid 次本道具',
- 'magics_locked' => '当前道具正在使用/卖出/赠送中,请稍后再试。',
'magics_present_message' => '赠送留言',
'magics_present_message_text' => '送您一个{$magic[name]},{$magic[description]},希望您能喜欢 ',
'magics_select' => '选择道具',
diff --git a/upload/source/language/lang_message.php b/upload/source/language/lang_message.php
index d56082474..7dbfdb2ad 100644
--- a/upload/source/language/lang_message.php
+++ b/upload/source/language/lang_message.php
@@ -161,6 +161,7 @@ $lang = array (
'credits_addfunds_toomuch' => '抱歉,您超出本月允许购买 {ec_maxcreditspermonth} 的限额',
'credits_transaction_amount_invalid' => '抱歉,您要转账或兑换的积分数量输入有误',
'credits_password_invalid' => '抱歉,您输入的密码错误',
+ 'credits_transfer_msg_locked' => '抱歉,正在进行其他的积分转账操作,转账失败,请稍后再试',
'extcredits_dataerror' => '抱歉,兑换失败,请与管理员联系',
'start_time_is_greater_than_end_time' => '开始日期不能大于结束日期',
'should_write_that' => '至少应该写点东西',
@@ -451,7 +452,6 @@ $lang = array (
'task_failed' => '抱歉,您没能在指定时间内完成任务',
'task_completed' => '恭喜您,任务已成功完成,您将收到奖励通知,请注意查收',
'task_giveup' => '您已放弃此任务',
- 'task_locked' => '抱歉,当前任务正在领取奖励中,请稍后再试。',
'activate_succeed' => '您好,{username},您的帐号已被成功激活,现在将转入站点首页',
@@ -982,6 +982,7 @@ $lang = array (
'magic_is_closed' => '此道具已被禁用',
'magic_not_for_sale' => '此道具不能通过购买获得',
'magic_groupid_limit' => '抱歉,您当前所在的用户组没有权限购买本道具',
+ 'magics_locked' => '当前道具正在使用/卖出/赠送中,请稍后再试。',
'bad_buynum' => '抱歉,您输入的购买数目有误',
'not_enough_coupon' => '抱歉,您的代金券数目不足',
'credit_is_not_enough' => '抱歉,您的积分不足购买此道具',
--
Gitee
From 394c1d80bbfe30deb12117e244e34604cae17678 Mon Sep 17 00:00:00 2001
From: ZhaiSoul <842607283@qq.com>
Date: Tue, 14 Apr 2020 21:33:46 +0800
Subject: [PATCH 12/15] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20process=E7=B1=BB?=
=?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E6=96=B9=E6=B3=95=E7=9A=84=E4=BF=AE?=
=?UTF-8?q?=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
upload/source/class/discuz/discuz_process.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/upload/source/class/discuz/discuz_process.php b/upload/source/class/discuz/discuz_process.php
index 17a10c758..869613fee 100644
--- a/upload/source/class/discuz/discuz_process.php
+++ b/upload/source/class/discuz/discuz_process.php
@@ -87,7 +87,7 @@ class discuz_process
$ret = '';
switch ($cmd) {
case 'add':
- $ret = C::t('common_process')->insert($name, (time() + $ttl));
+ $ret = C::t('common_process')->insert(array('processid' => $name, 'expiry' => time() + $ttl), FALSE, true);
break;
case 'get':
$ret = C::t('common_process')->fetch($name);
--
Gitee
From c904611e3b0a600410771f0ef36aea9679e07a6e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=AE=85=E9=AD=82Kill?= <842607283@qq.com>
Date: Tue, 14 Apr 2020 22:16:34 +0800
Subject: [PATCH 13/15] update upload/source/class/class_task.php.
---
upload/source/class/class_task.php | 1 -
1 file changed, 1 deletion(-)
diff --git a/upload/source/class/class_task.php b/upload/source/class/class_task.php
index 35cef9399..881d69f17 100644
--- a/upload/source/class/class_task.php
+++ b/upload/source/class/class_task.php
@@ -394,7 +394,6 @@ class task {
}
if($result === TRUE) {
-
if($this->task['reward']) {
$rewards = $this->reward();
$notification = $this->task['reward'];
--
Gitee
From eb0e81bb881a5856ac5e724cddd2fb33f16cea92 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=AE=85=E9=AD=82Kill?= <842607283@qq.com>
Date: Tue, 14 Apr 2020 22:58:52 +0800
Subject: [PATCH 14/15] update upload/source/class/helper/helper_form.php.
---
upload/source/class/helper/helper_form.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/upload/source/class/helper/helper_form.php b/upload/source/class/helper/helper_form.php
index 0f7814e9c..4b03de8df 100644
--- a/upload/source/class/helper/helper_form.php
+++ b/upload/source/class/helper/helper_form.php
@@ -18,6 +18,7 @@ class helper_form {
if(!getgpc($var)) {
return FALSE;
} else {
+ global $_G;
if($allowget || ($_SERVER['REQUEST_METHOD'] == 'POST' && !empty($_GET['formhash']) && $_GET['formhash'] == formhash() && empty($_SERVER['HTTP_X_FLASH_VERSION']) && (empty($_SERVER['HTTP_REFERER']) ||
strncmp($_SERVER['HTTP_REFERER'], 'http://wsq.discuz.com/', 22) === 0 || preg_replace("/https?:\/\/([^\:\/]+).*/i", "\\1", $_SERVER['HTTP_REFERER']) == preg_replace("/([^\:]+).*/", "\\1", $_SERVER['HTTP_HOST'])))) {
if(checkperm('seccode')) {
@@ -32,7 +33,6 @@ class helper_form {
} else {
showmessage('submit_invalid');
}
-
}
}
--
Gitee
From 64056b6fbd0a1e5d7778c55445f9074fec1a9a7a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=AE=85=E9=AD=82Kill?= <842607283@qq.com>
Date: Tue, 14 Apr 2020 23:04:03 +0800
Subject: [PATCH 15/15] update upload/source/class/class_task.php.
---
upload/source/class/class_task.php | 1 +
1 file changed, 1 insertion(+)
diff --git a/upload/source/class/class_task.php b/upload/source/class/class_task.php
index 881d69f17..d25b59aa9 100644
--- a/upload/source/class/class_task.php
+++ b/upload/source/class/class_task.php
@@ -394,6 +394,7 @@ class task {
}
if($result === TRUE) {
+
if($this->task['reward']) {
$rewards = $this->reward();
$notification = $this->task['reward'];
--
Gitee