Changeset 708
- Timestamp:
- 09/02/05 03:16:02 (3 years ago)
- Files:
-
- trunk/wifidog-auth/ChangeLog (modified) (1 diff)
- trunk/wifidog-auth/INSTALL (modified) (1 diff)
- trunk/wifidog-auth/wifidog/admin/incoming_outgoing_swap.php (modified) (1 diff)
- trunk/wifidog-auth/wifidog/auth/index.php (modified) (2 diffs)
- trunk/wifidog-auth/wifidog/change_password.php (modified) (3 diffs)
- trunk/wifidog-auth/wifidog/classes/AbstractDbPostgres.php (modified) (1 diff)
- trunk/wifidog-auth/wifidog/classes/Authenticator.php (modified) (1 diff)
- trunk/wifidog-auth/wifidog/classes/AuthenticatorLocalUser.php (modified) (1 diff)
- trunk/wifidog-auth/wifidog/classes/AuthenticatorRadius.php (modified) (1 diff)
- trunk/wifidog-auth/wifidog/classes/Content.php (modified) (1 diff)
- trunk/wifidog-auth/wifidog/classes/Content/ContentGroup.php (modified) (1 diff)
- trunk/wifidog-auth/wifidog/classes/MainUI.php (modified) (3 diffs)
- trunk/wifidog-auth/wifidog/classes/Network.php (modified) (14 diffs)
- trunk/wifidog-auth/wifidog/classes/Node.php (modified) (4 diffs)
- trunk/wifidog-auth/wifidog/classes/SmartyWifidog.php (modified) (1 diff)
- trunk/wifidog-auth/wifidog/classes/User.php (modified) (7 diffs)
- trunk/wifidog-auth/wifidog/config.php (modified) (2 diffs)
- trunk/wifidog-auth/wifidog/content/index.php (modified) (2 diffs)
- trunk/wifidog-auth/wifidog/hotspot_status.php (modified) (17 diffs)
- trunk/wifidog-auth/wifidog/include/schema_validate.php (modified) (6 diffs)
- trunk/wifidog-auth/wifidog/index.php (modified) (1 diff)
- trunk/wifidog-auth/wifidog/install.php (modified) (3 diffs)
- trunk/wifidog-auth/wifidog/login/index.php (modified) (4 diffs)
- trunk/wifidog-auth/wifidog/lost_password.php (modified) (2 diffs)
- trunk/wifidog-auth/wifidog/lost_username.php (modified) (2 diffs)
- trunk/wifidog-auth/wifidog/portal/index.php (modified) (3 diffs)
- trunk/wifidog-auth/wifidog/resend_validation.php (modified) (2 diffs)
- trunk/wifidog-auth/wifidog/signup.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
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 21 21 /**@file node_list.php 22 22 * Network status page 23 * @author Copyright (C) 2004 Benoit Gr� ire23 * @author Copyright (C) 2004 Benoit Gr�goire 24 24 */ 25 25 define('BASEPATH','../'); 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 $h
