<?

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



	// ========================================================================================
	// admin preferences page
	// ========================================================================================
	
	$PageTitle = '<img src="'.$ImagesURL.'/admin/admincp_settings.gif" width="23" height="20"> '.$MsgText[0][62];
	$BrowserTitle = $MsgText[0][62];
	$LocationBar = '<a href="'.$IndexURL.'">'.$MsgText[0][1].'</a> > <a href="'.$MainURL.'/options.html">'.$MsgText[0][4].'</a> > '.$MsgText[0][62];
	
	if ($LoggedIn == 'y') {
		
		ReadPermissions();
		Global $Permissions;
		
		if ($Permissions[7] == 'y') {
		
		
			// read list of language packs available
			if ($dir = @opendir('./languages')) {
				while (($file = readdir($dir)) !== false) {
		   			if ($file != '.' && $file != '..' && $file != 'index.html') {
						
						$FileNamePieces = explode('-',$file);
						list($LanguageCodeSplit, $Trash) = explode('.php',$FileNamePieces[3]);
					
						$LanguageCodes[] = $LanguageCodeSplit;
						
						$LanguageName = '';
						include('./languages/inc-core-lang-'.$LanguageCodeSplit.'.php');
						
						$LanguageNames[$LanguageCodeSplit] = $LanguageName;
						
        			}
				}
				closedir($dir);
			}
			
			// sort them by name
			for ($i = 0; $i < count($LanguageCodes); $i++) {
				for ($j = 0; $j < (count($LanguageCodes)-1); $j++) {

					if ($LanguageNames[$LanguageCodes[$j]] > $LanguageNames[$LanguageCodes[$j+1]]) {
					
						$Swap1 = $LanguageCodes[$j];
						
						$LanguageCodes[$j] = $LanguageCodes[$j+1];
						
						$LanguageCodes[$j+1] = $Swap1;
					
					} 
				
				}
			}
			
			// and then create the dropdown for them
			for ($i = 0; $i < count($LanguageCodes); $i++) {
				if ($LanguageCodes[$i] == $Settings['DefaultLanguage']) {
					$LanguagesDropdown .= '<option value="'.$LanguageCodes[$i].'" selected> '.$LanguageNames[$LanguageCodes[$i]].'</option>';
				}
				else {
					$LanguagesDropdown .= '<option value="'.$LanguageCodes[$i].'"> '.$LanguageNames[$LanguageCodes[$i]].'</option>';
				}
			}
						
			// and finally read back in the current one so anything else printed on the page is in the right language
			include('./languages/inc-core-lang-'.$Settings['DefaultLanguage'].'.php');
			
		
		
		
			$SBLChecked[$Settings['ShowBottomLogin']] = ' checked';
			$AGRChecked[$Settings['AllowGuestRegistrations']] = ' checked';
			$SPTChecked[$Settings['ShowProcessingTime']] = ' checked';
			$AUCChecked[$Settings['AllowUsernameChanges']] = ' checked';
			
			$VerifyChecked[$Settings['VerifyEmails']] = ' checked';
			
			$SNLChecked[$Settings['ShowNavigationLinks']] = ' checked';
			
			$AddSiteToTitleSelected[$Settings['AddSiteToTitle']] = ' selected';
			
			
			$LinkDecorationSelected[$OverridesArray[15]] = ' checked';
			$BLinkDecorationSelected[$OverridesArray[16]] = ' checked';
			
			
			
			$SPBChecked[$Settings['spb']] = ' checked';
			
			
			if ($Settings[rc('525042',3)] == 1 || $Settings[rc('108118108',5)] < 3) {
				$PBOption = '<input type="hidden" name="ShowPoweredBy" value="y">';
			}
			else {
				$PBOption = '<br><b>'.$MsgText[0][424].'</b><br><input type="radio" name="ShowPoweredBy" value="y"'.$SPBChecked['y'].'> '.$MsgText[0][552].'<br><input type="radio" name="ShowPoweredBy" value="l"'.$SPBChecked['l'].'> '.$MsgText[0][553].'<br><input type="radio" name="ShowPoweredBy" value="i"'.$SPBChecked['i'].'> '.$MsgText[0][554].'<br><input type="radio" name="ShowPoweredBy" value="n"'.$SPBChecked['n'].'> '.$MsgText[0][555].'<br><font size="1">'.$MsgText[0][425].'<br></font>';
			}
			
			
			
			if ($Settings['SiteCountry'] == '') {
				$Settings['SiteCountry'] = 'US';
			}
			
			$query6 = "select * from `".$Settings['DBPrefix']."core-Countries` where AllowUsers=1 order by Name asc";
			$result6 = mysql_query($query6) or die (mysql_error());
			while ($row6 = mysql_fetch_array($result6)) {
				if ($row6['Code'] == $Settings['SiteCountry']) {
					$CountriesList .= '<option value="'.$row6['Code'].'" selected> '.$row6['Name'].'</option>';
				}
				else {
					$CountriesList .= '<option value="'.$row6['Code'].'"> '.$row6['Name'].'</option>';
				}
			}
			
			
			if ($Settings['Notify'] == 'y' && $Settings['NotifyEmail'] != '') {
				$NotifyAddress = $Settings['NotifyEmail'];
				$NotifyChecked[2] = ' checked';
			}
			else if ($Settings['Notify'] == 'y') {
				$NotifyChecked[1] = ' checked';
			}
			else {
				$NotifyChecked[3] = ' checked';
			}
			
		
	
			$PageContents = '<br>'.$MsgText[0][426].'<br><br>
<form name="PostForm" action="'.$MainURL . '/admin/preferences-save" method="post">
<b>'.$MsgText[0][427].'</b><br><input type="radio" name="ShowBottomLogin" value="y"'.$SBLChecked['y'].'> '.$MsgText[0][118].' &nbsp;<input type="radio" name="ShowBottomLogin" value="n"'.$SBLChecked['n'].'> '.$MsgText[0][119].'<br><font size="1">'.$MsgText[0][428].'<br></font>
<br><b>'.$MsgText[0][429].'</b><br><input type="radio" name="AllowGuestRegistrations" value="y"'.$AGRChecked['y'].'> '.$MsgText[0][118].' &nbsp;<input type="radio" name="AllowGuestRegistrations" value="n"'.$AGRChecked['n'].'> '.$MsgText[0][119].'<br><font size="1">'.$MsgText[0][430].'<br></font>
<br><b>'.$MsgText[0][431].'</b><br><input type="radio" name="AllowUsernameChanges" value="y"'.$AUCChecked['y'].'> '.$MsgText[0][118].' &nbsp;<input type="radio" name="AllowUsernameChanges" value="n"'.$AUCChecked['n'].'> '.$MsgText[0][119].'<br><font size="1">'.$MsgText[0][432].'<br></font>
<br><b>'.$MsgText[0][433].'</b><br><input type="radio" name="ShowNavigationLinks" value="none"'.$SNLChecked['none'].'> '.$MsgText[0][119].'
<br><input type="radio" name="ShowNavigationLinks" value="allbuthome"'.$SNLChecked['allbuthome'].'> '.$MsgText[0][434].'
<br><input type="radio" name="ShowNavigationLinks" value="allpages"'.$SNLChecked['allpages'].'> '.$MsgText[0][435].'
<br><font size="1">'.$MsgText[0][436].'<br></font>
<br><b>'.$MsgText[0][437].'</b><br><input type="radio" name="ShowProcessingTime" value="y"'.$SPTChecked['y'].'> '.$MsgText[0][118].' &nbsp;<input type="radio" name="ShowProcessingTime" value="n"'.$SPTChecked['n'].'> '.$MsgText[0][119].'<br><font size="1">'.$MsgText[0][438].'<br></font>
'.$PBOption.'
<br><br><b>'.$MsgText[0][634].':</b><br><select name="SiteCountry">'.$CountriesList.'</select>

<br><br><br>
<b>'.$MsgText[0][439].':</b><br><input type="text" name="SiteName" size="40" value="'.str_replace('"','&#34;',$Settings['SiteName']).'"><br><font size="1">'.$MsgText[0][440].'<br></font>
<br>

<b>'.$MsgText[0][677].':</b><br><input type="text" name="LongSiteName" size="40" value="'.str_replace('"','&#34;',$Settings['LongSiteName']).'"><br><font size="1">'.$MsgText[0][678].'<br></font>
<br>

<b>'.$MsgText[0][635].':</b><br><select name="AddSiteToTitle"><option value="allbuthome"'.$AddSiteToTitleSelected['allbuthome'].'> '.$MsgText[0][636].'</option><option value="all"'.$AddSiteToTitleSelected['all'].'> '.$MsgText[0][637].'</option><option value="none"'.$AddSiteToTitleSelected['none'].'> '.$MsgText[0][638].'</option></select><br><br><b>'.$MsgText[0][639].':</b><br><input type="text" name="AddSiteToTitleSep" size="5" value="'.$Settings['AddSiteToTitleSep'].'"> ('.$MsgText[0][640].')
<br><br>

<br><b>'.$MsgText[0][441].':</b><br><input type="text" name="ContactEmail" size="40" value="'.$Settings['ContactEmail'].'"><br><font size="1">'.$MsgText[0][442].'<br></font>
<br><b>'.$MsgText[0][443].':</b><br><input type="text" name="Copyright" size="60" value="'.str_replace('"','&#34;',$Settings['Copyright']).'"><br><font size="1">'.$MsgText[0][444].'<br></font>
<br><b>'.$MsgText[0][445].':</b><br><textarea name="Footer" cols="50" rows="2" wrap="virtual">'.str_replace('<','&lt;',$Settings['Footer']).'</textarea><br><font size="1">'.$MsgText[0][446].'<br></font>
<br><br>

<b>'.$MsgText[0][641].':</b><br>
				<input type="radio" name="Notify" value="1"'.$NotifyChecked[1].'> '.$MsgText[0][642].'<br>
	<input type="radio" name="Notify" value="2"'.$NotifyChecked[2].'> '.$MsgText[0][643].': <input type="text" name="NotifyAddress" size="40" value="'.$NotifyAddress.'"><br>
	<input type="radio" name="Notify" value="3"'.$NotifyChecked[3].'> '.$MsgText[0][644].'<br>

<br><br>


<b>'.$MsgText[0][654].'</b><br><input type="radio" name="VerifyEmails" value="y"'.$VerifyChecked['y'].'> '.$MsgText[0][118].' &nbsp;<input type="radio" name="VerifyEmails" value="n"'.$VerifyChecked['n'].'> '.$MsgText[0][119].'<br><font size="1">'.$MsgText[0][655].'<br></font>


<br><br><br>
<b>'.$MsgText[0][447].':</b><br><input type="text" name="MetaDescription" size="60" value="'.str_replace('"','&#34;',$Settings['MetaDescription']).'"><br><font size="1">'.$MsgText[0][448].'<br></font>
<br>
<b>'.$MsgText[0][449].':</b><br><input type="text" name="MetaKeywords" size="60" value="'.str_replace('"','&#34;',$Settings['MetaKeywords']).'"><br><font size="1">'.$MsgText[0][450].'<br></font>

<br><br><b>'.$MsgText[0][451].':</b><br><input type="text" name="DestAfterLogin" size="40" value="'.str_replace('"','&#34;',$Settings['DestAfterLogin']).'"><br><font size="1">'.$MsgText[0][452].'<br></font>

<br><b>'.$MsgText[0][652].':</b><br><input type="text" name="CustomLoginCode" size="40" value="'.str_replace('"','&#34;',$Settings['CustomLoginCode']).'"><br><font size="1">'.$MsgText[0][653].'<br></font>

<br><br><b>'.$MsgText[0][560].':</b><br><input type="text" name="UsersPerPage" size="5" value="'.intval($Settings['UsersPerPage']).'"><br><font size="1">'.$MsgText[0][561].'<br></font>


<br><br><b>'.$MsgText[0][453].':</b><br><select name="DefaultLanguage">'.$LanguagesDropdown.'</select>
<br>


<br><br><b>'.$MsgText[0][711].':</b><br><input type="text" name="FileManagerMaxFileSize" size="5" value="'.$Settings['FileManagerMaxFileSize'].'"> KBytes<br>



<br><br><b>'.$MsgText[0][454].':</b><br>
<font size="1">'.$MsgText[0][455].'<br></font>

<img id="PreviousColorsControlImage" src="'.$ImagesURL.'/admin/spacer.gif" width="1" height="1" alt="" border="0">

<script>
var ColorPickerWindowCode = "";
var ColorDestination = "";

function GetCurrentColor() {
	if (ColorDestination != "") {
		return document.forms["PostForm"].elements[ColorDestination].value.substring(1);
	}
	else {
		return "";
	}
}

function LaunchColorPicker(ColorDest) {
	ColorDestination = ColorDest;
	
	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";

	ColorPickerWindowCode = window.open("'.$BaseURL.'/color_picker.html","colorpicker",WindowProperties);
}

function ColorSelected(ColorCode) {
	//alert(ColorCode);
	ColorPickerWindowCode.close();
	
	document.forms["PostForm"].elements[ColorDestination].value = ColorCode;
		
	document.getElementById("PreviousColorsControlImage").src = "'.$BaseURL.'/inc-core-admin-editor-previouscolors.php?"+ColorCode.substring(1)+"/"+(Math.random()*123456);
}

</script>


<br>
<b>'.$MsgText[0][456].':</b><br>
<input type="text" name="FontFace" size="30" value="'.$OverridesArray[0].'">&nbsp;&nbsp;<input type="text" name="FontSize" size="2" value="'.$OverridesArray[1].'">
<br><br>
<b>'.$MsgText[0][457].':</b>
<table cellpadding=3 cellspacing=0 border=0>
<tr><td><font face="'.$FontFace.'" size="2">'.$MsgText[0][458].':</td><td><input type="text" name="BG" size="7" value="'.$OverridesArray[2].'">&nbsp;<input type="button" value="'.$MsgText[0][556].'" onClick="LaunchColorPicker(\'BG\');"></td></tr>
<tr><td colspan="2" height="10"></td></tr>
<tr><td><font face="'.$FontFace.'" size="2">'.$MsgText[0][459].':</td><td><input type="text" name="Text" size="7" value="'.$OverridesArray[3].'">&nbsp;<input type="button" value="'.$MsgText[0][556].'" onClick="LaunchColorPicker(\'Text\');"></td></tr>
<tr><td><font face="'.$FontFace.'" size="2">'.$MsgText[0][460].':</td><td><input type="text" name="Link" size="7" value="'.$OverridesArray[4].'">&nbsp;<input type="button" value="'.$MsgText[0][556].'" onClick="LaunchColorPicker(\'Link\');"></td></tr>
<tr><td><font face="'.$FontFace.'" size="2">'.$MsgText[0][461].':</td><td><input type="text" name="VLink" size="7" value="'.$OverridesArray[5].'">&nbsp;<input type="button" value="'.$MsgText[0][556].'" onClick="LaunchColorPicker(\'VLink\');"></td></tr>
<tr><td><font face="'.$FontFace.'" size="2">'.$MsgText[0][462].':</td><td><input type="text" name="ALink" size="7" value="'.$OverridesArray[6].'">&nbsp;<input type="button" value="'.$MsgText[0][556].'" onClick="LaunchColorPicker(\'ALink\');"></td></tr>
<tr><td><font face="'.$FontFace.'" size="2">'.$MsgText[0][540].':</td><td><input type="text" name="LinkHover" size="7" value="'.$OverridesArray[13].'">&nbsp;<input type="button" value="'.$MsgText[0][556].'" onClick="LaunchColorPicker(\'LinkHover\');"></td></tr>
<tr><td colspan="2" height="10"></td></tr>
<tr><td><font face="'.$FontFace.'" size="2">'.$MsgText[0][463].':</td><td><input type="text" name="BBG" size="7" value="'.$OverridesArray[11].'">&nbsp;<input type="button" value="'.$MsgText[0][556].'" onClick="LaunchColorPicker(\'BBG\');"></td></tr>
<tr><td><font face="'.$FontFace.'" size="2">'.$MsgText[0][464].':</td><td><input type="text" name="BText" size="7" value="'.$OverridesArray[7].'">&nbsp;<input type="button" value="'.$MsgText[0][556].'" onClick="LaunchColorPicker(\'BText\');"></td></tr>
<tr><td><font face="'.$FontFace.'" size="2">'.$MsgText[0][465].':</td><td><input type="text" name="BLink" size="7" value="'.$OverridesArray[8].'">&nbsp;<input type="button" value="'.$MsgText[0][556].'" onClick="LaunchColorPicker(\'BLink\');"></td></tr>
<tr><td><font face="'.$FontFace.'" size="2">'.$MsgText[0][466].':&nbsp;&nbsp;&nbsp;</td><td><input type="text" name="BVLink" size="7" value="'.$OverridesArray[9].'">&nbsp;<input type="button" value="'.$MsgText[0][556].'" onClick="LaunchColorPicker(\'BVLink\');"></td></tr>
<tr><td><font face="'.$FontFace.'" size="2">'.$MsgText[0][467].':</td><td><input type="text" name="BALink" size="7" value="'.$OverridesArray[10].'">&nbsp;<input type="button" value="'.$MsgText[0][556].'" onClick="LaunchColorPicker(\'BALink\');"></td></tr>
<tr><td><font face="'.$FontFace.'" size="2">'.$MsgText[0][541].':</td><td><input type="text" name="BLinkHover" size="7" value="'.$OverridesArray[14].'">&nbsp;<input type="button" value="'.$MsgText[0][556].'" onClick="LaunchColorPicker(\'BLinkHover\');"></td></tr>
<tr><td colspan="2" height="10"></td></tr>
<tr><td><font face="'.$FontFace.'" size="2">'.$MsgText[0][468].':</td><td><input type="text" name="FormStyle" size="35" value="'.$OverridesArray[12].'"></td></tr>
</table>
<br>
<style>
a.Example1 { text-decoration:underline; }
a.Example1:hover { text-decoration:underline; }
a.Example2 { text-decoration:none; }
a.Example2:hover { text-decoration:none; }
a.Example3 { text-decoration:underline; }
a.Example3:hover { text-decoration:none; }
a.Example4 { text-decoration:none; }
a.Example4:hover { text-decoration:underline; }
</style>
<b>'.$MsgText[0][546].':</b><br>
	<input type="radio" name="LinkDecoration" value="1"'.$LinkDecorationSelected[1].'> <a href="#" class="Example1">'.$MsgText[0][548].'</a><br>
	<input type="radio" name="LinkDecoration" value="2"'.$LinkDecorationSelected[2].'> <a href="#" class="Example2">'.$MsgText[0][549].'</a><br>
	<input type="radio" name="LinkDecoration" value="3"'.$LinkDecorationSelected[3].'> <a href="#" class="Example3">'.$MsgText[0][550].'</a><br>
	<input type="radio" name="LinkDecoration" value="4"'.$LinkDecorationSelected[4].'> <a href="#" class="Example4">'.$MsgText[0][551].'</a><br>
	
<br>
<b>'.$MsgText[0][547].':</b><br>
	<input type="radio" name="BLinkDecoration" value="1"'.$BLinkDecorationSelected[1].'> <a href="#" class="Example1">'.$MsgText[0][548].'</a><br>
	<input type="radio" name="BLinkDecoration" value="2"'.$BLinkDecorationSelected[2].'> <a href="#" class="Example2">'.$MsgText[0][549].'</a><br>
	<input type="radio" name="BLinkDecoration" value="3"'.$BLinkDecorationSelected[3].'> <a href="#" class="Example3">'.$MsgText[0][550].'</a><br>
	<input type="radio" name="BLinkDecoration" value="4"'.$BLinkDecorationSelected[4].'> <a href="#" class="Example4">'.$MsgText[0][551].'</a><br>


<br><br><br><div align="center"><input type="submit" value="'.$MsgText[0][123].'">
</div>

</form>';



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

	}
	else {
	
		RedirectToLogin();
	
	}

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




?>
