Revize 2317
Přidáno uživatelem Michal Kliment před více než 10 roky(ů)
freenetis/trunk/application/controllers/connection_requests.php | ||
---|---|---|
$gateway = $ip_address_model->get_gateway_of_subnet($subnet_id);
|
||
|
||
if ($gateway && $gateway->id)
|
||
{
|
||
// first try SNMP
|
||
if (module::e('snmp'))
|
||
{
|
||
$mac_address = '';
|
||
|
||
// first try CGI scripts
|
||
if (module::e('cgi'))
|
||
{
|
||
$vars = arr::to_object(array
|
||
(
|
||
'GATEWAY_IP_ADDRESS' => $gateway->ip_address,
|
||
'IP_ADDRESS' => $ip_address
|
||
));
|
||
|
||
$url = text::object_format($vars, Settings::get('cgi_arp_url'));
|
||
|
||
$mac_address = @file_get_contents($url);
|
||
}
|
||
|
||
// now try SNMP
|
||
if (!valid::mac_address($mac_address) && module::e('snmp'))
|
||
{
|
||
try
|
||
{
|
||
$snmp = Snmp_Factory::factoryForDevice($gateway->ip_address);
|
||
|
||
// try find MAC address in DHCP
|
||
$mac_address = $snmp->getDHCPMacAddressOf($ip_address);
|
||
$this->session->set('connection_request_mac', $mac_address);
|
||
}
|
||
catch (DHCPMacAddressException $e)
|
||
{
|
||
... | ... | |
{
|
||
// try find MAC address in ARP table
|
||
$mac_address = $snmp->getARPMacAddressOf($ip_address);
|
||
$this->session->set('connection_request_mac', $mac_address);
|
||
}
|
||
catch(Exception $e)
|
||
{
|
||
... | ... | |
status::mwarning($e->getMessage());
|
||
}
|
||
}
|
||
// now try CGI scripts
|
||
else if (module::e('cgi'))
|
||
{
|
||
$vars = arr::to_object(array
|
||
(
|
||
'GATEWAY_IP_ADDRESS' => $gateway->ip_address,
|
||
'IP_ADDRESS' => $ip_address
|
||
));
|
||
|
||
$url = text::object_format($vars, Settings::get('cgi_arp_url'));
|
||
|
||
$mac_address = @file_get_contents($url);
|
||
|
||
if ($mac_address !== FALSE)
|
||
{
|
||
$this->session->set('connection_request_mac', $mac_address);
|
||
}
|
||
}
|
||
|
||
$this->session->set('connection_request_mac', $mac_address);
|
||
}
|
||
}
|
||
|
freenetis/trunk/application/controllers/json.php | ||
---|---|---|
|
||
if ($gateway && $gateway->id && valid::ip($ip_address))
|
||
{
|
||
// first try SNMP
|
||
if (module::e('snmp'))
|
||
$mac_address = '';
|
||
|
||
// first try CGI scripts
|
||
if (module::e('cgi'))
|
||
{
|
||
$vars = arr::to_object(array
|
||
(
|
||
'GATEWAY_IP_ADDRESS' => $gateway->ip_address,
|
||
'IP_ADDRESS' => $ip_address
|
||
));
|
||
|
||
$url = text::object_format($vars, Settings::get('cgi_arp_url'));
|
||
|
||
$mac_address = trim(@file_get_contents($url));
|
||
}
|
||
|
||
// now try SNMP
|
||
if (!valid::mac_address($mac_address) && module::e('snmp'))
|
||
{
|
||
try
|
||
{
|
||
... | ... | |
|
||
// try find MAC address in DHCP
|
||
$mac_address = $snmp->getDHCPMacAddressOf($ip_address);
|
||
|
||
die(json_encode(array
|
||
(
|
||
'state' => 1,
|
||
'mac' => $mac_address
|
||
)));
|
||
}
|
||
// MAC table is not in DHCP
|
||
catch (DHCPMacAddressException $e)
|
||
... | ... | |
{
|
||
// try find MAC address in ARP table
|
||
$mac_address = $snmp->getARPMacAddressOf($ip_address);
|
||
|
||
die(json_encode(array
|
||
(
|
||
'state' => 1,
|
||
'mac' => $mac_address
|
||
)));
|
||
}
|
||
catch(Exception $e)
|
||
{
|
||
Log::add_exception($e);
|
||
die(json_encode(array
|
||
(
|
||
'state' => 0,
|
||
'message' => $e->getMessage()
|
||
)));
|
||
}
|
||
}
|
||
catch (Exception $e)
|
||
{
|
||
Log::add_exception($e);
|
||
die(json_encode(array
|
||
(
|
||
'state' => 0,
|
||
'message' => $e->getMessage()
|
||
)));
|
||
}
|
||
}
|
||
// now try CGI scripts
|
||
else if (module::e('cgi'))
|
||
{
|
||
$vars = arr::to_object(array
|
||
|
||
if (valid::mac_address($mac_address))
|
||
{
|
||
die(json_encode(array
|
||
(
|
||
'GATEWAY_IP_ADDRESS' => $gateway->ip_address,
|
||
'IP_ADDRESS' => $ip_address
|
||
));
|
||
|
||
$url = text::object_format($vars, Settings::get('cgi_arp_url'));
|
||
|
||
$mac_address = @file_get_contents($url);
|
||
|
||
if ($mac_address !== FALSE)
|
||
{
|
||
die(json_encode(array
|
||
(
|
||
'state' => 1,
|
||
'mac' => $mac_address
|
||
)));
|
||
}
|
||
else
|
||
{
|
||
die(json_encode(array
|
||
(
|
||
'state' => 0,
|
||
'message' => __('Invalid output data')
|
||
)));
|
||
}
|
||
'state' => 1,
|
||
'mac' => $mac_address
|
||
)));
|
||
}
|
||
else
|
||
{
|
||
die(json_encode(array
|
||
(
|
||
'state' => 0,
|
||
'message' => __('SNMP or CGI scripts not enabled')
|
||
'message' => __('MAC not found')
|
||
)));
|
||
}
|
||
}
|
freenetis/trunk/application/libraries/Filter_form.php | ||
---|---|---|
{
|
||
$data = json_decode($this->queries[$query]->values, TRUE);
|
||
|
||
$on = $data["on"];
|
||
$types = $data["types"];
|
||
$operations = $data["opers"];
|
||
$values = $data["values"];
|
||
$tables = $data["tables"];
|
||
$on = @$data["on"];
|
||
$types = @$data["types"];
|
||
$operations = @$data["opers"];
|
||
$values = @$data["values"];
|
||
$tables = @$data["tables"];
|
||
|
||
$this->loaded_from_saved_query = TRUE;
|
||
|
Také k dispozici: Unified diff
Opravy:
- fixes #882: Zjisteni MAC z RB/Linux na hybridni siti
- fixes #885: FreenetIS bug report: Neidentifikovane platby