| 1 |
<?php |
<?php |
| 2 |
|
/** |
| 3 |
|
* Drupal HotSpot Module * http://www.coova.org/CoovaChilli |
| 4 |
|
* Copyright 2008-2009 (c) Coova Technologies, LLC. |
| 5 |
|
* Licensed under the Gnu Public License. |
| 6 |
|
*/ |
| 7 |
|
|
| 8 |
require_once drupal_get_path('module', 'hotspot').'/hotspot.inc'; |
require_once drupal_get_path('module', 'hotspot').'/hotspot.inc'; |
| 9 |
|
|
| 26 |
|
|
| 27 |
module_invoke_all('hotspot_loginpage'); |
module_invoke_all('hotspot_loginpage'); |
| 28 |
|
|
| 29 |
|
/** |
| 30 |
|
* URL Security: if enabled, ensure that the URL hasn't been tampered with. |
| 31 |
|
* Only the smartclient URL should have anything after the md= checksum parameter. |
| 32 |
|
*/ |
| 33 |
if (hotspot_setting('check_url_md', 'true') == 'true') { |
if (hotspot_setting('check_url_md', 'true') == 'true') { |
| 34 |
$md = $_REQUEST['md']; |
$md = $_REQUEST['md']; |
| 35 |
|
|
| 36 |
$uamsecret = hotspot_get_uamsecret(); |
$uamsecret = hotspot_get_uamsecret(); |
| 37 |
|
|
| 38 |
$check = (empty($_SERVER['HTTPS']) ? 'http' : 'https').'://'. |
$check = (empty($_SERVER['HTTPS']) ? 'http' : 'https').'://'. |
| 39 |
$_SERVER['SERVER_NAME'].preg_replace('/&md=[^&=]+$/', '', $_SERVER['REQUEST_URI']); |
$_SERVER['SERVER_NAME'].preg_replace('/&md=[^&=]+$/', '', $_SERVER['REQUEST_URI']); |
| 40 |
|
|
| 41 |
$match = strtoupper(md5($check.$uamsecret)); |
$match = strtoupper(md5($check.$uamsecret)); |
| 42 |
|
|
| 43 |
if ($md != $match) { |
if ($md != $match) { |
| 44 |
|
|
| 45 |
|
/** |
| 46 |
|
* Special exception for smart clients that are logging in. |
| 47 |
|
*/ |
| 48 |
|
if ($_REQUEST['res'] == 'smartclient') { |
| 49 |
|
$username = hotspot_get_username($_REQUEST); |
| 50 |
|
$password = hotspot_get_password($_REQUEST); |
| 51 |
|
if ($username && $password) { |
| 52 |
|
$url = hotspot_login_url($username, $password); |
| 53 |
|
header('Location: '. $url, TRUE, 302); |
| 54 |
|
print hotspot_wispr_xml($url); |
| 55 |
|
exit(); |
| 56 |
|
} |
| 57 |
|
} |
| 58 |
|
|
| 59 |
drupal_goto('badquery'); |
drupal_goto('badquery'); |
| 60 |
return; |
return; |
| 61 |
} |
} |
| 73 |
$username = hotspot_setting('auto_username', ''); |
$username = hotspot_setting('auto_username', ''); |
| 74 |
$password = hotspot_setting('auto_password', ''); |
$password = hotspot_setting('auto_password', ''); |
| 75 |
} |
} |
| 76 |
} |
} |
| 77 |
} |
} |
| 78 |
|
|
| 79 |
if ($_REQUEST['res'] == 'splash') { |
if ($_REQUEST['res'] == 'splash') { |
| 88 |
|
|
| 89 |
/** |
/** |
| 90 |
* If this is a login attempt, we'll process that here so that |
* If this is a login attempt, we'll process that here so that |
| 91 |
* we can issue a redirect back to CoovaChilli. (Not use by |
* we can issue a redirect back to CoovaChilli. (Not used by |
| 92 |
* JavaScript controller) |
* JavaScript controller) |
| 93 |
*/ |
*/ |
| 94 |
|
|
| 232 |
} |
} |
| 233 |
|
|
| 234 |
function theme_hotspot_success(&$node) { |
function theme_hotspot_success(&$node) { |
| 235 |
return theme_hotspot_status(); |
$url = hotspot_get_param('userurl'); |
| 236 |
|
$content = '<p>You are now on-line!</p>'; |
| 237 |
|
if ($url != '') { |
| 238 |
|
$content .= '<p>Original URL: <a href="'.$url.'">'.$url.'</a></p>'; |
| 239 |
|
} |
| 240 |
|
return $content; |
| 241 |
} |
} |
| 242 |
|
|
| 243 |
function theme_hotspot_loginform() |
function theme_hotspot_loginform() |
| 369 |
} |
} |
| 370 |
|
|
| 371 |
function theme_hotspot_jsstatus() { |
function theme_hotspot_jsstatus() { |
| 372 |
return ' |
return ' |
| 373 |
<div id="statusPage" style="display:none;"> |
<div id="statusPage" style="display:none;"> |
| 374 |
<table id="tableTab" cellpadding="0" cellspacing="0"> |
<table id="tableTab" cellpadding="0" cellspacing="0"> |
| 375 |
<tr> |
<tr> |