Changeset 946
- Timestamp:
- 02/14/06 14:31:10 (7 years ago)
- Location:
- trunk/wifidog-auth
- Files:
-
- 8 added
- 7 removed
- 10 modified
-
CHANGELOG (modified) (3 diffs)
-
wifidog/.directory (deleted)
-
wifidog/admin/generic_object_admin.php (modified) (2 diffs)
-
wifidog/admin/index.php (modified) (1 diff)
-
wifidog/admin/templates/.directory (deleted)
-
wifidog/auth/.directory (deleted)
-
wifidog/classes/.htaccess (added)
-
wifidog/classes/Session.php (modified) (1 diff)
-
wifidog/cron/.cvsignore (deleted)
-
wifidog/cron/vacuum.php (modified) (2 diffs)
-
wifidog/include/.htaccess (added)
-
wifidog/include/common.php (modified) (6 diffs)
-
wifidog/include/common_interface.php (modified) (1 diff)
-
wifidog/include/init_php.php (added)
-
wifidog/lib/RssPressReview/.htaccess (added)
-
wifidog/lib/smarty/.htaccess (added)
-
wifidog/local_content/common/.directory (deleted)
-
wifidog/local_content/default/.directory (deleted)
-
wifidog/locale/.htaccess (added)
-
wifidog/login/.directory (deleted)
-
wifidog/login/index.php (modified) (3 diffs)
-
wifidog/portal/index.php (modified) (2 diffs)
-
wifidog/templates/.htaccess (added)
-
wifidog/templates/classes/MainUI_ToolContent.tpl (modified) (1 diff)
-
wifidog/tmp/.htaccess (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wifidog-auth/CHANGELOG
r945 r946 1 2006-02-14 Max Horváth <max.horvath@maxspot.de> 2 * converted Session class to PHP5 style 3 * moved code used used to init PHP into wifidog/include/init_php.php 4 * fixed bug regarding APC (super globals weren't initialized before their 5 first use 6 * in an attemp to enter the administration interface of WiFiDog and not 7 being logged in you'll be redirected to the administration interface after 8 a successful login, if you are an admin or owner of a node. This only works 9 for a virtual login, as it isn't needed to be done when logging in via a 10 WiFiDog node (then you have to login anyway on the splash page first) 11 * fixed preview of network in administration interface as content for a 12 network as is isn't available in the code, yet 13 1 14 2006-02-13 Rob Janes <janes.rob@gmail.com> 2 15 * cron/cleanup.php needed new way to call common.php … … 4 17 5 18 2006-02-07 Benoit Grégoire <bock@step.polymtl.ca> 6 * Fix a bunch of file inclusion bugs in the statistics subsystem. 7 This is only a ad-hac fix. It seems the requires for just about every class have been stripped off.8 This must be fixed, all classes should require_once all classes or include that they need that isn't9 included by a parent class.10 19 * Fix a bunch of file inclusion bugs in the statistics subsystem. 20 This is only a ad-hac fix. It seems the requires for just about every class 21 have been stripped off. This must be fixed, all classes should require_once 22 all classes or include that they need that isn't included by a parent class. 23 11 24 2006-02-06 Benoit Grégoire <bock@step.polymtl.ca> 12 25 * wifidog/local_content/default/hotspot_logo.jpg: Delete deprecated file … … 39 52 * updated installation file to represent all the new modules that can be 40 53 installed to use all WiFiDog features 41 54 42 55 2006-01-31 Benoit Grégoire <bock@step.polymtl.ca> 43 56 * path_defines_base.php: Fix syntax errors in the exception thrown. Add more meaningfull output -
trunk/wifidog-auth/wifidog/admin/generic_object_admin.php
r914 r946 62 62 require_once('classes/GenericObject.php'); 63 63 require_once('classes/MainUI.php'); 64 require_once('classes/Network.php'); 64 65 65 66 if (!empty ($_REQUEST['debug'])) { … … 179 180 $html .= Node :: getSelectNodeUI($name); 180 181 181 $html .= $object->getUserUI(); 182 if (method_exists($object, "getUserUI")) { 183 $html .= $object->getUserUI(); 184 } 185 182 186 $html .= "<input type='hidden' name='action' value='preview'>\n"; 183 187 $html .= "<input type='submit' name='preview_submit' value='"._("Preview")." ".get_class($object)."'>\n"; -
trunk/wifidog-auth/wifidog/admin/index.php
r914 r946 50 50 require_once('classes/MainUI.php'); 51 51 52 $ui=new MainUI(); 52 // Init values 53 53 $html = ''; 54 $current_user = User :: getCurrentUser(); 55 if(!$current_user) 56 { 54 55 // Load MainUI class 56 $ui = new MainUI(); 57 58 // Get information about curent user 59 $current_user = User::getCurrentUser(); 60 61 if(!$current_user) { 57 62 // Redirect to login form automatically 58 header("Location: ../login/ ");63 header("Location: ../login/?origin=admin"); 59 64 exit; 60 } 61 else 62 { 65 } else { 63 66 $ui->setToolSection('ADMIN'); 64 67 } -
trunk/wifidog-auth/wifidog/classes/Session.php
r915 r946 49 49 * @copyright 2004-2006 Benoit Gregoire, Technologies Coeus inc. 50 50 */ 51 class Session{ 51 class Session 52 { 52 53 53 function Session() { 54 $session_id = session_id(); 55 if(empty($session_id)) { 56 session_start(); 57 } 58 } 54 /** 55 * Constructor 56 * 57 * @return void 58 * 59 * @access public 60 */ 61 public function __construct() 62 { 63 $session_id = session_id(); 59 64 60 /** 61 * Sets a session variable 62 * @param string name of variable 63 * @param mixed value of variable 64 * @return void 65 */ 66 function set($name,$value) { 67 $_SESSION[$name] = $value; 68 } 65 if (empty($session_id)) { 66 session_start(); 67 } 68 } 69 69 70 /** 71 * Fetches a session variable 72 * @param string name of variable 73 * @return mixed value of session varaible 74 */ 75 function get($name) { 76 if (isset($_SESSION[$name])) { 77 return $_SESSION[$name]; 78 } else { 79 return false; 70 /** 71 * Sets a session variable 72 * 73 * @param string $name Name of variable 74 * @param mixed $value value of variable 75 * 76 * @return void 77 * 78 * @access public 79 */ 80 public function set($name, $value) 81 { 82 $_SESSION[$name] = $value; 80 83 } 81 }82 84 83 /** 84 * Deletes a session variable 85 * @param string name of variable 86 * @return boolean 87 */ 88 function remove($name) { 89 if (isset($_SESSION[$name])) { 90 unset($_SESSION[$name]); 91 return true; 92 } else { 93 return false; 85 /** 86 * Fetches a session variable 87 * 88 * @param string $name Name of variable 89 * 90 * @return mixed Value of session varaible or false if unable to get value 91 * 92 * @access public 93 */ 94 public function get($name) 95 { 96 if (isset($_SESSION[$name])) { 97 return $_SESSION[$name]; 98 } else { 99 return false; 100 } 94 101 } 95 }96 102 97 /** 98 * Delete the whole session 99 * @return void 100 */ 101 function destroy() { 102 $_SESSION = array(); 103 session_destroy(); 104 } 103 /** 104 * Deletes a session variable 105 * 106 * @param string $name Name of variable 107 * 108 * @return bool True if successful 109 * 110 * @access public 111 */ 112 public function remove($name) 113 { 114 if (isset($_SESSION[$name])) { 115 unset($_SESSION[$name]); 105 116 106 /** 107 * Delete the whole session 108 * @return void 109 */ 110 function dump() { 111 echo "<pre>"; 112 print_r($_SESSION); 113 echo "</pre>\n"; 114 } 117 return true; 118 } else { 119 return false; 120 } 121 } 122 123 /** 124 * Delete the whole session 125 * 126 * @return void 127 * 128 * @access public 129 */ 130 public function destroy() 131 { 132 $_SESSION = array(); 133 session_destroy(); 134 } 135 136 /** 137 * Reinitializes the whole session 138 * 139 * @return void 140 * 141 * @access public 142 */ 143 public function restart() 144 { 145 $_SESSION = array(); 146 session_unset(); 147 session_destroy(); 148 149 session_start(); 150 } 151 152 /** 153 * Dump the whole session 154 * 155 * @param bool $print If true session will be printed 156 * 157 * @return mixed If $print is false the session data will be returned 158 * 159 * @access public 160 */ 161 public function dump($print = true) 162 { 163 if ($print) { 164 echo "<pre>" . print_r($_SESSION, true) . "</pre>"; 165 } else { 166 return $_SESSION; 167 } 168 } 169 115 170 } 116 171 -
trunk/wifidog-auth/wifidog/cron/vacuum.php
r945 r946 36 36 /** 37 37 * @package WiFiDogAuthServer 38 * @author Benoit Gregoire <bock@step.polymtl.ca>39 * @copyright 200 5-2006 Benoit Gregoire, Technologies Coeus inc.38 * @author Rob Janes <janes.rob@gmail.com> 39 * @copyright 2006 Rob Janes 40 40 * @version Subversion $Id: cleanup.php 916 2006-01-23 05:28:15Z max-horvath $ 41 41 * @link http://www.wifidog.org/ … … 47 47 require_once(dirname(__FILE__) . '/../include/common.php'); 48 48 49 // Define globals 49 50 global $db; 50 51 51 // $db->execSqlUpdate("VACUUM ANALYZE;", false);52 $db->execSqlUpdate("VACUUM ANALYZE;", true); // verbose52 // Run vacuum 53 $db->execSqlUpdate("VACUUM ANALYZE;", true); 53 54 54 55 /* -
trunk/wifidog-auth/wifidog/include/common.php
r927 r946 1 1 <?php 2 3 2 4 3 /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ … … 44 43 45 44 /** 46 * Disable APC cache (in case it has been installed) 47 */ 48 if (function_exists("apc_clear_cache")) { 49 ini_set("apc.enabled", 0); 50 } 51 52 /** 53 * Disable eAccelerator cache (in case it has been installed) 54 */ 55 if (function_exists("eaccelerator_rm")) { 56 ini_set("eaccelerator.enable", 0); 57 } 45 * Include PHP initialization file file 46 */ 47 require_once('init_php.php'); 58 48 59 49 /** … … 63 53 64 54 /** 55 * Filter super globals 56 */ 57 undo_magic_quotes(); 58 59 /** 60 * Set default timezone 61 */ 62 dateFix(); 63 64 /** 65 65 * Include path detection code 66 66 */ 67 require_once ('path_defines_base.php'); 68 69 require_once ('path_defines_url_content.php'); 70 71 72 undo_magic_quotes(); 73 74 require_once ('classes/EventLogging.php'); 75 require_once ('classes/AbstractDb.php'); 76 require_once ('classes/Locale.php');//Must be included for gettext handling 77 require_once ('classes/Dependencies.php'); 78 // require_once('classes/Session.php'); 67 require_once('path_defines_base.php'); 68 require_once('path_defines_url_content.php'); 69 70 /** 71 * Load required classes 72 */ 73 require_once('classes/EventLogging.php'); 74 require_once('classes/AbstractDb.php'); 75 require_once('classes/Locale.php'); 76 require_once('classes/Dependencies.php'); 79 77 80 78 global $db; 81 79 82 // $db = AbstractDb::Connect('DEFAULT');83 80 $db = new AbstractDb(); 84 81 … … 126 123 /* End session constants */ 127 124 128 129 function stripslashes_cb(&$item, $key)130 {131 $item = stripslashes($item);132 }133 134 function undo_magic_quotes() {135 if (get_magic_quotes_gpc()) {136 array_walk_recursive($_GET, 'stripslashes_cb');137 array_walk_recursive($_POST, 'stripslashes_cb');138 array_walk_recursive($_COOKIE, 'stripslashes_cb');139 array_walk_recursive($_REQUEST, 'stripslashes_cb');140 }141 }142 143 125 /** Convert a password hash form a NoCat passwd file into the same format as get_password_hash(). 144 126 * @return The 32 character hash. … … 149 131 150 132 function iso8601_date($unix_timestamp) { 151 /**152 * Set timezone if PHP version >= 5.1.0153 */154 if (str_replace(".", "", phpversion()) >= 510) {155 date_default_timezone_set(defined(DATE_TIMEZONE) ? DATE_TIMEZONE : "Canada/Eastern");156 }157 158 133 $tzd = date('O', $unix_timestamp); 159 134 $tzd = substr(chunk_split($tzd, 3, ':'), 0, 6); … … 332 307 * End: 333 308 */ 309 334 310 ?> -
trunk/wifidog-auth/wifidog/include/common_interface.php
r927 r946 51 51 52 52 /** 53 * Disable APC cache (in case it has been installed)53 * Include PHP initialization file file 54 54 */ 55 if (function_exists("apc_clear_cache")) { 56 ini_set("apc.enabled", 0); 57 } 58 59 /** 60 * Disable eAccelerator cache (in case it has been installed) 61 */ 62 if (function_exists("eaccelerator_rm")) { 63 ini_set("eaccelerator.enable", 0); 64 } 55 require_once('init_php.php'); 65 56 66 57 /** -
trunk/wifidog-auth/wifidog/login/index.php
r933 r946 58 58 require_once('classes/Network.php'); 59 59 60 / * Start general request parameter processing section */60 // Init values 61 61 $node = null; 62 if (!empty ($_REQUEST['gw_id'])) 63 { 62 $continueToAdmin = false; 63 64 /* 65 * Start general request parameter processing section 66 */ 67 if (!empty ($_REQUEST['gw_id'])) { 64 68 $gw_id = $_REQUEST['gw_id']; 65 69 66 try 67 { 68 $node = Node :: getObject($_REQUEST['gw_id']); 70 try { 71 $node = Node::getObject($_REQUEST['gw_id']); 69 72 $hotspot_name = $node->getName(); 70 73 $network = $node->getNetwork(); 71 74 } 72 catch (Exception $e) 73 {75 76 catch (Exception $e) { 74 77 $smarty->assign("error", $e->getMessage()); 75 78 $smarty->assign("tech_support_email", Network::getCurrentNetwork()->getTechSupportEmail()); … … 77 80 exit; 78 81 } 79 } 80 else 81 { 82 /* Gateway ID is not set... Virtual login */ 83 $network = Network :: getCurrentNetwork(); 82 } else { 83 // Gateway ID is not set ... virtual login 84 $network = Network::getCurrentNetwork(); 84 85 } 85 86 … … 93 94 isset ($_REQUEST["gw_id"]) && $session->set(SESS_GW_ID_VAR, $_REQUEST['gw_id']); 94 95 95 // Store original URL typed by user. 96 //TODO: manage this... 97 if (!empty ($_REQUEST['url'])) 98 { 96 /* 97 * General request parameter processing section 98 */ 99 100 /** 101 * Store original URL typed by user 102 * 103 * @todo Manage storing of original URL typed by user 104 */ 105 if (!empty($_REQUEST['url'])) { 99 106 $session->set(SESS_ORIGINAL_URL_VAR, $_REQUEST['url']); 100 107 } 101 /* End general request parameter processing section */ 102 103 /* Start login process section. 104 * If successfull, the browser is redirected to another page */ 105 106 /* If this is a splash-only node, skip the login interface and log-in using the splash_only user */ 107 if ($node && $node->isSplashOnly()) 108 { 108 109 // Check if user wanted to enter the administration interface 110 if (!empty($_REQUEST['origin']) && $_REQUEST['origin'] = "admin") { 111 $continueToAdmin = true; 112 } 113 114 /* 115 * Start login process section. 116 * 117 * If successfull, the browser is redirected to another page 118 */ 119 120 /* 121 * If this is a splash-only node, skip the login interface and log-in using 122 * the splash_only user 123 */ 124 if ($node && $node->isSplashOnly()) { 109 125 $user = $network->getSplashOnlyUser(); 110 126 $token = $user->generateConnectionToken(); 111 User :: setCurrentUser($user); 112 header("Location: http://".$_REQUEST['gw_address'].":".$_REQUEST['gw_port']."/wifidog/auth?token=$token"); 113 } 114 115 /* Normal login process */ 116 if (!empty ($_REQUEST['username']) && !empty ($_REQUEST['password']) && !empty ($_REQUEST['auth_source'])) 117 { 127 User::setCurrentUser($user); 128 129 header("Location: http://" . $_REQUEST['gw_address'] . ":" . $_REQUEST['gw_port'] . "/wifidog/auth?token=" . $token); 130 } 131 132 /* 133 * Normal login process 134 */ 135 if (!empty ($_REQUEST['username']) && !empty ($_REQUEST['password']) && !empty ($_REQUEST['auth_source'])) { 136 // Init values 118 137 $errmsg = ''; 138 119 139 $username = $db->escapeString($_REQUEST['username']); 120 140 121 141 // Authenticating the user through the selected auth source. 122 $network = Network ::processSelectNetworkUI('auth_source');142 $network = Network::processSelectNetworkUI('auth_source'); 123 143 124 144 $user = $network->getAuthenticator()->login($_REQUEST['username'], $_REQUEST['password'], $errmsg); 125 if ($user != null) 126 { 127 if (isset ($_REQUEST['gw_address']) && isset ($_REQUEST['gw_port'])) 128 { 129 /* Login from a gateway, redirect to the gateway to activate the token */ 145 146 if ($user != null) { 147 if (isset ($_REQUEST['gw_address']) && isset ($_REQUEST['gw_port'])) { 148 // Login from a gateway, redirect to the gateway to activate the token 130 149 $token = $user->generateConnectionToken(); 131 header("Location: http://".$_REQUEST['gw_address'].":".$_REQUEST['gw_port']."/wifidog/auth?token=$token"); 150 151 header("Location: http://" . $_REQUEST['gw_address'] . ":" . $_REQUEST['gw_port'] . "/wifidog/auth?token=" . $token); 152 } else { 153 // Virtual login, redirect to the auth server homepage 154 header("Location: " . BASE_SSL_PATH . ($continueToAdmin ? "admin/" : "")); 132 155 } 133 else 134 { 135 /* Virtual login, redirect to the auth server homepage */ 136 header("Location: ".BASE_SSL_PATH); 137 } 156 138 157 exit; 139 } 140 else 141 { 158 } else { 142 159 $error = $errmsg; 143 160 } 144 } 145 else 146 { 147 //Note that this is executed even when we have just arrived at the login page, so the user is reminded to supply a username and password 161 } else { 162 /* 163 * Note that this is executed even when we have just arrived at the login 164 * page, so the user is reminded to supply a username and password 165 */ 148 166 $error = _('Your must specify your username and password'); 149 167 } 150 /* End login process section.*/ 151 152 /* Start logout process section. 153 * Once logged out, we display the login page */ 154 if ((!empty ($_REQUEST['logout']) && $_REQUEST['logout'] == true) && ($user = User :: getCurrentUser()) != null) 155 { 168 169 /* 170 * Start logout process section 171 * 172 * Once logged out, we display the login page 173 */ 174 if ((!empty ($_REQUEST['logout']) && $_REQUEST['logout'] == true) && ($user = User::getCurrentUser()) != null) { 156 175 $network->getAuthenticator()->logout(); 157 176 } 158 /* End logout process section. */ 159 160 /* Start login interface section */ 177 178 /* 179 * Start login interface section 180 */ 161 181 $html = ''; 162 182 $html .= '<div id="login_form">'."\n"; -
trunk/wifidog-auth/wifidog/portal/index.php
r930 r946 54 54 require_once('classes/Node.php'); 55 55 require_once('classes/MainUI.php'); 56 require_once('classes/Session.php'); 56 57 57 58 /** 58 59 * Define width of toolbar 59 */ 60 define('TOOLBAR_WIDTH','250'); //Must match the stylesheet for the tool section width 61 60 * 61 * Must match the stylesheet for the tool section width 62 */ 63 define('TOOLBAR_WIDTH', '250'); 64 65 // Init values 62 66 $node = null; 63 if (!empty ($_REQUEST['gw_id'])) 67 68 // Init session 69 $session = new Session(); 70 71 // Get the current user 72 $current_user = User::getCurrentUser(); 73 74 if (!empty ($_REQUEST['gw_id'])) { 64 75 $node = Node :: getObject($_REQUEST['gw_id']); 65 66 if ($node == null) 67 {76 } 77 78 if ($node == null) { 68 79 $smarty->display("templates/message_unknown_hotspot.html"); 69 80 exit; 70 81 } 82 83 // Get information about current network 71 84 $network = $node->getNetwork(); 72 85 73 /* If this node has a custom portal defined, and the network config allows it, redirect to the custom portal */ 86 /* 87 * If this node has a custom portal defined, and the network config allows it, 88 * redirect to the custom portal 89 */ 74 90 $custom_portal_url = $node->getCustomPortalRedirectUrl(); 75 if(!empty($custom_portal_url) && $network->getCustomPortalRedirectAllowed()) 76 { 91 if (!empty($custom_portal_url) && $network->getCustomPortalRedirectAllowed()) { 77 92 header("Location: {$custom_portal_url}"); 78 93 } 79 80 94 81 95 $node_id = $node->getId(); … … 252 266 $network_logo_banner_url = COMMON_CONTENT_URL.NETWORK_LOGO_BANNER_NAME; 253 267 254 // Get the current user255 $current_user = User :: getCurrentUser();256 257 268 $html = ''; 258 269 -
trunk/wifidog-auth/wifidog/templates/classes/MainUI_ToolContent.tpl
r938 r946 76 76 <div class="language"> 77 77 <form class="language" name="lang_form" method="post" action="{$formAction}"> 78 {"Language :"|_}78 {"Language"|_}: 79 79 <select name="wifidog_language" onchange="javascript: document.lang_form.submit();"> 80 80 {foreach from=$languageChooser item=currLanguage}
