<?

/*
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 page
	// ========================================================================================
	
	$PageTitle = $MsgText[0][298];
	$BrowserTitle = $MsgText[0][298];
	$LocationBar = '<a href="'.$IndexURL.'">'.$MsgText[0][1].'</a> > <a href="'.$MainURL.'/options.html">'.$MsgText[0][4].'</a> > <a href="'.$MainURL.'/admin/pages.html">'.$MsgText[0][244].'</a> > '.$MsgText[0][298];
	
	if ($LoggedIn == 'y') {
		
		ReadPermissions();
		Global $Permissions;
		
		if ($Permissions[18] == 'y') {
							
			ReadFormArguments();
			Global $FormArguments;
			
			
			if (count($FormArguments) > 0) {
			
				$query = "select * from `".$Settings['DBPrefix']."core-Pages` where RecordNumber='".$FormArguments['PageID']."' LIMIT 1";
    	        $result = mysql_query($query) or die (mysql_error());
				
				$row = mysql_fetch_array($result);
			
				
				if ($row['MinLevel'] <= $UserLevel && $row['MinEditLevel'] <= $UserLevel && $row['RecordNumber'] == $FormArguments['PageID']) {
			
			
					$query = "DELETE FROM `".$Settings['DBPrefix']."core-Pages` WHERE RecordNumber='".$FormArguments['PageID']."' LIMIT 1";
	
	          		$result = mysql_query($query) or die (mysql_error());
					
					header('Location: ' . $MainURL . '/admin/pages.html');			
			
			
				}
				
			}
			else {
				$PageContents = $MsgText[0][98];
			}
		
		}
			

		
		else {
		
			$PageContents = $MsgText[0][97];
		
		}

	}
	else {
	
		RedirectToLogin();
	
	}

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




?>
