/** * @todo document this */ function action_banlistadd() { global $member; $blogid = intPostVar('blogid'); $allblogs = postVar('allblogs'); $iprange = postVar('iprange'); if ($iprange == "custom") { $iprange = postVar('customiprange'); } $reason = postVar('reason'); $member->blogAdminRights($blogid) or $this->disallow(); // TODO: check IP range validity if (!$allblogs) { if (!BAN::addBan($blogid, $iprange, $reason)) { $this->error(_ERROR_ADDBAN); } } else { // get blogs fot which member has admin rights $adminblogs = $member->getAdminBlogs(); $failed = 0; foreach ($adminblogs as $blogje) { if (!BAN::addBan($blogje, $iprange, $reason)) { $failed = 1; } } if ($failed) { $this->error(_ERROR_ADDBAN); } } $this->action_banlist(); }
/** * Checks if an IP or IP range is banned */ function checkban($blogid) { // check if banned $ban = BAN::isBanned($blogid, serverVar('REMOTE_ADDR')); if ($ban != 0) { doError(_ERROR_BANNED1 . $ban->iprange . _ERROR_BANNED2 . $ban->message . _ERROR_BANNED3); } }