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

« back to all changes in this revision

Viewing changes to plugins/calendar/calendar.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
 
 * calendar.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
4
 * Displays the main calendar page (month view).
12
5
 *
13
 
 * $Id: calendar.php,v 1.13.2.8 2006/02/03 22:27:52 jervfors Exp $
 
6
 * @copyright &copy; 2002-2006 The SquirrelMail Project Team
 
7
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 
8
 * @version $Id: calendar.php,v 1.13.2.9 2006/05/06 07:52:17 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
/* load 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');
29
24
 
30
25
/* get globals */
31
 
unset($month, $year);
32
 
if (isset($_GET['month']) && is_numeric($_GET['month'])) {
33
 
    $month = $_GET['month'];
34
 
}
35
 
if (isset($_GET['year']) && is_numeric($_GET['year'])) {
36
 
    $year = $_GET['year'];
37
 
}
38
 
if (isset($_POST['year']) && is_numeric($_POST['year'])) {
39
 
    $year = $_POST['year'];
40
 
}
41
 
if (isset($_POST['month']) && is_numeric($_POST['month'])) {
42
 
    $month = $_POST['month'];
 
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);
43
31
}
44
32
/* got 'em */
45
33
 
46
 
//display upper part of month calendar view
 
34
/**
 
35
 * display upper part of month calendar view
 
36
 * @return void
 
37
 * @access private
 
38
 */
47
39
function startcalendar() {
48
 
    global $year, $month, $day, $color;
 
40
    global $year, $month, $color;
49
41
 
50
42
    $prev_date = mktime(0, 0, 0, $month - 1, 1, $year);
51
43
    $act_date  = mktime(0, 0, 0, $month, 1, $year);
89
81
           '', $color[0] ) ."\n";
90
82
}
91
83
 
92
 
//main logic for month view of calendar
 
84
/**
 
85
 * main logic for month view of calendar
 
86
 * @return void
 
87
 * @access private
 
88
 */
93
89
function drawmonthview() {
94
 
    global $year, $month, $day, $color, $calendardata, $todayis;
 
90
    global $year, $month, $color, $calendardata, $todayis;
95
91
 
96
92
    $aday = 1 - date('w', mktime(0, 0, 0, $month, 1, $year));
97
93
    $days_in_month = date('t', mktime(0, 0, 0, $month, 1, $year));
104
100
            if ( $aday <= $days_in_month && $aday > 0){
105
101
                echo html_tag( 'td', '', 'left', $color[4], 'height="50" valign="top"' ) ."\n".
106
102
                     html_tag( 'div', '', 'right' );
107
 
                echo(($cdate==$todayis) ? "<font size=-1 color=$color[1]>[ " . _("TODAY") . " ] " : "<font size=-1>");
 
103
                echo(($cdate==$todayis) ? '<font size="-1" color="'.$color[1].'">[ ' . _("TODAY") . " ] " : '<font size="-1">');
108
104
                echo "<a href=day.php?year=$year&amp;month=$month&amp;day=";
109
105
                echo(($aday<10) ? "0" : "");
110
106
                echo "$aday>$aday</a></font></div>";
116
112
                $i=0;
117
113
                while ($calfoo = each($calendardata[$cdate])) {
118
114
                    $calbar = $calendardata[$cdate][$calfoo['key']];
119
 
                    $title = '['. $calfoo['key']. '] ' .$calbar['message'];
120
 
                    echo ($calbar['priority']==1) ? "<a href=\"#\" style=\"text-decoration:none; color: $color[1]\" title=\"$title\">$calbar[title]</a><br>\n" : "<a href=\"#\" style=\"text-decoration:none; color: $color[6]\" title=\"$title\">$calbar[title]</a><br>\n";
 
115
                    // FIXME: how to display multiline task
 
116
                    $title = '['. $calfoo['key']. '] ' .
 
117
                        str_replace(array("\r","\n"),array(' ',' '),htmlspecialchars($calbar['message']));
 
118
                    // FIXME: link to nowhere
 
119
                    echo "<a href=\"#\" style=\"text-decoration:none; color: "
 
120
                        .($calbar['priority']==1 ? $color[1] : $color[6])
 
121
                        ."\" title=\"$title\">".htmlspecialchars($calbar['title'])."</a><br />\n";
121
122
                    $i=$i+1;
122
123
                    if($i==2){
123
124
                        break;
131
132
    }
132
133
}
133
134
 
134
 
//end of monthly view and form to jump to any month and year
 
135
/**
 
136
 * end of monthly view and form to jump to any month and year
 
137
 * @return void
 
138
 * @access private
 
139
 */
135
140
function endcalendar() {
136
141
    global $year, $month, $day, $color;
137
142
 
138
143
    echo html_tag( 'tr' ) ."\n" .
139
144
           html_tag( 'td', '', 'left', '', 'colspan="7"' ) ."\n" .
140
 
         "          <FORM NAME=caljump ACTION=\"calendar.php\" METHOD=POST>\n".
141
 
         "          <SELECT NAME=\"year\">\n";
 
145
         "          <form name=\"caljump\" action=\"calendar.php\" method=\"post\">\n".
 
146
         "          <select name=\"year\">\n";
142
147
    select_option_year($year);
143
 
    echo "          </SELECT>\n".
144
 
         "          <SELECT NAME=\"month\">\n";
 
148
    echo "          </select>\n".
 
149
         "          <select name=\"month\">\n";
145
150
    select_option_month($month);
146
 
    echo "          </SELECT>\n".
147
 
         '         <INPUT TYPE=SUBMIT VALUE="' . _("Go") . "\">\n".
148
 
         "          </FORM>\n".
149
 
         "          </TD></TR>\n".
150
 
         "</TABLE></TD></TR></TABLE>\n";
 
151
    echo "          </select>\n".
 
152
         '          <input type="submit" value="' . _("Go") . "\" />\n".
 
153
         "          </form>\n".
 
154
         "          </td></tr>\n".
 
155
         "</table></td></tr></table>\n";
151
156
}
152
157
 
153
158