Exemplo n.º 1
0
function process_event($id, $name, $event_date, $event_time)
{
    global $out, $WS_DEBUG;
    if ($WS_DEBUG) {
        ws_log_message(str_replace('XXX', array($id, $name, $event_time, $event_date), translate('Event id=XXX XXX at XXX on XXX.')));
    }
    return ws_print_event_xml($id, $event_date);
}
Exemplo n.º 2
0
function process_event($id, $name, $event_date, $event_time)
{
    global $out, $sentIds, $WS_DEBUG;
    if (!empty($sentIds[$id])) {
        if ($WS_DEBUG) {
            ws_log_message(str_replace('XXX', array($id, $name), translate('Event id=XXX XXX already sent.')));
        }
        return '';
    } else {
        if ($WS_DEBUG) {
            ws_log_message(str_replace('XXX', array($id, $name, $event_time, $event_date), translate('Event id=XXX XXX at XXX on XXX.')));
        }
        $sentIds[$id] = true;
        return ws_print_event_xml($id, $event_date);
    }
}
Exemplo n.º 3
0
function process_event($id, $name, $event_date, $event_time)
{
    global $CUTOFF, $site_extras, $WS_DEBUG;
    $out = '';
    $debug = str_replace('XXX', array($id, $name, $event_time, $event_date), translate('Event id=XXX XXX at XXX on XXX.')) . "\n" . str_replace('XXX', count($site_extras), translate('Number of site_extras XXX.'));
    // Check to see if this event has any reminders.
    $extras = get_site_extra_fields($id);
    for ($j = 0, $seCnt = count($site_extras); $j < $seCnt; $j++) {
        $extra_name = $site_extras[$j][0];
        $extra_type = $site_extras[$j][2];
        $extra_arg1 = $site_extras[$j][3];
        $extra_arg2 = $site_extras[$j][4];
        if (!empty($extras[$extra_name]['cal_remind'])) {
            $debug .= "\n" . translate('Reminder set for event.');
            // How many minutes before event should we send the reminder?
            $event_time = mktime(intval($event_time / 10000), $event_time / 100 % 100, 0, substr($event_date, 4, 2), substr($event_date, 6, 2), substr($event_date, 0, 4));
            if (($extra_arg2 & EXTRA_REMINDER_WITH_OFFSET) > 0) {
                $minsbefore = $extras[$extra_name]['cal_data'];
                $remind_time = $event_time - $minsbefore * 60;
            } elseif (($extra_arg2 & EXTRA_REMINDER_WITH_DATE) > 0) {
                $rd = $extras[$extra_name]['cal_date'];
                $remind_time = mktime(0, 0, 0, substr($rd, 4, 2), substr($rd, 6, 2), substr($rd, 0, 4));
            } else {
                $minsbefore = $extra_arg1;
                $remind_time = $event_time - $minsbefore * 60;
            }
            $debug .= '
  ' . str_replace('XXX', $minsbefore, translate('Mins Before XXX.')) . '
  ' . str_replace('XXX', date('m/d/Y H:i', $event_time), translate('Event time is XXX.')) . '
  ' . str_replace('XXX', date('m/d/Y H:i', $remind_time), translate('Remind time is XXX.'));
            // Send a reminder.
            if (time() >= $remind_time - $CUTOFF * 86400) {
                if ($debug) {
                    $debug .= '
  SENDING REMINDER!';
                }
                $out .= process_reminder($id, $event_date, $remind_time);
            }
        }
    }
    if ($WS_DEBUG) {
        ws_log_message($debug);
    }
    return $out;
}
Exemplo n.º 4
0
<!-- in if -->';
    $cnt = 0;
    while (($row = dbi_fetch_row($res)) && $cnt < $num) {
        $out .= '
<!-- in while type: $row[2] -->
  <log>
    <login>' . ws_escape_xml($row[0]) . '</login>
    <calendar>' . ws_escape_xml($row[1]) . '</calendar>
    <type>' . ws_escape_xml($row[2]) . '</type>
    <date>' . ws_escape_xml($row[3]) . '</date>
    <time>' . ws_escape_xml($row[4]) . '</time>
    <action>' . ws_escape_xml($row[5]) . '</action>
    <id>' . ws_escape_xml($row[6]) . '</id>
  </log>
';
        $cnt++;
    }
    dbi_free_result($res);
} else {
    $out .= '
  <error>' . ws_escape_xml(dbi_error()) . '</error>';
}
$out .= '
</activitylog>
';
// If web servic debugging is on...
if (!empty($WS_DEBUG) && $WS_DEBUG) {
    ws_log_message($out);
}
// Send output now...
echo $out;