<?

/*
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
*/



	// ========================================================================================
	// Save Page Category Changes
	// ========================================================================================
	
	$PageTitle = $MsgText[0][296];
	$BrowserTitle = $MsgText[0][296];
	$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][296];
	
	if ($LoggedIn == 'y') {
		
		ReadPermissions();
		Global $Permissions;
		
						
		if ($Permissions[20] == 'y') {
	
						
			ReadFormArguments();
			Global $FormArguments;
			
			$FormArguments['CatIDToEdit'] = intval($FormArguments['CatIDToEdit']);			
			
		
			if ($FormArguments['DeleteCategory'] == 'delete') {
		
				DBConnect();
			
				$query = "DELETE FROM `".$Settings['DBPrefix']."core-PageCategories` WHERE RecordNumber='".$FormArguments['CatIDToEdit']."' LIMIT 1";
	
	            $result = mysql_query($query) or die (mysql_error());
				
				header('Location: ' . $MainURL . '/admin/pages.html');
			
			}		
			else {
			
								
				$query = "UPDATE `".$Settings['DBPrefix']."core-PageCategories` SET Parent='".$FormArguments['CatParent']."', Name='".$FormArguments['CatName']."', Description='".$FormArguments['CatDescription']."', HideCategory='".$FormArguments['HideCategory']."' WHERE RecordNumber='".$FormArguments['CatIDToEdit']."' LIMIT 1";

    	        $result = mysql_query($query) or die (mysql_error());
			
				header('Location: ' . $MainURL . '/admin/pages.html');
			
		
			}
			

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

	}
	else {
	
		RedirectToLogin();
	
	}

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




?>
