本文整理汇总了PHP中phpCAS::traceEnd方法的典型用法代码示例。如果您正苦于以下问题:PHP phpCAS::traceEnd方法的具体用法?PHP phpCAS::traceEnd怎么用?PHP phpCAS::traceEnd使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类phpCAS
的用法示例。
在下文中一共展示了phpCAS::traceEnd方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendRequest
/**
* Send the request and store the results.
*
* @return bool true on success, false on failure.
*/
protected function sendRequest()
{
phpCAS::traceBegin();
/*********************************************************
* initialize the CURL session
*********************************************************/
$ch = $this->_initAndConfigure();
/*********************************************************
* Perform the query
*********************************************************/
$buf = curl_exec($ch);
if ($buf === false) {
phpCAS::trace('curl_exec() failed');
$this->storeErrorMessage('CURL error #' . curl_errno($ch) . ': ' . curl_error($ch));
$res = false;
} else {
$this->storeResponseBody($buf);
phpCAS::trace("Response Body: \n" . $buf . "\n");
$res = true;
}
// close the CURL session
curl_close($ch);
phpCAS::traceEnd($res);
return $res;
}
示例2: sendRequest
/**
* Send the request and store the results.
*
* @return bool true on success, false on failure.
*/
protected function sendRequest()
{
phpCAS::traceBegin();
/*********************************************************
* initialize the CURL session
*********************************************************/
$ch = $this->_initAndConfigure();
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
phpCAS::log(var_dump($ch) . ' [' . basename($dbg[0]['file']) . ':' . $dbg[0]['line'] . ']');
/*********************************************************
* Perform the query
*********************************************************/
$buf = curl_exec($ch);
if ($buf === false) {
phpCAS::trace('curl_exec() failed');
$this->storeErrorMessage('CURL error #' . curl_errno($ch) . ': ' . curl_error($ch));
$res = false;
} else {
$this->storeResponseBody($buf);
phpCAS::trace("Response Body: \n" . $buf . "\n");
$res = true;
}
// close the CURL session
curl_close($ch);
phpCAS::traceEnd($res);
return $res;
}
示例3: __construct
/**
* The constructor of the class, should be called only by inherited classes.
*
* @param CAS_Client $cas_parent the CAS _client instance that creates the
* current object.
*
* @return void
*
* @protected
*/
function __construct($cas_parent)
{
phpCAS::traceBegin();
if (!$cas_parent->isProxy()) {
phpCAS::error('defining PGT storage makes no sense when not using a CAS proxy');
}
phpCAS::traceEnd();
}
示例4: getSambaProxyTicket
public function getSambaProxyTicket()
{
phpCAS::traceBegin();
if ($this->hasGot()) {
throw new CAS_OutOfSequenceException('Cannot set the URL, request already sent.');
}
$this->count = 1;
$this->initializeProxyTicket();
phpCAS::traceEnd();
return $this->getProxyTicket();
}
示例5: setFixedServiceURL
/**
* Set the fixed URL that will be set as the CAS service parameter. When this
* method is not called, a phpCAS script uses its own URL.
*
* @param $url the URL
*/
function setFixedServiceURL($url)
{
global $PHPCAS_CLIENT;
phpCAS::traceBegin();
if (!is_object($PHPCAS_CLIENT)) {
phpCAS::error('this method should only be called after ' . __CLASS__ . '::proxy()');
}
if (gettype($url) != 'string') {
phpCAS::error('type mismatched for parameter $url (should be `string\')');
}
$PHPCAS_CLIENT->setURL($url);
phpCAS::traceEnd();
}
示例6: _sendRequest
/**
* Send the request and store the results.
*
* @return boolean TRUE on success, FALSE on failure.
*/
protected function _sendRequest()
{
phpCAS::traceBegin();
/*********************************************************
* initialize the CURL session
*********************************************************/
$ch = curl_init($this->url);
if (version_compare(PHP_VERSION, '5.1.3', '>=')) {
//only avaible in php5
curl_setopt_array($ch, $this->curlOptions);
} else {
foreach ($this->curlOptions as $key => $value) {
curl_setopt($ch, $key, $value);
}
}
/*********************************************************
* Set SSL configuration
*********************************************************/
if ($this->caCertPath) {
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
curl_setopt($ch, CURLOPT_CAINFO, $this->caCertPath);
phpCAS::trace('CURL: Set CURLOPT_CAINFO');
} else {
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
}
/*********************************************************
* Configure curl to capture our output.
*********************************************************/
// return the CURL output into a variable
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// get the HTTP header with a callback
curl_setopt($ch, CURLOPT_HEADERFUNCTION, array($this, '_curlReadHeaders'));
/*********************************************************
* Add cookie headers to our request.
*********************************************************/
if (count($this->cookies)) {
$cookieStrings = array();
foreach ($this->cookies as $name => $val) {
$cookieStrings[] = $name . '=' . $val;
}
curl_setopt($ch, CURLOPT_COOKIE, implode(';', $cookieStrings));
}
/*********************************************************
* Add any additional headers
*********************************************************/
if (count($this->headers)) {
curl_setopt($ch, CURLOPT_HTTPHEADER, $this->headers);
}
/*********************************************************
* Flag and Body for POST requests
*********************************************************/
if ($this->isPost) {
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $this->postBody);
}
/*********************************************************
* Perform the query
*********************************************************/
$buf = curl_exec($ch);
if ($buf === FALSE) {
phpCAS::trace('curl_exec() failed');
$this->storeErrorMessage('CURL error #' . curl_errno($ch) . ': ' . curl_error($ch));
$res = FALSE;
} else {
$this->storeResponseBody($buf);
phpCAS::trace("Response Body: \n" . $buf . "\n");
$res = TRUE;
}
// close the CURL session
curl_close($ch);
phpCAS::traceEnd($res);
return $res;
}
示例7: getURL
/**
* This method returns the URL of the current request (without any ticket
* CGI parameter).
*
* @return The URL
*/
private function getURL()
{
phpCAS::traceBegin();
// the URL is built when needed only
if (empty($this->_url)) {
$final_uri = '';
# Forcing base url if specified explicitly
if ($this->_service_base_url != null) {
$final_uri .= $this->_service_base_url;
} else {
$final_uri = $this->isHttps() ? 'https' : 'http';
$final_uri .= '://';
$final_uri .= $this->getServerUrl();
}
$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;
}
示例8: parseCookieHeaders
/**
* Parse Cookies without PECL
* From the comments in http://php.net/manual/en/function.http-parse-cookie.php
* @param array $header An array of header lines.
* @param string $defaultDomain The domain to use if none is specified in the cookie.
* @return array of cookies
*/
protected function parseCookieHeaders($header, $defaultDomain)
{
phpCAS::traceBegin();
$cookies = array();
foreach ($header as $line) {
if (preg_match('/^Set-Cookie2?: /i', $line)) {
$cookies[] = $this->parseCookieHeader($line, $defaultDomain);
}
}
phpCAS::traceEnd($cookies);
return $cookies;
}
示例9: logout
/**
* This method is used to logout from CAS. Halts by redirecting to the CAS server.
* @param $url a URL that will be transmitted to the CAS server (to come back to when logged out)
*/
function logout($url = "")
{
global $PHPCAS_CLIENT;
phpCAS::traceBegin();
if (!is_object($PHPCAS_CLIENT)) {
phpCAS::error('this method should only be called after ' . __CLASS__ . '::client() or' . __CLASS__ . '::proxy()');
}
$PHPCAS_CLIENT->logout($url);
// never reached
phpCAS::traceEnd();
}
示例10: PGTStorageDB
/**
* The class constructor, called by CASClient::SetPGTStorageDB().
*
* @param $cas_parent the CASClient instance that creates the object.
* @param $user the user to access the data with
* @param $password the user's password
* @param $database_type the type of the database hosting the data
* @param $hostname the server hosting the database
* @param $port the port the server is listening on
* @param $database the name of the database
* @param $table the name of the table storing the data
*
* @public
*/
function PGTStorageDB($cas_parent, $user, $password, $database_type, $hostname, $port, $database, $table)
{
phpCAS::traceBegin();
// call the ancestor's constructor
$this->PGTStorage($cas_parent);
if (empty($database_type)) {
$database_type = CAS_PGT_STORAGE_DB_DEFAULT_DATABASE_TYPE;
}
if (empty($hostname)) {
$hostname = CAS_PGT_STORAGE_DB_DEFAULT_HOSTNAME;
}
if ($port == 0) {
$port = CAS_PGT_STORAGE_DB_DEFAULT_PORT;
}
if (empty($database)) {
$database = CAS_PGT_STORAGE_DB_DEFAULT_DATABASE;
}
if (empty($table)) {
$table = CAS_PGT_STORAGE_DB_DEFAULT_TABLE;
}
// build and store the PEAR DB URL
$this->_url = $database_type . ':' . '//' . $user . ':' . $password . '@' . $server . ':' . $port . '/' . $database;
// XXX should use setURL and setTable
phpCAS::traceEnd();
}
示例11: setExtraCurlOption
/**
* Change CURL options.
* CURL is used to connect through HTTPS to CAS server
* @param $key the option key
* @param $value the value to set
*/
function setExtraCurlOption($key, $value)
{
global $PHPCAS_CLIENT;
phpCAS::traceBegin();
if (!is_object($PHPCAS_CLIENT)) {
phpCAS::error('this method should only be called after ' . __CLASS__ . '::client() or' . __CLASS__ . '::proxy()');
}
$PHPCAS_CLIENT->setExtraCurlOption($key, $value);
phpCAS::traceEnd();
}
示例12: getURL
/**
* This method returns the URL of the current request (without any ticket
* CGI parameter).
*
* @return The URL
*
* @private
*/
function getURL()
{
phpCAS::traceBegin();
// 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'];
}
}
$baseurl = explode("?", $_SERVER['REQUEST_URI'], 2);
$final_uri .= $baseurl[0];
$query_string = '';
if ($_GET) {
$kv = array();
foreach ($_GET as $key => $value) {
if ($key !== "ticket") {
$kv[] = urlencode($key) . "=" . urlencode($value);
}
}
$query_string = join("&", $kv);
}
if ($query_string) {
$final_uri .= "?" . $query_string;
}
$this->setURL($final_uri);
}
phpCAS::traceEnd($this->_url);
return $this->_url;
}
示例13: read
/**
* This method reads a PGT corresponding to a PGT Iou and deletes the
* corresponding file.
*
* @param $pgt_iou the PGT iou
*
* @return the corresponding PGT, or FALSE on error
*
* @public
*/
function read($pgt_iou)
{
phpCAS::traceBegin();
$pgt = FALSE;
$fname = $this->getPGTIouFilename($pgt_iou);
if (file_exists($fname)) {
if (!($f = fopen($fname, "r"))) {
phpCAS::trace('could not open `' . $fname . '\'');
} else {
if (($pgt = fgets($f)) === FALSE) {
phpCAS::trace('could not read PGT from `' . $fname . '\'');
}
fclose($f);
}
// delete the PGT file
@unlink($fname);
} else {
phpCAS::trace('No such file `' . $fname . '\'');
}
phpCAS::traceEnd($pgt);
return $pgt;
}
示例14: contains
/**
* Validate the proxies from the proxy ticket validation against the
* chains that were definded.
*
* @param array $list List of proxies from the proxy ticket validation.
*
* @return if any chain fully matches the supplied list
*/
public function contains(array $list)
{
phpCAS::traceBegin();
$count = 0;
foreach ($this->_chains as $chain) {
phpCAS::trace("Checking chain " . $count++);
if ($chain->matches($list)) {
phpCAS::traceEnd(true);
return true;
}
}
phpCAS::trace("No proxy chain matches.");
phpCAS::traceEnd(false);
return false;
}
示例15: read
/**
* This method reads a PGT corresponding to a PGT Iou and deletes the
* corresponding db entry.
*
* @param string $pgt_iou the PGT iou
*
* @return the corresponding PGT, or FALSE on error
*/
public function read($pgt_iou)
{
phpCAS::traceBegin();
$pgt = false;
// initialize the PDO object for this method
$pdo = $this->_getPdo();
$this->_setErrorMode();
try {
$pdo->beginTransaction();
// fetch the pgt for the specified pgt_iou
$query = $pdo->prepare($this->retrievePgtSql());
$query->bindValue(':pgt_iou', $pgt_iou, PDO::PARAM_STR);
$query->execute();
$pgt = $query->fetchColumn(0);
$query->closeCursor();
// delete the specified pgt_iou from the database
$query = $pdo->prepare($this->deletePgtSql());
$query->bindValue(':pgt_iou', $pgt_iou, PDO::PARAM_STR);
$query->execute();
$query->closeCursor();
$pdo->commit();
} catch (PDOException $e) {
// attempt rolling back the transaction before throwing a phpCAS error
try {
$pdo->rollBack();
} catch (PDOException $e) {
}
phpCAS::trace('error reading PGT from database: ' . $e->getMessage());
}
// reset the PDO object
$this->_resetErrorMode();
phpCAS::traceEnd();
return $pgt;
}