| 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 | * Displays all the content associated to a hotspot |
|---|
| 38 | * |
|---|
| 39 | * @package WiFiDogAuthServer |
|---|
| 40 | * @author Francois Proulx <francois.proulx@gmail.com> |
|---|
| 41 | * @copyright 2005-2006 Francois Proulx, Technologies Coeus inc. |
|---|
| 42 | * @version Subversion $Id$ |
|---|
| 43 | * @link http://www.wifidog.org/ |
|---|
| 44 | */ |
|---|
| 45 | |
|---|
| 46 | /** |
|---|
| 47 | * Load required files |
|---|
| 48 | */ |
|---|
| 49 | require_once('../include/common.php'); |
|---|
| 50 | |
|---|
| 51 | require_once('classes/MainUI.php'); |
|---|
| 52 | require_once('include/common_interface.php'); |
|---|
| 53 | require_once('classes/Node.php'); |
|---|
| 54 | |
|---|
| 55 | if (CONF_USE_CRON_FOR_DB_CLEANUP == false) |
|---|
| 56 | { |
|---|
| 57 | garbage_collect(); |
|---|
| 58 | } |
|---|
| 59 | |
|---|
| 60 | $node = null; |
|---|
| 61 | if(!empty($_REQUEST['gw_id'])) |
|---|
| 62 | $node = Node :: getObject($_REQUEST['gw_id']); |
|---|
| 63 | |
|---|
| 64 | if ($node == null) { |
|---|
| 65 | $ui = new MainUI(); |
|---|
| 66 | $ui->displayError(_("No Hotspot specified!")); |
|---|
| 67 | exit; |
|---|
| 68 | } |
|---|
| 69 | |
|---|
| 70 | $node_id = $node->getId(); |
|---|
| 71 | $portal_template = $node_id.".html"; |
|---|
| 72 | Node :: setCurrentNode($node); |
|---|
| 73 | |
|---|
| 74 | $ui = new MainUI(); |
|---|
| 75 | if (isset ($session)) |
|---|
| 76 | { |
|---|
| 77 | $smarty->assign("original_url_requested", $session->get(SESS_ORIGINAL_URL_VAR)); |
|---|
| 78 | } |
|---|
| 79 | |
|---|
| 80 | $tool_html = ''; |
|---|
| 81 | |
|---|
| 82 | $tool_html .= "<h1>"._("Online users")."</h1>"."\n"; |
|---|
| 83 | $tool_html .= '<p class="indent">'."\n"; |
|---|
| 84 | $current_node = Node :: getCurrentNode(); |
|---|
| 85 | if ($current_node != null) |
|---|
| 86 | { |
|---|
| 87 | $current_node_id = $current_node->getId(); |
|---|
| 88 | $online_users = $current_node->getOnlineUsers(); |
|---|
| 89 | $num_online_users = count($online_users); |
|---|
| 90 | if ($num_online_users > 0) |
|---|
| 91 | { |
|---|
| 92 | //$tool_html .= $num_online_users.' '._("other users online at this hotspot..."); |
|---|
| 93 | $tool_html .= "<ul class='users_list'>\n"; |
|---|
| 94 | foreach($online_users as $online_user) |
|---|
| 95 | $tool_html .= "<li>{$online_user->getUsername()}</li>\n"; |
|---|
| 96 | $tool_html .= "</ul>\n"; |
|---|
| 97 | } |
|---|
| 98 | else |
|---|
| 99 | { |
|---|
| 100 | $tool_html .= _("Nobody is online at this hotspot..."); |
|---|
| 101 | } |
|---|
| 102 | } |
|---|
| 103 | else |
|---|
| 104 | { |
|---|
| 105 | $current_node_id = null; |
|---|
| 106 | $tool_html .= _("You are not currently at a hotspot..."); |
|---|
| 107 | } |
|---|
| 108 | $tool_html .= "</p>"."\n"; |
|---|
| 109 | |
|---|
| 110 | |
|---|
| 111 | /* |
|---|
| 112 | $tool_html .= '<p class="indent">'."\n"; |
|---|
| 113 | $tool_html .= "<a href='content.php?gw_id={$current_node_id}' target='_blank.right'><img src='/images/start.gif'></a>"."\n"; |
|---|
| 114 | $tool_html .= "</p>"."\n"; |
|---|
| 115 | */ |
|---|
| 116 | $ui->setToolContent($tool_html); |
|---|
| 117 | |
|---|
| 118 | |
|---|
| 119 | $html = ''; |
|---|
| 120 | $html .= "<div id='portal_container'>\n"; |
|---|
| 121 | |
|---|
| 122 | /* Node section */ |
|---|
| 123 | // Get all locative artistic content for this node |
|---|
| 124 | $contents = $node->getAllLocativeArtisticContent(); |
|---|
| 125 | if(!empty($contents)) |
|---|
| 126 | { |
|---|
| 127 | $html .= "<div class='portal_node_section'>\n"; |
|---|
| 128 | $html .= "<span class='portal_section_title'>"._("Content from:")." "; |
|---|
| 129 | |
|---|
| 130 | $node_homepage = $node->getHomePageURL(); |
|---|
| 131 | if(!empty($node_homepage)) |
|---|
| 132 | { |
|---|
| 133 | $html .= "<a href='$node_homepage'>"; |
|---|
| 134 | } |
|---|
| 135 | $html .= $node->getName(); |
|---|
| 136 | if(!empty($node_homepage)) |
|---|
| 137 | { |
|---|
| 138 | $html .= "</a>\n"; |
|---|
| 139 | } |
|---|
| 140 | $html .= "</span>"; |
|---|
| 141 | |
|---|
| 142 | foreach ($contents as $content) |
|---|
| 143 | { |
|---|
| 144 | $html .= "<div class='portal_content'>\n"; |
|---|
| 145 | $html .= $content->getUserUI(); |
|---|
| 146 | $html .= "</div>"; |
|---|
| 147 | } |
|---|
| 148 | $html .= "</div>\n"; |
|---|
| 149 | } |
|---|
| 150 | |
|---|
| 151 | $ui->setMainContent($html); |
|---|
| 152 | $ui->display(); |
|---|
| 153 | |
|---|
| 154 | /* |
|---|
| 155 | * Local variables: |
|---|
| 156 | * tab-width: 4 |
|---|
| 157 | * c-basic-offset: 4 |
|---|
| 158 | * c-hanging-comment-ender-p: nil |
|---|
| 159 | * End: |
|---|
| 160 | */ |
|---|
| 161 | |
|---|
| 162 | ?> |
|---|