Sophie

Sophie

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

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: misc.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_set.class.php');

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

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

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

    function xmldump($xml,$node){
        $node->set_attribute('name',$this->name);
        $node->set_attribute('ID',$this->ID);
        foreach ($this->elts as $elt){
                $elt->xmldump($xml,$node);
        }
    }
}

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

    function usage($ruleset)
    {
        $usage = Array();
        foreach ($ruleset->protocols->elts as $proto)
        {
            foreach($proto->elts as $protoelt)
            {
                if (array_get($protoelt->datas, 'l7rule') == $this->ID)
                {
                    $usage[] = $proto;
                }
            }
        }
        if (count($usage) == 0)
            return null;
        $urls = Array();
        foreach($usage as $proto)
        {
            $url = "protocols.php?elt=" . $proto->ID;
            $text = $proto->str();
            $urls[] = createLink($url, $text);
        }
        return implode(', ', $urls);
    }
}

?>