Ejemplo n.º 1
0
    die("missing params - action='{$action}'");
}
if ($name == "" || $email == "") {
    die("missing params - name='{$name}' email='{$email}'");
}
if ($action != 'del' && ($dates == "" || $eventtime == "")) {
    die("missing params - action='{$action}' dates='{$dates}' eventtime='{$eventtime}'");
}
if ($action != 'del' && !$daylist[1]) {
    die("invalid date string - dates='{$dates}'");
}
# If we're editing an existing event, then fetch its daily list and merge
# it into the $daylist.
if ($id) {
    # Fetch the old dates
    $olddates = dailystatus($id);
    # Merge the old and new lists.
    $daylist = mergedates($daylist, $olddates);
} else {
    # all dates will be added
    for ($i = 1; $daylist[$i]; $i++) {
        $daylist[$i]['changed'] = 'Y';
        $daylist[$i]['olddate'] = 'N';
    }
}
# For SQL we only store the first letter of the datestype
$sqldatestype = strtoupper(substr($daylist['datestype'], 0, 1));
# construct a SQL statement to insert/update/delete the record
$details = "";
$exceptions = "";
switch ($action) {
Ejemplo n.º 2
0
    print "<vfydates>\n";
    print "  <error>No matching dates</error>\n";
    print "</vfydates>\n";
} else {
    if ($newdates[365]) {
        # Every day matches?  That means we failed to parse anything in
        # the date.
        print "<vfydates>\n";
        print "  <error>Date not understood</error>\n";
        print "</vfydates>\n";
    } else {
        # If we're editing an existing event, then fetch its daily list and merge
        # it into the $newdates.
        if ($_REQUEST["id"]) {
            # Fetch the old dates
            $olddates = dailystatus($_REQUEST["id"]);
            # Merge the old and new lists.
            $newdates = mergedates($newdates, $olddates);
        } else {
            # all dates will be added.  Just merge in some new fields.
            for ($i = 1; $newdates[$i]; $i++) {
                $newdates[$i]["changed"] = "Y";
                $newdates[$i]["olddate"] = "N";
            }
        }
        # If this is a reload, not a change to the "dates" input, then any
        # missing dates must have been deleted instead of added.  HOWEVER since
        # it would be nice if one could extend a repeating event by reloading
        # it and saving it, without changing a bunch of dates from "Deleted" to
        # "Added", so if the list ends with a bunch of "Added" dates then leave
        # them that way.