Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 1830

Přidáno uživatelem Michal Kliment před téměř 12 roky(ů)

Upravy:

- #312 - Generovani zaznamu DHCP serveru (logovani chyb)

Zobrazit rozdíly:

freenetis/branches/1.1/application/helpers/arr.php
1 => __('Yes')
);
}
/**
* Remove values given by charlist (seperated by comma) from array
*
* @author Michal Kliment <kliment@freenetis.org>
* @param type $array
* @param type $charlist
* @return type
*/
public static function trim($array = array(), $charlist = '')
{
$charlist = explode(',', $charlist);
foreach ($array as $key => $val)
{
if (in_array($val, $charlist))
unset ($array[$key]);
}
return $array;
}
} // End arr
freenetis/branches/1.1/application/models/device.php
else
$mac = $dhcp_ip_address->iface->mac;
// mac has to bee valid and unique
if (valid::mac_address($mac) && !in_array($mac, $mac_addresses))
$host = arr::to_object(array
(
'id' => $dhcp_ip_address->id,
'server' => $dhcp_server->name,
'ip_address' => $dhcp_ip_address->ip_address,
'mac' => $mac,
'device_name' => $dhcp_ip_address->iface->device->name,
'device_type' => $dhcp_ip_address->iface->device->type,
'member_id' => $dhcp_ip_address->iface->device->user->member->id,
'member_name' => $dhcp_ip_address->iface->device->user->member->name,
'member_type' => $dhcp_ip_address->iface->device->user->member->type,
'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_addresses[] = $mac;
$mac_addresses[] = $host->mac;
$dhcp_server->hosts[] = arr::to_object(array
(
'id' => $dhcp_ip_address->id,
'server' => $dhcp_server->name,
'ip_address' => $dhcp_ip_address->ip_address,
'mac' => $mac,
'device_name' => $dhcp_ip_address->iface->device->name,
'device_type' => $dhcp_ip_address->iface->device->type,
'member_id' => $dhcp_ip_address->iface->device->user->member->id,
'member_name' => $dhcp_ip_address->iface->device->user->member->name,
'member_type' => $dhcp_ip_address->iface->device->user->member->type,
'comment' => 'ID {member_id} - {member_name} - {device_name}'
), 'stdClass', FALSE);
$dhcp_server->hosts[] = $host;
}
else
{
/**
* @todo Log error
*/
// log to database
Log_queue_Model::error(
'Device has not been exported: Bad MAC address format',
print_r($host, true)
);
}
}
freenetis/branches/1.1/application/controllers/devices.php
header ("Content-disposition: attachment; filename=".url::title($device->name)."-".$format."-export".$ext);
}
// find dns servers
$dns_servers = arr::trim(explode("\n",Settings::get('dns_servers')));
// dns servers has to be set
if (!count($dns_servers))
{
// log to database
Log_queue_Model::error(
'Device has not been exported: DNS servers are not set',
print_r($device_export, true)
);
die();
}
$view = new View('device_export_templates/'.$format);
$view->result = $device_export;
$view->dns_servers = array_map('trim', explode("\n", Settings::get('dns_servers')));
$view->dns_servers = $dns_servers;
$view->render(TRUE);
}
// form to choose format and output

Také k dispozici: Unified diff