Changeset 1419

Show
Ignore:
Timestamp:
09/18/09 17:51:29 (3 years ago)
Author:
gbastien
Message:

* Fixed #502 (for some cases)
* Some realignment of tabs for readability

Location:
trunk/wifidog-auth
Files:
11 modified

Legend:

Unmodified
Added
Removed
  • trunk/wifidog-auth/CHANGELOG

    r1409 r1419  
    11# $Id$ 
     2 
     32009-09-18 Geneviève Bastien <gbastien@versatic.net> 
     4  * Fixed #502 (Note: this fix works only if all gateways have config value SSLAvailable Yes, or else the server determines that even though the connection originated from HTTP by those gateways, it should use SSL and in this case, the port is not right.  Should need a way to specify port in Wifidog Virtual Hosts or get the apache port) 
     5  * Some realignment of tabs while documenting 
     6 
     72009-08-20 Genevieve Bastien <gbastien@versatic.net> 
     8  * Updated dependencies  #599 
     9  * Now gets the temp dir of the OS instead of hardcoding the /tmp dir in the install script #588 
    210 
    3112009-07-26 Robin Jones 
  • trunk/wifidog-auth/wifidog/auth/index.php

    r1414 r1419  
    9797                    // Start accounting 
    9898                    if ($authenticator->acctStart($info['conn_id'], $auth_message)) 
    99                     $auth_response = ACCOUNT_STATUS_ALLOWED; 
     99                        $auth_response = ACCOUNT_STATUS_ALLOWED; 
    100100                    else 
    101                     $auth_response = ACCOUNT_STATUS_DENIED; 
    102  
    103                 } 
    104             } 
    105             else 
    106             if ($info['token_status'] == TOKEN_INUSE && 
    107             $info['gw_id'] && isset($_REQUEST['gw_id']) && $info['gw_id'] == $_REQUEST['gw_id'] && 
    108             $info['user_mac'] && isset($_REQUEST['mac']) && $info['user_mac'] == $_REQUEST['mac'] && 
    109             $info['user_ip'] && isset($_REQUEST['ip']) && $info['user_ip'] == $_REQUEST['ip']) 
     101                        $auth_response = ACCOUNT_STATUS_DENIED; 
     102 
     103                } 
     104            } 
     105            else if ($info['token_status'] == TOKEN_INUSE && 
     106                $info['gw_id'] && isset($_REQUEST['gw_id']) && $info['gw_id'] == $_REQUEST['gw_id'] && 
     107                $info['user_mac'] && isset($_REQUEST['mac']) && $info['user_mac'] == $_REQUEST['mac'] && 
     108                $info['user_ip'] && isset($_REQUEST['ip']) && $info['user_ip'] == $_REQUEST['ip']) 
    110109            { 
    111110                // This solves the bug where the user clicks twice before getting the portal page 
     
    117116            } 
    118117        } 
    119         else 
    120         if ($_REQUEST['stage'] == STAGE_LOGOUT || $_REQUEST['stage'] == STAGE_COUNTERS) 
     118        else if ($_REQUEST['stage'] == STAGE_LOGOUT || $_REQUEST['stage'] == STAGE_COUNTERS) 
    121119        { 
    122120            if (!empty ($_REQUEST['incoming']) || !empty ($_REQUEST['outgoing'])) 
  • trunk/wifidog-auth/wifidog/classes/Authenticator.php

    r1414 r1419  
    9595     * Attempts to login a user against the authentication source 
    9696     * 
    97      * If successfull, returns a User object. 
     97     * If successfull, returns a User object and must call User::setCurrentUser($user) at the end 
    9898     */ 
    9999    public function login() 
     
    150150                        $default_network_param = $network->getId(); 
    151151        } 
    152         if (Server::getServer()->getUseGlobalUserAccounts()) 
    153                 $smarty->assign('selectNetworkUI', "<input type=\"hidden\" name=\"auth_source\" value='$default_network_param' />"); 
    154         else 
    155                 $smarty->assign('selectNetworkUI', Network::getSelectUI('auth_source', $networkUserData)); 
     152        if (Server::getServer()->getUseGlobalUserAccounts()) 
     153            $smarty->assign('selectNetworkUI', "<input type=\"hidden\" name=\"auth_source\" value='$default_network_param' />"); 
     154        else 
     155            $smarty->assign('selectNetworkUI', Network::getSelectUI('auth_source', $networkUserData)); 
    156156 
    157157        // Set user details 
  • trunk/wifidog-auth/wifidog/classes/Authenticators/AuthenticatorLocalUser.php

    r1330 r1419  
    138138                /* 
    139139                 * This is only used to discriminate if the problem was a 
    140                  * non-existent user of a wrong password. 
     140                 * non-existent user or a wrong password. 
    141141                 */ 
    142142                $user_info = null; 
  • trunk/wifidog-auth/wifidog/classes/MainUI.php

    r1391 r1419  
    277277    } 
    278278 
    279     /** Main processing function do generate the final content. 
     279    /** Main processing function to generate the final content. 
    280280     * It will successively call prepareGetUserUI() on all content objects, 
    281281     * and then getUserUI() on all objects.  Note that the point of calling 
    282282     * prepareGetUserUI is to allow that function to call methods of MainUI 
    283      * (such ans changing headers, etc.).  However, please note that you should not 
     283     * (such as changing headers, etc.).  However, please note that you should not 
    284284     * call MainUI::addContent() from prepareGetUserUI, as prepareGetUserUI() wouldn't 
    285285     * in turn get called on objects added this way. 
     
    349349            } 
    350350        } 
    351  
    352351    } 
    353352 
     
    535534 
    536535    /** 
    537      * Display the main page 
     536     * Display the main page.  This is where are called the functions to build the menu, and tool sections 
    538537     * 
    539538     * @return void 
     
    550549        $networkThemePack = Network :: getCurrentNetwork()->getThemePack(); 
    551550        if ($networkThemePack) {         
    552                 $ThemeConfig = $networkThemePack->getThemeConfigPath(); 
    553         } 
    554         // Checks to see if the theme file exists and if so, loads it.   
    555         if (!empty($ThemeConfig) && file_exists($ThemeConfig)) { 
    556                 require_once ($ThemeConfig); 
    557         } 
    558         // Checks to see if the theme file exists and if so, checks whether it should load the Base theme. 
    559         if (!defined('INHERIT_BASE_CSS') || defined('INHERIT_BASE_CSS' == true)) { 
    560         $this->appendStylesheetURL(BASE_THEME_URL . STYLESHEET_NAME); 
    561         $this->appendStylesheetURL(BASE_THEME_URL . PRINT_STYLESHEET_NAME, 'print'); 
    562         } 
    563         //If there is a theme pack, load the CSS file 
     551            $ThemeConfig = $networkThemePack->getThemeConfigPath(); 
     552              } 
     553        // Checks to see if the theme file exists and if so, loads it.   
     554        if (!empty($ThemeConfig) && file_exists($ThemeConfig)) { 
     555            require_once ($ThemeConfig); 
     556        } 
     557        // Checks to see if the theme file exists and if so, checks whether it should load the Base theme. 
     558        if (!defined('INHERIT_BASE_CSS') || defined('INHERIT_BASE_CSS' == true)) { 
     559            $this->appendStylesheetURL(BASE_THEME_URL . STYLESHEET_NAME); 
     560            $this->appendStylesheetURL(BASE_THEME_URL . PRINT_STYLESHEET_NAME, 'print'); 
     561        } 
     562        //If there is a theme pack, load the CSS file 
    564563        if ($networkThemePack) { 
    565             $this->appendStylesheetURL($networkThemePack->getStylesheetUrl()); 
    566         } 
    567         // Checks to see if the theme file exists and if so, checks whether it should always show the page header. 
    568         if (defined('ALWAYS_SHOW_HEADER') && ALWAYS_SHOW_HEADER == true) { 
    569         $this->smarty->assign('alwaysShowHeader', true); 
    570         } else { 
    571                 $this->smarty->assign('alwaysShowHeader', false); 
    572         } 
    573         // Checks to see if the theme file exists and if so, checks whether it should always show the page footer. 
    574         if (defined('ALWAYS_SHOW_FOOTER') && (ALWAYS_SHOW_FOOTER == true)) { 
    575                 $this->smarty->assign('alwaysShowFooter', true); 
    576         } else { 
    577                 $this->smarty->assign('alwaysShowFooter', false); 
    578         } 
    579         // Checks to see if the theme file exists and if so, checks where the site menu should be positioned. 
    580         if (defined('MENU_POSITION') && MENU_POSITION == "all") { 
    581         $this->smarty->assign('siteMenuPlaceAll', true); 
    582         } else { 
    583                 if (defined('MENU_POSITION') && MENU_POSITION == "left") { 
    584                         $this->smarty->assign('siteMenuPlaceLeft', true); 
    585                 } else { 
    586                         $this->smarty->assign('siteMenuPlaceMain', true); 
    587                         } 
    588                 } 
     564            $this->appendStylesheetURL($networkThemePack->getStylesheetUrl()); 
     565        } 
     566        // Checks to see if the theme file exists and if so, checks whether it should always show the page header. 
     567        if (defined('ALWAYS_SHOW_HEADER') && ALWAYS_SHOW_HEADER == true) { 
     568            $this->smarty->assign('alwaysShowHeader', true); 
     569        } else { 
     570            $this->smarty->assign('alwaysShowHeader', false); 
     571        } 
     572        // Checks to see if the theme file exists and if so, checks whether it should always show the page footer. 
     573        if (defined('ALWAYS_SHOW_FOOTER') && (ALWAYS_SHOW_FOOTER == true)) { 
     574            $this->smarty->assign('alwaysShowFooter', true); 
     575        } else { 
     576            $this->smarty->assign('alwaysShowFooter', false); 
     577        } 
     578        // Checks to see if the theme file exists and if so, checks where the site menu should be positioned. 
     579        if (defined('MENU_POSITION') && MENU_POSITION == "all") { 
     580            $this->smarty->assign('siteMenuPlaceAll', true); 
     581        } else { 
     582            if (defined('MENU_POSITION') && MENU_POSITION == "left") { 
     583                $this->smarty->assign('siteMenuPlaceLeft', true); 
     584            } else { 
     585                $this->smarty->assign('siteMenuPlaceMain', true); 
     586            } 
     587        } 
    589588 
    590589 
  • trunk/wifidog-auth/wifidog/classes/Node.php

    r1409 r1419  
    759759 
    760760            if (!empty ($lat) && !empty ($long)) 
    761             $this->mDb->execSqlUpdate("UPDATE nodes SET latitude = $lat, longitude = $long WHERE node_id = '{$this->getId()}'"); 
     761                $this->mDb->execSqlUpdate("UPDATE nodes SET latitude = $lat, longitude = $long WHERE node_id = '{$this->getId()}'"); 
    762762            else 
    763             $this->mDb->execSqlUpdate("UPDATE nodes SET latitude = NULL, longitude = NULL WHERE node_id = '{$this->getId()}'"); 
     763                $this->mDb->execSqlUpdate("UPDATE nodes SET latitude = NULL, longitude = NULL WHERE node_id = '{$this->getId()}'"); 
    764764            $this->refresh(); 
    765765        } 
  • trunk/wifidog-auth/wifidog/classes/Profile.php

    r1403 r1419  
    152152    { 
    153153        if($this->_row['is_visible'] == "f") 
    154         return false; 
     154            return false; 
    155155        else 
    156         return true; 
     156            return true; 
    157157    } 
    158158 
     
    173173        if ($value != $this->isVisible()) { 
    174174            if($value == true) 
    175             $_retVal = $db->execSqlUpdate("UPDATE profiles SET is_visible = true WHERE profile_id = '{$this->getId()}'", false); 
     175                $_retVal = $db->execSqlUpdate("UPDATE profiles SET is_visible = true WHERE profile_id = '{$this->getId()}'", false); 
    176176            else 
    177             $_retVal = $db->execSqlUpdate("UPDATE profiles SET is_visible = false WHERE profile_id = '{$this->getId()}'", false); 
     177                $_retVal = $db->execSqlUpdate("UPDATE profiles SET is_visible = false WHERE profile_id = '{$this->getId()}'", false); 
    178178            $this->refresh(); 
    179179        } 
  • trunk/wifidog-auth/wifidog/classes/ProfileTemplateField.php

    r1403 r1419  
    7171        $db->execSqlUniqueRes($sql, $row, false); 
    7272 
    73                 $this->_id = $row['profile_template_field_id']; 
     73        $this->_id = $row['profile_template_field_id']; 
    7474        $this->profile_template_field_row = $row; 
    7575    } 
     
    179179            $content_type_filter_ui_result = FormSelectGenerator :: getResult($name, null); 
    180180 
    181                         if(empty($content_type_filter_ui_result)) 
    182                         { 
    183                                 throw new exception("Unable to retrieve the content type filter to associate with the new field"); 
    184                         } 
     181            if(empty($content_type_filter_ui_result)) 
     182            { 
     183                throw new exception("Unable to retrieve the content type filter to associate with the new field"); 
     184            } 
    185185                         
    186186            $content_type_filter = ContentTypeFilter :: getObject($content_type_filter_ui_result); 
     
    581581     */ 
    582582    public function delete(& $errmsg) { 
    583         require_once('classes/User.php'); 
    584          
    585                 $db = AbstractDb::getObject(); 
    586  
    587             // Init values 
    588                 $_retVal = false; 
    589  
    590                 if (!User::getCurrentUser()->DEPRECATEDisSuperAdmin()) { 
    591                         $errmsg = _('Access denied (must have super admin access)'); 
    592                 } else { 
    593                         $_id = $db->escapeString($this->getId()); 
    594  
    595                         if (!$db->execSqlUpdate("DELETE FROM profile_template_fields WHERE profile_template_field_id = '{$_id}'", false)) { 
    596                                 $errmsg = _('Could not delete ProfileTemplateField!'); 
    597                         } else { 
    598                                 $_retVal = true; 
    599                         } 
    600                 } 
    601  
    602                 return $_retVal; 
     583        require_once('classes/User.php'); 
     584         
     585        $db = AbstractDb::getObject(); 
     586 
     587        // Init values 
     588        $_retVal = false; 
     589 
     590        if (!User::getCurrentUser()->DEPRECATEDisSuperAdmin()) { 
     591            $errmsg = _('Access denied (must have super admin access)'); 
     592        } else { 
     593            $_id = $db->escapeString($this->getId()); 
     594 
     595            if (!$db->execSqlUpdate("DELETE FROM profile_template_fields WHERE profile_template_field_id = '{$_id}'", false)) { 
     596                $errmsg = _('Could not delete ProfileTemplateField!'); 
     597            } else { 
     598                $_retVal = true; 
     599            } 
     600        } 
     601 
     602        return $_retVal; 
    603603    } 
    604604    /** Reloads the object from the database.  Should normally be called after a set operation */ 
  • trunk/wifidog-auth/wifidog/classes/StakeholderType.php

    r1355 r1419  
    8181     
    8282    private function __construct($id) { 
    83     $this->_id=$id; 
     83        $this->_id=$id; 
    8484    } 
    8585    /** 
  • trunk/wifidog-auth/wifidog/include/path_defines_url_content.php

    r1393 r1419  
    8989 
    9090//echo "<pre>";print_r($_SERVER);echo "</pre>"; 
    91  
    9291$current_url = 'http'; 
    9392if ($_SERVER['SERVER_PORT'] == '443') { 
     
    108107     * Define base web address to use (this time using SLL) 
    109108     */ 
    110     define('BASE_SSL_PATH', 'https://'.$_SERVER['SERVER_NAME'].SYSTEM_PATH); 
     109  //  define('BASE_SSL_PATH', 'https://'.$_SERVER['SERVER_NAME'].SYSTEM_PATH); 
     110    if ($_SERVER['SERVER_PORT'] != 80 && $_SERVER['SERVER_PORT'] != 443) {  
     111        define('BASE_SSL_PATH', 'https://'.$_SERVER['SERVER_NAME'] . ':'.$_SERVER['SERVER_PORT']. SYSTEM_PATH);  
     112    } else {  
     113        define('BASE_SSL_PATH', 'https://'.$_SERVER['SERVER_NAME'] . SYSTEM_PATH);  
     114    }  
    111115} 
    112116else { 
  • trunk/wifidog-auth/wifidog/login/index.php

    r1304 r1419  
    279279} 
    280280else { 
    281     $name = $network->getName();} 
    282     $welcome_msg = sprintf("<span>%s</span> <em>%s</em>",_("Welcome to"), $name); 
    283     $ui->addContent('page_header', "<div class='welcome_msg'><div class='welcome_msg_inner'>$welcome_msg</div></div>"); 
    284     $ui->addContent('main_area_top', $html); 
    285  
    286     /* 
    287      * Main content (login form) 
    288      */ 
    289  
    290     // Get all network content and node "login" content 
    291     $content_rows = null; 
    292     $network_id = $network->getId(); 
    293     $sql_network = "(SELECT content_id, display_area, display_order, subscribe_timestamp FROM network_has_content WHERE network_id='$network_id'  AND display_page='login') "; 
    294     $sql_node = null; 
    295     if ($node) { 
    296         // Get all node content 
    297         $node_id = $db->escapeString($node->getId()); 
    298         $sql_node = "UNION (SELECT content_id, display_area, display_order, subscribe_timestamp FROM node_has_content WHERE node_id='$node_id'  AND display_page='login')"; 
    299     } 
    300     $sql = "SELECT * FROM ($sql_network $sql_node) AS content_everywhere ORDER BY display_area, display_order, subscribe_timestamp DESC"; 
    301  
    302     $db->execSql($sql, $content_rows, false); 
    303     if ($content_rows) { 
    304         foreach ($content_rows as $content_row) { 
    305             $content = Content :: getObject($content_row['content_id']); 
    306             if ($content->isDisplayableAt($node)) { 
    307                 $ui->addContent($content_row['display_area'], $content, $content_row['display_order']); 
    308             } 
     281    $name = $network->getName(); 
     282} 
     283$welcome_msg = sprintf("<span>%s</span> <em>%s</em>",_("Welcome to"), $name); 
     284$ui->addContent('page_header', "<div class='welcome_msg'><div class='welcome_msg_inner'>$welcome_msg</div></div>"); 
     285$ui->addContent('main_area_top', $html); 
     286 
     287/* 
     288 * Main content (login form) 
     289 */ 
     290 
     291// Get all network content and node "login" content 
     292$content_rows = null; 
     293$network_id = $network->getId(); 
     294$sql_network = "(SELECT content_id, display_area, display_order, subscribe_timestamp FROM network_has_content WHERE network_id='$network_id'  AND display_page='login') "; 
     295$sql_node = null; 
     296if ($node) { 
     297    // Get all node content 
     298    $node_id = $db->escapeString($node->getId()); 
     299    $sql_node = "UNION (SELECT content_id, display_area, display_order, subscribe_timestamp FROM node_has_content WHERE node_id='$node_id'  AND display_page='login')"; 
     300} 
     301$sql = "SELECT * FROM ($sql_network $sql_node) AS content_everywhere ORDER BY display_area, display_order, subscribe_timestamp DESC"; 
     302 
     303$db->execSql($sql, $content_rows, false); 
     304if ($content_rows) { 
     305    foreach ($content_rows as $content_row) { 
     306        $content = Content :: getObject($content_row['content_id']); 
     307        if ($content->isDisplayableAt($node)) { 
     308            $ui->addContent($content_row['display_area'], $content, $content_row['display_order']); 
    309309        } 
    310310    } 
    311  
    312     /* 
    313      * Render output 
    314      */ 
    315     $ui->display(); 
    316  
    317     /* 
    318      * Local variables: 
    319      * tab-width: 4 
    320      * c-basic-offset: 4 
    321      * c-hanging-comment-ender-p: nil 
    322      * End: 
    323      */ 
    324  
    325     ?> 
     311} 
     312 
     313/* 
     314 * Render output 
     315 */ 
     316$ui->display(); 
     317 
     318/* 
     319 * Local variables: 
     320 * tab-width: 4 
     321 * c-basic-offset: 4 
     322 * c-hanging-comment-ender-p: nil 
     323 * End: 
     324 */ 
     325 
     326?>