本文整理汇总了PHP中phpCAS::traceBegin方法的典型用法代码示例。如果您正苦于以下问题:PHP phpCAS::traceBegin方法的具体用法?PHP phpCAS::traceBegin怎么用?PHP phpCAS::traceBegin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类phpCAS
的用法示例。
在下文中一共展示了phpCAS::traceBegin方法的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();
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;
}
示例2: __construct
/**
* This method is used to print the HTML output when the user was not
* authenticated.
*
* @param CAS_Client $client phpcas client
* @param string $failure the failure that occured
* @param string $cas_url the URL the CAS server was asked for
* @param bool $no_response the response from the CAS server (other
* parameters are ignored if TRUE)
* @param bool $bad_response bad response from the CAS server ($err_code
* and $err_msg ignored if TRUE)
* @param string $cas_response the response of the CAS server
* @param int $err_code the error code given by the CAS server
* @param string $err_msg the error message given by the CAS server
*/
public function __construct($client, $failure, $cas_url, $no_response, $bad_response = '', $cas_response = '', $err_code = '', $err_msg = '')
{
phpCAS::traceBegin();
$lang = $client->getLangObj();
$client->printHTMLHeader($lang->getAuthenticationFailed());
printf($lang->getYouWereNotAuthenticated(), htmlentities($client->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 ($client->getServerVersion()) {
case CAS_VERSION_1_0:
phpCAS::trace('Reason: CAS error');
break;
case CAS_VERSION_2_0:
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);
}
$client->printHTMLFooter();
phpCAS::traceExit();
}
示例3: 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;
}
示例4: __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();
}
示例5: 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();
}
示例6: init
/**
* This method is used to initialize the storage. Halts on error.
*
* @public
*/
function init()
{
phpCAS::traceBegin();
// if the storage has already been initialized, return immediatly
if ($this->isInitialized()) {
return;
}
// call the ancestor's method (mark as initialized)
parent::init();
// try to connect to the database
$this->_link = DB::connect($this->getURL());
if (DB::isError($this->_link)) {
phpCAS::error('could not connect to database (' . DB::errorMessage($this->_link) . ')');
}
var_dump($this->_link);
phpCAS::traceBEnd();
}
示例7: addRebroadcastHeader
/**
* This method is used to add header parameters when rebroadcasting
* pgtIou/pgtId or logoutRequest.
*
* @param String $header Header to send when rebroadcasting.
*
* @return void
*/
public static function addRebroadcastHeader($header)
{
phpCAS::traceBegin();
phpCAS::_validateClientExists();
try {
self::$_PHPCAS_CLIENT->addRebroadcastHeader($header);
} catch (Exception $e) {
phpCAS::error(get_class($e) . ': ' . $e->getMessage());
}
phpCAS::traceEnd();
}
示例8: 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;
}
示例9: init
/**
* This method is used to initialize the storage. Halts on error.
*
* @public
*/
function init()
{
phpCAS::traceBegin();
// if the storage has already been initialized, return immediatly
if ($this->isInitialized()) {
return;
}
// call the ancestor's method (mark as initialized)
parent::init();
//include phpDB library (the test was introduced in release 0.4.8 for
//the integration into Tikiwiki).
if (!class_exists('DB')) {
include_once 'DB.php';
}
// try to connect to the database
$this->_link = DB::connect($this->getURL());
if (DB::isError($this->_link)) {
phpCAS::error('could not connect to database (' . DB::errorMessage($this->_link) . ')');
}
var_dump($this->_link);
phpCAS::traceBEnd();
}
示例10: 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;
}
示例11: 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;
}
示例12: 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;
}
示例13: 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();
}
示例14: _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;
}
示例15: open
/**
* Open the IMAP stream (similar to imap_open()).
*
* @return resource Returns an IMAP stream on success
* @throws CAS_OutOfSequenceException If called multiple times.
* @throws CAS_ProxyTicketException If there is a proxy-ticket failure.
* The code of the Exception will be one of:
* PHPCAS_SERVICE_PT_NO_SERVER_RESPONSE
* PHPCAS_SERVICE_PT_BAD_SERVER_RESPONSE
* PHPCAS_SERVICE_PT_FAILURE
* @throws CAS_ProxiedService_Exception If there is a failure sending the request to the target service. */
public function open()
{
if ($this->hasBeenOpened()) {
throw new CAS_OutOfSequenceException('Stream already opened.');
}
if (empty($this->_mailbox)) {
throw new CAS_ProxiedService_Exception('You must specify a mailbox via ' . get_class($this) . '->setMailbox($mailbox)');
}
phpCAS::traceBegin();
// Get our proxy ticket and append it to our URL.
$this->initializeProxyTicket();
phpCAS::trace('opening IMAP mailbox `' . $this->_mailbox . '\'...');
$this->_stream = @imap_open($this->_mailbox, $this->_username, $this->getProxyTicket(), $this->_options);
if ($this->_stream) {
phpCAS::trace('ok');
} else {
phpCAS::trace('could not open mailbox');
// @todo add localization integration.
$message = 'IMAP Error: ' . $url . ' ' . var_export(imap_errors(), true);
phpCAS::trace($message);
throw new CAS_ProxiedService_Exception($message);
}
phpCAS::traceEnd();
return $this->_stream;
}