예제 #1
0
	/**
	 * @param UserTable $user
	 */
	public function getMenu( $user )
	{
		global $_CB_framework;

		if ( ( ! cbantispamClass::isUserBlockable( $user ) ) ||( ! Application::MyUser()->isGlobalModerator() ) ) {
			return;
		}

		if ( $this->params->get( 'general_block', 1 ) ) {
			if ( $this->params->get( 'menu_block_user', 1 ) ) {
				$menu					=	array();
				$menu['arrayPos']		=	array( '_UE_MENU_MODERATE' => array( '_UE_MENU_ANTISPAM_BLOCKUSER' => null ) );
				$menu['position']		=	'menuBar';
				$menu['caption']		=	htmlspecialchars( CBTxt::T( 'Block User' ) );
				$menu['url']			=	$_CB_framework->pluginClassUrl( $this->element, true, array( 'action' => 'block', 'func' => 'user', 'usr' => (int) $user->get( 'id' ) ) );
				$menu['target']			=	'';
				$menu['img']			=	'<span class="fa fa-ban"></span> ';
				$menu['tooltip']		=	htmlspecialchars( CBTxt::T( 'Block this users account' ) );

				$this->addMenu( $menu );
			}

			if ( $this->params->get( 'menu_block_ip', 1 ) ) {
				$menu					=	array();
				$menu['arrayPos']		=	array( '_UE_MENU_MODERATE' => array( '_UE_MENU_ANTISPAM_BLOCKIP' => null ) );
				$menu['position']		=	'menuBar';
				$menu['caption']		=	htmlspecialchars( CBTxt::T( 'Block IP Address' ) );
				$menu['url']			=	$_CB_framework->pluginClassUrl( $this->element, true, array( 'action' => 'block', 'func' => 'ip', 'usr' => (int) $user->get( 'id' ) ) );
				$menu['target']			=	'';
				$menu['img']			=	'<span class="fa fa-ban"></span> ';
				$menu['tooltip']		=	htmlspecialchars( CBTxt::T( 'Block this users IP Address' ) );

				$this->addMenu( $menu );
			}

			if ( $this->params->get( 'menu_block_email', 0 ) ) {
				$menu					=	array();
				$menu['arrayPos']		=	array( '_UE_MENU_MODERATE' => array( '_UE_MENU_ANTISPAM_BLOCKEMAIL' => null ) );
				$menu['position']		=	'menuBar';
				$menu['caption']		=	htmlspecialchars( CBTxt::T( 'Block Email Address' ) );
				$menu['url']			=	$_CB_framework->pluginClassUrl( $this->element, true, array( 'action' => 'block', 'func' => 'email', 'usr' => (int) $user->get( 'id' ) ) );
				$menu['target']			=	'';
				$menu['img']			=	'<span class="fa fa-ban"></span> ';
				$menu['tooltip']		=	htmlspecialchars( CBTxt::T( 'Block this users Email Address' ) );

				$this->addMenu( $menu );
			}

			if ( $this->params->get( 'menu_block_domain', 0 ) ) {
				$menu					=	array();
				$menu['arrayPos']		=	array( '_UE_MENU_MODERATE' => array( '_UE_MENU_ANTISPAM_BLOCKDOMAIN' => null ) );
				$menu['position']		=	'menuBar';
				$menu['caption']		=	htmlspecialchars( CBTxt::T( 'Block Email Domain' ) );
				$menu['url']			=	$_CB_framework->pluginClassUrl( $this->element, true, array( 'action' => 'block', 'func' => 'domain', 'usr' => (int) $user->get( 'id' ) ) );
				$menu['target']			=	'';
				$menu['img']			=	'<span class="fa fa-ban"></span> ';
				$menu['tooltip']		=	htmlspecialchars( CBTxt::T( 'Block this users Email Domain' ) );

				$this->addMenu( $menu );
			}
		}

		if ( $this->params->get( 'general_whitelist', 1 ) ) {
			if ( $this->params->get( 'menu_whitelist_user', 1 ) ) {
				$menu					=	array();
				$menu['arrayPos']		=	array( '_UE_MENU_MODERATE' => array( '_UE_MENU_ANTISPAM_WHITELISTUSER' => null ) );
				$menu['position']		=	'menuBar';
				$menu['caption']		=	htmlspecialchars( CBTxt::T( 'Whitelist User' ) );
				$menu['url']			=	$_CB_framework->pluginClassUrl( $this->element, true, array( 'action' => 'whitelist', 'func' => 'user', 'usr' => (int) $user->get( 'id' ) ) );
				$menu['target']			=	'';
				$menu['img']			=	'<span class="fa fa-shield"></span> ';
				$menu['tooltip']		=	htmlspecialchars( CBTxt::T( 'Whitelist this users account' ) );

				$this->addMenu( $menu );
			}

			if ( $this->params->get( 'menu_whitelist_ip', 1 ) ) {
				$menu					=	array();
				$menu['arrayPos']		=	array( '_UE_MENU_MODERATE' => array( '_UE_MENU_ANTISPAM_WHITELISTIP' => null ) );
				$menu['position']		=	'menuBar';
				$menu['caption']		=	htmlspecialchars( CBTxt::T( 'Whitelist IP Address' ) );
				$menu['url']			=	$_CB_framework->pluginClassUrl( $this->element, true, array( 'action' => 'whitelist', 'func' => 'ip', 'usr' => (int) $user->get( 'id' ) ) );
				$menu['target']			=	'';
				$menu['img']			=	'<span class="fa fa-shield"></span> ';
				$menu['tooltip']		=	htmlspecialchars( CBTxt::T( 'Whitelist this users IP Address' ) );

				$this->addMenu( $menu );
			}

			if ( $this->params->get( 'menu_whitelist_email', 0 ) ) {
				$menu					=	array();
				$menu['arrayPos']		=	array( '_UE_MENU_MODERATE' => array( '_UE_MENU_ANTISPAM_WHITELISTEMAIL' => null ) );
				$menu['position']		=	'menuBar';
				$menu['caption']		=	htmlspecialchars( CBTxt::T( 'Whitelist Email Address' ) );
				$menu['url']			=	$_CB_framework->pluginClassUrl( $this->element, true, array( 'action' => 'whitelist', 'func' => 'email', 'usr' => (int) $user->get( 'id' ) ) );
				$menu['target']			=	'';
				$menu['img']			=	'<span class="fa fa-shield"></span> ';
				$menu['tooltip']		=	htmlspecialchars( CBTxt::T( 'Whitelist this users Email Address' ) );

				$this->addMenu( $menu );
			}

			if ( $this->params->get( 'menu_whitelist_domain', 0 ) ) {
				$menu					=	array();
				$menu['arrayPos']		=	array( '_UE_MENU_MODERATE' => array( '_UE_MENU_ANTISPAM_WHITELISTDOMAIN' => null ) );
				$menu['position']		=	'menuBar';
				$menu['caption']		=	htmlspecialchars( CBTxt::T( 'Whitelist Email Domain' ) );
				$menu['url']			=	$_CB_framework->pluginClassUrl( $this->element, true, array( 'action' => 'whitelist', 'func' => 'domain', 'usr' => (int) $user->get( 'id' ) ) );
				$menu['target']			=	'';
				$menu['img']			=	'<span class="fa fa-shield"></span> ';
				$menu['tooltip']		=	htmlspecialchars( CBTxt::T( 'Whitelist this users Email Domain' ) );

				$this->addMenu( $menu );
			}
		}
	}