Changeset 1384 for trunk/wifidog-auth
- Timestamp:
- 10/02/08 09:44:42 (2 months ago)
- Files:
-
- trunk/wifidog-auth/CHANGELOG (modified) (1 diff)
- trunk/wifidog-auth/wifidog/classes/Network.php (modified) (3 diffs)
- trunk/wifidog-auth/wifidog/classes/Node.php (modified) (3 diffs)
- trunk/wifidog-auth/wifidog/include/schema_validate.php (modified) (2 diffs)
- trunk/wifidog-auth/wifidog/portal/index.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/wifidog-auth/CHANGELOG
r1366 r1384 1 1 # $Id$ 2 2008-10-02 Robin Jones 3 * Support for redirecting to the users original URL instead of portal 4 2 5 2008-09-23 Robin Jones 3 6 * Oops, forgot to include new style sheet into the previous commit. 4 5 2008-09-23 Robin Jones6 7 * Made Login template easier to edit using CSS and added example to NetworkFusion theme pack, This closes #343 . 7 8 trunk/wifidog-auth/wifidog/classes/Network.php
r1362 r1384 1405 1405 } 1406 1406 1407 /** 1408 * Are nodes allowed to redirect users to the original requested web page instead of 1409 * the portal? 1410 * 1411 * @return bool True or false 1412 * 1413 * @access public 1414 */ 1415 public function getPortalOriginalUrlAllowed() 1416 { 1417 return (($this->_row['allow_original_url_redirect'] == 't') ? true : false); 1418 } 1419 1420 /** 1421 * Set if nodes are allowed to redirect users to the original requested web page 1422 * instead of the portal? 1423 * 1424 * @param bool $value The new value, true or false 1425 * 1426 * @return bool True on success, false on failure 1427 * 1428 * @access public 1429 */ 1430 public function setPortalOriginalUrlAllowed($value) 1431 { 1432 // Init values 1433 $retval = true; 1434 1435 if ($value != $this->getPortalOriginalUrlAllowed()) { 1436 $db = AbstractDb::getObject(); 1437 $value ? $value = 'TRUE' : $value = 'FALSE'; 1438 $retval = $db->execSqlUpdate("UPDATE networks SET allow_original_url_redirect = {$value} WHERE network_id = '{$this->getId()}'", false); 1439 $this->refresh(); 1440 } 1441 1442 return $retval; 1443 } 1444 1445 1407 1446 /** The length of the window during which the user must not have exceeded the limits below. 1408 1447 * … … 1665 1704 $data = InterfaceElements::generateInputCheckbox("network_" . $this->getId() . "_allow_custom_portal_redirect", "", _("Yes"), $this->getCustomPortalRedirectAllowed(), "network_allow_custom_portal_redirect_radio"); 1666 1705 $html_network_node_properties[] = InterfaceElements::generateAdminSectionContainer("network_allow_custom_portal_redirect", $title, $data, $help); 1706 1707 // allow_original_URL_redirect 1708 $title = _("Original URL redirection"); 1709 $help = _("Are nodes allowed to redirect users to the web page they originally requested instead of the portal?"); 1710 $data = InterfaceElements::generateInputCheckbox("network_" . $this->getId() . "_allow_original_URL_redirect", "", _("Yes"), $this->getPortalOriginalUrlAllowed(), "network_allow_original_URL_redirect_radio"); 1711 $html_network_node_properties[] = InterfaceElements::generateAdminSectionContainer("network_allow_original_URL_redirect", $title, $data, $help); 1667 1712 1668 1713 // Build section … … 1875 1920 $this->setCustomPortalRedirectAllowed(empty ($_REQUEST[$name]) ? false : true); 1876 1921 1922 // 'allow_original_URL_redirect 1923 $name = "network_".$this->getId()."_allow_original_URL_redirect"; 1924 $this->setPortalOriginalUrlAllowed(empty ($_REQUEST[$name]) ? false : true); 1925 1877 1926 /* 1878 1927 * Dynamic abuse control trunk/wifidog-auth/wifidog/classes/Node.php
r1351 r1384 1020 1020 } 1021 1021 1022 /** redirect users to the original requested web page instead of portal 1023 Must be enabled in the Network configuration to have any effect 1024 @return a string */ 1025 function getPortalOriginalUrlAllowed() 1026 { 1027 return (($this->_row['allow_original_url_redirect'] == 't') ? true : false); 1028 } 1029 1030 /** redirect users to the original requested web page instead of portal 1031 Must be enabled in the Network configuration to have any effect 1032 @return true on success, false on failure */ 1033 function setPortalOriginalUrlAllowed($value) 1034 { 1035 $retval = true; 1036 if ($value != $this->getPortalOriginalUrlAllowed()) 1037 { 1038 $db = AbstractDb::getObject(); 1039 $value ? $value = 'TRUE' : $value = 'FALSE'; 1040 $retval = $db->execSqlUpdate("UPDATE nodes SET allow_original_url_redirect = '{$value}' WHERE node_id = '{$this->getId()}'", false); 1041 $this->refresh(); 1042 } 1043 return $retval; 1044 } 1045 1046 1047 1022 1048 /** 1023 1049 * Retrieves the admin interface of this object … … 1240 1266 $_html_node_config[] = InterfaceElements::generateAdminSectionContainer("node_custom_portal_redirect_url", $_title, $_data); 1241 1267 } 1268 1269 // allow_original_URL_redirect 1270 $title = _("Original URL redirection"); 1271 $help = _("Are nodes allowed to redirect users to the web page they originally requested instead of the portal? this will overide the custom portal URL"); 1272 $data = InterfaceElements::generateInputCheckbox("node_" . $node_id . "_allow_original_URL_redirect", "", _("Yes"), $this->getPortalOriginalUrlAllowed(), "node_allow_original_URL_redirect_radio"); 1273 $_html_node_config[] = InterfaceElements::generateAdminSectionContainer("node_allow_original_URL_redirect", $title, $data, $help); 1242 1274 1243 1275 // Build section … … 1425 1457 } 1426 1458 1459 // allow_original_URL_redirect 1460 if ($network->getPortalOriginalUrlAllowed()) 1461 { 1462 $name = "node_" . $node_id . "_allow_original_URL_redirect"; 1463 $this->setPortalOriginalUrlAllowed(empty ($_REQUEST[$name]) ? false : true); 1464 } 1465 1427 1466 // End Node configuration section 1428 1467 trunk/wifidog-auth/wifidog/include/schema_validate.php
r1352 r1384 48 48 * Define current database schema version 49 49 */ 50 define('REQUIRED_SCHEMA_VERSION', 6 2);50 define('REQUIRED_SCHEMA_VERSION', 63); 51 51 /** Used to test a new shecma version before modyfying the database */ 52 52 define('SCHEMA_UPDATE_TEST_MODE', false); … … 1416 1416 1417 1417 } 1418 $new_schema_version = 63; 1419 if ($schema_version < $new_schema_version && $new_schema_version <= $targetSchema) { 1420 printUpdateVersion($new_schema_version); 1421 $sql .= "\n\nUPDATE schema_info SET value='$new_schema_version' WHERE tag='schema_version';\n"; 1422 1423 $sql .= "ALTER TABLE networks ADD column allow_original_url_redirect bool; \n"; 1424 $sql .= "ALTER TABLE networks ALTER COLUMN allow_original_url_redirect SET DEFAULT FALSE;\n"; 1425 1426 $sql .= "ALTER TABLE nodes ADD column allow_original_URL_redirect bool; \n"; 1427 $sql .= "ALTER TABLE nodes ALTER COLUMN allow_original_URL_redirect SET DEFAULT FALSE;\n"; 1428 } 1418 1429 /* 1419 1430 $new_schema_version = ; trunk/wifidog-auth/wifidog/portal/index.php
r1295 r1384 107 107 } 108 108 } 109 110 /* 111 * If this node allows redirection to original URL, and the network config allows it, 112 * redirect to original URL 113 */ 114 $session_original_url = $session->get(SESS_ORIGINAL_URL_VAR); 115 116 if ($node->getPortalOriginalUrlAllowed() && $network->getPortalOriginalUrlAllowed() && !empty ($session_original_url)) 117 /** 118 * If the database doesn't get cleaned up by a cron job, we'll do now (normally this is done in ManiUI, but for custom URLs, MainUI may never be instanciated 119 */ 120 if (CONF_USE_CRON_FOR_DB_CLEANUP == false) { 121 garbage_collect(); 122 } 123 header("Location: {$session_original_url}"); 124 exit; 125 } 126 109 127 110 128 /*
