A start for a new change_password master plugin. This is not finished
[squirrelmail.git] / plugins / calendar / event_delete.php
CommitLineData
d61a01d4 1<?php
7c67a5e8 2
3/**
4 * event_delete.php
5 *
76911253 6 * Copyright (c) 2002-2003 The SquirrelMail Project Team
7c67a5e8 7 * Licensed under the GNU GPL. For full terms see the file COPYING.
d61a01d4 8 *
7c67a5e8 9 * Originally contrubuted by Michal Szczotka <michal@tuxy.org>
d61a01d4 10 *
7c67a5e8 11 * Functions to delete a event.
d61a01d4 12 *
2c85de8f 13 * $Id$
ea5f4b8e 14 * @package plugins
15 * @subpackage calendar
16 */
17
18/**
19 * @ignore
d61a01d4 20 */
92219031 21define('SM_PATH','../../');
cf1efdce 22
8d6a115b 23/* Calender plugin required files. */
24require_once(SM_PATH . 'plugins/calendar/calendar_data.php');
25require_once(SM_PATH . 'plugins/calendar/functions.php');
26
cf1efdce 27/* SquirrelMail required files. */
28require_once(SM_PATH . 'include/validate.php');
29require_once(SM_PATH . 'functions/strings.php');
30require_once(SM_PATH . 'functions/date.php');
31require_once(SM_PATH . 'config/config.php');
32require_once(SM_PATH . 'functions/page_header.php');
aa7fb30c 33require_once(SM_PATH . 'include/load_prefs.php');
cf1efdce 34require_once(SM_PATH . 'functions/html.php');
95dcee50 35/* get globals */
d8270226 36if (isset($_GET['month']) && is_numeric($_GET['month'])) {
95dcee50 37 $month = $_GET['month'];
38}
d8270226 39elseif (isset($_POST['month']) && is_numeric($_GET['month'])) {
95dcee50 40 $month = $_POST['month'];
41}
d8270226 42if (isset($_GET['year']) && is_numeric($_GET['year'])) {
95dcee50 43 $year = $_GET['year'];
44}
d8270226 45elseif (isset($_POST['year']) && is_numeric($_POST['year'])) {
95dcee50 46 $year = $_POST['year'];
47}
d8270226 48if (isset($_GET['day']) && is_numeric($_GET['day'])) {
95dcee50 49 $day = $_GET['day'];
50}
d8270226 51elseif (isset($_POST['day']) && is_numeric($_POST['day'])) {
95dcee50 52 $day = $_POST['day'];
53}
d8270226 54if (isset($_GET['dyear']) && is_numeric($_GET['dyear'])) {
95dcee50 55 $dyear = $_GET['dyear'];
56}
d8270226 57elseif (isset($_POST['dyear']) && is_numeric($_POST['dyear'])) {
95dcee50 58 $dyear = $_POST['dyear'];
59}
d8270226 60if (isset($_GET['dmonth']) && is_numeric($_GET['dmonth'])) {
95dcee50 61 $dmonth = $_GET['dmonth'];
62}
d8270226 63elseif (isset($_POST['dmonth']) && is_numeric($_POST['dmonth'])) {
95dcee50 64 $dmonth = $_POST['dmonth'];
65}
d8270226 66if (isset($_GET['dday']) && is_numeric($_GET['dday'])) {
95dcee50 67 $dday = $_GET['dday'];
68}
d8270226 69elseif (isset($_POST['dday']) && is_numeric($_POST['dday'])) {
95dcee50 70 $dday = $_POST['dday'];
71}
d8270226 72if (isset($_GET['dhour']) && is_numeric($_GET['dhour'])) {
95dcee50 73 $dhour = $_GET['dhour'];
74}
d8270226 75elseif (isset($_POST['dhour']) && is_numeric($_POST['dhour'])) {
95dcee50 76 $dhour = $_POST['dhour'];
77}
d8270226 78if (isset($_GET['dminute']) && is_numeric($_GET['dminute'])) {
95dcee50 79 $dminute = $_GET['dminute'];
80}
d8270226 81elseif (isset($_POST['dminute']) && is_numeric($_POST['dminute'])) {
95dcee50 82 $dminute = $_POST['dminute'];
83}
84if (isset($_POST['confirmed'])) {
85 $confirmed = $_POST['confirmed'];
86}
87/* got 'em */
d61a01d4 88
89function confirm_deletion()
90{
91 global $calself, $dyear, $dmonth, $dday, $dhour, $dminute, $calendardata, $color, $year, $month, $day;
92
93 $tmparray = $calendardata["$dmonth$dday$dyear"]["$dhour$dminute"];
94
b01b21d0 95 echo html_tag( 'table',
96 html_tag( 'tr',
97 html_tag( 'th', _("Do you really want to delete this event?") . '<br>', '', $color[4], 'colspan="2"' )
98 ) .
99 html_tag( 'tr',
100 html_tag( 'td', _("Date:"), 'right', $color[4] ) .
101 html_tag( 'td', $dmonth.'/'.$dday.'/'.$dyear, 'left', $color[4] )
102 ) .
103 html_tag( 'tr',
104 html_tag( 'td', _("Time:"), 'right', $color[4] ) .
105 html_tag( 'td', $dhour.':'.$dminute, 'left', $color[4] )
106 ) .
107 html_tag( 'tr',
108 html_tag( 'td', _("Title:"), 'right', $color[4] ) .
a11df61b 109 html_tag( 'td', $tmparray['title'], 'left', $color[4] )
b01b21d0 110 ) .
111 html_tag( 'tr',
112 html_tag( 'td', _("Message:"), 'right', $color[4] ) .
a11df61b 113 html_tag( 'td', $tmparray['message'], 'left', $color[4] )
b01b21d0 114 ) .
115 html_tag( 'tr',
116 html_tag( 'td',
117 " <FORM NAME=\"delevent\" METHOD=POST ACTION=\"$calself\">\n".
118 " <INPUT TYPE=HIDDEN NAME=\"dyear\" VALUE=\"$dyear\">\n".
119 " <INPUT TYPE=HIDDEN NAME=\"dmonth\" VALUE=\"$dmonth\">\n".
120 " <INPUT TYPE=HIDDEN NAME=\"dday\" VALUE=\"$dday\">\n".
121 " <INPUT TYPE=HIDDEN NAME=\"year\" VALUE=\"$year\">\n".
122 " <INPUT TYPE=HIDDEN NAME=\"month\" VALUE=\"$month\">\n".
123 " <INPUT TYPE=HIDDEN NAME=\"day\" VALUE=\"$day\">\n".
124 " <INPUT TYPE=HIDDEN NAME=\"dhour\" VALUE=\"$dhour\">\n".
125 " <INPUT TYPE=HIDDEN NAME=\"dminute\" VALUE=\"$dminute\">\n".
126 " <INPUT TYPE=HIDDEN NAME=\"confirmed\" VALUE=\"yes\">\n".
127 ' <INPUT TYPE=SUBMIT VALUE="' . _("Yes") . "\">\n".
128 " </FORM>\n" ,
129 'right', $color[4] ) .
130 html_tag( 'td',
131 " <FORM NAME=\"nodelevent\" METHOD=POST ACTION=\"day.php\">\n".
132 " <INPUT TYPE=HIDDEN NAME=\"year\" VALUE=\"$year\">\n".
133 " <INPUT TYPE=HIDDEN NAME=\"month\" VALUE=\"$month\">\n".
134 " <INPUT TYPE=HIDDEN NAME=\"day\" VALUE=\"$day\">\n".
135 ' <INPUT TYPE=SUBMIT VALUE="' . _("No") . "\">\n".
136 " </FORM>\n" ,
137 'left', $color[4] )
138 ) ,
139 '', $color[0], 'border="0" cellpadding="2" cellspacing="1"' );
d61a01d4 140}
141
142if ($month <= 0){
143 $month = date( 'm' );
144}
145if ($year <= 0){
146 $year = date( 'Y' );
147}
148if ($day <= 0){
149 $day = date( 'd' );
150}
151
152$calself=basename($PHP_SELF);
153
154displayPageHeader($color, 'None');
155//load calendar menu
156calendar_header();
157
b01b21d0 158echo html_tag( 'tr', '', '', $color[0] ) .
159 html_tag( 'td' ) .
160 html_tag( 'table', '', '', $color[0], 'width="100%" border="0" cellpadding="2" cellspacing="1"' ) .
161 html_tag( 'tr' ) .
162 html_tag( 'td', '', 'left' ) .
f3409980 163 date_intl( _("l, F j Y"), mktime(0, 0, 0, $month, $day, $year));
d61a01d4 164if (isset($dyear) && isset($dmonth) && isset($dday) && isset($dhour) && isset($dminute)){
165 if (isset($confirmed)){
166 delete_event("$dmonth$dday$dyear", "$dhour$dminute");
b01b21d0 167 echo '<br><br>' . _("Event deleted!") . "<br>\n";
1ba8cd6b 168 echo "<a href=\"day.php?year=$year&amp;month=$month&amp;day=$day\">" .
b01b21d0 169 _("Day View") . "</a>\n";
d61a01d4 170 } else {
171 readcalendardata();
172 confirm_deletion();
173 }
174} else {
175 echo '<br>' . _("Nothing to delete!");
176}
177
178?>
179</table></td></tr></table>
beb218e0 180</body></html>