1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-19 21:02:09 +02:00

Set profanity list limit to 1000. (Could reduce performance)

Fix for comment template. Prevent secureImage from buffering too many keys.
This commit is contained in:
Cameron
2021-02-14 07:02:09 -08:00
parent e6bdc0e6ec
commit aee77a102f
5 changed files with 74 additions and 8 deletions

View File

@@ -67,7 +67,30 @@ class secure_image
$this->secret = e107::getUserSession()->generateRandomString('*****');
e107::getSession('secureImage')->set($this->random_number, $this->secret);
$secImg = e107::getSession('secureImage');
$list = $secImg->get('secret');
$maxCache = 6;
if(!empty($list) && count($list) > $maxCache)
{
$total = count($list) - $maxCache;
$c = 1;
foreach($list as $key=>$v)
{
if($c > $total)
{
continue;
}
$secImg->clear('secret/'.$key);
$c++;
}
}
$secImg->set('secret/'.$this->random_number, $this->secret);
return $this->random_number;
}
@@ -96,7 +119,8 @@ class secure_image
return call_user_func($user_func,$recnum,$checkstr);
}
$secret = e107::getSession('secureImage')->get($recnum);
$tmp = e107::getSession('secureImage')->get('secret');
$secret = varset($tmp[$recnum]);
if(!empty($secret) && ($secret === $checkstr))
{
@@ -269,10 +293,10 @@ class secure_image
// $code = intval($row['tmp_info']); // new value
if($tmp = e107::getSession('secureImage')->get($recnum))
$tmp = e107::getSession('secureImage')->get('secret');
if(isset($tmp[$recnum]))
{
$code = $tmp;
$code = $tmp[$recnum];
}
else
{