XF 2.2 Spam regex not working

dieg0

Active member
Hi guys,

I'm getting a bunch of spam posts by new users. Some of these messages include links so I decided to give the spam regex admin.php?options/groups/spam/ a try so that users with less than X posts can't use links. With no success. At all.

The last thing I've tried is @Mike 's regex

Code:
^(?>(?i)(?!www|http|\.com|\.net|\.org|\.biz|\.ru).)*$

The URL I'm using for my test is

Code:
https://stackoverflow.com/questions/3809401/what-is-a-good-regular-expression-to-match-a-url

I've created a new user with 0 posts and I can post that stackoverflow link. Why is that?

Some of my previous tries were

Code:
https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,4}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)

Code:
(http(s)?:\/\/.)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)

I'm currently running v2.2.7 Patch 1

This is the error log from the admin panel

Code:
#0 src/XF.php(213): XF\Error->logError('Push notificati...', false)
#1 src/XF/Service/PushNotification.php(243): XF::logError('Push notificati...')
#2 src/XF/Service/PushNotification.php(176): XF\Service\PushNotification->handleResults(Object(Generator))
#3 src/XF/Service/PusherTrait.php(194): XF\Service\PushNotification->sendNotifications()
#4 src/XF/Repository/UserAlert.php(165): XF\Service\Alert\Pusher->push()
#5 src/XF/Repository/UserAlert.php(116): XF\Repository\UserAlert->insertAlert(811175, 1728370, 'xxxx', 'post', 4659190, 'insert', Array, Array)
#6 src/XF/Notifier/AbstractNotifier.php(70): XF\Repository\UserAlert->alert(Object(XF\Entity\User), 1728370, 'xxxx', 'post', 4659190, 'insert', Array, Array)
#7 src/XF/Notifier/Post/AbstractWatch.php(112): XF\Notifier\AbstractNotifier->basicAlert(Object(XF\Entity\User), 1728370, 'xxxx', 'post', 4659190, 'insert')
#8 src/XF/Service/AbstractNotifier.php(88): XF\Notifier\Post\AbstractWatch->sendAlert(Object(XF\Entity\User))
#9 src/XF/Service/AbstractNotifier.php(46): XF\Service\AbstractNotifier->notifyType(Object(XF\Notifier\Post\ThreadWatch), Array, 1.6362E+9)
#10 src/XF/Service/AbstractNotifier.php(58): XF\Service\AbstractNotifier->notify(3)
#11 src/XF/Service/Thread/Replier.php(247): XF\Service\AbstractNotifier->notifyAndEnqueue(3)
#12 src/XF/Pub/Controller/Thread.php(452): XF\Service\Thread\Replier->sendNotifications()
#13 src/addons/EMD/FT/XF/Pub/Controller/Thread.php(23): XF\Pub\Controller\Thread->finalizeThreadReply(Object(XF\Service\Thread\Replier))
#14 src/XF/Pub/Controller/Thread.php(609): EMD\FT\XF\Pub\Controller\Thread->finalizeThreadReply(Object(XF\Service\Thread\Replier))
#15 src/XF/Mvc/Dispatcher.php(352): XF\Pub\Controller\Thread->actionAddReply(Object(XF\Mvc\ParameterBag))
#16 src/XF/Mvc/Dispatcher.php(263): XF\Mvc\Dispatcher->dispatchClass('XF:Thread', 'AddReply', Object(XF\Mvc\RouteMatch), Object(EMD\FT\XF\Pub\Controller\Thread), NULL)
#17 src/XF/Mvc/Dispatcher.php(115): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(EMD\FT\XF\Pub\Controller\Thread), NULL)
#18 src/XF/Mvc/Dispatcher.php(57): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#19 src/XF/App.php(2345): XF\Mvc\Dispatcher->run()
#20 src/XF.php(512): XF\App->run()
#21 index.php(20): XF::runApp('XF\\Pub\\App')
#22 {main}






array(4) {
  ["url"] => string(48) "/threads/xxxx.12345/add-reply"
  ["referrer"] => string(62) "https://www.xxxx.xxxx/threads/xxxx.xxxx/"
  ["_GET"] => array(1) {
    ["/threads/xxxx_xxxx/add-reply"] => string(0) ""
  }
  ["_POST"] => array(8) {
    ["message_html"] => string(138) "<div data-xf-p="1" dir="ltr">https://stackoverflow.com/questions/3809401/what-is-a-good-regular-expression-to-match-a-url</div><p><br></p>"
    ["last_date"] => string(10) "1636166780"
    ["last_known_date"] => string(10) "1636166780"
    ["load_extra"] => string(1) "1"
    ["_xfToken"] => string(8) "********"
    ["_xfRequestUri"] => string(39) "/threads/xxxx.xxxx/"
    ["_xfWithData"] => string(1) "1"
    ["_xfResponseType"] => string(4) "json"
  }
}
 
Last edited:
Top