当前位置: 首页>>代码示例>>PHP>>正文


PHP phpCAS::error方法代码示例

本文整理汇总了PHP中phpCAS::error方法的典型用法代码示例。如果您正苦于以下问题:PHP phpCAS::error方法的具体用法?PHP phpCAS::error怎么用?PHP phpCAS::error使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在phpCAS的用法示例。


在下文中一共展示了phpCAS::error方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: read

 /**
  * This virtual method reads a PGT corresponding to a PGT Iou and deletes
  * the corresponding storage entry.
  *
  * @param string $pgt_iou the PGT iou
  *
  * @return void
  *
  * @note Should never be called.
  */
 function read($pgt_iou)
 {
     phpCAS::error(__CLASS__ . '::' . __FUNCTION__ . '() should never be called');
 }
开发者ID:jifangshiyanshi,项目名称:tuonews,代码行数:14,代码来源:AbstractStorage.php

示例2: 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();
 }
开发者ID:vinoth4891,项目名称:clinique,代码行数:16,代码来源:CAS.php

示例3: 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();
 }
开发者ID:bitschift,项目名称:CollabAchievements,代码行数:19,代码来源:CAS.php

示例4: 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();
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:22,代码来源:pgt-db.php

示例5: write

 /**
  * This method stores a PGT and its corresponding PGT Iou into a file. Echoes a
  * warning on error.
  *
  * @param $pgt the PGT
  * @param $pgt_iou the PGT iou
  *
  * @public
  */
 function write($pgt, $pgt_iou)
 {
     phpCAS::traceBegin();
     $fname = $this->getPGTIouFilename($pgt_iou);
     if (!file_exists($fname)) {
         if ($f = fopen($fname, "w")) {
             if (fputs($f, $pgt) === FALSE) {
                 phpCAS::error('could not write PGT to `' . $fname . '\'');
             }
             fclose($f);
         } else {
             phpCAS::error('could not open `' . $fname . '\'');
         }
     } else {
         phpCAS::error('File exists: `' . $fname . '\'');
     }
     phpCAS::traceEnd();
 }
开发者ID:JP-Git,项目名称:moodle,代码行数:27,代码来源:pgt-file.php

示例6: _readURL

 /**
  * This method is used to acces a remote URL.
  *
  * @param string $url      the URL to access.
  * @param string &$headers an array containing the HTTP header lines of the
  * response (an empty array on failure).
  * @param string &$body    the body of the response, as a string (empty on
  * failure).
  * @param string &$err_msg an error message, filled on failure.
  *
  * @return true on success, false otherwise (in this later case, $err_msg
  * contains an error message).
  */
 private function _readURL($url, &$headers, &$body, &$err_msg)
 {
     phpCAS::traceBegin();
     $className = $this->_requestImplementation;
     $request = new $className();
     if (count($this->_curl_options)) {
         $request->setCurlOptions($this->_curl_options);
     }
     $request->setUrl($url);
     if (empty($this->_cas_server_ca_cert) && !$this->_no_cas_server_validation) {
         phpCAS::error('one of the methods phpCAS::setCasServerCACert() or phpCAS::setNoCasServerValidation() must be called.');
     }
     if ($this->_cas_server_ca_cert != '') {
         $request->setSslCaCert($this->_cas_server_ca_cert, $this->_cas_server_cn_validate);
     }
     // add extra stuff if SAML
     if ($this->getServerVersion() == SAML_VERSION_1_1) {
         $request->addHeader("soapaction: http://www.oasis-open.org/committees/security");
         $request->addHeader("cache-control: no-cache");
         $request->addHeader("pragma: no-cache");
         $request->addHeader("accept: text/xml");
         $request->addHeader("connection: keep-alive");
         $request->addHeader("content-type: text/xml");
         $request->makePost();
         $request->setPostBody($this->_buildSAMLPayload());
     }
     if ($request->send()) {
         $headers = $request->getResponseHeaders();
         $body = $request->getResponseBody();
         $err_msg = '';
         phpCAS::traceEnd(true);
         return true;
     } else {
         $headers = '';
         $body = '';
         $err_msg = $request->getErrorMessage();
         phpCAS::traceEnd(false);
         return false;
     }
 }
