/[drupal]/contributions/modules/hotspot/hotspot.pages.inc
ViewVC logotype

Diff of /contributions/modules/hotspot/hotspot.pages.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.4.2.5, Mon Jul 27 11:46:18 2009 UTC revision 1.4.2.6, Fri Jul 31 19:34:48 2009 UTC
# Line 1  Line 1 
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    
# Line 21  function hotspot_render($tid = 0) { Line 26  function hotspot_render($tid = 0) {
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        }        }
# Line 45  function hotspot_render($tid = 0) { Line 73  function hotspot_render($tid = 0) {
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') {
# Line 60  function hotspot_render($tid = 0) { Line 88  function hotspot_render($tid = 0) {
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    
# Line 204  function theme_hotspot_already(&$node) { Line 232  function theme_hotspot_already(&$node) {
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()
# Line 336  function theme_hotspot_jshtml() Line 369  function theme_hotspot_jshtml()
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>

Legend:
Removed from v.1.4.2.5  
changed lines
  Added in v.1.4.2.6

  ViewVC Help
Powered by ViewVC 1.1.2