Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 1851

Přidáno uživatelem Michal Kliment před více než 11 roky(ů)

Upravy:

- #473 - Chybove kody pri stahovani DHCP konfigurace
- #474 - Vynucene stahnuti konfigurace DHCP

Zobrazit rozdíly:

freenetis/branches/1.1/application/models/device.php
'comment' => 'ID {member_id} - {member_name} - {device_name}'
), 'stdClass', FALSE);
// mac has to be valid and unique
if (valid::mac_address($host->mac) && !in_array($host->mac, $mac_addresses))
// mac is not valid
if (!valid::mac_address($host->mac))
{
$mac_addresses[] = $host->mac;
$dhcp_server->hosts[] = $host;
// log to database
Log_queue_Model::error(
'Device has not been exported: Invalid MAC address format',
print_r($host, true)
);
}
else
// mac is not unique
else if (in_array($host->mac, $mac_addresses))
{
// log to database
Log_queue_Model::error(
'Device has not been exported: Bad MAC address format',
'Device has not been exported: Duplicate MAC address '.$host->mac.' in subnet',
print_r($host, true)
);
}
// mac is valid => host is valid
else
{
$mac_addresses[] = $host->mac;
$dhcp_server->hosts[] = $host;
}
}
$dhcp_servers[] = $dhcp_server;
freenetis/branches/1.1/application/controllers/devices.php
* @author Michal Kliment
* @param type $device_id
*/
public function export($device_id = NULL, $format = '', $output = '')
public function export($device_id = NULL, $format = '', $output = '', $forced = 0)
{
// bad parameter
if (!$device_id || !is_numeric($device_id))
......
{
$subnet_model = new Subnet_Model();
// no change
if (!$subnet_model->is_any_subnet_of_device_expired($device_id))
// no forced download and no change (#474)
if (!$forced && !$subnet_model->is_any_subnet_of_device_expired($device_id))
{
if (!text::starts_with($format, 'mikrotik'))
{
......
{
Log::add_exception($e);
Log_queue_Model::error($e->getMessage(), print_r ($device, TRUE));
die();
if ($from_device)
{
if (!text::starts_with($format, 'mikrotik'))
{
@header('HTTP/1.0 500 Internal Server Error');
}
die();
}
}
// it is device itself?
......
print_r($device_export, true)
);
die();
if ($from_device)
{
if (!text::starts_with($format, 'mikrotik'))
{
@header('HTTP/1.0 500 Internal Server Error');
}
die();
}
}
$view = new View('device_export_templates/'.$format);

Také k dispozici: Unified diff