| 1 | <?php |
|---|
| 2 | /********************************************************************\ |
|---|
| 3 | * This program is free software; you can redistribute it and/or * |
|---|
| 4 | * modify it under the terms of the GNU General Public License as * |
|---|
| 5 | * published by the Free Software Foundation; either version 2 of * |
|---|
| 6 | * the License, or (at your option) any later version. * |
|---|
| 7 | * * |
|---|
| 8 | * This program is distributed in the hope that it will be useful, * |
|---|
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
|---|
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
|---|
| 11 | * GNU General Public License for more details. * |
|---|
| 12 | * * |
|---|
| 13 | * You should have received a copy of the GNU General Public License* |
|---|
| 14 | * along with this program; if not, contact: * |
|---|
| 15 | * * |
|---|
| 16 | * Free Software Foundation Voice: +1-617-542-5942 * |
|---|
| 17 | * 59 Temple Place - Suite 330 Fax: +1-617-542-2652 * |
|---|
| 18 | * Boston, MA 02111-1307, USA gnu@gnu.org * |
|---|
| 19 | * * |
|---|
| 20 | \********************************************************************/ |
|---|
| 21 | /**@file index.php Displays all the content associated to a hotspot |
|---|
| 22 | * @author Copyright (C) 2005 François Proulx |
|---|
| 23 | */ |
|---|
| 24 | |
|---|
| 25 | define('BASEPATH', '../'); |
|---|
| 26 | require_once BASEPATH.'include/common.php'; |
|---|
| 27 | require_once BASEPATH.'include/common_interface.php'; |
|---|
| 28 | require_once BASEPATH.'classes/Node.php'; |
|---|
| 29 | require_once BASEPATH.'classes/MainUI.php'; |
|---|
| 30 | |
|---|
| 31 | if (CONF_USE_CRON_FOR_DB_CLEANUP == false) |
|---|
| 32 | { |
|---|
| 33 | garbage_collect(); |
|---|
| 34 | } |
|---|
| 35 | |
|---|
| 36 | $node = null; |
|---|
| 37 | if(!empty($_REQUEST['gw_id'])) |
|---|
| 38 | $node = Node :: getObject($_REQUEST['gw_id']); |
|---|
| 39 | |
|---|
| 40 | if ($node == null) |
|---|
| 41 | { |
|---|
| 42 | $smarty->display("templates/message_unknown_hotspot.html"); |
|---|
| 43 | exit; |
|---|
| 44 | } |
|---|
| 45 | |
|---|
| 46 | $node_id = $node->getId(); |
|---|
| 47 | $portal_template = $node_id.".html"; |
|---|
| 48 | Node :: setCurrentNode($node); |
|---|
| 49 | |
|---|
| 50 | $ui = new MainUI(); |
|---|
| 51 | if (isset ($session)) |
|---|
| 52 | { |
|---|
| 53 | $smarty->assign("original_url_requested", $session->get(SESS_ORIGINAL_URL_VAR)); |
|---|
| 54 | } |
|---|
| 55 | |
|---|
| 56 | $tool_html = ''; |
|---|
| 57 | |
|---|
| 58 | //TODO: Write this |
|---|
| 59 | /* |
|---|
| 60 | $tool_html .= "<h1>"._("At this Hotspot")."</h1>"."\n"; |
|---|
| 61 | $tool_html .= '<p class="indent">'."\n"; |
|---|
| 62 | $tool_html .= _("Local content...")."\n"; |
|---|
| 63 | $tool_html .= "</p>"."\n";*/ |
|---|
| 64 | |
|---|
| 65 | $tool_html .= "<h1>"._("Online users")."</h1>"."\n"; |
|---|
| 66 | $tool_html .= '<p class="indent">'."\n"; |
|---|
| 67 | $current_node = Node :: getCurrentNode(); |
|---|
| 68 | if ($current_node != null) |
|---|
| 69 | { |
|---|
| 70 | $current_node_id = $current_node->getId(); |
|---|
| 71 | $online_users = $current_node->getOnlineUsers(); |
|---|
| 72 | $num_online_users = count($online_users); |
|---|
| 73 | if ($num_online_users > 0) |
|---|
| 74 | { |
|---|
| 75 | //$tool_html .= $num_online_users.' '._("other users online at this hotspot..."); |
|---|
| 76 | $tool_html .= "<ul class='users_list'>\n"; |
|---|
| 77 | foreach($online_users as $online_user) |
|---|
| 78 | $tool_html .= "<li>{$online_user->getUsername()}</li>\n"; |
|---|
| 79 | $tool_html .= "</ul>\n"; |
|---|
| 80 | } |
|---|
| 81 | else |
|---|
| 82 | { |
|---|
| 83 | $tool_html .= _("Nobody is online at this hotspot..."); |
|---|
| 84 | } |
|---|
| 85 | } |
|---|
| 86 | else |
|---|
| 87 | { |
|---|
| 88 | $current_node_id = null; |
|---|
| 89 | $tool_html .= _("You are not currently at a hotspot..."); |
|---|
| 90 | } |
|---|
| 91 | $tool_html .= "</p>"."\n"; |
|---|
| 92 | |
|---|
| 93 | |
|---|
| 94 | $tool_html .= '<p class="indent">'."\n"; |
|---|
| 95 | |
|---|
| 96 | $tool_html .= "<a href='content.php?gw_id={$current_node_id}' target='_blank.right'><img src='/images/start.gif'></a>"."\n"; |
|---|
| 97 | $tool_html .= "</p>"."\n"; |
|---|
| 98 | $ui->setToolContent($tool_html); |
|---|
| 99 | |
|---|
| 100 | $hotspot_network_name = HOTSPOT_NETWORK_NAME; |
|---|
| 101 | $hotspot_network_url = HOTSPOT_NETWORK_URL; |
|---|
| 102 | $network_logo_url = COMMON_CONTENT_URL.NETWORK_LOGO_NAME; |
|---|
| 103 | $network_logo_banner_url = COMMON_CONTENT_URL.NETWORK_LOGO_BANNER_NAME; |
|---|
| 104 | |
|---|
| 105 | $hotspot_logo_url = find_local_content_url(HOTSPOT_LOGO_NAME); |
|---|
| 106 | $hotspot_logo_banner_url = find_local_content_url(HOTSPOT_LOGO_BANNER_NAME); |
|---|
| 107 | |
|---|
| 108 | $html = ''; |
|---|
| 109 | $html .= "<div id='portal_container'>\n"; |
|---|
| 110 | |
|---|
| 111 | /* Node section */ |
|---|
| 112 | $html .= "<div class='portal_node_section'>\n"; |
|---|
| 113 | $html .= "<img class='portal_section_logo' src='{$hotspot_logo_url}' alt=''>\n"; |
|---|
| 114 | $html .= "<span class='portal_section_title'>"._("Content from:")."</span>"; |
|---|
| 115 | |
|---|
| 116 | $node_homepage = $node->getHomePageURL(); |
|---|
| 117 | if(!empty($node_homepage)) |
|---|
| 118 | { |
|---|
| 119 | $html .= "<a href='$node_homepage'>"; |
|---|
| 120 | } |
|---|
| 121 | $html .= $node->getName(); |
|---|
| 122 | if(!empty($node_homepage)) |
|---|
| 123 | { |
|---|
| 124 | $html .= "</a>\n"; |
|---|
| 125 | } |
|---|
| 126 | |
|---|
| 127 | // Get all locative artistic content for this node |
|---|
| 128 | $contents = $node->getAllLocativeArtisticContent(); |
|---|
| 129 | $html .= "<ul>\n"; |
|---|
| 130 | foreach ($contents as $content) |
|---|
| 131 | { |
|---|
| 132 | $html .= "<li>\n"; |
|---|
| 133 | $html .= $content->getUserUI(); |
|---|
| 134 | $html .= "</li>\n"; |
|---|
| 135 | } |
|---|
| 136 | $html .= "</ul>\n"; |
|---|
| 137 | |
|---|
| 138 | $html .= "</div>\n"; |
|---|
| 139 | |
|---|
| 140 | $ui->setMainContent($html); |
|---|
| 141 | $ui->display(); |
|---|
| 142 | |
|---|
| 143 | ?> |
|---|