开发者ID:bryan-mwas,项目名称:Clearance101,代码行数:53,代码来源:Client.php

示例7: getProxies

	/**
	 * Answer an array of proxies that are sitting in front of this application.
	 *
	 * This method will only return a non-empty array if we have received and validated
	 * a Proxy Ticket.
	 * 
	 * @return array
	 * @access public
	 * @since 6/25/09
	 */
	public static function getProxies () {
		global $PHPCAS_CLIENT;
		if ( !is_object($PHPCAS_CLIENT) ) {
			phpCAS::error('this method should only be called after '.__CLASS__.'::client()');
		}  
		
		return($PHPCAS_CLIENT->getProxies());
	}
开发者ID:rhertzog,项目名称:lcs,代码行数:18,代码来源:class.CAS.1.2.0.php

示例8: write

 /**
  * This method stores a PGT and its corresponding PGT Iou in the database.
  * Echoes a warning on error.
  *
  * @param string $pgt     the PGT
  * @param string $pgt_iou the PGT iou
  *
  * @return void
  */
 public function write($pgt, $pgt_iou)
 {
     phpCAS::traceBegin();
     // initialize the PDO object for this method
     $pdo = $this->_getPdo();
     $this->_setErrorMode();
     try {
         $pdo->beginTransaction();
         $query = $pdo->prepare($this->storePgtSql());
         $query->bindValue(':pgt', $pgt, PDO::PARAM_STR);
         $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::error('error writing PGT to database: ' . $e->getMessage());
     }
     // reset the PDO object
     $this->_resetErrorMode();
     phpCAS::traceEnd();
 }
开发者ID:Trideon,项目名称:gigolo,代码行数:35,代码来源:Db.php

示例9: read

 /**
  * This method reads a PGT corresponding to a PGT Iou and deletes the
  * corresponding file.
  *
  * @param string $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::error('could not open `' . $fname . '\'');
         } else {
             if (($pgt = fgets($f)) === false) {
                 phpCAS::error('could not read PGT from `' . $fname . '\'');
             }
             phpCAS::trace('Successful read of PGT to `' . $fname . '\'');
             fclose($f);
         }
         // delete the PGT file
         @unlink($fname);
     } else {
         phpCAS::error('No such file `' . $fname . '\'');
     }
     phpCAS::traceEnd($pgt);
     return $pgt;
 }
开发者ID:dipeira,项目名称:sch-progs,代码行数:33,代码来源:File.php

示例10: retrievePT

 /**
  * Retrieve a Proxy Ticket from the CAS server.
  */
 function retrievePT($target_service, &$err_code, &$err_msg)
 {
     global $PHPCAS_CLIENT;
     if (!is_object($PHPCAS_CLIENT)) {
         phpCAS::error('this method should only be called after ' . __CLASS__ . '::proxy()');
     }
     if (gettype($target_service) != 'string') {
         phpCAS::error('type mismatched for parameter $target_service(should be `string\')');
     }
     return $PHPCAS_CLIENT->retrievePT($target_service, $err_code, $err_msg);
 }
开发者ID:veritech,项目名称:pare-project,代码行数:14,代码来源:CAS.php

示例11: 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();
     if (!is_object(self::$_PHPCAS_CLIENT)) {
         phpCAS::error('this method should only be called after ' . __CLASS__ . '::client() or' . __CLASS__ . '::proxy()');
     }
     self::$_PHPCAS_CLIENT->addRebroadcastHeader($header);
     phpCAS::traceEnd();
 }
开发者ID:rhertzog,项目名称:lcs,代码行数:17,代码来源:CAS.php

