[WMTech] Post Guard (basic)

[WMTech] Post Guard (basic) 1.1.5

No permission to download
I would like to block the following from thread titles:
  1. 'help me'
  2. 'plz help'
  3. 'please help'
  4. 'need help'
  5. More than one exclamation.

In regards to punctuation:
  • /^[^.,\/#!$%\^&\*;:{}=\-_`~()]{20,}?$/si (where 20 is the number of characters)
This blocks text without dot or comma, but should block text without any form of punctuation. i.e. question mark, excelemation mark, colon, semi-colon.

  • /^[^\n]{20,}?$/si (where 20 is the number of characters)
  • /^[^.,\/#!$%\^&\*;:{}=\-_`~()]{20,}?$/si (where 20 is the number of characters)
This works if this is the only text in the post, but if there is more text in the post which has line breaks/punctuation then the user does not get an error.

  • /\[url='.*?wikipedia.*?'\].*?\[\/url\]/si
I am able to post this link: https://en.wikipedia.org/wiki/Nonsense
 
Last edited:
I would like to block the following from thread titles:
  1. 'help me'
  2. 'plz help'
  3. 'please help'
  4. 'need help'
  5. More than one exclamation.

In regards to punctuation:
  • /^[^.,\/#!$%\^&\*;:{}=\-_`~()]{20,}?$/si (where 20 is the number of characters)
This blocks text without dot or comma, but should block text without any form of punctuation. i.e. question mark, excelemation mark, colon, semi-colon.

For any specific phrase or word, you can use: /\bthe phrase\b/si
The \b means "word boundary"

Two or more exclamation in a row: /!{2,}/si

You're right, that last one was missing the question mark:
/^[^.,\/#!$%\^&\*;:{}=\-_`~()?]{20,}?$/si
 
Is it possible to use the same phrase for multiple guards? Or will this cause issues later down the line?
 
  • /^[^\n]{20,}?$/si (where 20 is the number of characters)
  • /^[^.,\/#!$%\^&\*;:{}=\-_`~()]{20,}?$/si (where 20 is the number of characters)
This works if this is the only text in the post, but if there is more text in the post which has line breaks/punctuation then the user does not get an error.

OK to rephrase it means "on any line having more than x characters" and "on a group of x non-punctuation characters in any line"?

In that case try these out:
/^.{20,}$/m
/[^.,\/#!$%\^&\*;:{}=\-_`~()?]{20,}?/m

Otherwise I'm unclear on exactly what the match condition is.

  • /\[url='.*?wikipedia.*?'\].*?\[\/url\]/si
I am able to post this link: https://en.wikipedia.org/wiki/Nonsense

Yes that only works if they put it in a BBcode URL. It's better to use URL text blocking.
This should catch it:
/(https?|ftp|file):\/\/.*?\.wikipedia\.[-A-Z0-9+&@#\/%?=~_|!:,.;]*[A-Z0-9+&@#\/%=~_|]/si

Is it possible to use the same phrase for multiple guards? Or will this cause issues later down the line?
Can't see any problem.
 
It seems that the if a thread has a title that triggers a guard, then any reply to the thread will trigger an error.
 
OK to rephrase it means "on any line having more than x characters" and "on a group of x non-punctuation characters in any line"?
That is correct.

/[^.,\/#!$%\^&\*;:{}=\-_`~()?]{20,}?/m
This triggers an error if there is a dot at the end of the line.
 
It seems that the if a thread has a title that triggers a guard, then any reply to the thread will trigger an error.

Ah yes, threads also store information about last post etc, so posting is triggering it. I'll upload the fix now. Make sure you have made the Add-on fields of the Master phrases blank, so it won't erase them on upgrade.

That is correct.

/[^.,\/#!$%\^&\*;:{}=\-_`~()?]{20,}?/m
This triggers an error if there is a dot at the end of the line.

But that's OK as long as there is a group of more than x non-punctuation on the line, right? Otherwise, is it "a line with no punctuation"?
 
I encountered this error:
Code:
Zend_Controller_Response_Exception: Cannot send headers; headers already sent in /library/PostGuard/Listener.php, line 1 - library/Zend/Controller/Response/Abstract.php:321

Generated By: Alfa, A moment ago


Stack Trace

#0 /library/Zend/Controller/Response/Abstract.php(115): Zend_Controller_Response_Abstract->canSendHeaders(true)

#1 /library/XenForo/FrontController.php(205): Zend_Controller_Response_Abstract->setHeader('Content-Encodin...', 'gzip', true)

#2 /index.php(13): XenForo_FrontController->run()

#3 {main}

Request State

array(3) {

  ["url"] => string(37) "https://my-forum.com/wiki/xxx"

  ["_GET"] => array(0) {

  }

  ["_POST"] => array(0) {

  }

}
I was not trying to post anything.
 
Interesting, I can't be certain of the interaction with that add-on that is causing this without a copy, but I can try to make the trigger condition more stringent and we can see if it fixes it.
 
I am getting time out fatal errors for deferred.php: (120 seconds) This was not the case before. Can it be that this addon is causing it?
 
I am getting time out fatal errors for deferred.php: (120 seconds) This was not the case before. Can it be that this addon is causing it?
Hard to tell without more error information, but it's possible that there is some background task running across the threads, and the same "retroactive invalidity" effect is blocking it. But I've found a better way to check the titles, so I'll upload a new revision shortly.
 
I am currently encountering a lot of issues not related to this addon. My error log being full makes it hard for me to fully evaluate if this addon is running smooth.

It sure seems that this addon is running smooth and I think it is fine to remove the beta tag. My members do not report any issues with it.
I will post a review after I have used this for a while.
I am pretty happy with the functionality. It saves me and my staff a lot of work.
 
You should update the resource description from :
"XenForo prevents users from creating posts with no content"

into :
"XenForo prevents users from creating posts and editing post with no content" :)
 
Top Bottom