diff --git a/web/zmactions.php b/web/zmactions.php index 0830ff9e3..19c8bbbbd 100644 --- a/web/zmactions.php +++ b/web/zmactions.php @@ -50,17 +50,7 @@ if ( $action ) { foreach( $mark_eids as $mark_eid ) { - $result = mysql_query( "delete from Stats where EventId = '$mark_eid'" ); - if ( !$result ) - die( mysql_error() ); - $result = mysql_query( "delete from Frames where EventId = '$mark_eid'" ); - if ( !$result ) - die( mysql_error() ); - $result = mysql_query( "delete from Events where Id = '$mark_eid'" ); - if ( !$result ) - die( mysql_error() ); - if ( $mark_eid ) - system( escapeshellcmd( "rm -rf ".EVENT_PATH."/*/".sprintf( "%04d", $mark_eid ) ) ); + deleteEvent( $mark_eid ); } } elseif ( $mark_zids ) @@ -104,17 +94,7 @@ if ( $action ) } foreach( $mark_eids as $mark_eid ) { - $result = mysql_query( "delete from Stats where EventId = '$mark_eid'" ); - if ( !$result ) - die( mysql_error() ); - $result = mysql_query( "delete from Frames where EventId = '$mark_eid'" ); - if ( !$result ) - die( mysql_error() ); - $result = mysql_query( "delete from Events where Id = '$mark_eid'" ); - if ( !$result ) - die( mysql_error() ); - if ( $mark_eid ) - system( "rm -rf ".EVENT_PATH."/*/".sprintf( "%04d", $mark_eid ) ); + deleteEvent( $mark_eid ); } system( "rm -rf ".EVENT_PATH."/".$monitor[Name] ); diff --git a/web/zmfuncs.php b/web/zmfuncs.php index c5f061f73..2f6c87551 100644 --- a/web/zmfuncs.php +++ b/web/zmfuncs.php @@ -19,6 +19,21 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // +function deleteEvent( $eid ) +{ + $result = mysql_query( "delete from Stats where EventId = '$mark_eid'" ); + if ( !$result ) + die( mysql_error() ); + $result = mysql_query( "delete from Frames where EventId = '$mark_eid'" ); + if ( !$result ) + die( mysql_error() ); + $result = mysql_query( "delete from Events where Id = '$mark_eid'" ); + if ( !$result ) + die( mysql_error() ); + if ( $mark_eid ) + system( escapeshellcmd( "rm -rf ".EVENT_PATH."/*/".sprintf( "%04d", $mark_eid ) ) ); +} + function getBrowser( &$browser, &$version ) { global $HTTP_SERVER_VARS;