~ubuntu-branches/ubuntu/hardy/squirrelmail/hardy-updates

« back to all changes in this revision

Viewing changes to plugins/calendar/event_delete.php

  • Committer: Bazaar Package Importer
  • Author(s): Thijs Kinkhorst
  • Date: 2006-07-04 14:49:23 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20060704144923-w5l1xdbivclpkmda
Tags: 2:1.4.7-1
* New upstream bugfix release.
  + Addresses some low-impact, theoretical or disputed security bugs,
    for which the code is tightened just-in-case:
    - Possible local file inclusion (Closes: #373731, CVE-2006-2842)
    - XSS in search.php (Closes: #375782, CVE-2006-3174)
  + Adds note to db-backend.txt about postgreSQL (Closes: #376605).

* Checked for standards version to 3.7.2, no changes necessary.
* Update maintainer address.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
<?php
2
2
 
3
3
/**
4
 
 * event_delete.php
5
 
 *
6
 
 * Copyright (c) 2002-2006 The SquirrelMail Project Team
7
 
 * Licensed under the GNU GPL. For full terms see the file COPYING.
8
 
 *
9
 
 * Originally contrubuted by Michal Szczotka <michal@tuxy.org>
10
 
 *
11
 
 * Functions to delete a event. 
12
 
 *
13
 
 * $Id: event_delete.php,v 1.14.2.5 2006/02/03 22:27:52 jervfors Exp $
 
4
 * Functions to delete a event.
 
5
 *
 
6
 * @copyright &copy; 2002-2006 The SquirrelMail Project Team
 
7
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 
8
 * @version $Id: event_delete.php,v 1.14.2.6 2006/05/06 07:52:18 tokul Exp $
 
9
 * @package plugins
 
10
 * @subpackage calendar
14
11
 */
 
12
 
 
13
/** @ignore */
15
14
define('SM_PATH','../../');
16
15
 
17
 
/* Calender plugin required files. */
18
 
require_once(SM_PATH . 'plugins/calendar/calendar_data.php');
19
 
require_once(SM_PATH . 'plugins/calendar/functions.php');
20
 
 
21
16
/* SquirrelMail required files. */
22
 
require_once(SM_PATH . 'include/validate.php');
23
 
require_once(SM_PATH . 'functions/strings.php');
24
 
require_once(SM_PATH . 'functions/date.php');
25
 
require_once(SM_PATH . 'config/config.php');
26
 
require_once(SM_PATH . 'functions/page_header.php');
27
 
require_once(SM_PATH . 'include/load_prefs.php');
28
 
require_once(SM_PATH . 'functions/html.php');
 
17
include_once(SM_PATH . 'include/validate.php');
 
18
/* date_intl() */
 
19
include_once(SM_PATH . 'functions/date.php');
 
20
 
 
21
/* Calendar plugin required files. */
 
22
include_once(SM_PATH . 'plugins/calendar/calendar_data.php');
 
23
include_once(SM_PATH . 'plugins/calendar/functions.php');
 
24
 
29
25
/* get globals */
30
 
if (isset($_GET['month']) && is_numeric($_GET['month'])) {
31
 
    $month = $_GET['month'];
32
 
}
33
 
elseif (isset($_POST['month']) && is_numeric($_GET['month'])) {
34
 
    $month = $_POST['month'];
35
 
}
36
 
if (isset($_GET['year']) && is_numeric($_GET['year'])) {
37
 
    $year = $_GET['year'];
38
 
}
39
 
elseif (isset($_POST['year']) && is_numeric($_POST['year'])) {
40
 
    $year = $_POST['year'];
41
 
}
42
 
if (isset($_GET['day']) && is_numeric($_GET['day'])) {
43
 
    $day = $_GET['day'];
44
 
}
45
 
elseif (isset($_POST['day']) && is_numeric($_POST['day'])) {
46
 
    $day = $_POST['day'];
47
 
}
48
 
if (isset($_GET['dyear']) && is_numeric($_GET['dyear'])) {
49
 
    $dyear = $_GET['dyear'];
50
 
}
51
 
elseif (isset($_POST['dyear']) && is_numeric($_POST['dyear'])) {
52
 
    $dyear = $_POST['dyear'];
53
 
}
54
 
if (isset($_GET['dmonth']) && is_numeric($_GET['dmonth'])) {
55
 
    $dmonth = $_GET['dmonth'];
56
 
}
57
 
elseif (isset($_POST['dmonth']) && is_numeric($_POST['dmonth'])) {
58
 
    $dmonth = $_POST['dmonth'];
59
 
}
60
 
if (isset($_GET['dday']) && is_numeric($_GET['dday'])) {
61
 
    $dday = $_GET['dday'];
62
 
}
63
 
elseif (isset($_POST['dday']) && is_numeric($_POST['dday'])) {
64
 
    $dday = $_POST['dday'];
65
 
}
66
 
if (isset($_GET['dhour']) && is_numeric($_GET['dhour'])) {
67
 
    $dhour = $_GET['dhour'];
68
 
}
69
 
elseif (isset($_POST['dhour']) && is_numeric($_POST['dhour'])) {
70
 
    $dhour = $_POST['dhour'];
71
 
}
72
 
if (isset($_GET['dminute']) && is_numeric($_GET['dminute'])) {
73
 
    $dminute = $_GET['dminute'];
74
 
}
75
 
elseif (isset($_POST['dminute']) && is_numeric($_POST['dminute'])) {
76
 
    $dminute = $_POST['dminute'];
77
 
}
78
 
if (isset($_POST['confirmed'])) {
79
 
    $confirmed = $_POST['confirmed'];
80
 
}
 
26
if (! sqGetGlobalVar('month',$month,SQ_FORM) || ! is_numeric($month)) {
 
27
    unset($month);
 
28
}
 
29
if (! sqGetGlobalVar('year',$year,SQ_FORM) || ! is_numeric($year)) {
 
30
    unset($year);
 
31
}
 
32
if (! sqGetGlobalVar('day',$day,SQ_FORM) || ! is_numeric($day)) {
 
33
    unset($day);
 
34
}
 
35
if (! sqGetGlobalVar('dyear',$dyear,SQ_FORM) || ! is_numeric($dyear)) {
 
36
    unset($dyear);
 
37
}
 
38
if (! sqGetGlobalVar('dmonth',$dmonth,SQ_FORM) || ! is_numeric($dmonth)) {
 
39
    unset($dmonth);
 
40
}
 
41
if (! sqGetGlobalVar('dday',$dday,SQ_FORM) || ! is_numeric($dday)) {
 
42
    unset($dday);
 
43
}
 
44
if (! sqGetGlobalVar('dhour',$dhour,SQ_FORM) || ! is_numeric($dhour)) {
 
45
    unset($dhour);
 
46
}
 
47
if (! sqGetGlobalVar('dminute',$dminute,SQ_FORM) || ! is_numeric($dminute)) {
 
48
    unset($dminute);
 
49
}
 
50
sqGetGlobalVar('confirmed',$confirmed,SQ_POST);
 
51
 
81
52
/* got 'em */
82
53
 
83
 
function confirm_deletion()
84
 
{
 
54
/**
 
55
 * Displays confirmation form when event is deleted
 
56
 * @return void
 
57
 */
 
58
function confirm_deletion() {
85
59
    global $calself, $dyear, $dmonth, $dday, $dhour, $dminute, $calendardata, $color, $year, $month, $day;
86
60
 
87
61
    $tmparray = $calendardata["$dmonth$dday$dyear"]["$dhour$dminute"];
88
62
 
89
63
    echo html_tag( 'table',
90
64
               html_tag( 'tr',
91
 
                   html_tag( 'th', _("Do you really want to delete this event?") . '<br>', '', $color[4], 'colspan="2"' )
 
65
                   html_tag( 'th', _("Do you really want to delete this event?") . '<br />', '', $color[4], 'colspan="2"' )
92
66
               ) .
93
67
               html_tag( 'tr',
94
68
                   html_tag( 'td', _("Date:"), 'right', $color[4] ) .
95
 
                   html_tag( 'td', $dmonth.'/'.$dday.'/'.$dyear, 'left', $color[4] )
 
69
                   html_tag( 'td', date_intl(_("m/d/Y"),mktime(0,0,0,$dmonth,$dday,$dyear)), 'left', $color[4] )
96
70
               ) .
97
71
               html_tag( 'tr',
98
72
                   html_tag( 'td', _("Time:"), 'right', $color[4] ) .
99
 
                   html_tag( 'td', $dhour.':'.$dminute, 'left', $color[4] )
 
73
                   html_tag( 'td', date_intl(_("H:i"),mktime($dhour,$dminute,0,$dmonth,$dday,$dyear)), 'left', $color[4] )
100
74
               ) .
101
75
               html_tag( 'tr',
102
76
                   html_tag( 'td', _("Title:"), 'right', $color[4] ) .
103
 
                   html_tag( 'td', $tmparray['title'], 'left', $color[4] )
 
77
                   html_tag( 'td', htmlspecialchars($tmparray['title']), 'left', $color[4] )
104
78
               ) .
105
79
               html_tag( 'tr',
106
80
                   html_tag( 'td', _("Message:"), 'right', $color[4] ) .
107
 
                   html_tag( 'td', $tmparray['message'], 'left', $color[4] )
 
81
                   html_tag( 'td', nl2br(htmlspecialchars($tmparray['message'])), 'left', $color[4] )
108
82
               ) .
109
83
               html_tag( 'tr',
110
84
                   html_tag( 'td',
111
 
                       "    <FORM NAME=\"delevent\" METHOD=POST ACTION=\"$calself\">\n".
112
 
                       "       <INPUT TYPE=HIDDEN NAME=\"dyear\" VALUE=\"$dyear\">\n".
113
 
                       "       <INPUT TYPE=HIDDEN NAME=\"dmonth\" VALUE=\"$dmonth\">\n".
114
 
                       "       <INPUT TYPE=HIDDEN NAME=\"dday\" VALUE=\"$dday\">\n".
115
 
                       "       <INPUT TYPE=HIDDEN NAME=\"year\" VALUE=\"$year\">\n".
116
 
                       "       <INPUT TYPE=HIDDEN NAME=\"month\" VALUE=\"$month\">\n".
117
 
                       "       <INPUT TYPE=HIDDEN NAME=\"day\" VALUE=\"$day\">\n".
118
 
                       "       <INPUT TYPE=HIDDEN NAME=\"dhour\" VALUE=\"$dhour\">\n".
119
 
                       "       <INPUT TYPE=HIDDEN NAME=\"dminute\" VALUE=\"$dminute\">\n".
120
 
                       "       <INPUT TYPE=HIDDEN NAME=\"confirmed\" VALUE=\"yes\">\n".
121
 
                       '       <INPUT TYPE=SUBMIT VALUE="' . _("Yes") . "\">\n".
122
 
                       "    </FORM>\n" ,
 
85
                       "    <form name=\"delevent\" method=\"post\" action=\"$calself\">\n".
 
86
                       "       <input type=\"hidden\" name=\"dyear\" value=\"$dyear\" />\n".
 
87
                       "       <input type=\"hidden\" name=\"dmonth\" value=\"$dmonth\" />\n".
 
88
                       "       <input type=\"hidden\" name=\"dday\" value=\"$dday\" />\n".
 
89
                       "       <input type=\"hidden\" name=\"year\" value=\"$year\" />\n".
 
90
                       "       <input type=\"hidden\" name=\"month\" value=\"$month\" />\n".
 
91
                       "       <input type=\"hidden\" name=\"day\" value=\"$day\" />\n".
 
92
                       "       <input type=\"hidden\" name=\"dhour\" value=\"$dhour\" />\n".
 
93
                       "       <input type=\"hidden\" name=\"dminute\" value=\"$dminute\" />\n".
 
94
                       "       <input type=\"hidden\" name=\"confirmed\" value=\"yes\" />\n".
 
95
                       '       <input type="submit" value="' . _("Yes") . "\" />\n".
 
96
                       "    </form>\n" ,
123
97
                   'right', $color[4] ) .
124
98
                   html_tag( 'td',
125
 
                       "    <FORM NAME=\"nodelevent\" METHOD=POST ACTION=\"day.php\">\n".
126
 
                       "       <INPUT TYPE=HIDDEN NAME=\"year\" VALUE=\"$year\">\n".
127
 
                       "       <INPUT TYPE=HIDDEN NAME=\"month\" VALUE=\"$month\">\n".
128
 
                       "       <INPUT TYPE=HIDDEN NAME=\"day\" VALUE=\"$day\">\n".
129
 
                       '       <INPUT TYPE=SUBMIT VALUE="' . _("No") . "\">\n".
130
 
                       "    </FORM>\n" ,
 
99
                       "    <form name=\"nodelevent\" method=\"post\" action=\"day.php\">\n".
 
100
                       "       <input type=\"hidden\" name=\"year\" value=\"$year\" />\n".
 
101
                       "       <input type=\"hidden\" name=\"month\" value=\"$month\" />\n".
 
102
                       "       <input type=\"hidden\" name=\"day\" value=\"$day\" />\n".
 
103
                       '       <input type="submit" value="' . _("No") . "\" />\n".
 
104
                       "    </form>\n" ,
131
105
                   'left', $color[4] )
132
106
               ) ,
133
107
           '', $color[0], 'border="0" cellpadding="2" cellspacing="1"' );
158
132
if (isset($dyear) && isset($dmonth) && isset($dday) && isset($dhour) && isset($dminute)){
159
133
    if (isset($confirmed)){
160
134
        delete_event("$dmonth$dday$dyear", "$dhour$dminute");
161
 
        echo '<br><br>' . _("Event deleted!") . "<br>\n";
 
135
        echo '<br /><br />' . _("Event deleted!") . "<br />\n";
162
136
        echo "<a href=\"day.php?year=$year&amp;month=$month&amp;day=$day\">" .
163
137
          _("Day View") . "</a>\n";
164
138
    } else {
166
140
        confirm_deletion();
167
141
    }
168
142
} else {
169
 
    echo '<br>' . _("Nothing to delete!");
 
143
    echo '<br />' . _("Nothing to delete!");
170
144
}
171
145
 
172
146
?>