示例12: readURL

 /**
  * This method is used to acces a remote URL.
  *
  * @param $url the URL to access.
  * @param $cookies an array containing cookies strings such as 'name=val'
  * @param $headers an array containing the HTTP header lines of the response
  * (an empty array on failure).
  * @param $body the body of the response, as a string (empty on failure).
  * @param $err_msg an error message, filled on failure.
  *
  * @return TRUE on success, FALSE otherwise (in this later case, $err_msg
  * contains an error message).
  *
  * @private
  */
 function readURL($url, $cookies, &$headers, &$body, &$err_msg)
 {
     phpCAS::traceBegin();
     $headers = '';
     $body = '';
     $err_msg = '';
     $res = TRUE;
     // initialize the CURL session
     $ch = curl_init($url);
     if (version_compare(PHP_VERSION, '5.1.3', '>=')) {
         //only avaible in php5
         curl_setopt_array($ch, $this->_curl_options);
     } else {
         foreach ($this->_curl_options as $key => $value) {
             curl_setopt($ch, $key, $value);
         }
     }
     if ($this->_cas_server_cert == '' && $this->_cas_server_ca_cert == '' && !$this->_no_cas_server_validation) {
         phpCAS::error('one of the methods phpCAS::setCasServerCert(), phpCAS::setCasServerCACert() or phpCAS::setNoCasServerValidation() must be called.');
     }
     if ($this->_cas_server_cert != '') {
         curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
         curl_setopt($ch, CURLOPT_SSLCERT, $this->_cas_server_cert);
     } else {
         if ($this->_cas_server_ca_cert != '') {
             curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
             curl_setopt($ch, CURLOPT_CAINFO, $this->_cas_server_ca_cert);
         } else {
             curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1);
             curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
         }
     }
     // return the CURL output into a variable
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     // get the HTTP header with a callback
     $this->_curl_headers = array();
     // empty the headers array
     curl_setopt($ch, CURLOPT_HEADERFUNCTION, array($this, '_curl_read_headers'));
     // add cookies headers
     if (is_array($cookies)) {
         curl_setopt($ch, CURLOPT_COOKIE, implode(';', $cookies));
     }
     // perform the query
     $buf = curl_exec($ch);
     if ($buf === FALSE) {
         phpCAS::trace('curl_exec() failed');
         $err_msg = 'CURL error #' . curl_errno($ch) . ': ' . curl_error($ch);
         // close the CURL session
         curl_close($ch);
         $res = FALSE;
     } else {
         // close the CURL session
         curl_close($ch);
         $headers = $this->_curl_headers;
         $body = $buf;
     }
     phpCAS::traceEnd($res);
     return $res;
 }
开发者ID:skdong,项目名称:nfs-ovd,代码行数:74,代码来源:client.php

