<?

/*
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 gallery prefs
	// ========================================================================================
	
	$PageTitle = '<img src="'.$ImagesURL.'/admin/admincp_photo.gif" width="28" height="22"> '.$MsgText[3][4];
	$BrowserTitle = $MsgText[3][4];
	$LocationBar = '<a href="'.$IndexURL.'">'.$MsgText[0][1].'</a> > <a href="' . $MainURL . '/options.html">'.$MsgText[0][4].'</a> > '.$MsgText[3][4];
	
	if ($LoggedIn == 'y') {
		
		ReadPermissions();
		Global $Permissions;
		
		if ($Permissions[302] == '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';
			//}
			
			
									
			$TitleAlignmentSelected[$pgSettings['TitleAlignment']] = ' selected';
			
			
			
			
	
			$PageContents = '<form name="PostForm" action="'.$MainURL.'/admin/photos_prefs_save" method="post">
						
			<br><b>'.$MsgText[3][17].':</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;('.$MsgText[1][26].': <select name="TitleAlignment" style="'.$FormStyle.'">
			<option value="L"'.$TitleAlignmentSelected['L'].'> '.$MsgText[0][15].'</option>
			<option value="C"'.$TitleAlignmentSelected['C'].'> '.$MsgText[0][16].'</option>
			<option value="R"'.$TitleAlignmentSelected['R'].'> '.$MsgText[0][17].'</option>
			</select>)<br>
			<input type="text" name="Title" size="45" value="'.str_replace('"','&#34;',$pgSettings['Title']).'" style="'.$FormStyle.'">
			<br>
			
			<script>
var ImageDestination = "";

var ExistingImagesWindowCode = "";

function SelectImage(ImageDestinationSent) {
	var WindowProperties = "width=420,height=300,left=" + (screen.width-420)/2 + ",top=" + (screen.height-300)/2 + ",location=no,menubar=no,directories=no,toolbar=no,status=no,scrollbars=no,resizable=yes";

	ImageDestination = ImageDestinationSent;

	if (ImageDestination == "Photo") {
		ExistingImagesWindowCode = window.open("'.$BaseURL.'/inc-core-admin-editor-existingimages.php?"+document.forms["PostForm"].elements["PhotoURL"].value,"existingimages",WindowProperties);
	}
	else {
		ExistingImagesWindowCode = window.open("'.$BaseURL.'/inc-core-admin-editor-existingimages.php?"+document.forms["PostForm"].elements["TitleImage"].value,"existingimages",WindowProperties);
	}
}
function ExistingImageSelected(ImageName,ImageWidth,ImageHeight) {

	ExistingImagesWindowCode.close();
	
	if (ImageDestination == "Photo") {
		document.forms["PostForm"].elements["PhotoURL"].value = "/images/uploaded/"+ImageName;
	}
	else {
		document.forms["PostForm"].elements["TitleImage"].value = "/images/uploaded/"+ImageName;
	}

}
function UploadToServer(ImageDestinationSent) {

		ImageDestination = ImageDestinationSent;

		var WindowProperties = "width=580,height=380,left=" + (screen.width-580)/2 + ",top=" + (screen.height-380)/2 + ",location=no,menubar=no,directories=no,toolbar=no,status=no,scrollbars=no,resizable=yes";

		UploadWindowCode = window.open("'.$BaseURL.'/inc-core-admin-editor-imageupload.php","imageupload",WindowProperties);

	  }

	  function UploadedImageSelected(ImageName,ImageWidth,ImageHeight) {

		UploadWindowCode.close();
		
		
		if (ImageDestination == "Photo") {
			document.forms["PostForm"].elements["PhotoURL"].value = "/images/uploaded/"+ImageName;
		}
		else {
			document.forms["PostForm"].elements["TitleImage"].value = "/images/uploaded/"+ImageName;
		}
		
	  }
</script>
			
			
			'.$MsgText[0][519].':<br>
			<input type="text" name="TitleImage" size="50" value="'.str_replace('"', '&#34;', $pgSettings['TitleImage']).'" style="'.$FormStyle.'">
			<br>
			<input type="button" value="'.$MsgText[0][521].'" onClick="SelectImage();" style="'.$FormStyle.'">&nbsp;<input type="button" value="'.$MsgText[0][563].'" onClick="UploadToServer();" style="'.$FormStyle.'">
			<br><br>

			
			<br><b>'.$MsgText[3][18].':</b><br>
			'.$MsgText[3][19].': <input type="text" name="ThumbMaxWidth" size="5" value="'.$pgSettings['ThumbMaxWidth'].'">px&nbsp;&nbsp;&nbsp;'.$MsgText[3][20].': <input type="text" name="ThumbMaxHeight" size="5" value="'.$pgSettings['ThumbMaxHeight'].'">px<br>
				'.$MsgText[3][21].': <input type="checkbox" name="RebuildThumbs" value="y"> '.$MsgText[0][118].'<br>('.$MsgText[3][22].')<br>

			<br><b>'.$MsgText[3][23].':</b><br>
			'.$MsgText[3][19].': <input type="text" name="MaxWidth" size="5" value="'.$pgSettings['MaxWidth'].'">px&nbsp;&nbsp;&nbsp;'.$MsgText[3][20].': <input type="text" name="MaxHeight" size="5" value="'.$pgSettings['MaxHeight'].'">px<br>
'.$MsgText[3][24].': <input type="text" name="MaxFileSize" size="5" value="'.$pgSettings['MaxFileSize'].'"> KBytes
<br>
			<br><br><b>'.$MsgText[3][69].'</b><br>
			<br><b>'.$MsgText[3][25].':</b><br>
			<input type="text" name="StorageLocationLocal" size="50" value="'.$pgSettings['StorageLocationLocal'].'"><br><font size="1">('.$MsgText[3][26].')<br></font>
			
			<br><b>'.$MsgText[3][27].':</b><br>
			<input type="text" name="StorageLocationHTTP" size="50" value="'.$pgSettings['StorageLocationHTTP'].'"><br><font size="1">('.$MsgText[3][28].')<br></font>
	
			
			<br><br><br><br>
			<input type="submit" value="'.$MsgText[0][123].'">
			</form>';
			
			
	
	
		}
		else {
		
			$PageContents = $MsgText[0][97];
		
		}

	}
	else {
	
		RedirectToLogin();
	
	}
	

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




?>
