Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > dca483b59ba61f3fa092de932ddd570e > files > 250

nuface-2.0.14-2mdv2009.1.i586.rpm

<?php
# Copyright(C) 2004-2007 INL
# Written by Eric Leblond <regit@inl.fr>
#            Vincent Deffontaines <gryzor@inl.fr>
#            Jean Gillaux <jean@inl.fr>
#            Damien Boucard <damien.boucard AT inl.fr>
#
# $Id: network.class.php 17927 2009-02-16 13:16:09Z haypo $
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
#  This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.

require_once('elt.class.php');
require_once('elt_set.class.php');

class resource extends elt_set {
    function resource($ress,$type='xml',$id=0){
        parent::elt_set($ress, $type, $id, 'resource');
        if ($type=='xml'){
            $this->read_elements($ress);
        }
    }
    function express($ress){
        foreach($ress->get_elements_by_tagname("elt") as $resselt){
          $result=$resselt->express;
        }
    }
}

class auth extends elt_set {
    function auth($ress,$type='xml',$id=0){
        parent::elt_set($ress, $type, $id, 'auth');
        if ($type=='xml'){
            $this->read_elements($ress);
        }
    }

    function express($ress){
        foreach($ress->get_elements_by_tagname("elt") as $resselt){
          $result=$resselt->express;
        }
    }
}


class network_set extends elt_set{
    function network_set($ress,$type='xml',$id=0){
      parent::elt_set($ress, $type, $id, 'network_set');
        if ($type=='xml'){
            $this->read_elements($ress, "nets");
        }
    }
}

class connection extends elt{
    function connection($ress,$type='xml',$id=0){
      parent::elt($ress, $type, $id, 'connection');
      $this->datas['type'] = 'connection';
        if ($type=='xml'){
            xml_read_elements($this, $ress, "connection");
        }
    }
    function xmldump($xml,$curelt){
        $node=$xml->create_element( 'net' );
        foreach($this->datas as $key=>$data){
          if (($data != '--') and ($data != ''))
                $node->set_attribute($key,$data);
        }
        $curelt->append_child($node);
    }
}

class network extends elt{
    function network($ress,$type='xml',$id=0){
      parent::elt($ress,$type,$id);
      if (isset($this->datas['ID']))
      {
        $this->datas['id']=$this->datas['ID'];
        unset($this->datas['ID']);
      }
        if ($type=='xml'){
            xml_read_elements($this, $ress, "net");
        }
    }

    function check_consistency()
    {
        $errmsg = parent::check_consistency();
        if ($errmsg)
            return $errmsg;
        $name = $this->datas['name'];
        if (strpos($name, ' ') !== false)
            return sprintf(_('Spaces are not allowed in a network name ("%s")'), $name);
        return '';
    }

    function xmldump($xml,$curelt){
        $node=$xml->create_element( 'net' );
        foreach($this->datas as $key=>$data){
          if (($data != '--') and ($data != ''))
                $node->set_attribute($key,$data);
        }
        $curelt->append_child($node);
    }
}

class interf extends elt_set{
    function interf($ress,$type='xml',$id=0){
      parent::elt_set($ress, $type, $id, 'interf');
      if (isset($this->datas['ID']))
      {
        $this->datas['id']=$this->datas['ID'];
        unset($this->datas['ID']);
      }
        if ($type=='xml'){
            $this->read_elements($ress, "interface");
        }
    }

    function xmldump($xml,$curelt){
        $node=$xml->create_element( 'interface' );
	if (isset($this->ID))
	  $node->set_attribute('id',$this->ID);
	if (isset($this->name))
	  $node->set_attribute('name',$this->name);
        foreach($this->elts as $key=>$data){
	  if (!isset($data))
	    continue;
	  $data->xmldump($xml,$node);
	  $curelt->append_child($node);
        }
        $curelt->append_child($node);
    }
}


class address extends elt{
    function address($ress,$type='xml',$id=0){
      parent::elt($ress, $type, $id, 'address');
      if (isset($this->datas['ID']))
      {
        $this->datas['id']=$this->datas['ID'];
        unset($this->datas['ID']);
      }
        if ($type=='xml'){
            xml_read_elements($this, $ress, "addr");
        }
    }
    function xmldump($xml,$curelt){
        $node=$xml->create_element( 'addr' );
        foreach($this->datas as $key=>$data){
          if (($data != '--') and ($data != ''))
                $node->set_attribute($key,$data);
        }
        $curelt->append_child($node);
    }
}

?>