root/wifidogadmin/wifidog/hotspot_status.php

Revision 479, 4.9 kB (checked in by insultant, 8 months ago)

--

Line 
1 <?php
2
3 /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
4
5 // +-------------------------------------------------------------------+
6 // | WiFiDog Authentication Server                                     |
7 // | =============================                                     |
8 // |                                                                   |
9 // | The WiFiDog Authentication Server is part of the WiFiDog captive  |
10 // | portal suite.                                                     |
11 // +-------------------------------------------------------------------+
12 // | PHP version 5 required.                                           |
13 // +-------------------------------------------------------------------+
14 // | Homepage:     http://www.wifidog.org/                             |
15 // | Source Forge: http://sourceforge.net/projects/wifidog/            |
16 // +-------------------------------------------------------------------+
17 // | This program is free software; you can redistribute it and/or     |
18 // | modify it under the terms of the GNU General Public License as    |
19 // | published by the Free Software Foundation; either version 2 of    |
20 // | the License, or (at your option) any later version.               |
21 // |                                                                   |
22 // | This program is distributed in the hope that it will be useful,   |
23 // | but WITHOUT ANY WARRANTY; without even the implied warranty of    |
24 // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the     |
25 // | GNU General Public License for more details.                      |
26 // |                                                                   |
27 // | You should have received a copy of the GNU General Public License |
28 // | along with this program; if not, contact:                         |
29 // |                                                                   |
30 // | Free Software Foundation           Voice:  +1-617-542-5942        |
31 // | 59 Temple Place - Suite 330        Fax:    +1-617-542-2652        |
32 // | Boston, MA  02111-1307,  USA       gnu@gnu.org                    |
33 // |                                                                   |
34 // +-------------------------------------------------------------------+
35
36 /**
37  * Network status page
38  *
39  * @package    WiFiDogAuthServer
40  * @author     Benoit Grégoire <bock@step.polymtl.ca>
41  * @author     Francois Proulx <francois.proulx@gmail.com>
42  * @author     Max Horváth <max.horvath@freenet.de>
43  * @copyright  2004-2007 Benoit Grégoire, Technologies Coeus inc.
44  * @copyright  2004-2006 Francois Proulx, Technologies Coeus inc.
45  * @copyright  2006 Max Horváth, Horvath Web Consulting
46  * @version    Subversion $Id: hotspot_status.php 1253 2007-07-16 05:11:27Z benoitg $
47  * @link       http://www.wifidog.org/
48  */
49
50 /**
51  * Load required files
52  */
53 require_once(dirname(__FILE__) . '/include/common.php');
54
55 require_once('classes/SmartyWifidog.php');
56 require_once('classes/Network.php');
57 require_once('classes/NodeList.php');
58 $smarty = SmartyWifidog::getObject();
59 $db = AbstractDb::getObject();
60 if (!empty ($_REQUEST['format'])) {
61     $format = $db->escapeString($_REQUEST['format']);
62 } else {
63     $format = "HTML";
64 }
65
66 if (!empty ($_REQUEST['network_id'])) {
67     $network = Network::getObject($db->escapeString($_REQUEST['network_id']));
68 } else {
69     $network = Network::getDefaultNetwork(true);
70 }
71
72 if ($network) {
73     // Init node list type
74     $nodeList = NodeList::getObject($format, $network);
75     /**
76      * XSLT support for Hotspot status page
77      * ====================================
78      *
79      * If you want to enable XSLT support for the Hotspot status page enable this
80      * value.
81      *
82      * Enabling it will let you you display hostpot status in any format.
83      * http://server_ip/hotspot_status.php?format=XML&xslt=http://xslt_server/xslt/wifidog_status.xsl
84      */
85     // If a XSL transform stylesheet has been specified, try to use it.
86     if ($format == "XML" && !empty($_REQUEST['xslt'])) {
87         if(Dependency::check("xsl")) {// Load the XSLT
88             if($xslt_dom = @DomDocument::load($_REQUEST['xslt']) === false) {
89                 echo sprintf("Unable to load XSTL : %s", $_REQUEST['xslt']);
90             }
91             else {
92                 $xslt_proc = new XsltProcessor();
93                 $xslt_proc->importStyleSheet($xslt_dom);
94
95                 // Prepare HTML
96                 header("Content-Type: text/html; charset=UTF-8");
97                 echo $xslt_proc->transformToXML($nodeList->getOutput(true));
98             }
99         }
100         else {
101             $dep = Dependency::getObject("xsl");
102             echo sprintf("Missing dependency: %s: %s", $dep->getId(), $dep->getDescription());
103         }
104     } else {
105         // Deliver node list
106         $nodeList->getOutput();
107     }
108 }
109
110 /*
111  * Local variables:
112  * tab-width: 4
113  * c-basic-offset: 4
114  * c-hanging-comment-ender-p: nil
115  * End:
116  */
117
118 ?>
Note: See TracBrowser for help on using the browser.