cvs: phpweb / cal.php
| From: | James Cox | Date: | Thu, 02 May 2002 05:45:20 +0000 |
| Subject: | cvs: phpweb / cal.php | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-9982@lists.php.net to get a copy of this message | ||
imajes Thu May 2 01:45:20 2002 EDT
Modified files:
/phpweb cal.php
Log:
/me grumbles something about people not having anything better to do
Index: phpweb/cal.php
diff -u phpweb/cal.php:1.31 phpweb/cal.php:1.32
--- phpweb/cal.php:1.31 Mon Mar 4 21:54:18 2002
+++ phpweb/cal.php Thu May 2 01:45:19 2002
@@ -10,7 +10,13 @@
$begun = 0;
-if ($id) {
+if (!is_numeric($id) || !is_numeric($cy) || !is_numeric($cd) || !is_numeric($cm)) {
+ $errors[] = "invalid data specified";
+ $hack = 1;
+}
+
+if (!$hack) {
+ if ($id) {
if ($event = load_event($id)) {
commonHeader("Event: ".htmlentities($event['sdesc']));
display_event($event, 0);
@@ -19,8 +25,8 @@
else {
$errors[] = "There is no event for specified id
('".htmlentities($id)."')";
}
-}
-elseif ($cy && $cm && $cd) {
+ }
+ elseif ($cy && $cm && $cd) {
if (checkdate($cm,$cd,$cy)) {
$date = mktime(0,0,1,$cm,$cd,$cy);
if ($events = load_events($date)) {
@@ -39,17 +45,18 @@
$errors[] = "The specified date (".htmlentities("$cy/$cm/$cd").") was
not valid.";
unset($cm); unset($cd); unset($cy);
}
-}
+ }
-if ($cm && $cy && !checkdate($cm,1,$cy)) {
+ if ($cm && $cy && !checkdate($cm,1,$cy)) {
$errors[] = "The specified year and month (".htmlentities("$cy, $cm").")
are not valid.";
unset($cm); unset($cy);
-}
+ }
-if (!$cm) $cm = date("m");
-if (!$cy) $cy = date("Y");
+ if (!$cm) $cm = date("m");
+ if (!$cy) $cy = date("Y");
-$date = mktime(0,0,1,$cm,1,$cy);
+ $date = mktime(0,0,1,$cm,1,$cy);
+}
if (!$begun) {
commonHeader("Events: ".date("F Y", $date));
@@ -66,8 +73,12 @@
$events = load_events($date,1);
-if ($errors) display_errors($errors);
-
+if ($errors) {
+ display_errors($errors);
+ commonFooter();
+ exit(0);
+}
+
# beginning and end of this month
$bom = mktime(0,0,1,$cm, 1,$cy);
$eom = mktime(0,0,1,$cm+1,0,$cy);