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; } }
public function blocked($attribute, $params) { if (BbiiIpaddress::blocked($this->ip)) { $this->addError('ip', Yii::t('BbiiModule.bbii', 'Your IP address has been blocked.')); } }
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; }