Changeset 708
- Timestamp:
- 09/02/05 03:16:02 (8 years ago)
- Location:
- trunk/wifidog-auth
- Files:
-
- 28 modified
-
ChangeLog (modified) (1 diff)
-
INSTALL (modified) (1 diff)
-
wifidog/admin/incoming_outgoing_swap.php (modified) (1 diff)
-
wifidog/auth/index.php (modified) (2 diffs)
-
wifidog/change_password.php (modified) (3 diffs)
-
wifidog/classes/AbstractDbPostgres.php (modified) (1 diff)
-
wifidog/classes/Authenticator.php (modified) (1 diff)
-
wifidog/classes/AuthenticatorLocalUser.php (modified) (1 diff)
-
wifidog/classes/AuthenticatorRadius.php (modified) (1 diff)
-
wifidog/classes/Content.php (modified) (1 diff)
-
wifidog/classes/Content/ContentGroup.php (modified) (1 diff)
-
wifidog/classes/MainUI.php (modified) (3 diffs)
-
wifidog/classes/Network.php (modified) (14 diffs)
-
wifidog/classes/Node.php (modified) (4 diffs)
-
wifidog/classes/SmartyWifidog.php (modified) (1 diff)
-
wifidog/classes/User.php (modified) (7 diffs)
-
wifidog/config.php (modified) (2 diffs)
-
wifidog/content/index.php (modified) (2 diffs)
-
wifidog/hotspot_status.php (modified) (17 diffs)
-
wifidog/include/schema_validate.php (modified) (6 diffs)
-
wifidog/index.php (modified) (1 diff)
-
wifidog/install.php (modified) (3 diffs)
-
wifidog/login/index.php (modified) (4 diffs)
-
wifidog/lost_password.php (modified) (2 diffs)
-
wifidog/lost_username.php (modified) (2 diffs)
-
wifidog/portal/index.php (modified) (3 diffs)
-
wifidog/resend_validation.php (modified) (2 diffs)
-
wifidog/signup.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wifidog-auth/ChangeLog
r706 r708 1 2005-09-01 Benoit Grégoire <bock@step.polymtl.ca> 2 WARNING: DO NOT use the CVS auth server in production until further notice. 3 Massive internal changes are underway. 4 Use the release tagged 1.0m1 in production. 5 * Network abstraction mostly complete, including UI. 6 All that is missing is new network creation, network stakeholder UI and testing. 7 * Cleanup the config file of all the now unneeded constants. 8 Note that the install script is currently broken. 9 There can now be multiple networks on the server. 10 The install script will have to make sure that there is at least one, with one super-admin 11 1 12 2005-08-31 Francois Proulx <francois.proulx@gmail.com> 2 13 * Fixed bug where node ID containing periods, whitespaces or underscores would confuse PHP 3 14 * MD5 hash is used to make sur the http vars are unique 4 15 * This is only valid for Node administration 5 16 17 NOTE: the 1.0m1 release was tagged here 18 6 19 2005-08-31 Benoit Grégoire <bock@step.polymtl.ca> 7 20 * Node.php: Fix node creation -
trunk/wifidog-auth/INSTALL
r692 r708 59 59 ***************************************** 60 60 61 ***************************************** 62 Backup and restore 63 ***************************************** 64 65 To backup: 66 pg_dump wifidog --blobs --file=wifidog_backup.sql --format=c --ignore-version --no-owner -v --compress=3 -U wifidog 67 68 To restore from a backup: 69 dropdb wifidog 70 createdb wifidog --encoding=UTF-8 --owner=wifidog 71 pg_restore -U wifidog -d wifidog -v wifidog_backup.sql 61 72 62 73 Enjoy! -
trunk/wifidog-auth/wifidog/admin/incoming_outgoing_swap.php
r401 r708 26 26 require_once 'admin_common.php'; 27 27 28 echo "<div id='head'><h1> ". HOTSPOT_NETWORK_NAME ._(' cumulative user statistics')."</h1></div>\n";28 echo "<div id='head'><h1>incoming_outgoing_swap</h1></div>\n"; 29 29 echo "<div id='navLeft'>\n"; 30 30 //echo get_user_management_menu(); -
trunk/wifidog-auth/wifidog/auth/index.php
r638 r708 32 32 $auth_message = ''; 33 33 34 $token = null; 35 if(!empty($_REQUEST['token'])) 36 { 34 37 $token = $db->EscapeString($_REQUEST['token']); 35 $db->ExecSqlUniqueRes("SELECT NOW(), *, CASE WHEN ((NOW() - reg_date) > interval '".VALIDATION_GRACE_TIME." minutes') THEN true ELSE false END AS validation_grace_time_expired FROM users,connections WHERE users.user_id=connections.user_id AND connections.token='$token'", $info, false); 38 } 39 40 $db->ExecSqlUniqueRes("SELECT NOW(), *, CASE WHEN ((NOW() - reg_date) > networks.validation_grace_time) THEN true ELSE false END AS validation_grace_time_expired FROM connections JOIN users ON (users.user_id=connections.user_id) JOIN networks ON (users.account_origin = networks.network_id) WHERE connections.token='$token'", $info, false); 36 41 if ($info != null) 37 42 { 38 43 // Retrieve the associated authenticator 39 $authenticator = $AUTH_SOURCE_ARRAY[$info['account_origin']]['authenticator']; 40 41 if ($_REQUEST['stage'] == STAGE_LOGIN) 44 $authenticator = Network::getObject($info['account_origin'])->getAuthenticator(); 45 if(!$authenticator) 46 { 47 $auth_message .= "| Error: Unable to instanciate authenticator. "; 48 $auth_response = ACCOUNT_STATUS_ERROR; 49 } 50 else 51 { 52 if ($_REQUEST['stage'] == STAGE_LOGIN) 42 53 { 43 54 if ($info['token_status'] == TOKEN_UNUSED) … … 123 134 } 124 135 } 136 } 125 137 else 126 138 { -
trunk/wifidog-auth/wifidog/change_password.php
r579 r708 26 26 define('BASEPATH','./'); 27 27 require_once BASEPATH.'include/common.php'; 28 require_once BASEPATH.'classes/MainUI.php'; 28 29 require_once BASEPATH.'include/common_interface.php'; 29 30 require_once BASEPATH.'classes/User.php'; 30 require_once BASEPATH.'classes/MainUI.php';31 31 32 32 isset($_REQUEST["username"]) && $smarty->assign("username", $_REQUEST["username"]); … … 34 34 if (isset($_REQUEST["submit"])) { 35 35 try { 36 // If the source is present and that it's in our AUTH_SOURCE_ARRAY, save it to a var for later use37 $ _REQUEST['auth_source'] && in_array($_REQUEST['auth_source'], array_keys($AUTH_SOURCE_ARRAY)) && $account_origin = $_REQUEST['auth_source'];36 // If the source is present and that it's in our, save it to a var for later use 37 $account_origin = Networt::getObject($_REQUEST['auth_source']); 38 38 39 39 if (!$account_origin || !$_REQUEST["username"] || !$_REQUEST["oldpassword"] || !$_REQUEST["newpassword"] || !$_REQUEST["newpassword_again"]) … … 73 73 $sources = array (); 74 74 // Preserve keys 75 foreach (array_keys($AUTH_SOURCE_ARRAY) as $auth_source_key) 76 if ($AUTH_SOURCE_ARRAY[$auth_source_key]['authenticator']->isRegistrationPermitted()) 77 $sources[$auth_source_key] = $AUTH_SOURCE_ARRAY[$auth_source_key]; 75 $network_array=Network::getAllNetworks(); 76 foreach ($network_array as $network) 77 if ($network->getAuthenticator()->isRegistrationPermitted()) 78 $sources[$network->getId()] = $network->getName(); 78 79 79 80 isset ($sources) && $smarty->assign('auth_sources', $sources); -
trunk/wifidog-auth/wifidog/classes/AbstractDbPostgres.php
r619 r708 271 271 @param $sql requête SELECT à exécuter 272 272 @param $debug Si TRUE, affiche la requête brute 273 @return false on failure, true otherwise 273 274 */ 274 275 function ExecSqlUpdate($sql, $debug=false) -
trunk/wifidog-auth/wifidog/classes/Authenticator.php
r609 r708 23 23 * Technologies Coeus inc. 24 24 */ 25 require_once 'AuthenticatorLocalUser.php'; 26 require_once 'AuthenticatorRadius.php'; 25 27 26 28 /** Abstract class to represent an authentication source */ -
trunk/wifidog-auth/wifidog/classes/AuthenticatorLocalUser.php
r553 r708 47 47 { 48 48 return get_class($account_origin['authenticator']) == "AuthenticatorLocalUser"; 49 }50 51 /**52 * Returns in array containing only Local User account origins53 * @return array54 */55 public static function getAllLocalUserAccountOrigins()56 {57 global $AUTH_SOURCE_ARRAY;58 return array_filter($AUTH_SOURCE_ARRAY, array("self", "isLocalUserAccountOrigin"));59 49 } 60 50 -
trunk/wifidog-auth/wifidog/classes/AuthenticatorRadius.php
r544 r708 46 46 /** 47 47 * AuthenticatorRadius constructor 48 * Example: new AuthenticatorRadius(IDRC_ACCOUNT_ORIGIN, "192.168.0.11", 49 * 1812, 1813, "secret_key", "CHAP_MD5"); 48 50 * @param $account_orgin : The origin of the account 49 51 * @param $host : hostname of the RADIUS server -
trunk/wifidog-auth/wifidog/classes/Content.php
r694 r708 233 233 public static function getSelectContentUI($user_prefix, $sql_additional_where = null) 234 234 { 235 global $AUTH_SOURCE_ARRAY;236 235 $html = ''; 237 236 $name = "{$user_prefix}"; -
trunk/wifidog-auth/wifidog/classes/Content/ContentGroup.php
r686 r708 315 315 316 316 /* content_ordering_mode */ 317 global $AUTH_SOURCE_ARRAY;318 317 $html .= "<div class='admin_section_container'>\n"; 319 318 $html .= "<div class='admin_section_title'>"._("In what order should the content displayed?").": </div>\n"; -
trunk/wifidog-auth/wifidog/classes/MainUI.php
r695 r708 25 25 */ 26 26 require_once BASEPATH.'include/common.php'; 27 /** @note We put a call to validate_schema() here so it systematically called 28 * from any UI page, but not from any machine readable pages 29 */ 30 require_once BASEPATH.'include/schema_validate.php'; 31 validate_schema(); 32 27 33 require_once BASEPATH.'include/common_interface.php'; 28 34 … … 39 45 private $footer_scripts = array (); 40 46 41 42 /** @note We put a call to validate_schema() here so it systematically called43 * from any UI page, but not from any machine readable pages44 */45 47 function __construct() 46 48 { 47 require_once BASEPATH.'include/schema_validate.php';48 validate_schema();49 50 49 $this->smarty = new SmartyWifidog(); 51 50 $this->title = Network :: getCurrentNetwork()->getName().' '._("authentication server"); //Default title … … 357 356 { 358 357 $html = "<p>$errmsg</p>\n"; 359 $html .= "<p>"._("Please get in touch with ")."<a href='{TECH_SUPPORT_EMAIL}'>{TECH_SUPPORT_EMAIL}</a></p>"; 358 $email = Network::getCurrentNetwork()->getTechSupportEmail(); 359 if(!empty($email)) 360 { 361 $html .= "<p>"._("Please get in touch with ")."<a href='{$email}'>{$email}</a></p>"; 362 } 360 363 $this->setMainContent($html); 361 364 $this->display(); -
trunk/wifidog-auth/wifidog/classes/Network.php
r705 r708 1 1 <?php 2 2 3 /********************************************************************\ 3 4 * This program is free software; you can redistribute it and/or * … … 31 32 { 32 33 private $id; /**< The network id */ 34 private $mRow; 33 35 34 36 /** Get an instance of the object … … 42 44 } 43 45 46 /** Get all the Networks configured on this server 47 * @return an array of Network objects. The default network is returned 48 * first 49 */ 50 static function getAllNetworks() 51 { 52 $retval = array (); 53 global $db; 54 $sql = "SELECT network_id FROM networks ORDER BY is_default_network DESC"; 55 $network_rows = null; 56 $db->ExecSql($sql, $network_rows, false); 57 if ($network_rows == null) 58 { 59 throw new Exception(_("Network::getAllNetworks: Fatal error: No networks in the database!")); 60 } 61 foreach ($network_rows as $network_row) 62 { 63 $retval[] = new self($network_row['network_id']); 64 } 65 return $retval; 66 } 67 68 /** Get the default network 69 * @return a Network object, NEVER returns null. 70 */ 71 static function getDefaultNetwork($real_network_only = false) 72 { 73 $retval = null; 74 global $db; 75 $sql = "SELECT network_id FROM networks WHERE is_default_network=TRUE ORDER BY creation_date LIMIT 1"; 76 $network_row = null; 77 $db->ExecSqlUniqueRes($sql, $network_row, false); 78 if ($network_row == null) 79 { 80 throw new Exception(_("Network::getDefaultNetwork: Fatal error: Unable to find the default network!")); 81 } 82 $retval = new self($network_row['network_id']); 83 return $retval; 84 } 85 44 86 /** Get the current network for which the portal is displayed or to which a user is physically connected. 45 * @param $real_network_only true or false. If true, the real physical network where the user is connected is returned, and the node set by setCurrentNode is ignored. 46 * @return a Node object, or null if it can't be found. 87 * @param $real_network_only NOT IMPLEMENTED YET true or false. If true, 88 * the real physical network where the user is connected is returned, and 89 * the node set by setCurrentNode is ignored. 90 * @return a Network object, NEVER returns null. 47 91 */ 48 92 static function getCurrentNetwork($real_network_only = false) 49 93 { 50 global $AUTH_SOURCE_ARRAY; 51 $keys = array_keys($AUTH_SOURCE_ARRAY); 52 53 return new self($keys[0]); 94 $retval = null; 95 $current_node = Node :: getCurrentNode(); 96 if ($current_node != null) 97 { 98 $retval = $current_node->getNetwork(); 99 } 100 else 101 { 102 $retval = Network::getDefaultNetwork(); 103 } 104 return $retval; 54 105 } 55 106 … … 69 120 public static function getSelectNetworkUI($user_prefix) 70 121 { 71 global $AUTH_SOURCE_ARRAY;72 122 $html = ''; 73 123 $name = $user_prefix; 74 124 $html .= _("Network:")." \n"; 75 $number_of_networks = count($AUTH_SOURCE_ARRAY); 125 126 global $db; 127 $sql = "SELECT network_id, name FROM networks ORDER BY is_default_network DESC"; 128 $network_rows = null; 129 $db->ExecSql($sql, $network_rows, false); 130 if ($network_rows == null) 131 { 132 throw new Exception(_("Network::getAllNetworks: Fatal error: No networks in the database!")); 133 } 134 135 $network_array = self :: getAllNetworks(); 136 $number_of_networks = count($network_rows); 76 137 if ($number_of_networks > 1) 77 138 { 78 139 $i = 0; 79 foreach ($ AUTH_SOURCE_ARRAY as $network_id => $network_info)140 foreach ($network_rows as $network_row) 80 141 { 81 $tab[$i][0] = $network_ id;82 $tab[$i][1] = $network_ info['name'];142 $tab[$i][0] = $network_row['network_id']; 143 $tab[$i][1] = $network_row['name']; 83 144 $i ++; 84 145 } … … 88 149 else 89 150 { 90 foreach ($ AUTH_SOURCE_ARRAY as $network_id => $network_info) //iterates only once...151 foreach ($network_rows as $network_row) //iterates only once... 91 152 { 92 $html .= " $network_ info[name] ";93 $html .= "<input type='hidden' name='$name' value='$network_ id'>";153 $html .= " $network_row[name] "; 154 $html .= "<input type='hidden' name='$name' value='$network_row[network_id]'>"; 94 155 } 95 156 } … … 105 166 $object = null; 106 167 $name = "{$user_prefix}"; 107 if (!empty($_REQUEST[$name]))168 if (!empty ($_REQUEST[$name])) 108 169 return new self($_REQUEST[$name]); 109 170 else … … 113 174 private function __construct($p_network_id) 114 175 { 115 global $AUTH_SOURCE_ARRAY; 116 $found = false; 117 foreach ($AUTH_SOURCE_ARRAY as $network_id => $network_info) 118 { 119 if ($p_network_id == $network_id) 120 { 121 $found = true; 122 } 123 } 124 if (!$found) 125 { 126 throw new Exception(_("The specified network doesn't exist: ").$p_network_id); 127 } 128 $this->id = $p_network_id; 176 global $db; 177 178 $network_id_str = $db->EscapeString($p_network_id); 179 $sql = "SELECT *, EXTRACT(EPOCH FROM validation_grace_time) as validation_grace_time_seconds FROM networks WHERE network_id='$network_id_str'"; 180 $row = null; 181 $db->ExecSqlUniqueRes($sql, $row, false); 182 if ($row == null) 183 { 184 throw new Exception("The network with id $network_id_str could not be found in the database"); 185 } 186 $this->mRow = $row; 187 $this->id = $db->EscapeString($row['network_id']); 129 188 } 130 189 … … 140 199 public function getTechSupportEmail() 141 200 { 142 return TECH_SUPPORT_EMAIL; 143 } 144 201 return $this->mRow['tech_support_email']; 202 } 203 204 /** Set the network's tech support and information email address 205 * @param $value The new value 206 * @return true on success, false on failure */ 207 function setTechSupportEmail($value) 208 { 209 $retval = true; 210 if ($value != $this->getName()) 211 { 212 global $db; 213 $value = $db->EscapeString($value); 214 $retval = $db->ExecSqlUpdate("UPDATE networks SET tech_support_email = '{$value}' WHERE network_id = '{$this->getId()}'", false); 215 $this->refresh(); 216 } 217 return $retval; 218 } 219 145 220 /** Retreives the network name 146 * @return The id*/221 * @return A string */ 147 222 public function getName() 148 223 { 149 return HOTSPOT_NETWORK_NAME; 224 return $this->mRow['name']; 225 } 226 227 /** Set the network's name 228 * @param $value The new value 229 * @return true on success, false on failure */ 230 function setName($value) 231 { 232 $retval = true; 233 if ($value != $this->getName()) 234 { 235 global $db; 236 $value = $db->EscapeString($value); 237 $retval = $db->ExecSqlUpdate("UPDATE networks SET name = '{$value}' WHERE network_id = '{$this->getId()}'", false); 238 $this->refresh(); 239 } 240 return $retval; 150 241 } 151 242 … … 154 245 public function getHomepageURL() 155 246 { 156 return HOTSPOT_NETWORK_URL; 157 } 247 return $this->mRow['homepage_url']; 248 } 249 250 /** Set the network's homepage url 251 * @param $value The new value 252 * @return true on success, false on failure */ 253 function setHomepageURL($value) 254 { 255 $retval = true; 256 if ($value != $this->getName()) 257 { 258 global $db; 259 $value = $db->EscapeString($value); 260 $retval = $db->ExecSqlUpdate("UPDATE networks SET homepage_url = '{$value}' WHERE network_id = '{$this->getId()}'", false); 261 $this->refresh(); 262 } 263 return $retval; 264 } 265 266 /** Retreives the network's authenticator's class. 267 * @return A string */ 268 public function getAuthenticatorClassName() 269 { 270 return $this->mRow['network_authenticator_class']; 271 } 272 273 /** Set the network's authenticator's class. The subclass of Authenticator to be used for user authentication (ex: AuthenticatorRadius) 274 * @param $value a string, the class name of a subclass of Authenticator 275 * @return true on success, false on failure */ 276 function setAuthenticatorClassName($value) 277 { 278 $retval = true; 279 if ($value != $this->getAuthenticatorClassName()) 280 { 281 global $db; 282 $value = $db->EscapeString($value); 283 $retval = $db->ExecSqlUpdate("UPDATE networks SET network_authenticator_class = '{$value}' WHERE network_id = '{$this->getId()}'", false); 284 $this->refresh(); 285 } 286 return $retval; 287 } 288 289 /** Retreives the authenticator's parameters 290 * @return A string */ 291 public function getAuthenticatorConstructorParams() 292 { 293 return $this->mRow['network_authenticator_params']; 294 } 295 296 /** The explicit parameters to be passed to the authenticator's constructor (ex: 'my_network_id', '192.168.0.11', 1812, 1813, 'secret_key', 'CHAP_MD5') 297 * @param $value The new value 298 * @return true on success, false on failure */ 299 function setAuthenticatorConstructorParams($value) 300 { 301 $retval = true; 302 if ($value != $this->getAuthenticatorConstructorParams()) 303 { 304 global $db; 305 $value = $db->EscapeString($value); 306 $retval = $db->ExecSqlUpdate("UPDATE networks SET network_authenticator_params = '{$value}' WHERE network_id = '{$this->getId()}'", false); 307 $this->refresh(); 308 } 309 return $retval; 310 } 311 312 /** Get the Authenticator object for this network 313 * @return a subclass of Authenticator */ 314 public function getAuthenticator() 315 { 316 require_once BASEPATH.'classes/Authenticator.php'; 317 if (strpos($this->mRow['network_authenticator_params'], ';') != false) 318 { 319 throw new Exception("Network::getAuthenticator(): Security error: The parameters passed to the constructor of the authenticator are potentially unsafe"); 320 } 321 $objstring = 'return new '.$this->mRow['network_authenticator_class'].'('.$this->mRow['network_authenticator_params'].');'; 322 return eval ($objstring); 323 } 324 325 /** Is the network the default network? 326 * @return true or false */ 327 public function isDefaultNetwork() 328 { 329 ($this->mRow['is_default_network']=='t')?$retval=true:$retval=false; 330 return $retval; 331 } 332 333 /** Set as the default network. The can only be one default network, so this method will unset is_default_network for all other network 334 * @return true on success, false on failure */ 335 function setAsDefaultNetwork() 336 { 337 $retval = true; 338 if (!$this->isDefaultNetwork()) 339 { 340 global $db; 341 $sql = "UPDATE networks SET is_default_network = FALSE;\n"; 342 $sql .= "UPDATE networks SET is_default_network = TRUE WHERE network_id = '{$this->getId()}';\n"; 343 $retval = $db->ExecSqlUpdate($sql, false); 344 $this->refresh(); 345 } 346 return $retval; 347 } 348 349 /** Retreives the network's validation grace period 350 * @return An integer (seconds) */ 351 public function getValidationGraceTime() 352 { 353 return $this->mRow['validation_grace_time_seconds']; 354 } 355 356 /** Set the network's validation grace period in seconds. A new user is granted Internet access for this period check his email and validate his account. 357 * @param $value The new value 358 * @return true on success, false on failure */ 359 function setValidationGraceTime($value) 360 { 361 $retval = true; 362 if ($value != $this->getValidationGraceTime()) 363 { 364 global $db; 365 $value = $db->EscapeString($value); 366 $retval = $db->ExecSqlUpdate("UPDATE networks SET validation_grace_time = '{$value} seconds' WHERE network_id = '{$this->getId()}'", false); 367 $this->refresh(); 368 } 369 return $retval; 370 } 371 372 /** Retreives the FROM adress of the validation email 373 * @return A string */ 374 public function getValidationEmailFromAddress() 375 { 376 return $this->mRow['validation_email_from_address']; 377 } 378 379 /** Set the FROM adress of the validation email 380 * @param $value The new value 381 * @return true on success, false on failure */ 382 function setValidationEmailFromAddress($value) 383 { 384 $retval = true; 385 if ($value != $this->getValidationEmailFromAddress()) 386 { 387 global $db; 388 $value = $db->EscapeString($value); 389 $retval = $db->ExecSqlUpdate("UPDATE networks SET validation_email_from_address = '{$value}' WHERE network_id = '{$this->getId()}'", false); 390 $this->refresh(); 391 } 392 return $retval; 393 } 394 395 /** Can an account be connected more than once at the same time? 396 * @return true or false */ 397 public function getMultipleLoginAllowed() 398 { 399 ($this->mRow['allow_multiple_login']=='t')?$retval=true:$retval=false; 400 return $retval; 401 } 402 403 /** Set if a account be connected more than once at the same time? 404 * @param $value The new value, true or false 405 * @return true on success, false on failure */ 406 function setMultipleLoginAllowed($value) 407 { 408 $retval = true; 409 if ($value != $this->getMultipleLoginAllowed()) 410 { 411 global $db; 412 $value?$value='TRUE':$value='FALSE'; 413 $retval = $db->ExecSqlUpdate("UPDATE networks SET allow_multiple_login = {$value} WHERE network_id = '{$this->getId()}'", false); 414 $this->refresh(); 415 } 416 return $retval; 417 } 418 419 /** Are nodes allowed to be set as splash-only (no login)? 420 * @return true or false */ 421 public function getSplashOnlyNodesAllowed() 422 { 423 ($this->mRow['allow_splash_only_nodes']=='t')?$retval=true:$retval=false; 424 return $retval; 425 } 426 427 /** Set if nodes are allowed to be set as splash-only (no login) 428 * @param $value The new value, true or false 429 * @return true on success, false on failure */ 430 function setSplashOnlyNodesAllowed($value) 431 { 432 $retval = true; 433 if ($value != $this->getSplashOnlyNodesAllowed()) 434 { 435 global $db; 436 $value?$value='TRUE':$value='FALSE'; 437 $retval = $db->ExecSqlUpdate("UPDATE networks SET allow_splash_only_nodes = {$value} WHERE network_id = '{$this->getId()}'", false); 438 $this->refresh(); 439 } 440 return $retval; 441 } 442 443 /** Are nodes allowed to redirect users to an arbitrary web page instead of the portal? 444 * @return true or false */ 445 public function getCustomPortalRedirectAllowed() 446 { 447 ($this->mRow['allow_custom_portal_redirect']=='t')?$retval=true:$retval=false; 448 return $retval; 449 } 450 451 /** Set if nodes are allowed to redirect users to an arbitrary web page instead of the portal? 452 * @param $value The new value, true or false 453 * @return true on success, false on failure */ 454 function setCustomPortalRedirectAllowed($value) 455 { 456 $retval = true; 457 if ($value != $this->getCustomPortalRedirectAllowed()) 458 { 459 global $db; 460 $value?$value='TRUE':$value='FALSE'; 461 $retval = $db->ExecSqlUpdate("UPDATE networks SET allow_custom_portal_redirect = {$value} WHERE network_id = '{$this->getId()}'", false); 462 $this->refresh(); 463 } 464 return $retval; 465 } 158 466 159 467 /**Get an array of all Content linked to the network 160 468 * @param boolean $exclude_subscribed_content 161 * @param User $subscriber The User object used to discriminate the content469 * @param User $subscriber The User object used to discriminate the content 162 470 * @return an array of Content or an empty arrray */ 163 471 function getAllContent($exclude_subscribed_content = false, $subscriber = null) 164 472 { 165 global $db;473 global $db; 166 474 $retval = array (); 167 // Get all network, but exclude user subscribed content if asked475 // Get all network, but exclude user subscribed content if asked 168 476 if ($exclude_subscribed_content == true && $subscriber) 169 477 $sql = "SELECT content_id FROM network_has_content WHERE network_id='$this->id' AND content_id NOT IN (SELECT content_id FROM user_has_content WHERE user_id = '{$subscriber->getId()}') ORDER BY subscribe_timestamp DESC"; … … 171 479 $sql = "SELECT content_id FROM network_has_content WHERE network_id='$this->id' ORDER BY subscribe_timestamp DESC"; 172 480 $db->ExecSql($sql, $content_rows, false); 173 481 174 482 if ($content_rows != null) 175 483 { … … 185 493 * @return The HTML fragment for this interface */ 186 494 187 /** Get the Authenticator object for this network */188 public function getAuthenticator()189 {190 global $AUTH_SOURCE_ARRAY;191 return $AUTH_SOURCE_ARRAY[$this->id]['authenticator'];192 }193 194 495 public function getAdminUI() 195 496 { … … 199 500 $html .= "<div class='admin_class'>Network (".get_class($this)." instance)</div>\n"; 200 501 502 // network_id 503 $html .= "<div class='admin_section_container'>\n"; 504 $html .= "<div class='admin_section_title'>"._("Network ID")." : </div>\n"; 505 $html .= "<div class='admin_section_data'>\n"; 506 $name = "network_".$this->getId()."_name"; 507 $value = htmlspecialchars($this->getId(), ENT_QUOTES); 508 $html .= $value; 509 //$html .= "<input type='text' size ='50' value='$value' name='$name'>\n"; 510 $html .= "</div>\n"; 511 $html .= "</div>\n"; 512 513 // name 514 $html .= "<div class='admin_section_container'>\n"; 515 $html .= "<div class='admin_section_title'>"._("Network name")." : </div>\n"; 516 $html .= "<div class='admin_section_data'>\n"; 517 $name = "network_".$this->getId()."_name"; 518 $value = htmlspecialchars($this->getName(), ENT_QUOTES); 519 $html .= "<input type='text' size ='50' value='$value' name='$name'>\n"; 520 $html .= "</div>\n"; 521 $html .= "</div>\n"; 522 523 // homepage_url 524 $html .= "<div class='admin_section_container'>\n"; 525 $html .= "<div class='admin_section_title'>"._("Network's web site")." : </div>\n"; 526 $html .= "<div class='admin_section_data'>\n"; 527 $name = "network_".$this->getId()."_homepage_url"; 528 $value = htmlspecialchars($this->getHomepageURL(), ENT_QUOTES); 529 $html .= "<input type='text' size ='50' value='$value' name='$name'>\n"; 530 $html .= "</div>\n"; 531 $html .= "</div>\n"; 532 533 // tech_support_email 534 $html .= "<div class='admin_section_container'>\n"; 535 $html .= "<div class='admin_section_title'>"._("Technical support email")." : </div>\n"; 536 $html .= "<div class='admin_section_data'>\n"; 537 $name = "network_".$this->getId()."_tech_support_email"; 538 $value = htmlspecialchars($this->getTechSupportEmail(), ENT_QUOTES); 539 $html .= "<input type='text' size ='50' value='$value' name='$name'>\n"; 540 $html .= "</div>\n"; 541 $html .= "</div>\n"; 542 543 544 // network_authenticator_class 545 $html .= "<div class='admin_section_container'>\n"; 546 $html .= "<div class='admin_section_title'>"._("Network authenticator class. The subclass of Authenticator to be used for user authentication (ex: AuthenticatorRadius)")." : </div>\n"; 547 $html .= "<div class='admin_section_data'>\n"; 548 $name = "network_".$this->getId()."_network_authenticator_class"; 549 $value = htmlspecialchars($this->getAuthenticatorClassName(), ENT_QUOTES); 550 $html .= "<input type='text' size ='50' value='$value' name='$name'>\n"; 551 $html .= "</div>\n"; 552 $html .= "</div>\n"; 553 554 // network_authenticator_params 555 $html .= "<div class='admin_section_container'>\n"; 556 $html .= "<div class='admin_section_title'>"._("The explicit parameters to be passed to the authenticator (ex: 'my_network_id', '192.168.0.11', 1812, 1813, 'secret_key', 'CHAP_MD5')")." : </div>\n"; 557 $html .= "<div class='admin_section_data'>\n"; 558 $name = "network_".$this->getId()."_network_authenticator_params"; 559 $value = htmlspecialchars($this->getAuthenticatorConstructorParams(), ENT_QUOTES); 560 $html .= "<input type='text' size ='50' value='$value' name='$name'>\n"; 561 $html .= "</div>\n"; 562 $html .= "</div>\n"; 563 564 // is_default_network 565 $html .= "<div class='admin_section_container'>\n"; 566 $html .= "<div class='admin_section_title'>"._("Is this network the default network?")." : </div>\n"; 567 $html .= "<div class='admin_section_data'>\n"; 568 $name = "network_".$this->getId()."_is_default_network"; 569 $this->isDefaultNetwork()? $checked='CHECKED': $checked=''; 570 $html .= "<input type='checkbox' name='$name' $checked>\n"; 571 $html .= "</div>\n"; 572 $html .= "</div>\n"; 573 574 // validation_grace_time 575 $html .= "<div class='admin_section_container'>\n"; 576 $html .= "<div class='admin_section_title'>"._("The length of the validation grace period in seconds. A new user is granted Internet access for this period check his email and validate his account.")." : </div>\n"; 577 $html .= "<div class='admin_section_data'>\n"; 578 $name = "network_".$this->getId()."_validation_grace_time"; 579 $value = htmlspecialchars($this->getValidationGraceTime(), ENT_QUOTES); 580 $html .= "<input type='text' size ='5' value='$value' name='$name'>\n"; 581 $html .= "</div>\n"; 582 $html .= "</div>\n"; 583 584 // validation_email_from_address 585 $html .= "<div class='admin_section_container'>\n"; 586 $html .= "<div class='admin_section_title'>"._("This will be the from adress of the validation email")." : </div>\n"; 587 $html .= "<div class='admin_section_data'>\n"; 588 $name = "network_".$this->getId()."_validation_email_from_address"; 589 $value = htmlspecialchars($this->getValidationEmailFromAddress(), ENT_QUOTES); 590 $html .= "<input type='text' size ='50' value='$value' name='$name'>\n"; 591 $html .= "</div>\n"; 592 $html .= "</div>\n"; 593 594 // allow_multiple_login 595 $html .= "<div class='admin_section_container'>\n"; 596 $html .= "<div class='admin_section_title'>"._("Can an account be connected more than once at the same time?")." : </div>\n"; 597 $html .= "<div class='admin_section_data'>\n"; 598 $name = "network_".$this->getId()."_allow_multiple_login"; 599 $this->getMultipleLoginAllowed()? $checked='CHECKED': $checked=''; 600 $html .= "<input type='checkbox' name='$name' $checked>\n"; 601 $html .= "</div>\n"; 602 $html .= "</div>\n"; 603 604 // allow_splash_only_nodes 605 $html .= "<div class='admin_section_container'>\n"; 606 $html .= "<div class='admin_section_title'>"._("Are nodes allowed to be set as splash-only (no login)?")." : </div>\n"; 607 $html .= "<div class='admin_section_data'>\n"; 608 $name = "network_".$this->getId()."_allow_splash_only_nodes"; 609 $this->getSplashOnlyNodesAllowed()? $checked='CHECKED': $checked=''; 610 $html .= "<input type='checkbox' name='$name' $checked>\n"; 611 $html .= "</div>\n"; 612 $html .= "</div>\n"; 613 614 // allow_custom_portal_redirect 615 $html .= "<div class='admin_section_container'>\n"; 616 $html .= "<div class='admin_section_title'>"._("Are nodes allowed to redirect users to an arbitrary web page instead of the portal?")." : </div>\n"; 617 $html .= "<div class='admin_section_data'>\n"; 618 $name = "network_".$this->getId()."_allow_custom_portal_redirect"; 619 $this->getCustomPortalRedirectAllowed()? $checked='CHECKED': $checked=''; 620 $html .= "<input type='checkbox' name='$name' $checked>\n"; 621 $html .= "</div>\n"; 622 $html .= "</div>\n"; 623 624 // network_stakeholders 625 $html .= "<div class='admin_section_container'>\n"; 626 $html .= "<div class='admin_section_title'>"._("Network stakeholders")." : </div>\n"; 627 $html .= "<div class='admin_section_data'>\n"; 628 //$name = "network_".$this->getId()."_allow_custom_portal_redirect"; 629 //$this->getCustomPortalRedirectAllowed()? $checked='CHECKED': $checked=''; 630 //$html .= "<input type='checkbox' name='$name' $checked>\n"; 631 $html .= "WRITEME!"; 632 $html .= "</div>\n"; 633 $html .= "</div>\n"; 634 201 635 // Create new nodes 202 636 $html .= "<div class='admin_section_container'>\n"; 203 637 $html .= "<div class='admin_section_title'>"._("New node ID")." : </div>\n"; 204 638 205 639 $html .= "<div class='admin_section_data'>\n"; 206 640 $name = "network_{$this->getId()}_new_node_id"; 207 641 $html .= "<input type='text' size='10' name='{$name}'>\n"; 208 642 209 643 $html .= "<div class='admin_section_tools'>\n"; 210 644 $name = "network_{$this->getId()}_create_node"; 211 645 $html .= "<input type='submit' name='{$name}' value='"._("Create a new node")."'>\n"; 212 646 $html .= "</div>\n"; 213 214 $html .= "</div>\n"; 215 $html .= "</div>\n"; 216 647 648 $html .= "</div>\n"; 649 $html .= "</div>\n"; 650 217 651 // Content management 218 652 $html .= "<div class='admin_section_container'>\n"; … … 242 676 $html .= "</div>\n"; 243 677 $html .= "</div>\n"; 244 678 245 679 return $html; 246 680 } 247 681 248 682 /** Process admin interface of this object. 249 683 */ 250 684 public function processAdminUI() 251 685 { 252 $user = User::getCurrentUser(); 253 if (!$user->isSuperAdmin()) 254 { 255 throw new Exception(_('Access denied!')); 256 } 257 258 // Node creation 259 $create_new_node = "network_{$this->getId()}_create_node"; 260 $new_node_id = "network_{$this->getId()}_new_node_id"; 261 if (!empty ($_REQUEST[$create_new_node])) 262 if(!empty ($_REQUEST[$new_node_id])) 263 { 264 Node::createNewNode($_REQUEST[$new_node_id], $this); 265 $url = GENERIC_OBJECT_ADMIN_ABS_HREF."?".http_build_query(array("object_class" => "Node", "action" => "edit", "object_id" => $_REQUEST[$new_node_id])); 686 //pretty_print_r($_REQUEST); 687 $user = User :: getCurrentUser(); 688 if (!$user->isSuperAdmin()) 689 { 690 throw new Exception(_('Access denied!')); 691 } 692 693 // name 694 $name = "network_".$this->getId()."_name"; 695 $this->setName($_REQUEST[$name]); 696 697 // homepage_url 698 $name = "network_".$this->getId()."_homepage_url"; 699 $this->setHomepageURL($_REQUEST[$name]); 700 701 702 // tech_support_email 703 $name = "network_".$this->getId()."_tech_support_email"; 704 $this->setTechSupportEmail($_REQUEST[$name]); 705 706 // network_authenticator_class 707 $name = "network_".$this->getId()."_network_authenticator_class"; 708 $this->setAuthenticatorClassName($_REQUEST[$name]); 709 710 // network_authenticator_params 711 $name = "network_".$this->getId()."_network_authenticator_params"; 712 $this->setAuthenticatorConstructorParams($_REQUEST[$name]); 713 714 // is_default_network 715 $name = "network_".$this->getId()."_is_default_network"; 716 if($_REQUEST[$name]=='on') 717 $this->setAsDefaultNetwork(); 718 719 // validation_grace_time 720 $name = "network_".$this->getId()."_validation_grace_time"; 721 $this->setValidationGraceTime($_REQUEST[$name]); 722 723 // validation_email_from_address 724 $name = "network_".$this->getId()."_validation_email_from_address"; 725 $this->setValidationEmailFromAddress($_REQUEST[$name]); 726 727 // allow_multiple_login 728 $name = "network_".$this->getId()."_allow_multiple_login"; 729 $this->setMultipleLoginAllowed(empty($_REQUEST[$name])?false:true); 730 731 // allow_splash_only_nodes 732 $name = "network_".$this->getId()."_allow_splash_only_nodes"; 733 $this->setSplashOnlyNodesAllowed(empty($_REQUEST[$name])?false:true); 734 735 // allow_custom_portal_redirect 736 $name = "network_".$this->getId()."_allow_custom_portal_redirect"; 737 $this->setCustomPortalRedirectAllowed(empty($_REQUEST[$name])?false:true); 738 739 // Node creation 740 $create_new_node = "network_{$this->getId()}_create_node"; 741 $new_node_id = "network_{$this->getId()}_new_node_id"; 742 if (!empty ($_REQUEST[$create_new_node])) 743 if (!empty ($_REQUEST[$new_node_id])) 744 { 745 Node :: createNewNode($_REQUEST[$new_node_id], $this); 746 $url = GENERIC_OBJECT_ADMIN_ABS_HREF."?".http_build_query(array ("object_class" => "Node", "action" => "edit", "object_id" => $_REQUEST[$new_node_id])); 266 747 header("Location: {$url}"); 267 }748 } 268 749 else 269 750 echo _("You MUST enter a node ID."); 270 271 // Content management751 752 // Content management 272 753 foreach ($this->getAllContent() as $content) 273 754 { … … 284 765 $name = "network_{$this->id}_new_content"; 285 766 $content = Content :: processSelectContentUI($name); 286 if($content)287 $this->addContent($content);767 if ($content) 768 $this->addContent($content); 288 769 } 289 770 } -
trunk/wifidog-auth/wifidog/classes/Node.php
r706 r708 33 33 { 34 34 private $mRow; 35 private $mdB; /**< An AbstractDb instance */ 35 36 private $id; 36 37 private static $current_node_id = null; … … 251 252 252 253 /** @param $node_id The id of the node */ 253 function __construct($node_id) 254 { 255 global $db; 256 254 private function __construct($node_id) 255 { 256 global $db; 257 $this->mDb = & $db; 258 257 259 $node_id_str = $db->EscapeString($node_id); 258 260 $sql = "SELECT * FROM nodes WHERE node_id='$node_id_str'"; … … 263 265 } 264 266 $this->mRow = $row; 265 $this->mDb = & $db;266 267 $this->id = $row['node_id']; 267 268 } … … 269 270 function getId() 270 271 { 271 return $this->mRow['node_id']; 272 return $this->id; 273 } 274 275 /** Gets the Network to which the node belongs 276 * @return Network object (never returns null) 277 */ 278 public function getNetwork() 279 { 280 return Network::getObject($this->mRow['network_id']); 272 281 } 273 282 -
trunk/wifidog-auth/wifidog/classes/SmartyWifidog.php
r700 r708 116 116 $this->assign('wifidog_logo_url', COMMON_CONTENT_URL.WIFIDOG_LOGO_NAME); 117 117 $this->assign('wifidog_logo_banner_url',COMMON_CONTENT_URL.WIFIDOG_LOGO_BANNER_NAME); 118 118 $network = Network::GetCurrentNetwork(); 119 119 /* Usefull stuff from config.php */ 120 $this->assign('hotspot_network_name', HOTSPOT_NETWORK_NAME);121 $this->assign('hotspot_network_url', HOTSPOT_NETWORK_URL);120 $this->assign('hotspot_network_name',$network->getName()); 121 $this->assign('hotspot_network_url',$network->getHomepageURL()); 122 122 123 123 $this->assign('hotspot_logo_url', find_local_content_url(HOTSPOT_LOGO_NAME)); -
trunk/wifidog-auth/wifidog/classes/User.php
r695 r708 126 126 } 127 127 128 /**129 * Get the list of users associated with a username130 * Since we cannot guarantee the uniqueness of (user, e-mail) key this will131 * return an array.132 *133 * NB : This function will only extract users who authenticate134 * through a LocalUserAuthenticator135 * (see AuthenticatorLocalUser::getAllLocalUserAccountOrigins)136 *137 * @param $username : the username criterion138 * @return array : array of User objects139 */140 public static function getUsersByUsername($username)141 {142 $users_list = array ();143 144 // E-mail cannot be empty, will return an empty array.145 if (!empty ($username))146 {147 // Build SQL query, excluding users who do not authenticate through LocalUserAuth148 global $db;149 $username_str = $db->EscapeString($username);150 $sql = "SELECT user_id FROM users WHERE username = '$username_str'";151 $first = true;152 foreach (array_keys(AuthenticatorLocalUser :: getAllLocalUserAccountOrigins()) as $account_origin)153 {154 if ($first === true)155 {156 $sql .= " AND (account_origin = '$account_origin'";157 $first = false;158 }159 else160 $sql .= " OR account_origin = '$account_origin'";161 }162 if ($first === false)163 $sql .= ")";164 $db->ExecSql($sql, $users_rows, false);165 166 // Fill an array with User objects corresponding to those we just got167 if (!empty ($users_rows))168 foreach ($users_rows as $user_row)169 $users_list[] = new User($user_row['user_id']);170 }171 172 return $users_list;173 }174 175 /**176 * Get the list of users associated with an e-mail address177 * Since we cannot guarantee the unicity of (user, e-mail) key178 * this will return an array.179 *180 * NB : This function will only extract users who authenticate181 * through a LocalUserAuthenticator182 * (see AuthenticatorLocalUser::getAllLocalUserAccountOrigins)183 *184 * @param $email : the e-mail criterion185 * @return array : array of User objects186 */187 public static function getUsersByEmail($email)188 {189 $users_list = array ();190 191 // E-mail cannot be empty, will return an empty array.192 if (!empty ($email))193 {194 // Build SQL query, excluding users who do not authenticate through LocalUserAuth195 global $db;196 $email_str = $db->EscapeString($email);197 $sql = "SELECT user_id FROM users WHERE email = '$email_str'";198 $first = true;199 foreach (array_keys(AuthenticatorLocalUser :: getAllLocalUserAccountOrigins()) as $account_origin)200 {201 if ($first === true)202 {203 $sql .= " AND (account_origin = '$account_origin'";204 $first = false;205 }206 else207 $sql .= " OR account_origin = '$account_origin'";208 }209 if ($first === false)210 $sql .= ")";211 $db->ExecSql($sql, $users_rows, false);212 213 // Fill an array with User objects corresponding to those we just got214 if (!empty ($users_rows))215 foreach ($users_rows as $user_row)216 $users_list[] = new User($user_row['user_id']);217 }218 219 return $users_list;220 }221 222 128 /** Returns the hash of the password suitable for storing or comparing in the database. This hash is the same one as used in NoCat 223 129 * @return The 32 character hash. … … 275 181 return $this->id; 276 182 } 183 184 /** Gets the Network to which the user belongs 185 * @return Network object (never returns null) 186 */ 187 public function getNetwork() 188 { 189 return Network::getObject($this->mRow['account_origin']); 190 } 191 277 192 278 193 /** Get a user display suitable for a user list. Will include link to the user profile. */ … … 365 280 if ($account_status == ACCOUNT_STATUS_VALIDATION) 366 281 { 367 $sql = "SELECT CASE WHEN ((NOW() - reg_date) > interval '".VALIDATION_GRACE_TIME." minutes') THEN true ELSE false END AS validation_grace_time_expired FROM usersWHERE (user_id='{$this->id}')";282 $sql = "SELECT CASE WHEN ((NOW() - reg_date) > interval networks.validation_grace_time) THEN true ELSE false END AS validation_grace_time_expired, networks.validation_grace_time FROM users JOIN networks ON (users.account_origin = networks.network_id) WHERE (user_id='{$this->id}')"; 368 283 $db->ExecSqlUniqueRes($sql, $user_info, false); 369 284 370 285 if ($user_info['validation_grace_time_expired'] == 't') 371 286 { 372 $errmsg = _("Sorry, your ").VALIDATION_GRACE_TIME._(" minutes grace period to retrieve your email and validate your account has now expired. You will have to connect to the internet and validate your account from another location or create a new account. For help, please ").'<a href="'.BASEPATH.'faq.php'.'">'._("click here.").'</a>';287 $errmsg = sprintf(_("Sorry, your %s minutes grace period to retrieve your email and validate your account has now expired. You will have to connect to the internet and validate your account from another location or create a new account. For help, please %s click here %s."), $user_info['validation_grace_time_expired'], '<a href="'.BASEPATH.'faq.php'.'">', '</a>'); 373 288 $retval = false; 374 289 } … … 520 435 function sendLostUsername() 521 436 { 437 $network = $this->getNetwork(); 522 438 $username = $this->getUsername(); 523 439 $headers = 'MIME-Version: 1.0'."\r\n"; 524 440 $headers .= 'Content-type: text/plain; charset=UTF-8'."\r\n"; 525 $headers .= "From: ". VALIDATION_EMAIL_FROM_ADDRESS;526 $subject = HOTSPOT_NETWORK_NAME._(" lost username request");441 $headers .= "From: ".$network->getValidationEmailFromAddress(); 442 $subject = $network->getName()._(" lost username request"); 527 443 $body = _("Hello,\nYou have requested that the authentication server send you your username:\nUsername: ").$username._("\n\nHave a nice day,\nThe Team"); 528 444 … … 547 463 else 548 464 { 465 $network = $this->getNetwork(); 549 466 $headers = 'MIME-Version: 1.0'."\r\n"; 550 467 $headers .= 'Content-type: text/plain; charset=UTF-8'."\r\n"; 551 $headers .= "From: ". VALIDATION_EMAIL_FROM_ADDRESS;552 $subject = HOTSPOT_NETWORK_NAME._(" new user validation");468 $headers .= "From: ".$network->getValidationEmailFromAddress(); 469 $subject = $network->getName()._(" new user validation"); 553 470 $url = "http://".$_SERVER["SERVER_NAME"]."/validate.php?user_id=".$this->getId()."&token=".$this->getValidationToken(); 554 471 $body = _("Hello,\nPlease follow the link below to validate your account.\n").$url._("\n\nThank you,\nThe Team."); … … 565 482 { 566 483 global $db; 567 484 $network = $this->getNetwork(); 568 485 $new_password = $this->randomPass(); 569 486 $this->setPassword($new_password); … … 572 489 $headers = 'MIME-Version: 1.0'."\r\n"; 573 490 $headers .= 'Content-type: text/plain; charset=UTF-8'."\r\n"; 574 $headers .= "From: ". VALIDATION_EMAIL_FROM_ADDRESS;575 $subject = HOTSPOT_NETWORK_NAME._(" new password request");491 $headers .= "From: ".$network->getValidationEmailFromAddress(); 492 $subject = $network->getName()._(" new password request"); 576 493 $body = _("Hello,\nYou have requested that the authentication server send you a new password:\nUsername: ").$username._("\nPassword: ").$new_password._("\n\nHave a nice day,\nThe Team"); 577 494 -
trunk/wifidog-auth/wifidog/config.php
r686 r708 17 17 define('SYSTEM_PATH', '/'); 18 18 /**< Set this to true if your server has SSL available, otherwise, passwords will be transmitted in clear text over the air */ 19 define('SSL_AVAILABLE', true); 20 /** @deprecated version - 2005-04-19 */ 21 define('HOTSPOT_NETWORK_NAME', 'Île sans fil'); 22 define('HOTSPOT_NETWORK_URL', 'http://www.ilesansfil.org/'); 23 define('TECH_SUPPORT_EMAIL', 'tech@ilesansfil.org'); 24 define('UNKNOWN_HOSTPOT_NAME', 'Unknown HotSpot'); 19 define('SSL_AVAILABLE', false); 25 20 26 define('VALIDATION_GRACE_TIME', 20); /**< Number of minutes after new account creation during which internet access is available to validate your account. Once elapsed, you have to validate from home... */27 define('VALIDATION_EMAIL_FROM_ADDRESS', 'validation@ilesansfil.org');28 21 /* RSS support. If set to true, MAGPIERSS must be installed in MAGPIE_REL_PATH */ 29 22 define('RSS_SUPPORT', true); … … 71 64 define('LOCAL_CONTENT_REL_PATH', 'local_content/');//Path to the directory containing the different node specific directories. Relative to BASE_URL_PATH 72 65 73 // Authentication sources section74 /* The array index for the source must match the account_origin in the user table */75 76 // Local User authenticators77 require_once BASEPATH.'classes/AuthenticatorLocalUser.php';78 79 /**********************************************80 * BIG FAT WARNING81 * DO NOT remove this authenticator under any circumstance82 * you SHOULD NOT change its name either83 * The system relies heavily on its main authenticator to do84 * multiple tasks with users...85 * ********************************************86 */87 define('LOCAL_USER_ACCOUNT_ORIGIN', 'LOCAL_USER');88 $AUTH_SOURCE_ARRAY[LOCAL_USER_ACCOUNT_ORIGIN]=array(89 'name'=>HOTSPOT_NETWORK_NAME,90 'authenticator'=>new AuthenticatorLocalUser(LOCAL_USER_ACCOUNT_ORIGIN));91 92 // RADIUS authenticators ( see AuthenticatorRadius constuctor doc for details )93 /*94 require_once BASEPATH.'classes/AuthenticatorRadius.php';95 96 define('IDRC_ACCOUNT_ORIGIN', 'IDRC_RADIUS_USER');97 $AUTH_SOURCE_ARRAY[IDRC_ACCOUNT_ORIGIN]=array(98 'name'=>"IDRC RADIUS Server",99 'authenticator'=>new AuthenticatorRadius(IDRC_ACCOUNT_ORIGIN, "192.168.0.11", 1812, 1813, "secret_key", "CHAP_MD5"));100 */101 102 66 /*These are the file names of the different templates that can be put in the CONTENT_PATH/(node_id)/ folders */ 103 67 define('STYLESHEET_NAME', 'stylesheet.css'); -
trunk/wifidog-auth/wifidog/content/index.php
r655 r708 25 25 define('BASEPATH', '../'); 26 26 require_once BASEPATH.'include/common.php'; 27 require_once BASEPATH.'classes/MainUI.php'; 27 28 require_once BASEPATH.'include/common_interface.php'; 28 29 require_once BASEPATH.'classes/Node.php'; 29 require_once BASEPATH.'classes/MainUI.php';30 30 31 31 if (CONF_USE_CRON_FOR_DB_CLEANUP == false) … … 92 92 $ui->setToolContent($tool_html); 93 93 94 $hotspot_network_name = HOTSPOT_NETWORK_NAME;95 $hotspot_network_url = HOTSPOT_NETWORK_URL;96 $network_logo_url = COMMON_CONTENT_URL.NETWORK_LOGO_NAME;97 $network_logo_banner_url = COMMON_CONTENT_URL.NETWORK_LOGO_BANNER_NAME;98 99 94 $hotspot_logo_url = find_local_content_url(HOTSPOT_LOGO_NAME); 100 $hotspot_logo_banner_url = find_local_content_url(HOTSPOT_LOGO_BANNER_NAME);101 95 102 96 $html = ''; -
trunk/wifidog-auth/wifidog/hotspot_status.php
r695 r708 62 62 63 63 // Network metadata 64 $network = Network::getCurrentNetwork(); 64 65 $network_metadata_node = $xmldoc->createElement("networkMetadata"); 65 66 $network_metadata_node = $hotspot_status_root_node->appendChild($network_metadata_node); 66 $network_name_node = $xmldoc->createElement("networkUri", htmlspecialchars( HOTSPOT_NETWORK_URL, ENT_QUOTES));67 $network_name_node = $xmldoc->createElement("networkUri", htmlspecialchars($network->getHomepageURL(), ENT_QUOTES)); 67 68 $network_metadata_node->appendChild($network_name_node); 68 $network_name_node = $xmldoc->createElement("name", htmlspecialchars( HOTSPOT_NETWORK_NAME, ENT_QUOTES));69 $network_name_node = $xmldoc->createElement("name", htmlspecialchars($network->getName(), ENT_QUOTES)); 69 70 $network_metadata_node->appendChild($network_name_node); 70 $network_url_node = $xmldoc->createElement("websiteUrl", htmlspecialchars( HOTSPOT_NETWORK_URL, ENT_QUOTES));71 $network_url_node = $xmldoc->createElement("websiteUrl", htmlspecialchars($network->getHomepageURL(), ENT_QUOTES)); 71 72 $network_metadata_node->appendChild($network_url_node); 72 $network_mail_node = $xmldoc->createElement("techSupportEmail", TECH_SUPPORT_EMAIL); 73 $network_metadata_node->appendChild($network_mail_node); 73 $email = Network::GetCurrentNetwork()->getTechSupportEmail(); 74 if(!empty($email)) 75 { 76 $network_mail_node = $xmldoc->createElement("techSupportEmail", $email); 77 $network_metadata_node->appendChild($network_mail_node); 78 } 74 79 $nodes_count_node = $xmldoc->createElement("hotspotsCount", count($node_results)); 75 80 $network_metadata_node->appendChild($nodes_count_node); … … 90 95 foreach ($node_results as $node_row) 91 96 { 97 $node=Node::getObject($node_row['node_id']); 98 $network=$node->getNetwork(); 92 99 $hotspot = $xmldoc->createElement("hotspot"); 93 100 $hotspot = $hotspots_metadata_node->appendChild($hotspot); … … 299 306 $title = $channel->appendChild($title); 300 307 301 $textnode = $xmldoc->createTextNode( HOTSPOT_NETWORK_NAME._(": Newest HotSpots"));308 $textnode = $xmldoc->createTextNode($network->getName()._(": Newest HotSpots")); 302 309 $title->appendChild($textnode); 303 310 … … 305 312 $link = $xmldoc->createElement("link"); 306 313 $channel->appendChild($link); 307 $textnode = $xmldoc->createTextNode( HOTSPOT_NETWORK_URL);314 $textnode = $xmldoc->createTextNode($network->getHomepageURL()); 308 315 $link->appendChild($textnode); 309 316 … … 311 318 $description = $xmldoc->createElement("description"); 312 319 $channel->appendChild($description); 313 $textnode = $xmldoc->createTextNode(_("WiFiDog list of the most recent HotSpots opened by the network: "). HOTSPOT_NETWORK_NAME);320 $textnode = $xmldoc->createTextNode(_("WiFiDog list of the most recent HotSpots opened by the network: ").$network->getName()); 314 321 $description->appendChild($textnode); 315 322 … … 325 332 $copyright = $xmldoc->createElement("copyright"); 326 333 $channel->appendChild($copyright); 327 $textnode = $xmldoc->createTextNode(_("Copyright "). HOTSPOT_NETWORK_NAME);334 $textnode = $xmldoc->createTextNode(_("Copyright ").$network->getName()); 328 335 $copyright->appendChild($textnode); 329 336 330 337 /* managingEditor */ 331 338 339 332 340 /* webMaster */ 333 334 $webMaster = $xmldoc->createElement("webMaster"); 335 $channel->appendChild($webMaster); 336 $textnode = $xmldoc->createTextNode(TECH_SUPPORT_EMAIL); 337 $webMaster->appendChild($textnode); 341 $email = Network::GetCurrentNetwork()->getTechSupportEmail(); 342 if(!empty($email)) 343 { 344 $webMaster = $xmldoc->createElement("webMaster"); 345 $channel->appendChild($webMaster); 346 $textnode = $xmldoc->createTextNode($email); 347 $webMaster->appendChild($textnode); 348 } 338 349 339 350 /* pubDate */ … … 383 394 $title = $xmldoc->createElement("title"); 384 395 $image->appendChild($title); 385 $textnode = $xmldoc->createTextNode( HOTSPOT_NETWORK_NAME);396 $textnode = $xmldoc->createTextNode($network->getName()); 386 397 $title->appendChild($textnode); 387 398 /* url */ … … 393 404 $link = $xmldoc->createElement("link"); 394 405 $image->appendChild($link); 395 $textnode = $xmldoc->createTextNode( HOTSPOT_NETWORK_URL);406 $textnode = $xmldoc->createTextNode($network->getHomepageURL()); 396 407 $link->appendChild($textnode); 397 408 /* width */ … … 553 564 $guid->setAttribute('isPermaLink', 'false'); 554 565 $item->appendChild($guid); 555 $textnode = $xmldoc->createTextNode( HOTSPOT_NETWORK_URL.$node_row['node_id']);566 $textnode = $xmldoc->createTextNode($network->getHomepageURL().$node_row['node_id']); 556 567 $guid->appendChild($textnode); 557 568 … … 589 600 $title = $channel->appendChild($title); 590 601 591 $textnode = $xmldoc->createTextNode(utf8_encode( HOTSPOT_NETWORK_NAME._(": Newest HotSpots")));602 $textnode = $xmldoc->createTextNode(utf8_encode($network->getName()._(": Newest HotSpots"))); 592 603 $title->appendChild($textnode); 593 604 … … 595 606 $link = $xmldoc->createElement("link"); 596 607 $channel->appendChild($link); 597 $textnode = $xmldoc->createTextNode(utf8_encode( HOTSPOT_NETWORK_URL));608 $textnode = $xmldoc->createTextNode(utf8_encode($network->getHomepageURL())); 598 609 $link->appendChild($textnode); 599 610 … … 601 612 $description = $xmldoc->createElement("description"); 602 613 $channel->appendChild($description); 603 $textnode = $xmldoc->createTextNode(utf8_encode(_("WiFiDog list of the most recent HotSpots opened by the network: "). HOTSPOT_NETWORK_NAME));614 $textnode = $xmldoc->createTextNode(utf8_encode(_("WiFiDog list of the most recent HotSpots opened by the network: ").$network->getName())); 604 615 $description->appendChild($textnode); 605 616 … … 615 626 $copyright = $xmldoc->createElement("copyright"); 616 627 $channel->appendChild($copyright); 617 $textnode = $xmldoc->createTextNode(utf8_encode(_("Copyright "). HOTSPOT_NETWORK_NAME));628 $textnode = $xmldoc->createTextNode(utf8_encode(_("Copyright ").$network->getName())); 618 629 $copyright->appendChild($textnode); 619 630 … … 621 632 622 633 /* webMaster */ 623 624 $webMaster = $xmldoc->createElement("webMaster"); 625 $channel->appendChild($webMaster); 626 $textnode = $xmldoc->createTextNode(utf8_encode(TECH_SUPPORT_EMAIL)); 627 $webMaster->appendChild($textnode); 628 634 $email = Network::GetCurrentNetwork()->getTechSupportEmail(); 635 if(!empty($email)) 636 { 637 $webMaster = $xmldoc->createElement("webMaster"); 638 $channel->appendChild($webMaster); 639 $textnode = $xmldoc->createTextNode($email); 640 $webMaster->appendChild($textnode); 641 } 642 629 643 /* pubDate */ 630 644 $pubDate = $xmldoc->createElement("pubDate"); … … 673 687 $title = $xmldoc->createElement("title"); 674 688 $image->appendChild($title); 675 $textnode = $xmldoc->createTextNode(utf8_encode( HOTSPOT_NETWORK_NAME));689 $textnode = $xmldoc->createTextNode(utf8_encode($network->getName())); 676 690 $title->appendChild($textnode); 677 691 /* url */ … … 683 697 $link = $xmldoc->createElement("link"); 684 698 $image->appendChild($link); 685 $textnode = $xmldoc->createTextNode(utf8_encode( HOTSPOT_NETWORK_URL));699 $textnode = $xmldoc->createTextNode(utf8_encode($network->getHomepageURL())); 686 700 $link->appendChild($textnode); 687 701 /* width */ … … 808 822 $guid->setAttribute('isPermaLink', 'false'); 809 823 $item->appendChild($guid); 810 $textnode = $xmldoc->createTextNode(utf8_encode( HOTSPOT_NETWORK_URL.$node_row['node_id']));824 $textnode = $xmldoc->createTextNode(utf8_encode($network->getHomepageURL().$node_row['node_id'])); 811 825 $guid->appendChild($textnode); 812 826 -
trunk/wifidog-auth/wifidog/include/schema_validate.php
r699 r708 28 28 require_once BASEPATH.'classes/AbstractDb.php'; 29 29 require_once BASEPATH.'classes/Session.php'; 30 define('REQUIRED_SCHEMA_VERSION', 2 5);30 define('REQUIRED_SCHEMA_VERSION', 26); 31 31 32 32 /** Check that the database schema is up to date. If it isn't, offer to update it. */ … … 34 34 { 35 35 global $db; 36 37 //check_users_not_empty();38 36 $db->ExecSqlUniqueRes("SELECT * FROM schema_info WHERE tag='schema_version'", $row, false); 39 37 if (empty ($row)) … … 74 72 { 75 73 // Extract the first account origin, assume it's the default 76 global $AUTH_SOURCE_ARRAY; 77 if (!empty ($AUTH_SOURCE_ARRAY)) 78 { 79 $default_account_origin = array_values(array_keys($AUTH_SOURCE_ARRAY)); 80 $default_account_origin = $default_account_origin[0]; 81 } 82 83 if (!empty ($default_account_origin)) 74 $network = Network::getDefaultNetwork(); 75 if (!empty ($network)) 84 76 { 85 77 global $db; 86 $db->ExecSqlUniqueRes("SELECT user_id FROM users WHERE account_origin = ' $default_account_origin' LIMIT 1", $row, false);78 $db->ExecSqlUniqueRes("SELECT user_id FROM users WHERE account_origin = '{$network->getId()}' LIMIT 1", $row, false); 87 79 if ($row == null) 88 80 { 89 81 echo "<html><head><h1>"; 90 echo _("No user matches the default account origin, a new user admin/admin will be created. Change the password as soon as possible !");82 echo _("No user matches the default network, a new user admin/admin will be created. Change the password as soon as possible !"); 91 83 echo "</html></head>"; 92 84 $sql = "BEGIN;"; … … 101 93 { 102 94 echo "<html><head><h1>"; 103 echo _("Could not get a default account origin, make sure you config.php has at least one AUTH_SOURCE_ARRAY entry.");95 echo _("Could not get a default network!"); 104 96 echo "</html></head>"; 105 97 exit (); … … 134 126 { 135 127 $user_id = $db->EscapeString($row['user_id']); 136 $sql .= "UPDATE users SET username='$user_id', user_id='".get_guid()."', account_origin=' ".LOCAL_USER_ACCOUNT_ORIGIN."' WHERE user_id='$user_id';\n";128 $sql .= "UPDATE users SET username='$user_id', user_id='".get_guid()."', account_origin='LOCAL_USER' WHERE user_id='$user_id';\n"; 137 129 } 138 130 $sql .= "CREATE UNIQUE INDEX idx_unique_username_and_account_origin ON users (username, account_origin);\n"; … … 567 559 $sql .= "DROP TABLE node_tech_officers;\n"; 568 560 } 569 561 562 $new_schema_version = 26; 563 if ($schema_version < $new_schema_version) 564 { 565 echo "<h2>Preparing SQL statements to update schema to version $new_schema_version</h2>\n"; 566 $sql .= "\n\nUPDATE schema_info SET value='$new_schema_version' WHERE tag='schema_version';\n"; 567 $sql .= "CREATE TABLE networks ( \n"; 568 $sql .= " network_id text NOT NULL PRIMARY KEY,\n"; 569 $sql .= " network_authenticator_class text NOT NULL CHECK (network_authenticator_class<>''),\n"; 570 $sql .= " network_authenticator_params text,\n"; 571 $sql .= " is_default_network boolean NOT NULL DEFAULT FALSE,\n"; 572 $sql .= " name text NOT NULL DEFAULT 'Unnamed network' CHECK (name<>''),\n"; 573 $sql .= " creation_date date NOT NULL DEFAULT now(),\n"; 574 $sql .= " homepage_url text,\n"; 575 $sql .= " tech_support_email text,\n"; 576 $sql .= " validation_grace_time interval NOT NULL DEFAULT '1200 seconds',\n"; 577 $sql .= " validation_email_from_address text NOT NULL CHECK (validation_email_from_address<>'') DEFAULT 'validation@wifidognetwork',\n"; 578 $sql .= " allow_multiple_login BOOLEAN NOT NULL DEFAULT FALSE,\n"; 579 $sql .= " allow_splash_only_nodes BOOLEAN NOT NULL DEFAULT FALSE,\n"; 580 $sql .= " allow_custom_portal_redirect BOOLEAN NOT NULL DEFAULT FALSE\n"; 581 $sql .= ");\n"; 582 $sql .= "INSERT INTO networks (network_id, network_authenticator_class, network_authenticator_params) SELECT account_origin, COALESCE('AuthenticatorLocalUser') as network_authenticator_class, account_origin FROM users GROUP BY (account_origin) ORDER BY min(reg_date);\n"; 583 $sql .= "UPDATE networks SET is_default_network=TRUE WHERE network_id=(SELECT account_origin FROM users GROUP BY (account_origin) ORDER BY min(reg_date) LIMIT 1);\n"; 584 $sql .= "ALTER TABLE users ADD CONSTRAINT account_origin_fkey FOREIGN KEY (account_origin) REFERENCES networks (network_id) ON UPDATE CASCADE ON DELETE RESTRICT;\n"; 585 $sql .= "ALTER TABLE nodes ADD COLUMN network_id text; \n"; 586 $sql .= "UPDATE nodes SET network_id=(SELECT account_origin FROM users GROUP BY (account_origin) ORDER BY min(reg_date) LIMIT 1);\n"; 587 $sql .= "ALTER TABLE nodes ALTER COLUMN network_id SET NOT NULL; \n"; 588 $sql .= "ALTER TABLE nodes ADD CONSTRAINT network_id_fkey FOREIGN KEY (network_id) REFERENCES networks ON UPDATE CASCADE ON DELETE RESTRICT;\n"; 589 $sql .= "ALTER TABLE network_has_content ADD CONSTRAINT network_id_fkey FOREIGN KEY (network_id) REFERENCES networks ON UPDATE CASCADE ON DELETE CASCADE;\n"; 590 591 $sql .= "CREATE TABLE network_stakeholders ( \n"; 592 $sql .= " network_id text REFERENCES networks,\n"; 593 $sql .= " user_id VARCHAR(45) REFERENCES users,\n"; 594 $sql .= " is_admin BOOLEAN NOT NULL DEFAULT FALSE,\n"; 595 $sql .= " is_stat_viewer BOOLEAN NOT NULL DEFAULT FALSE,\n"; 596 $sql .= "PRIMARY KEY (network_id, user_id)\n"; 597 $sql .= ");\n"; 598 } 570 599 $db->ExecSqlUpdate("BEGIN;\n$sql\nCOMMIT;\n", true); 571 600 //$db->ExecSqlUpdate("BEGIN;\n$sql\nROLLBACK;\n", true); -
trunk/wifidog-auth/wifidog/index.php
r673 r708 26 26 define('BASEPATH', './'); 27 27 require_once BASEPATH.'include/common.php'; 28 require_once BASEPATH.'classes/MainUI.php'; 28 29 require_once BASEPATH.'include/common_interface.php'; 29 30 require_once BASEPATH.'classes/Node.php'; 30 require_once BASEPATH.'classes/MainUI.php';31 31 32 32 $num_valid_users = $stats->getNumValidUsers(); -
trunk/wifidog-auth/wifidog/install.php
r698 r708 1237 1237 print "<H1>Network</H1>"; 1238 1238 1239 $HOTSPOT_NETWORK_NAME = $configArray['HOTSPOT_NETWORK_NAME']; 1240 $HOTSPOT_NETWORK_URL = $configArray['HOTSPOT_NETWORK_URL']; 1241 $TECH_SUPPORT_EMAIL = $configArray['TECH_SUPPORT_EMAIL']; 1242 //$UNKNOWN_HOSTPOT_NAME = $configArray['UNKNOWN_HOSTPOT_NAME']; 1243 $VALIDATION_GRACE_TIME = $configArray['VALIDATION_GRACE_TIME']; 1244 $VALIDATION_EMAIL_FROM_ADDRESS = $configArray['VALIDATION_EMAIL_FROM_ADDRESS']; 1239 //$HOTSPOT_NETWORK_NAME = $configArray['HOTSPOT_NETWORK_NAME']; 1240 //$HOTSPOT_NETWORK_URL = $configArray['HOTSPOT_NETWORK_URL']; 1241 //$TECH_SUPPORT_EMAIL = $configArray['TECH_SUPPORT_EMAIL']; 1242 //$VALIDATION_GRACE_TIME = $configArray['VALIDATION_GRACE_TIME']; 1243 //$VALIDATION_EMAIL_FROM_ADDRESS = $configArray['VALIDATION_EMAIL_FROM_ADDRESS']; 1245 1244 1246 1245 print <<< EndHTML … … 1266 1265 <script type="text/javascript"> 1267 1266 function submitOptionsValue() { 1268 newConfig("HOTSPOT_NETWORK_NAME='" + document.myform.HOTSPOT_NETWORK_NAME.value + "'"); 1269 newConfig("HOTSPOT_NETWORK_URL='" + document.myform.HOTSPOT_NETWORK_URL.value + "'"); 1270 newConfig("TECH_SUPPORT_EMAIL='" + document.myform.TECH_SUPPORT_EMAIL.value + "'"); 1271 /* newConfig("UNKNOWN_HOSTPOT_NAME='" + document.myform.UNKNOWN_HOSTPOT_NAME.value + "'"); */ 1272 newConfig("VALIDATION_GRACE_TIME=" + document.myform.VALIDATION_GRACE_TIME.value); 1273 newConfig("VALIDATION_EMAIL_FROM_ADDRESS='" + document.myform.VALIDATION_EMAIL_FROM_ADDRESS.value + "'"); 1267 //newConfig("HOTSPOT_NETWORK_NAME='" + document.myform.HOTSPOT_NETWORK_NAME.value + "'"); 1268 //newConfig("HOTSPOT_NETWORK_URL='" + document.myform.HOTSPOT_NETWORK_URL.value + "'"); 1269 //newConfig("TECH_SUPPORT_EMAIL='" + document.myform.TECH_SUPPORT_EMAIL.value + "'"); 1270 //newConfig("VALIDATION_GRACE_TIME=" + document.myform.VALIDATION_GRACE_TIME.value); 1271 //newConfig("VALIDATION_EMAIL_FROM_ADDRESS='" + document.myform.VALIDATION_EMAIL_FROM_ADDRESS.value + "'"); 1274 1272 } 1275 1273 </script> … … 1419 1417 1420 1418 <B>Create the wifidog database</B> 1421 <PRE> <I>postgres@yourserver $></I> createdb -O wifidogwifidog1419 <PRE> <I>postgres@yourserver $></I> createdb wifidog --encoding=UTF-8 --owner=wifidog 1422 1420 CREATE DATABASE 1423 1421 </PRE> -
trunk/wifidog-auth/wifidog/login/index.php
r655 r708 78 78 } 79 79 80 // Add the auth servers list to smarty variables81 isset ($AUTH_SOURCE_ARRAY) && $smarty->assign('auth_sources', $AUTH_SOURCE_ARRAY);82 // Pass the account_origin along, if it's set83 isset ($_REQUEST["auth_source"]) && $smarty->assign('selected_auth_source', $_REQUEST["auth_source"]);84 85 80 $node = null; 86 81 if (!empty ($_REQUEST['gw_id'])) … … 92 87 $node = Node :: getObject($_REQUEST['gw_id']); 93 88 $hotspot_name = $node->getName(); 89 $network = $node->getNetwork(); 94 90 } 95 91 catch (Exception $e) … … 103 99 { 104 100 /* Gateway ID is not set... Virtual login */ 101 $network = Network::getCurrentNetwork(); 105 102 } 106 103 … … 174 171 175 172 // HTML body 176 $hotspot_network_name = HOTSPOT_NETWORK_NAME;177 $hotspot_network_url = HOTSPOT_NETWORK_URL;173 $hotspot_network_name = $network->getName(); 174 $hotspot_network_url = $network->getHomepageURL(); 178 175 $network_logo_banner_url = COMMON_CONTENT_URL.NETWORK_LOGO_BANNER_NAME; 179 176 -
trunk/wifidog-auth/wifidog/lost_password.php
r567 r708 36 36 $username = $db->EscapeString($_REQUEST['username']); 37 37 $email = $db->EscapeString($_REQUEST['email']); 38 // If the source is present and that it's in our AUTH_SOURCE_ARRAY, save it to a var for later use 39 $ _REQUEST['auth_source'] && in_array($_REQUEST['auth_source'], array_keys($AUTH_SOURCE_ARRAY)) && $account_origin = $_REQUEST['auth_source'];38 39 $account_origin = Network::getObject($_REQUEST['auth_source']); 40 40 41 41 try { … … 69 69 $sources = array (); 70 70 // Preserve keys 71 foreach (array_keys($AUTH_SOURCE_ARRAY) as $auth_source_key) 72 if ($AUTH_SOURCE_ARRAY[$auth_source_key]['authenticator']->isRegistrationPermitted()) 73 $sources[$auth_source_key] = $AUTH_SOURCE_ARRAY[$auth_source_key]; 74 71 $network_array=Network::getAllNetworks(); 72 foreach ($network_array as $network) 73 if ($network->getAuthenticator()->isRegistrationPermitted()) 74 $sources[$network->getId()] = $network->getName(); 75 75 76 isset ($sources) && $smarty->assign('auth_sources', $sources); 76 77 // Pass the account_origin along, if it's set 77 78 isset ($_REQUEST["auth_source"]) && $smarty->assign('selected_auth_source', $_REQUEST["auth_source"]); 78 79 79 //$smarty->display("templates/lost_password.html");80 80 $ui = new MainUI(); 81 81 $smarty->assign('SelectNetworkUI', Network::getSelectNetworkUI('auth_source')); -
trunk/wifidog-auth/wifidog/lost_username.php
r567 r708 31 31 32 32 if (isset($_REQUEST["submit"])) { 33 // If the source is present and that it's in our AUTH_SOURCE_ARRAY, save it to a var for later use 34 $_REQUEST['auth_source'] && in_array($_REQUEST['auth_source'], array_keys($AUTH_SOURCE_ARRAY)) && $account_origin = $_REQUEST['auth_source']; 35 33 $account_origin = Networt::getObject($_REQUEST['auth_source']); 36 34 try { 37 35 if(empty($account_origin)) … … 61 59 $sources = array (); 62 60 // Preserve keys 63 foreach (array_keys($AUTH_SOURCE_ARRAY) as $auth_source_key) 64 if ($AUTH_SOURCE_ARRAY[$auth_source_key]['authenticator']->isRegistrationPermitted()) 65 $sources[$auth_source_key] = $AUTH_SOURCE_ARRAY[$auth_source_key]; 66 61 $network_array=Network::getAllNetworks(); 62 foreach ($network_array as $network) 63 if ($network->getAuthenticator()->isRegistrationPermitted()) 64 $sources[$network->getId()] = $network->getName(); 65 67 66 isset ($sources) && $smarty->assign('auth_sources', $sources); 68 67 // Pass the account_origin along, if it's set 69 68 isset ($_REQUEST["auth_source"]) && $smarty->assign('selected_auth_source', $_REQUEST["auth_source"]); 70 69 71 //$smarty->display("templates/lost_username.html");72 70 $ui = new MainUI(); 73 71 $smarty->assign('SelectNetworkUI', Network::getSelectNetworkUI('auth_source')); -
trunk/wifidog-auth/wifidog/portal/index.php
r655 r708 66 66 if ($current_node != null) 67 67 { 68 $network = $node->getNetwork(); 68 69 $current_node_id = $current_node->getId(); 69 70 $online_users = $current_node->getOnlineUsers(); … … 84 85 else 85 86 { 87 $network = Network::getCurrentNetwork(); 86 88 $current_node_id = null; 87 89 $tool_html .= _("You are not currently at a hotspot..."); … … 204 206 $ui->setToolContent($tool_html); 205 207 206 $hotspot_network_name = HOTSPOT_NETWORK_NAME;207 $hotspot_network_url = HOTSPOT_NETWORK_URL;208 $hotspot_network_name = $network->getName(); 209 $hotspot_network_url = $network->getHomepageURL(); 208 210 $network_logo_url = COMMON_CONTENT_URL.NETWORK_LOGO_NAME; 209 211 $network_logo_banner_url = COMMON_CONTENT_URL.NETWORK_LOGO_BANNER_NAME; -
trunk/wifidog-auth/wifidog/resend_validation.php
r567 r708 34 34 $smarty->assign("error", _("Please specify a username")); 35 35 } else { 36 // If the source is present and that it's in our AUTH_SOURCE_ARRAY, save it to a var for later use 37 $_REQUEST['auth_source'] && in_array($_REQUEST['auth_source'], array_keys($AUTH_SOURCE_ARRAY)) && $account_origin = $_REQUEST['auth_source']; 38 36 $account_origin = Networt::getObject($_REQUEST['auth_source']); 39 37 try { 40 38 if(empty($account_origin)) … … 62 60 $sources = array (); 63 61 // Preserve keys 64 foreach (array_keys($AUTH_SOURCE_ARRAY) as $auth_source_key) 65 if ($AUTH_SOURCE_ARRAY[$auth_source_key]['authenticator']->isRegistrationPermitted()) 66 $sources[$auth_source_key] = $AUTH_SOURCE_ARRAY[$auth_source_key]; 62 $network_array=Network::getAllNetworks(); 63 foreach ($network_array as $network) 64 if ($network->getAuthenticator()->isRegistrationPermitted()) 65 $sources[$network->getId()] = $network->getName(); 67 66 68 67 isset ($sources) && $smarty->assign('auth_sources', $sources); -
trunk/wifidog-auth/wifidog/signup.php
r642 r708 81 81 $smarty->assign('username', $username); 82 82 $smarty->assign('email', $email); 83 // If the source is present and that it's in our AUTH_SOURCE_ARRAY, save it to a var for later use 84 $_REQUEST['auth_source'] && in_array($_REQUEST['auth_source'], array_keys($AUTH_SOURCE_ARRAY)) && $account_origin = $_REQUEST['auth_source']; 85 83 $account_origin = Networt::getObject($_REQUEST['auth_source']); 86 84 try 87 85 { … … 136 134 } 137 135 } 138 139 136 // Add the auth servers list to smarty variables 140 137 $sources = array (); 141 138 // Preserve keys 142 foreach (array_keys($AUTH_SOURCE_ARRAY) as $auth_source_key) 143 if ($AUTH_SOURCE_ARRAY[$auth_source_key]['authenticator']->isRegistrationPermitted()) 144 $sources[$auth_source_key] = $AUTH_SOURCE_ARRAY[$auth_source_key]; 145 139 $network_array=Network::getAllNetworks(); 140 foreach ($network_array as $network) 141 if ($network->getAuthenticator()->isRegistrationPermitted()) 142 $sources[$network->getId()] = $network->getName(); 143 146 144 isset ($sources) && $smarty->assign('auth_sources', $sources); 147 145 // Pass the account_origin along, if it's set 148 146 isset ($_REQUEST["auth_source"]) && $smarty->assign('selected_auth_source', $_REQUEST["auth_source"]); 149 147 150 //$smarty->display("templates/signup.html");151 148 $ui = new MainUI(); 152 149 $smarty->assign('SelectNetworkUI', Network::getSelectNetworkUI('auth_source'));
