From: moodler Date: Thu, 9 Mar 2006 16:45:25 +0000 (+0000) Subject: Checking in some old changes X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=8a8333860e70fcedf837640cbf0473dbd7454696;p=moodle.git Checking in some old changes --- diff --git a/sso/hive/expired.php b/sso/hive/expired.php index 58dd43be2e..31dcfe3fa4 100644 --- a/sso/hive/expired.php +++ b/sso/hive/expired.php @@ -1,47 +1,47 @@ - -
- - - - - -
- - - - - - - - - -
- : - - " /> -
- : - - " /> -
-
- " /> -
-
-
- + +
+ + + + + +
+ + + + + + + + + +
+ : + + " /> +
+ : + + " /> +
+
+ " /> +
+
+
+ diff --git a/sso/hive/lib.php b/sso/hive/lib.php index 5ba3c2f4a3..90c123d0c9 100755 --- a/sso/hive/lib.php +++ b/sso/hive/lib.php @@ -1,68 +1,79 @@ -sso = 'hive'; - // $CFG->hiveprotocol = 'http'; - // $CFG->hiveport = '80'; - // $CFG->hivehost = 'turkey.harvestroad.com.au'; - // $CFG->hivepath = '/cgi-bin/hive/hive.cgi'; - // $CFG->hivecbid = '28'; - -function sso_user_login($username, $password) { - - global $CFG, $SESSION; - - include($CFG->libdir.'/snoopy/Snoopy.class.inc'); - - if (empty($CFG->hivehost)) { - return false; // Hive config variables not configured yet - } - -/// Set up Snoopy - - $snoopy = new Snoopy; - - $submit_url = $CFG->hiveprotocol .'://'. $CFG->hivehost .':'. $CFG->hiveport .''. $CFG->hivepath ; - - $submit_vars['HIVE_UNAME'] = $username; - $submit_vars['HIVE_UPASS'] = $password; - $submit_vars['HIVE_ENDUSER']= $username; - $submit_vars['HIVE_REQ'] = '2112'; - $submit_vars['HIVE_REF'] = 'hin:hive@API Login 3'; - $submit_vars['HIVE_RET'] = 'ORG'; - $submit_vars['HIVE_REM'] = ''; - $submit_vars['HIVE_PROD'] = '0'; - $submit_vars['HIVE_USERIP'] = getremoteaddr(); - - -/// We use POST to call Hive with a bit more security - $snoopy->submit($submit_url,$submit_vars); - -/// If there's a bug, we may need to use GET instead -/// foreach ($submit_vars as $name => $value) { -/// $params[] = "$name=".urlencode($value); -/// } -/// $submit_url .= '?'.implode('&', $params); -/// $snoopy->fetch($submit_url); - -/// Extract HIVE_SESSION from headers - - foreach ($snoopy->headers as $header) { - if (strpos($header, 'HIVE_SESSION=') !== false) { - $header = explode('HIVE_SESSION=', $header); - if (count($header) > 1) { - $cookie = explode(';', $header[1]); - $cookie = $cookie[0]; - $SESSION->HIVE_SESSION = $cookie; - $SESSION->HIVE_PASSWORD = $password; - return true; - } - } - } - return false; // No cookie found -} - -?> +sso = 'hive'; + // $CFG->hiveprotocol = 'http'; + // $CFG->hiveport = '80'; + // $CFG->hivehost = 'turkey.harvestroad.com.au'; + // $CFG->hivepath = '/cgi-bin/hive/hive.cgi'; + // $CFG->hivecbid = '28'; + +function sso_user_login($username, $password) { + + global $CFG, $SESSION; + + include($CFG->libdir.'/snoopy/Snoopy.class.inc'); + + if (empty($CFG->hivehost)) { + return false; // Hive config variables not configured yet + } + +/// Set up Snoopy + + $snoopy = new Snoopy; + + $submit_url = $CFG->hiveprotocol .'://'. $CFG->hivehost .':'. $CFG->hiveport .''. $CFG->hivepath ; + + $submit_vars['HIVE_UNAME'] = $username; + $submit_vars['HIVE_UPASS'] = $password; + $submit_vars['HIVE_ENDUSER']= $username; + $submit_vars['HIVE_REQ'] = '2112'; + $submit_vars['HIVE_REF'] = 'hin:hive@API Login 3'; + $submit_vars['HIVE_RET'] = 'ORG'; + $submit_vars['HIVE_REM'] = ''; + $submit_vars['HIVE_PROD'] = '0'; + $submit_vars['HIVE_USERIP'] = getremoteaddr(); + + +/// We use POST to call Hive with a bit more security + $snoopy->submit($submit_url,$submit_vars); + +/// Extract HIVE_SESSION from headers + + foreach ($snoopy->headers as $header) { + if (strpos($header, 'HIVE_SESSION=') !== false) { + $header = explode('HIVE_SESSION=', $header); + if (count($header) > 1) { + $cookie = explode(';', $header[1]); + $cookie = $cookie[0]; + $SESSION->HIVE_SESSION = $cookie; + return true; + } + } + } + +/// Try again with the guest username and password + + $submit_vars['HIVE_UNAME'] = $CFG->hiveusername; + $submit_vars['HIVE_UPASS'] = $CFG->hivepassword; + $submit_vars['HIVE_ENDUSER']= $CFG->hiveusername; + $snoopy->submit($submit_url,$submit_vars); + foreach ($snoopy->headers as $header) { + if (strpos($header, 'HIVE_SESSION=') !== false) { + $header = explode('HIVE_SESSION=', $header); + if (count($header) > 1) { + $cookie = explode(';', $header[1]); + $cookie = $cookie[0]; + $SESSION->HIVE_SESSION = $cookie; + return true; + } + } + } + + return false; // No cookie found +} + +?> diff --git a/sso/hive/login.php b/sso/hive/login.php index 3d4cb11984..cc83319ed3 100644 --- a/sso/hive/login.php +++ b/sso/hive/login.php @@ -1,23 +1,23 @@ -username, $frm->password)) { - - /// reopen Hive - redirect($CFG->wwwroot.'/mod/resource/type/repository/hive/openhive.php'); - } else { - redirect($CFG->wwwroot.'/sso/hive/expired.php'); - } - -?> - +username, $frm->password)) { + + /// reopen Hive + redirect($CFG->wwwroot.'/mod/resource/type/repository/hive/openlitebrowse.php'); + } else { + redirect($CFG->wwwroot.'/sso/hive/expired.php'); + } + +?> +