1 | <?php |
---|
2 | /**************************************************************************\ |
---|
3 | * eGroupWare * |
---|
4 | * http://www.egroupware.org * |
---|
5 | * Written by Mark Peters <skeeter@phpgroupware.org> * |
---|
6 | * -------------------------------------------- * |
---|
7 | * This program is free software; you can redistribute it and/or modify it * |
---|
8 | * under the terms of the GNU General Public License as published by the * |
---|
9 | * Free Software Foundation; either version 2 of the License, or (at your * |
---|
10 | * option) any later version. * |
---|
11 | \**************************************************************************/ |
---|
12 | |
---|
13 | $send_back_to = str_replace('submit','admin',$_SERVER['HTTP_REFERER']); |
---|
14 | if(!$_POST['locale']) |
---|
15 | { |
---|
16 | Header('Location: '.$send_back_to); |
---|
17 | } |
---|
18 | |
---|
19 | $send_back_to = str_replace('&locale='.$_POST['locale'],'',$send_back_to); |
---|
20 | $file = './holidays.'.$_POST['locale'].'.csv'; |
---|
21 | if(!file_exists($file)) |
---|
22 | { |
---|
23 | if (count($_POST['name'])) |
---|
24 | { |
---|
25 | $c_holidays = count($_POST['name']); |
---|
26 | $fp = fopen($file,'w'); |
---|
27 | for($i=0;$i<$c_holidays;++$i) |
---|
28 | { |
---|
29 | fwrite($fp,$_POST['locale']."\t".$_POST['name'][$i]."\t".$_POST['day'][$i]."\t".$_POST['month'][$i]."\t".$_POST['occurence'][$i]."\t".$_POST['dow'][$i]."\t".$_POST['observance'][$i]."\n"); |
---|
30 | } |
---|
31 | fclose($fp); |
---|
32 | } |
---|
33 | Header('Location: '.$send_back_to); |
---|
34 | } |
---|
35 | else |
---|
36 | { |
---|
37 | ?> |
---|
38 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
---|
39 | <html> |
---|
40 | <head> |
---|
41 | <title>eGroupWare.org: There is already a holiday-file for '<?php echo $_POST['locale']; ?>' !!!</title> |
---|
42 | </head> |
---|
43 | <body> |
---|
44 | <h1>There is already a holiday-file for '<?php echo $_POST['locale']; ?>' !!!</h1> |
---|
45 | |
---|
46 | <p>If you think your version of the holidays for '<?php echo $_POST['locale']; ?>' should replace |
---|
47 | the existing one, please <a href="<?php echo $_SERVER['HTTP_REFERER']; ?>&download=1">download</a> the file |
---|
48 | and <a href="mailto:egroupware-developers@lists.sourceforge.net">mail it</a> to us.</p> |
---|
49 | |
---|
50 | <p>To get back to your own eGroupWare-install <a href="<?php echo $send_back_to; ?>">click here</a>.</p> |
---|
51 | </body> |
---|
52 | </html> |
---|
53 | <?php |
---|
54 | } |
---|
55 | ?> |
---|