<?

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



	// ========================================================================================
	// photo upload processing
	// ========================================================================================
	
	$PageTitle = $MsgText[3][3];
	$BrowserTitle = $MsgText[3][3];
	$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][29];
	
	if ($LoggedIn == 'y') {
		
		ReadPermissions();
		Global $Permissions;
		
		if ($Permissions[301] == 'y') {
		
		
			$query = "select * from `".$Settings['DBPrefix']."pg-Settings`";
			$result = mysql_query($query) or die (mysql_error());
			while ($row = mysql_fetch_array($result)) {
				$pgSettings[$row['Name']] = $row['Value'];
			}
			
			if ($pgSettings['StorageLocationHTTP'] == '') {
				$pgSettings['StorageLocationHTTP'] = $BaseURL.'/pg_images';
			}
			if ($pgSettings['StorageLocationLocal'] == '') {
				$pgSettings['StorageLocationLocal'] = './pg_images';
			}
			
			
			
			ReadFormArguments();
			Global $FormArguments;
			
			if (count($FormArguments) > 0) {
			
								
				$query = "insert into `".$Settings['DBPrefix']."pg-Galleries` (GalleryTitle,GalleryDescription,GalleryFormat,MinLevel,MinEditLevel,Priority) values ('".$FormArguments['Title']."', '".$FormArguments['Description']."', '".$FormArguments['Format']."', '".$FormArguments['MinLevel']."', '".$FormArguments['MinEditLevel']."', '".$FormArguments['Priority']."')";
				$result = mysql_query($query) or die (mysql_error());
					
					
				Header('Location: '.$MainURL.'/admin/photos_galleries.html');
					
					

			}
			else {
				$PageContents = $MsgText[0][98];
			}
		
		} // end if permissions are sufficient
		else {
		
			$PageContents = $MsgText[0][97];
		
		}

	}
	else {
	
		RedirectToLogin();
	
	}

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




?>
