/** * Ban comment ip */ function banIpAction() { $bannedIp = new BannedIpRecord(); $bannedIp->remoteIp = $this->request->remoteIp; $bannedIp->save(); $this->set("status", "OK"); $this->viewClass = "JsonView"; }
function saveNewIpBanAction() { $bannedIps = preg_split("#\r?\n#", $this->request->bannedIps); foreach ($bannedIps as $ip) { $ip = trim($ip); if (empty($ip)) { continue; } $bannedIp = new BannedIpRecord(); $bannedIp->remoteIp = $ip; $bannedIp->save(); } $this->redirect($this->moduleLink("banIp")); }