|
@@ 127-133 (lines=7) @@
|
| 124 |
|
* |
| 125 |
|
* @param string $ipAddress The IP to add to a ban |
| 126 |
|
*/ |
| 127 |
|
public function addIP($ipAddress) |
| 128 |
|
{ |
| 129 |
|
$this->lazyLoad(); |
| 130 |
|
|
| 131 |
|
$this->ipAddresses[] = $ipAddress; |
| 132 |
|
$this->db->execute('INSERT IGNORE INTO banned_ips (id, ban_id, ip_address) VALUES (NULL, ?, ?)', [$this->getId(), $ipAddress]); |
| 133 |
|
} |
| 134 |
|
|
| 135 |
|
/** |
| 136 |
|
* Remove an IP from the ban |
|
@@ 140-147 (lines=8) @@
|
| 137 |
|
* |
| 138 |
|
* @param string $ipAddress The IP to remove from the ban |
| 139 |
|
*/ |
| 140 |
|
public function removeIP($ipAddress) |
| 141 |
|
{ |
| 142 |
|
$this->lazyLoad(); |
| 143 |
|
|
| 144 |
|
// Remove $ipAddress from $this->ipAddresses |
| 145 |
|
$this->ipAddresses = array_diff($this->ipAddresses, [$ipAddress]); |
| 146 |
|
$this->db->execute('DELETE FROM banned_ips WHERE ban_id = ? AND ip_address = ?', [$this->getId(), $ipAddress]); |
| 147 |
|
} |
| 148 |
|
|
| 149 |
|
/** |
| 150 |
|
* Set the IP addresses of the ban |