[ Index ] |
|
Code source de WebCalendar 1.0.5 |
1 <?php 2 include_once 'includes/init.php'; 3 4 $error = ""; 5 6 if ( $readonly == 'Y' ) { 7 $error = translate("You are not authorized"); 8 } 9 10 // Allow administrators to approve public events 11 if ( $public_access == "Y" && ! empty ( $public ) && $is_admin ) 12 $app_user = "__public__"; 13 else 14 $app_user = ( $is_assistant || $is_nonuser_admin ? $user : $login ); 15 16 if ( empty ( $error ) && $id > 0 ) { 17 if ( ! dbi_query ( "UPDATE webcal_entry_user SET cal_status = 'R' " . 18 "WHERE cal_login = '$app_user' AND cal_id = $id" ) ) { 19 $error = translate("Error approving event") . ": " . dbi_error (); 20 } else { 21 activity_log ( $id, $login, $app_user, $LOG_REJECT, "" ); 22 } 23 24 // Update any extension events related to this one. 25 $res = dbi_query ( "SELECT cal_id FROM webcal_entry " . 26 "WHERE cal_ext_for_id = $id" ); 27 if ( $res ) { 28 if ( $row = dbi_fetch_row ( $res ) ) { 29 $ext_id = $row[0]; 30 if ( ! dbi_query ( "UPDATE webcal_entry_user SET cal_status = 'R' " . 31 "WHERE cal_login = '$app_user' AND cal_id = $ext_id" ) ) { 32 $error = translate("Error approving event") . ": " . dbi_error (); 33 } 34 } 35 dbi_free_result ( $res ); 36 } 37 38 // Email participants to notify that it was rejected. 39 // Get list of participants 40 $sql = "SELECT cal_login FROM webcal_entry_user WHERE cal_id = $id and cal_status = 'A'"; 41 //echo $sql."<br />"; 42 $res = dbi_query ( $sql ); 43 if ( $res ) { 44 while ( $row = dbi_fetch_row ( $res ) ) 45 $partlogin[] = $row[0]; 46 dbi_free_result($res); 47 } 48 49 // Get the name of the event 50 $sql = "SELECT cal_name, cal_description, cal_date, cal_time FROM webcal_entry WHERE cal_id = $id"; 51 $res = dbi_query ( $sql ); 52 if ( $res ) { 53 $row = dbi_fetch_row ( $res ); 54 $name = $row[0]; 55 $description = $row[1]; 56 $fmtdate = $row[2]; 57 $time = $row[3]; 58 dbi_free_result ( $res ); 59 } 60 61 if ($time != '-1') { 62 $hour = substr($time,0,2); 63 $minute = substr($time,2,2); 64 } 65 66 for ( $i = 0; $i < count ( $partlogin ); $i++ ) { 67 // does this user want email for this? 68 $send_user_mail = get_pref_setting ( $partlogin[$i], 69 "EMAIL_EVENT_REJECTED" ); 70 user_load_variables ( $partlogin[$i], "temp" ); 71 $user_language = get_pref_setting ( $partlogin[$i], "LANGUAGE" ); 72 if ( $send_user_mail == "Y" && strlen ( $tempemail ) && 73 $send_email != "N" ) { 74 if (($GLOBALS['LANGUAGE'] != $user_language) && ! empty ( $user_language ) && ( $user_language != 'none' )){ 75 reset_language ( $user_language ); 76 } 77 $msg = translate("Hello") . ", " . $tempfullname . ".\n\n" . 78 translate("An appointment has been rejected by") . 79 " " . $login_fullname . ". " . 80 translate("The subject was") . " \"" . $name . " \"\n" . 81 translate("The description is") . " \"" . $description . "\"\n" . 82 translate("Date") . ": " . date_to_str ( $fmtdate ) . "\n" . 83 ( ( empty ( $hour ) && empty ( $minute ) ) ? "" : 84 translate("Time") . ": " . 85 display_time ( ( $hour * 10000 ) + ( $minute * 100 ) ) ) . 86 "\n\n\n"; 87 if ( ! empty ( $server_url ) ) { 88 $url = $server_url . "view_entry.php?id=" . $id; 89 $msg .= "\n\n" . $url; 90 } 91 92 $from = $email_fallback_from; 93 if ( strlen ( $login_email ) ) 94 $from = $login_email; 95 96 $extra_hdrs = "From: $from\r\nX-Mailer: " . translate("Title"); 97 98 mail ( $tempemail, 99 translate($application_name) . " " . translate("Notification") . ": " . $name, 100 html_to_8bits ($msg), $extra_hdrs ); 101 activity_log ( $id, $login, $partlogin[$i], $LOG_NOTIFICATION, 102 "Event rejected by $app_user" ); 103 } 104 } 105 } 106 107 if ( empty ( $error ) ) { 108 if ( $ret == "list" ) 109 do_redirect ( "list_unapproved.php?user=$app_user" ); 110 else 111 do_redirect ( "view_entry.php?id=$id&user=$app_user" ); 112 exit; 113 } 114 print_header (); 115 echo "<h2>" . translate("Error") . "</h2>\n"; 116 echo "<p>" . $error . "</p>\n"; 117 print_trailer (); 118 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Fri Nov 30 19:09:19 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |