Example #1
0
 public static function blocked($ip)
 {
     $model = BbiiIpaddress::find()->find("ip = '{$ip}'");
     if ($model === null) {
         return false;
     } else {
         $model->updateCounters(array('count' => 1));
         // method since Yii 1.1.8
         return true;
     }
 }
Example #2
0
 public function blocked($attribute, $params)
 {
     if (BbiiIpaddress::blocked($this->ip)) {
         $this->addError('ip', Yii::t('BbiiModule.bbii', 'Your IP address has been blocked.'));
     }
 }
Example #3
0
 public function actionBanIp($id)
 {
     $post = BbiiPost::find($id);
     if ($post === null) {
         throw new HttpException(404, Yii::t('BbiiModule.bbii', 'The requested post does not exist.'));
     }
     $ip = new BbiiIpaddress();
     $ip->ip = $post->ip;
     $ip->save();
     return;
 }