Skip to content

Commit

Permalink
#953 Ability to restrict posting links for certain membership levels
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexTr committed Dec 16, 2017
1 parent 5e45f55 commit 1eb3b04
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion inc/classes/BxDolForm.php
Expand Up @@ -709,6 +709,8 @@ class BxDolForm extends BxDol implements iBxDolReplaceable
static $TYPES_TEXT = array('text' => 1, 'textarea' => 1);
static $TYPES_FILE = array('file' => 1);

static $FUNC_SKIP_DOMAIN_CHECK = array('email' => 1, 'emails' => 1, 'emailexist' => 1, 'emailuniq' => 1, 'hostdomain' => 1, 'hostdomainchat' => 1);

protected $_aMarkers = array ();

protected $oTemplate;
Expand Down Expand Up @@ -1182,7 +1184,13 @@ function check (&$aInputs, $aValues = array())
}

// check for links in text fields
if (isset(BxDolForm::$TYPES_TEXT[$a['type']]) && bx_is_url_in_content($val) && !isAdmin())
$sCheckerFunc = isset($a['checker']['func']) ? strtolower($a['checker']['func']) : '';
if (
!isset(BxDolForm::$FUNC_SKIP_DOMAIN_CHECK[$sCheckerFunc]) &&
(!isset($a['skip_domain_check']) || false == $a['skip_domain_check']) &&
isset(BxDolForm::$TYPES_TEXT[$a['type']]) &&
bx_is_url_in_content($val) &&
!isAdmin())
{
$aCheck = checkActionModule(bx_get_logged_profile_id(), 'post links', 'system');
if ($aCheck[CHECK_ACTION_RESULT] !== CHECK_ACTION_RESULT_ALLOWED) {
Expand Down

0 comments on commit 1eb3b04

Please sign in to comment.