root/trunk/wifidog-auth/wifidog/hotspot_status.php

Revision 1421, 5.0 KB (checked in by benoitg, 4 years ago)

Update my email address

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
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 <benoitg@coeus.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$
47 * @link       http://www.wifidog.org/
48 */
49
50/**
51 * Load required files
52 */
53require_once(dirname(__FILE__) . '/include/common.php');
54
55require_once('classes/SmartyWifidog.php');
56require_once('classes/Network.php');
57require_once('classes/NodeList.php');
58$smarty = SmartyWifidog::getObject();
59$db = AbstractDb::getObject();
60if (!empty ($_REQUEST['format'])) {
61    $format = $db->escapeString($_REQUEST['format']);
62} else {
63    $format = "HTML";
64}
65
66if (isset ($_REQUEST["network_id"])) {
67        $network_id = $_REQUEST["network_id"];
68    if($network_id == ""){
69        $network = null;
70    } else {
71        try {
72            $network = Network::getObject($network_id);
73        } catch (Exception $e) {
74            $network = Network::getDefaultNetwork();
75        }
76    }
77} else {
78        $network = Network::getDefaultNetwork();
79}
80
81if ($network or NodeList::getAllowsNullNetwork($format)) {
82    // Init node list type
83    $nodeList = NodeList::getObject($format, $network);
84    /**
85     * XSLT support for Hotspot status page
86     * ====================================
87     *
88     * If you want to enable XSLT support for the Hotspot status page enable this
89     * value.
90     *
91     * Enabling it will let you you display hostpot status in any format.
92     * http://server_ip/hotspot_status.php?format=XML&xslt=http://xslt_server/xslt/wifidog_status.xsl
93     */
94    // If a XSL transform stylesheet has been specified, try to use it.
95    if ($format == "XML" && !empty($_REQUEST['xslt'])) {
96        if(Dependency::check("xsl")) {// Load the XSLT
97            if(($xslt_dom = @DomDocument::load(trim($_REQUEST['xslt']))) === false) {
98                echo sprintf("Unable to load XSTL : %s", $_REQUEST['xslt']);
99            }
100            else {
101                $xslt_proc = new XSLTProcessor();
102                $xslt_proc->importStyleSheet($xslt_dom);
103
104                // Prepare HTML
105                header("Content-Type: text/html; charset=UTF-8");
106                echo $xslt_proc->transformToXML($nodeList->getOutput(true));
107            }
108        }
109        else {
110            $dep = Dependency::getObject("xsl");
111            echo sprintf("Missing dependency: %s: %s", $dep->getId(), $dep->getDescription());
112        }
113    } else {
114        // Deliver node list
115        $nodeList->getOutput();
116    }
117}
118
119/*
120 * Local variables:
121 * tab-width: 4
122 * c-basic-offset: 4
123 * c-hanging-comment-ender-p: nil
124 * End:
125 */
126
127?>
Note: See TracBrowser for help on using the browser.