<?php
   /*
    * phpUA
    * United Admins © 2004
    * http://www.unitedadmins.com/
    *
    * 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; either version 2
    * of the License, or (at your option) any later version.
    *
    * 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, write to the Free Software
    * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
    *
    */
    
    // $Id: plugin_q3_mode_rules.inc,v 1.3 2004/02/26 10:15:18 mad-x Exp $
    // Created by Hendrik Leppkes (punisher@unitedadmins.com)
    
    pluginRegisterMode("Q3", "rules", $phpUA["LANGUAGE"]["Rules"], "plugin_q3_mode_rules", 1, 1, 0, "plugin_q3_mode_rules.inc");
    
    function plugin_q3_mode_rules($id, $ip, $port)
    {
        startBenchmark(__FILE__, __FUNCTION__);
        
        global $phpUA;
        require_once(ABSOLUTEPATH . "plugins/shared/plugin_q3_query.inc");
        $server_query = new plugin_q3_query($ip, $port);
        
        $phpUA["TEMPLATE"]->assign("SERVER_ID", $id);
        $phpUA["TEMPLATE"]->assign("SERVER_IP", $ip);
        $phpUA["TEMPLATE"]->assign("SERVER_PORT", $port);
        
        if (!$status = $server_query->getstatus()) displayErrorMessage($phpUA["LANGUAGE"]["ConnectionTimeout"] . "<br>(" . basename(__FILE__) . ":" . __LINE__ . ")");
        $phpUA["TEMPLATE"]->assign("SERVER_HOSTNAME", $status["sv_hostname"]);
        
        foreach ($status as $key => $value) {
            $rules_array[] = array("rule"=>$key,
                                   "value"=>$value);
        }
        $phpUA["TEMPLATE"]->assign("SERVER_RULES", $rules_array);
        
        $phpUA["TEMPLATE"]->display($phpUA["STYLE"] . "/plugin_q3/rules.tpl");
        
        endBenchmark(__FILE__, __FUNCTION__);
    }
?>