<?

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



	// ========================================================================================
	// edit Existing gallery
	// ========================================================================================
	
	$PageTitle = $MsgText[3][51];
	$BrowserTitle = $MsgText[3][51];
	$LocationBar = '<a href="'.$IndexURL.'">'.$MsgText[0][1].'</a> > <a href="' . $MainURL . '/options.html">'.$MsgText[0][4].'</a> > <a href="'.$MainURL.'/admin/photos_galleries.html">'.$MsgText[3][3].'</a> > '.$MsgText[3][51];
	
	if ($LoggedIn == 'y') {
		
		ReadPermissions();
		Global $Permissions;
		
		ReadFormArguments();
		Global $FormArguments;
		
		$query = "select MinLevel,MinEditLevel from `".$Settings['DBPrefix']."pg-Galleries` where RecordNumber='".$FormArguments['RecordNumberToEdit']."' limit 1";
		$result = mysql_query($query) or die (mysql_error());
		$row = mysql_fetch_array($result);
		
		
		if ($Permissions[301] == 'y' && $row['MinLevel'] <= $UserLevel && $row['MinEditLevel'] <= $UserLevel) {
		
				
			if (count($FormArguments) > 0) {
			
																																		
				$query5 = "update `".$Settings['DBPrefix']."pg-Galleries` set GalleryTitle='".$FormArguments['Title']."', GalleryDescription='".$FormArguments['Description']."', GalleryFormat='".$FormArguments['Format']."', MinLevel='".intval($FormArguments['MinLevel'])."', MinEditLevel='".intval($FormArguments['MinEditLevel'])."', Priority='".intval($FormArguments['Priority'])."' where RecordNumber='".$FormArguments['RecordNumberToEdit']."' limit 1";
				$result5 = mysql_query($query5) or die (mysql_error());
				
							
				header('Location: ' . $MainURL . '/admin/photos_galleries.html');
				
			}
			else {
				$PageContents = $MsgText[0][98];
			}
			
		}
		else {
		
			$PageContents = $MsgText[0][97];
		
		}

	}
	else {
	
		RedirectToLogin();
	
	}
	
	

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




?>
