<?

/*
FlexCMS (http://www.flexcms.com)
Flexible, Powerful, Affordable.

Contents of this file are protected by the copyright
notice found at http://www.flexcms.com/flex/pages/copyright.html,
and its usage is subject to the terms of the licensing agreement 
available at http://www.flexcms.com/flex/pages/license.html
*/



	// ========================================================================================
	// Delete Calendar Event
	// ========================================================================================
	
	$PageTitle = $MsgText[1][79];
	$BrowserTitle = $MsgText[1][79];
	$LocationBar = '<a href="'.$IndexURL.'">'.$MsgText[0][1].'</a> > <a href="' . $MainURL . '/options.html">'.$MsgText[0][4].'</a> > <a href="'.$MainURL.'/admin/calendar.html">'.$MsgText[1][2].'</a> > '.$MsgText[1][79];
	
	if ($LoggedIn == 'y') {
		
		ReadPermissions();
		Global $Permissions;
		
		ReadFormArguments();
		Global $FormArguments;
		
		$query = "select MinLevel,MinEditLevel from `".$Settings['DBPrefix']."cl-Events` where RecordNumber='".$FormArguments['RecordNumber']."' limit 1";
		$result = mysql_query($query) or die (mysql_error());
		$row = mysql_fetch_array($result);
		
		if ($Permissions[100] == 'y' && $row['MinLevel'] <= $UserLevel && $row['MinEditLevel'] <= $UserLevel) {
	
		
			if (count($FormArguments) > 0) {
																							
				$query55 = "delete from `".$Settings['DBPrefix']."cl-Events` where RecordNumber='".$FormArguments['RecordNumber']."' limit 1";
				$result55 = mysql_query($query55) or die (mysql_error());
				
				$query55 = "delete from `".$Settings['DBPrefix']."cl-EventDates` where EventID='".$FormArguments['RecordNumber']."'";
				$result55 = mysql_query($query55) or die (mysql_error());
				
				header('Location: ' . $MainURL . '/admin/calendar.html');
				
			}
			else {
				$PageContents = $MsgText[0][98];
			}
			
		}
		else {
		
			$PageContents = $MsgText[0][97];
		
		}

	}
	else {
	
		RedirectToLogin();
	
	}
	
	

	// ========================================================================================




?>
