Revize 53cf4ce8
Přidáno uživatelem Ondřej Fibich před téměř 8 roky(ů)
application/controllers/web_interface.php | ||
---|---|---|
|
||
/**
|
||
* Prints all unallowed ip addresses, otherwise same as previous method
|
||
*
|
||
* @author Michal Kliments
|
||
*
|
||
* @param int $message_type message type to filter only IP redirected with
|
||
* the specified type or NULL for all types
|
||
* @author Michal Kliment
|
||
* @author Ondřej Fibich
|
||
*/
|
||
public function unallowed_ip_addresses()
|
||
public function unallowed_ip_addresses($message_type = NULL)
|
||
{
|
||
// if gateway set uped - anly allow to access this page from it
|
||
// also if redirection is not enabled
|
||
... | ... | |
@header('HTTP/1.0 403 Forbidden');
|
||
die();
|
||
}
|
||
|
||
$ip_adresses = ORM::factory('ip_address')->get_unallowed_ip_addresses();
|
||
|
||
$ipm = new Ip_address_Model();
|
||
$mt_num = intval($message_type);
|
||
if ($message_type != NULL && $mt_num >= 0)
|
||
{
|
||
$ip_adresses = $ipm->get_unallowed_ip_addresses_by_type($mt_num);
|
||
}
|
||
else
|
||
{
|
||
$ip_adresses = $ipm->get_unallowed_ip_addresses();
|
||
}
|
||
|
||
$items = array();
|
||
|
application/models/ip_address.php | ||
---|---|---|
JOIN messages_ip_addresses mip ON mip.ip_address_id = ip.id
|
||
");
|
||
}
|
||
|
||
/**
|
||
* Same as previous method, but return unallowed ip addresses for a specific
|
||
* message type
|
||
*
|
||
* @author Ondrej Fibich
|
||
* @see Web_interface_Controller#unallowed_ip_addresses
|
||
* @param int $type message type constant
|
||
* @return type
|
||
*/
|
||
public function get_unallowed_ip_addresses_by_type($type)
|
||
{
|
||
return $this->db->query("
|
||
SELECT DISTINCT ip.ip_address
|
||
FROM ip_addresses ip
|
||
JOIN messages_ip_addresses mip ON mip.ip_address_id = ip.id
|
||
JOIN messages m ON m.id = mip.message_id
|
||
WHERE m.type = ?
|
||
", $type);
|
||
}
|
||
|
||
/**
|
||
* Function gets all ip address of interfaces of devices of users of given member.
|
Také k dispozici: Unified diff
Resolves #1060: implement filter for message type in Web interface unallowed_ip_addresses