function update($values, $object)
 {
     if (!defined('SYS_FORMS')) {
         require_once BASE . 'subsystems/forms.php';
     }
     exponent_forms_initialize();
     $object->title = $values['title'];
     $object->internal_name = preg_replace('/--+/', '-', preg_replace('/[^A-Za-z0-9_]/', '-', $values['int']));
     $object->body = $values['body'];
     $object->publish = popupdatetimecontrol::parseData('publish', $values);
     $object->unpublish = popupdatetimecontrol::parseData('unpublish', $values);
     return $object;
 }
         $eventdate = $db->selectObject('eventdate', 'id=' . intval($_POST['date_id']));
         $eventdate->date = exponent_datetime_startOfDayTimestamp(popupdatetimecontrol::parseData("eventdate", $_POST));
         $db->updateObject($eventdate, 'eventdate');
     } else {
         $item->approved = 1;
         $db->updateObject($item, "calendar");
         // There should be only one eventdate
         $eventdate = $db->selectObject('eventdate', 'event_id = ' . $item->id);
         $eventdate->date = exponent_datetime_startOfDayTimestamp(popupdatetimecontrol::parseData("eventdate", $_POST));
         $db->updateObject($eventdate, 'eventdate');
     }
     calendarmodule::spiderContent($item);
 } else {
     exponent_forms_initialize();
     $start_recur = exponent_datetime_startOfDayTimestamp(popupdatetimecontrol::parseData("eventdate", $_POST));
     $stop_recur = exponent_datetime_startOfDayTimestamp(popupdatetimecontrol::parseData("untildate", $_POST));
     if ($_POST['recur'] != "recur_none") {
         // Do recurrence
         $freq = $_POST['recur_freq_' . $_POST['recur']];
         ###echo $_POST['recur'] . "<br />";
         switch ($_POST['recur']) {
             case "recur_daily":
                 $dates = exponent_datetime_recurringDailyDates($start_recur, $stop_recur, $freq);
                 break;
             case "recur_weekly":
                 $dates = exponent_datetime_recurringWeeklyDates($start_recur, $stop_recur, $freq, isset($_POST['day']) ? array_keys($_POST['day']) : array($dateinfo['wday']));
                 break;
             case "recur_monthly":
                 $dates = exponent_datetime_recurringMonthlyDates($start_recur, $stop_recur, $freq, $_POST['month_type']);
                 break;
             case "recur_yearly":