|
@@ 368-401 (lines=34) @@
|
| 365 |
|
*
|
| 366 |
|
* @return a newly created CASClient object
|
| 367 |
|
*/
|
| 368 |
|
function client($server_version, $server_hostname, $server_port, $server_uri, $start_session = true)
|
| 369 |
|
{
|
| 370 |
|
global $PHPCAS_CLIENT, $PHPCAS_INIT_CALL;
|
| 371 |
|
|
| 372 |
|
phpCAS:: traceBegin();
|
| 373 |
|
if (is_object($PHPCAS_CLIENT)) {
|
| 374 |
|
phpCAS:: error($PHPCAS_INIT_CALL['method'] . '() has already been called (at ' . $PHPCAS_INIT_CALL['file'] . ':' . $PHPCAS_INIT_CALL['line'] . ')');
|
| 375 |
|
}
|
| 376 |
|
if (gettype($server_version) != 'string') {
|
| 377 |
|
phpCAS:: error('type mismatched for parameter $server_version (should be `string\')');
|
| 378 |
|
}
|
| 379 |
|
if (gettype($server_hostname) != 'string') {
|
| 380 |
|
phpCAS:: error('type mismatched for parameter $server_hostname (should be `string\')');
|
| 381 |
|
}
|
| 382 |
|
if (gettype($server_port) != 'integer') {
|
| 383 |
|
phpCAS:: error('type mismatched for parameter $server_port (should be `integer\')');
|
| 384 |
|
}
|
| 385 |
|
if (gettype($server_uri) != 'string') {
|
| 386 |
|
phpCAS:: error('type mismatched for parameter $server_uri (should be `string\')');
|
| 387 |
|
}
|
| 388 |
|
|
| 389 |
|
// store where the initializer is called from
|
| 390 |
|
$dbg = phpCAS:: backtrace();
|
| 391 |
|
$PHPCAS_INIT_CALL = array(
|
| 392 |
|
'done' => true,
|
| 393 |
|
'file' => $dbg[0]['file'],
|
| 394 |
|
'line' => $dbg[0]['line'],
|
| 395 |
|
'method' => __CLASS__ . '::' . __FUNCTION__
|
| 396 |
|
);
|
| 397 |
|
|
| 398 |
|
// initialize the global object $PHPCAS_CLIENT
|
| 399 |
|
$PHPCAS_CLIENT = new CASClient($server_version, false /*proxy*/
|
| 400 |
|
, $server_hostname, $server_port, $server_uri, $start_session);
|
| 401 |
|
phpCAS:: traceEnd();
|
| 402 |
|
}
|
| 403 |
|
|
| 404 |
|
/**
|
|
@@ 418-451 (lines=34) @@
|
| 415 |
|
*
|
| 416 |
|
* @return a newly created CASClient object
|
| 417 |
|
*/
|
| 418 |
|
function proxy($server_version, $server_hostname, $server_port, $server_uri, $start_session = true)
|
| 419 |
|
{
|
| 420 |
|
global $PHPCAS_CLIENT, $PHPCAS_INIT_CALL;
|
| 421 |
|
|
| 422 |
|
phpCAS:: traceBegin();
|
| 423 |
|
if (is_object($PHPCAS_CLIENT)) {
|
| 424 |
|
phpCAS:: error($PHPCAS_INIT_CALL['method'] . '() has already been called (at ' . $PHPCAS_INIT_CALL['file'] . ':' . $PHPCAS_INIT_CALL['line'] . ')');
|
| 425 |
|
}
|
| 426 |
|
if (gettype($server_version) != 'string') {
|
| 427 |
|
phpCAS:: error('type mismatched for parameter $server_version (should be `string\')');
|
| 428 |
|
}
|
| 429 |
|
if (gettype($server_hostname) != 'string') {
|
| 430 |
|
phpCAS:: error('type mismatched for parameter $server_hostname (should be `string\')');
|
| 431 |
|
}
|
| 432 |
|
if (gettype($server_port) != 'integer') {
|
| 433 |
|
phpCAS:: error('type mismatched for parameter $server_port (should be `integer\')');
|
| 434 |
|
}
|
| 435 |
|
if (gettype($server_uri) != 'string') {
|
| 436 |
|
phpCAS:: error('type mismatched for parameter $server_uri (should be `string\')');
|
| 437 |
|
}
|
| 438 |
|
|
| 439 |
|
// store where the initialzer is called from
|
| 440 |
|
$dbg = phpCAS:: backtrace();
|
| 441 |
|
$PHPCAS_INIT_CALL = array(
|
| 442 |
|
'done' => true,
|
| 443 |
|
'file' => $dbg[0]['file'],
|
| 444 |
|
'line' => $dbg[0]['line'],
|
| 445 |
|
'method' => __CLASS__ . '::' . __FUNCTION__
|
| 446 |
|
);
|
| 447 |
|
|
| 448 |
|
// initialize the global object $PHPCAS_CLIENT
|
| 449 |
|
$PHPCAS_CLIENT = new CASClient($server_version, true /*proxy*/
|
| 450 |
|
, $server_hostname, $server_port, $server_uri, $start_session);
|
| 451 |
|
phpCAS:: traceEnd();
|
| 452 |
|
}
|
| 453 |
|
|
| 454 |
|
/** @} */
|