Changeset 1156

Show
Ignore:
Timestamp:
12/31/06 00:25:37 (5 years ago)
Author:
benoitg
Message:
  • install.php: Move path verification to the first page, and make it clearer. Fix PHP warnings.
  • wifidog/include/smarty.resource.string.php: A smarty resource plugin to parse a smarty template from a

string

  • SmartyTemplate?: Very basic but functionnal commit of the new Smarty content type. IMPORTANT NOTE: This will eventually obsolete IFrameRest, which will be removed.
  • Continue cleaning-up/standardizing Smarty variable usage.
Location:
trunk/wifidog-auth
Files:
3 added
13 modified

Legend:

Unmodified
Added
Removed
  • trunk/wifidog-auth/CHANGELOG

    r1154 r1156  
     12006-12-30 Benoit Grégoire  <bock@step.polymtl.ca> 
     2        * install.php:  Move path verification to the first page, and make it clearer.  Fix PHP warnings. 
     3        * wifidog/include/smarty.resource.string.php:  A smarty resource plugin to parse a smarty template from a string 
     4        * SmartyTemplate:  Very basic but functionnal commit of the new Smarty content type.   
     5        IMPORTANT NOTE:  This will eventually obsolete IFrameRest, which will be removed. 
     6        * Continue cleaning-up/standardizing Smarty variable usage. 
     7         
     82006-12-12 Benoit Grégoire  <bock@step.polymtl.ca> 
     9        * Fix all PHP 5.2 compatibility issues I could find.  This needs further testing 
     10 
    1112006-12-12 Pascal Charest <pascal.charest@gmail.com> 
    212        * install.php: Remove obsolete Phlickr installation references 
  • trunk/wifidog-auth/wifidog/change_password.php

    r1128 r1156  
    6565$user = User::getCurrentUser(); 
    6666if ($user) { 
    67         User::assignSmartyValues($smarty, $user); 
    6867 
    6968        if ($user->isSuperAdmin() && isset($_REQUEST['username'])) { 
  • trunk/wifidog-auth/wifidog/classes/Content/IFrameRest/IFrameRest.php

    r1090 r1156  
    110110     * @return string HTML code for the administration interface 
    111111     */ 
    112     public function getAdminUI() 
     112    public function getAdminUI($subclass_admin_interface = null, $title=null) 
    113113    { 
    114114        // Init values 
  • trunk/wifidog-auth/wifidog/classes/MainUI.php

    r1147 r1156  
    402402 
    403403                // Init ALL smarty values 
    404                 User :: assignSmartyValues($this->smarty, $_currentUser); 
    405404                $this->smarty->assign('formAction', ""); 
    406405                $this->smarty->assign('nodeUI', ""); 
     
    475474        $_currentUser = User :: getCurrentUser(); 
    476475 
    477         User :: assignSmartyValues($this->smarty, $_currentUser); 
    478  
    479476        $this->smarty->assign('logoutParameters', ""); 
    480477        $this->smarty->assign('loginParameters', ""); 
     
    484481        $this->smarty->assign('techSupportInformation', ""); 
    485482        $this->smarty->assign('shrinkLeftArea', $this->_shrinkLeftArea); 
    486  
    487         // Provide Smarty with information about the network 
    488         Network :: assignSmartyValues($this->smarty); 
    489483 
    490484        /* 
     
    596590         */ 
    597591 
    598         // Get information about user 
    599         User :: assignSmartyValues($this->smarty); 
    600  
    601592        // Provide footer scripts to Smarty 
    602593        $this->smarty->assign('footerScripts', $this->_footerScripts); 
  • trunk/wifidog-auth/wifidog/classes/Node.php

    r1148 r1156  
    15551555        } 
    15561556 
     1557    /** 
     1558     * Assigns values about node to be processed by the Smarty engine. 
     1559     * 
     1560     * @param object $smarty Smarty object 
     1561     * @param object $net    Node object 
     1562     * 
     1563     * @return void 
     1564     * 
     1565     * @static 
     1566     * @access public 
     1567     */ 
     1568    public static function assignSmartyValues($smarty, $node = null) 
     1569    { 
     1570        if (!$node) { 
     1571            $node = self::getCurrentNode(); 
     1572        } 
     1573 
     1574        // Set network details 
     1575        $smarty->assign('nodeId', $node ? $node->getId() : ''); 
     1576        $smarty->assign('nodeName', $node ? $node->getName() : ''); 
     1577    } 
    15571578} 
    15581579 
  • trunk/wifidog-auth/wifidog/classes/SmartyWifidog.php

    r1127 r1156  
    4646 */ 
    4747require_once("classes/Locale.php"); 
     48require_once("include/smarty.resource.string.php"); 
    4849 
    4950// Check if Smarty installed, if not redirect user to web-base installation 
     
    123124 */ 
    124125class SmartyWifidog extends Smarty { 
    125     private static $object; 
    126126    public static function getObject() { 
    127         if (self::$object==null) 
    128         { 
    129                 self::$object=new self(); 
    130         } 
    131         return self::$object; 
     127        return new self(); 
    132128    } 
    133129   private function __construct() 
     
    152148        $this->register_modifier("fsize_format", "smarty_modifier_fsize_format"); 
    153149 
     150                // register the resource name "string" 
     151                $this->register_resource("string", array("smarty_resource_string_source", 
     152                                       "smarty_resource_string_timestamp", 
     153                                       "smarty_resource_string_secure", 
     154                                       "smarty_resource_string_trusted")); 
    154155        $this->caching = false; 
    155156        //$this->compile_check = true; 
    156         $this->assign('app_name','Wifidog auth server'); 
    157  
    158     /* We need this for various forms to redirect properly (language form) */ 
    159     $this->assign('request_uri', $_SERVER["REQUEST_URI"]); 
    160157 
    161158/* Common content */ 
     
    172169 
    173170     /* Other useful stuff */ 
    174      $this->assign('userIsAtHotspot', Node::getCurrentRealNode() != null ? true : false); 
    175  
    176      $this->assign('currentLocale', Locale::getCurrentLocale()); 
     171$this->assign('userIsAtHotspot', Node :: getCurrentRealNode() != null ? true : false); 
     172Network::assignSmartyValues($this); 
     173Node::assignSmartyValues($this); 
     174User::assignSmartyValues($this); 
    177175   } 
    178176 
  • trunk/wifidog-auth/wifidog/help.php

    r1127 r1156  
    5353require_once('classes/Network.php'); 
    5454$smarty = SmartyWifidog::getObject(); 
    55 Network::assignSmartyValues($smarty); 
    5655$smarty->assign('read_the_faq', 
    5756        sprintf('Read the <a href="%sfaq.php">faq</a> document for more information.', BASE_URL_PATH)); 
  • trunk/wifidog-auth/wifidog/index.php

    r1147 r1156  
    6767// Get information about network 
    6868$network = Network::getCurrentNetwork(); 
    69 Network::assignSmartyValues($smarty, $network); 
    70  
    71 // Get information about user 
    72 User::assignSmartyValues($smarty); 
    7369 
    7470/* 
  • trunk/wifidog-auth/wifidog/install.php

    r1154 r1156  
    314314        function execVerbose($command, & $output, & $return_var, $always_show_output = true) { 
    315315            print "$command"; 
    316             $retval = exec($command.'  2>&1', & $output, & $return_var); 
     316            $retval = exec($command.'  2>&1', $output, $return_var); 
    317317            if ($return_var != 0) 
    318318            print "<p style='color:red'><em>Error:</em>  Command did not complete successfully  (returned $return_var): <br/>\n"; 
     
    444444                $error = 0; 
    445445 
    446                 print "<p><em>Installation directory (WIFIDOG_ABS_FILE_PATH)</em>: " . WIFIDOG_ABS_FILE_PATH . "</p>"; 
    447                 print "<p><em>Note:</em> Please validate that 'Installation directory' value is the right one. If this value is wrong, the PATH automatic detection will not work as properly"; 
    448446                print "<p><em>HTTP daemon UNIX username/group</em>: $process_username/$process_group</p>"; 
    449447                #    print "<p><em>HTTPD group</em>: $process_group<BR</p>"; 
     
    14221420        $WIFIDOG_VERSION = $configArray['WIFIDOG_VERSION']; 
    14231421        # TODO : Add links to auth-server web documents 
    1424         print<<<EndHTML 
     1422print<<<EndHTML 
    14251423<h1>Welcome to WifiDog Auth-Server installation and configuration script.</h1> 
    14261424<p>This installation still needs improvement, so please any report bug to the mailing list for better support.<BR/> 
    14271425The current auth-server version is <em>$WIFIDOG_VERSION</em>.</p> 
    14281426 
    1429 <p><strong>Before going any further</strong> with this installation you need to have/create a valid user and database. 
    1430 <p>Here is a command line example for PostgreSQL (or use the way you like) :</p> 
    1431  
     1427<p><strong>Before going any further</strong> with this installation you need to do the following:\n 
     1428<h2>1-Make sure you created a valid user and database.</h2> 
     1429<p>If you haven't, here is a command line example for PostgreSQL (or use the way you like) :</p> 
    14321430<em>Create the PostgreSQL databaser user for WifiDog</em> (createuser and createdb need to be in you PATH) : 
    14331431<pre>  <I>postgres@yourserver $></I> createuser wifidog --pwprompt 
     
    14381436  CREATE USER 
    14391437</pre> 
    1440  
    14411438<em>Create the WifiDog database</em> 
    14421439<pre>  <I>postgres@yourserver $></I> createdb wifidog --encoding=UTF-8 --owner=wifidog 
    14431440  CREATE DATABASE 
    14441441</pre> 
    1445  
    1446 <em>Security</em> : A password is needed to continue with the installation. You need to read the random password in <em>$password_file</em> file. No username needed, only the password. This password is only usefull for the installation, you will never use it in Auth-Server administration pages. 
     1442<h2>2-Check that the paths were autodected properly</h2> 
     1443EndHTML; 
     1444                echo "<table>\n"; 
     1445                echo "<tr><td>Absolute path to the /wifidog directory (WIFIDOG_ABS_FILE_PATH):</td><td>" . WIFIDOG_ABS_FILE_PATH . "</td></tr>\n"; 
     1446                                echo "<tr><td>URL path to reach the /wifidog directory with a web browser (SYSTEM_PATH): </td><td>" . SYSTEM_PATH . "</td></tr>\n"; 
     1447                echo "<tr><td colspan=2><em>Please verify the two values above.</em> They should be autodectected correctly by wifidog in path_defines_base.php.  If there is a bug and they are not, you need to override them in config.php (or find the bug), or your auth server will not work properly.  </td></tr></table>\n"; 
     1448print<<<EndHTML 
     1449<h2>3-Retrieve the install password</h2> 
     1450A password is needed to continue with the installation. You need to read the random password in <em>$password_file</em> file. No username needed, only the password. This password is only usefull for the installation, you will never use it in Auth-Server administration pages. 
    14471451</pre> 
    14481452 
  • trunk/wifidog-auth/wifidog/login/index.php

    r1135 r1156  
    242242 
    243243// Set details about node 
    244 $smarty->assign('node', $node); 
    245244$smarty->assign('gw_address', $gw_address); 
    246245$smarty->assign('gw_port', $gw_port); 
  • trunk/wifidog-auth/wifidog/portal/index.php

    r1147 r1156  
    135135$smarty->assign('sectionMAINCONTENT', false); 
    136136 
    137 // Init ALL smarty values 
    138 $smarty->assign('currentNode', null); 
    139 $smarty->assign('numOnlineUsers', 0); 
    140 $smarty->assign('onlineUsers', array ()); 
    141 $smarty->assign('userIsAtHotspot', false); 
    142 $smarty->assign('noUrl', true); 
    143 $smarty->assign('url', ""); 
    144 $smarty->assign('currentUrl', ""); 
    145 $smarty->assign('accountValidation', false); 
    146 $smarty->assign('validationTime', 20); 
    147 $smarty->assign('hotspotNetworkUrl', ""); 
    148 $smarty->assign('hotspotNetworkName', ""); 
    149 $smarty->assign('networkLogoBannerUrl', ""); 
    150 $smarty->assign('networkContents', false); 
    151 $smarty->assign('networkContentArray', array ()); 
    152 $smarty->assign('nodeHomepage', false); 
    153 $smarty->assign('nodeURL', ""); 
    154 $smarty->assign('nodeName', ""); 
    155 $smarty->assign('nodeContents', false); 
    156 $smarty->assign('nodeContentArray', array ()); 
    157 $smarty->assign('userContents', false); 
    158 $smarty->assign('userContentArray', array ()); 
    159  
    160 /* 
    161  * Tool content 
    162  */ 
    163  
    164 // Set section of Smarty template 
    165 $smarty->assign('sectionTOOLCONTENT', true); 
    166  
    167 // Set details about node 
    168 $smarty->assign('currentNode', $current_node); 
    169137 
    170138// Set details about onlineusers 
     
    184152 
    185153 */ 
    186 $smarty->assign('numOnlineUsers', $num_online_users); 
    187  
     154$smarty->assign('onlineUsers', array ()); 
    188155if ($num_online_users > 0) { 
    189156    $smarty->assign('onlineUsers', $online_user_array); 
     
    192159// Check for requested URL and if user is at a hotspot 
    193160$original_url_requested = $session->get(SESS_ORIGINAL_URL_VAR); 
    194  
    195 $smarty->assign('userIsAtHotspot', Node :: getCurrentRealNode() != null ? true : false); 
    196161 
    197162if (empty ($original_url_requested)) { 
     
    199164    $smarty->assign('url', "?missing=url"); 
    200165} else { 
    201     $smarty->assign('noUrl', true); 
     166    $smarty->assign('noUrl', false); 
    202167    $smarty->assign('url', $original_url_requested); 
    203168} 
    204  
    205 // Assign current request url 
    206 $smarty->assign('currentUrl', CURRENT_REQUEST_URL); 
    207169 
    208170// Compile HTML code 
  • trunk/wifidog-auth/wifidog/templates/sites/login.tpl

    r1049 r1156  
    5050        <form name="login_form" action="{$base_ssl_path}login/index.php" method="post" onsubmit="return validateForm(this);"> 
    5151                        <input type="hidden" name="form_request" value="login"> 
    52             {if $node != null} 
     52            {if $gw_address != null} 
    5353                <input type="hidden" name="gw_address" value="{$gw_address}"> 
     54            {/if} 
     55            {if $gw_port != null} 
    5456                <input type="hidden" name="gw_port" value="{$gw_port}"> 
     57            {/if} 
     58            {if $gw_id != null} 
    5559                <input type="hidden" name="gw_id" value="{$gw_id}"> 
    5660            {/if} 
  • trunk/wifidog-auth/wifidog/templates/sites/portal.tpl

    r1041 r1156  
    4949 
    5050    <p class="indent"> 
    51         {if $currentNode != null} 
    52             {if ($numOnlineUsers > 0)} 
    53                 {if ($numOnlineUsers == 1)} 
     51        {if $nodeId != null} 
     52            {if ($networkNumOnlineUsers > 0)} 
     53                {if ($networkNumOnlineUsers == 1)} 
    5454                    1 {"user is online at this hotspot"|_} 
    5555                {else} 
    56                     {$numOnlineUsers} {"users are online at this hotspot"|_} 
     56                    {$networkNumOnlineUsers} {"users are online at this hotspot"|_} 
    5757                {/if} 
    5858