ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
CAS.php
Go to the documentation of this file.
1 <?php
2 
3 #error_reporting(E_ALL ^ E_NOTICE);
4 
5 //
6 // hack by Vangelis Haniotakis to handle the absence of $_SERVER['REQUEST_URI'] in IIS
7 //
8 if (!$_SERVER['REQUEST_URI']) {
9  $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'].'?'.$_SERVER['QUERY_STRING'];
10 }
11 
12 //
13 // another one by Vangelis Haniotakis also to make phpCAS work with PHP5
14 //
15 if (version_compare(PHP_VERSION,'5','>=')) {
16  //require_once(dirname(__FILE__).'/domxml-php4-php5.php');
17 }
18 
26 // ########################################################################
27 // CONSTANTS
28 // ########################################################################
29 
30 // ------------------------------------------------------------------------
31 // CAS VERSIONS
32 // ------------------------------------------------------------------------
33 
37 define('PHPCAS_VERSION','0.4.20-1');
38 
39 // ------------------------------------------------------------------------
40 // CAS VERSIONS
41 // ------------------------------------------------------------------------
50 define("CAS_VERSION_1_0",'1.0');
54 define("CAS_VERSION_2_0",'2.0');
55 
61 // ------------------------------------------------------------------------
62 // FILE PGT STORAGE
63 // ------------------------------------------------------------------------
67 define("CAS_PGT_STORAGE_FILE_DEFAULT_PATH",'/tmp');
71 define("CAS_PGT_STORAGE_FILE_FORMAT_PLAIN",'plain');
75 define("CAS_PGT_STORAGE_FILE_FORMAT_XML",'xml');
79 define("CAS_PGT_STORAGE_FILE_DEFAULT_FORMAT",CAS_PGT_STORAGE_FILE_FORMAT_PLAIN);
80 // ------------------------------------------------------------------------
81 // DATABASE PGT STORAGE
82 // ------------------------------------------------------------------------
86 define("CAS_PGT_STORAGE_DB_DEFAULT_DATABASE_TYPE",'mysql');
90 define("CAS_PGT_STORAGE_DB_DEFAULT_HOSTNAME",'localhost');
94 define("CAS_PGT_STORAGE_DB_DEFAULT_PORT",'');
98 define("CAS_PGT_STORAGE_DB_DEFAULT_DATABASE",'phpCAS');
102 define("CAS_PGT_STORAGE_DB_DEFAULT_TABLE",'pgt');
103 
105 // ------------------------------------------------------------------------
106 // SERVICE ACCESS ERRORS
107 // ------------------------------------------------------------------------
116 define("PHPCAS_SERVICE_OK",0);
121 define("PHPCAS_SERVICE_PT_NO_SERVER_RESPONSE",1);
126 define("PHPCAS_SERVICE_PT_BAD_SERVER_RESPONSE",2);
131 define("PHPCAS_SERVICE_PT_FAILURE",3);
135 define("PHPCAS_SERVICE_NOT AVAILABLE",4);
136 
138 // ------------------------------------------------------------------------
139 // LANGUAGES
140 // ------------------------------------------------------------------------
146 define("PHPCAS_LANG_ENGLISH", 'english');
147 define("PHPCAS_LANG_FRENCH", 'french');
148 define("PHPCAS_LANG_GREEK", 'greek');
149 
160 define("PHPCAS_LANG_DEFAULT", PHPCAS_LANG_ENGLISH);
161 
163 // ------------------------------------------------------------------------
164 // MISC
165 // ------------------------------------------------------------------------
177 
184 $PHPCAS_INIT_CALL = array('done' => FALSE,
185  'file' => '?',
186  'line' => -1,
187  'method' => '?');
188 
195 $PHPCAS_AUTH_CHECK_CALL = array('done' => FALSE,
196  'file' => '?',
197  'line' => -1,
198  'method' => '?',
199  'result' => FALSE);
200 
206 $PHPCAS_DEBUG = array('filename' => FALSE,
207  'indent' => 0,
208  'unique_id' => '');
209 
212 // ########################################################################
213 // CLIENT CLASS
214 // ########################################################################
215 
216 // include client class
217 if (version_compare(PHP_VERSION,'5','>='))
218 {
219  include_once(dirname(__FILE__).'/client.php');
220 }
221 else
222 {
223  include_once(dirname(__FILE__).'/client4.php');
224 }
225 
226 // ########################################################################
227 // INTERFACE CLASS
228 // ########################################################################
229 
244 class phpCAS
245 {
246 
247  // ########################################################################
248  // INITIALIZATION
249  // ########################################################################
250 
270  function client($server_version,
271  $server_hostname,
272  $server_port,
273  $server_uri,
274  $start_session = true)
275  {
277 
278  phpCAS::traceBegin();
279  if ( is_object($PHPCAS_CLIENT) ) {
280  phpCAS::error($PHPCAS_INIT_CALL['method'].'() has already been called (at '.$PHPCAS_INIT_CALL['file'].':'.$PHPCAS_INIT_CALL['line'].')');
281  }
282  if ( gettype($server_version) != 'string' ) {
283  phpCAS::error('type mismatched for parameter $server_version (should be `string\')');
284  }
285  if ( gettype($server_hostname) != 'string' ) {
286  phpCAS::error('type mismatched for parameter $server_hostname (should be `string\')');
287  }
288  if ( gettype($server_port) != 'integer' ) {
289  phpCAS::error('type mismatched for parameter $server_port (should be `integer\')');
290  }
291  if ( gettype($server_uri) != 'string' ) {
292  phpCAS::error('type mismatched for parameter $server_uri (should be `string\')');
293  }
294 
295  // store where the initialzer is called from
296  $dbg = phpCAS::backtrace();
297  $PHPCAS_INIT_CALL = array('done' => TRUE,
298  'file' => $dbg[0]['file'],
299  'line' => $dbg[0]['line'],
300  'method' => __CLASS__.'::'.__FUNCTION__);
301 
302  // initialize the global object $PHPCAS_CLIENT
303  $PHPCAS_CLIENT = new CASClient($server_version,FALSE/*proxy*/,$server_hostname,$server_port,$server_uri,$start_session);
304  phpCAS::traceEnd();
305  }
306 
321  function proxy($server_version,
322  $server_hostname,
323  $server_port,
324  $server_uri,
325  $start_session = true)
326  {
328 
329  phpCAS::traceBegin();
330  if ( is_object($PHPCAS_CLIENT) ) {
331  phpCAS::error($PHPCAS_INIT_CALL['method'].'() has already been called (at '.$PHPCAS_INIT_CALL['file'].':'.$PHPCAS_INIT_CALL['line'].')');
332  }
333  if ( gettype($server_version) != 'string' ) {
334  phpCAS::error('type mismatched for parameter $server_version (should be `string\')');
335  }
336  if ( gettype($server_hostname) != 'string' ) {
337  phpCAS::error('type mismatched for parameter $server_hostname (should be `string\')');
338  }
339  if ( gettype($server_port) != 'integer' ) {
340  phpCAS::error('type mismatched for parameter $server_port (should be `integer\')');
341  }
342  if ( gettype($server_uri) != 'string' ) {
343  phpCAS::error('type mismatched for parameter $server_uri (should be `string\')');
344  }
345 
346  // store where the initialzer is called from
347  $dbg = phpCAS::backtrace();
348  $PHPCAS_INIT_CALL = array('done' => TRUE,
349  'file' => $dbg[0]['file'],
350  'line' => $dbg[0]['line'],
351  'method' => __CLASS__.'::'.__FUNCTION__);
352 
353  // initialize the global object $PHPCAS_CLIENT
354  $PHPCAS_CLIENT = new CASClient($server_version,TRUE/*proxy*/,$server_hostname,$server_port,$server_uri,$start_session);
355  phpCAS::traceEnd();
356  }
357 
359  // ########################################################################
360  // DEBUGGING
361  // ########################################################################
362 
373  function setDebug($filename='')
374  {
375  global $PHPCAS_DEBUG;
376 
377  if ( $filename != FALSE && gettype($filename) != 'string' ) {
378  phpCAS::error('type mismatched for parameter $dbg (should be FALSE or the name of the log file)');
379  }
380 
381  if ( empty($filename) ) {
382  if ( preg_match('/^Win.*/',getenv('OS')) ) {
383  if ( isset($_ENV['TMP']) ) {
384  $debugDir = $_ENV['TMP'].'/';
385  } else if ( isset($_ENV['TEMP']) ) {
386  $debugDir = $_ENV['TEMP'].'/';
387  } else {
388  $debugDir = '';
389  }
390  } else {
391  $debugDir = '/tmp/';
392  }
393  $filename = $debugDir . 'phpCAS.log';
394  }
395 
396  if ( empty($PHPCAS_DEBUG['unique_id']) ) {
397  $PHPCAS_DEBUG['unique_id'] = substr(strtoupper(md5(uniqid(''))),0,4);
398  }
399 
400  $PHPCAS_DEBUG['filename'] = $filename;
401 
402  phpCAS::trace('START ******************');
403  }
404 
415  function backtrace()
416  {
417  if ( function_exists('debug_backtrace') ) {
418  return debug_backtrace();
419  } else {
420  // poor man's hack ... but it does work ...
421  return array();
422  }
423  }
424 
432  function log($str)
433  {
434  $indent_str = ".";
435  global $PHPCAS_DEBUG;
436 
437  if ( $PHPCAS_DEBUG['filename'] ) {
438  for ($i=0;$i<$PHPCAS_DEBUG['indent'];$i++) {
439  $indent_str .= '| ';
440  }
441  error_log($PHPCAS_DEBUG['unique_id'].' '.$indent_str.$str."\n",3,$PHPCAS_DEBUG['filename']);
442  }
443 
444  }
445 
454  function error($msg)
455  {
456  $dbg = phpCAS::backtrace();
457  $function = '?';
458  $file = '?';
459  $line = '?';
460  if ( is_array($dbg) ) {
461  for ( $i=1; $i<sizeof($dbg); $i++) {
462  if ( is_array($dbg[$i]) ) {
463  if ( $dbg[$i]['class'] == __CLASS__ ) {
464  $function = $dbg[$i]['function'];
465  $file = $dbg[$i]['file'];
466  $line = $dbg[$i]['line'];
467  }
468  }
469  }
470  }
471  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";
472  phpCAS::trace($msg);
473  phpCAS::traceExit();
474  exit();
475  }
476 
480  function trace($str)
481  {
482  $dbg = phpCAS::backtrace();
483  phpCAS::log($str.' ['.basename($dbg[1]['file']).':'.$dbg[1]['line'].']');
484  }
485 
489  function traceBegin()
490  {
491  global $PHPCAS_DEBUG;
492 
493  $dbg = phpCAS::backtrace();
494  $str = '=> ';
495  if ( !empty($dbg[2]['class']) ) {
496  $str .= $dbg[2]['class'].'::';
497  }
498  $str .= $dbg[2]['function'].'(';
499  if ( is_array($dbg[2]['args']) ) {
500  foreach ($dbg[2]['args'] as $index => $arg) {
501  if ( $index != 0 ) {
502  $str .= ', ';
503  }
504  $str .= str_replace("\n","",var_export($arg,TRUE));
505  }
506  }
507  $str .= ') ['.basename($dbg[2]['file']).':'.$dbg[2]['line'].']';
508  phpCAS::log($str);
509  $PHPCAS_DEBUG['indent'] ++;
510  }
511 
517  function traceEnd($res='')
518  {
519  global $PHPCAS_DEBUG;
520 
521  $PHPCAS_DEBUG['indent'] --;
522  $dbg = phpCAS::backtrace();
523  $str = '';
524  $str .= '<= '.str_replace("\n","",var_export($res,TRUE));
525  phpCAS::log($str);
526  }
527 
531  function traceExit()
532  {
533  global $PHPCAS_DEBUG;
534 
535  phpCAS::log('exit()');
536  while ( $PHPCAS_DEBUG['indent'] > 0 ) {
537  phpCAS::log('-');
538  $PHPCAS_DEBUG['indent'] --;
539  }
540  }
541 
543  // ########################################################################
544  // INTERNATIONALIZATION
545  // ########################################################################
559  function setLang($lang)
560  {
561  global $PHPCAS_CLIENT;
562  if ( !is_object($PHPCAS_CLIENT) ) {
563  phpCAS::error('this method should not be called before '.__CLASS__.'::client() or '.__CLASS__.'::proxy()');
564  }
565  if ( gettype($lang) != 'string' ) {
566  phpCAS::error('type mismatched for parameter $lang (should be `string\')');
567  }
568  $PHPCAS_CLIENT->setLang($lang);
569  }
570 
572  // ########################################################################
573  // VERSION
574  // ########################################################################
585  function getVersion()
586  {
587  return PHPCAS_VERSION;
588  }
589 
591  // ########################################################################
592  // HTML OUTPUT
593  // ########################################################################
604  function setHTMLHeader($header)
605  {
606  global $PHPCAS_CLIENT;
607  if ( !is_object($PHPCAS_CLIENT) ) {
608  phpCAS::error('this method should not be called before '.__CLASS__.'::client() or '.__CLASS__.'::proxy()');
609  }
610  if ( gettype($header) != 'string' ) {
611  phpCAS::error('type mismatched for parameter $header (should be `string\')');
612  }
613  $PHPCAS_CLIENT->setHTMLHeader($header);
614  }
615 
621  function setHTMLFooter($footer)
622  {
623  global $PHPCAS_CLIENT;
624  if ( !is_object($PHPCAS_CLIENT) ) {
625  phpCAS::error('this method should not be called before '.__CLASS__.'::client() or '.__CLASS__.'::proxy()');
626  }
627  if ( gettype($footer) != 'string' ) {
628  phpCAS::error('type mismatched for parameter $footer (should be `string\')');
629  }
630  $PHPCAS_CLIENT->setHTMLHeader($header);
631  }
632 
634  // ########################################################################
635  // PGT STORAGE
636  // ########################################################################
649  function setPGTStorageFile($format='',
650  $path='')
651  {
653 
654  phpCAS::traceBegin();
655  if ( !is_object($PHPCAS_CLIENT) ) {
656  phpCAS::error('this method should only be called after '.__CLASS__.'::proxy()');
657  }
658  if ( !$PHPCAS_CLIENT->isProxy() ) {
659  phpCAS::error('this method should only be called after '.__CLASS__.'::proxy()');
660  }
661  if ( $PHPCAS_AUTH_CHECK_CALL['done'] ) {
662  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'].')');
663  }
664  if ( gettype($format) != 'string' ) {
665  phpCAS::error('type mismatched for parameter $format (should be `string\')');
666  }
667  if ( gettype($path) != 'string' ) {
668  phpCAS::error('type mismatched for parameter $format (should be `string\')');
669  }
670  $PHPCAS_CLIENT->setPGTStorageFile($format,$path);
671  phpCAS::traceEnd();
672  }
673 
689  function setPGTStorageDB($user,
690  $password,
691  $database_type='',
692  $hostname='',
693  $port=0,
694  $database='',
695  $table='')
696  {
698 
699  phpCAS::traceBegin();
700  if ( !is_object($PHPCAS_CLIENT) ) {
701  phpCAS::error('this method should only be called after '.__CLASS__.'::proxy()');
702  }
703  if ( !$PHPCAS_CLIENT->isProxy() ) {
704  phpCAS::error('this method should only be called after '.__CLASS__.'::proxy()');
705  }
706  if ( $PHPCAS_AUTH_CHECK_CALL['done'] ) {
707  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'].')');
708  }
709  if ( gettype($user) != 'string' ) {
710  phpCAS::error('type mismatched for parameter $user (should be `string\')');
711  }
712  if ( gettype($password) != 'string' ) {
713  phpCAS::error('type mismatched for parameter $password (should be `string\')');
714  }
715  if ( gettype($database_type) != 'string' ) {
716  phpCAS::error('type mismatched for parameter $database_type (should be `string\')');
717  }
718  if ( gettype($hostname) != 'string' ) {
719  phpCAS::error('type mismatched for parameter $hostname (should be `string\')');
720  }
721  if ( gettype($port) != 'integer' ) {
722  phpCAS::error('type mismatched for parameter $port (should be `integer\')');
723  }
724  if ( gettype($database) != 'string' ) {
725  phpCAS::error('type mismatched for parameter $database (should be `string\')');
726  }
727  if ( gettype($table) != 'string' ) {
728  phpCAS::error('type mismatched for parameter $table (should be `string\')');
729  }
730  $PHPCAS_CLIENT->setPGTStorageDB($this,$user,$password,$hostname,$port,$database,$table);
731  phpCAS::traceEnd();
732  }
733 
735  // ########################################################################
736  // ACCESS TO EXTERNAL SERVICES
737  // ########################################################################
756  function serviceWeb($url,&$err_code,&$output)
757  {
759 
760  phpCAS::traceBegin();
761  if ( !is_object($PHPCAS_CLIENT) ) {
762  phpCAS::error('this method should only be called after '.__CLASS__.'::proxy()');
763  }
764  if ( !$PHPCAS_CLIENT->isProxy() ) {
765  phpCAS::error('this method should only be called after '.__CLASS__.'::proxy()');
766  }
767  if ( !$PHPCAS_AUTH_CHECK_CALL['done'] ) {
768  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()');
769  }
770  if ( !$PHPCAS_AUTH_CHECK_CALL['result'] ) {
771  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');
772  }
773  if ( gettype($url) != 'string' ) {
774  phpCAS::error('type mismatched for parameter $url (should be `string\')');
775  }
776 
777  $res = $PHPCAS_CLIENT->serviceWeb($url,$err_code,$output);
778 
779  phpCAS::traceEnd($res);
780  return $res;
781  }
782 
799  function serviceMail($url,$flags,&$err_code,&$err_msg,&$pt)
800  {
802 
803  phpCAS::traceBegin();
804  if ( !is_object($PHPCAS_CLIENT) ) {
805  phpCAS::error('this method should only be called after '.__CLASS__.'::proxy()');
806  }
807  if ( !$PHPCAS_CLIENT->isProxy() ) {
808  phpCAS::error('this method should only be called after '.__CLASS__.'::proxy()');
809  }
810  if ( !$PHPCAS_AUTH_CHECK_CALL['done'] ) {
811  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()');
812  }
813  if ( !$PHPCAS_AUTH_CHECK_CALL['result'] ) {
814  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');
815  }
816  if ( gettype($url) != 'string' ) {
817  phpCAS::error('type mismatched for parameter $url (should be `string\')');
818  }
819 
820  if ( gettype($flags) != 'integer' ) {
821  phpCAS::error('type mismatched for parameter $flags (should be `integer\')');
822  }
823 
824  $res = $PHPCAS_CLIENT->serviceMail($url,$flags,$err_code,$err_msg,$pt);
825 
826  phpCAS::traceEnd($res);
827  return $res;
828  }
829 
831  // ########################################################################
832  // AUTHENTICATION
833  // ########################################################################
843  function checkAuthentication()
844  {
846 
847  phpCAS::traceBegin();
848  if ( !is_object($PHPCAS_CLIENT) ) {
849  phpCAS::error('this method should not be called before '.__CLASS__.'::client() or '.__CLASS__.'::proxy()');
850  }
851 
852  $auth = $PHPCAS_CLIENT->checkAuthentication();
853 
854  // store where the authentication has been checked and the result
855  $dbg = phpCAS::backtrace();
856  $PHPCAS_AUTH_CHECK_CALL = array('done' => TRUE,
857  'file' => $dbg[0]['file'],
858  'line' => $dbg[0]['line'],
859  'method' => __CLASS__.'::'.__FUNCTION__,
860  'result' => $auth );
861  phpCAS::traceEnd($auth);
862  return $auth;
863  }
864 
870  function forceAuthentication()
871  {
873 
874  phpCAS::traceBegin();
875  if ( !is_object($PHPCAS_CLIENT) ) {
876  phpCAS::error('this method should not be called before '.__CLASS__.'::client() or '.__CLASS__.'::proxy()');
877  }
878 
879  $auth = $PHPCAS_CLIENT->forceAuthentication();
880 
881  // store where the authentication has been checked and the result
882  $dbg = phpCAS::backtrace();
883  $PHPCAS_AUTH_CHECK_CALL = array('done' => TRUE,
884  'file' => $dbg[0]['file'],
885  'line' => $dbg[0]['line'],
886  'method' => __CLASS__.'::'.__FUNCTION__,
887  'result' => $auth );
888 
889  if ( !$auth ) {
890  phpCAS::trace('user is not authenticated, redirecting to the CAS server');
891  $PHPCAS_CLIENT->forceAuthentication();
892  } else {
893  phpCAS::trace('no need to authenticate (user `'.phpCAS::getUser().'\' is already authenticated)');
894  }
895 
896  phpCAS::traceEnd();
897  }
898 
902  function authenticate()
903  {
904  phpCAS::error('this method is deprecated. You should use '.__CLASS__.'::forceAuthentication() instead');
905  }
906 
910  function isAuthenticated()
911  {
912  phpCAS::error('this method is deprecated. You should use '.__CLASS__.'::forceAuthentication() instead');
913  }
914 
922  function getUser()
923  {
925  if ( !is_object($PHPCAS_CLIENT) ) {
926  phpCAS::error('this method should not be called before '.__CLASS__.'::client() or '.__CLASS__.'::proxy()');
927  }
928  if ( !$PHPCAS_AUTH_CHECK_CALL['done'] ) {
929  phpCAS::error('this method should only be called after '.__CLASS__.'::forceAuthentication() or '.__CLASS__.'::isAuthenticated()');
930  }
931  if ( !$PHPCAS_AUTH_CHECK_CALL['result'] ) {
932  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');
933  }
934  return $PHPCAS_CLIENT->getUser();
935  }
936 
943  function getServerLoginURL()
944  {
945  global $PHPCAS_CLIENT;
946  if ( !is_object($PHPCAS_CLIENT) ) {
947  phpCAS::error('this method should not be called before '.__CLASS__.'::client() or '.__CLASS__.'::proxy()');
948  }
949  return $PHPCAS_CLIENT->getServerLoginURL();
950  }
951 
958  function getServerLogoutURL()
959  {
960  global $PHPCAS_CLIENT;
961  if ( !is_object($PHPCAS_CLIENT) ) {
962  phpCAS::error('this method should not be called before '.__CLASS__.'::client() or '.__CLASS__.'::proxy()');
963  }
964  return $PHPCAS_CLIENT->getServerLogoutURL();
965  }
966 
971  function logout($url = "")
972  {
973  global $PHPCAS_CLIENT;
974 
975  phpCAS::traceBegin();
976  if ( !is_object($PHPCAS_CLIENT) ) {
977  phpCAS::error('this method should only be called after '.__CLASS__.'::client() or'.__CLASS__.'::proxy()');
978  }
979  $PHPCAS_CLIENT->logout($url);
980  // never reached
981  phpCAS::traceEnd();
982  }
983 
990  function setFixedCallbackURL($url='')
991  {
992  global $PHPCAS_CLIENT;
993  phpCAS::traceBegin();
994  if ( !is_object($PHPCAS_CLIENT) ) {
995  phpCAS::error('this method should only be called after '.__CLASS__.'::proxy()');
996  }
997  if ( !$PHPCAS_CLIENT->isProxy() ) {
998  phpCAS::error('this method should only be called after '.__CLASS__.'::proxy()');
999  }
1000  if ( gettype($url) != 'string' ) {
1001  phpCAS::error('type mismatched for parameter $url (should be `string\')');
1002  }
1003  $PHPCAS_CLIENT->setCallbackURL($url);
1004  phpCAS::traceEnd();
1005  }
1006 
1013  function setFixedServiceURL($url)
1014  {
1015  global $PHPCAS_CLIENT;
1016  phpCAS::traceBegin();
1017  if ( !is_object($PHPCAS_CLIENT) ) {
1018  phpCAS::error('this method should only be called after '.__CLASS__.'::proxy()');
1019  }
1020  if ( gettype($url) != 'string' ) {
1021  phpCAS::error('type mismatched for parameter $url (should be `string\')');
1022  }
1023  $PHPCAS_CLIENT->setURL($url);
1024  phpCAS::traceEnd();
1025  }
1026 
1030  function getServiceURL()
1031  {
1032  global $PHPCAS_CLIENT;
1033  if ( !is_object($PHPCAS_CLIENT) ) {
1034  phpCAS::error('this method should only be called after '.__CLASS__.'::proxy()');
1035  }
1036  return($PHPCAS_CLIENT->getURL());
1037  }
1038 
1042  function retrievePT($target_service,&$err_code,&$err_msg)
1043  {
1044  global $PHPCAS_CLIENT;
1045  if ( !is_object($PHPCAS_CLIENT) ) {
1046  phpCAS::error('this method should only be called after '.__CLASS__.'::proxy()');
1047  }
1048  if ( gettype($target_service) != 'string' ) {
1049  phpCAS::error('type mismatched for parameter $target_service(should be `string\')');
1050  }
1051  return($PHPCAS_CLIENT->retrievePT($target_service,$err_code,$err_msg));
1052  }
1055 }
1056 
1057 // ########################################################################
1058 // DOCUMENTATION
1059 // ########################################################################
1060 
1061 // ########################################################################
1062 // MAIN PAGE
1063 
1073 // ########################################################################
1074 // MODULES DEFINITION
1075 
1150 // ########################################################################
1151 // EXAMPLES
1152 
1189 ?>