<?

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



	// ========================================================================================
	// guestbook prefs
	// ========================================================================================
	
	$PageTitle = '<img src="'.$ImagesURL.'/admin/admincp_guestbook.gif" width="22" height="21"> '.$MsgText[6][19];
	$BrowserTitle = $MsgText[6][19];
	$LocationBar = '<a href="'.$IndexURL.'">'.$MsgText[0][1].'</a> > <a href="' . $MainURL . '/options.html">'.$MsgText[0][4].'</a> > '.$MsgText[6][19];
	
	if ($LoggedIn == 'y') {
		
		ReadPermissions();
		Global $Permissions;
		
		if ($Permissions[602] == 'y') {
		
			$query = "select * from `".$Settings['DBPrefix']."gb-Settings`";
			$result = mysql_query($query) or die (mysql_error());
			while ($row = mysql_fetch_array($result)) {
				$gbSettings[$row['Name']] = $row['Value'];
			}
			
			
			$SortDirectionSelected[$gbSettings['SortDirection']] = ' selected';
			$TitleAlignmentSelected[$gbSettings['TitleAlignment']] = ' selected';
			
			$TopTextAlignmentSelected[$gbSettings['TopTextAlignment']] = ' selected';
			
			$ApprovalSelected[$gbSettings['RequireApproval']] = ' selected';
			
			if ($gbSettings['Notify'] == 'y' && $gbSettings['NotifyEmail'] != '') {
				$NotifyAddress = $gbSettings['NotifyEmail'];
				$NotifyChecked[2] = ' checked';
			}
			else if ($gbSettings['Notify'] == 'y') {
				$NotifyChecked[1] = ' checked';
			}
			else {
				$NotifyChecked[3] = ' checked';
			}
			
			
			
			
			$PageContents = '<form name="PostForm" action="'.$MainURL.'/admin/guestbook_prefs_save" method="post">
			
			<br><b>'.$MsgText[2][49].':</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;('.$MsgText[2][50].': <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="PageTitle" size="45" value="'.str_replace('"','&#34;',$gbSettings['PageTitle']).'" 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;', $gbSettings['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[2][51].':</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;('.$MsgText[2][50].': <select name="TopTextAlignment" style="'.$FormStyle.'">
			<option value="L"'.$TopTextAlignmentSelected['L'].'> '.$MsgText[0][15].'</option>
			<option value="C"'.$TopTextAlignmentSelected['C'].'> '.$MsgText[0][16].'</option>
			<option value="R"'.$TopTextAlignmentSelected['R'].'> '.$MsgText[0][17].'</option>
			</select>)<br>
			<textarea name="TopText" cols="39" rows="1" wrap="virtual" style="'.$FormStyle.'">'.str_replace('<','&lt;',$gbSettings['TopText']).'</textarea>
			<br>
			
			<br><br>
			
			<br>	
			<b>'.$MsgText[6][20].':</b><br><input type="text" name="EntriesPerPage" size="5" value="'.$gbSettings['EntriesPerPage'].'" style="'.$FormStyle.'">
			
			<br><br><br>
			<b>'.$MsgText[6][21].':</b><br><select name="SortDirection" style="'.$FormStyle.'">
	<option value="asc"'.$SortDirectionSelected['asc'].'> '.$MsgText[6][23].'</option>
	<option value="desc"'.$SortDirectionSelected['desc'].'> '.$MsgText[6][22].'</option>
</select>
			<br><br><br>
			<b>'.$MsgText[6][24].':</b><br>
			<select name="RequireApproval" style="'.$FormStyle.'">
	<option value="y"'.$ApprovalSelected['y'].'> '.$MsgText[6][25].'</option>
	<option value="n"'.$ApprovalSelected['n'].'> '.$MsgText[6][26].'</option>
</select>

			<br><br><br>
			<b>'.$MsgText[6][27].':</b><br>
				<input type="radio" name="Notify" value="1"'.$NotifyChecked[1].'> '.$MsgText[6][28].'<br>
	<input type="radio" name="Notify" value="2"'.$NotifyChecked[2].'> '.$MsgText[6][29].': <input type="text" name="NotifyAddress" size="40" style="'.$FormStyle.'" value="'.$NotifyAddress.'"><br>
	<input type="radio" name="Notify" value="3"'.$NotifyChecked[3].'> '.$MsgText[6][30].'<br>



			
								
			<br><br><br>
			<input type="submit" value="'.$MsgText[0][123].'" style="'.$FormStyle.'">
			</form>';
			
			
	
	
		}
		else {
		
			$PageContents = $MsgText[0][97];
		
		}

	}
	else {
	
		RedirectToLogin();
	
	}
	

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




?>
