Skip to content

Commit

Permalink
1.2.0 update
Browse files Browse the repository at this point in the history
WBB 4.1, WCF 2.1 compatibility
  • Loading branch information
Oliver Schlöbe committed Apr 26, 2015
1 parent b972bcf commit c3366d2
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 14 deletions.
Binary file modified files.tar
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
namespace wbb\system\event\listener;
use wcf\system\event\IEventListener;
use wcf\system\event\listener\IParameterizedEventListener;
use wcf\util;
use wcf\system\WCF;
use wcf\system\Regex;
Expand All @@ -15,7 +15,7 @@
* @subpackage system.event.listener
* @category Community Framework
*/
class ThreadAddFormAntiURLSpamListener implements IEventListener {
class ThreadAddFormAntiURLSpamListener implements IParameterizedEventListener {
private $illegalChars = '[^\x0-\x2C\x2E\x2F\x3A-\x40\x5B-\x60\x7B-\x7F]+';
private $sourceCodeRegEx = null;

Expand Down Expand Up @@ -55,16 +55,16 @@ class ThreadAddFormAntiURLSpamListener implements IEventListener {


/**
* @see \wcf\system\event\IEventListener::execute()
* @see \wcf\system\event\listener\IParameterizedEventListener::execute()
*/
public function execute($obj, $className, $eventName) {
$actionName = $obj->getActionName();
$parameters = $obj->getParameters();
public function execute($eventObj, $className, $eventName, array &$parameters) {
$actionName = $eventObj->getActionName();
$parameters = $eventObj->getParameters();

switch ($actionName) {
case 'triggerPublication':
case 'update':
$objects = $obj->getObjects();
$objects = $eventObj->getObjects();
if (empty($objects[0])) {
return;
}
Expand All @@ -88,7 +88,7 @@ public function execute($obj, $className, $eventName) {

if (($this->urlCount > POST_LINKRESTRICTION_MAX_URLS)
|| (POST_LINKRESTRICTION_ENABLE_IMAGE_RESTRICTION && $this->imgCount > POST_LINKRESTRICTION_MAX_IMAGES)) {
$obj->disable();
$eventObj->disable();
}
break;
}
Expand Down Expand Up @@ -131,9 +131,13 @@ public function parse($text) {
foreach ($matches as $match) {
$match1 = trim($match[1], '"=\'');
$match2 = trim($match[2], '"=\'');

if (!\wcf\system\application\ApplicationHandler::getInstance()->isInternalURL($match1) &&
!$this->isInternalURLCustom($match1) &&
!\wcf\system\application\ApplicationHandler::getInstance()->isInternalURL($match2) &&
!$this->isInternalURLCustom($match1)) {
$count++;
}

if (!\wcf\system\application\ApplicationHandler::getInstance()->isInternalURL($match2) &&
!$this->isInternalURLCustom($match2)) {
$count++;
}
Expand Down Expand Up @@ -174,6 +178,7 @@ private function isInternalURLCustom($url) {
private function getCustomURLS() {
$customURLs = explode(',', POST_LINKRESTRICTION_CUSTOM_URLS);
$customURLs = array_map(array($this, 'addHttpToCustomURLs'), $customURLs);

return $customURLs;
}

Expand Down
8 changes: 4 additions & 4 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<packagedescription>Disables user posts if they have a too low post counter and the post contains external URIs.</packagedescription>
<packagedescription language="de"><![CDATA[Deaktiviert Beiträge von Benutzern mit zu wenig Beiträgen, falls der Beitrag externe URLs enthält.]]></packagedescription>
<packagedescription language="de-informal"><![CDATA[Deaktiviert Beiträge von Benutzern mit zu wenig Beiträgen, falls der externe Beitrag URLs enthält.]]></packagedescription>
<version>1.1.4</version>
<date>2015-01-23</date>
<version>1.2.0</version>
<date>2015-04-26</date>
<license>LGPL</license>
</packageinformation>

Expand All @@ -18,8 +18,8 @@
</authorinformation>

<requiredpackages>
<requiredpackage minversion="2.0.0">com.woltlab.wcf</requiredpackage>
<requiredpackage minversion="4.0.0">com.woltlab.wbb</requiredpackage>
<requiredpackage minversion="2.1.0">com.woltlab.wcf</requiredpackage>
<requiredpackage minversion="4.1.0">com.woltlab.wbb</requiredpackage>
</requiredpackages>

<instructions type="install">
Expand Down

0 comments on commit c3366d2

Please sign in to comment.