<?

/*
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 Calendar Colors
	// ========================================================================================
	
	$PageTitle = $MsgText[1][4];
	$BrowserTitle = $MsgText[1][4];
	$LocationBar = '<a href="'.$IndexURL.'">'.$MsgText[0][1].'</a> > <a href="' . $MainURL . '/options.html">'.$MsgText[0][4].'</a> > '.$MsgText[1][4];
	
	if ($LoggedIn == 'y') {
		
		ReadPermissions();
		Global $Permissions;
		
		if ($Permissions[101] == 'y') {

	
			ReadFormArguments();
			Global $FormArguments;
			
			if (count($FormArguments) > 0) {
			
			
				for ($i = 1; $i <= 12; $i++) {
					if (substr($FormArguments['co'.$i],0,1) != '#' && $FormArguments['co'.$i] != '') { 
						$FormArguments['co'.$i] = '#'.$FormArguments['co'.$i];
					}
				}
				
				
				for ($i = 1; $i <= 12; $i++) {
					$OverridesString .= '%%'.$FormArguments['co'.$i];
				}
				
				
				
				
																		
							
				$query = "update `".$Settings['DBPrefix']."cl-Settings` set Value='".$OverridesString."' where Name='ColorOverrides' limit 1";
				$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();
	
	}
	
	

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




?>
