ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
Miscellaneous
+ Collaboration diagram for Miscellaneous:

Functions

 CASClient::getURL ()
 This method returns the URL of the current request (without any ticket CGI parameter).
 CASClient::removeParameterFromQueryString ($parameterName, $queryString)
 Removes a parameter from a query string.
 CASClient::setURL ($url)
 This method sets the URL of the current request.
 CASClient::authError ($failure, $cas_url, $no_response, $bad_response='', $cas_response='', $err_code='', $err_msg='')
 This method is used to print the HTML output when the user was not authenticated.

Variables

 CASClient::$_url
 the URL of the current request (without any ticket CGI parameter).
 $GLOBALS ['PHPCAS_CLIENT']
 This global variable is used by the interface class phpCAS.
 $GLOBALS ['PHPCAS_INIT_CALL']
 This global variable is used to store where the initializer is called from (to print a comprehensive error in case of multiple calls).
 $GLOBALS ['PHPCAS_AUTH_CHECK_CALL']
 This global variable is used to store where the method checking the authentication is called from (to print comprehensive errors)
 $GLOBALS ['PHPCAS_DEBUG']
 This global variable is used to store phpCAS debug mode.
 $PHPCAS_CLIENT
 This global variable is used by the interface class phpCAS.
 $PHPCAS_INIT_CALL
 This global variable is used to store where the initializer is called from (to print a comprehensive error in case of multiple calls).
 $PHPCAS_AUTH_CHECK_CALL
 This global variable is used to store where the method checking the authentication is called from (to print comprehensive errors)
 $PHPCAS_DEBUG
 This global variable is used to store phpCAS debug mode.

Detailed Description

Function Documentation

CASClient::authError (   $failure,
  $cas_url,
  $no_response,
  $bad_response = '',
  $cas_response = '',
  $err_code = '',
  $err_msg = '' 
)
private

This method is used to print the HTML output when the user was not authenticated.

Parameters
$failurethe failure that occured
$cas_urlthe URL the CAS server was asked for
$no_responsethe response from the CAS server (other parameters are ignored if TRUE)
$bad_responsebad response from the CAS server ($err_code and $err_msg ignored if TRUE)
$cas_responsethe response of the CAS server
$err_codethe error code given by the CAS server
$err_msgthe error message given by the CAS server

Definition at line 2722 of file client.php.

References $failure, CAS_STR_AUTHENTICATION_FAILED, CAS_STR_YOU_WERE_NOT_AUTHENTICATED, CAS_VERSION_1_0, CAS_VERSION_2_0, exit, phpCAS\trace(), phpCAS\traceBegin(), and phpCAS\traceExit().

Referenced by CASClient\validateST().