示例13: readURL

 /**
  * This method is used to acces a remote URL.
  *
  * @param $url the URL to access.
  * @param $cookies an array containing cookies strings such as 'name=val'
  * @param $headers an array containing the HTTP header lines of the response
  * (an empty array on failure).
  * @param $body the body of the response, as a string (empty on failure).
  * @param $err_msg an error message, filled on failure.
  *
  * @return TRUE on success, FALSE otherwise (in this later case, $err_msg
  * contains an error message).
  *
  * @private
  */
 function readURL($url, $cookies, &$headers, &$body, &$err_msg)
 {
     phpCAS::traceBegin();
     $headers = '';
     $body = '';
     $err_msg = '';
     $res = TRUE;
     // initialize the CURL session
     $ch = curl_init($url);
     if (version_compare(PHP_VERSION, '5.1.3', '>=')) {
         //only avaible in php5
         curl_setopt_array($ch, $this->_curl_options);
     } else {
         foreach ($this->_curl_options as $key => $value) {
             curl_setopt($ch, $key, $value);
         }
     }
     if ($this->_cas_server_cert == '' && $this->_cas_server_ca_cert == '' && !$this->_no_cas_server_validation) {
         phpCAS::error('one of the methods phpCAS::setCasServerCert(), phpCAS::setCasServerCACert() or phpCAS::setNoCasServerValidation() must be called.');
     }
     if ($this->_cas_server_cert != '' && $this->_cas_server_ca_cert != '') {
         // This branch added by IDMS. Seems phpCAS implementor got a bit confused about the curl options CURLOPT_SSLCERT and CURLOPT_CAINFO
         curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
         curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1);
         curl_setopt($ch, CURLOPT_SSLCERT, $this->_cas_server_cert);
         curl_setopt($ch, CURLOPT_CAINFO, $this->_cas_server_ca_cert);
         curl_setopt($ch, CURLOPT_VERBOSE, '1');
         phpCAS::trace('CURL: Set all required opts for mutual authentication ------');
     } else {
         if ($this->_cas_server_cert != '') {
             curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
             curl_setopt($ch, CURLOPT_SSLCERT, $this->_cas_server_cert);
         } else {
             if ($this->_cas_server_ca_cert != '') {
                 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
                 curl_setopt($ch, CURLOPT_CAINFO, $this->_cas_server_ca_cert);
             } else {
                 curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1);
                 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
             }
         }
     }
     // return the CURL output into a variable
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     // get the HTTP header with a callback
     $this->_curl_headers = array();
     // empty the headers array
     curl_setopt($ch, CURLOPT_HEADERFUNCTION, array($this, '_curl_read_headers'));
     // add cookies headers
     if (is_array($cookies)) {
         curl_setopt($ch, CURLOPT_COOKIE, implode(';', $cookies));
     }
     // add extra stuff if SAML
     if ($this->hasSA()) {
         $more_headers = array("soapaction: http://www.oasis-open.org/committees/security", "cache-control: no-cache", "pragma: no-cache", "accept: text/xml", "connection: keep-alive", "content-type: text/xml");
         curl_setopt($ch, CURLOPT_HTTPHEADER, $more_headers);
         curl_setopt($ch, CURLOPT_POST, 1);
         $data = $this->buildSAMLPayload();
         //phpCAS::trace('SAML Payload: '.print_r($data, TRUE));
         curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
     }
     // perform the query
     $buf = curl_exec($ch);
     //phpCAS::trace('CURL: Call completed. Response body is: \''.$buf.'\'');
     if ($buf === FALSE) {
         phpCAS::trace('curl_exec() failed');
         $err_msg = 'CURL error #' . curl_errno($ch) . ': ' . curl_error($ch);
         //phpCAS::trace('curl error: '.$err_msg);
         // close the CURL session
         curl_close($ch);
         $res = FALSE;
     } else {
         // close the CURL session
         curl_close($ch);
         $headers = $this->_curl_headers;
         $body = $buf;
     }
     phpCAS::traceEnd($res);
     return $res;
 }
开发者ID:nagyistoce,项目名称:moodle-Teach-Pilot,代码行数:95,代码来源:client.php

示例14: _renameSession

 /**
  * Renaming the session
  *
  * @param string $ticket name of the ticket
  *
  * @return void
  */
 private function _renameSession($ticket)
 {
     phpCAS::traceBegin();
     if ($this->getChangeSessionID()) {
         if (!empty($this->_user)) {
             $old_session = $_SESSION;
             session_destroy();
             // set up a new session, of name based on the ticket
             $session_id = preg_replace('/[^a-zA-Z0-9\\-]/', '', $ticket);
             phpCAS::trace("Session ID: " . $session_id);
             session_id($session_id);
             session_start();
             phpCAS::trace("Restoring old session vars");
             $_SESSION = $old_session;
         } else {
             phpCAS::error('Session should only be renamed after successfull authentication');
         }
     } else {
         phpCAS::trace("Skipping session rename since phpCAS is not handling the session.");
     }
     phpCAS::traceEnd();
 }
开发者ID:Trideon,项目名称:gigolo,代码行数:29,代码来源:Client.php

示例15: 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();
 }
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:27,代码来源:pgt-db.php


注:本文中的phpCAS::error方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。