Ejemplo n.º 1
0
if (count($errors)) {
    display_errors($errors);
}
// Generate days and months arrays for form
for ($i = 1; $i <= 7; $i++) {
    $days[$i] = strftime('%A', mktime(12, 0, 0, 4, $i));
}
for ($i = 1; $i <= 12; $i++) {
    $months[$i] = strftime('%B', mktime(12, 0, 0, $i, 1));
}
// Possibilities to recur
$re = array(1 => 'First', 2 => 'Second', 3 => 'Third', 4 => 'Fourth', -1 => 'Last', -2 => '2nd Last', -3 => '3rd Last');
// If we have data, display preview
if ($process && count($errors) === 0) {
    echo "<p><strong>Preview:</strong></p>\n";
    display_event($_POST);
    echo "<p><strong>Change:</strong></p>\n";
}
?>
<form action="/submit-event.php" method="post">
<table border="0" cellpadding="3" class="standard">
 <tr>
  <th class="subr">Start Date</th>
  <td>
   <select name="smonth"><option></option><?php 
display_options($months, $_POST['smonth']);
?>
</select>
   <input type="text" name="sday" size="2" maxlength="2" value="<?php 
echo htmlentities($_POST['sday'], ENT_QUOTES | ENT_IGNORE, 'UTF-8');
?>
Ejemplo n.º 2
0
        display_event($event, 0);
        $begun = TRUE;
    } else {
        $errors[] = "There is no event for specified id ('" . htmlentities($id, ENT_QUOTES | ENT_IGNORE, 'UTF-8') . "')";
    }
} elseif ($cy && $cm && $cd) {
    // Check if date is valid
    if (checkdate($cm, $cd, $cy)) {
        // Date integer for that day
        $date = mktime(0, 0, 1, $cm, $cd, $cy);
        // Try to load events for that day, and display them all
        if ($events = load_events($date)) {
            site_header("Events: " . date("F j, Y", $date), array("current" => "FIXME"));
            echo "<h2>", date("F j, Y", $date), "</h2>\n";
            foreach ($events as $event) {
                display_event($event, 0);
                echo "<br />";
            }
            $begun = TRUE;
        } else {
            $errors[] = "There are no events for the specified date (" . date("F j, Y", $date) . ").";
        }
    } else {
        $errors[] = "The specified date (" . htmlentities("{$cy}/{$cm}/{$cd}", ENT_QUOTES | ENT_IGNORE, 'UTF-8') . ") was not valid.";
        unset($cm);
        unset($cd);
        unset($cy);
    }
}
// Check if month and year is valid
if ($cm && $cy && !checkdate($cm, 1, $cy)) {