예제 #1
0
 /**
  * @param  array  $params   plugin parameters for the current action
  * @return null or jSelectorAct  if action should change
  */
 public function beforeAction($params)
 {
     $selector = null;
     $banok = false;
     if (isset($params['banuser.check'])) {
         jClasses::inc('havefnubb~bans');
         $banok = bans::check();
     }
     if ($banok) {
         // disconnect the user if he was connected
         jAuth::logout();
         if ($this->config['on_error'] == 1 || !jApp::coord()->request->isAllowedResponse('jResponseRedirect')) {
             throw new jException(jLocale::get("havefnubb~ban.you.are.banned"));
         } else {
             $selector = new jSelectorAct($this->config['on_error_action']);
         }
     }
     return $selector;
 }
 /**
  * to answer to jcommunity_registration_prepare_save event
  * @param object $event the given event to answer to
  */
 function onjcommunity_registration_prepare_save($event)
 {
     $user = $event->getParam('user');
     // check if the user try to register with a banned domain
     jClasses::inc('havefnubb~bans');
     // $return is false when the domain of the email is not banned
     // otherwise ; $return contain the message of the ban
     $return = bans::checkDomain($user->email);
     if (is_string($return)) {
         $event->Add(array('errorRegistration' => $return));
     } else {
         $event->Add(array('errorRegistration' => ''));
     }
 }