0337d704 |
1 | <?php |
2 | /*************************************************************************** |
3 | * Copyright (C) 2003-2004 Polytechnique.org * |
4 | * http://opensource.polytechnique.org/ * |
5 | * * |
6 | * This program is free software; you can redistribute it and/or modify * |
7 | * it under the terms of the GNU General Public License as published by * |
8 | * the Free Software Foundation; either version 2 of the License, or * |
9 | * (at your option) any later version. * |
10 | * * |
11 | * This program is distributed in the hope that it will be useful, * |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
14 | * GNU General Public License for more details. * |
15 | * * |
16 | * You should have received a copy of the GNU General Public License * |
17 | * along with this program; if not, write to the Free Software * |
18 | * Foundation, Inc., * |
19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * |
20 | ***************************************************************************/ |
21 | |
22 | require_once("xorg.inc.php"); |
23 | new_skinned_page('evenements.tpl', AUTH_MDP); |
24 | |
25 | $titre = Post::get('titre'); |
26 | $texte = Post::get('texte'); |
27 | $promo_min = Post::getInt('promo_min'); |
28 | $promo_max = Post::getInt('promo_max'); |
29 | $peremption = Post::getInt('peremption'); |
30 | $validation_message = Post::get('validation_message'); |
31 | $action = Post::get('action'); |
32 | |
33 | $page->assign('titre', $titre); |
34 | $page->assign('texte', $texte); |
35 | $page->assign('promo_min', $promo_min); |
36 | $page->assign('promo_max', $promo_max); |
37 | $page->assign('peremption', $peremption); |
38 | $page->assign('validation_message', $validation_message); |
39 | $page->assign('action', strtolower($action)); |
40 | |
41 | if ($action=="Confirmer") { |
42 | $texte = preg_replace( "/((http|ftp)+(s)?:\/\/[^<>\s]+)/i", "<a href=\"\\0\">\\0</a>", $texte ); |
43 | $texte = preg_replace( "/([^,\s]+@[^,\s]+)/i", "<a href=\"mailto:\\0\">\\0</a>", $texte ); |
44 | require_once("validations.inc.php"); |
45 | $evtreq = new evtreq($titre, $texte, $promo_min, $promo_max, |
46 | $peremption, $validation_message, Session::getInt('uid')); |
47 | $evtreq->submit(); |
48 | $page->assign('ok', true); |
49 | } |
50 | |
51 | $select = ""; |
52 | for ($i = 1 ; $i < 30 ; $i++) { |
53 | $p_stamp=date("Ymd",time()+3600*24*$i); |
54 | $year=substr($p_stamp,0,4); |
55 | $month=substr($p_stamp,4,2); |
56 | $day=substr($p_stamp,6,2); |
57 | |
58 | $select .= "<option value=\"$p_stamp\"" . (($p_stamp == strtr($peremption, array("-" => ""))) ? " selected" : "")."> $day / $month / $year</option>\n"; |
59 | } |
60 | $page->assign('select',$select); |
61 | $page->run(); |
62 | |
63 | ?> |