/** * display upper part of month calendar view * @return void * @access private */ function startcalendar() { global $year, $month, $color; $prev_date = mktime(0, 0, 0, $month - 1, 1, $year); $act_date = mktime(0, 0, 0, $month, 1, $year); $next_date = mktime(0, 0, 0, $month + 1, 1, $year); $prev_month = date('m', $prev_date); $next_month = date('m', $next_date); $prev_year = date('Y', $prev_date); $next_year = date('Y', $next_date); $self = 'calendar.php'; echo html_tag('tr', "\n" . html_tag('td', "\n" . html_tag('table', '', '', $color[0], 'width="100%" border="0" cellpadding="2" cellspacing="1"') . html_tag('tr', "\n" . html_tag('th', "<a href=\"{$self}?year=" . ($year - 1) . "&month={$month}\"><< " . ($year - 1) . "</a>") . "\n" . html_tag('th', "<a href=\"{$self}?year={$prev_year}&month={$prev_month}\">< " . date_intl('M', $prev_date) . "</a>") . "\n" . html_tag('th', date_intl('F Y', $act_date), '', $color[0], 'colspan="3"') . html_tag('th', "<a href=\"{$self}?year={$next_year}&month={$next_month}\">" . date_intl('M', $next_date) . " ></a>") . "\n" . html_tag('th', "<a href=\"{$self}?year=" . ($year + 1) . "&month={$month}\">" . ($year + 1) . " >></a>")) . "\n" . html_tag('tr', html_tag('th', _("Sunday"), '', $color[5], 'width="14%" width="90"') . "\n" . html_tag('th', _("Monday"), '', $color[5], 'width="14%" width="90"') . "\n" . html_tag('th', _("Tuesday"), '', $color[5], 'width="14%" width="90"') . "\n" . html_tag('th', _("Wednesday"), '', $color[5], 'width="14%" width="90"') . "\n" . html_tag('th', _("Thursday"), '', $color[5], 'width="14%" width="90"') . "\n" . html_tag('th', _("Friday"), '', $color[5], 'width="14%" width="90"') . "\n" . html_tag('th', _("Saturday"), '', $color[5], 'width="14%" width="90"') . "\n")), '', $color[0]) . "\n"; }
/** * Returns a short representation of the date, * taking timezones and localization into account. * Depending on user's settings, this string can be * of the form: "14:23" or "Jun 14, 2003" depending * on whether the stamp is "today" or not. * * @param int stamp the timestamp * @return string the date string */ function getDateString($stamp) { global $invert_time, $hour_format, $show_full_date; if ($stamp == -1) { return ''; } $now = time(); $dateZ = date('Z', $now); // FIXME: isn't this obsolete and introduced as a terrible workaround // for bugs at other places which are fixed a long time ago? if ($invert_time) { $dateZ = -$dateZ; } // calculate when it was midnight and when it will be, // in order to display dates differently if they're 'today' $midnight = $now - $now % 86400 - $dateZ; // this is to correct if after calculations midnight is more than // one whole day away. if ($now - $midnight > 86400) { $midnight += 86400; } $nextmid = $midnight + 86400; if ($show_full_date == 1 || $nextmid < $stamp) { $date_format = _("M j, Y"); } else { if ($midnight < $stamp) { /* Today */ if ($hour_format == SMPREF_TIME_12HR) { $date_format = _("g:i a"); } else { $date_format = _("H:i"); } } else { if ($midnight - 518400 < $stamp) { /* This week */ if ($hour_format == SMPREF_TIME_12HR) { $date_format = _("D, g:i a"); } else { $date_format = _("D, H:i"); } } else { /* before this week */ $date_format = _("M j, Y"); } } } return date_intl($date_format, $stamp); }
/** * Confirms event update * @return void * @access private */ function confirm_update() { global $calself, $year, $month, $day, $hour, $minute, $calendardata, $color, $event_year, $event_month, $event_day, $event_hour, $event_minute, $event_length, $event_priority, $event_title, $event_text; $tmparray = $calendardata["{$month}{$day}{$year}"]["{$hour}{$minute}"]; $tab = ' '; echo html_tag('table', html_tag('tr', html_tag('th', _("Do you really want to change this event from:") . "<br />\n", '', $color[4], 'colspan="2"') . "\n") . html_tag('tr', html_tag('td', _("Date:"), 'right', $color[4]) . "\n" . html_tag('td', date_intl(_("m/d/Y"), mktime(0, 0, 0, $month, $day, $year)), 'left', $color[4]) . "\n") . html_tag('tr', html_tag('td', _("Time:"), 'right', $color[4]) . "\n" . html_tag('td', date_intl(_("H:i"), mktime($hour, $minute, 0, $month, $day, $year)), 'left', $color[4]) . "\n") . html_tag('tr', html_tag('td', _("Priority:"), 'right', $color[4]) . "\n" . html_tag('td', $tmparray['priority'], 'left', $color[4]) . "\n") . html_tag('tr', html_tag('td', _("Title:"), 'right', $color[4]) . "\n" . html_tag('td', sm_encode_html_special_chars($tmparray['title']), 'left', $color[4]) . "\n") . html_tag('tr', html_tag('td', _("Message:"), 'right', $color[4]) . "\n" . html_tag('td', nl2br(sm_encode_html_special_chars($tmparray['message'])), 'left', $color[4]) . "\n") . html_tag('tr', html_tag('th', _("to:") . "<br />\n", '', $color[4], 'colspan="2"') . "\n") . html_tag('tr', html_tag('td', _("Date:"), 'right', $color[4]) . "\n" . html_tag('td', date_intl(_("m/d/Y"), mktime(0, 0, 0, $event_month, $event_day, $event_year)), 'left', $color[4]) . "\n") . html_tag('tr', html_tag('td', _("Time:"), 'right', $color[4]) . "\n" . html_tag('td', date_intl(_("H:i"), mktime($event_hour, $event_minute, 0, $event_month, $event_day, $event_year)), 'left', $color[4]) . "\n") . html_tag('tr', html_tag('td', _("Priority:"), 'right', $color[4]) . "\n" . html_tag('td', $event_priority, 'left', $color[4]) . "\n") . html_tag('tr', html_tag('td', _("Title:"), 'right', $color[4]) . "\n" . html_tag('td', sm_encode_html_special_chars($event_title), 'left', $color[4]) . "\n") . html_tag('tr', html_tag('td', _("Message:"), 'right', $color[4]) . "\n" . html_tag('td', nl2br(sm_encode_html_special_chars($event_text)), 'left', $color[4]) . "\n") . html_tag('tr', html_tag('td', "<form name=\"updateevent\" method=\"post\" action=\"{$calself}\">\n" . $tab . addHidden('year', $year) . $tab . addHidden('month', $month) . $tab . addHidden('day', $day) . $tab . addHidden('hour', $hour) . $tab . addHidden('minute', $minute) . $tab . addHidden('event_year', $event_year) . $tab . addHidden('event_month', $event_month) . $tab . addHidden('event_day', $event_day) . $tab . addHidden('event_hour', $event_hour) . $tab . addHidden('event_minute', $event_minute) . $tab . addHidden('event_priority', $event_priority) . $tab . addHidden('event_length', $event_length) . $tab . addHidden('event_title', $event_title) . $tab . addHidden('event_text', $event_text) . $tab . addHidden('updated', 'yes') . $tab . addHidden('confirmed', 'yes') . $tab . addSubmit(_("Yes")) . "</form>\n", 'right', $color[4]) . "\n" . html_tag('td', "<form name=\"nodelevent\" method=\"post\" action=\"day.php\">\n" . $tab . addHidden('year', $year) . $tab . addHidden('month', $month) . $tab . addHidden('day', $day) . $tab . addSubmit(_("No")) . "</form>\n", 'left', $color[4]) . "\n"), '', $color[0], 'border="0" cellpadding="2" cellspacing="1"'); }
/** Translate the input date to imap date to local date display, * so the user can know if the date is wrong or illegal * @return string locally formatted date or error text */ function asearch_get_date_display(&$what) { $what_parts = sqimap_asearch_parse_date($what); if (count($what_parts) == 4) { if (checkdate($what_parts[2], $what_parts[1], $what_parts[3])) { return date_intl(_("M j, Y"), mktime(0, 0, 0, $what_parts[2], $what_parts[1], $what_parts[3])); } //return $what_parts[1] . ' ' . getMonthName($what_parts[2]) . ' ' . $what_parts[3]; return _("(Illegal date)"); } return _("(Wrong date)"); }
function getDateString($stamp) { global $invert_time, $hour_format; if ($stamp == -1) { return ''; } $now = time(); $dateZ = date('Z', $now); if ($invert_time) { $dateZ = -$dateZ; } $midnight = $now - $now % 86400 - $dateZ; if ($midnight < $stamp) { /* Today */ if ($hour_format == SMPREF_TIME_12HR) { $date_format = _("g:i a"); } else { $date_format = _("G:i"); } } else { if ($midnight - 518400 < $stamp) { /* This week */ if ($hour_format == SMPREF_TIME_12HR) { $date_format = _("D, g:i a"); } else { $date_format = _("D, G:i"); } } else { /* before this week */ $date_format = _("M j, Y"); } } return date_intl($date_format, $stamp); }
if (!isset($month) || $month <= 0) { $month = date('m'); } if (!isset($year) || $year <= 0) { $year = date('Y'); } if (!isset($day) || $day <= 0) { $day = date('d'); } if (!isset($hour) || $hour <= 0) { $hour = '08'; } $calself = basename($PHP_SELF); displayPageHeader($color); //load calendar menu calendar_header(); echo html_tag('tr', '', '', $color[0]) . html_tag('td', '', 'left') . html_tag('table', '', '', $color[0], 'width="100%" border="0" cellpadding="2" cellspacing="1"') . html_tag('tr', html_tag('td', date_intl(_("l, F j Y"), mktime(0, 0, 0, $month, $day, $year)), 'left', '', 'colspan="2"')); //if form has not been filled in if (!isset($event_text)) { show_event_form(); } else { readcalendardata(); $calendardata["{$month}{$day}{$year}"]["{$event_hour}{$event_minute}"] = array('length' => $event_length, 'priority' => $event_priority, 'title' => $event_title, 'message' => $event_text, 'reminder' => ''); //save writecalendardata(); echo html_tag('table', html_tag('tr', html_tag('th', _("Event Has been added!") . "<br />\n", '', $color[4], 'colspan="2"')) . html_tag('tr', html_tag('td', _("Date:"), 'right', $color[4]) . "\n" . html_tag('td', date_intl(_("m/d/Y"), mktime(0, 0, 0, $month, $day, $year)), 'left', $color[4]) . "\n") . html_tag('tr', html_tag('td', _("Time:"), 'right', $color[4]) . "\n" . html_tag('td', date_intl(_("H:i"), mktime($event_hour, $event_minute, 0, $month, $day, $year)), 'left', $color[4]) . "\n") . html_tag('tr', html_tag('td', _("Title:"), 'right', $color[4]) . "\n" . html_tag('td', sm_encode_html_special_chars($event_title, ENT_NOQUOTES), 'left', $color[4]) . "\n") . html_tag('tr', html_tag('td', _("Message:"), 'right', $color[4]) . "\n" . html_tag('td', nl2br(sm_encode_html_special_chars($event_text, ENT_NOQUOTES)), 'left', $color[4]) . "\n") . html_tag('tr', html_tag('td', "<a href=\"day.php?year={$year}&month={$month}&day={$day}\">" . _("Day View") . "</a>\n", 'left', $color[4], 'colspan="2"') . "\n"), '', $color[0], 'width="100%" border="0" cellpadding="2" cellspacing="1"') . "\n"; } ?> </table></td></tr></table> </body></html>
/** * Returns a short representation of the date, * taking timezones and localization into account. * Depending on user's settings, this string can be * of the form: "14:23" or "Jun 14, 2003" depending * on whether the stamp is "today" or not. * * @param int stamp the timestamp * @return string the date string */ function getDateString($stamp) { global $invert_time, $hour_format, $show_full_date; if ($stamp == -1) { return ''; } $now = time(); $dateZ = date('Z', $now); // FIXME: isn't this obsolete and introduced as a terrible workaround // for bugs at other places which are fixed a long time ago? if ($invert_time) { $dateZ = -$dateZ; } $midnight = $now - $now % 86400 - $dateZ; $nextmid = $midnight + 86400 - $dateZ; if ($show_full_date == 1 || $nextmid < $stamp) { $date_format = _("M j, Y"); } else { if ($midnight < $stamp) { /* Today */ if ($hour_format == SMPREF_TIME_12HR) { $date_format = _("g:i a"); } else { $date_format = _("G:i"); } } else { if ($midnight - 518400 < $stamp) { /* This week */ if ($hour_format == SMPREF_TIME_12HR) { $date_format = _("D, g:i a"); } else { $date_format = _("D, G:i"); } } else { /* before this week */ $date_format = _("M j, Y"); } } } return date_intl($date_format, $stamp); }
/** * Displays confirmation form when event is deleted * @return void */ function confirm_deletion() { global $calself, $dyear, $dmonth, $dday, $dhour, $dminute, $calendardata, $color, $year, $month, $day; $tmparray = $calendardata["{$dmonth}{$dday}{$dyear}"]["{$dhour}{$dminute}"]; echo html_tag('table', html_tag('tr', html_tag('th', _("Do you really want to delete this event?") . '<br />', '', $color[4], 'colspan="2"')) . html_tag('tr', html_tag('td', _("Date:"), 'right', $color[4]) . html_tag('td', date_intl(_("m/d/Y"), mktime(0, 0, 0, $dmonth, $dday, $dyear)), 'left', $color[4])) . html_tag('tr', html_tag('td', _("Time:"), 'right', $color[4]) . html_tag('td', date_intl(_("H:i"), mktime($dhour, $dminute, 0, $dmonth, $dday, $dyear)), 'left', $color[4])) . html_tag('tr', html_tag('td', _("Title:"), 'right', $color[4]) . html_tag('td', htmlspecialchars($tmparray['title']), 'left', $color[4])) . html_tag('tr', html_tag('td', _("Message:"), 'right', $color[4]) . html_tag('td', nl2br(htmlspecialchars($tmparray['message'])), 'left', $color[4])) . html_tag('tr', html_tag('td', " <form name=\"delevent\" method=\"post\" action=\"{$calself}\">\n" . " <input type=\"hidden\" name=\"dyear\" value=\"{$dyear}\" />\n" . " <input type=\"hidden\" name=\"dmonth\" value=\"{$dmonth}\" />\n" . " <input type=\"hidden\" name=\"dday\" value=\"{$dday}\" />\n" . " <input type=\"hidden\" name=\"year\" value=\"{$year}\" />\n" . " <input type=\"hidden\" name=\"month\" value=\"{$month}\" />\n" . " <input type=\"hidden\" name=\"day\" value=\"{$day}\" />\n" . " <input type=\"hidden\" name=\"dhour\" value=\"{$dhour}\" />\n" . " <input type=\"hidden\" name=\"dminute\" value=\"{$dminute}\" />\n" . " <input type=\"hidden\" name=\"confirmed\" value=\"yes\" />\n" . ' <input type="submit" value="' . _("Yes") . "\" />\n" . " </form>\n", 'right', $color[4]) . html_tag('td', " <form name=\"nodelevent\" method=\"post\" action=\"day.php\">\n" . " <input type=\"hidden\" name=\"year\" value=\"{$year}\" />\n" . " <input type=\"hidden\" name=\"month\" value=\"{$month}\" />\n" . " <input type=\"hidden\" name=\"day\" value=\"{$day}\" />\n" . ' <input type="submit" value="' . _("No") . "\" />\n" . " </form>\n", 'left', $color[4])), '', $color[0], 'border="0" cellpadding="2" cellspacing="1"'); }
/** * main loop for displaying daily events * @return void * @access private */ function display_events() { global $daily_events, $month, $day, $year, $color; ksort($daily_events, SORT_STRING); $eo = 0; while ($calfoo = each($daily_events)) { if ($eo == 0) { $eo = 4; } else { $eo = 0; } $ehour = substr($calfoo['key'], 0, 2); $eminute = substr($calfoo['key'], 2, 2); if (!is_array($calfoo['value'])) { echo html_tag('tr', html_tag('td', $ehour . ':' . $eminute, 'left') . html_tag('td', ' ', 'left') . html_tag('td', "<font size=\"-1\"><a href=\"event_create.php?year={$year}&month={$month}&day={$day}&hour=" . substr($calfoo['key'], 0, 2) . "\">" . _("ADD") . "</a></font>", 'center'), '', $color[$eo]); } else { $calbar = $calfoo['value']; if ($calbar['length'] != 0) { $elength = '-' . date_intl(_("H:i"), mktime($ehour, $eminute + $calbar['length'], 0, 1, 1, 0)); } else { $elength = ''; } echo html_tag('tr', '', '', $color[$eo]) . html_tag('td', date_intl(_("H:i"), mktime($ehour, $eminute, 0, 1, 1, 0)) . $elength, 'left') . html_tag('td', '', 'left') . '['; echo $calbar['priority'] == 1 ? "<font color=\"{$color['1']}\">" . htmlspecialchars($calbar['title']) . '</font>' : htmlspecialchars($calbar['title']); echo '] <div style="margin-left:10px">' . nl2br(htmlspecialchars($calbar['message'])) . '</div>' . html_tag('td', "<font size=\"-1\"><nobr>\n" . "<a href=\"event_edit.php?year={$year}&month={$month}&day={$day}&hour=" . substr($calfoo['key'], 0, 2) . "&minute=" . substr($calfoo['key'], 2, 2) . "\">" . _("EDIT") . "</a> | \n" . "<a href=\"event_delete.php?dyear={$year}&dmonth={$month}&dday={$day}&dhour=" . substr($calfoo['key'], 0, 2) . "&dminute=" . substr($calfoo['key'], 2, 2) . "&year={$year}&month={$month}&day={$day}\">" . _("DEL") . '</a>' . "</nobr></font>\n", 'center'); } } }