Skip to content

Commit

Permalink
fixes for js_keys
Browse files Browse the repository at this point in the history
  • Loading branch information
davydovct committed Jul 6, 2018
1 parent ea0dc46 commit 2fce382
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Anti-spam plugin for Joomla 2.5-3.X.
============
Version 5.6
Version 5.6.1

## Simple antispam test

Expand Down
12 changes: 6 additions & 6 deletions antispambycleantalk.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* CleanTalk joomla plugin
*
* @version 5.5
* @version 5.6.1
* @package Cleantalk
* @subpackage Joomla
* @author CleanTalk (welcome@cleantalk.org)
Expand All @@ -25,7 +25,7 @@ class plgSystemAntispambycleantalk extends JPlugin {
/**
* Plugin version string for server
*/
const ENGINE = 'joomla3-56';
const ENGINE = 'joomla3-561';

/**
* Default value for hidden field ct_checkjs
Expand Down Expand Up @@ -107,14 +107,14 @@ private function cleantalk_get_checkjs_code()
$key = strval(md5($config['apikey'] . time()));
$latest_key_time = 0;
if (empty($keys))
$keys = array( $key => time());
$keys = array(time() => $key);
else
{
$keys = json_decode($keys,true);
foreach ($keys as $k => $t) {
foreach ($keys as $t => $k) {
// Removing key if it's to old
if (time() - $t > $config['js_keys_store_days'] * 86400) {
unset($keys[$k]);
unset($keys[$t]);
continue;
}
if ($t > $latest_key_time) {
Expand All @@ -124,7 +124,7 @@ private function cleantalk_get_checkjs_code()
}
// Get new key if the latest key is too old
if (time() - $latest_key_time > $config['js_key_lifetime']) {
$keys[$key] = time();
$keys[time()] = $key;
}
}
$id=$this->getId();
Expand Down
2 changes: 1 addition & 1 deletion antispambycleantalk.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<license>GNU/GPLv2</license>
<authorEmail>welcome@cleantalk.org</authorEmail>
<authorUrl>cleantalk.org</authorUrl>
<version>5.6</version>
<version>5.6.1</version>
<description>PLG_CLEANTALK_DESCRIPTION</description>
<files>
<filename plugin="antispambycleantalk">antispambycleantalk.php</filename>
Expand Down
22 changes: 21 additions & 1 deletion plugin-updates.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<updates>
<updates>
<update>
<name>Antispam by CleanTalk</name>
<description>Antispam plugin for Joomla registrations and contacts, for VurtueMart, Rapid Contact, VTEM Contact, JComments 2.3, 3.0.</description>
<element>antispambycleantalk</element>
<type>plugin</type>
<folder>system</folder>
<client_id>0</client_id>
<client>0</client>
<version>5.6.1</version>
<infourl title="Antispam by CleanTalk">https://cleantalk.org/joomla-anti-spam-plugin-without-captcha</infourl>
<downloads>
<downloadurl type="full" format="zip">https://github.com/CleanTalk/joomla25-3x-antispam/archive/5.6.1.zip</downloadurl>
</downloads>
<tags>
<tag>stable</tag>
</tags>
<maintainer>CleanTalk</maintainer>
<maintainerurl>https://cleantalk.org</maintainerurl>
<targetplatform name="joomla" version="[23].*"/>
</update>
<update>
<name>Antispam by CleanTalk</name>
<description>Antispam plugin for Joomla registrations and contacts, for VurtueMart, Rapid Contact, VTEM Contact, JComments 2.3, 3.0.</description>
Expand Down

0 comments on commit 2fce382

Please sign in to comment.