Version 4.6.0
This commit is contained in:
1 parent
f79dcf067a
commit
517a5e1f70
2036 files changed
+110041
-26162
No files matched your search
@@ -94,6 +94,11 @@ class _Profanity extends \IPS\Patterns\ActiveRecord implements \JsonSerializable
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( $row['min_posts'] )
|
||||
{
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'profanity_filter_action_moderate_min_posts', NULL, array( 'pluralize' => array( $row['min_posts'] ) ) );
|
||||
}
|
||||
|
||||
return \IPS\Member::loggedIn()->language()->addToStack('profanity_filter_action_moderate');
|
||||
}
|
||||
},
|
||||
@@ -167,9 +172,11 @@ class _Profanity extends \IPS\Patterns\ActiveRecord implements \JsonSerializable
|
||||
),
|
||||
'toggles' => array(
|
||||
'swap' => array( 'profanity_swop' ),
|
||||
'moderate' => array()
|
||||
'moderate' => array( 'profanity_min_posts' )
|
||||
)
|
||||
) ) );
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\Number( 'profanity_min_posts', ( $current ) ? $current->min_posts : 0, FALSE, array( 'unlimited' => 0, 'unlimitedLang' => 'profanity_min_posts_unlimited' ), NULL, \IPS\Member::loggedIn()->language()->addToStack('profanity_min_posts_prefix'), \IPS\Member::loggedIn()->language()->addToStack('profanity_min_posts_suffix'), 'profanity_min_posts' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'profanity_swop', ( $current ) ? $current->swop : NULL, NULL, array(), NULL, NULL, NULL, 'profanity_swop' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Radio( 'profanity_m_exact', ( $current ) ? $current->m_exact : NULL, FALSE, array(
|
||||
'options' => array(
|
||||
@@ -218,6 +225,16 @@ class _Profanity extends \IPS\Patterns\ActiveRecord implements \JsonSerializable
|
||||
{
|
||||
$obj->m_exact = $values['m_exact'];
|
||||
}
|
||||
|
||||
if ( array_key_exists( 'm_exact', $values ) )
|
||||
{
|
||||
$obj->m_exact = $values['m_exact'];
|
||||
}
|
||||
|
||||
if ( array_key_exists( 'min_posts', $values ) )
|
||||
{
|
||||
$obj->min_posts = $values['min_posts'];
|
||||
}
|
||||
|
||||
if ( array_key_exists( 'action', $values ) )
|
||||
{
|
||||
@@ -226,7 +243,7 @@ class _Profanity extends \IPS\Patterns\ActiveRecord implements \JsonSerializable
|
||||
$obj->action = $values['action'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$obj->save();
|
||||
|
||||
return $obj;
|
||||
@@ -267,12 +284,13 @@ class _Profanity extends \IPS\Patterns\ActiveRecord implements \JsonSerializable
|
||||
/**
|
||||
* Check if the content should be hidden by profanity or url filters
|
||||
*
|
||||
* @param string $content The content to check
|
||||
* @param string $content The content to check
|
||||
* @param \IPS\Member|NULL $member The author of the content
|
||||
* @return bool
|
||||
*/
|
||||
public static function hiddenByFilters( $content )
|
||||
public static function hiddenByFilters( $content, $member=NULL )
|
||||
{
|
||||
$return = static::_checkProfanityFilters( $content );
|
||||
$return = static::_checkProfanityFilters( $content, $member );
|
||||
|
||||
if ( $return == FALSE )
|
||||
{
|
||||
@@ -285,10 +303,11 @@ class _Profanity extends \IPS\Patterns\ActiveRecord implements \JsonSerializable
|
||||
/**
|
||||
* Check Profanity Filters
|
||||
*
|
||||
* @param string $content The content to check
|
||||
* @param string $content The content to check
|
||||
* @param \IPS\Member|NULL $member The author of the content
|
||||
* @return bool
|
||||
*/
|
||||
protected static function _checkProfanityFilters( $content )
|
||||
protected static function _checkProfanityFilters( $content, $member=NULL )
|
||||
{
|
||||
$looseProfanity = array();
|
||||
$exactProfanity = array();
|
||||
@@ -296,6 +315,11 @@ class _Profanity extends \IPS\Patterns\ActiveRecord implements \JsonSerializable
|
||||
{
|
||||
if ( $profanity->action == 'moderate' )
|
||||
{
|
||||
if ( ( $member and $profanity->min_posts ) and $member->member_posts > $profanity->min_posts )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( $profanity->m_exact )
|
||||
{
|
||||
$exactProfanity[] = $profanity->type;
|
||||
@@ -330,12 +354,12 @@ class _Profanity extends \IPS\Patterns\ActiveRecord implements \JsonSerializable
|
||||
}
|
||||
|
||||
$split = preg_split( '/((?=<^|\b)(?:' . implode( '|', $words ) . ')(?=\b|$))/iu', $content, null, PREG_SPLIT_DELIM_CAPTURE );
|
||||
|
||||
|
||||
if ( \is_array( $split ) )
|
||||
{
|
||||
foreach( $split AS $section )
|
||||
{
|
||||
if ( \in_array( $section, $exactProfanity ) )
|
||||
if ( \in_array( mb_strtolower( $section ), array_map( 'mb_strtolower', $exactProfanity ) ) )
|
||||
{
|
||||
return TRUE;
|
||||
break;
|
||||
@@ -395,7 +419,7 @@ class _Profanity extends \IPS\Patterns\ActiveRecord implements \JsonSerializable
|
||||
|
||||
foreach( $tags AS $tag )
|
||||
{
|
||||
if ( ( $tag->hasAttribute( 'href' ) and !$tag->hasAttribute( 'data-mentionid' ) ) OR ( ( $tag->hasAttribute( 'src' ) OR $tag->hasAttribute( 'data-embed-src' ) ) AND !$tag->hasAttribute( 'data-emoticon' ) ) )
|
||||
if ( ( $tag->hasAttribute( 'href' ) and !$tag->hasAttribute( 'data-mentionid' ) AND !$tag->hasAttribute( 'data-fileid' ) ) OR ( ( $tag->hasAttribute( 'src' ) OR $tag->hasAttribute( 'data-embed-src' ) ) AND !$tag->hasAttribute( 'data-emoticon' ) AND !$tag->hasAttribute( 'data-fileid' ) ) )
|
||||
{
|
||||
if ( \IPS\Settings::i()->ipb_url_filter_option == 'none' )
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user