1
0
mirror of https://github.com/php/web-php.git synced 2026-03-23 23:02:13 +01:00

/me grumbles something about people not having anything better to do

This commit is contained in:
James Cox
2002-05-02 05:45:19 +00:00
parent 86b3e68ce6
commit 164b1a1dc7

35
cal.php
View File

@@ -10,7 +10,13 @@ require_once 'prepend.inc';
$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 @@ if ($id) {
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,18 +45,19 @@ elseif ($cy && $cm && $cd) {
$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");
$date = mktime(0,0,1,$cm,1,$cy);
}
if (!$cm) $cm = date("m");
if (!$cy) $cy = date("Y");
$date = mktime(0,0,1,$cm,1,$cy);
if (!$begun) {
commonHeader("Events: ".date("F Y", $date));
?>
@@ -66,8 +73,12 @@ to get the details for all of the events taking place that day.</p>
$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);