本文整理汇总了PHP中date_to_str函数的典型用法代码示例。如果您正苦于以下问题:PHP date_to_str函数的具体用法?PHP date_to_str怎么用?PHP date_to_str使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了date_to_str函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: translate
</td>
</tr>';
}
if (Doc::commentsEnabled()) {
echo '
<tr>
<td class="aligntop bold">' . translate('Comments') . ':</td>
<td>';
$comList = new CommentList($id);
$num_comment = $comList->getSize();
$comment_text = '';
for ($i = 0; $i < $num_comment; $i++) {
$cmt = $comList->getDoc($i);
user_load_variables($cmt->getLogin(), 'cmt_');
$comment_text .= '
<strong>' . htmlspecialchars($cmt->getDescription()) . '</strong> - ' . $cmt_fullname . ' ' . translate('at') . ' ' . date_to_str($cmt->getModDate(), '', false, true) . ' ' . display_time($cmt->getModTime(), 2) . ($is_admin || $login == $cmt->getLogin() || user_is_assistant($login, $cmt->getLogin()) || $login == $create_by || user_is_assistant($login, $create_by) ? ' [<a href="docdel.php?blid=' . $cmt->getId() . '" onclick="return confirm( \'' . $areYouSureStr . '\' );">' . translate('Delete') . '</a>]' : '') . '<br />
<blockquote id="eventcomment">' . nl2br(activate_urls(htmlspecialchars($cmt->getData()))) . '
</blockquote><div style="clear:both"></div>';
}
if ($num_comment == 0) {
echo translate('None') . '<br />';
} else {
echo '
' . $num_comment . ' ' . translate('comments') . '
<input id="showbutton" type="button" value="' . translate('Show') . '" onclick="showComments();" />
<input id="hidebutton" type="button" value="' . translate('Hide') . '" onclick="hideComments();" /><br />
<div id="comtext">' . $comment_text . '</div>';
// We could put the following JS in includes/js/view_entry.php,
// but we won't need it in many cases and we don't know whether
// we need it until after would need to include it.
// So, we will include it here instead.
示例2: set_today
set_today($date);
$nextdate = date('Ymd', mktime(0, 0, 0, $thismonth, $thisday + 7, $thisyear));
$prevdate = date('Ymd', mktime(0, 0, 0, $thismonth, $thisday - 7, $thisyear));
$wkstart = get_weekday_before($thisyear, $thismonth, $thisday + 1);
$wkend = $wkstart + 86400 * ($DISPLAY_WEEKENDS == 'N' ? 5 : 7);
$thisdate = date('Ymd', $wkstart);
$nextStr = translate('Next');
$prevStr = translate('Previous');
print_header(array('js/popups.php/true'));
ob_start();
echo '
<div style="width:99%;">
<a title="' . $prevStr . '" class="prev" href="view_v.php?id=' . $id . '&date=' . $prevdate . '"><img src="images/leftarrow.gif" alt="' . $prevStr . '" /></a>
<a title="' . $nextStr . '" class="next" href="view_v.php?id=' . $id . '&date=' . $nextdate . '"><img src="images/rightarrow.gif" alt="' . $nextStr . '" /></a>
<div class="title">
<span class="date">' . date_to_str($thisdate, '', false) . ' - ' . date_to_str(date('Ymd', $wkend), '', false) . '</span><br />
<span class="viewname">' . htmlspecialchars($view_name) . '</span>
</div>
</div><br />';
// .
// The table has names across the top and dates for rows. Since we need to spit
// out an entire row before we can move to the next date, we'll save up all the
// HTML for each cell and then print it out when we're done..
// Additionally, we only want to put at most 6 users in one table since
// any more than that doesn't really fit in the page.
// .
// Get users in this view.
$viewusers = view_get_user_list($id);
$viewusercnt = count($viewusers);
if ($viewusercnt == 0) {
// This could happen if user_sees_only_his_groups = Y and
示例3: list_unapproved
function list_unapproved($user)
{
global $temp_fullname, $key, $login;
//echo "Listing events for $user <BR>";
echo "<UL>\n";
$sql = "SELECT webcal_entry.cal_id, webcal_entry.cal_name, " . "webcal_entry.cal_description, " . "webcal_entry.cal_priority, webcal_entry.cal_date, " . "webcal_entry.cal_time, webcal_entry.cal_duration, " . "webcal_entry_user.cal_status " . "FROM webcal_entry, webcal_entry_user " . "WHERE webcal_entry.cal_id = webcal_entry_user.cal_id " . "AND ( webcal_entry.cal_ext_for_id IS NULL " . "OR webcal_entry.cal_ext_for_id = 0 ) AND " . "webcal_entry_user.cal_login = '{$user}' AND " . "webcal_entry_user.cal_status = 'W' " . "ORDER BY webcal_entry.cal_date";
$res = dbi_query($sql);
$count = 0;
$eventinfo = "";
if ($res) {
while ($row = dbi_fetch_row($res)) {
$key++;
$id = $row[0];
$name = $row[1];
$description = $row[2];
$pri = $row[3];
$date = $row[4];
$time = $row[5];
$duration = $row[6];
$status = $row[7];
$divname = "eventinfo-{$id}-{$key}";
echo "<LI><A CLASS=\"entry\" HREF=\"view_entry.php?id={$id}";
echo "\" onMouseOver=\"window.status='" . translate("View this entry") . "'; show(event, '{$divname}'); return true;\" onMouseOut=\"hide('{$divname}'); return true;\">";
$timestr = "";
if ($time > 0) {
$timestr = display_time($time);
if ($duration > 0) {
// calc end time
$h = (int) ($time / 10000);
$m = $time / 100 % 100;
$m += $duration;
$d = $duration;
while ($m >= 60) {
$h++;
$m -= 60;
}
$end_time = sprintf("%02d%02d00", $h, $m);
$timestr .= " - " . display_time($end_time);
}
}
echo htmlspecialchars($name);
echo "</A>";
echo " (" . date_to_str($date) . ")\n";
echo ": <A HREF=\"approve_entry.php?id={$id}&ret=list";
if ($user == "__public__") {
echo "&public=1";
}
echo "\" CLASS=\"navlinks\" onClick=\"return confirm('" . translate("Approve this entry?") . "');\">" . translate("Approve/Confirm") . "</A>, ";
echo "<A HREF=\"reject_entry.php?id={$id}&ret=list";
if ($user == "__public__") {
echo "&public=1";
}
echo "\" CLASS=\"navlinks\" onClick=\"return confirm('" . translate("Reject this entry?") . "');\">" . translate("Reject") . "</A>";
$eventinfo .= build_event_popup($divname, $user, $description, $timestr, $time);
$count++;
}
dbi_free_result($res);
}
echo "</UL><P>\n";
if ($count == 0) {
user_load_variables($user, "temp_");
echo translate("No unapproved events for") . " " . $temp_fullname . ".";
} else {
echo $eventinfo;
}
}
示例4: date_to_str
</td></tr>
</table>
</td><td class="aligncenter aligntop">
<br />
<!-- BEGIN EXAMPLE MONTH -->
<table style="width:90%; background-color:<?php
echo $BGCOLOR;
?>
"><tr>
<td width="1%" rowspan="3"> </td>
<td style="text-align:center; color:<?php
echo $H2COLOR;
?>
; font-weight:bold;"><?php
echo date_to_str($dateYmd, $DATE_FORMAT_MY, false);
?>
</td>
<td width="1%" rowspan="3"> </td></tr>
<tr><td bgcolor="<?php
echo $BGCOLOR;
?>
">
<?php
set_today($dateYmd);
echo display_month(date('m'), date('Y'), true);
?>
</td></tr>
<tr><td> </td></tr>
</table>
<!-- END EXAMPLE MONTH -->
示例5: check_for_conflicts
function check_for_conflicts($dates, $duration, $hour, $minute, $participants, $login, $id)
{
global $single_user_login, $single_user;
global $repeated_events, $limit_appts, $limit_appts_number;
if (!count($dates)) {
return false;
}
$evtcnt = array();
$sql = "SELECT distinct webcal_entry_user.cal_login, webcal_entry.cal_time," . "webcal_entry.cal_duration, webcal_entry.cal_name, " . "webcal_entry.cal_id, webcal_entry.cal_ext_for_id, " . "webcal_entry.cal_access, " . "webcal_entry_user.cal_status, webcal_entry.cal_date " . "FROM webcal_entry, webcal_entry_user " . "WHERE webcal_entry.cal_id = webcal_entry_user.cal_id " . "AND (";
for ($x = 0; $x < count($dates); $x++) {
if ($x != 0) {
$sql .= " OR ";
}
$sql .= "webcal_entry.cal_date = " . date("Ymd", $dates[$x]);
}
$sql .= ") AND webcal_entry.cal_time >= 0 " . "AND webcal_entry_user.cal_status IN ('A','W') AND ( ";
if ($single_user == "Y") {
$participants[0] = $single_user_login;
} else {
if (strlen($participants[0]) == 0) {
// likely called from a form with 1 user
$participants[0] = $login;
}
}
for ($i = 0; $i < count($participants); $i++) {
if ($i > 0) {
$sql .= " OR ";
}
$sql .= " webcal_entry_user.cal_login = '" . $participants[$i] . "'";
}
$sql .= " )";
// make sure we don't get something past the end date of the
// event we are saving.
//echo "SQL: $sql<P>";
$conflicts = "";
$res = dbi_query($sql);
$found = array();
$count = 0;
if ($res) {
$time1 = sprintf("%d%02d00", $hour, $minute);
$duration1 = sprintf("%d", $duration);
while ($row = dbi_fetch_row($res)) {
//Add to an array to see if it has been found already for the next part.
$found[$count++] = $row[4];
// see if either event overlaps one another
if ($row[4] != $id && (empty($row[5]) || $row[5] != $id)) {
$time2 = $row[1];
$duration2 = $row[2];
$cntkey = $user . "-" . $row[8];
$evtcnt[$cntkey]++;
$over_limit = 0;
if ($limit_appts == "Y" && $limit_appts_number > 0 && $evtcnt[$cntkey] >= $limit_appts_number) {
$over_limit = 1;
}
if ($over_limit || times_overlap($time1, $duration1, $time2, $duration2)) {
$conflicts .= "<LI>";
if ($single_user == "Y") {
$conflicts .= "{$row['0']}: ";
}
if ($row[6] == 'R' && $row[0] != $login) {
$conflicts .= "(" . translate("Private") . ")";
} else {
$conflicts .= "<A HREF=\"view_entry.php?id={$row['4']}";
if ($user != $login) {
$conflicts .= "&user={$user}";
}
$conflicts .= "\">{$row['3']}</A>";
}
if ($duration2 == 24 * 60) {
$conflicts .= " (" . translate("All day event") . ")";
} else {
$conflicts .= " (" . display_time($time2);
if ($duration2 > 0) {
$conflicts .= "-" . display_time(add_duration($time2, $duration2));
}
$conflicts .= ")";
}
$conflicts .= " on " . date_to_str($row[8]);
if ($over_limit) {
$tmp = translate("exceeds limit of XXX events per day");
$tmp = str_replace("XXX", $limit_appts_number, $tmp);
$conflicts .= " (" . $tmp . ")";
}
}
}
}
dbi_free_result($res);
} else {
echo translate("Database error") . ": " . dbi_error();
exit;
}
//echo "<br>hello";
for ($q = 0; $q < count($participants); $q++) {
$time1 = sprintf("%d%02d00", $hour, $minute);
$duration1 = sprintf("%d", $duration);
//This date filter is not necessary for functional reasons, but it eliminates some of the
//events that couldn't possibly match. This could be made much more complex to put more
//of the searching work onto the database server, or it could be dropped all together to put
//the searching work onto the client.
$date_filter = "AND (webcal_entry.cal_date <= " . date("Ymd", $dates[count($dates) - 1]);
//.........这里部分代码省略.........
示例6: dbi_query
$sql .= "ORDER BY webcal_entry_log.cal_log_id DESC";
$res = dbi_query($sql);
$nextpage = "";
if ($res) {
$num = 0;
while ($row = dbi_fetch_row($res)) {
$num++;
if ($num > $PAGE_SIZE) {
$nextpage = $row[7];
break;
} else {
echo "<tr";
if ($num % 2) {
echo " class=\"odd\"";
}
echo "><td>\n" . $row[0] . "</td><td>\n" . $row[1] . "</td><td>\n" . date_to_str($row[3]) . " " . display_time($row[4]) . "</td><td>\n" . "<a title=\"" . htmlspecialchars($row[6]) . "\" href=\"view_entry.php?id={$row['5']}\">" . htmlspecialchars($row[6]) . "</a></td><td>\n";
if ($row[2] == $LOG_CREATE) {
etranslate("Event created");
} else {
if ($row[2] == $LOG_APPROVE) {
etranslate("Event approved");
} else {
if ($row[2] == $LOG_REJECT) {
etranslate("Event rejected");
} else {
if ($row[2] == $LOG_UPDATE) {
etranslate("Event updated");
} else {
if ($row[2] == $LOG_DELETE) {
etranslate("Event deleted");
} else {
示例7: str_replace
for ($i = 0, $cnt = count($views); $i < $cnt; $i++) {
if ($views[$i]['cal_is_global'] != 'Y' && ($prad || $views[$i]['cal_owner'] != $user)) {
continue;
}
$xurl = $views[$i]['url'];
$xurl_strip = str_replace('&', '&', $xurl);
$user_vu .= $option . $xurl . '"' . ($tmp == $xurl_strip ? $selected : '') . '>' . htmlspecialchars($views[$i]['cal_name']) . '</option>';
}
foreach (array('BGCOLOR' => translate('Document background'), 'H2COLOR' => translate('Document title'), 'TEXTCOLOR' => translate('Document text'), 'MYEVENTS' => translate('My event text'), 'TABLEBG' => translate('Table grid color'), 'THBG' => translate('Table header background'), 'THFG' => translate('Table header text'), 'CELLBG' => translate('Table cell background'), 'TODAYCELLBG' => translate('Table cell background for current day'), 'HASEVENTSBG' => translate('Table cell background for days with events'), 'WEEKENDBG' => translate('Table cell background for weekends'), 'OTHERMONTHBG' => translate('Table cell background for other month'), 'WEEKNUMBER' => translate('Week number color'), 'POPUP_BG' => translate('Event popup background'), 'POPUP_FG' => translate('Event popup text')) as $k => $v) {
$color_sets .= print_color_input_html($k, $v);
}
$example_month = '
<!-- BEGIN EXAMPLE MONTH -->
<div id="example_month">
<p>' . date_to_str(date('Ymd'), $DATE_FORMAT_MY, false) . '</p>' . display_month(date('m'), date('Y'), true) . '
</div>
<!-- END EXAMPLE MONTH -->
';
/* Save either system or user preferences.
*
* @param string $prefs
* @param string $src
* @param bool _SYSTEM_ = true
* user = false
*/
function save_pref($prefs, $src)
{
global $error, $my_theme, $prad;
if (!$prad) {
global $prefuser;
示例8: translate
if (!dbi_query($sql)) {
$error = translate("Database error") . ": " . dbi_error();
}
// send mail notification if enabled
// TODO: move this code into a function...
if ($external_notifications == "Y" && $send_email != "N" && strlen($ext_emails[$i]) > 0) {
$fmtdate = sprintf("%04d%02d%02d", $year, $month, $day);
// Strip [\d] from duplicate Names before emailing
$ext_names[$i] = trim(preg_replace('/\\[[\\d]]/', "", $ext_names[$i]));
$msg = translate("Hello") . ", " . $ext_names[$i] . ".\n\n";
if ($newevent) {
$msg .= translate("A new appointment has been made for you by");
} else {
$msg .= translate("An appointment has been updated by");
}
$msg .= " " . $login_fullname . ". " . translate("The subject is") . " \"" . $name . "\"\n\n" . translate("The description is") . " \"" . $description . "\"\n" . translate("Date") . ": " . date_to_str($fmtdate) . "\n" . (empty($hour) && empty($minute) ? "" : translate("Time") . ": " . display_time($hour * 10000 + $minute * 100) . "\n") . translate("Please look on") . " " . translate($application_name) . ".";
// add URL to event, if we can figure it out
/*
if ( ! empty ( $server_url ) ) {
$url = $server_url . "view_entry.php?id=" . $id;
$msg .= "\n\n" . $url;
}
*/
if (strlen($from)) {
$extra_hdrs = "From: {$from}\r\nX-Mailer: " . translate($application_name);
} else {
$extra_hdrs = "X-Mailer: " . translate($application_name);
}
mail($ext_emails[$i], translate($application_name) . " " . translate("Notification") . ": " . $name, utf8_decode(html_to_8bits($msg)), $extra_hdrs);
}
}
示例9: event_to_text
function event_to_text($id, $date, $time, $duration, $name, $description, $status, $pri, $access, $event_owner)
{
global $login, $user, $event_template, $report_id, $allow_html_description;
$time_str = $start_time_str = $end_time_str = '';
if ($duration == 24 * 60) {
$time_str = translate("All day event");
} else {
if ($time == -1) {
$time_str = translate("Untimed event");
} else {
$time_str = display_time($time);
$start_time_str = $time_str;
$time_short = preg_replace("/(:00)/", '', $time_str);
if ($duration > 0) {
if ($duration == 24 * 60) {
$time_str = translate("All day event");
} else {
// calc end time
$h = (int) ($time / 10000);
$m = $time / 100 % 100;
$m += $duration;
$d = $duration;
while ($m >= 60) {
$h++;
$m -= 60;
}
$end_time = sprintf("%02d%02d00", $h, $m);
$time_str .= " - " . display_time($end_time);
$end_time_str = display_time($end_time);
}
}
}
}
if ($login != $user && $access == 'R' && strlen($user)) {
$name_str = "(" . translate("Private") . ")";
$description_str = translate("This event is confidential");
} else {
if ($login != $event_owner && $access == 'R' && strlen($event_owner)) {
$name_str = "(" . translate("Private") . ")";
$description_str = translate("This event is confidential");
} else {
$name_str = htmlspecialchars($name);
if (!empty($allow_html_description) && $allow_html_description == 'Y') {
$str = str_replace('&', '&', $description);
$description_str = str_replace('&amp;', '&', $str);
if (strstr($description_str, "<") && strstr($description_str, ">")) {
// found some HTML
} else {
// No HTML found. Add line breaks.
$description_str = nl2br($description_str);
}
} else {
$description_str = nl2br(activate_urls(htmlspecialchars($description)));
}
}
}
$date_str = date_to_str($date, "", false);
$date_full_str = date_to_str($date, "", true, false);
if ($duration > 0) {
$duration_str = $duration . ' ' . translate("minutes");
} else {
$duration_str = '';
}
if ($pri == 1) {
$pri_str = translate("Low");
} else {
if ($pri == 2) {
$pri_str = translate("Medium");
} else {
if ($pri == 3) {
$pri_str = translate("High");
}
}
}
if ($status == 'W') {
$status_str = translate("Waiting for approval");
} else {
if ($status == 'D') {
$status_str = translate("Deleted");
} else {
if ($status == 'R') {
$status_str = translate("Rejected");
} else {
if ($status == 'A') {
$status_str = translate("Approved");
} else {
$status_str = translate("Unknown");
}
}
}
}
$href_str = "view_entry.php?id={$id}";
// Replace all variables in the event template.
$text = $event_template;
$text = str_replace('${name}', $name_str, $text);
$text = str_replace('${description}', $description_str, $text);
$text = str_replace('${date}', $date_str, $text);
$text = str_replace('${dateYmd}', $date, $text);
$text = str_replace('${fulldate}', $date_full_str, $text);
$text = str_replace('${time}', $time_str, $text);
//.........这里部分代码省略.........
示例10: dbi_query
$sql .= "ORDER BY webcal_entry_log.cal_log_id DESC";
$res = dbi_query($sql);
$nextpage = "";
if ($res) {
$font = "<FONT SIZE=\"-1\">";
$num = 0;
while ($row = dbi_fetch_row($res)) {
$num++;
if ($num > $PAGE_SIZE) {
$nextpage = $row[7];
break;
} else {
echo "<TR>";
echo "<TD VALIGN=\"top\" BGCOLOR=\"{$CELLBG}\">" . $font . $row[0] . "</FONT></TD>";
echo "<TD VALIGN=\"top\" BGCOLOR=\"{$CELLBG}\">" . $font . $row[1] . "</FONT></TD>";
echo "<TD VALIGN=\"top\" BGCOLOR=\"{$CELLBG}\">" . $font . date_to_str($row[3]) . " " . display_time($row[4]) . "</FONT></TD>";
echo "<TD VALIGN=\"top\" BGCOLOR=\"{$CELLBG}\">" . $font . "<A HREF=\"view_entry.php?id={$row['5']}\" CLASS=\"navlinks\">" . htmlspecialchars($row[6]) . "</A></FONT></TD>";
echo "<TD VALIGN=\"top\" BGCOLOR=\"{$CELLBG}\">" . $font;
if ($row[2] == $LOG_CREATE) {
etranslate("Event created");
} else {
if ($row[2] == $LOG_APPROVE) {
etranslate("Event approved");
} else {
if ($row[2] == $LOG_REJECT) {
etranslate("Event rejected");
} else {
if ($row[2] == $LOG_UPDATE) {
etranslate("Event updated");
} else {
if ($row[2] == $LOG_DELETE) {
示例11: format_site_extras
function format_site_extras($extras, $filter = '')
{
global $site_extras;
if (empty($site_extras) || empty($extras)) {
return;
}
$ret = array();
$extra_view = 1;
foreach ($site_extras as $site_extra) {
$data = '';
$extra_name = $site_extra[0];
$extra_desc = $site_extra[1];
$extra_type = $site_extra[2];
$extra_arg1 = $site_extra[3];
$extra_arg2 = $site_extra[4];
if (!empty($site_extra[5]) && !empty($filter)) {
$extra_view = $site_extra[5] & $filter;
}
if (!empty($extras[$extra_name]) && !empty($extras[$extra_name]['cal_name']) && !empty($extra_view)) {
$name = translate($extra_desc);
if ($extra_type == EXTRA_DATE) {
if ($extras[$extra_name]['cal_date'] > 0) {
$data = date_to_str($extras[$extra_name]['cal_date']);
}
} elseif ($extra_type == EXTRA_TEXT || $extra_type == EXTRA_MULTILINETEXT) {
$data = nl2br($extras[$extra_name]['cal_data']);
} elseif ($extra_type == EXTRA_RADIO && !empty($extra_arg1[$extras[$extra_name]['cal_data']])) {
$data .= $extra_arg1[$extras[$extra_name]['cal_data']];
} else {
$data .= $extras[$extra_name]['cal_data'];
}
$ret[$extra_name] = array('name' => $name, 'data' => $data);
}
}
return $ret;
}
示例12: count
if (is_array($ext_names) && is_array($ext_emails)) {
$ext_namescnt = count($ext_names);
for ($i = 0; $i < $ext_namescnt; $i++) {
if (strlen($ext_names[$i])) {
if (!dbi_execute('INSERT INTO webcal_entry_ext_user
( cal_id, cal_fullname, cal_email ) VALUES ( ?, ?, ? )', array($id, $ext_names[$i], strlen($ext_emails[$i]) ? $ext_emails[$i] : null))) {
$error = $dberror . dbi_error();
}
// Send mail notification if enabled.
// TODO: Move this code into a function...
if ($EXTERNAL_NOTIFICATIONS == 'Y' && $SEND_EMAIL != 'N' && strlen($ext_emails[$i]) > 0) {
if (!$newevent && isset($EXTERNAL_UPDATES) && $EXTERNAL_UPDATES == 'Y' || $newevent) {
$fmtdate = $timetype == 'T' ? date('Ymd', $eventstart) : gmdate('Ymd', $eventstart);
// Strip [\d] from duplicate Names before emailing.
$ext_names[$i] = trim(preg_replace('/\\[[\\d]]/', '', $ext_names[$i]));
$msg = str_replace('XXX', $ext_names[$i], $helloStr) . "\n\n" . str_replace('XXX', $login_fullname, $newevent ? $newAppStr : $updAppStr) . "\n" . str_replace('XXX', $name, $subjStr) . "\n\n" . str_replace('XXX', $description, $descStr) . "\n\n" . str_replace('XXX', date_to_str($fmtdate), $dateStr) . "\n" . ($timetype == 'T' ? str_replace('XXX', display_time('', !empty($GENERAL_USE_GMT) && $GENERAL_USE_GMT == 'Y' ? 3 : 6, $eventstart), $timeStr) : '') . $extra_email_data;
// Don't send HTML to external adresses.
// Always attach iCalendar file to external users
$mail->WC_Send($login_fullname, $ext_emails[$i], $ext_names[$i], $name, $msg, 'N', $from, $id);
}
}
}
}
}
//end external mail
}
//end empty error
// If we were editing this event, then go back to the last view (day, month, week).
// If this is a new event,
// then go to the preferred view for the date range where this event was added.
if (empty($error) && empty($mailerError)) {
示例13: dbtable_html_list
function dbtable_html_list($tablear, $tablename, $href, $fields, $keys, $order)
{
global $THBG, $THFG, $CELLBG;
if (!is_array($tablear)) {
return "Error: dbtable_to_html_list parameter 1 is not an array!\n<br />\n";
}
if (!is_array($fields)) {
return "Error: dbtable_to_html_list parameter 2 is not an array!\n<br />\n";
}
if (!is_array($keys)) {
return "Error: dbtable_to_html_list parameter 3 is not an array!\n<br />\n";
}
$ret = "<table style=\"border-width:0px;\" cellspacing=\"0\" cellpadding=\"0\">" . "<tr><td style=\"background-color:#000000;\">" . "<table style=\"border-width:0px; width:100%;\" cellspacing=\"1\" cellpadding=\"2\">" . "<tr><td style=\"width:100%; background-color:{$CELLBG};\">" . "<table style=\"border-width:0px; width:100%;\">\n";
// header
$ret .= "<tr>";
for ($i = 0; $i < count($fields); $i++) {
$ind = dbtable_get_field_index($tablear, $fields[$i]);
/*
if ( $ind < 0 )
echo "Error: dbtable_html_list invalid fieldname \"$fields[$i]\" $i\n"; exit;
*/
if (empty($tablear[$ind]["hide"])) {
$ret .= "<th style=\"background-color:{$THBG}; color:{$THFG};\">" . $tablear[$ind]["prompt"] . "</th>";
}
}
$ret .= "</tr>\n";
$sql = "SELECT " . $fields[0];
for ($i = 1; $i < count($fields); $i++) {
$sql .= ", " . $fields[$i];
}
$sql .= " FROM " . $tablename . " ";
if (is_array($keys) && count($keys) > 0) {
$sql .= "WHERE ";
$first = 1;
for ($i = 0; $i < count($tablear); $i++) {
if (!empty($tablear[$i]["iskey"])) {
if (empty($keys[$tablear[$i]["name"]])) {
//echo "Error: key value for " . $tablear[$i]["name"] . " not set.\n";
//exit;
} else {
if ($first) {
$first = 0;
} else {
$sql .= " AND ";
}
$sql .= $tablear[$i]["name"] . " = ";
if ($tablear[$i]["type"] == "int" || $tablear[$i]["type"] == "float" || $tablear[$i]["type"] == "date") {
$sql .= $keys[$tablear[$i]["name"]];
} else {
$sql .= "'" . $keys[$tablear[$i]["name"]] . "'";
}
}
}
}
}
if (!empty($order)) {
$sql .= " ORDER BY " . $order;
}
//echo "SQL: $sql<br />\n";
$res = dbi_query($sql);
if ($res) {
while ($row = dbi_fetch_row($res)) {
$ret .= "<tr>";
$first_href = 1;
$first = 1;
for ($i = 0; $i < count($fields); $i++) {
// check data type (date)
$ind = dbtable_get_field_index($tablear, $fields[$i]);
if (empty($tablear[$ind]["hide"])) {
$ret .= "<td style=\"background-color:{$CELLBG}; vertical-align:top;\">";
if ($tablear[$ind]["type"] == "date") {
$val = date_to_str($row[$i], "", 1, 1);
} else {
if ($tablear[$ind]["type"] == "dbdate") {
$y = substr($row[$i], 0, 4);
$m = substr($row[$i], 5, 2);
$d = substr($row[$i], 8, 2);
$date = sprintf("%04d%02d%02d", $y, $m, $d);
$val = date_to_str($date, "", 1, 1);
} else {
$val = htmlentities($row[$i]);
}
}
if ($first_href && !empty($href)) {
$first_href = 0;
$url = $href;
for ($j = count($fields) - 1; $j >= 0; $j--) {
$url = str_replace("%{$j}", $row[$j], $url);
}
$ret .= "<a href=\"{$url}\">" . $val . "</a>";
} else {
$ret .= $val;
}
$ret .= "</td>";
}
}
$ret .= "</tr>\n";
}
} else {
echo translate("Database error") . ": " . dbi_error();
//.........这里部分代码省略.........
示例14: read_repeated_events
/* Pre-Load the repeated events for quickier access. */
$repeated_events = read_repeated_events(strlen($user) ? $user : $login, $evStart, $evEnd, $cat_id);
/* Pre-load the non-repeating events for quicker access. */
// Start the search ONE_WEEK early to account for cross-day events.
$events = read_events(strlen($user) ? $user : $login, $evStart - 604800, $evEnd, $cat_id);
if (empty($DISPLAY_TASKS_IN_GRID) || $DISPLAY_TASKS_IN_GRID == 'Y') {
/* Pre-load tasks for quicker access. */
$tasks = read_tasks(!empty($user) && strlen($user) && $is_assistant ? $user : $login, $wkend, $cat_id);
}
$eventsStr = $filler = $headerStr = $minical_tasks = $untimedStr = '';
$navStr = display_navigation('week');
for ($i = $start_ind; $i <= $end_ind; $i++) {
$days[$i] = $wkstart + 86400 * $i + 43200;
$weekdays[$i] = weekday_name(($i + $WEEK_START) % 7, $DISPLAY_LONG_DAYS);
$dateYmd = date('Ymd', $days[$i]);
$header[$i] = $weekdays[$i] . '<br />' . date_to_str($dateYmd, $DATE_FORMAT_MD, false, true);
// .
// Generate header row.
$class = $dateYmd == date('Ymd', $today) ? ' class="today"' : (is_weekend($days[$i]) ? ' class="weekend"' : '');
$headerStr .= '
<th ' . $class . '>' . ($can_add ? html_for_add_icon($dateYmd, '', '', $user) : '') . '<p style="margin:.75em 0 0 0"><a href="day.php?' . $u_url . 'date=' . $dateYmd . $caturl . '">' . $header[$i] . '</a></p></th>';
$date = date('Ymd', $days[$i]);
$hour_arr = $rowspan_arr = $tk = array();
// .
// Get, combine and sort, static and repeating events for this date.
$ev = combine_and_sort_events(get_entries($date, $get_unapproved), get_repeating_entries($user, $date));
// .
// Then sort in any tasks due for this day and before.
$ev = combine_and_sort_events($ev, $date >= date('Ymd') ? get_tasks($date, $get_unapproved) : $tk);
for ($j = 0, $cnt = count($ev); $j < $cnt; $j++) {
if ($get_unapproved || $ev[$j]->getStatus() == 'A') {
示例15: dbi_free_result
dbi_free_result($res);
}
if ($time != '-1') {
$hour = substr($time, 0, 2);
$minute = substr($time, 2, 2);
}
for ($i = 0; $i < count($partlogin); $i++) {
// does this user want email for this?
$send_user_mail = get_pref_setting($partlogin[$i], "EMAIL_EVENT_REJECTED");
user_load_variables($partlogin[$i], "temp");
$user_language = get_pref_setting($partlogin[$i], "LANGUAGE");
if ($send_user_mail == "Y" && strlen($tempemail) && $send_email != "N") {
if ($GLOBALS['LANGUAGE'] != $user_language && !empty($user_language) && $user_language != 'none') {
reset_language($user_language);
}
$msg = translate("Hello") . ", " . $tempfullname . ".\n\n" . translate("An appointment has been rejected by") . " " . $login_fullname . ". " . translate("The subject was") . " \"" . $name . " \"\n" . translate("The description is") . " \"" . $description . "\"\n" . translate("Date") . ": " . date_to_str($fmtdate) . "\n" . (empty($hour) && empty($minute) ? "" : translate("Time") . ": " . display_time($hour * 10000 + $minute * 100)) . "\n\n\n";
if (!empty($server_url)) {
$url = $server_url . "view_entry.php?id=" . $id;
$msg .= "\n\n" . $url;
}
$from = $email_fallback_from;
if (strlen($login_email)) {
$from = $login_email;
}
$extra_hdrs = "From: {$from}\r\nX-Mailer: " . translate("Title");
mail($tempemail, translate($application_name) . " " . translate("Notification") . ": " . $name, html_to_8bits($msg), $extra_hdrs);
activity_log($id, $login, $partlogin[$i], $LOG_NOTIFICATION, "Event rejected by {$app_user}");
}
}
}
if (empty($error)) {