{
printf($this->getString(CAS_STR_YOU_WERE_NOT_AUTHENTICATED),htmlentities($this->getURL()),$_SERVER['SERVER_ADMIN']);
phpCAS::trace('CAS URL: '.$cas_url);
phpCAS::trace('Authentication failure: '.$failure);
if ( $no_response ) {
phpCAS::trace('Reason: no response from the CAS server');
} else {
if ( $bad_response ) {
phpCAS::trace('Reason: bad response from the CAS server');
} else {
switch ($this->getServerVersion()) {
phpCAS::trace('Reason: CAS error');
break;
if ( empty($err_code) )
phpCAS::trace('Reason: no CAS error');
else
phpCAS::trace('Reason: ['.$err_code.'] CAS error: '.$err_msg);
break;
}
}
phpCAS::trace('CAS response: '.$cas_response);
}
$this->printHTMLFooter();
exit();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

CASClient::getURL ( )
private

This method returns the URL of the current request (without any ticket CGI parameter).

Returns
The URL

Definition at line 2621 of file client.php.

Referenced by CASClient\getServerLoginURL(), CASClient\getServerProxyValidateURL(), CASClient\getServerSamlValidateURL(), CASClient\getServerServiceValidateURL(), and CASClient\isAuthenticated().

{
// the URL is built when needed only
if ( empty($this->_url) ) {
$final_uri = '';
// remove the ticket if present in the URL
$final_uri = ($this->isHttps()) ? 'https' : 'http';
$final_uri .= '://';
/* replaced by Julien Marchal - v0.4.6
* $this->_url .= $_SERVER['SERVER_NAME'];
*/
if(empty($_SERVER['HTTP_X_FORWARDED_SERVER'])){
/* replaced by teedog - v0.4.12
* $this->_url .= $_SERVER['SERVER_NAME'];
*/
if (empty($_SERVER['SERVER_NAME'])) {
$server_name = $_SERVER['HTTP_HOST'];
} else {
$server_name = $_SERVER['SERVER_NAME'];
}
} else {
$server_name = $_SERVER['HTTP_X_FORWARDED_SERVER'];
}
$final_uri .= $server_name;
if (!strpos($server_name, ':')) {
if ( ($this->isHttps() && $_SERVER['SERVER_PORT']!=443)
|| (!$this->isHttps() && $_SERVER['SERVER_PORT']!=80) ) {
$final_uri .= ':';
$final_uri .= $_SERVER['SERVER_PORT'];
}
}
$request_uri = explode('?', $_SERVER['REQUEST_URI'], 2);
$final_uri .= $request_uri[0];
if (isset($request_uri[1]) && $request_uri[1])
{
$query_string = $this->removeParameterFromQueryString('ticket', $request_uri[1]);
// If the query string still has anything left, append it to the final URI
if ($query_string !== '')
$final_uri .= "?$query_string";
}
phpCAS::trace("Final URI: $final_uri");
$this->setURL($final_uri);
}
phpCAS::traceEnd($this->_url);
return $this->_url;
}

+ Here is the caller graph for this function:

CASClient::removeParameterFromQueryString (   $parameterName,
  $queryString 
)

Removes a parameter from a query string.

Parameters
string$parameterName
string$queryString
Returns
string

http://stackoverflow.com/questions/1842681/regular-expression-to-remove-one-parameter-from-query-string

Definition at line 2685 of file client.php.

{
$parameterName = preg_quote($parameterName);
return preg_replace("/&$parameterName(=[^&]*)?|^$parameterName(=[^&]*)?&?/", '', $queryString);
}
CASClient::setURL (   $url)
private

This method sets the URL of the current request.

Parameters
$urlurl to set for service

Definition at line 2699 of file client.php.

{
$this->_url = $url;
}

Variable Documentation

CASClient::$_url
private

the URL of the current request (without any ticket CGI parameter).

Written and read by CASClient::getURL().

Definition at line 2611 of file client.php.

$GLOBALS['PHPCAS_CLIENT']

This global variable is used by the interface class phpCAS.

Definition at line 276 of file CAS.php.

$GLOBALS['PHPCAS_INIT_CALL']

This global variable is used to store where the initializer is called from (to print a comprehensive error in case of multiple calls).

Definition at line 284 of file CAS.php.

$GLOBALS['PHPCAS_AUTH_CHECK_CALL']

This global variable is used to store where the method checking the authentication is called from (to print comprehensive errors)

Definition at line 297 of file CAS.php.

$GLOBALS['PHPCAS_DEBUG']

This global variable is used to store phpCAS debug mode.

Definition at line 310 of file CAS.php.

$PHPCAS_AUTH_CHECK_CALL

This global variable is used to store where the method checking the authentication is called from (to print comprehensive errors)

Definition at line 195 of file CAS.php.

Referenced by phpCAS\checkAuthentication(), phpCAS\forceAuthentication(), phpCAS\getAttributes(), phpCAS\getUser(), phpCAS\isAuthenticated(), phpCAS\serviceMail(), phpCAS\serviceWeb(), phpCAS\setPGTStorageDB(), and phpCAS\setPGTStorageFile().

$PHPCAS_DEBUG

This global variable is used to store phpCAS debug mode.

Definition at line 206 of file CAS.php.

Referenced by phpCAS\log(), phpCAS\setDebug(), phpCAS\traceBegin(), phpCAS\traceEnd(), and phpCAS\traceExit().

$PHPCAS_INIT_CALL

This global variable is used to store where the initializer is called from (to print a comprehensive error in case of multiple calls).

Definition at line 184 of file CAS.php.

Referenced by phpCAS\client(), and phpCAS\proxy().