Show
Ignore:
Timestamp:
12/26/05 05:43:56 (7 years ago)
Author:
max-horvath
Message:

2005-12-26 Max Horvath <max.horvath@…>

  • added new headers to every source file
  • converted file to represent a tab as four (4) spaces
  • added PhpDocumentor? documentation
  • added WiFiDog skin to HTMLeditor
  • language selection in a content class now shows the language name instead of the language code
  • added caching support to content classes Langstring and TrivialLangstring?
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/wifidog-auth/wifidog/classes/MainUI.php

    r828 r866  
    11<?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 MainUI.php 
    22  * @author Copyright (C) 2005 Technologies Coeus inc. 
     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 * @package    WiFiDogAuthServer 
     38 * @author     Benoit Gregoire <bock@step.polymtl.ca> 
     39 * @copyright  2005 Benoit Gregoire <bock@step.polymtl.ca> - Technologies Coeus 
     40 * inc. 
     41 * @version    CVS: $Id$ 
     42 * @link       http://sourceforge.net/projects/wifidog/ 
    2343 */ 
     44 
    2445require_once BASEPATH.'include/common.php'; 
    2546/** @note We put a call to validate_schema() here so it systematically called 
    26 * from any UI page, but not from any machine readable pages  
     47* from any UI page, but not from any machine readable pages 
    2748*/ 
    2849require_once BASEPATH.'include/schema_validate.php'; 
     
    3152if (CONF_USE_CRON_FOR_DB_CLEANUP == false) 
    3253{ 
    33         garbage_collect(); 
     54    garbage_collect(); 
    3455} 
    3556 
     
    4061class MainUI 
    4162{ 
    42         private $main_content; /**<Content to be displayed in the main pane */ 
    43         private $tool_content; /**<Content to be displayed in the tool pane */ 
    44         private $smarty; 
    45         private $title; 
    46         private $html_headers; 
    47         private $tool_section_enabled = true; 
    48         private $footer_scripts = array (); 
    49  
    50         function __construct() 
    51         { 
    52                 $this->smarty = new SmartyWifidog(); 
    53                 $this->title = Network :: getCurrentNetwork()->getName().' '._("authentication server"); //Default title 
    54         } 
    55  
    56         /** Check if the tool section is enabled 
    57          *  
    58         */ 
    59         public function isToolSectionEnabled() 
    60         { 
    61                 return $this->tool_section_enabled; 
    62         } 
    63  
    64         public function setToolSectionEnabled($status) 
    65         { 
    66                 $this->tool_section_enabled = $status; 
    67         } 
    68  
    69         /** Set the content to be displayed in the main pane */ 
    70         public function setMainContent($html) 
    71         { 
    72                 $this->main_content = $html; 
    73         } 
    74  
    75         /** Set the title of the page */ 
    76         public function setTitle($title_string) 
    77         { 
    78                 $this->title = $title_string; 
    79         } 
    80  
    81         /** Add content at the very end of the <body>.  This is NOT meant to add footers or other display content, it is meant to add <script></script> tag pairs that have to be executed only once the page is loaded. 
    82         * @param $script A piece of script surrounded by <script></script> tags. */ 
    83         public function addFooterScript($script) 
    84         { 
    85                 $this->footer_scripts[] = $script; 
    86         } 
    87  
    88         /** Set the HTML page headers */ 
    89         public function setHtmlHeader($headers_string) 
    90         { 
    91                 $this->html_headers = $headers_string; 
    92         } 
    93  
    94         /** Set the section to be displayed in the tool pane */ 
    95         public function setToolSection($section) 
    96         { 
    97                 switch ($section) 
    98                 { 
    99                         case "ADMIN" : 
    100                                 $current_user = User :: getCurrentUser(); 
    101                                 $html = ''; 
    102  
    103                                 if ($current_user && $current_user->isNobody()) 
    104                                 { 
    105                                         $html .= _("You do not have permissions to access any administration functions."); 
    106                                 } 
    107                                 else 
    108                                 { 
    109  
    110                                         if ($current_user && $current_user->isSuperAdmin()) 
    111                                         { 
    112                                                 $html .= "<li><a href='user_log.php'>"._("User logs")."</a></li>\n"; 
    113                                                 $html .= "<li><a href='online_users.php'>"._("Online Users")."</a></li>\n"; 
    114                                                 $html .= "<li><a href='stats.php'>"._("Statistics")."</a></li>\n"; 
    115                                                 $html .= "<li><a href='import_user_database.php'>"._("Import NoCat user database")."</a></li>\n"; 
    116                                                 $html .= "<li><a href='content_admin.php'>"._("Content manager")."</a></li>\n"; 
    117                                         } 
    118  
    119                                         $html .= "</ul>\n"; 
    120  
    121                                         // If the user is super admin OR owner of at least one hotspot show the menu 
    122                                         if ($current_user && ($current_user->isSuperAdmin() || $current_user->isOwner())) 
    123                                         { 
    124                                                 /* Node admin */ 
    125                                                 $html .= "<div class='admin_section_container'>\n"; 
    126                                                 $html .= '<form action="'.GENERIC_OBJECT_ADMIN_ABS_HREF.'" method="post">'; 
    127                                                 $html .= "<div class='admin_section_title'>"._("Node administration:")." </div>\n"; 
    128  
    129                                                 $html .= "<div class='admin_section_data'>\n"; 
    130  
    131                                                 if ($current_user->isSuperAdmin()) 
    132                                                         $sql_additional_where = ''; 
    133                                                 else 
    134                                                         $sql_additional_where = "AND node_id IN (SELECT node_id from node_stakeholders WHERE is_owner = true AND user_id='".$current_user->getId()."')"; 
    135                                                 $html .= "<div id='NodeSelector'>\n"; 
    136                                                 $html .= Node :: getSelectNodeUI('object_id', $sql_additional_where); 
    137                                                 $html .= "</div>\n"; 
    138                                                 $html .= "</div>\n"; 
    139                                                 $html .= "<div class='admin_section_tools'>\n"; 
    140                                                 $html .= "<input type='hidden' name='object_class' value='Node'>\n"; 
    141                                                 $html .= "<input type='hidden' name='action' value='edit'>\n"; 
    142                                                 $html .= "<input type='submit' name='edit_submit' value='"._("Edit")."'>\n"; 
    143                                                 $html .= '</form>'; 
    144                                                  
    145                                                 if($current_user->isSuperAdmin()) 
    146                                                 { 
    147                                                         $html .= '<form action="'.GENERIC_OBJECT_ADMIN_ABS_HREF.'" method="post">'; 
    148                                                         $html .= "<input type='hidden' name='action' value='new_ui'>\n"; 
    149                                                         $html .= "<input type='hidden' name='object_class' value='Node'>\n"; 
    150                                                         $html .= "<input type=submit name='new_submit' value='"._("Create")."'>\n"; 
    151                                                         $html .= "</form>\n"; 
    152                                                          
    153                                                 } 
    154                                                 $html .= "</div>\n"; 
    155                                                 $html .= "</div>\n"; 
    156                                         } 
    157  
    158                                         /* Network admin */ 
    159                                         if ($current_user && $current_user->isSuperAdmin()) 
    160                                         { 
    161                                                 $html .= "<div class='admin_section_container'>\n"; 
    162                                                 $html .= '<form action="'.GENERIC_OBJECT_ADMIN_ABS_HREF.'" method="post">'; 
    163                                                 $html .= "<div class='admin_section_title'>"._("Network administration:")." </div>\n"; 
    164  
    165                                                 $html .= "<div class='admin_section_data'>\n"; 
    166                                                 $html .= "<input type='hidden' name='action' value='edit'>\n"; 
    167                                                 $html .= "<input type='hidden' name='object_class' value='Network'><br>\n"; 
    168                                                 $html .= Network :: getSelectNetworkUI('object_id'); 
    169                                                 $html .= "</div>\n"; 
    170                                                 $html .= "<div class='admin_section_tools'>\n"; 
    171                                                 $html .= "<input type=submit name='edit_submit' value='"._("Edit")."'>\n"; 
    172                                                 $html .= "</form>\n"; 
    173                                                 $html .= '<form action="'.GENERIC_OBJECT_ADMIN_ABS_HREF.'" method="post">'; 
    174                                                 $html .= "<input type='hidden' name='action' value='new_ui'>\n"; 
    175                                                 $html .= "<input type='hidden' name='object_class' value='Network'>\n"; 
    176                                                 $html .= "<input type=submit name='new_submit' value='"._("Create")."'>\n"; 
    177                                                 $html .= "</form>\n"; 
    178                                                 $html .= "</div>\n"; 
    179                                                 $html .= "</div>\n"; 
    180                                         } 
    181                                 } 
    182                                 break; 
    183                         default : 
    184                                 $html .= "<p class='errormsg'>"._("Unknown section:")." $section</p>\n"; 
    185  
    186                 } 
    187                 $this->tool_content = $html; 
    188         } 
    189  
    190         /** Set the content to be displayed in the tool pane */ 
    191         public function setToolContent($html) 
    192         { 
    193                 $this->tool_content = $html; 
    194         } 
    195  
    196         /** Get the content to be displayed in the tool pane 
    197          * @param section, one of:  START, LOGIN,  
    198         * @return HTML markup */ 
    199         private function getToolContent($section = 'START') 
    200         { 
    201                 global $session; 
    202                 $html = ''; 
    203                 switch ($section) 
    204                 { 
    205                         case "NONE" : 
    206                                 break; 
    207                         case "LOGIN" : 
    208                                 break; 
    209                         case "START" : 
    210                                 $html .= '<div id="tool_section">'."\n"; 
    211                                 $html .= '<div class="tool_user_info">'."\n"; 
    212                                 $html .= '<span class="tool_user_info">'."\n"; 
    213                                 $user = User :: getCurrentUser(); 
    214                                 if ($user != null) 
    215                                 { 
    216                                         $html .= '<p>'._("Logged in as:").' '.$user->getUsername().'</p>'."\n"; 
    217                                         $html .= '<a class="administration" HREF="'.BASE_SSL_PATH.'user_profile.php"><img class="administration" src="'.BASE_SSL_PATH.'images/profile.gif" border="0"> '._("My Profile").'</a>'."\n"; 
    218  
    219                                         $gw_id = $session->get(SESS_GW_ID_VAR); 
    220                                         $gw_address = $session->get(SESS_GW_ADDRESS_VAR); 
    221                                         $gw_port = $session->get(SESS_GW_PORT_VAR); 
    222  
    223                                         if ($gw_id && $gw_address && $gw_port) 
    224                                                 $html .= '<a class="administration" HREF="'.BASE_SSL_PATH.'login/?logout=true&gw_id='.$gw_id.'&gw_address='.$gw_address.'&gw_port='.$gw_port.'"><img class="administration" src="'.BASE_SSL_PATH.'images/logout.gif" border="0"> '._("Logout").'</a>'."\n"; 
    225                                         else 
    226                                                 $html .= '<a class="administration" HREF="'.BASE_SSL_PATH.'login/?logout=true"><img class="administration" src="'.BASE_SSL_PATH.'images/logout.gif" border="0"> '._("Logout").'</a>'."\n"; 
    227  
    228                                 } 
    229                                 else 
    230                                 { 
    231                                         $gw_id = !empty ($_REQUEST['gw_id']) ? $_REQUEST['gw_id'] : $session->get(SESS_GW_ID_VAR); 
    232                                         $gw_address = !empty ($_REQUEST['gw_address']) ? $_REQUEST['gw_address'] : $session->get(SESS_GW_ADDRESS_VAR); 
    233                                         $gw_port = !empty ($_REQUEST['gw_port']) ? $_REQUEST['gw_port'] : $session->get(SESS_GW_PORT_VAR); 
    234  
    235                                         // If the user connects physically ( through a gateway don't show the confusing login message )  
    236                                         if (empty ($gw_id) || empty ($gw_address) || empty ($gw_port)) 
    237                                                 $href = BASE_SSL_PATH.'login/'; 
    238                                         else 
    239                                                 $href = BASE_SSL_PATH.'login/?gw_id='.$gw_id.'&gw_address='.$gw_address.'&gw_port='.$gw_port; 
     63    private $main_content; /**<Content to be displayed in the main pane */ 
     64    private $tool_content; /**<Content to be displayed in the tool pane */ 
     65    private $smarty; 
     66    private $title; 
     67    private $html_headers; 
     68    private $tool_section_enabled = true; 
     69    private $footer_scripts = array (); 
     70 
     71    function __construct() 
     72    { 
     73        $this->smarty = new SmartyWifidog(); 
     74        $this->title = Network :: getCurrentNetwork()->getName().' '._("authentication server"); //Default title 
     75    } 
     76 
     77    /** Check if the tool section is enabled 
     78     * 
     79    */ 
     80    public function isToolSectionEnabled() 
     81    { 
     82        return $this->tool_section_enabled; 
     83    } 
     84 
     85    public function setToolSectionEnabled($status) 
     86    { 
     87        $this->tool_section_enabled = $status; 
     88    } 
     89 
     90    /** Set the content to be displayed in the main pane */ 
     91    public function setMainContent($html) 
     92    { 
     93        $this->main_content = $html; 
     94    } 
     95 
     96    /** Set the title of the page */ 
     97    public function setTitle($title_string) 
     98    { 
     99        $this->title = $title_string; 
     100    } 
     101 
     102    /** Add content at the very end of the <body>.  This is NOT meant to add footers or other display content, it is meant to add <script></script> tag pairs that have to be executed only once the page is loaded. 
     103    * @param $script A piece of script surrounded by <script></script> tags. */ 
     104    public function addFooterScript($script) 
     105    { 
     106        $this->footer_scripts[] = $script; 
     107    } 
     108 
     109    /** Set the HTML page headers */ 
     110    public function setHtmlHeader($headers_string) 
     111    { 
     112        $this->html_headers = $headers_string; 
     113    } 
     114 
     115    /** Set the section to be displayed in the tool pane */ 
     116    public function setToolSection($section) 
     117    { 
     118        switch ($section) 
     119        { 
     120            case "ADMIN" : 
     121                $current_user = User :: getCurrentUser(); 
     122                $html = ''; 
     123 
     124                if ($current_user && $current_user->isNobody()) 
     125                { 
     126                    $html .= _("You do not have permissions to access any administration functions."); 
     127                } 
     128                else 
     129                { 
     130 
     131                    if ($current_user && $current_user->isSuperAdmin()) 
     132                    { 
     133                        $html .= "<li><a href='user_log.php'>"._("User logs")."</a></li>\n"; 
     134                        $html .= "<li><a href='online_users.php'>"._("Online Users")."</a></li>\n"; 
     135                        $html .= "<li><a href='stats.php'>"._("Statistics")."</a></li>\n"; 
     136                        $html .= "<li><a href='import_user_database.php'>"._("Import NoCat user database")."</a></li>\n"; 
     137                        $html .= "<li><a href='content_admin.php'>"._("Content manager")."</a></li>\n"; 
     138                    } 
     139 
     140                    $html .= "</ul>\n"; 
     141 
     142                    // If the user is super admin OR owner of at least one hotspot show the menu 
     143                    if ($current_user && ($current_user->isSuperAdmin() || $current_user->isOwner())) 
     144                    { 
     145                        /* Node admin */ 
     146                        $html .= "<div class='admin_section_container'>\n"; 
     147                        $html .= '<form action="'.GENERIC_OBJECT_ADMIN_ABS_HREF.'" method="post">'; 
     148                        $html .= "<div class='admin_section_title'>"._("Node administration:")." </div>\n"; 
     149 
     150                        $html .= "<div class='admin_section_data'>\n"; 
     151 
     152                        if ($current_user->isSuperAdmin()) 
     153                            $sql_additional_where = ''; 
     154                        else 
     155                            $sql_additional_where = "AND node_id IN (SELECT node_id from node_stakeholders WHERE is_owner = true AND user_id='".$current_user->getId()."')"; 
     156                        $html .= "<div id='NodeSelector'>\n"; 
     157                        $html .= Node :: getSelectNodeUI('object_id', $sql_additional_where); 
     158                        $html .= "</div>\n"; 
     159                        $html .= "</div>\n"; 
     160                        $html .= "<div class='admin_section_tools'>\n"; 
     161                        $html .= "<input type='hidden' name='object_class' value='Node'>\n"; 
     162                        $html .= "<input type='hidden' name='action' value='edit'>\n"; 
     163                        $html .= "<input type='submit' name='edit_submit' value='"._("Edit")."'>\n"; 
     164                        $html .= '</form>'; 
     165 
     166                        if($current_user->isSuperAdmin()) 
     167                        { 
     168                            $html .= '<form action="'.GENERIC_OBJECT_ADMIN_ABS_HREF.'" method="post">'; 
     169                            $html .= "<input type='hidden' name='action' value='new_ui'>\n"; 
     170                            $html .= "<input type='hidden' name='object_class' value='Node'>\n"; 
     171                            $html .= "<input type=submit name='new_submit' value='"._("Create")."'>\n"; 
     172                            $html .= "</form>\n"; 
     173 
     174                        } 
     175                        $html .= "</div>\n"; 
     176                        $html .= "</div>\n"; 
     177                    } 
     178 
     179                    /* Network admin */ 
     180                    if ($current_user && $current_user->isSuperAdmin()) 
     181                    { 
     182                        $html .= "<div class='admin_section_container'>\n"; 
     183                        $html .= '<form action="'.GENERIC_OBJECT_ADMIN_ABS_HREF.'" method="post">'; 
     184                        $html .= "<div class='admin_section_title'>"._("Network administration:")." </div>\n"; 
     185 
     186                        $html .= "<div class='admin_section_data'>\n"; 
     187                        $html .= "<input type='hidden' name='action' value='edit'>\n"; 
     188                        $html .= "<input type='hidden' name='object_class' value='Network'><br>\n"; 
     189                        $html .= Network :: getSelectNetworkUI('object_id'); 
     190                        $html .= "</div>\n"; 
     191                        $html .= "<div class='admin_section_tools'>\n"; 
     192                        $html .= "<input type=submit name='edit_submit' value='"._("Edit")."'>\n"; 
     193                        $html .= "</form>\n"; 
     194                        $html .= '<form action="'.GENERIC_OBJECT_ADMIN_ABS_HREF.'" method="post">'; 
     195                        $html .= "<input type='hidden' name='action' value='new_ui'>\n"; 
     196                        $html .= "<input type='hidden' name='object_class' value='Network'>\n"; 
     197                        $html .= "<input type=submit name='new_submit' value='"._("Create")."'>\n"; 
     198                        $html .= "</form>\n"; 
     199                        $html .= "</div>\n"; 
     200                        $html .= "</div>\n"; 
     201                    } 
     202                } 
     203                break; 
     204            default : 
     205                $html .= "<p class='errormsg'>"._("Unknown section:")." $section</p>\n"; 
     206 
     207        } 
     208        $this->tool_content = $html; 
     209    } 
     210 
     211    /** Set the content to be displayed in the tool pane */ 
     212    public function setToolContent($html) 
     213    { 
     214        $this->tool_content = $html; 
     215    } 
     216 
     217    /** Get the content to be displayed in the tool pane 
     218     * @param section, one of:  START, LOGIN, 
     219    * @return HTML markup */ 
     220    private function getToolContent($section = 'START') 
     221    { 
     222        global $session; 
     223        $html = ''; 
     224        switch ($section) 
     225        { 
     226            case "NONE" : 
     227                break; 
     228            case "LOGIN" : 
     229                break; 
     230            case "START" : 
     231                $html .= '<div id="tool_section">'."\n"; 
     232                $html .= '<div class="tool_user_info">'."\n"; 
     233                $html .= '<span class="tool_user_info">'."\n"; 
     234                $user = User :: getCurrentUser(); 
     235                if ($user != null) 
     236                { 
     237                    $html .= '<p>'._("Logged in as:").' '.$user->getUsername().'</p>'."\n"; 
     238                    $html .= '<a class="administration" HREF="'.BASE_SSL_PATH.'user_profile.php"><img class="administration" src="'.BASE_SSL_PATH.'images/profile.gif" border="0"> '._("My Profile").'</a>'."\n"; 
     239 
     240                    $gw_id = $session->get(SESS_GW_ID_VAR); 
     241                    $gw_address = $session->get(SESS_GW_ADDRESS_VAR); 
     242                    $gw_port = $session->get(SESS_GW_PORT_VAR); 
     243 
     244                    if ($gw_id && $gw_address && $gw_port) 
     245                        $html .= '<a class="administration" HREF="'.BASE_SSL_PATH.'login/?logout=true&gw_id='.$gw_id.'&gw_address='.$gw_address.'&gw_port='.$gw_port.'"><img class="administration" src="'.BASE_SSL_PATH.'images/logout.gif" border="0"> '._("Logout").'</a>'."\n"; 
     246                    else 
     247                        $html .= '<a class="administration" HREF="'.BASE_SSL_PATH.'login/?logout=true"><img class="administration" src="'.BASE_SSL_PATH.'images/logout.gif" border="0"> '._("Logout").'</a>'."\n"; 
     248 
     249                } 
     250                else 
     251                { 
     252                    $gw_id = !empty ($_REQUEST['gw_id']) ? $_REQUEST['gw_id'] : $session->get(SESS_GW_ID_VAR); 
     253                    $gw_address = !empty ($_REQUEST['gw_address']) ? $_REQUEST['gw_address'] : $session->get(SESS_GW_ADDRESS_VAR); 
     254                    $gw_port = !empty ($_REQUEST['gw_port']) ? $_REQUEST['gw_port'] : $session->get(SESS_GW_PORT_VAR); 
     255 
     256                    // If the user connects physically ( through a gateway don't show the confusing login message ) 
     257                    if (empty ($gw_id) || empty ($gw_address) || empty ($gw_port)) 
     258                        $href = BASE_SSL_PATH.'login/'; 
     259                    else 
     260                        $href = BASE_SSL_PATH.'login/?gw_id='.$gw_id.'&gw_address='.$gw_address.'&gw_port='.$gw_port; 
    240261$html .= '<p>'._("I am not logged in.").'<br><a href="'.$href.'">'._("Login").'</a></p>'."\n"; 
    241                                          
    242                                         $html .= '<a class="administration" HREF="'.Network :: getCurrentNetwork()->getHomepageURL().'"><img class="administration" src="'.BASE_SSL_PATH.'images/lien_ext.gif"> '.Network :: getCurrentNetwork()->getName().'</a>'."\n"; 
    243                                         $html .= '<a class="administration" HREF="'.BASE_SSL_PATH.'faq.php"><img class="administration" src="'.BASE_SSL_PATH.'images/where.gif"> '._("Where am I?").'</a>'."\n"; 
    244                                 } 
    245  
    246                                 $html .= "</span>"."\n"; //End tool_user_info 
    247                                 $html .= "</div>"."\n"; //End tool_user_info 
    248  
    249                                 $html .= '<div class="navigation">'."\n"; 
    250                                 /* 
    251                                 $html .= '<a href="index.php" class="navigation">'._("Start").'</a>'."\n"; 
    252                                 $html .= '<img class="separator" src="'.BASE_NON_SSL_PATH.'/images/separator.gif">'."\n"; 
    253                                 $html .= '<a href="users.php" class="navigation">'._("Users Online").'</a>'."\n"; 
    254                                 $html .= '<img class="separator" src="'.BASE_NON_SSL_PATH.'/images/separator.gif">'."\n"; 
    255                                 $html .= '<a href="news.php" class="navigation">'._("News").'</a>'."\n"; 
    256                                 $html .= '<img class="separator" src="'.BASE_NON_SSL_PATH.'/images/separator.gif">'."\n"; 
    257                                 $html .= '<a href="hotspots.php" class="navigation">'._("Hotspots").'</a>'."\n"; 
    258                                 */ 
    259                                 $html .= '<span class="navigation">'; 
    260                                 $html .= Network :: getCurrentNetwork()->getName()." "._("Building your wireless community"); 
    261                                 $html .= '</span>'; 
    262                                 $html .= "</div>"."\n"; //End navigation 
    263  
    264                                 $html .= '<div class="language">'."\n"; 
    265                                 $html .= '<form class="language" name="lang_form" method="post" action="'.$_SERVER['REQUEST_URI'].'">'."\n"; 
    266                                 $html .= _("Language:")."\n"; 
    267                                 $html .= "<select name='wifidog_language' onChange='javascript: document.lang_form.submit();'>"."\n"; 
    268                                 global $AVAIL_LOCALE_ARRAY; //From config file 
    269                                 foreach ($AVAIL_LOCALE_ARRAY as $lang_ids => $lang_names) 
    270                                 { 
    271                                         if (Locale :: getCurrentLocale()->getId() == $lang_ids) 
    272                                         { 
    273                                                 $selected = "SELECTED"; 
    274                                         } 
    275                                         else 
    276                                         { 
    277                                                 $selected = ''; 
    278                                         } 
    279                                         $html .= '<option label="'.$lang_names.'" value="'.$lang_ids.'" '.$selected.'>'.$lang_names.'</option>'."\n"; 
    280                                 } 
    281                                 $html .= "</select>"."\n"; 
    282                                 $html .= "</form>"."\n"; 
    283  
    284                                 $html .= "</div>"."\n"; //End language 
    285  
    286                                 $html .= "<div class='tool_content'>"."\n"; 
    287                                 /******************************/ 
    288                                 $html .= $this->tool_content; 
    289                                 /******************************/ 
    290                                 $html .= "</div>"."\n"; //End tool_content 
    291                                 $html .= '<div class="avis">'."\n"; 
    292                                 $html .= '<span class="avis">'."\n"; 
    293                                 $html .= sprintf(_("Accounts on %s are and will stay completely free."), Network :: getCurrentNetwork()->getName()); 
    294                                 $html .= _("Please inform us of any problem or service interruption at:"); 
    295                                 $tech_support_email = Network :: getCurrentNetwork()->getTechSupportEmail(); 
    296                                 $html .= '<a href="mailto:'.$tech_support_email.'">'.$tech_support_email.'</a>'."\n"; 
    297                                 $html .= "</span>"."\n"; //End avis 
    298                                 $html .= "</div>"."\n"; //End avis 
    299                                 $html .= "</div>"."\n"; //End tool_section 
    300                                 break; 
    301                         default : 
    302                                 $html .= '<p class="errmsg">MainUI::getToolContent(): Unknown section!</p>'."\n"; 
    303                 } 
    304                 return $html; 
    305         } 
    306  
    307         /** Display the page 
    308          * @note:  Uses a few request parameters to displaty debug information 
    309          * if $_REQUEST['debug_request'] is present, it will print out the $_REQUEST array at the top of the page */ 
    310         public function display() 
    311         { 
    312                 $html = ''; 
    313                 //$this->smarty->display(DEFAULT_CONTENT_SMARTY_PATH."header.html"); 
    314  
    315                 /**** Headers ****/ 
    316                 $html .= '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">'."\n"; 
    317                 $html .= '<html>'."\n"; 
    318                 $html .= '<head>'."\n"; 
    319                 $html .= '<meta http-equiv="Content-Type" content="text/html; charset=utf-8">'."\n"; 
    320                 $html .= '<meta http-equiv="Pragma" CONTENT="no-cache">'."\n"; 
    321                 $html .= '<meta http-equiv="Expires" CONTENT="-1">'."\n"; 
    322                 // Add HTML headers 
    323                 $html .= "{$this->html_headers}"; 
    324                 $html .= "<title>{$this->title}</title>\n"; 
    325                 $html .= "<style type='text/css'>\n"; 
    326                 if (is_file(NODE_CONTENT_PHP_RELATIVE_PATH.STYLESHEET_NAME)) 
    327                 { 
    328                         $stylesheet_file = NODE_CONTENT_SMARTY_PATH.STYLESHEET_NAME; 
    329                 } 
    330                 else 
    331                 { 
    332                         $stylesheet_file = DEFAULT_CONTENT_SMARTY_PATH.STYLESHEET_NAME; 
    333                 } 
    334                 $html .= $this->smarty->fetch($stylesheet_file); 
    335                 $html .= "</style>\n"; 
    336                 $html .= "</head>\n"; 
    337  
    338                 $html .= "<body>"."\n"; 
    339                 if (isset ($_REQUEST['debug_request'])) 
    340                 { 
    341                         $html .= '<pre>'; 
    342                         $html .= print_r($_REQUEST, true); 
    343                         $html .= '</pre>'; 
    344                 } 
    345                 $html .= '<div class="outer_container">'."\n"; 
    346  
    347                 if ($this->isToolSectionEnabled()) 
    348                 { 
    349                         /**** Tools ******/ 
    350                         $html .= $this->getToolContent(); 
    351  
    352                         /**** Main section ****/ 
    353                         $html .= "<div id='main_section'>"."\n"; 
    354                         $html .= $this->main_content; 
    355                         $html .= "</div>"."\n"; //End main_section       
    356                 } 
    357                 else 
    358                 { 
    359                         /**** Main section ****/ 
    360                         $html .= $this->main_content; 
    361                 } 
    362  
    363                 $html .= '</div>'."\n"; //End outer_container 
    364  
    365                 foreach ($this->footer_scripts as $script) 
    366                 { 
    367                         $html .= "{$script}\n"; 
    368                 } 
    369                 $html .= "</body>"."\n"; 
    370                 $html .= "</html>"."\n"; 
    371                 echo $html; 
    372  
    373         } 
    374  
    375         function displayError($errmsg) 
    376         { 
    377                 $html = "<p>$errmsg</p>\n"; 
    378                 $email = Network :: getCurrentNetwork()->getTechSupportEmail(); 
    379                 if (!empty ($email)) 
    380                 { 
    381                         $html .= "<p>"._("Please get in touch with ")."<a href='{$email}'>{$email}</a></p>"; 
    382                 } 
    383                 $this->setMainContent($html); 
    384                 $this->display(); 
    385         } 
    386  
    387 } //End class 
     262 
     263                    $html .= '<a class="administration" HREF="'.Network :: getCurrentNetwork()->getHomepageURL().'"><img class="administration" src="'.BASE_SSL_PATH.'images/lien_ext.gif"> '.Network :: getCurrentNetwork()->getName().'</a>'."\n"; 
     264                    $html .= '<a class="administration" HREF="'.BASE_SSL_PATH.'faq.php"><img class="administration" src="'.BASE_SSL_PATH.'images/where.gif"> '._("Where am I?").'</a>'."\n"; 
     265                } 
     266 
     267                $html .= "</span>"."\n"; //End tool_user_info 
     268                $html .= "</div>"."\n"; //End tool_user_info 
     269 
     270                $html .= '<div class="navigation">'."\n"; 
     271                /* 
     272                $html .= '<a href="index.php" class="navigation">'._("Start").'</a>'."\n"; 
     273                $html .= '<img class="separator" src="'.BASE_NON_SSL_PATH.'/images/separator.gif">'."\n"; 
     274                $html .= '<a href="users.php" class="navigation">'._("Users Online").'</a>'."\n"; 
     275                $html .= '<img class="separator" src="'.BASE_NON_SSL_PATH.'/images/separator.gif">'."\n"; 
     276                $html .= '<a href="news.php" class="navigation">'._("News").'</a>'."\n"; 
     277                $html .= '<img class="separator" src="'.BASE_NON_SSL_PATH.'/images/separator.gif">'."\n"; 
     278                $html .= '<a href="hotspots.php" class="navigation">'._("Hotspots").'</a>'."\n"; 
     279                */ 
     280                $html .= '<span class="navigation">'; 
     281                $html .= Network :: getCurrentNetwork()->getName()." "._("Building your wireless community"); 
     282                $html .= '</span>'; 
     283                $html .= "</div>"."\n"; //End navigation 
     284 
     285                $html .= '<div class="language">'."\n"; 
     286                $html .= '<form class="language" name="lang_form" method="post" action="'.$_SERVER['REQUEST_URI'].'">'."\n"; 
     287                $html .= _("Language:")."\n"; 
     288                $html .= "<select name='wifidog_language' onChange='javascript: document.lang_form.submit();'>"."\n"; 
     289                global $AVAIL_LOCALE_ARRAY; //From config file 
     290                foreach ($AVAIL_LOCALE_ARRAY as $lang_ids => $lang_names) 
     291                { 
     292                    if (Locale :: getCurrentLocale()->getId() == $lang_ids) 
     293                    { 
     294                        $selected = "SELECTED"; 
     295                    } 
     296                    else 
     297                    { 
     298                        $selected = ''; 
     299                    } 
     300                    $html .= '<option label="'.$lang_names.'" value="'.$lang_ids.'" '.$selected.'>'.$lang_names.'</option>'."\n"; 
     301                } 
     302                $html .= "</select>"."\n"; 
     303                $html .= "</form>"."\n"; 
     304 
     305                $html .= "</div>"."\n"; //End language 
     306 
     307                $html .= "<div class='tool_content'>"."\n"; 
     308                /******************************/ 
     309                $html .= $this->tool_content; 
     310                /******************************/ 
     311                $html .= "</div>"."\n"; //End tool_content 
     312                $html .= '<div class="avis">'."\n"; 
     313                $html .= '<span class="avis">'."\n"; 
     314                $html .= sprintf(_("Accounts on %s are and will stay completely free."), Network :: getCurrentNetwork()->getName()); 
     315                $html .= _("Please inform us of any problem or service interruption at:"); 
     316                $tech_support_email = Network :: getCurrentNetwork()->getTechSupportEmail(); 
     317                $html .= '<a href="mailto:'.$tech_support_email.'">'.$tech_support_email.'</a>'."\n"; 
     318                $html .= "</span>"."\n"; //End avis 
     319                $html .= "</div>"."\n"; //End avis 
     320                $html .= "</div>"."\n"; //End tool_section 
     321                break; 
     322            default : 
     323                $html .= '<p class="errmsg">MainUI::getToolContent(): Unknown section!</p>'."\n"; 
     324        } 
     325        return $html; 
     326    } 
     327 
     328    /** Display the page 
     329     * @note:  Uses a few request parameters to displaty debug information 
     330     * if $_REQUEST['debug_request'] is present, it will print out the $_REQUEST array at the top of the page */ 
     331    public function display() 
     332    { 
     333        $html = ''; 
     334        //$this->smarty->display(DEFAULT_CONTENT_SMARTY_PATH."header.html"); 
     335 
     336        /**** Headers ****/ 
     337        $html .= '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">'."\n"; 
     338        $html .= '<html>'."\n"; 
     339        $html .= '<head>'."\n"; 
     340        $html .= '<meta http-equiv="Content-Type" content="text/html; charset=utf-8">'."\n"; 
     341        $html .= '<meta http-equiv="Pragma" CONTENT="no-cache">'."\n"; 
     342        $html .= '<meta http-equiv="Expires" CONTENT="-1">'."\n"; 
     343        // Add HTML headers 
     344        $html .= "{$this->html_headers}"; 
     345        $html .= "<title>{$this->title}</title>\n"; 
     346        $html .= "<style type='text/css'>\n"; 
     347        if (is_file(NODE_CONTENT_PHP_RELATIVE_PATH.STYLESHEET_NAME)) 
     348        { 
     349            $stylesheet_file = NODE_CONTENT_SMARTY_PATH.STYLESHEET_NAME; 
     350        } 
     351        else 
     352        { 
     353            $stylesheet_file = DEFAULT_CONTENT_SMARTY_PATH.STYLESHEET_NAME; 
     354        } 
     355        $html .= $this->smarty->fetch($stylesheet_file); 
     356        $html .= "</style>\n"; 
     357        $html .= "</head>\n"; 
     358 
     359        $html .= "<body class='bodyBackColor'>"."\n"; 
     360        if (isset ($_REQUEST['debug_request'])) 
     361        { 
     362            $html .= '<pre>'; 
     363            $html .= print_r($_REQUEST, true); 
     364            $html .= '</pre>'; 
     365        } 
     366        $html .= '<div class="outer_container">'."\n"; 
     367 
     368        if ($this->isToolSectionEnabled()) 
     369        { 
     370            /**** Tools ******/ 
     371            $html .= $this->getToolContent(); 
     372 
     373            /**** Main section ****/ 
     374            $html .= "<div id='main_section'>"."\n"; 
     375            $html .= $this->main_content; 
     376            $html .= "</div>"."\n"; //End main_section 
     377        } 
     378        else 
     379        { 
     380            /**** Main section ****/ 
     381            $html .= $this->main_content; 
     382        } 
     383 
     384        $html .= '</div>'."\n"; //End outer_container 
     385 
     386        foreach ($this->footer_scripts as $script) 
     387        { 
     388            $html .= "{$script}\n"; 
     389        } 
     390        $html .= "</body>"."\n"; 
     391        $html .= "</html>"."\n"; 
     392        echo $html; 
     393 
     394    } 
     395 
     396    function displayError($errmsg) 
     397    { 
     398        $html = "<p>$errmsg</p>\n"; 
     399        $email = Network :: getCurrentNetwork()->getTechSupportEmail(); 
     400        if (!empty ($email)) 
     401        { 
     402            $html .= "<p>"._("Please get in touch with ")."<a href='{$email}'>{$email}</a></p>"; 
     403        } 
     404        $this->setMainContent($html); 
     405        $this->display(); 
     406    } 
     407 
     408} 
     409 
     410/* 
     411 * Local variables: 
     412 * tab-width: 4 
     413 * c-basic-offset: 4 
     414 * c-hanging-comment-ender-p: nil 
     415 * End: 
     416 */ 
     417 
    388418?>