Changeset 1419
- Timestamp:
- 09/18/09 17:51:29 (3 years ago)
- Location:
- trunk/wifidog-auth
- Files:
-
- 11 modified
-
CHANGELOG (modified) (1 diff)
-
wifidog/auth/index.php (modified) (2 diffs)
-
wifidog/classes/Authenticator.php (modified) (2 diffs)
-
wifidog/classes/Authenticators/AuthenticatorLocalUser.php (modified) (1 diff)
-
wifidog/classes/MainUI.php (modified) (4 diffs)
-
wifidog/classes/Node.php (modified) (1 diff)
-
wifidog/classes/Profile.php (modified) (2 diffs)
-
wifidog/classes/ProfileTemplateField.php (modified) (3 diffs)
-
wifidog/classes/StakeholderType.php (modified) (1 diff)
-
wifidog/include/path_defines_url_content.php (modified) (2 diffs)
-
wifidog/login/index.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wifidog-auth/CHANGELOG
r1409 r1419 1 1 # $Id$ 2 3 2009-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 7 2009-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 2 10 3 11 2009-07-26 Robin Jones -
trunk/wifidog-auth/wifidog/auth/index.php
r1414 r1419 97 97 // Start accounting 98 98 if ($authenticator->acctStart($info['conn_id'], $auth_message)) 99 $auth_response = ACCOUNT_STATUS_ALLOWED;99 $auth_response = ACCOUNT_STATUS_ALLOWED; 100 100 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']) 110 109 { 111 110 // This solves the bug where the user clicks twice before getting the portal page … … 117 116 } 118 117 } 119 else 120 if ($_REQUEST['stage'] == STAGE_LOGOUT || $_REQUEST['stage'] == STAGE_COUNTERS) 118 else if ($_REQUEST['stage'] == STAGE_LOGOUT || $_REQUEST['stage'] == STAGE_COUNTERS) 121 119 { 122 120 if (!empty ($_REQUEST['incoming']) || !empty ($_REQUEST['outgoing'])) -
trunk/wifidog-auth/wifidog/classes/Authenticator.php
r1414 r1419 95 95 * Attempts to login a user against the authentication source 96 96 * 97 * If successfull, returns a User object .97 * If successfull, returns a User object and must call User::setCurrentUser($user) at the end 98 98 */ 99 99 public function login() … … 150 150 $default_network_param = $network->getId(); 151 151 } 152 if (Server::getServer()->getUseGlobalUserAccounts())153 $smarty->assign('selectNetworkUI', "<input type=\"hidden\" name=\"auth_source\" value='$default_network_param' />");154 else155 $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)); 156 156 157 157 // Set user details -
trunk/wifidog-auth/wifidog/classes/Authenticators/AuthenticatorLocalUser.php
r1330 r1419 138 138 /* 139 139 * This is only used to discriminate if the problem was a 140 * non-existent user o fa wrong password.140 * non-existent user or a wrong password. 141 141 */ 142 142 $user_info = null; -
trunk/wifidog-auth/wifidog/classes/MainUI.php
r1391 r1419 277 277 } 278 278 279 /** Main processing function do generate the final content.279 /** Main processing function to generate the final content. 280 280 * It will successively call prepareGetUserUI() on all content objects, 281 281 * and then getUserUI() on all objects. Note that the point of calling 282 282 * prepareGetUserUI is to allow that function to call methods of MainUI 283 * (such a ns changing headers, etc.). However, please note that you should not283 * (such as changing headers, etc.). However, please note that you should not 284 284 * call MainUI::addContent() from prepareGetUserUI, as prepareGetUserUI() wouldn't 285 285 * in turn get called on objects added this way. … … 349 349 } 350 350 } 351 352 351 } 353 352 … … 535 534 536 535 /** 537 * Display the main page 536 * Display the main page. This is where are called the functions to build the menu, and tool sections 538 537 * 539 538 * @return void … … 550 549 $networkThemePack = Network :: getCurrentNetwork()->getThemePack(); 551 550 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 file551 $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 564 563 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 } 589 588 590 589 -
trunk/wifidog-auth/wifidog/classes/Node.php
r1409 r1419 759 759 760 760 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()}'"); 762 762 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()}'"); 764 764 $this->refresh(); 765 765 } -
trunk/wifidog-auth/wifidog/classes/Profile.php
r1403 r1419 152 152 { 153 153 if($this->_row['is_visible'] == "f") 154 return false;154 return false; 155 155 else 156 return true;156 return true; 157 157 } 158 158 … … 173 173 if ($value != $this->isVisible()) { 174 174 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); 176 176 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); 178 178 $this->refresh(); 179 179 } -
trunk/wifidog-auth/wifidog/classes/ProfileTemplateField.php
r1403 r1419 71 71 $db->execSqlUniqueRes($sql, $row, false); 72 72 73 $this->_id = $row['profile_template_field_id'];73 $this->_id = $row['profile_template_field_id']; 74 74 $this->profile_template_field_row = $row; 75 75 } … … 179 179 $content_type_filter_ui_result = FormSelectGenerator :: getResult($name, null); 180 180 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 } 185 185 186 186 $content_type_filter = ContentTypeFilter :: getObject($content_type_filter_ui_result); … … 581 581 */ 582 582 public function delete(& $errmsg) { 583 require_once('classes/User.php');584 585 $db = AbstractDb::getObject();586 587 // Init values588 $_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; 603 603 } 604 604 /** Reloads the object from the database. Should normally be called after a set operation */ -
trunk/wifidog-auth/wifidog/classes/StakeholderType.php
r1355 r1419 81 81 82 82 private function __construct($id) { 83 $this->_id=$id;83 $this->_id=$id; 84 84 } 85 85 /** -
trunk/wifidog-auth/wifidog/include/path_defines_url_content.php
r1393 r1419 89 89 90 90 //echo "<pre>";print_r($_SERVER);echo "</pre>"; 91 92 91 $current_url = 'http'; 93 92 if ($_SERVER['SERVER_PORT'] == '443') { … … 108 107 * Define base web address to use (this time using SLL) 109 108 */ 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 } 111 115 } 112 116 else { -
trunk/wifidog-auth/wifidog/login/index.php
r1304 r1419 279 279 } 280 280 else { 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; 296 if ($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); 304 if ($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']); 309 309 } 310 310 } 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 ?>
