Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 414

Přidáno uživatelem Michal Kliment před asi 15 roky(ů)

Dokonceno odstraneni vsech session z kontroleru ip adres a VLAN rozhranich.

Zobrazit rozdíly:

freenetis/trunk/kohana/application/controllers/vlan_ifaces.php
* @return unknown_type
*/
function show_all($limit_results = 50, $order_by = 'id', $order_by_direction = 'asc', $page_word = null, $page = 1)
{
//---- delete session device ----
$this->session->del('ssDevice_id');
$this->session->del('ssIface_id');
{
if (!$this->acl_check_view('Devices_Controller','vlan_iface'))
Controller::error(1);
......
*/
function show($vlan_iface_id = null)
{
$ssIface_id = $this->session->get('ssIface_id');
$vlan_iface = new Vlan_iface_Model($vlan_iface_id);
if (!isset($vlan_iface_id) || $vlan_iface->id == 0) {
Controller::warning(1);
......
$member_id = $vlan_iface->iface->device->user->member_id;
if(!$this->acl_check_view('Devices_Controller','vlan_iface',$member_id)) Controller::error(1);
$this->session->set('ssVlan_iface_id',$vlan_iface->id);
$this->session->del('ssIface_id');
//----------- list of IP ADDRESSES ---------------
$ip_model = new Ip_address_Model();
......
$form->input('name')->label(url_lang::lang('texts.name').':')->rules('required|length[3,250]')->value($vlan_iface->name);
$iface_model = new Iface_Model();
$ifaces = $iface_model->select(array('id','name'))->orderby('name')->find_all();
$ifaces = $iface_model->find_all_by_id($vlan_iface->iface_id);
foreach ($ifaces as $iface) {
$arr_ifaces[$iface->id] = $iface->name;
......
{
if (isset($vlan_iface_id))
{
// get information from session to know where to return
$ssIface_id = $this->session->get('ssIface_id');
if ($ssIface_id)
$link_back = url_lang::base().'ifaces/show/'.$ssIface_id;
else
$link_back = url_lang::base().'vlan_ifaces/show_all';
$vlan_iface = new Vlan_iface_Model($vlan_iface_id);
if (!$vlan_iface->id)
url::redirect($link_back);
Controller::error(RECORD);
$link_back = url_lang::base().'ifaces/show/'.$vlan_iface->iface_id;
if (!$this->acl_check_delete('Devices_Controller', 'vlan_iface', $vlan_iface->iface->device->user->member_id))
Controller::error(1);
// find ip addresses of interface, in this relation 1:n ORM works
......
}
else
{
Controller::warning(1);
Controller::warning(PARAMETER);
}
}
}
freenetis/trunk/kohana/application/controllers/ip_addresses.php
} // end of add function
function edit($ip_address_id = NULL)
{
{
if (!$ip_address_id)
Controller::warning(PARAMETER);
$ip_address = new Ip_address_Model($ip_address_id);
if (!$ip_address->id)
Controller::error(RECORD);
$member_id = ($ip_address->iface_id) ? $ip_address->iface->device->user->member_id : $ip_address->vlan_iface->iface->device->user->member_id;
if (!$this->acl_check_edit('Devices_Controller', 'ip_address',$member_id)) Controller::error(1);
$this->form = new Forge(url_lang::base()."ip_addresses/edit/".$ip_address_id, '', 'POST', array('id' => 'article_form'));
$this->form->set_attr('class', 'form_class')->set_attr('method', 'post');
$iface_model = new Iface_Model();
$vlan_iface_model = new Vlan_iface_Model();
$ip_address = new Ip_address_Model($ip_address_id);
if (!isset($ip_address_id) || $ip_address->id == 0) {
Controller::warning(1);
}
$this->ip_address_id = $ip_address_id;
$member_id = NULL;
$arr_ifaces = array();
$arr_vlan_ifaces = array();
$iface_selected = $ip_address->iface_id;
$vlan_iface_selected = $ip_address->vlan_iface_id;
if ($ip_address->iface_id)
{
$ifaces = $iface_model->find_all_by_id($ip_address->iface_id);
......
$ifaces = array();
$vlan_ifaces = $vlan_iface_model->find_all_by_id($ip_address->vlan_iface_id);
}
if (!$this->acl_check_edit('Devices_Controller', 'ip_address',$member_id)) Controller::error(1);
foreach ($ifaces as $iface) {
$arr_ifaces[$iface->id] = $iface->name;

Také k dispozici: Unified diff