Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 8f55a2a5

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

Release 1.1.6

Zobrazit rozdíly:

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
{
......
// 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);
}
}
application/controllers/ifaces.php
$link = new Link_Model($link_id);
$iface = new Iface_Model();
if (!$link || !$link->id)
if (!$link || !$link->id || (
$link->medium != Link_Model::MEDIUM_AIR &&
$link->medium != Link_Model::MEDIUM_ROAMING))
{
self::error(RECORD);
}
......
self::error(ACCESS);
}
$this->append_link_id = $link->id; // for callback
$ai_types = null;
if ($link->medium == Link_Model::MEDIUM_AIR)
{
$ai_types = array(Iface_Model::TYPE_WIRELESS);
}
$form = new Forge();
$form->dropdown('iface_id')
->label('Interface')
->options($iface->select_list_grouped_by_device())
->options($iface->select_list_grouped_by_device(null, $ai_types))
->rules('required')
->style('width:400px');
->style('width:400px')
->callback(array($this, 'valid_iface_for_appending_to_link'));
$form->submit('Add');
......
}
}
/**
* Callback function to validate iface that should be appended to link
*
* @param Form_Field $input
*/
public function valid_iface_for_appending_to_link($input = NULL)
{
if (empty($input) || !is_object($input))
{
self::error(PAGE);
}
if ($input->value)
{
$iface = new Iface_Model($input->value);
$link = new Link_Model($this->append_link_id);
// airlink constrains
if ($link->medium == Link_Model::MEDIUM_AIR)
{
// only wireless type enabled
if ($iface->type != Iface_Model::TYPE_WIRELESS)
{
// no message required this should not happend due to
// select options restriction
$input->add_error('required');
}
// check constrain for only one iface with mode AP in air link
if ($iface->wireless_mode == Iface_Model::WIRELESS_MODE_AP)
{
$count = ORM::factory('iface')->count_items_by_mode_and_link(
Iface_Model::WIRELESS_MODE_AP, $link->id, $iface->id
);
if ($count > 0)
{
$input->add_error('required', __(
'In this link an interface in mode AP already exists.'
));
}
}
}
}
}
}
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')
)));
}
}
application/controllers/links.php
'use_selector' => false
));
if ($link->medium == Link_Model::MEDIUM_ROAMING &&
if (($link->medium == Link_Model::MEDIUM_AIR ||
$link->medium == Link_Model::MEDIUM_ROAMING) &&
$this->acl_check_edit('Ifaces_Controller', 'iface'))
{
$grid->add_new_button(
application/controllers/members.php
$form->input('membername')
->label('Name of organization')
->help(help::hint('member_name'))
->rules('length[1,60]');
->rules('length[1,100]');
// access control
if ($this->acl_check_new('Members_Controller', 'organization_id'))
......
{
$form->input('membername')
->label('Member name')
->rules('required|length[1,60]')
->rules('required|length[1,100]')
->value($member->name);
}
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;
application/models/iface.php
* Gets array of ifaces grouped by device for dropdown
*
* @param integer $device_id Only iface of one device?
* @param array $restrict_types Array of allowed types
* @author Ondřej fibich
* @return array
*/
public function select_list_grouped_by_device($device_id = NULL)
public function select_list_grouped_by_device($device_id = NULL,
$restrict_types = array())
{
$where = '';
......
$where = 'WHERE d.id = ' . intval($device_id);
}
if (is_array($restrict_types) && count($restrict_types))
{
$where .= empty($where) ? 'WHERE ' : ' AND ';
$where .= ' i.type IN (' . implode(',', $restrict_types) . ')';
}
$ifaces = $this->db->query("
SELECT i.id, COALESCE(d.name, '') AS device_name,
CONCAT(u.surname, ' ', u.name, ' - ', u.login) AS user_name,
application/vendors/deb/freenetis/changelog
freenetis (1.1.6) stable; urgency=hight
* Fix release
* Fixes #894: Member name length limitation extended
* Fixes #899: Invalid prefilled value in link dialog
* Fixes #900: Possibility to add existing wireless interface to air link
-- Ondrej Fibich <ondrej.fibich@gmail.com> Wed, 19 Mar 2014 23:19:06 +0100
freenetis (1.1.5) stable; urgency=hight
* Fix release
* Fixes #885: Unidentified payments filter
* Fixes #893: Pre-fill of form for approving of a connection request
* Implements #882: Determining of MAC from RB/Linux in hybrid networks
-- Ondrej Fibich <ondrej.fibich@gmail.com> Tue, 04 Mar 2014 23:29:40 +0100
freenetis (1.1.4) stable; urgency=hight
* Fix release
* Fixes #880: Fixes filter initialization due to forgotten JS debug
application/views/js/devices_add.php
<?php if (!empty($connection_request_model)): ?>
// add mac from request
if ((default_iface >= 0) && (i == default_iface))
if ((default_iface >= 0) && ((i - start_index) == default_iface))
{
auto_fill = true;
html_buffer.push('value="<?php echo $connection_request_model->mac_address ?>" ');
......
html_buffer.push(']" ');
<?php if (!empty($connection_request_model)): ?>
// add mac from request
if ((default_iface >= 0) && (i == default_iface))
// add ip from request
if ((default_iface >= 0) && ((i - start_index) == default_iface))
{
html_buffer.push('value="<?php echo $connection_request_model->ip_address ?>" ');
}
......
<?php if (!empty($connection_request_model)): ?>
// add mac from request
if ((default_iface >= 0) && (i == default_iface))
if ((default_iface >= 0) && ((i - start_index) == default_iface))
{
html_buffer.push('class="subnet_fill_in_connection_request_model_value" ');
}
......
html_buffer.push('<a href="#" class="device_add_detail_button get_connected_to_device_and_iface');
<?php if (!empty($connection_request_model)): ?>
// enable getting on connection request (MAC and subnet aready filled in)
if (i != default_iface)
if ((i - start_index) != default_iface)
{
html_buffer.push(' dispNone');
}
application/views/js/ifaces_add.php
$('#port_medium_input').val($('#medium').val());
var bitrate = $('#bitrate').val();
$('#bitrate_input').val(substr(bitrate, 0, bitrate.length-1));
$('#bitrate_input').val(substr(bitrate, 0, bitrate.length-1) || '');
$('#bitrate_unit_input').val(substr(bitrate, -1));
$('#duplex_input').val($('#duplex').val());
version.php
* The current version of FreenetIS.
* This value must be changed by developers in a new release of FreenetIS.
*/
define('FREENETIS_VERSION', '1.1.4');
define('FREENETIS_VERSION', '1.1.6');

Také k dispozici: Unified diff