public function unblockIp() { foreach (array_keys($this->params()->ip_ban) as $ban_id) { IpBans::destroyAll("id = ?", $ban_id); } $this->redirectTo("user#show_blocked_users"); }
protected function check_ip_ban() { if ($this->request()->controller() == "banned" and $this->request()->action() == "index") { return; } $ban = $this->get_ip_ban(); if (!$ban) { return; } if ($ban->expires_at && $ban->expires_at < date('Y-m-d H:i:s')) { IpBans::destroyAll("ip_addr = '{$this->request()->remoteIp()}'"); return; } $this->redirectTo('banned#index'); }
public function showBlockedUsers() { $this->set_title('Blocked Users'); #$this->users = User.find(:all, 'select' => "users.*", 'joins' => "JOIN bans ON bans.user_id = users.id", 'conditions' => ["bans.banned_by = ?", current_user()->id]) $this->users = User::order("expires_at ASC")->select("users.*")->joins("JOIN bans ON bans.user_id = users.id")->take(); $this->ip_bans = IpBans::all(); }