ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
tickets.php File Reference

Go to the source code of this file.

Functions

 storeTicket ($ticket, $path, $value)
 
 retrieveTicket ($ticket, $path, $unlink=true)
 
 checkServiceURL ($service, array $legal_service_urls)
 

Function Documentation

◆ checkServiceURL()

checkServiceURL (   $service,
array  $legal_service_urls 
)

Definition at line 36 of file tickets.php.

References $service.

36  {
37  foreach ($legal_service_urls AS $legalurl) {
38  if (strpos($service, $legalurl) === 0) return TRUE;
39  }
40  return FALSE;
41 }
$service
Definition: login.php:15
$legal_service_urls
Definition: login.php:23

◆ retrieveTicket()

retrieveTicket (   $ticket,
  $path,
  $unlink = true 
)

Definition at line 15 of file tickets.php.

References $filename, and $path.

15  {
16 
17  if (!preg_match('/^(ST|PT|PGT)-?[a-zA-Z0-9]+$/D', $ticket)) throw new Exception('Invalid characters in ticket');
18 
19  if (!is_dir($path))
20  throw new Exception('Directory for CAS Server ticket storage [' . $path . '] does not exists. ');
21 
22  $filename = $path . '/' . $ticket;
23 
24  if (!file_exists($filename))
25  throw new Exception('Could not find ticket');
26 
27  $content = file_get_contents($filename);
28 
29  if ($unlink) {
30  unlink($filename);
31  }
32 
33  return unserialize($content);
34 }

◆ storeTicket()

storeTicket (   $ticket,
  $path,
  $value 
)

Definition at line 3 of file tickets.php.

References $filename, and $path.

3  {
4 
5  if (!is_dir($path))
6  throw new Exception('Directory for CAS Server ticket storage [' . $path . '] does not exists. ');
7 
8  if (!is_writable($path))
9  throw new Exception('Directory for CAS Server ticket storage [' . $path . '] is not writable. ');
10 
11  $filename = $path . '/' . $ticket;
12  file_put_contents($filename, serialize($value));
13 }