<?php include("config.php");

if($_POST[change_colors] && $logged->is_admin())
{
	$css =  file_get_contents('style.colors.tmp');
	$css = str_replace("#b_body","#".$_POST[b_body],$css);
	$css = str_replace("#bo_header","#".$_POST[bo_header],$css);
	$css = str_replace("#bo_menubutton","#".$_POST[bo_menubutton],$css);
	$css = str_replace("#b_menubutton","#".$_POST[b_menubutton],$css);
	$css = str_replace("#b_menu","#".$_POST[b_menu],$css);
	$css = str_replace("#c_menutitle","#".$_POST[c_menutitle],$css);
	$css = str_replace("#b_header","#".$_POST[b_header],$css);
	$css = str_replace("#c_header","#".$_POST[c_header],$css);
	$css = str_replace("#b_info_btn","#".$_POST[b_info_btn],$css);
	$css = str_replace("#b_info","#".$_POST[b_info],$css);
	$css = str_replace("#c_info_btn","#".$_POST[c_info_btn],$css);
	$css = str_replace("#b_h_info_btn","#".$_POST[b_h_info_btn],$css);
	$css = str_replace("#c_h_info_btn","#".$_POST[c_h_info_btn],$css);
	$css = str_replace("#c_info","#".$_POST[c_info],$css);
	$css = str_replace("#b_btn","#".$_POST[b_btn],$css);
	$css = str_replace("#b_h_btn","#".$_POST[b_h_btn],$css);
	$css = str_replace("#c_btn","#".$_POST[c_btn],$css);
	$css = str_replace("#bo_btn","#".$_POST[bo_btn],$css);
	$css = str_replace("#c_h_btn","#".$_POST[c_h_btn],$css);
	$css = str_replace("#bo_h_btn","#".$_POST[bo_h_btn],$css);
	$css = str_replace("#b_h_acc","#".$_POST[b_h_acc],$css);
	$css = str_replace("#c_h_acc","#".$_POST[c_h_acc],$css);
	$css = str_replace("#c_sub","#".$_POST[c_sub],$css);
	$css = str_replace("#b_sub","#".$_POST[b_sub],$css);
	$css = str_replace("#c_h_sub","#".$_POST[c_h_sub],$css);
	$css = str_replace("#b_h_sub","#".$_POST[b_h_sub],$css);
	$css = str_replace("#bo_acc","#".$_POST[bo_acc],$css);
	$css = str_replace("#c_acc","#".$_POST[c_acc],$css);
	$css = str_replace("#b_h_menubutton","#".$_POST[b_h_menubutton],$css);
	file_put_contents("style.colors.css", $css);
	$config->set_value("color_bo_header",$_POST[bo_header]);
	$config->set_value("color_b_body",$_POST[b_body]);
	$config->set_value("color_b_menu",$_POST[b_menu]);
	$config->set_value("color_c_menutitle",$_POST[c_menutitle]);
	$config->set_value("color_b_header",$_POST[b_header]);
	$config->set_value("color_c_header",$_POST[c_header]);
	$config->set_value("color_bo_menubutton",$_POST[bo_menubutton]);
	$config->set_value("color_b_menubutton",$_POST[b_menubutton]);
	$config->set_value("color_b_info_btn",$_POST[b_info_btn]);
	$config->set_value("color_b_info",$_POST[b_info]);
	$config->set_value("color_c_info_btn",$_POST[c_info_btn]);
	$config->set_value("color_b_h_info_btn",$_POST[b_h_info_btn]);
	$config->set_value("color_c_h_info_btn",$_POST[c_h_info_btn]);
	$config->set_value("color_c_info",$_POST[c_info]);
	$config->set_value("color_b_btn",$_POST[b_btn]);
	$config->set_value("color_b_h_btn",$_POST[b_h_btn]);
	$config->set_value("color_c_btn",$_POST[c_btn]);
	$config->set_value("color_bo_btn",$_POST[bo_btn]);
	$config->set_value("color_c_h_btn",$_POST[c_h_btn]);
	$config->set_value("color_bo_h_btn",$_POST[bo_h_btn]);
	$config->set_value("color_b_h_acc",$_POST[b_h_acc]);
	$config->set_value("color_c_h_acc",$_POST[c_h_acc]);
	$config->set_value("color_c_sub",$_POST[c_sub]);
	$config->set_value("color_b_sub",$_POST[b_sub]);
	$config->set_value("color_c_h_sub",$_POST[c_h_sub]);
	$config->set_value("color_b_h_sub",$_POST[b_h_sub]);
	$config->set_value("color_bo_acc",$_POST[bo_acc]);
	$config->set_value("color_c_acc",$_POST[c_acc]);
	$config->set_value("color_b_h_menubutton",$_POST[b_h_menubutton]);
	$config->set_value('watermark_text_color',$_POST[watermark_text_color]);
	$config->set_value('watermark_color',$_POST[watermark_color]);
	echo "Colors Changed, please refresh.";
	
}
if($_POST[restore])
{
	$css =  file_get_contents('style.colors.default');
	file_put_contents("style.colors.css", $css);
	$config->set_value("color_bo_header",'2d76a7');
	$config->set_value("color_b_body",'ecf0f1');
	$config->set_value("color_b_menu",'34495e');
	$config->set_value("color_c_menutitle",'6f869e');
	$config->set_value("color_b_header",'ecf0f1');
	$config->set_value("color_c_header",'3d3d3d');
	$config->set_value("color_bo_menubutton",'bdc3c7');
	$config->set_value("color_b_menubutton",'none');
	$config->set_value("color_b_info_btn",'34495e');
	$config->set_value("color_b_info",'4aa3df');
	$config->set_value("color_c_info_btn",'ecf0f1');
	$config->set_value("color_b_h_info_btn",'111111');
	$config->set_value("color_c_h_info_btn",'ecf0f1');
	$config->set_value("color_c_info",'ecf0f1');
	$config->set_value("color_b_btn",'34495e');
	$config->set_value("color_b_h_btn",'111111');
	$config->set_value("color_c_btn",'ecf0f1');
	$config->set_value("color_bo_btn",'1b2938');
	$config->set_value("color_c_h_btn",'ecf0f1');
	$config->set_value("color_bo_h_btn",'1b2938');
	$config->set_value("color_b_h_acc",'4aa3df');
	$config->set_value("color_c_h_acc",'ecf0f1');
	$config->set_value("color_c_sub",'ecf0f1');
	$config->set_value("color_b_sub",'2c3e50');
	$config->set_value("color_c_h_sub",'ecf0f1');
	$config->set_value("color_b_h_sub",'1c2936');
	$config->set_value("color_bo_acc",'2c3e50');
	$config->set_value("color_c_acc",'ecf0f1');
	$config->set_value("color_b_h_menubutton",'ffffff');
	$config->set_value('watermark_text_color','34495e');
	$config->set_value('watermark_color','ffffff');
	echo "Colors Restored as Default.";
}
?>