示例#1
0
 /**
  * @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();
 }