<?

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



	// ========================================================================================
	// Save Forum Prefs
	// ========================================================================================
	
	$PageTitle = $MsgText[2][2];
	$BrowserTitle = $MsgText[2][2];
	$LocationBar = '<a href="'.$IndexURL.'">'.$MsgText[0][1].'</a> > <a href="' . $MainURL . '/options.html">'.$MsgText[0][4].'</a> > '.$MsgText[2][2];
	
	if ($LoggedIn == 'y') {
		
		ReadPermissions();
		Global $Permissions;
		
		if ($Permissions[204] == 'y') {
	
			//$PageContents = '<br><b>Existing Calendar Events</b>';
	
			ReadFormArguments();
			Global $FormArguments;
			
			if (count($FormArguments) > 0) {
																		
				$query = "update `".$Settings['DBPrefix']."mb-Settings` set Value='".$FormArguments['PageTitle']."' where Name='PageTitle' limit 1";
				$result = mysql_query($query) or die (mysql_error());
				
				$query = "update `".$Settings['DBPrefix']."mb-Settings` set Value='".$FormArguments['TitleAlignment']."' where Name='TitleAlignment' limit 1";
				$result = mysql_query($query) or die (mysql_error());
				
				
				$query = "update `".$Settings['DBPrefix']."mb-Settings` set Value='".$FormArguments['TopText']."' where Name='TopText' limit 1";
				$result = mysql_query($query) or die (mysql_error());
				
				$query = "update `".$Settings['DBPrefix']."mb-Settings` set Value='".$FormArguments['TopTextAlignment']."' where Name='TopTextAlignment' limit 1";
				$result = mysql_query($query) or die (mysql_error());
				
				
				$query = "update `".$Settings['DBPrefix']."mb-Settings` set Value='".$FormArguments['BottomText']."' where Name='BottomText' limit 1";
				$result = mysql_query($query) or die (mysql_error());
				
				$query = "update `".$Settings['DBPrefix']."mb-Settings` set Value='".$FormArguments['BottomTextAlignment']."' where Name='BottomTextAlignment' limit 1";
				$result = mysql_query($query) or die (mysql_error());
				
				
				$query = "update `".$Settings['DBPrefix']."mb-Settings` set Value='".$FormArguments['MessagesPerPage']."' where Name='MessagesPerPage' limit 1";
				$result = mysql_query($query) or die (mysql_error());
				
				$query = "update `".$Settings['DBPrefix']."mb-Settings` set Value='".$FormArguments['ThreadsPerPage']."' where Name='ThreadsPerPage' limit 1";
				$result = mysql_query($query) or die (mysql_error());
				
				
				$query = "update `".$Settings['DBPrefix']."mb-Settings` set Value='".$FormArguments['PEAlignment']."' where Name='PEAlignment' limit 1";
				$result = mysql_query($query) or die (mysql_error());
				
				
				
				$query = "select * from `".$Settings['DBPrefix']."mb-Settings` where Name='TitleImage' limit 1";
				$result = mysql_query($query) or die (mysql_error());
				if (mysql_num_rows($result) > 0) {
					$query = "update `".$Settings['DBPrefix']."mb-Settings` set Value='".$FormArguments['TitleImage']."' where Name='TitleImage' limit 1";
					$result = mysql_query($query) or die (mysql_error());
				}
				else {
					$query = "insert into `".$Settings['DBPrefix']."mb-Settings` (Name, Value) values ('TitleImage','".$FormArguments['TitleImage']."')";
					$result = mysql_query($query) or die (mysql_error());
				}
				
				
				$query = "select * from `".$Settings['DBPrefix']."mb-Settings` where Name='SignatureImageMaxWidth' limit 1";
				$result = mysql_query($query) or die (mysql_error());
				if (mysql_num_rows($result) > 0) {
					$query = "update `".$Settings['DBPrefix']."mb-Settings` set Value='".$FormArguments['SignatureImageMaxWidth']."' where Name='SignatureImageMaxWidth' limit 1";
					$result = mysql_query($query) or die (mysql_error());
				}
				else {
					$query = "insert into `".$Settings['DBPrefix']."mb-Settings` (Name, Value) values ('SignatureImageMaxWidth','".$FormArguments['SignatureImageMaxWidth']."')";
					$result = mysql_query($query) or die (mysql_error());
				}
				
				$query = "select * from `".$Settings['DBPrefix']."mb-Settings` where Name='SignatureImageMaxHeight' limit 1";
				$result = mysql_query($query) or die (mysql_error());
				if (mysql_num_rows($result) > 0) {
					$query = "update `".$Settings['DBPrefix']."mb-Settings` set Value='".$FormArguments['SignatureImageMaxHeight']."' where Name='SignatureImageMaxHeight' limit 1";
					$result = mysql_query($query) or die (mysql_error());
				}
				else {
					$query = "insert into `".$Settings['DBPrefix']."mb-Settings` (Name, Value) values ('SignatureImageMaxHeight','".$FormArguments['SignatureImageMaxHeight']."')";
					$result = mysql_query($query) or die (mysql_error());
				}
				
							
			
				header('Location: ' . $MainURL . '/options.html');
				
			}
			else {
				$PageContents = $MsgText[0][98];
			}
			
		}
		else {
		
			$PageContents = $MsgText[0][97];
		
		}

	}
	else {
	
		RedirectToLogin();
	
	}
	
	

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




?>
