<?

/*
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 settings changes
	// ========================================================================================
	
	$PageTitle = $MsgText[0][64];
	$BrowserTitle = $MsgText[0][64];
	$LocationBar = '<a href="'.$IndexURL.'">'.$MsgText[0][1].'</a> > <a href="'.$MainURL.'/options.html">'.$MsgText[0][4].'</a> > '.$MsgText[0][64];
	
	if ($LoggedIn == 'y') {
		
		ReadPermissions();
		Global $Permissions;
		
		if ($Permissions[8] == 'y') {
	
			ReadFormArguments();
			Global $FormArguments;
			
			if (count($FormArguments) > 0) {
			
			// remove slash from the end of the url values
			//if (substr($FormArguments['BaseURL'],strlen($FormArguments['BaseURL'])-1,1) == '/') {
			//	$FormArguments['BaseURL'] = substr($FormArguments['BaseURL'],0,strlen($FormArguments['BaseURL'])-1);
			//}
			if (substr($FormArguments['ImagesURL'],strlen($FormArguments['ImagesURL'])-1,1) == '/') {
				$FormArguments['ImagesURL'] = substr($FormArguments['ImagesURL'],0,strlen($FormArguments['ImagesURL'])-1);
			}
			
			
					
			
			$query = "update `".$Settings['DBPrefix']."core-Settings` set Value='".$FormArguments['ImagesURL']."' where Name='ImagesURL' limit 1";
			$result = mysql_query($query) or die (mysql_error());
			
			$query = "update `".$Settings['DBPrefix']."core-Settings` set Value='".$FormArguments['ScriptName']."' where Name='ScriptName' limit 1";
			$result = mysql_query($query) or die (mysql_error());
			
			$query = "update `".$Settings['DBPrefix']."core-Settings` set Value='".$FormArguments['CookieName']."' where Name='CookieName' limit 1";
			$result = mysql_query($query) or die (mysql_error());
			
			$query = "update `".$Settings['DBPrefix']."core-Settings` set Value='".$FormArguments['TimezoneOffset']."' where Name='TimezoneOffset' limit 1";
			$result = mysql_query($query) or die (mysql_error());
			
			
			
			if ($Settings['WindowsQSPatch'] == 'y') {
				$FormArguments['ScriptName'] .= '?';
			}
			
			
			header('Location: ' . $BaseURL . '/' . $FormArguments['ScriptName'] . '/options.html');
			
			
			}
			else {
				$PageContents = $MsgText[0][98];
			}
			

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

	}
	else {
	
		RedirectToLogin();
	
	}

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




?>
