2 include_once $gfplugins.'webcalendar/www/includes/init.php';
3 load_user_categories();
7 if ( $readonly == 'Y' ) {
8 $error = translate("You are not authorized");
11 // Allow administrators to approve public events
12 if ( $public_access == "Y" && ! empty ( $public ) && $is_admin )
13 $app_user = "__public__";
15 $app_user = ( $is_assistant || $is_nonuser_admin ? $user : $login );
17 if ( empty ( $error ) && $id > 0 ) {
18 if ( ! dbi_query ( "UPDATE webcal_entry_user SET cal_status = 'A' " .
19 "WHERE cal_login = '$app_user' AND cal_id = $id" ) ) {
20 $error = translate("Error approving event") . ": " . dbi_error ();
22 $params[0] = $app_user ;
24 plugin_hook('add_cal_link_father_event',$params);
27 activity_log ( $id, $login, $app_user, $LOG_APPROVE, "" );
29 // Update any extension events related to this one.
30 $res = dbi_query ( "SELECT cal_id FROM webcal_entry " .
31 "WHERE cal_ext_for_id = $id" );
33 if ( $row = dbi_fetch_row ( $res ) ) {
35 if ( ! dbi_query ( "UPDATE webcal_entry_user SET cal_status = 'A' " .
36 "WHERE cal_login = '$app_user' AND cal_id = $ext_id" ) ) {
37 $error = translate("Error approving event") . ": " . dbi_error ();
40 dbi_free_result ( $res );
44 if ( empty ( $error ) ) {
45 if ( ! empty ( $ret ) && $ret == "list" )
46 do_redirect ( "list_unapproved.php?user=$app_user" );
48 do_redirect ( "view_entry.php?id=$id&user=$app_user" );
52 echo "<h2>" . translate("Error") . "</h2>\n";
53 echo "<p>" . $error . "</p>\n";