ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
zoneinfo_generator.php
Go to the documentation of this file.
1 <?php
2 
3  exit();
4 
5  define('ZONEINFO','/usr/share/zoneinfo');
6  define('TZ_CONVERT','tz_convert');
7  define('READLINK','readlink');
8 
9  chdir('../../..');
10 
11  include_once('include/inc.header.php');
12  include_once('Services/Calendar/classes/class.ilCalendarUtil.php');
13 
14  foreach(ilCalendarUtil::_getShortTimeZoneList() as $tz_name => $tmp)
15  {
16  $name_underscore = str_replace('/','_',$tz_name);
17 
18  if(is_link(ZONEINFO.'/'.$tz_name))
19  {
20  $name = exec(READLINK.' -f '.ZONEINFO.'/'.$tz_name);
21  }
22  else
23  {
24  $name = ZONEINFO.'/'.$tz_name;
25  }
26 
27  exec(TZ_CONVERT.' -o Services/Calendar/zoneinfo/'.$name_underscore.'.tmp'.' '.$name);
28 
29  $reader = fopen('Services/Calendar/zoneinfo/'.$name_underscore.'.tmp', 'r');
30  $writer = fopen('Services/Calendar/zoneinfo/'.$name_underscore.'.ics', 'w');
31 
32  $counter = 0;
33  while($line = fgets($reader))
34  {
35  if(++$counter < 4)
36  {
37  continue;
38  }
39  if($counter == 5)
40  {
41  fputs($writer, 'TZID='.$tz_name."\n");
42  }
43  else
44  {
45  if(substr($line,0,13) === 'END:VCALENDAR')
46  {
47  break;
48  }
49  fputs($writer, $line);
50  }
51  }
52 
53  fclose($reader);
54  fclose($writer);
55  unlink('Services/Calendar/zoneinfo/'.$name_underscore.'.tmp');
56 
57  #echo $name_underscore.' <br />';
58  }
59 
60 
61 ?>