<?php

						/*************************************\
						
						    Handshakes Professional (3.0)
						            by DZOIC LTD
						       Copyright(c) 2005-2006
						        http://www.dzoic.com
						
						\*************************************/

						///////////////////////////////////////

						admin_validate_section("customize",10);
						$action = $GLOBALS["Get"]->val("action");

							switch($action){

								case '':
									badwords();
									break;
									
								case 'save':
									save_badwords();
									break;

							}//switch

						///////////////////////////////////////
						
function badwords(){
	
	admin_validate();
	
	$data["themes"] = array ();
	$data["themes"] = admin_get_themes();
	
	$theme = $GLOBALS["Get"]->val("theme");
	
	if(empty($theme))
		$theme = $GLOBALS["THEME"];
	
	if($theme){
	$data["theme"] = $theme;
	include(DOC_ROOT."/themes/".$theme."/system/badwords.inc.php");	
	asort($badwords);
	$data["badwords"] = $badwords;	
	$layout[0] = "badwords";
	}//if
	
	$data["section"] = "customize";
	$data["subsection"] = 10;
	$data["title_id"] = "4";	
	admin_output($layout,$data);
	
}//badwords

function save_badwords(){
	
	admin_validate();	
	
	$badwords = handle_empties($GLOBALS["Get"]->val("badwords"),1);
	$theme    = $GLOBALS["Get"]->val("theme");
	
	$write_str = "<?php\n\n";
	$write_str.= go_through_array("\$badwords",$badwords);
	$write_str.= "\n?>";
	
	$file = DOC_ROOT."/themes/".$theme."/system/badwords.inc.php";
	$file_handler = fopen($file,"w");
	fwrite($file_handler,$write_str);
	fclose($file_handler);
	
	load_page("index.php?section=badwords&theme=".$theme);
	
}//save_badwords
						
?>