" . translate("Purging events for") . " $user...\n"; $ids = ''; $end_date = sprintf ( "%04d%02d%02d, ", $end_year,$end_month,$end_day); if ( $purge_all == "Y" ) { if ( $user == 'ALL' ) { $ids = array ('%'); } else { $ids = get_ids ( "SELECT cal_id FROM webcal_entry WHERE cal_create_by = '$user'" ); } } elseif ( $end_date ) { if ( $user != 'ALL' ) { $tail = " AND webcal_entry.cal_create_by = '$user'"; } else { $ALL = 1; // Need this to tell get_ids to ignore participant check } $E_ids = get_ids ( "SELECT cal_id FROM webcal_entry WHERE cal_type = 'E' AND cal_date < '$end_date' $tail", $ALL ); $M_ids = get_ids ( "SELECT webcal_entry.cal_id FROM webcal_entry INNER JOIN webcal_entry_repeats ON webcal_entry.cal_id = webcal_entry_repeats.cal_id WHERE webcal_entry.cal_type = 'M' AND cal_end IS NOT NULL AND cal_end < '$end_date' $tail", $ALL ); $ids = array_merge ( $E_ids, $M_ids ); } if ( $ids ) purge_events ( $ids ); echo "

..." . translate("Finished") . ".

\n"; } else { ?>

:
:
ALL events for a user")?>:
" ONCLICK="return confirm(' ' + document.forms[0].user.value + '?')">
\n"; } } function get_ids ( $sql, $ALL = '' ) { $ids = array(); $res = dbi_query ( $sql ); if ( $res ) { while ( $row = dbi_fetch_row ( $res ) ) { if ($ALL == 1) { $ids[] = $row['cal_id']; } else { //ONLY Delete event if no other participants. $ID = $row['cal_id']; $res2 = dbi_query ( "SELECT COUNT(*) FROM webcal_entry_user " . "WHERE cal_id = $ID" ); if ( $res2 ) { if ( $row2 = dbi_fetch_row ( $res2 ) ) { if ( $row2[0] == 1 ) $ids[] = $ID; } dbi_free_result ( $res2 ); } } // End if ($ALL) } // End while } dbi_free_result ( $res ); return $ids; } ?>