| 1 | <?php |
|---|
| 2 | |
|---|
| 3 | // $Id$ |
|---|
| 4 | /********************************************************************\ |
|---|
| 5 | * This program is free software; you can redistribute it and/or * |
|---|
| 6 | * modify it under the terms of the GNU General Public License as * |
|---|
| 7 | * published by the Free Software Foundation; either version 2 of * |
|---|
| 8 | * the License, or (at your option) any later version. * |
|---|
| 9 | * * |
|---|
| 10 | * This program is distributed in the hope that it will be useful, * |
|---|
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
|---|
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
|---|
| 13 | * GNU General Public License for more details. * |
|---|
| 14 | * * |
|---|
| 15 | * You should have received a copy of the GNU General Public License* |
|---|
| 16 | * along with this program; if not, contact: * |
|---|
| 17 | * * |
|---|
| 18 | * Free Software Foundation Voice: +1-617-542-5942 * |
|---|
| 19 | * 59 Temple Place - Suite 330 Fax: +1-617-542-2652 * |
|---|
| 20 | * Boston, MA 02111-1307, USA gnu@gnu.org * |
|---|
| 21 | * * |
|---|
| 22 | \********************************************************************/ |
|---|
| 23 | /**@file index.php Displays the portal page |
|---|
| 24 | * @author Copyright (C) 2004 Benoit Gr�goire et Philippe April |
|---|
| 25 | */ |
|---|
| 26 | |
|---|
| 27 | define('BASEPATH', '../'); |
|---|
| 28 | require_once BASEPATH.'include/common.php'; |
|---|
| 29 | require_once BASEPATH.'include/common_interface.php'; |
|---|
| 30 | require_once BASEPATH.'classes/Node.php'; |
|---|
| 31 | require_once BASEPATH.'classes/MainUI.php'; |
|---|
| 32 | |
|---|
| 33 | if (CONF_USE_CRON_FOR_DB_CLEANUP == false) |
|---|
| 34 | { |
|---|
| 35 | garbage_collect(); |
|---|
| 36 | } |
|---|
| 37 | $node = Node :: getObject($_REQUEST['gw_id']); |
|---|
| 38 | |
|---|
| 39 | if ($node == null) |
|---|
| 40 | { |
|---|
| 41 | $smarty->assign("gw_id", $_REQUEST['gw_id']); |
|---|
| 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 | $tool_html .= "<h1>At this Hotspot</h1>"."\n"; |
|---|
| 58 | $tool_html .= '<p class="indent">'."\n"; |
|---|
| 59 | $tool_html .= "Local content..."."\n"; |
|---|
| 60 | $tool_html .= "</p>"."\n"; |
|---|
| 61 | |
|---|
| 62 | $tool_html .= "<h1>Users Online</h1>"."\n"; |
|---|
| 63 | $tool_html .= '<p class="indent">'."\n"; |
|---|
| 64 | $current_node = Node :: getCurrentNode(); |
|---|
| 65 | if ($current_node != null) |
|---|
| 66 | { |
|---|
| 67 | $current_node_id = $current_node->getId(); |
|---|
| 68 | $online_users = $current_node->getOnlineUsers(); |
|---|
| 69 | $num_online_users = count($online_users); |
|---|
| 70 | if ($num_online_users > 0) |
|---|
| 71 | { |
|---|
| 72 | $tool_html .= $num_online_users.' '._("other users online at this hotspot..."); |
|---|
| 73 | } |
|---|
| 74 | else |
|---|
| 75 | { |
|---|
| 76 | $tool_html .= _("Nobody is online at this hotspot..."); |
|---|
| 77 | } |
|---|
| 78 | } |
|---|
| 79 | else |
|---|
| 80 | { |
|---|
| 81 | $current_node_id = null; |
|---|
| 82 | $tool_html .= _("You are not currently at a hotspot..."); |
|---|
| 83 | } |
|---|
| 84 | $tool_html .= "</p>"."\n"; |
|---|
| 85 | |
|---|
| 86 | $tool_html .= '<p class="indent">'."\n"; |
|---|
| 87 | |
|---|
| 88 | $tool_html .= "<a href='content.php?gw_id={$current_node_id}' target='_blank.right'><img src='/images/start.gif'></a>"."\n"; |
|---|
| 89 | $tool_html .= "</p>"."\n"; |
|---|
| 90 | $ui->setToolContent($tool_html); |
|---|
| 91 | |
|---|
| 92 | $hotspot_network_name = HOTSPOT_NETWORK_NAME; |
|---|
| 93 | $hotspot_network_url = HOTSPOT_NETWORK_URL; |
|---|
| 94 | $network_logo_url = COMMON_CONTENT_URL.NETWORK_LOGO_NAME; |
|---|
| 95 | $network_logo_banner_url = COMMON_CONTENT_URL.NETWORK_LOGO_BANNER_NAME; |
|---|
| 96 | |
|---|
| 97 | $hotspot_logo_url = find_local_content_url(HOTSPOT_LOGO_NAME); |
|---|
| 98 | $hotspot_logo_banner_url = find_local_content_url(HOTSPOT_LOGO_BANNER_NAME); |
|---|
| 99 | |
|---|
| 100 | $html = ''; |
|---|
| 101 | $html .= "<div id='portal_container'>\n"; |
|---|
| 102 | |
|---|
| 103 | /* Network section */ |
|---|
| 104 | $html .= "<div class='portal_network_section'>\n"; |
|---|
| 105 | $html .= "<a href='{$hotspot_network_url}'><img class='portal_section_logo' src='{$network_logo_banner_url}' alt='{$hotspot_network_name} logo' border='0'></a>\n"; |
|---|
| 106 | $html .= "Content from \"<a href='{$hotspot_network_url}'>{$hotspot_network_name}</a>\"\n"; |
|---|
| 107 | $contents = Network :: getCurrentNetwork()->getAllContent(); |
|---|
| 108 | foreach ($contents as $content) |
|---|
| 109 | { |
|---|
| 110 | $html .= $content->getUserUI(); |
|---|
| 111 | } |
|---|
| 112 | $html .= "</div>\n"; |
|---|
| 113 | |
|---|
| 114 | /* Node section */ |
|---|
| 115 | $html .= "<div class='portal_node_section'>\n"; |
|---|
| 116 | $html .= "<img class='portal_section_logo' src='{$hotspot_logo_url}' alt=''>\n"; |
|---|
| 117 | $html .= "Content from "; |
|---|
| 118 | $node_homepage = $node->getHomePageURL(); |
|---|
| 119 | if(!empty($node_homepage)) |
|---|
| 120 | { |
|---|
| 121 | $html .= "<a href='$node_homepage'>"; |
|---|
| 122 | } |
|---|
| 123 | $html .= $node->getName(); |
|---|
| 124 | |
|---|
| 125 | if(!empty($node_homepage)) |
|---|
| 126 | { |
|---|
| 127 | $html .= "</a>\n"; |
|---|
| 128 | } |
|---|
| 129 | $contents = $node->getAllContent(); |
|---|
| 130 | foreach ($contents as $content) |
|---|
| 131 | { |
|---|
| 132 | $html .= $content->getUserUI(); |
|---|
| 133 | } |
|---|
| 134 | $html .= "</div>\n"; |
|---|
| 135 | |
|---|
| 136 | /* User section */ |
|---|
| 137 | $html .= "<div class='portal_user_section'>\n"; |
|---|
| 138 | $html .= _("My content")."\n"; |
|---|
| 139 | $html .= "</div>\n"; |
|---|
| 140 | $html .= "</div>\n"; /* end portal_container */ |
|---|
| 141 | |
|---|
| 142 | $ui->setMainContent($html); |
|---|
| 143 | $ui->display(); |
|---|
| 144 | /* If we have local content, display it. Otherwise, display default */ |
|---|
| 145 | /*if (is_file(NODE_CONTENT_PHP_RELATIVE_PATH.PORTAL_PAGE_NAME)) { |
|---|
| 146 | $smarty->assign("local_content_path", NODE_CONTENT_SMARTY_PATH); |
|---|
| 147 | $smarty->display(NODE_CONTENT_SMARTY_PATH.PORTAL_PAGE_NAME); |
|---|
| 148 | } else { |
|---|
| 149 | $smarty->assign("local_content_path", DEFAULT_CONTENT_SMARTY_PATH); |
|---|
| 150 | $smarty->display(DEFAULT_CONTENT_SMARTY_PATH.PORTAL_PAGE_NAME); |
|---|
| 151 | } |
|---|
| 152 | */ |
|---|
| 153 | ?> |
|---|
| 154 | |
|---|
| 155 | |
|---|