1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
<?php
include_once 'includes/init.php';
load_user_categories();
$error = "";
if ( $readonly == 'Y' ) {
$error = translate("You are not authorized");
}
// Allow administrators to approve public events
if ( $public_access == "Y" && ! empty ( $public ) && $is_admin )
$app_user = "__public__";
else
$app_user = ( $is_assistant || $is_nonuser_admin ? $user : $login );
if ( empty ( $error ) && $id > 0 ) {
if ( ! dbi_query ( "UPDATE webcal_entry_user SET cal_status = 'A' " .
"WHERE cal_login = '$app_user' AND cal_id = $id" ) ) {
$error = translate("Error approving event") . ": " . dbi_error ();
} else {
activity_log ( $id, $login, $app_user, $LOG_APPROVE, "" );
}
// Update any extension events related to this one.
$res = dbi_query ( "SELECT cal_id FROM webcal_entry " .
"WHERE cal_ext_for_id = $id" );
if ( $res ) {
if ( $row = dbi_fetch_row ( $res ) ) {
$ext_id = $row[0];
if ( ! dbi_query ( "UPDATE webcal_entry_user SET cal_status = 'A' " .
"WHERE cal_login = '$app_user' AND cal_id = $ext_id" ) ) {
$error = translate("Error approving event") . ": " . dbi_error ();
}
}
dbi_free_result ( $res );
}
}
if ( empty ( $error ) ) {
if ( $ret == "list" )
do_redirect ( "list_unapproved.php?user=$app_user" );
else
do_redirect ( "view_entry.php?id=$id&user=$app_user" );
exit;
}
print_header ();
echo "<h2>" . translate("Error") . "</h2>\n";
echo "<p>" . $error . "</p>\n";
print_trailer ();
?>
|