本文整理汇总了PHP中user_load_variables函数的典型用法代码示例。如果您正苦于以下问题:PHP user_load_variables函数的具体用法?PHP user_load_variables怎么用?PHP user_load_variables使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了user_load_variables函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getGetValue
$user_firstname = getGetValue('firstname');
$user_lastname = getGetValue('lastname');
$user_login = getGetValue('username');
$user_password = getGetValue('password');
// This error should not happen in a properly written client,
// so no need to translate it.
if (empty($error) && empty($user_login)) {
$error = 'Username cannot be blank.';
}
// Check for invalid characters in the login.
if (empty($error) && addslashes($user_login) != $user_login) {
$error = translate('Invalid characters in login');
}
// Check to see if username exists...
if (empty($error)) {
if (user_load_variables($user_login, 'old_')) {
// username does already exist...
if ($add) {
$error = str_replace('XXX', ws_escape_xml($user_login), translate('Username XXX already exists.'));
}
} else {
// username does not already exist...
if (!$add || $delete) {
$error = str_replace('XXX', ws_escape_xml($user_login), translate('Username XXX does not exist.'));
}
}
}
// If adding a user, make sure a password was provided
if (empty($error) && $add && empty($user_password)) {
$error = translate('You have not entered a password.');
}
示例2: translate
}
// Make sure they specified a username
if (empty($user)) {
echo "<?xml version=\"1.0\" encoding=\"utf8\"?>\n<!DOCTYPE html\n PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n \"DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n\n <head>\n<title>" . translate("Error") . "</title>\n</head>\n" . "<body>\n<h2>" . translate("Error") . "</h2>\n" . "No user specified.\n</body>\n</html>";
}
// Load user preferences (to get the USER_PUBLISH_ENABLED and
// DISPLAY_UNAPPROVED setting for this user).
$login = $user;
load_user_preferences();
if (empty($USER_PUBLISH_ENABLED) || $USER_PUBLISH_ENABLED != 'Y') {
header("Content-Type: text/plain");
etranslate("You are not authorized");
exit;
}
// Load user name, etc.
user_load_variables($user, "publish_");
function get_events_for_publish()
{
global $user;
global $DISPLAY_UNAPPROVED;
// We exporting repeating events only with the pilot-datebook CSV format
$sql = "SELECT webcal_entry.cal_id, webcal_entry.cal_name " . ", webcal_entry.cal_priority, webcal_entry.cal_date " . ", webcal_entry.cal_time " . ", webcal_entry_user.cal_status, webcal_entry.cal_create_by " . ", webcal_entry.cal_access, webcal_entry.cal_duration " . ", webcal_entry.cal_description " . ", webcal_entry_user.cal_category " . "FROM webcal_entry, webcal_entry_user ";
$sql .= "WHERE webcal_entry.cal_id = webcal_entry_user.cal_id AND " . "webcal_entry_user.cal_login = '" . $user . "'";
// Include unapproved events if the user has asked to do so in
// their preferences.
if ($DISPLAY_UNAPPROVED == "N" || $user == "__public__") {
$sql .= " AND webcal_entry_user.cal_status = 'A'";
} else {
$sql .= " AND webcal_entry_user.cal_status IN ('W','A')";
}
$sql .= " ORDER BY webcal_entry.cal_date";
示例3: strftime
<?php
for ($date = $wkstart, $h = 0; date("Ymd", $date) <= date("Ymd", $wkend); $date += 24 * 3600, $h++) {
$wday = strftime("%w", $date);
$weekday = weekday_short_name($wday);
if (date("Ymd", $date) == date("Ymd", $today)) {
echo "<th class=\"today\" style=\"width:{$tdw}%;\">";
} else {
echo "<th style=\"width:{$tdw}%;\">";
}
echo $weekday . " " . round(date("d", $date)) . "</th>\n";
}
echo "</tr>\n";
for ($i = 0; $i < count($viewusers); $i++) {
echo "\n<tr>\n";
$user = $viewusers[$i];
user_load_variables($user, "temp");
echo "<th class=\"row\" style=\"width:{$tdw}%;\">{$tempfullname}</th>";
for ($date = $wkstart, $h = 0; date("Ymd", $date) <= date("Ymd", $wkend); $date += 24 * 3600, $h++) {
$wday = strftime("%w", $date);
if ($wday == 0 || $wday == 6) {
echo "<td class=\"weekend\" style=\"width:{$tdw}%;\">";
} else {
echo "<td style=\"width:{$tdw}%;\">";
}
$events = $e_save[$i];
$repeated_events = $re_save[$i];
if (empty($add_link_in_views) || $add_link_in_views != "N") {
echo html_for_add_icon(date("Ymd", $date), "", "", $user);
}
print_date_entries(date("Ymd", $date), $user, true);
echo "</td>";
示例4: str_replace
}
$cookie_path = str_replace("login.php", "", $PHP_SELF);
//echo "Cookie path: $cookie_path\n";
$out = "<login>\n";
if ($single_user == "Y") {
// No login for single-user mode
$out .= "<error>No login required for single-user mode</error>\n";
} else {
if ($use_http_auth) {
// There is no login page when using HTTP authorization
$out .= "<error>No login required for HTTP authentication</error>\n";
} else {
if (!empty($login) && !empty($password)) {
$login = trim($login);
if (user_valid_login($login, $password)) {
user_load_variables($login, "");
// set login to expire in 365 days
srand((double) microtime() * 1000000);
$salt = chr(rand(ord('A'), ord('z'))) . chr(rand(ord('A'), ord('z')));
$encoded_login = encode_string($login . "|" . crypt($password, $salt));
//SetCookie ( "webcalendar_session", $encoded_login, 0, $cookie_path );
$out .= " <cookieName>webcalendar_session</cookieName>\n";
$out .= " <cookieValue>{$encoded_login}</cookieValue>\n";
if ($is_admin) {
$out .= " <admin>1</admin>\n";
}
} else {
$out .= " <error>Invalid login</error>\n";
}
}
}
示例5: build_event_popup
function build_event_popup($divname, $user, $description, $time)
{
global $login, $popup_fullnames, $popuptemp_fullname;
$ret = "<DIV ID=\"" . $divname . "\" STYLE=\"position: absolute; z-index: 20; visibility: hidden; top: 0px; left: 0px;\">\n" . "<TABLE BORDER=\"0\" WIDTH=\"30%\" CELLPADDING=\"0\" CELLSPACING=\"1\"><TR><TD BGCOLOR=\"" . $GLOBALS["POPUP_FG"] . "\">\n" . "<TABLE BORDER=\"0\" WIDTH=\"100%\" CELLPADDING=\"0\" CELLSPACING=\"1\"><TR><TD BGCOLOR=\"" . $GLOBALS["POPUP_BG"] . "\" CLASS=\"popup\">\n" . "<FONT COLOR=\"" . $GLOBALS["POPUP_FG"] . "\">";
if (empty($popup_fullnames)) {
$popup_fullnames = array();
}
if ($user != $login) {
if (empty($popup_fullnames[$user])) {
user_load_variables($user, "popuptemp_");
$popup_fullnames[$user] = $popuptemp_fullname;
}
$ret .= "<B>" . translate("User") . ":</B> {$popup_fullnames[$user]}<BR>";
}
if (strlen($time)) {
$ret .= "<B>" . translate("Time") . ":</B> {$time}<BR>";
}
$ret .= "<B>" . translate("Description") . ":</B>\n";
$ret .= nl2br(htmlspecialchars($description));
$ret .= "</FONT></TD></TR></TABLE>\n" . "</TD></TR></TABLE>\n" . "</DIV>\n";
return $ret;
}
示例6: etranslate
" href="edit_layer.php<?php
if ($updating_public) {
echo "?public=1";
}
?>
"><?php
etranslate("Add layer");
?>
</a><br /><br />
<?php
$layer_count = 1;
if ($layers) {
foreach ($layers as $layer) {
$layeruser = $layer['cal_layeruser'];
user_load_variables($layeruser, "layer");
?>
<span style="font-weight:bold;"><?php
etranslate("Layer");
?>
<?php
echo $layer_count;
?>
</span>
(<a title="<?php
etranslate("Edit layer");
?>
" href="edit_layer.php?id=<?php
echo $layer['cal_layerid'] . $u_url;
?>
"><?php
示例7: translate
$nouser = translate('No user specified');
// Make sure they specified a username.
if (empty($user)) {
echo send_doctype($errorStr);
echo <<<EOT
</head>
<body>
<h2>{$errorStr}</h2>
{$nouser}.
</body>
</html>
EOT;
exit;
}
// Load user preferences (to get the USER_PUBLISH_ENABLED and
// DISPLAY_UNAPPROVED setting for this user).
$login = $user;
load_user_preferences();
if (empty($USER_PUBLISH_ENABLED) || $USER_PUBLISH_ENABLED != 'Y') {
header('Content-Type: text/plain');
echo print_not_auth(25);
exit;
}
// Load user name, etc.
user_load_variables($user, 'publish_');
// header ( 'Content-Type: text/plain' );
header('Content-Type: text/calendar');
header('Content-Disposition: attachment; filename="' . $user . '.ics"');
$use_all_dates = true;
$type = 'publish';
export_ical();
示例8: access_user_calendar
} else {
// Check UAC.
$can_email = 'Y';
if (access_is_enabled()) {
$can_email = access_user_calendar('email', $participants[$i], $login);
}
// Don't send mail if we are editing a non-user calendar and we are the admin.
if (!$is_nonuser_admin && $can_email == 'Y') {
// Only send mail if their email address is filled in.
$do_send = get_pref_setting($participants[$i], $newevent ? 'EMAIL_EVENT_ADDED' : 'EMAIL_EVENT_UPDATED');
$htmlmail = get_pref_setting($participants[$i], 'EMAIL_HTML');
$t_format = get_pref_setting($participants[$i], 'TIME_FORMAT');
$user_TIMEZONE = get_pref_setting($participants[$i], 'TIMEZONE');
set_env('TZ', $user_TIMEZONE);
$user_language = get_pref_setting($participants[$i], 'LANGUAGE');
user_load_variables($participants[$i], 'temp');
if (boss_must_be_notified($login, $participants[$i]) && !empty($tempemail) && $do_send == 'Y' && $send_user_mail && $SEND_EMAIL != 'N') {
// We send to creator if they want it.
if ($send_own != 'Y' && $participants[$i] == $login) {
continue;
}
reset_language(empty($user_language) || $user_language == 'none' ? $LANGUAGE : $user_language);
$fmtdate = $timetype == 'T' ? date('Ymd', $eventstart) : gmdate('Ymd', $eventstart);
$msg = str_replace('XXX', $tempfullname, $helloStr) . "\n\n" . str_replace('XXX', $login_fullname, $newevent || empty($old_status[$participants[$i]]) ? $newAppStr : $updAppStr) . "\n" . str_replace('XXX', $name, $subjStr) . "\n\n" . str_replace('XXX', $description, $descStr) . "\n" . str_replace('XXX', date_to_str($fmtdate), $dateStr) . "\n" . ($timetype != 'T' ? '' : str_replace('XXX', display_time('', 2, $eventstart, $t_format), $timeStr) . "\n") . $extra_email_data . str_replace('XXX', generate_application_name(), $REQUIRE_APPROVALS == 'Y' ? translate('Please look on XXX to accept or reject this appointment.') : translate('Please look on XXX to view this appointment.'));
// Add URL to event, if we can figure it out.
if (!empty($SERVER_URL)) {
// DON'T change & to & here. Email will handle it.
$url = $SERVER_URL . 'view_entry.php?id=' . $id . '&em=1';
if ($htmlmail == 'Y') {
$url = activate_urls($url);
}
示例9: header
$WebCalendar->setLanguage();
if (empty($PUBLISH_ENABLED) || $PUBLISH_ENABLED != 'Y') {
header('Content-Type: text/plain');
// Mozilla Calendar does not bother showing errors, so they won't see this
// error message anyhow... Not sure about Apple iCal or other clients.
etranslate('Publishing Disabled (Admin)');
exit;
}
if (empty($USER_PUBLISH_RW_ENABLED) || $USER_PUBLISH_RW_ENABLED != 'Y') {
header('Content-Type: text/plain');
etranslate('Publishing Disabled (User)');
exit;
}
$prodid = 'Unnamed iCal client';
// Load user name, etc.
user_load_variables($login, 'publish_');
function dump_globals()
{
foreach ($GLOBALS as $K => $V) {
do_debug("GLOBALS[{$K}] => " . (strlen($V) < 70 ? $V : '(too long)'));
}
foreach ($GLOBALS['HTTP_POST_VARS'] as $K => $V) {
do_debug("GLOBALS[{$_POST[$K]}] => " . (strlen($V) < 70 ? $V : '(too long)'));
}
}
switch ($_SERVER['REQUEST_METHOD']) {
case 'PUT':
// do_debug ( "Importing updated remote calendar" );
$calUser = $login;
$overwrite = true;
$type = 'icalclient';
示例10: TimeMatrix
function TimeMatrix($date, $participants)
{
global $CELLBG, $TODAYCELLBG, $THFG, $THBG, $TABLEBG;
global $user_fullname, $nowYmd, $repeated_events, $events;
global $thismonth, $thisday, $thisyear;
$increment = 15;
$interval = 4;
$cell_pix = 6;
$participant_pix = '170';
//$interval = (int)(60 / $increment);
$first_hour = $GLOBALS["WORK_DAY_START_HOUR"];
$last_hour = $GLOBALS["WORK_DAY_END_HOUR"];
$hours = $last_hour - $first_hour;
$cols = $hours * $interval + 1;
$total_pix = (int) ($cell_pix * $interval * $hours + $participant_pix);
?>
<br />
<table class="matrixd" style="width:<?php
echo $total_pix;
?>
px;" cellspacing="0" cellpadding="0">
<tr><td class="matrix" colspan="<?php
echo $cols;
?>
">
<img src="pix.gif" alt="spacer" />
</td></tr>
<tr><th style="width:<?php
echo $participant_pix;
?>
px;">
<?php
etranslate("Participants");
?>
</th>
<?php
$str = '';
$MouseOut = "onmouseout=\"window.status=''; this.style.backgroundColor='" . $CELLBG . "';\"";
$CC = 1;
for ($i = $first_hour; $i < $last_hour; $i++) {
for ($j = 0; $j < $interval; $j++) {
$str .= ' <td style="width:' . $cell_pix . 'px;" id="C' . $CC . '" class="dailymatrix" ';
switch ($j) {
case 0:
if ($interval == 4) {
$k = $i <= 9 ? '0' : substr($i, 0, 1);
}
$str .= 'onmousedown="schedule_event(' . $i . ',' . $increment * $j . ");\" onmouseover=\"window.status='Schedule a " . $i . ':' . ($increment * $j <= 9 ? '0' : '') . $increment * $j . " appointment.'; this.style.backgroundColor='#CCFFCC'; return true;\" " . $MouseOut . " title=\"Schedule an appointment for " . $i . ':' . ($increment * $j <= 9 ? '0' : '') . $increment * $j . ".\">";
$str .= $k . "</td>\n";
break;
case 1:
if ($interval == 4) {
$k = $i <= 9 ? substr($i, 0, 1) : substr($i, 1, 2);
}
$str .= 'onmousedown="schedule_event(' . $i . ',' . $increment * $j . ");\" onmouseover=\"window.status='Schedule a " . $i . ':' . $increment * $j . " appointment.'; this.style.backgroundColor='#CCFFCC'; return true;\" " . $MouseOut . " title=\"Schedule an appointment for " . $i . ':' . ($increment * $j <= 9 ? '0' : '') . $increment * $j . ".\">";
$str .= $k . "</td>\n";
break;
default:
$str .= 'onmousedown="schedule_event(' . $i . ',' . $increment * $j . ");\" onmouseover=\"window.status='Schedule a " . $i . ':' . $increment * $j . " appointment.'; this.style.backgroundColor='#CCFFCC'; return true;\" " . $MouseOut . " title=\"Schedule an appointment for " . $i . ':' . ($increment * $j <= 9 ? '0' : '') . $increment * $j . ".\">";
$str .= " </td>\n";
break;
}
$CC++;
}
}
echo $str . "</tr>\n<tr><td class=\"matrix\" colspan=\"{$cols}\">\n<img src=\"pix.gif\" alt=\"spacer\" />\n</td></tr>\n";
// Display each participant
for ($i = 0; $i < count($participants); $i++) {
user_load_variables($participants[$i], "user_");
/* Pre-Load the repeated events for quckier access */
$repeated_events = read_repeated_events($participants[$i], "", $nowYmd);
/* Pre-load the non-repeating events for quicker access */
$events = read_events($participants[$i], $nowYmd, $nowYmd);
// get all the repeating events for this date and store in array $rep
$rep = get_repeating_entries($participants[$i], $nowYmd);
// get all the non-repeating events for this date and store in $ev
$ev = get_entries($participants[$i], $nowYmd);
// combine into a single array for easy processing
$ALL = array_merge($rep, $ev);
$all_events = array();
// exchange space for to keep from breaking
$user_nospace = preg_replace('/\\s/', ' ', $user_fullname);
foreach ($ALL as $E) {
$E['cal_time'] = sprintf("%06d", $E['cal_time']);
$Tmp['START'] = mktime(substr($E['cal_time'], 0, 2), substr($E['cal_time'], 2, 2), 0, $thismonth, $thisday, $thisyear);
$Tmp['END'] = $Tmp['START'] + $E['cal_duration'] * 60;
$Tmp['ID'] = $E['cal_id'];
$all_events[] = $Tmp;
}
echo "<tr>\n<th class=\"row\" style=\"width:{$participant_pix}px;\">" . $user_nospace . "</th>\n";
$col = 1;
for ($j = $first_hour; $j < $last_hour; $j++) {
for ($k = 0; $k < $interval; $k++) {
$border = $k == '0' ? ' border-left: 1px solid #000000;' : "";
$RC = $CELLBG;
$TIME = mktime(sprintf("%02d", $j), $increment * $k, 0, $thismonth, $thisday, $thisyear);
$space = " ";
foreach ($all_events as $ET) {
if ($TIME >= $ET['START'] && $TIME < $ET['END']) {
//.........这里部分代码省略.........
示例11: event_to_text
function event_to_text($event, $date)
{
global $ALLOW_HTML_DESCRIPTION, $event_template, $login, $report_id, $user;
$allDayStr = translate('All day event');
$confStr = translate('This event is confidential.');
// translate ( 'Private' )
$privStr = translate('(Private)');
$end_time_str = $start_time_str = $time_str = '';
$tempAllDay = $event->isAllDay();
$tempDurStr = $event->getDuration();
if ($tempAllDay) {
$time_str = $allDayStr;
} else {
if ($event->isUntimed()) {
$time_str = translate('Untimed event');
} else {
$start_time_str = $time_str = display_time($event->getDateTime());
$time_short = getShortTime($time_str);
if ($tempDurStr > 0) {
if ($tempAllDay) {
$time_str = $allDayStr;
} else {
$tempEDT = $event->getEndDateTime();
$end_time_str = display_time($tempEDT);
$time_str .= ' - ' . display_time($tempEDT);
}
}
}
}
$name = $event->getName();
$tempAcc = $event->getAccess();
$tempDesc = $event->getDescription();
$tempExtForID = $event->getExtForID();
$tempLog = $event->getLogin();
if ($tempExtForID != '') {
$id = $tempExtForID;
// translate ( 'cont.' )
$name .= ' ' . translate('(cont.)');
} else {
$id = $event->getID();
}
if ($tempAcc == 'R') {
if ($login != $user && strlen($user) || $login != $tempLog && strlen($tempLog)) {
$description_str = $confStr;
$name_str = $privStr;
}
} else {
$name_str = htmlspecialchars($name);
if (!empty($ALLOW_HTML_DESCRIPTION) && $ALLOW_HTML_DESCRIPTION == 'Y') {
$str = str_replace('&', '&', $tempDesc);
//fix any broken special characters
$str = preg_replace("/&(#[0-9]+|[a-z]+);/i", "&\$1;", $str);
$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($tempDesc)));
}
}
$date_full_str = date_to_str($date);
$date_str = date_to_str($date, '', false);
$duration_str = $tempDurStr > 0 ? $tempDurStr . ' ' . translate('minutes') : '';
$temp = $event->getPriority();
$pri_str = $temp > 6 ? translate('Low') : ($temp < 4 ? translate('High') : translate('Medium'));
$temp = $event->getStatus();
if ($temp == 'A') {
$status_str = translate('Approved');
} elseif ($temp == 'D') {
$status_str = translate('Deleted');
} elseif ($temp == 'R') {
$status_str = translate('Rejected');
} elseif ($temp == 'W') {
$status_str = translate('Waiting for approval');
} else {
$status_str = translate('Unknown');
}
$location = $event->getLocation();
$url = $event->getUrl();
$href_str = 'view_entry.php?id=' . $id;
// Get user's fullname.
user_load_variables($tempLog, 'report_');
$fullname = $GLOBALS['report_fullname'];
// Replace all variables in the event template.
$text = str_replace(array('${date}', '${dateYmd}', '${description}', '${duration}', '${endtime}', '${fulldate}', '${fullname}', '${href}', '${id}', '${location}', '${name}', '${priority}', '${report_id}', '${starttime}', '${time}', '${url}', '${user}'), array($date_str, $date, $description_str, $duration_str, $end_time_str, $date_full_str, $fullname, $href_str, $id, $location, $name_str, $pri_str, $report_id, $start_time_str, $time_str, $url, $tempLog), $event_template);
$text = replace_site_extras_in_template($text, format_site_extras(get_site_extra_fields($id), EXTRA_DISPLAY_REPORT));
return $text;
}
示例12: sprintf
$fmtdate = $row[1];
$time = sprintf("%06d", $row[2]);
dbi_free_result($res);
}
$eventstart = date_to_epoch($fmtdate . $time);
$TIME_FORMAT = 24;
for ($i = 0, $cnt = count($partlogin); $i < $cnt; $i++) {
// Log the deletion.
activity_log($id, $login, $partlogin[$i], $log_delete, '');
// Check UAC.
$can_email = access_is_enabled() ? access_user_calendar('email', $partlogin[$i], $login) : false;
// Don't email the logged in user.
if ($can_email && $partlogin[$i] != $login) {
set_env('TZ', get_pref_setting($partlogin[$i], 'TIMEZONE'));
$user_language = get_pref_setting($partlogin[$i], 'LANGUAGE');
user_load_variables($partlogin[$i], 'temp');
if (!$is_nonuser_admin && $partlogin[$i] != $login && get_pref_setting($partlogin[$i], 'EMAIL_EVENT_DELETED') == 'Y' && boss_must_be_notified($login, $partlogin[$i]) && !empty($tempemail) && $SEND_EMAIL != 'N') {
reset_language(empty($user_language) || $user_language == 'none' ? $LANGUAGE : $user_language);
// Use WebCalMailer class.
$mail->WC_Send($login_fullname, $tempemail, $tempfullname, $name, str_replace('XXX', $tempfullname, translate('Hello, XXX.')) . ".\n\n" . str_replace('XXX', $login_fullname, translate('XXX has canceled an appointment.')) . "\n" . str_replace('XXX', $name, translate('Subject XXX')) . "\"\n" . str_replace('XXX', date_to_str($thisdate), translate('Date XXX')) . "\n" . (!empty($eventtime) && $eventtime != '-1' ? str_replace('XXX', display_time('', 2, $eventstart, get_pref_setting($partlogin[$i], 'TIME_FORMAT')), translate('Time XXX')) : '') . "\n\n", get_pref_setting($partlogin[$i], 'EMAIL_HTML'), $login_email);
}
}
}
// Instead of deleting from the database...
// mark it as deleted by setting the status for each participant to "D"
// (instead of "A"/Accepted, "W"/Waiting-on-approval or "R"/Rejected).
if ($override_repeat) {
dbi_execute('INSERT INTO webcal_entry_repeats_not
( cal_id, cal_date, cal_exdate ) VALUES ( ?, ?, ? )', array($id, $date, 1));
// Should we log this to the activity log???
} else {
示例13: list_unapproved
function list_unapproved($user)
{
global $eventinfo, $key, $login, $NONUSER_ENABLED, $noret, $temp_fullname;
user_load_variables($user, 'temp_');
$rssLink = '<a href="rss_unapproved.php?user=' . htmlspecialchars($user) . '"><img src="images/rss.png" width="14" height="14" alt="RSS 2.0 - ' . htmlspecialchars($temp_fullname) . '" border="0"/></a>';
$count = 0;
$ret = '';
$sql = 'SELECT we.cal_id, we.cal_name, we.cal_description, weu.cal_login,
we.cal_priority, we.cal_date, we.cal_time, we.cal_duration,
weu.cal_status, we.cal_type
FROM webcal_entry we, webcal_entry_user weu
WHERE we.cal_id = weu.cal_id AND weu.cal_login = ? AND weu.cal_status = \'W\'
ORDER BY weu.cal_login, we.cal_date';
$rows = dbi_get_cached_rows($sql, array($user));
if ($rows) {
$allDayStr = translate('All day event');
$appConStr = translate('Approve/Confirm');
$appSelStr = translate('Approve Selected');
$checkAllStr = translate('Check All');
$deleteStr = translate('Delete');
$emailStr = translate('Emails Will Not Be Sent');
$rejectSelStr = translate('Reject Selected');
$rejectStr = translate('Reject');
$uncheckAllStr = translate('Uncheck All');
$viewStr = translate('View this entry');
for ($i = 0, $cnt = count($rows); $i < $cnt; $i++) {
$row = $rows[$i];
$key++;
$id = $row[0];
$name = $row[1];
$description = $row[2];
$cal_user = $row[3];
$pri = $row[4];
$date = $row[5];
$time = sprintf("%06d", $row[6]);
$duration = $row[7];
$status = $row[8];
$type = $row[9];
$view_link = 'view_entry';
$entryID = 'entry' . $type . $id;
$linkid = "pop{$id}-{$key}";
$timestr = '';
if ($time > 0 || $time == 0 && $duration != 1440) {
$eventstart = date_to_epoch($date . $time);
$eventstop = $eventstart + $duration;
$eventdate = date_to_str(date('Ymd', $eventstart));
$timestr = display_time('', 0, $eventstart) . ($duration > 0 ? ' - ' . display_time('', 0, $eventstop) : '');
} else {
// Don't shift date if All Day or Untimed.
$eventdate = date_to_str($date);
// If All Day display in popup.
if ($time == 0 && $duration == 1440) {
$timestr = $allDayStr;
}
}
$ret .= ($count == 0 ? '
<tr>
<td colspan="5"><h3>' . $temp_fullname . ' ' . $rssLink . '</h3></td>
</tr>' : '') . '
<tr ' . ($count % 2 == 0 ? '' : 'class="odd"') . '>
<td width="5%" align="right"><input type="checkbox" name="' . $entryID . '" value="' . $user . '"/></td>
<td><a title="' . $viewStr . '" class="entry" id="' . $linkid . '" href="' . $view_link . '.php?id=' . $id . '&user=' . $cal_user . '">' . htmlspecialchars($name) . '</a> (' . $eventdate . '):</td>' . '
<td align="center"><input type="image" src="images/check.gif" title="' . $appConStr . '" onclick="return do_confirm( \'approve\', \'' . $cal_user . '\', \'' . $entryID . '\' );" /></td>' . '
<td align="center"><input type="image" src="images/rejected.gif" title="' . $rejectStr . '" onclick="return do_confirm( \'reject\', \'' . $cal_user . '\', \'' . $entryID . '\' );" /></td>' . (!access_is_enabled() || access_user_calendar('edit', $user) ? '
<td align="center"><input type="image" src="images/delete.png" title="' . $deleteStr . '" onclick="return do_confirm( \'delete\', \'' . $cal_user . '\', \'' . $entryID . '\' );\\" /></td>' : '') . '
</tr>';
$eventinfo .= build_entry_popup('eventinfo-' . $linkid, $cal_user, $description, $timestr, site_extras_for_popup($id));
$count++;
}
if ($count > 1) {
$ret .= '
<tr>
<td colspan="5" nowrap="nowrap">
<img src="images/select.gif" border="0" alt="" />
<label><a title="' . $checkAllStr . '" onclick="check_all( \'' . $user . '\' );">' . $checkAllStr . '</a> / <a title="' . $uncheckAllStr . '" onclick="uncheck_all( \'' . $user . '\' );">' . $uncheckAllStr . '</a></label>
<input type="image" src="images/check.gif" title="' . $appSelStr . '" onclick="return do_confirm( \'approveSelected\', \'' . $cal_user . '\' );" />
<input type="image" src="images/rejected.gif" title="' . $rejectSelStr . '" onclick="return do_confirm( \'rejectSelected\', \'' . $cal_user . '\' );" /> ( ' . $emailStr . ' )
</td>
</tr>';
}
}
if ($count == 0) {
$noret .= '
<tr>
<td colspan="5" class="nounapproved">' . str_replace('XXX', $temp_fullname, translate('No unapproved entries for XXX.')) . ' ' . $rssLink . '</td>
</tr>';
}
return $ret;
}
示例14: translate
<?php
$newgroup = true;
$groupname = "";
$groupowner = "";
$groupupdated = "";
if (empty($id)) {
$groupname = translate("Unnamed Group");
} else {
$newgroup = false;
// get group by id
$res = dbi_query("SELECT cal_owner, cal_name, cal_last_update, cal_owner " . "FROM webcal_group WHERE cal_group_id = {$id}");
if ($res) {
if ($row = dbi_fetch_row($res)) {
$groupname = $row[1];
$groupupdated = $row[2];
user_load_variables($row[3], "temp");
$groupowner = $tempfullname;
}
dbi_fetch_row($res);
}
}
if ($newgroup) {
$v = array();
echo "<h2>" . translate("Add Group") . "</h2>\n";
echo "<input type=\"hidden\" name=\"add\" value=\"1\" />\n";
} else {
echo "<h2>" . translate("Edit Group") . "</h2>\n";
echo "<input type=\"hidden\" name=\"id\" value=\"{$id}\" />";
}
?>
示例15: list_unapproved
function list_unapproved($user)
{
global $temp_fullname, $key, $login;
//echo "Listing events for $user <br>";
$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)) {
if ($count == 0) {
echo "<ul>\n";
}
$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 title=\"" . translate("View this entry") . "\" class=\"entry\" href=\"view_entry.php?id={$id}&user={$user}";
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";
//approve
echo ": <a title=\"" . translate("Approve/Confirm") . "\" href=\"approve_entry.php?id={$id}&ret=list&user={$user}";
if ($user == "__public__") {
echo "&public=1";
}
echo "\" class=\"nav\" onclick=\"return confirm('" . translate("Approve this entry?") . "');\">" . translate("Approve/Confirm") . "</a>, ";
//reject
echo "<a title=\"" . translate("Reject") . "\" href=\"reject_entry.php?id={$id}&ret=list&user={$user}";
if ($user == "__public__") {
echo "&public=1";
}
echo "\" class=\"nav\" onclick=\"return confirm('" . translate("Reject this entry?") . "');\">" . translate("Reject") . "</a>";
//delete
echo ", <a title=\"" . translate("Delete") . "\" href=\"del_entry.php?id={$id}&ret=list";
if ($user != $login) {
echo "&user={$user}";
}
echo "\" class=\"nav\" onclick=\"return confirm('" . translate("Are you sure you want to delete this entry?") . "');\">" . translate("Delete") . "</a>";
echo "\n</li>\n";
$eventinfo .= build_event_popup($divname, $user, $description, $timestr, site_extras_for_popup($id));
$count++;
}
dbi_free_result($res);
if ($count > 0) {
echo "</ul>\n";
}
}
if ($count == 0) {
user_load_variables($user, "temp_");
echo "<span class=\"nounapproved\">" . translate("No unapproved events for") . " " . $temp_fullname . ".</span>\n";
} else {
if (!empty($eventinfo)) {
echo $eventinfo;
}
}
}