Changeset 566

Show
Ignore:
Timestamp:
04/25/05 09:16:07 (8 years ago)
Author:
benoitg
Message:

2005-04-25 Benoit Gr�goire <bock@…>

  • Integration merge, should work, but there will be display problems everywhere. Expect further commits today.
  • Almost 100% complete Network abstraction
  • Much better object encapsulation. Deprecated methods not removed yet.
  • Add MainUI class. Used to display the interface. Inner workings still need work.
Location:
trunk/wifidog-auth
Files:
1 added
7 removed
47 modified

Legend:

Unmodified
Added
Removed
  • trunk/wifidog-auth/ChangeLog

    r565 r566  
     12005-04-25 Benoit Grégoire  <bock@step.polymtl.ca> 
     2        * Integration merge, should work, but there will be display problems everywhere.  Expect further commits today. 
     3        * Almost 100% complete Network abstraction 
     4        * Much better object encapsulation.  Deprecated methods not removed yet. 
     5        * Add MainUI class.  Used to display the interface.  Inner workings still need work. 
     6         
    172005-04-23 François Proulx <francois.proulx@gmail.com> 
    28        * Added Preferred Size support for Flickr pictures 
  • trunk/wifidog-auth/wifidog/admin/content_admin.php

    r553 r566  
    2828define('CONTENT_ADMIN_HREF', 'content_admin.php'); 
    2929require_once BASEPATH.'classes/Content.php'; 
    30  
    31 $smarty->display("templates/header.html"); 
     30require_once BASEPATH.'classes/MainUI.php'; 
     31$ui=new MainUI(); 
    3232$html = ''; 
    3333 
     
    8989} 
    9090 
    91 echo $html; 
    92 $smarty->display("templates/footer.html"); 
     91$ui->setToolSection('ADMIN'); 
     92$ui->setMainContent($html); 
     93$ui->display(); 
    9394?> 
    9495 
  • trunk/wifidog-auth/wifidog/admin/index.php

    r559 r566  
    2828require_once 'admin_common.php'; 
    2929require_once BASEPATH.'classes/Content.php'; 
    30  
    31 $smarty->display("templates/header.html"); 
    32  
     30require_once BASEPATH.'classes/MainUI.php'; 
     31$ui=new MainUI(); 
     32$html = ''; 
    3333$current_user = User :: getCurrentUser(); 
    3434if(!$current_user) 
    3535{ 
    36     $html = _('You must be logged in to access the administration panel.'); 
     36    $html = '<p class="errormsg">'._('You must be logged in to access the administration panel.')."</p>\n"; 
    3737} 
    3838else 
    3939{ 
    40     $html = ''; 
    41     $html .= "<ul>\n"; 
    42     $html .= "<li><a href='user_log.php'>"._("User logs")."</a></li>\n"; 
    43     $html .= "<li><a href='online_users.php'>"._("Online Users")."</a></li>\n"; 
    44     $html .= "<li><a href='user_stats.php'>"._("Cumulative user statistics")."</a></li>\n"; 
    45     $html .= "<li><a href='hotspot_log.php'>"._("Hotspot logs")."</a></li>\n"; 
    46     $html .= "<li><a href='import_user_database.php'>"._("Import NoCat user database")."</a></li>\n"; 
    47     $html .= "<li><a href='hotspot.php'>"._("Hotspot creation and configuration")."</a> - Beta</li>\n"; 
    48     $html .= "<li><a href='owner_sendfiles.php'>"._("Hotspot owner administration")."</a> - Beta</li>\n"; 
    49      
    50     /* Node admin */ 
    51     $html .= "<div class='admin_section_container'>\n"; 
    52     $html .= '<form action="'.GENERIC_OBJECT_ADMIN_ABS_HREF.'" method="get">'; 
    53     $html .= "<div class='admin_section_title'>"._("Node administration:")." </div>\n"; 
    54      
    55     $html .= "<div class='admin_section_data'>\n"; 
    56     $html .= "<input type='hidden' name='action' value='edit'>\n"; 
    57     $html .= "<input type='hidden' name='object_class' value='Node'>\n"; 
    58      
    59     if ($current_user->isSuperAdmin()) 
    60     { 
    61         $sql_additional_where = ''; 
    62     } 
    63     else 
    64     { 
    65         $sql_additional_where = "AND node_id IN (SELECT node_id from node_owners WHERE user_id='".$current_user->getId()."')"; 
    66     } 
    67     $html .= Node :: getSelectNodeUI('object_id', $sql_additional_where); 
    68     $html .= "</div>\n"; 
    69     $html .= "<div class='admin_section_tools'>\n"; 
    70      
    71     $html .= "<input type=submit name='edit_submit' value='"._("Edit")."'>\n"; 
    72     $html .= "</div>\n"; 
    73     $html .= '</form>'; 
    74     $html .= "</div>\n"; 
    75      
    76     /* Network admin */ 
    77     $html .= "<div class='admin_section_container'>\n"; 
    78     $html .= '<form action="'.GENERIC_OBJECT_ADMIN_ABS_HREF.'" method="post">'; 
    79     $html .= "<div class='admin_section_title'>"._("Network administration:")." </div>\n"; 
    80      
    81     $html .= "<div class='admin_section_data'>\n"; 
    82     $html .= "<input type='hidden' name='action' value='edit'>\n"; 
    83     $html .= "<input type='hidden' name='object_class' value='Network'>\n"; 
    84     $html .= Network :: getSelectNetworkUI('object_id'); 
    85     $html .= "</div>\n"; 
    86     $html .= "<div class='admin_section_tools'>\n"; 
    87      
    88     $html .= "<input type=submit name='edit_submit' value='"._("Edit")."'>\n"; 
    89     $html .= "</div>\n"; 
    90     $html .= '</form>'; 
    91     $html .= "</div>\n"; 
    92      
    93     $html .= "<li><a href='content_admin.php'>"._("Content manager")."</a></li>\n"; 
    94     $html .= "</ul>\n"; 
     40        $ui->setToolSection('ADMIN'); 
    9541} 
    9642 
    97 echo $html; 
    98  
    99 $smarty->display("templates/footer.html"); 
     43$ui->setMainContent($html); 
     44$ui->display(); 
    10045?> 
  • trunk/wifidog-auth/wifidog/admin/templates/hotspot_display.html

    r406 r566  
    1 {include file="templates/header.html" title="Hotspot administration"} 
    2  
    31<b style="position: absolute;top: 10px;right: 10px;">({$user_id})</b> <!-- DEBUG --> 
    42 
     
    4139 
    4240<p class="warning">{$error_message}</p> 
    43  
    44 {include file="templates/footer.html"} 
  • trunk/wifidog-auth/wifidog/admin/templates/hotspot_edit.html

    r435 r566  
    1 {include file="templates/header.html" title="Hotspot administration"} 
    2  
    31<h3>{$title} {$smarty.const.HOTSPOT_NETWORK_NAME}</h3> 
    42 
     
    7977<br> 
    8078<p>Work in progress note: Better DB integrity testing is needed before allowing the hotspot ID modification.</p> 
    81  
    82 {include file="templates/footer.html"} 
  • trunk/wifidog-auth/wifidog/admin/templates/hotspot_log.html

    r452 r566  
    1 {include file="templates/header.html"} 
    2  
    31{section name=node loop=$nodes} 
    42<div id="hotspot_log"> 
     
    130128 
    131129</div> 
    132  
    133 {include file="templates/footer.html"} 
  • trunk/wifidog-auth/wifidog/admin/templates/hotspot_owner.html

    r406 r566  
    1 {include file="templates/header.html" title="Hotspot administration"} 
    2  
    31<h3>{$title} {$smarty.const.HOTSPOT_NETWORK_NAME}</h3> 
    42<script LANGUAGE="JavaScript"> 
     
    7169 
    7270</form> 
    73  
    74 {include file="templates/footer.html"} 
    75  
  • trunk/wifidog-auth/wifidog/admin/templates/online_users.html

    r516 r566  
    1 {include file="templates/header.html"} 
    2  
    31{if $error} 
    42        <div id="help"> 
     
    3331 
    3432{/if} 
    35  
    36 {include file="templates/footer.html"} 
  • trunk/wifidog-auth/wifidog/admin/templates/owner_display.html

    r398 r566  
    1 {include file="templates/header.html" title="Hotspot owner administration"} 
    2  
    31<b style="position: absolute;top: 10px;right: 10px;">({$user_id})</b> <!-- DEBUG --> 
    42   
     
    3836 
    3937</form> 
    40  
    41 {include file="templates/footer.html"} 
    42  
  • trunk/wifidog-auth/wifidog/admin/templates/owner_upload.html

    r398 r566  
    1 {include file="templates/header.html" title="Hotspot owner administration"} 
    2  
    31<B style="position: absolute;top: 10px;right: 10px;">({$user_id})</B> <!-- DEBUG --> 
    42 
     
    4846 
    4947</form> 
    50  
    51 {include file="templates/footer.html"} 
  • trunk/wifidog-auth/wifidog/admin/templates/user_log.html

    r516 r566  
    1 {include file="templates/header.html"} 
    2  
    31{if $error} 
    42        <div id="help"> 
     
    4846 
    4947{/if} 
    50  
    51 {include file="templates/footer.html"} 
  • trunk/wifidog-auth/wifidog/admin/templates/user_log_detailed.html

    r516 r566  
    1 {include file="templates/header.html"} 
    2  
    31{literal} 
    42<style> 
     
    8583{/if} 
    8684</div> 
    87  
    88 {include file="templates/footer.html"} 
  • trunk/wifidog-auth/wifidog/admin/templates/user_stats.html

    r516 r566  
    1 {include file="templates/header.html"} 
    2  
    31<div id="user_stats"> 
    42 
     
    9795 
    9896</div> 
    99  
    100 {include file="templates/footer.html"} 
  • trunk/wifidog-auth/wifidog/admin/user_log.php

    r545 r566  
    3939        try 
    4040        { 
    41                 $user = User :: getUserByID($_REQUEST['user_id']); 
     41                $user = User :: getObject($_REQUEST['user_id']); 
    4242                $userinfo = $user->getInfoArray(); 
    4343                $userinfo['account_status_description'] = $account_status_to_text[$userinfo['account_status']]; 
     
    103103 
    104104        $smarty->assign("account_status_to_text", $account_status_to_text); 
    105         $smarty->display("admin/templates/user_log.html"); 
     105 
     106        require_once BASEPATH.'classes/MainUI.php'; 
     107$ui=new MainUI(); 
     108        $ui->setToolSection('ADMIN'); 
     109$ui->setMainContent($smarty->fetch("admin/templates/user_log.html")); 
     110$ui->display(); 
    106111} 
    107112?> 
  • trunk/wifidog-auth/wifidog/admin/user_stats.php

    r545 r566  
    3838$smarty->assign("most_frequent_users", Statistics::getMostFrequentUsers(10)); 
    3939$smarty->assign("most_greedy_users", Statistics::getMostGreedyUsers(10)); 
    40 $smarty->display("admin/templates/user_stats.html"); 
     40        require_once BASEPATH.'classes/MainUI.php'; 
     41$ui=new MainUI(); 
     42        $ui->setToolSection('ADMIN'); 
     43$ui->setMainContent($smarty->fetch("admin/templates/user_stats.html")); 
     44$ui->display(); 
    4145?> 
  • trunk/wifidog-auth/wifidog/classes/Content.php

    r562 r566  
    536536                                                $html .= "<li class='admin_section_list_item'>\n"; 
    537537                                                $html .= "<div class='admin_section_data'>\n"; 
    538                                                 $user = User :: getUserByID($content_owner_row['user_id']); 
     538                                                $user = User :: getObject($content_owner_row['user_id']); 
    539539 
    540540                                                $html .= $user->getUserListUI(); 
     
    694694                                        foreach ($content_owner_rows as $content_owner_row) 
    695695                                        { 
    696                                                 $user = User :: getUserByID($content_owner_row['user_id']); 
     696                                                $user = User :: getObject($content_owner_row['user_id']); 
    697697                                                $user_id = $user->getId(); 
    698698                                                $name = "content_".$this->id."_owner_".$user->GetId()."_remove"; 
  • trunk/wifidog-auth/wifidog/classes/Locale.php

    r545 r566  
    11<?php 
     2 
    23 
    34/********************************************************************\ 
     
    3536        private $mLang; 
    3637        private $mPays; 
    37         // Associations 
     38 
     39        /** Get the Locale object 
     40         * @param $content_id The content id 
     41         * @return the Content object, or null if there was an error (an exception is also thrown) 
     42         */ 
     43        static function getObject($locale_id) 
     44        { 
     45 
     46                return new self($locale_id); 
     47        } 
     48 
     49        public static function getCurrentLocale() 
     50        { 
     51                global $session; 
     52                $object = null; 
     53                $locale_id = $session->get(SESS_LANGUAGE_VAR); 
     54                if (empty ($locale_id)) 
     55                { 
     56                        $object = new self(DEFAULT_LANG); 
     57                } 
     58                else 
     59                { 
     60                        $object = new self($locale_id); 
     61                } 
     62                return $object; 
     63 
     64        } 
     65 
     66        /** 
     67         * @return true on success, false on failure 
     68         */ 
     69        public static function setCurrentLocale($locale) 
     70        { 
     71                global $session; 
     72                $retval = false; 
     73                if ($locale != null) 
     74                { 
     75                        $locale_id = $locale->getId(); 
     76                        $session->set(SESS_LANGUAGE_VAR, $locale_id); 
     77                        $retval = true; 
     78                } 
     79                else 
     80                { 
     81                        $locale_id = DEFAULT_LANG; 
     82                        $session->set(SESS_LANGUAGE_VAR, $locale_id); 
     83                        $retval = false; 
     84                } 
     85                /* Gettext support */ 
     86                if (!function_exists('gettext')) 
     87                { 
     88                        define('GETTEXT_AVAILABLE', false); 
     89                        /* Redefine the gettext functions if gettext isn't installed */ 
     90                        function gettext($string) 
     91                        { 
     92                                return $string; 
     93                        } 
     94                        function _($string) 
     95                        { 
     96                                return $string; 
     97                        } 
     98                } 
     99                else 
     100                { 
     101                        define('GETTEXT_AVAILABLE', true); 
     102                } 
     103 
     104                if (GETTEXT_AVAILABLE) 
     105                { 
     106                        $current_locale = setlocale(LC_ALL, $locale_id); 
     107                        if (setlocale(LC_ALL, $locale_id) != $locale_id) 
     108                        { 
     109                                echo "Warning: language.php: Unable to setlocale() to ".$locale_id.", return value: $current_locale, current locale: ".setlocale(LC_ALL, 0); 
     110                        } 
     111 
     112                        bindtextdomain('messages', BASEPATH.'/locale'); 
     113                        bind_textdomain_codeset('messages', 'UTF-8'); 
     114                        textDomain('messages'); 
     115 
     116                        putenv("LC_ALL=".$locale_id); 
     117                        putenv("LANGUAGE=".$locale_id); 
     118                } 
     119                return $retval; 
     120 
     121        } 
    38122 
    39123        /** Example: 'fr_CA_montreal' will give 
     
    68152         * @return A sql fragment 
    69153         */ 
    70                 public static function getSqlCaseStringSelect($locale_id) 
    71         { 
    72                                 $decomposed_locale = Locale :: decomposeLocaleId($locale_id); 
    73                  
     154        public static function getSqlCaseStringSelect($locale_id) 
     155        { 
     156                $decomposed_locale = Locale :: decomposeLocaleId($locale_id); 
    74157 
    75158                $sql = " (CASE\n"; 
     
    88171                //On cherche une chaine n'ayant pas de locale associée, elle a plue de chance d'être lisible qu'une chaîne prise au hasard 
    89172                $sql .= " WHEN locales_id IS NULL THEN 5\n"; 
    90                  
     173 
    91174                $sql .= "      ELSE 20 "; 
    92175                $sql .= "  END)\n"; 
    93176                return $sql; 
    94177        } 
    95          
     178 
    96179        /**Constructeur 
    97180        @param string locale Locale in POSIX format (excluding charset), such as fr ou fr_CA: "xx(x)_YY_(n*z)".  Both '_' and '-' are acceptable as separator. 
     
    127210        } 
    128211 
    129 public function GetId() 
    130 { 
    131         return $this->mId; 
    132 } 
     212        public function GetId() 
     213        { 
     214                return $this->mId; 
     215        } 
    133216        /**Indique si la clef primaire de l'objet est une chaîne de caractère. 
    134217        */ 
     
    182265        function Export($export_format, & $document, $parent, $entree = null) 
    183266        { 
    184 //              $sql = "SELECT locales_id FROM locales WHERE locales_id='$this->mId'"; 
    185 //              $this->mBd->executerSqlResUnique($sql, $locales_row, false); 
    186                  
    187                         $language = $document->createElementNS(LOM_EXPORT_NS, "Language"); 
    188                         $parent->appendChild($language); 
    189                         $textnode = $document->createTextNode($this->mId); 
    190                         $language->appendChild($textnode); 
    191         } 
    192          
     267                        //              $sql = "SELECT locales_id FROM locales WHERE locales_id='$this->mId'"; 
     268                //              $this->mBd->executerSqlResUnique($sql, $locales_row, false); 
     269 
     270        $language = $document->createElementNS(LOM_EXPORT_NS, "Language"); 
     271                $parent->appendChild($language); 
     272                $textnode = $document->createTextNode($this->mId); 
     273                $language->appendChild($textnode); 
     274        } 
     275 
    193276        /* 
    194277         * Returns a HTML formatted string for output to string ( with an image ) 
     
    242325                echo $this->GetString(); 
    243326        } 
    244          
     327 
    245328        /** 
    246329         * By definition a Locale cannot be empty 
     
    250333                return false; 
    251334        } 
    252          
     335 
    253336        /** 
    254337         * Checks if the object complies with the specified profile settings 
     
    258341        function IsCompliant($obligation) 
    259342        { 
    260                 switch($obligation) 
    261                 { 
    262                         case 'MANDATORY': 
    263                                 if($this->isEmpty()) 
     343                switch ($obligation) 
     344                { 
     345                        case 'MANDATORY' : 
     346                                if ($this->isEmpty()) 
    264347                                        return NOT_COMPLIANT_MASK; 
    265348                                break; 
    266                         case 'RECOMMENDED': 
    267                                 if($this->isEmpty()) 
     349                        case 'RECOMMENDED' : 
     350                                if ($this->isEmpty()) 
    268351                                        return NOT_ALL_RECOMMENDED; 
    269352                                break; 
  • trunk/wifidog-auth/wifidog/classes/LocaleList.php

    r553 r566  
    4343                global $db; 
    4444                $this->mBd = & $db; //for backward compatibility 
    45         } 
    46  
    47         /**Indique si la clef primaire de l'objet est une chaîne de caractère. 
    48         */ 
    49         function PrimaryKeyIsString() 
    50         { 
    51                 return true; 
    5245        } 
    5346 
     
    123116        } 
    124117 
    125         /**Exporte l'élément dans un format d'échange 
    126         @param $export_format format de la sortie 
    127         @param $document Le document auquel la sortie doit être ajouté.  Le type peut varier 
    128         @param $parent Le parent de l'élément à ajouter.  Le type peut varier    
    129         @param $entree ID de l'entree de vocabulaire 
    130         */ 
    131         function Export($export_format, & $document, $parent, $entree = null) 
    132         { 
    133                 if ($entree != null) 
    134                 { 
    135                         $langue = new Locale($entree); 
    136                         $langue->Export($export_format, $document, $parent); 
    137                 } 
    138         } 
    139  
    140         function isEmpty() 
    141         { 
    142                 return false; 
    143         } 
    144  
    145         /** 
    146          * By definition it cannot be considerend empty, so it's always compliant' 
    147          * @return boolean 
    148          */ 
    149         function isCompliant($profile, $lom_element) 
    150         { 
    151                 return COMPLIANT_MASK; 
    152         } 
    153118 
    154119} /* end class LocaleList */ 
  • trunk/wifidog-auth/wifidog/classes/Network.php

    r554 r566  
    7272                global $AUTH_SOURCE_ARRAY; 
    7373                $html = ''; 
    74                 $name = "{$user_prefix}"; 
    75                 $html .= "Network: \n"; 
     74                $name = $user_prefix; 
     75                $html .= _("Network:")." \n"; 
    7676                $number_of_networks = count($AUTH_SOURCE_ARRAY); 
    7777                if ($number_of_networks > 1) 
     
    133133                return $this->id; 
    134134        } 
     135 
     136        /** Retreives the network name  
     137         * @return The id */ 
     138        public function getTechSupportEmail() 
     139        { 
     140                return TECH_SUPPORT_EMAIL; 
     141        } 
     142 
     143        /** Retreives the network name  
     144         * @return The id */ 
     145        public function getName() 
     146        { 
     147                return HOTSPOT_NETWORK_NAME; 
     148        } 
     149 
     150        /** Retreives the network's homepage url  
     151         * @return The id */ 
     152        public function getHomepageURL() 
     153        { 
     154                return HOTSPOT_NETWORK_URL; 
     155        } 
     156 
     157 
    135158        /**Get an array of all Content linked to the network 
    136159        * @return an array of Content or an empty arrray */ 
     
    153176        /** Retreives the admin interface of this object. 
    154177         * @return The HTML fragment for this interface */ 
     178          
     179         /** Get the Authenticator object for this network */ 
     180         public function getAuthenticator() 
     181         { 
     182                global $AUTH_SOURCE_ARRAY; 
     183         return $AUTH_SOURCE_ARRAY[$this->id]['authenticator']; 
     184         } 
     185          
    155186        public function getAdminUI() 
    156187        { 
  • trunk/wifidog-auth/wifidog/classes/Node.php

    r555 r566  
    5757                else 
    5858                { 
    59                         $object = getCurrentRealNode(); 
     59                        $object = self::getCurrentRealNode(); 
    6060                } 
    6161                return $object; 
     
    7474         * @param        * @return a Node object, or null if it can't be found. 
    7575         */ 
    76         public function getCurrentRealNode() 
     76        public static function getCurrentRealNode() 
    7777        { 
    7878                global $db; 
     
    484484        } 
    485485 
     486/** The list of users online at this node 
     487 * @return An array of User object, or en empty array */ 
    486488        function getOnlineUsers() 
    487489        { 
    488490                global $db; 
    489  
    490                 $db->ExecSql("SELECT users.user_id, users.username, users.account_origin FROM users,connections WHERE connections.token_status='".TOKEN_INUSE."' AND users.user_id=connections.user_id AND connections.node_id='{$this->id}'", $users, false); 
     491                $retval=array(); 
     492                $db->ExecSql("SELECT users.user_id FROM users,connections WHERE connections.token_status='".TOKEN_INUSE."' AND users.user_id=connections.user_id AND connections.node_id='{$this->id}'", $users, false); 
     493                if($users!=null) 
     494                { 
     495                        foreach ($users as $user_row) 
     496                        { 
     497                                $retval[]=getObject($user_row['user_id']); 
     498                        } 
     499                } 
    491500                return $users; 
    492501        } 
     
    548557        } 
    549558 
     559/** Warning, the semantics of this function will change */ 
    550560        public static function getAllOnlineUsers() 
    551561        { 
  • trunk/wifidog-auth/wifidog/classes/SmartyWifidog.php

    r553 r566  
    3939class SmartyWifidog extends Smarty { 
    4040 
    41    function SmartyWifidog() 
     41   function __construct() 
    4242   { 
    4343    
  • trunk/wifidog-auth/wifidog/classes/User.php

    r553 r566  
    3333 
    3434        /** Instantiate a user object  
    35          * @param $id The id of the requested user  
     35         * @param $id The user id of the requested user  
    3636         * @return a User object, or null if there was an error 
    3737         */ 
    38         public static function getUserByID($id) 
     38        public static function getObject($id) 
    3939        { 
    4040                $object = null; 
  • trunk/wifidog-auth/wifidog/config.php

    r563 r566  
    77 * 
    88 *     $Log$ 
     9 *     Revision 1.37  2005/04/25 13:16:06  benoitg 
     10 *     2005-04-25 Benoit Gr�goire  <bock@step.polymtl.ca> 
     11 *      * Integration merge, should work, but there will be display problems everywhere.  Expect further commits today. 
     12 *      * Almost 100% complete Network abstraction 
     13 *      * Much better object encapsulation.  Deprecated methods not removed yet. 
     14 *      * Add MainUI class.  Used to display the interface.  Inner workings still need work. 
     15 * 
    916 *     Revision 1.36  2005/04/23 22:11:17  fproulx 
    1017 *     2005-04-23 François Proulx <francois.proulx@gmail.com> 
     
    205212define('CONF_DBMS',DBMS_POSTGRES); 
    206213 
     214/* Available Locales (Languages) */ 
     215$AVAIL_LOCALE_ARRAY=array('fr'=>'Français', 
     216                                'en'=>'English'); 
     217                                                 
    207218/***** You should normally not have to edit anything below this ******/ 
    208219define('WIFIDOG_NAME', 'WiFiDog Authentication server'); 
     
    251262define('LOGIN_PAGE_NAME', 'login.html'); 
    252263define('PORTAL_PAGE_NAME', 'portal.html');/**< @deprecated version - 19-Apr-2005*/ 
    253 define('PAGE_HEADER_NAME', 'header.html'); 
    254 define('PAGE_FOOTER_NAME', 'footer.html'); 
     264define('PAGE_HEADER_NAME', 'header.html');/**< @deprecated version - 19-Apr-2005*/ 
     265define('PAGE_FOOTER_NAME', 'footer.html');/**< @deprecated version - 19-Apr-2005*/ 
    255266define('HOTSPOT_STATUS_PAGE', 'hotspot_status.php'); 
    256267define('HOTSPOT_LOGO_NAME', 'hotspot_logo.jpg'); 
     
    264275 
    265276define('DEFAULT_NODE_ID', 'default'); 
    266 define('DEFAULT_LANG', 'fr_FR'); 
     277define('DEFAULT_LANG', 'fr'); 
    267278 
    268279 
  • trunk/wifidog-auth/wifidog/hotspot_status.php

    r516 r566  
    525525                        } 
    526526                $smarty->assign("num_deployed_nodes", count($node_results)); 
    527                 $smarty->assign("title", "hotspot_status"); 
    528                 $smarty->display("templates/hotspot_status.html"); 
     527 
     528                 
     529                require_once BASEPATH.'classes/MainUI.php'; 
     530$ui=new MainUI(); 
     531//$ui->setToolSection('ADMIN'); 
     532                $ui->setTitle(_("Hotspot list")); 
     533$ui->setMainContent($smarty->fetch("templates/hotspot_status.html")); 
     534$ui->display(); 
    529535        } 
    530536?> 
  • trunk/wifidog-auth/wifidog/include/common.php

    r553 r566  
    4949define('SESS_GW_PORT_VAR', 'SESS_GW_PORT'); 
    5050define('SESS_GW_ID_VAR', 'SESS_GW_ID'); 
    51  
    52 /* Languages and sessions */ 
    53 $lang_ids = array( 
    54         "fr", 
    55         "en" 
    56     ); 
    57 $lang_names = array( 
    58         "Fran&ccedil;ais", 
    59         "English" 
    60     ); 
    6151 
    6252/* End */ 
  • trunk/wifidog-auth/wifidog/include/language.php

    r553 r566  
    11<?php 
    22require_once BASEPATH.'classes/Session.php'; 
     3require_once BASEPATH.'classes/Locale.php'; 
    34$session = new Session(); 
    4 /* Gettext support */ 
    5 if(!function_exists ('gettext')) 
    6   { 
    7     define('GETTEXT_AVAILABLE', false); 
    8     /* Redefine the gettext functions if gettext isn't installed */ 
    9     function gettext($string) 
    10     { 
    11       return $string; 
    12     } 
    13     function _($string) 
    14     { 
    15       return $string; 
    16     } 
    17   } 
    18 else 
    19   { 
    20     define('GETTEXT_AVAILABLE', true); 
    21   } 
    225 
    23 if (!empty($_REQUEST['lang'])) { 
    24     $session->set('SESS_LANGUAGE_VAR', $_REQUEST['lang']); 
     6if (!empty ($_REQUEST['lang'])) 
     7{ 
     8        Locale::setCurrentLocale(Locale::getObject($_REQUEST['lang'])); 
    259} 
    2610 
    27 if ($session->get('SESS_LANGUAGE_VAR')) { 
    28     setlocale(LC_ALL, $session->get('SESS_LANGUAGE_VAR')); 
    29 } 
    30  
    31 if (GETTEXT_AVAILABLE) { 
    32         $current_locale = setlocale(LC_ALL, DEFAULT_LANG); 
    33         if (setlocale(LC_ALL, DEFAULT_LANG) != DEFAULT_LANG) { 
    34                 echo "Warning: language.php: Unable to setlocale() to ".DEFAULT_LANG.", return value: $current_locale, current locale: ".  setlocale(LC_ALL, 0); 
    35         } 
    36  
    37         bindtextdomain('messages', BASEPATH.'/locale'); 
    38         bind_textdomain_codeset('messages', 'UTF-8'); 
    39         textDomain('messages'); 
    40  
    41         if (!empty($_REQUEST['lang']) && isset($session)) { 
    42             $session->set(SESS_LANGUAGE_VAR, $_REQUEST['lang']); 
    43         } 
    44  
    45         if (isset($session) && $session->get(SESS_LANGUAGE_VAR)) { 
    46             putenv("LC_ALL=".$session->get(SESS_LANGUAGE_VAR)); 
    47             putenv("LANGUAGE=".$session->get(SESS_LANGUAGE_VAR)); 
    48             setlocale(LC_ALL, $session->get(SESS_LANGUAGE_VAR)); 
    49             if (isset($smarty)) { 
    50                 $smarty->assign("lang_id", $session->get(SESS_LANGUAGE_VAR)); 
    51             } 
    52         } else { 
    53             putenv("LC_ALL=" . DEFAULT_LANG); 
    54             putenv("LANGUAGE=" . DEFAULT_LANG); 
    55             setlocale(LC_ALL, DEFAULT_LANG); 
    56             $smarty->assign("lang_id", DEFAULT_LANG); 
    57         } 
    58  
    59         if (isset($smarty)) { 
    60             $smarty->assign("lang_ids", $lang_ids); 
    61             $smarty->assign("lang_names", $lang_names); 
    62         } 
    63 } 
     11$locale = Locale::getCurrentLocale(); 
     12$locale_id = $locale->getId(); 
     13                if (isset ($smarty)) 
     14                { 
     15                        $smarty->assign("lang_id", $locale_id); 
     16                } 
    6417?> 
  • trunk/wifidog-auth/wifidog/index.php

    r544 r566  
    2020   \********************************************************************/ 
    2121  /**@file index.php 
     22   * Authserver home page 
    2223   * @author Copyright (C) 2004 Benoit Gr�goire 
    2324   */ 
     
    2728require_once BASEPATH.'include/common_interface.php'; 
    2829require_once BASEPATH.'classes/Node.php'; 
     30require_once BASEPATH.'classes/MainUI.php'; 
    2931 
    3032$smarty->assign("num_valid_users", $stats->getNumValidUsers()); 
     
    3234 
    3335$smarty->assign("title", _("authentication server")); 
    34 $smarty->display("templates/main.html"); 
     36$ui=new MainUI(); 
     37$ui->setMainContent($smarty->fetch("templates/main.html")); 
     38$ui->display(); 
    3539?> 
  • trunk/wifidog-auth/wifidog/local_content/default/stylesheet.css

    r565 r566  
    11{literal} 
    2 body { 
    3   {/literal} 
    4   background: #fff url({$common_content_url}back.gif) repeat-y; 
    5   {literal} 
    6   margin: 0; 
    7   font-family: helvetica; 
    8   font-size: 90%; 
    9   color: #628C53; 
    10 } 
    11  
    12 #head { 
    13   {/literal} 
    14   background: #CCE0C5 url({$common_content_url}h1_back.gif) repeat-x; 
    15   {literal} 
    16 } 
    17  
    18 h1 { 
    19   {/literal} 
    20   background: url({$common_content_url}head.gif) no-repeat top left; 
    21   {literal} 
    22   margin: 0; 
    23   padding: 7px 2px 2px 186px; 
    24   height: 50px; 
    25   font-weight: normal; 
    26   font-size: 1.5em; 
    27   text-align: center; 
    28   color: #fff; 
    29 } 
    30  
    31 h2 { 
    32   /*clear: both;*/ 
    33   border-bottom: 1px solid #BFDCB5; 
    34   color: #628C53; 
    35 } 
    36  
    37 #login { 
    38   background: #CCE0C5; 
    39   padding: 2px 10px; 
    40   text-align: right; 
    41   font-size: 0.9em; 
    42   color: #628C53; 
    43 } 
    44  
    45 #login form, #login p { 
    46   margin: 0; 
    47 } 
    48  
    49 #login span { 
    50   padding-right: 20px; 
    51   font-weight: bold; 
    52 } 
    53  
    54 #content { 
    55   float: none; 
    56   margin-left: 186px; 
    57   padding: 10px; 
    58   border-top: 1px solid #BFDCB5; 
    59 } 
    60  
    61 #navLeft { 
    62   float: left; 
    63   width: 186px; 
    64   color: #628C53; 
    65 } 
    66  
    67 #navLeft ul { 
    68   margin-left: 15px; 
    69   padding-left: 0; 
    70   list-style-type: none; 
    71 } 
    72  
    73 #navLeft ul li { 
    74   padding: 3px 0; 
    75 } 
    76  
    77 #navLeft a { 
    78   color: #35952A; 
    79 } 
    80  
    81 #navLeft a:hover { 
    82   color: #FB7F44; 
    83 } 
    84  
    85 #navLeft h3 { 
    86   margin-left: 15px; 
    87   font-size: 1.2em; 
    88 } 
     2body{ 
     3        margin: 0px; 
     4        padding: 0px; 
     5        font-family: arial, sans-serif; 
     6        color: #616756; 
     7        font-size: 11px; 
     8        overflow: hidden; 
     9} 
     10 
     11.outer_container 
     12{ 
     13        margin-left: 252px;  /* L+2*left border */ 
     14        border-left: 1px solid #000; 
     15        background-color: #fcd; 
     16} 
     17 
     18#tool_section{ 
     19        border: 1px solid #E9E9E9; 
     20        float:left; 
     21        float: left; 
     22        position: relative; 
     23        width: 250px;  /* L */ 
     24        margin-left: -254px;  /* -L-1-2*left border- 2* right border */ 
     25        margin-right: 2px; 
     26} 
     27 
     28#main_section{ 
     29        border: 1px solid #E9E9E9; 
     30        float:right; 
     31        width: 100%; 
     32        margin-left: -1px; 
     33} 
     34 
     35div.tool_user_info{ 
     36        background: #C8FF7A; 
     37        background-color: #C8FF7A; 
     38        vertical-align: middle; 
     39} 
     40span.tool_user_info{ 
     41        position: relative; 
     42        top: 3px; 
     43        bottom: 3px; 
     44} 
     45div.navigation{ 
     46        width: 250px; 
     47        height: 38px; 
     48        text-align: center; 
     49    {/literal} 
     50        background-image: url(../images/01_nav.gif); 
     51    {literal} 
     52        background-repeat: repeat; 
     53        background-position: left top; 
     54        overflow: hidden; 
     55} 
     56span.navigation{ 
     57        position: relative; 
     58        top: 10px; 
     59} 
     60div.language{ 
     61        width: 250px; 
     62        height: 30px; 
     63} 
     64form.language{ 
     65        position: relative; 
     66        top: 5px; 
     67        right: 5px; 
     68        text-align: right; 
     69} 
     70.tool_content{ 
     71        width: 250px; 
     72        overflow: hidden; 
     73} 
     74 
     75div.avis{ 
     76        width: 250px; 
     77        height: 200px; 
     78    {/literal} 
     79        background-image: url(../images/03_avis.gif); 
     80    {literal} 
     81        background-repeat: repeat-x; 
     82        background-position: left top; 
     83        background-color: #FDFDFD; 
     84} 
     85span.avis{ 
     86        position: relative; 
     87        top: 20px; 
     88        left: 10px; 
     89} 
     90div.anysection{ 
     91        padding: 0px 5px 0px 5px; 
     92        font-family: arial, sans-serif; 
     93        color: #616756; 
     94        font-size: 11px; 
     95        text-align: left; 
     96} 
     97div.test{ 
     98        text-align: center; 
     99        vertical-align: text-top; 
     100} 
     101h1{ 
     102        font-family: verdana, sans-serif; 
     103        color: #88AA4B; 
     104        font-size: 14px; 
     105} 
     106form{ 
     107        padding: 0px; 
     108        margin: 0px; 
     109} 
     110img.separator{ 
     111        display: inline; 
     112        position: relative; 
     113        top: 0px; 
     114        vertical-align: text-top; 
     115} 
     116img.administration{ 
     117        vertical-align: middle; 
     118} 
     119a{ 
     120        font-family: arial, sans-serif; 
     121        color: #616756; 
     122        font-size: 11px; 
     123        text-decoration: underline; 
     124} 
     125a:hover{ 
     126        font-family: arial, sans-serif; 
     127        color: #88AA4B; 
     128        font-size: 11px; 
     129        text-decoration: underline; 
     130} 
     131a.administration{ 
     132        margin: 5px; 
     133        font-family: arial, sans-serif; 
     134        color: #616756; 
     135        font-size: 11px; 
     136        font-weight: bold; 
     137        text-decoration: none; 
     138} 
     139a.navigation{ 
     140        position: relative; 
     141        top: 10px; 
     142        padding-left: 5px; 
     143        padding-right: 5px; 
     144        font-family: arial, sans-serif; 
     145        color: #616756; 
     146        font-size: 11px; 
     147        text-decoration: none; 
     148} 
     149.indent{ 
     150        padding-left: 25px; 
     151} 
     152 
     153select{ 
     154        font-family: arial, sans-serif; 
     155        color: #616756; 
     156        font-size: 11px; 
     157        border: 1px solid #C8FF7A; 
     158        background: #C8FF7A; 
     159} 
     160 
     161 
     162/*********************************************************************/ 
    89163 
    90164.logos { 
     
    93167} 
    94168 
    95 p.sidenote { 
    96   margin: 20px 10px; 
    97   padding: 10px 5px; 
    98   border: 1px solid #BFDCB5; 
    99 } 
    100  
    101 .hotspot { 
    102   padding: 5px; 
    103   border: 1px solid #BFDCB5; 
    104 } 
    105  
    106  
    107 .warning { 
    108         color:red; 
    109         font:bold 14px/18px verdana, arial, helvetica, sans-serif; 
    110         margin:0px 0px 5px 10px; 
    111         padding:0px; 
    112 }        
    113  
    114 .spreadsheet { border: thin solid lightblue  ; text-align:left} 
    115 TH.spreadsheet { background-color: lightgrey} 
    116 TABLE.spreadsheet { border: solid darkblue  ; text-align:left} 
    117 TABLE.spreadsheet_user { border:  thin solid lightblue ;        padding:0px;    margin:0px;} 
    118 TH.th_left { background-color: lightgrey  ; text-align:left} 
    119 TH.th_section { background-color: silver  ; text-align:center} 
    120 TD.spreadsheet_user { /*background-color: lightgray;*/ } 
    121 .popup { background-color: white;   border: solid darkblue    ; text-align:left} 
    122 .link     { color: blue; text-decoration: underline } 
    123 A:link    { color: blue } 
    124 A:active  { color: red; /* font-size: 125% */} 
    125 A:visited { font-size: 85% } 
    126  
    127 #node_list { float: left; } 
    128 #node_list table { background-color: #b1d5ba; border-collapse: collapse; width: 100%; } 
    129 #node_list tr { background-color: #e1f5da; border: 1px solid; } 
    130 #node_list tr.even { background-color: #e1f5da; } 
    131 #node_list tr.odd { background-color: #b1d5ba; } 
    132 #node_list td { margin: 0 0 0 0; text-align: center; color: #000000; } 
    133 #node_list td.status { width: 15em; text-align: left; font-size: 9pt; } 
    134 #node_list a { color: #000000; } 
    135  
    136 #hotspot_status { float: left; } 
    137 #hotspot_status table { background-color: #b1d5ba; border-collapse: collapse; width: 100%; } 
    138 #hotspot_status tr { vertical-align: top; font-size: 10pt; font-family: Arial; background-color: #e1f5da; border: 1px solid; } 
    139 #hotspot_status tr.even { background-color: #e1f5da; } 
    140 #hotspot_status tr.odd { background-color: #b1d5ba; } 
    141 #hotspot_status td { margin: 0 0 0 0; color: #000000; } 
    142 #hotspot_status a { color: #000000; } 
    143  
    144 #hotspot_log { margin: 1em; } 
    145 #hotspot_log table { background-color: #b1d5ba; border-collapse: collapse; } 
    146 #hotspot_log th { background-color: #e1f5da; border: 1px solid; text-align: left; } 
    147 #hotspot_log tr { background-color: #ffffff; border: 1px solid; } 
    148 #hotspot_log td { margin: 0 0 0 0; color: #000000; } 
    149 #hotspot_log td.status { width: 15em; text-align: left; font-size: 9pt; } 
    150 #hotspot_log a { color: #000000; } 
    151  
    152 #user_stats { float: left; } 
    153 #user_stats table { background-color: #b1d5ba; border-collapse: collapse; } 
    154 #user_stats th { background-color: #e1f5da; border: 1px solid; } 
    155 #user_stats tr { background-color: #ffffff; border: 1px solid; } 
    156 #user_stats td { margin: 0 0 0 0; color: #000000; } 
    157 #user_stats td.status { width: 15em; text-align: left; font-size: 9pt; } 
    158 #user_stats a { color: #000000; } 
    159  
    160 #std_table { float: left; } 
    161 #std_table table { border: 1px solid gray; } 
    162 #std_table th { font-size: 14pt; background-color: #e1f5da;} 
    163 #std_table td.item { font-weight: bold; } 
    164169 
    165170/** Messages */ 
     
    287292    clear: left; 
    288293} 
     294 
     295.spreadsheet { border: thin solid lightblue  ; text-align:left} 
     296TH.spreadsheet { background-color: lightgrey} 
     297TABLE.spreadsheet { border: solid darkblue  ; text-align:left} 
     298TABLE.spreadsheet_user { border:  thin solid lightblue ;        padding:0px;    margin:0px;} 
     299TH.th_left { background-color: lightgrey  ; text-align:left} 
     300TH.th_section { background-color: silver  ; text-align:center} 
     301TD.spreadsheet_user { /*background-color: lightgray;*/ } 
     302.popup { background-color: white;   border: solid darkblue    ; text-align:left} 
     303.link     { color: blue; text-decoration: underline } 
     304 
     305#node_list { float: left; } 
     306#node_list table { background-color: #b1d5ba; border-collapse: collapse; width: 100%; } 
     307#node_list tr { background-color: #e1f5da; border: 1px solid; } 
     308#node_list tr.even { background-color: #e1f5da; } 
     309#node_list tr.odd { background-color: #b1d5ba; } 
     310#node_list td { margin: 0 0 0 0; text-align: center; color: #000000; } 
     311#node_list td.status { width: 15em; text-align: left; font-size: 9pt; } 
     312#node_list a { color: #000000; } 
     313 
     314#hotspot_status { float: left; } 
     315#hotspot_status table { background-color: #b1d5ba; border-collapse: collapse; width: 100%; } 
     316#hotspot_status tr { vertical-align: top; font-size: 10pt; font-family: Arial; background-color: #e1f5da; border: 1px solid; } 
     317#hotspot_status tr.even { background-color: #e1f5da; } 
     318#hotspot_status tr.odd { background-color: #b1d5ba; } 
     319#hotspot_status td { margin: 0 0 0 0; color: #000000; } 
     320#hotspot_status a { color: #000000; } 
     321 
     322#hotspot_log { margin: 1em; } 
     323#hotspot_log table { background-color: #b1d5ba; border-collapse: collapse; } 
     324#hotspot_log th { background-color: #e1f5da; border: 1px solid; text-align: left; } 
     325#hotspot_log tr { background-color: #ffffff; border: 1px solid; } 
     326#hotspot_log td { margin: 0 0 0 0; color: #000000; } 
     327#hotspot_log td.status { width: 15em; text-align: left; font-size: 9pt; } 
     328#hotspot_log a { color: #000000; } 
     329 
     330#user_stats { float: left; } 
     331#user_stats table { background-color: #b1d5ba; border-collapse: collapse; } 
     332#user_stats th { background-color: #e1f5da; border: 1px solid; } 
     333#user_stats tr { background-color: #ffffff; border: 1px solid; } 
     334#user_stats td { margin: 0 0 0 0; color: #000000; } 
     335#user_stats td.status { width: 15em; text-align: left; font-size: 9pt; } 
     336#user_stats a { color: #000000; } 
     337 
     338#std_table { float: left; } 
     339#std_table table { border: 1px solid gray; } 
     340#std_table th { font-size: 14pt; background-color: #e1f5da;} 
     341#std_table td.item { font-weight: bold; } 
     342 
    289343{/literal} 
  • trunk/wifidog-auth/wifidog/login/index.php

    r553 r566  
    11<?php 
     2 
    23 
    34// $Id$ 
     
    3132require_once BASEPATH.'classes/Node.php'; 
    3233require_once BASEPATH.'classes/User.php'; 
     34require_once BASEPATH.'classes/Network.php'; 
    3335 
    34 if (!empty ($_REQUEST['url'])) { 
     36if (!empty ($_REQUEST['url'])) 
     37{ 
    3538        $session->set(SESS_ORIGINAL_URL_VAR, $_REQUEST['url']); 
    3639} 
    3740 
    38 if (!empty ($_REQUEST['username']) && !empty ($_REQUEST['password']) && !empty ($_REQUEST['auth_source'])) { 
     41if (!empty ($_REQUEST['username']) && !empty ($_REQUEST['password']) && !empty ($_REQUEST['auth_source'])) 
     42{ 
    3943        $errmsg = ''; 
    4044        $username = $db->EscapeString($_REQUEST['username']); 
    41         $auth_source = $db->EscapeString($_REQUEST['auth_source']); 
    4245 
    43         // Authenticating the user through the sselected auth source. 
    44         $user = $AUTH_SOURCE_ARRAY[$auth_source]['authenticator']->login($_REQUEST['username'], $_REQUEST['password'], $errmsg); 
     46        // Authenticating the user through the selected auth source. 
     47$network = Network::processSelectNetworkUI('auth_source'); 
    4548 
    46         if ($user != null) { 
    47                 if (isset ($_REQUEST['gw_address']) && isset ($_REQUEST['gw_port']) && ($token = $user->generateConnectionToken())) { 
     49$user = $network->getAuthenticator()->login($_REQUEST['username'], $_REQUEST['password'], $errmsg); 
     50        if ($user != null) 
     51        { 
     52                if (isset ($_REQUEST['gw_address']) && isset ($_REQUEST['gw_port']) && ($token = $user->generateConnectionToken())) 
     53                { 
    4854                        header("Location: http://".$_REQUEST['gw_address'].":".$_REQUEST['gw_port']."/wifidog/auth?token=$token"); 
    49                 } else { 
     55                } 
     56                else 
     57                { 
    5058                        /* Virtual login */ 
    5159                        header("Location: ".BASE_NON_SSL_PATH); 
    5260                } 
    5361                exit; 
    54         } else { 
    55                 $smarty->assign("error", $errmsg); 
    5662        } 
    57 } else { 
    58  
    59         $smarty->assign("error", _('Your must specify your username and password')); 
     63        else 
     64        { 
     65                $error = $errmsg; 
     66        } 
     67} 
     68else 
     69{ 
     70        $error = _('Your must specify your username and password'); 
    6071} 
    6172 
     
    6576isset ($_REQUEST["auth_source"]) && $smarty->assign('selected_auth_source', $_REQUEST["auth_source"]); 
    6677 
    67 if (isset ($_REQUEST['gw_id'])) { 
    68         $smarty->assign("gw_id", $_REQUEST['gw_id']); 
     78$node=null; 
     79if (!empty ($_REQUEST['gw_id'])) 
     80{ 
     81        $gw_id=$_REQUEST['gw_id']; 
    6982 
    70         try { 
    71                 $node = Node :: getObject($db->EscapeString(CURRENT_NODE_ID)); 
    72                 $smarty->assign('hotspot_name', $node->getName()); 
    73         } catch (Exception $e) { 
     83        try 
     84        { 
     85                $node = Node :: getObject($_REQUEST['gw_id']); 
     86                $hotspot_name = $node->getName(); 
     87        } 
     88        catch (Exception $e) 
     89        { 
    7490                $smarty->assign("error", $e->getMessage()); 
    7591                $smarty->display("templates/generic_error.html"); 
    7692                exit; 
    7793        } 
    78 } else { 
     94} 
     95else 
     96{ 
    7997        /* Gateway ID is not set... Virtual login */ 
    80         $smarty->display("templates/login_virtual.html"); 
    81         exit; 
    8298} 
    8399 
    84 isset ($_REQUEST["username"]) && $smarty->assign('username', $_REQUEST["username"]); 
    85 isset ($_REQUEST["gw_address"]) && $smarty->assign('gw_address', $_REQUEST['gw_address']); 
    86 isset ($_REQUEST["gw_port"]) && $smarty->assign('gw_port', $_REQUEST['gw_port']); 
    87 isset ($_REQUEST["gw_id"]) && $smarty->assign('gw_id', $_REQUEST['gw_id']); 
     100isset ($_REQUEST["username"]) && $username = $_REQUEST["username"]; 
     101isset ($_REQUEST["gw_address"]) && $gw_address = $_REQUEST['gw_address']; 
     102isset ($_REQUEST["gw_port"]) && $gw_port = $_REQUEST['gw_port']; 
     103isset ($_REQUEST["gw_id"]) && $gw_id = $_REQUEST['gw_id']; 
    88104 
    89105isset ($_REQUEST["gw_address"]) && $session->set(SESS_GW_ADDRESS_VAR, $_REQUEST['gw_address']); 
     
    91107isset ($_REQUEST["gw_id"]) && $session->set(SESS_GW_ID_VAR, $_REQUEST['gw_id']); 
    92108 
    93 $smarty->display("templates/".LOGIN_PAGE_NAME); 
     109$html = ''; 
     110$html .= '<div id="form">'."\n"; 
     111if (empty ($_REQUEST['gw_id'])) 
     112{ 
     113        $html .= '<h3>'._("This is the 'virtual login' page you can use to get the credentials which will then give you access to management functions on the network without being at a hotspot.").'</h3>'."\n"; 
     114} 
     115else 
     116{ 
     117        $html .= '<h3>'._("Welcome! Hotspot:")." $hotspot_name</h3>\n"; 
     118} 
     119 
     120$html .= '<h3>'._("Please log-in or").'<br><a href="'.BASE_SSL_PATH.'signup.php">'._("Sign-up, it's free!").'</a></h3>'."\n"; 
     121 
     122$html .= '<form name="login_form" method="post">'."\n"; 
     123if($node!=null) 
     124{ 
     125        $html .= '<input type="hidden" name="gw_address" value="'.$gw_address.'">'."\n"; 
     126$html .= '<input type="hidden" name="gw_port" value="'.$gw_port.'">'."\n"; 
     127$html .= '<input type="hidden" name="gw_id" value="'.$gw_id.'">'."\n"; 
     128} 
     129$html .= '<table>'."\n"; 
     130$html .= Network::getSelectNetworkUI('auth_source'); 
     131$html .= '<tr>'."\n"; 
     132$html .= '<td>'._("Username (or email)").':</td>'."\n"; 
     133$html .= '<td><input type="text" name="username" value="'.$username.'" size="20"></td>'."\n"; 
     134$html .= '</tr>'."\n"; 
     135$html .= '<tr>'."\n"; 
     136$html .= '<td>'._("Password").':</td>'."\n"; 
     137$html .= '<td><input type="password" name="password" size="20"></td>'."\n"; 
     138$html .= '</tr>'."\n"; 
     139$html .= '<tr>'."\n"; 
     140$html .= '<td></td>'."\n"; 
     141$html .= '<td><input class="submit" type="submit" name="submit" value="'._("Login").'"></td>'."\n"; 
     142$html .= '</tr>'."\n"; 
     143$html .= '</table>'."\n"; 
     144$html .= '</form>'."\n"; 
     145 
     146$html .= '<h3>'._("I already have an account, but").':</h3>'."\n"; 
     147$html .= '<ul>'."\n"; 
     148$html .= '<li><a href="'.BASE_SSL_PATH.'lost_username.php">'._("I Forgot my username").'</a><br>'."\n"; 
     149$html .= '<li><a href="'.BASE_SSL_PATH.'lost_password.php">'._("I Forgot my password").'</a>'."\n"; 
     150$html .= '<li><a href="'.BASE_SSL_PATH.'resend_validation.php">'._("Re-send the validation email").'</a><br>'."\n"; 
     151if ($error) 
     152{ 
     153        $class = 'class="help"'; 
     154} 
     155else 
     156{ 
     157        $class = ''; 
     158} 
     159$html .= '<li><a href="'.BASE_SSL_PATH.'faq.php">'._("I have trouble connecting and I would like some help").'</a><br>'."\n"; 
     160$html .= '</ul>'."\n"; 
     161$html .= '</div>'."\n"; 
     162 
     163if ($error) 
     164{ 
     165        $html .= '<div id="help">'."\n"; 
     166        $html .= "$error\n"; 
     167        $html .= '</div>'."\n"; 
     168} 
     169 
     170require_once BASEPATH.'classes/MainUI.php'; 
     171$ui = new MainUI(); 
     172$ui->setMainContent($html); 
     173$ui->display(); 
    94174?> 
    95175 
     176 
     177 
  • trunk/wifidog-auth/wifidog/node_list.php

    r405 r566  
    3535} 
    3636 
    37 $smarty->display("templates/node_list.html"); 
     37require_once BASEPATH.'classes/MainUI.php'; 
     38$ui=new MainUI(); 
     39//$ui->setToolSection('ADMIN'); 
     40$ui->setMainContent($smarty->fetch("templates/node_list.html")); 
     41$ui->display(); 
    3842?> 
  • trunk/wifidog-auth/wifidog/portal/index.php

    r554 r566  
    11<?php 
    2   // $Id$ 
    3   /********************************************************************\ 
    4    * This program is free software; you can redistribute it and/or    * 
    5    * modify it under the terms of the GNU General Public License as   * 
    6    * published by the Free Software Foundation; either version 2 of   * 
    7    * the License, or (at your option) any later version.              * 
    8    *                                                                  * 
    9    * This program is distributed in the hope that it will be useful,  * 
    10    * but WITHOUT ANY WARRANTY; without even the implied warranty of   * 
    11    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    * 
    12    * GNU General Public License for more details.                     * 
    13    *                                                                  * 
    14    * You should have received a copy of the GNU General Public License* 
    15    * along with this program; if not, contact:                        * 
    16    *                                                                  * 
    17    * Free Software Foundation           Voice:  +1-617-542-5942       * 
    18    * 59 Temple Place - Suite 330        Fax:    +1-617-542-2652       * 
    19    * Boston, MA  02111-1307,  USA       gnu@gnu.org                   * 
    20    *                                                                  * 
    21    \********************************************************************/ 
    22   /**@file index.php Displays the portal page 
    23    * @author Copyright (C) 2004 Benoit Gr�goire et Philippe April 
    24    */ 
    252 
    26 define('BASEPATH','../'); 
     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 
     27define('BASEPATH', '../'); 
    2728require_once BASEPATH.'include/common.php'; 
    2829require_once BASEPATH.'include/common_interface.php'; 
    2930require_once BASEPATH.'classes/Node.php'; 
     31require_once BASEPATH.'classes/MainUI.php'; 
    3032 
    31 if (CONF_USE_CRON_FOR_DB_CLEANUP == false) { 
    32     garbage_collect(); 
     33if (CONF_USE_CRON_FOR_DB_CLEANUP == false) 
     34{ 
     35        garbage_collect(); 
    3336} 
    34 $node = Node::getObject($_REQUEST['gw_id']); 
     37$node = Node :: getObject($_REQUEST['gw_id']); 
    3538 
    36 if ($node==null) { 
    37     $smarty->display("templates/message_unknown_hotspot.html"); 
    38     exit; 
    39 } 
    40 $node_id=$node->getId(); 
    41 $portal_template = $node_id . ".html"; 
    42  
    43 if ($node == null) { 
    44     $smarty->assign("gw_id", $_REQUEST['gw_id']); 
    45     $smarty->display("templates/message_unknown_hotspot.html"); 
    46     exit; 
     39if ($node == null) 
     40{ 
     41        $smarty->assign("gw_id", $_REQUEST['gw_id']); 
     42        $smarty->display("templates/message_unknown_hotspot.html"); 
     43        exit; 
    4744} 
    4845 
    49 Node::setCurrentNode($node); 
     46$node_id = $node->getId(); 
     47$portal_template = $node_id.".html"; 
     48Node :: setCurrentNode($node); 
    5049 
    51 $smarty->assign('hotspot_name', $node->getName()); 
    52 $node_name= $node->getName(); 
     50$ui = new MainUI(); 
     51if (isset ($session)) 
     52{ 
     53        $smarty->assign("original_url_requested", $session->get(SESS_ORIGINAL_URL_VAR)); 
     54} 
    5355 
    54 /* Find out who is online */ 
    55 $smarty->assign("online_users", $node->getOnlineUsers()); 
     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"; 
    5661 
     62$tool_html .= "<h1>Users Online</h1>"."\n"; 
     63$tool_html .= '<p class="indent">'."\n"; 
     64$current_node = Node :: getCurrentNode(); 
     65if ($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} 
     79else 
     80{ 
     81        $current_node_id = null; 
     82        $tool_html .= _("You are not currently at a hotspot..."); 
     83} 
     84$tool_html .= "</p>"."\n"; 
    5785 
    58 if (isset($session)) { 
    59     $smarty->assign("original_url_requested", $session->get(SESS_ORIGINAL_URL_VAR)); 
    60 } 
    61         $hotspot_network_name=HOTSPOT_NETWORK_NAME; 
    62         $hotspot_network_url=HOTSPOT_NETWORK_URL; 
    63         $network_logo_url=COMMON_CONTENT_URL.NETWORK_LOGO_NAME; 
    64         $network_logo_banner_url=COMMON_CONTENT_URL.NETWORK_LOGO_BANNER_NAME; 
     86$tool_html .= '<p class="indent">'."\n"; 
    6587 
    66      $hotspot_logo_url= find_local_content_url(HOTSPOT_LOGO_NAME); 
    67      $hotspot_logo_banner_url=find_local_content_url(HOTSPOT_LOGO_BANNER_NAME); 
     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); 
    6891 
     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; 
    6996 
    70 $smarty->display(DEFAULT_CONTENT_SMARTY_PATH."header.html"); 
    71 $html=''; 
     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 = ''; 
    72101$html .= "<div id='portal_container'>\n"; 
    73102 
     
    76105$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"; 
    77106$html .= "Content from \"<a href='{$hotspot_network_url}'>{$hotspot_network_name}</a>\"\n"; 
    78 $contents = Network::getCurrentNetwork()->getAllContent(); 
     107$contents = Network :: getCurrentNetwork()->getAllContent(); 
    79108foreach ($contents as $content) 
    80109{ 
     
    86115$html .= "<div class='portal_node_section'>\n"; 
    87116$html .= "<img class='portal_section_logo' src='{$hotspot_logo_url}' alt=''>\n"; 
    88 $html .= "Content from \"<a href='{$hotspot_logo_url}'>{$node_name}</a>\"\n"; 
     117$html .= "Content from "; 
     118$node_homepage = $node->getHomePageURL(); 
     119if(!empty($node_homepage)) 
     120{ 
     121        $html .= "<a href='$node_homepage'>"; 
     122} 
     123$html .= $node->getName(); 
     124 
     125if(!empty($node_homepage)) 
     126{ 
     127        $html .= "</a>\n"; 
     128} 
    89129$contents = $node->getAllContent(); 
    90130foreach ($contents as $content) 
     
    99139$html .= "</div>\n"; 
    100140$html .= "</div>\n"; /* end portal_container */ 
    101                 echo $html; 
     141 
     142$ui->setMainContent($html); 
     143$ui->display(); 
    102144/* If we have local content, display it. Otherwise, display default */ 
    103145/*if (is_file(NODE_CONTENT_PHP_RELATIVE_PATH.PORTAL_PAGE_NAME)) { 
     
    109151} 
    110152*/ 
     153?> 
    111154 
    112 $smarty->display(DEFAULT_CONTENT_SMARTY_PATH."footer.html"); 
    113 ?> 
     155 
  • trunk/wifidog-auth/wifidog/templates/change_password.html

    r530 r566  
    1 {include file="templates/header_small.html"} 
    21    <div id="form"> 
    32        <h3>{"Change my password"|_}</h3> 
     
    3837        {/if} 
    3938    </div> 
    40 {include file="templates/footer.html"} 
  • trunk/wifidog-auth/wifidog/templates/faq.html

    r416 r566  
    1 {include file="templates/header_small.html"} 
     1 
    22    <div id="form"> 
    33        <h2>{"Frequently Asked Questions"|_}</h3> 
     
    2525        </p> 
    2626    </div> 
    27  
    28 {include file="templates/footer.html"} 
     27     
  • trunk/wifidog-auth/wifidog/templates/generic_error.html

    r456 r566  
    1 {include file="templates/header_small.html"} 
    21 
    32<p> 
     
    98</p> 
    109 
    11 {include file="templates/footer.html"} 
  • trunk/wifidog-auth/wifidog/templates/hotspot_status.html

    r437 r566  
    1 {include file="templates/header.html" title="hotspot list"} 
     1 
    22<div id="hotspot_status"> 
    33<table> 
  • trunk/wifidog-auth/wifidog/templates/lost_password.html

    r530 r566  
    1 {include file="templates/header_small.html"} 
    21    <div id="form"> 
    32        <h3>{"Lost password"|_}</h3> 
     
    3029        {/if} 
    3130    </div> 
    32 {include file="templates/footer.html"} 
  • trunk/wifidog-auth/wifidog/templates/lost_username.html

    r530 r566  
    1 {include file="templates/header_small.html"} 
     1 
    22    <div id="form"> 
    33        <h3>{"Lost username"|_}</h3> 
     
    2626        {/if} 
    2727    </div> 
    28 {include file="templates/footer.html"} 
     28 
  • trunk/wifidog-auth/wifidog/templates/main.html

    r349 r566  
    1 {include file="templates/header.html" title="authentication server"} 
    21<p>{"The network currently has"|_} {$num_valid_users} {"valid users"|_}. {$num_online_users} {"user(s) are currently online"|_}.</p> 
    32<ul> 
  • trunk/wifidog-auth/wifidog/templates/message_activate.html

    r388 r566  
    1 {include file="templates/header_small.html"} 
    21 
    32<p> 
     
    1312</p> 
    1413 
    15 {include file="templates/footer.html"} 
  • trunk/wifidog-auth/wifidog/templates/message_default.html

    r388 r566  
    1 {include file="templates/header_small.html"} 
     1 
    22 
    33<p> 
     
    55</p> 
    66 
    7 {include file="templates/footer.html"} 
     7 
  • trunk/wifidog-auth/wifidog/templates/message_denied.html

    r389 r566  
    1 {include file="templates/header_small.html"} 
    21 
    32<p> 
     
    54</p> 
    65 
    7 {include file="templates/footer.html"} 
     6 
  • trunk/wifidog-auth/wifidog/templates/message_failed_validation.html

    r389 r566  
    1 {include file="templates/header_small.html"} 
    21 
    32<p> 
     
    98</p> 
    109 
    11 {include file="templates/footer.html"} 
     10 
  • trunk/wifidog-auth/wifidog/templates/message_unknown_hotspot.html

    r404 r566  
    1 {include file="templates/header_small.html"} 
    2  
    31<p> 
    42{if $gw_id} 
     
    1311</p> 
    1412 
    15 {include file="templates/footer.html"} 
  • trunk/wifidog-auth/wifidog/templates/node_list.html

    r405 r566  
    1 {include file="templates/header.html" title="node list"} 
    21<div id="node_list"> 
    32<h3>{"Status of all nodes of the"|_} {$smarty.const.HOTSPOT_NETWORK_NAME} {"network"|_}</h3> 
  • trunk/wifidog-auth/wifidog/templates/resend_validation.html

    r530 r566  
    1 {include file="templates/header_small.html"} 
    21    <div id="form"> 
    32        <h3>{"Re-send validation email"|_}</h3> 
     
    2625        {/if} 
    2726    </div> 
    28 {include file="templates/footer.html"} 
  • trunk/wifidog-auth/wifidog/templates/signup.html

    r530 r566  
    1 {include file="templates/header_small.html"} 
    21    <div id="form"> 
    32        <h3>{"Register a free account with"|_} {$hotspot_network_name}</h3> 
     
    3837        {/if} 
    3938    </div> 
    40  
    41 {include file="templates/footer.html"} 
  • trunk/wifidog-auth/wifidog/validate.php

    r517 r566  
    3434        throw new Exception(_('No user ID specified!')); 
    3535 
    36     $user = User::getUserByID($_REQUEST['user_id']); 
     36    $user = User::getObject($_REQUEST['user_id']); 
    3737 
    3838    if ($db->EscapeString($_REQUEST['token']) != $user->getValidationToken())