00001 <?php
00002
00003 error_reporting(E_ALL ^ E_NOTICE);
00004
00005
00006
00007
00008 if (!$_SERVER['REQUEST_URI']) {
00009 $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'].'?'.$_SERVER['QUERY_STRING'];
00010 }
00011
00012
00013
00014
00015 if (version_compare(PHP_VERSION,'5','>=')) {
00016
00017 }
00018
00026
00027
00028
00029
00030
00031
00032
00033
00037 define('PHPCAS_VERSION','0.4.20-1');
00038
00039
00040
00041
00050 define("CAS_VERSION_1_0",'1.0');
00054 define("CAS_VERSION_2_0",'2.0');
00055
00061
00062
00063
00067 define("CAS_PGT_STORAGE_FILE_DEFAULT_PATH",'/tmp');
00071 define("CAS_PGT_STORAGE_FILE_FORMAT_PLAIN",'plain');
00075 define("CAS_PGT_STORAGE_FILE_FORMAT_XML",'xml');
00079 define("CAS_PGT_STORAGE_FILE_DEFAULT_FORMAT",CAS_PGT_STORAGE_FILE_FORMAT_PLAIN);
00080
00081
00082
00086 define("CAS_PGT_STORAGE_DB_DEFAULT_DATABASE_TYPE",'mysql');
00090 define("CAS_PGT_STORAGE_DB_DEFAULT_HOSTNAME",'localhost');
00094 define("CAS_PGT_STORAGE_DB_DEFAULT_PORT",'');
00098 define("CAS_PGT_STORAGE_DB_DEFAULT_DATABASE",'phpCAS');
00102 define("CAS_PGT_STORAGE_DB_DEFAULT_TABLE",'pgt');
00103
00105
00106
00107
00116 define("PHPCAS_SERVICE_OK",0);
00121 define("PHPCAS_SERVICE_PT_NO_SERVER_RESPONSE",1);
00126 define("PHPCAS_SERVICE_PT_BAD_SERVER_RESPONSE",2);
00131 define("PHPCAS_SERVICE_PT_FAILURE",3);
00135 define("PHPCAS_SERVICE_NOT AVAILABLE",4);
00136
00138
00139
00140
00146 define("PHPCAS_LANG_ENGLISH", 'english');
00147 define("PHPCAS_LANG_FRENCH", 'french');
00148 define("PHPCAS_LANG_GREEK", 'greek');
00149
00160 define("PHPCAS_LANG_DEFAULT", PHPCAS_LANG_ENGLISH);
00161
00163
00164
00165
00176 $PHPCAS_CLIENT = null;
00177
00184 $PHPCAS_INIT_CALL = array('done' => FALSE,
00185 'file' => '?',
00186 'line' => -1,
00187 'method' => '?');
00188
00195 $PHPCAS_AUTH_CHECK_CALL = array('done' => FALSE,
00196 'file' => '?',
00197 'line' => -1,
00198 'method' => '?',
00199 'result' => FALSE);
00200
00206 $PHPCAS_DEBUG = array('filename' => FALSE,
00207 'indent' => 0,
00208 'unique_id' => '');
00209
00212
00213
00214
00215
00216
00217 if (version_compare(PHP_VERSION,'5','>='))
00218 {
00219 include_once(dirname(__FILE__).'/client.php');
00220 }
00221 else
00222 {
00223 include_once(dirname(__FILE__).'/client4.php');
00224 }
00225
00226
00227
00228
00229
00244 class phpCAS
00245 {
00246
00247
00248
00249
00250
00270 function client($server_version,
00271 $server_hostname,
00272 $server_port,
00273 $server_uri,
00274 $start_session = true)
00275 {
00276 global $PHPCAS_CLIENT, $PHPCAS_INIT_CALL;
00277
00278 phpCAS::traceBegin();
00279 if ( is_object($PHPCAS_CLIENT) ) {
00280 phpCAS::error($PHPCAS_INIT_CALL['method'].'() has already been called (at '.$PHPCAS_INIT_CALL['file'].':'.$PHPCAS_INIT_CALL['line'].')');
00281 }
00282 if ( gettype($server_version) != 'string' ) {
00283 phpCAS::error('type mismatched for parameter $server_version (should be `string\')');
00284 }
00285 if ( gettype($server_hostname) != 'string' ) {
00286 phpCAS::error('type mismatched for parameter $server_hostname (should be `string\')');
00287 }
00288 if ( gettype($server_port) != 'integer' ) {
00289 phpCAS::error('type mismatched for parameter $server_port (should be `integer\')');
00290 }
00291 if ( gettype($server_uri) != 'string' ) {
00292 phpCAS::error('type mismatched for parameter $server_uri (should be `string\')');
00293 }
00294
00295
00296 $dbg = phpCAS::backtrace();
00297 $PHPCAS_INIT_CALL = array('done' => TRUE,
00298 'file' => $dbg[0]['file'],
00299 'line' => $dbg[0]['line'],
00300 'method' => __CLASS__.'::'.__FUNCTION__);
00301
00302
00303 $PHPCAS_CLIENT = new CASClient($server_version,FALSE,$server_hostname,$server_port,$server_uri,$start_session);
00304 phpCAS::traceEnd();
00305 }
00306
00321 function proxy($server_version,
00322 $server_hostname,
00323 $server_port,
00324 $server_uri,
00325 $start_session = true)
00326 {
00327 global $PHPCAS_CLIENT, $PHPCAS_INIT_CALL;
00328
00329 phpCAS::traceBegin();
00330 if ( is_object($PHPCAS_CLIENT) ) {
00331 phpCAS::error($PHPCAS_INIT_CALL['method'].'() has already been called (at '.$PHPCAS_INIT_CALL['file'].':'.$PHPCAS_INIT_CALL['line'].')');
00332 }
00333 if ( gettype($server_version) != 'string' ) {
00334 phpCAS::error('type mismatched for parameter $server_version (should be `string\')');
00335 }
00336 if ( gettype($server_hostname) != 'string' ) {
00337 phpCAS::error('type mismatched for parameter $server_hostname (should be `string\')');
00338 }
00339 if ( gettype($server_port) != 'integer' ) {
00340 phpCAS::error('type mismatched for parameter $server_port (should be `integer\')');
00341 }
00342 if ( gettype($server_uri) != 'string' ) {
00343 phpCAS::error('type mismatched for parameter $server_uri (should be `string\')');
00344 }
00345
00346
00347 $dbg = phpCAS::backtrace();
00348 $PHPCAS_INIT_CALL = array('done' => TRUE,
00349 'file' => $dbg[0]['file'],
00350 'line' => $dbg[0]['line'],
00351 'method' => __CLASS__.'::'.__FUNCTION__);
00352
00353
00354 $PHPCAS_CLIENT = new CASClient($server_version,TRUE,$server_hostname,$server_port,$server_uri,$start_session);
00355 phpCAS::traceEnd();
00356 }
00357
00359
00360
00361
00362
00373 function setDebug($filename='')
00374 {
00375 global $PHPCAS_DEBUG;
00376
00377 if ( $filename != FALSE && gettype($filename) != 'string' ) {
00378 phpCAS::error('type mismatched for parameter $dbg (should be FALSE or the name of the log file)');
00379 }
00380
00381 if ( empty($filename) ) {
00382 if ( preg_match('/^Win.*/',getenv('OS')) ) {
00383 if ( isset($_ENV['TMP']) ) {
00384 $debugDir = $_ENV['TMP'].'/';
00385 } else if ( isset($_ENV['TEMP']) ) {
00386 $debugDir = $_ENV['TEMP'].'/';
00387 } else {
00388 $debugDir = '';
00389 }
00390 } else {
00391 $debugDir = '/tmp/';
00392 }
00393 $filename = $debugDir . 'phpCAS.log';
00394 }
00395
00396 if ( empty($PHPCAS_DEBUG['unique_id']) ) {
00397 $PHPCAS_DEBUG['unique_id'] = substr(strtoupper(md5(uniqid(''))),0,4);
00398 }
00399
00400 $PHPCAS_DEBUG['filename'] = $filename;
00401
00402 phpCAS::trace('START ******************');
00403 }
00404
00415 function backtrace()
00416 {
00417 if ( function_exists('debug_backtrace') ) {
00418 return debug_backtrace();
00419 } else {
00420
00421 return array();
00422 }
00423 }
00424
00432 function log($str)
00433 {
00434 $indent_str = ".";
00435 global $PHPCAS_DEBUG;
00436
00437 if ( $PHPCAS_DEBUG['filename'] ) {
00438 for ($i=0;$i<$PHPCAS_DEBUG['indent'];$i++) {
00439 $indent_str .= '| ';
00440 }
00441 error_log($PHPCAS_DEBUG['unique_id'].' '.$indent_str.$str."\n",3,$PHPCAS_DEBUG['filename']);
00442 }
00443
00444 }
00445
00454 function error($msg)
00455 {
00456 $dbg = phpCAS::backtrace();
00457 $function = '?';
00458 $file = '?';
00459 $line = '?';
00460 if ( is_array($dbg) ) {
00461 for ( $i=1; $i<sizeof($dbg); $i++) {
00462 if ( is_array($dbg[$i]) ) {
00463 if ( $dbg[$i]['class'] == __CLASS__ ) {
00464 $function = $dbg[$i]['function'];
00465 $file = $dbg[$i]['file'];
00466 $line = $dbg[$i]['line'];
00467 }
00468 }
00469 }
00470 }
00471 echo "<br />\n<b>phpCAS error</b>: <font color=\"FF0000\"><b>".__CLASS__."::".$function.'(): '.htmlentities($msg)."</b></font> in <b>".$file."</b> on line <b>".$line."</b><br />\n";
00472 phpCAS::trace($msg);
00473 phpCAS::traceExit();
00474 exit();
00475 }
00476
00480 function trace($str)
00481 {
00482 $dbg = phpCAS::backtrace();
00483 phpCAS::log($str.' ['.basename($dbg[1]['file']).':'.$dbg[1]['line'].']');
00484 }
00485
00489 function traceBegin()
00490 {
00491 global $PHPCAS_DEBUG;
00492
00493 $dbg = phpCAS::backtrace();
00494 $str = '=> ';
00495 if ( !empty($dbg[2]['class']) ) {
00496 $str .= $dbg[2]['class'].'::';
00497 }
00498 $str .= $dbg[2]['function'].'(';
00499 if ( is_array($dbg[2]['args']) ) {
00500 foreach ($dbg[2]['args'] as $index => $arg) {
00501 if ( $index != 0 ) {
00502 $str .= ', ';
00503 }
00504 $str .= str_replace("\n","",var_export($arg,TRUE));
00505 }
00506 }
00507 $str .= ') ['.basename($dbg[2]['file']).':'.$dbg[2]['line'].']';
00508 phpCAS::log($str);
00509 $PHPCAS_DEBUG['indent'] ++;
00510 }
00511
00517 function traceEnd($res='')
00518 {
00519 global $PHPCAS_DEBUG;
00520
00521 $PHPCAS_DEBUG['indent'] --;
00522 $dbg = phpCAS::backtrace();
00523 $str = '';
00524 $str .= '<= '.str_replace("\n","",var_export($res,TRUE));
00525 phpCAS::log($str);
00526 }
00527
00531 function traceExit()
00532 {
00533 global $PHPCAS_DEBUG;
00534
00535 phpCAS::log('exit()');
00536 while ( $PHPCAS_DEBUG['indent'] > 0 ) {
00537 phpCAS::log('-');
00538 $PHPCAS_DEBUG['indent'] --;
00539 }
00540 }
00541
00543
00544
00545
00559 function setLang($lang)
00560 {
00561 global $PHPCAS_CLIENT;
00562 if ( !is_object($PHPCAS_CLIENT) ) {
00563 phpCAS::error('this method should not be called before '.__CLASS__.'::client() or '.__CLASS__.'::proxy()');
00564 }
00565 if ( gettype($lang) != 'string' ) {
00566 phpCAS::error('type mismatched for parameter $lang (should be `string\')');
00567 }
00568 $PHPCAS_CLIENT->setLang($lang);
00569 }
00570
00572
00573
00574
00585 function getVersion()
00586 {
00587 return PHPCAS_VERSION;
00588 }
00589
00591
00592
00593
00604 function setHTMLHeader($header)
00605 {
00606 global $PHPCAS_CLIENT;
00607 if ( !is_object($PHPCAS_CLIENT) ) {
00608 phpCAS::error('this method should not be called before '.__CLASS__.'::client() or '.__CLASS__.'::proxy()');
00609 }
00610 if ( gettype($header) != 'string' ) {
00611 phpCAS::error('type mismatched for parameter $header (should be `string\')');
00612 }
00613 $PHPCAS_CLIENT->setHTMLHeader($header);
00614 }
00615
00621 function setHTMLFooter($footer)
00622 {
00623 global $PHPCAS_CLIENT;
00624 if ( !is_object($PHPCAS_CLIENT) ) {
00625 phpCAS::error('this method should not be called before '.__CLASS__.'::client() or '.__CLASS__.'::proxy()');
00626 }
00627 if ( gettype($footer) != 'string' ) {
00628 phpCAS::error('type mismatched for parameter $footer (should be `string\')');
00629 }
00630 $PHPCAS_CLIENT->setHTMLHeader($header);
00631 }
00632
00634
00635
00636
00649 function setPGTStorageFile($format='',
00650 $path='')
00651 {
00652 global $PHPCAS_CLIENT,$PHPCAS_AUTH_CHECK_CALL;
00653
00654 phpCAS::traceBegin();
00655 if ( !is_object($PHPCAS_CLIENT) ) {
00656 phpCAS::error('this method should only be called after '.__CLASS__.'::proxy()');
00657 }
00658 if ( !$PHPCAS_CLIENT->isProxy() ) {
00659 phpCAS::error('this method should only be called after '.__CLASS__.'::proxy()');
00660 }
00661 if ( $PHPCAS_AUTH_CHECK_CALL['done'] ) {
00662 phpCAS::error('this method should only be called before '.$PHPCAS_AUTH_CHECK_CALL['method'].'() (called at '.$PHPCAS_AUTH_CHECK_CALL['file'].':'.$PHPCAS_AUTH_CHECK_CALL['line'].')');
00663 }
00664 if ( gettype($format) != 'string' ) {
00665 phpCAS::error('type mismatched for parameter $format (should be `string\')');
00666 }
00667 if ( gettype($path) != 'string' ) {
00668 phpCAS::error('type mismatched for parameter $format (should be `string\')');
00669 }
00670 $PHPCAS_CLIENT->setPGTStorageFile($format,$path);
00671 phpCAS::traceEnd();
00672 }
00673
00689 function setPGTStorageDB($user,
00690 $password,
00691 $database_type='',
00692 $hostname='',
00693 $port=0,
00694 $database='',
00695 $table='')
00696 {
00697 global $PHPCAS_CLIENT,$PHPCAS_AUTH_CHECK_CALL;
00698
00699 phpCAS::traceBegin();
00700 if ( !is_object($PHPCAS_CLIENT) ) {
00701 phpCAS::error('this method should only be called after '.__CLASS__.'::proxy()');
00702 }
00703 if ( !$PHPCAS_CLIENT->isProxy() ) {
00704 phpCAS::error('this method should only be called after '.__CLASS__.'::proxy()');
00705 }
00706 if ( $PHPCAS_AUTH_CHECK_CALL['done'] ) {
00707 phpCAS::error('this method should only be called before '.$PHPCAS_AUTH_CHECK_CALL['method'].'() (called at '.$PHPCAS_AUTH_CHECK_CALL['file'].':'.$PHPCAS_AUTH_CHECK_CALL['line'].')');
00708 }
00709 if ( gettype($user) != 'string' ) {
00710 phpCAS::error('type mismatched for parameter $user (should be `string\')');
00711 }
00712 if ( gettype($password) != 'string' ) {
00713 phpCAS::error('type mismatched for parameter $password (should be `string\')');
00714 }
00715 if ( gettype($database_type) != 'string' ) {
00716 phpCAS::error('type mismatched for parameter $database_type (should be `string\')');
00717 }
00718 if ( gettype($hostname) != 'string' ) {
00719 phpCAS::error('type mismatched for parameter $hostname (should be `string\')');
00720 }
00721 if ( gettype($port) != 'integer' ) {
00722 phpCAS::error('type mismatched for parameter $port (should be `integer\')');
00723 }
00724 if ( gettype($database) != 'string' ) {
00725 phpCAS::error('type mismatched for parameter $database (should be `string\')');
00726 }
00727 if ( gettype($table) != 'string' ) {
00728 phpCAS::error('type mismatched for parameter $table (should be `string\')');
00729 }
00730 $PHPCAS_CLIENT->setPGTStorageDB($this,$user,$password,$hostname,$port,$database,$table);
00731 phpCAS::traceEnd();
00732 }
00733
00735
00736
00737
00756 function serviceWeb($url,&$err_code,&$output)
00757 {
00758 global $PHPCAS_CLIENT, $PHPCAS_AUTH_CHECK_CALL;
00759
00760 phpCAS::traceBegin();
00761 if ( !is_object($PHPCAS_CLIENT) ) {
00762 phpCAS::error('this method should only be called after '.__CLASS__.'::proxy()');
00763 }
00764 if ( !$PHPCAS_CLIENT->isProxy() ) {
00765 phpCAS::error('this method should only be called after '.__CLASS__.'::proxy()');
00766 }
00767 if ( !$PHPCAS_AUTH_CHECK_CALL['done'] ) {
00768 phpCAS::error('this method should only be called after the programmer is sure the user has been authenticated (by calling '.__CLASS__.'::checkAuthentication() or '.__CLASS__.'::forceAuthentication()');
00769 }
00770 if ( !$PHPCAS_AUTH_CHECK_CALL['result'] ) {
00771 phpCAS::error('authentication was checked (by '.$PHPCAS_AUTH_CHECK_CALL['method'].'() at '.$PHPCAS_AUTH_CHECK_CALL['file'].':'.$PHPCAS_AUTH_CHECK_CALL['line'].') but the method returned FALSE');
00772 }
00773 if ( gettype($url) != 'string' ) {
00774 phpCAS::error('type mismatched for parameter $url (should be `string\')');
00775 }
00776
00777 $res = $PHPCAS_CLIENT->serviceWeb($url,$err_code,$output);
00778
00779 phpCAS::traceEnd($res);
00780 return $res;
00781 }
00782
00799 function serviceMail($url,$flags,&$err_code,&$err_msg,&$pt)
00800 {
00801 global $PHPCAS_CLIENT, $PHPCAS_AUTH_CHECK_CALL;
00802
00803 phpCAS::traceBegin();
00804 if ( !is_object($PHPCAS_CLIENT) ) {
00805 phpCAS::error('this method should only be called after '.__CLASS__.'::proxy()');
00806 }
00807 if ( !$PHPCAS_CLIENT->isProxy() ) {
00808 phpCAS::error('this method should only be called after '.__CLASS__.'::proxy()');
00809 }
00810 if ( !$PHPCAS_AUTH_CHECK_CALL['done'] ) {
00811 phpCAS::error('this method should only be called after the programmer is sure the user has been authenticated (by calling '.__CLASS__.'::checkAuthentication() or '.__CLASS__.'::forceAuthentication()');
00812 }
00813 if ( !$PHPCAS_AUTH_CHECK_CALL['result'] ) {
00814 phpCAS::error('authentication was checked (by '.$PHPCAS_AUTH_CHECK_CALL['method'].'() at '.$PHPCAS_AUTH_CHECK_CALL['file'].':'.$PHPCAS_AUTH_CHECK_CALL['line'].') but the method returned FALSE');
00815 }
00816 if ( gettype($url) != 'string' ) {
00817 phpCAS::error('type mismatched for parameter $url (should be `string\')');
00818 }
00819
00820 if ( gettype($flags) != 'integer' ) {
00821 phpCAS::error('type mismatched for parameter $flags (should be `integer\')');
00822 }
00823
00824 $res = $PHPCAS_CLIENT->serviceMail($url,$flags,$err_code,$err_msg,$pt);
00825
00826 phpCAS::traceEnd($res);
00827 return $res;
00828 }
00829
00831
00832
00833
00843 function checkAuthentication()
00844 {
00845 global $PHPCAS_CLIENT, $PHPCAS_AUTH_CHECK_CALL;
00846
00847 phpCAS::traceBegin();
00848 if ( !is_object($PHPCAS_CLIENT) ) {
00849 phpCAS::error('this method should not be called before '.__CLASS__.'::client() or '.__CLASS__.'::proxy()');
00850 }
00851
00852 $auth = $PHPCAS_CLIENT->checkAuthentication();
00853
00854
00855 $dbg = phpCAS::backtrace();
00856 $PHPCAS_AUTH_CHECK_CALL = array('done' => TRUE,
00857 'file' => $dbg[0]['file'],
00858 'line' => $dbg[0]['line'],
00859 'method' => __CLASS__.'::'.__FUNCTION__,
00860 'result' => $auth );
00861 phpCAS::traceEnd($auth);
00862 return $auth;
00863 }
00864
00870 function forceAuthentication()
00871 {
00872 global $PHPCAS_CLIENT, $PHPCAS_AUTH_CHECK_CALL;
00873
00874 phpCAS::traceBegin();
00875 if ( !is_object($PHPCAS_CLIENT) ) {
00876 phpCAS::error('this method should not be called before '.__CLASS__.'::client() or '.__CLASS__.'::proxy()');
00877 }
00878
00879 $auth = $PHPCAS_CLIENT->forceAuthentication();
00880
00881
00882 $dbg = phpCAS::backtrace();
00883 $PHPCAS_AUTH_CHECK_CALL = array('done' => TRUE,
00884 'file' => $dbg[0]['file'],
00885 'line' => $dbg[0]['line'],
00886 'method' => __CLASS__.'::'.__FUNCTION__,
00887 'result' => $auth );
00888
00889 if ( !$auth ) {
00890 phpCAS::trace('user is not authenticated, redirecting to the CAS server');
00891 $PHPCAS_CLIENT->forceAuthentication();
00892 } else {
00893 phpCAS::trace('no need to authenticate (user `'.phpCAS::getUser().'\' is already authenticated)');
00894 }
00895
00896 phpCAS::traceEnd();
00897 }
00898
00902 function authenticate()
00903 {
00904 phpCAS::error('this method is deprecated. You should use '.__CLASS__.'::forceAuthentication() instead');
00905 }
00906
00910 function isAuthenticated()
00911 {
00912 phpCAS::error('this method is deprecated. You should use '.__CLASS__.'::forceAuthentication() instead');
00913 }
00914
00922 function getUser()
00923 {
00924 global $PHPCAS_CLIENT, $PHPCAS_AUTH_CHECK_CALL;
00925 if ( !is_object($PHPCAS_CLIENT) ) {
00926 phpCAS::error('this method should not be called before '.__CLASS__.'::client() or '.__CLASS__.'::proxy()');
00927 }
00928 if ( !$PHPCAS_AUTH_CHECK_CALL['done'] ) {
00929 phpCAS::error('this method should only be called after '.__CLASS__.'::forceAuthentication() or '.__CLASS__.'::isAuthenticated()');
00930 }
00931 if ( !$PHPCAS_AUTH_CHECK_CALL['result'] ) {
00932 phpCAS::error('authentication was checked (by '.$PHPCAS_AUTH_CHECK_CALL['method'].'() at '.$PHPCAS_AUTH_CHECK_CALL['file'].':'.$PHPCAS_AUTH_CHECK_CALL['line'].') but the method returned FALSE');
00933 }
00934 return $PHPCAS_CLIENT->getUser();
00935 }
00936
00943 function getServerLoginURL()
00944 {
00945 global $PHPCAS_CLIENT;
00946 if ( !is_object($PHPCAS_CLIENT) ) {
00947 phpCAS::error('this method should not be called before '.__CLASS__.'::client() or '.__CLASS__.'::proxy()');
00948 }
00949 return $PHPCAS_CLIENT->getServerLoginURL();
00950 }
00951
00958 function getServerLogoutURL()
00959 {
00960 global $PHPCAS_CLIENT;
00961 if ( !is_object($PHPCAS_CLIENT) ) {
00962 phpCAS::error('this method should not be called before '.__CLASS__.'::client() or '.__CLASS__.'::proxy()');
00963 }
00964 return $PHPCAS_CLIENT->getServerLogoutURL();
00965 }
00966
00971 function logout($url = "")
00972 {
00973 global $PHPCAS_CLIENT;
00974
00975 phpCAS::traceBegin();
00976 if ( !is_object($PHPCAS_CLIENT) ) {
00977 phpCAS::error('this method should only be called after '.__CLASS__.'::client() or'.__CLASS__.'::proxy()');
00978 }
00979 $PHPCAS_CLIENT->logout($url);
00980 // never reached
00981 phpCAS::traceEnd();
00982 }
00983
00990 function setFixedCallbackURL($url='')
00991 {
00992 global $PHPCAS_CLIENT;
00993 phpCAS::traceBegin();
00994 if ( !is_object($PHPCAS_CLIENT) ) {
00995 phpCAS::error('this method should only be called after '.__CLASS__.'::proxy()');
00996 }
00997 if ( !$PHPCAS_CLIENT->isProxy() ) {
00998 phpCAS::error('this method should only be called after '.__CLASS__.'::proxy()');
00999 }
01000 if ( gettype($url) != 'string' ) {
01001 phpCAS::error('type mismatched for parameter $url (should be `string\')');
01002 }
01003 $PHPCAS_CLIENT->setCallbackURL($url);
01004 phpCAS::traceEnd();
01005 }
01006
01013 function setFixedServiceURL($url)
01014 {
01015 global $PHPCAS_CLIENT;
01016 phpCAS::traceBegin();
01017 if ( !is_object($PHPCAS_CLIENT) ) {
01018 phpCAS::error('this method should only be called after '.__CLASS__.'::proxy()');
01019 }
01020 if ( gettype($url) != 'string' ) {
01021 phpCAS::error('type mismatched for parameter $url (should be `string\')');
01022 }
01023 $PHPCAS_CLIENT->setURL($url);
01024 phpCAS::traceEnd();
01025 }
01026
01030 function getServiceURL()
01031 {
01032 global $PHPCAS_CLIENT;
01033 if ( !is_object($PHPCAS_CLIENT) ) {
01034 phpCAS::error('this method should only be called after '.__CLASS__.'::proxy()');
01035 }
01036 return($PHPCAS_CLIENT->getURL());
01037 }
01038
01042 function retrievePT($target_service,&$err_code,&$err_msg)
01043 {
01044 global $PHPCAS_CLIENT;
01045 if ( !is_object($PHPCAS_CLIENT) ) {
01046 phpCAS::error('this method should only be called after '.__CLASS__.'::proxy()');
01047 }
01048 if ( gettype($target_service) != 'string' ) {
01049 phpCAS::error('type mismatched for parameter $target_service(should be `string\')');
01050 }
01051 return($PHPCAS_CLIENT->retrievePT($target_service,$err_code,$err_msg));
01052 }
01055 }
01056
01057
01058
01059
01060
01061
01062
01063
01073
01074
01075
01150
01151
01152
01189 ?>