示例#1
0
 function apply_blacklist()
 {
     if (empty($this->badge_name) && empty($this->legal_name)) {
         return;
     }
     list($blacklist, $field, $trigger) = Blacklist::match($this->badge_name, $this->legal_name);
     if ($blacklist) {
         $this->blacklisted = true;
         $this->blacklist_id = $blacklist->id;
         $this->blacklist_trigger = "{$field}:{$trigger}";
         $this->blacklist_type = $blacklist->type;
         $this->blacklist_message = $blacklist->reason;
     } else {
         if ($this->blacklisted && !$this->blacklist_id) {
             // Manual blacklists shouldn't be reset.
             return;
         }
         $this->blacklisted = false;
         $this->blacklist_id = null;
         $this->blacklist_trigger = null;
         $this->blacklist_type = null;
         $this->blacklist_message = null;
     }
 }