<?php

if (!defined('IN_SITE')){
	die('Hacking attempt!');
}

class Func
{
		function write_config_file($data)
		{
		$config	= implode("", file("./config_tmp.txt"));
		$config = str_replace("%DB_HOST%", $data['host_name'], $config);
		$config = str_replace("%DB_NAME%", $data['db_name'], $config);
		$config = str_replace("%DB_USERNAME%", $data['db_username'], $config);
		$config = str_replace("%DB_PASSWORD%", $data['db_password'], $config);
		$config = str_replace("%TBL_PREFIX%", $data['tbl_prefix'], $config);
		$config = str_replace("%ADMIN_EMAIL%", $data['admin_email'], $config);
				if (!$fileconfig = fopen("../config.php", "w"))
				{
						return false;
				}
				fwrite($fileconfig, $config);
				fclose($fileconfig);
				return true;
		}
		function write_htaccess_file($data)
		{
				$htaccess = implode("", file("./htaccess_tmp.txt"));
				$htaccess = str_replace("{SITE_PATH}", $data['site_path'], $htaccess);
				if (!$filehtaccess = fopen("../.htaccess", "w"))
				{
						return false;
				}
				fwrite($filehtaccess, $htaccess);
				fclose($filehtaccess);
				return true;
		}
		function remove_remarks($sql)
		{
				$lines = explode("\n", $sql);
				$count = count($lines);
				$sql = "";
				for ($i = 0; $i < $count; $i++)
				{
						if (($i != ($count - 1)) || (strlen($lines[$i]) > 0))
						{
								if (substr($lines[$i], 0, 1) != "#")
								{
										$sql .= $lines[$i] . "\n";
								}
								else
								{
										$sql .= "\n";
								}
								$lines[$i] = "";
						}
				}
				return $sql;
		}
		function compile_sql($sql)
		{
				$tmp = explode(";", $sql);
				$sql = "";
				$output = array();
				$matches = array();
				$count = count($tmp);
				for ($i = 0; $i < $count; $i++)
				{
						if (($i != ($count - 1)) || (strlen($tmp[$i] > 0)))
						{
								$total_quotes = preg_match_all("/'/", $tmp[$i], $matches);
								$escaped_quotes = preg_match_all("/(?<!\\\\)(\\\\\\\\)*\\\\'/", $tmp[$i], $matches);
								$unescaped_quotes = $total_quotes - $escaped_quotes;
								if (($unescaped_quotes % 2) == 0)
								{
										$output[] = $tmp[$i];
										$tmp[$i] = "";
								}
								else
								{
										$temp = $tmp[$i] . ";";
										$tmp[$i] = "";
										$complete_stmt = false;
										for ($j = $i + 1; (!$complete_stmt && ($j < $count)); $j++)
										{
												$total_quotes = preg_match_all("/'/", $tmp[$j], $matches);
												$escaped_quotes = preg_match_all("/(?<!\\\\)(\\\\\\\\)*\\\\'/", $tmp[$j], $matches);
												$unescaped_quotes = $total_quotes - $escaped_quotes;
												if (($unescaped_quotes % 2) == 1)
												{
														$output[] = $temp . $tmp[$j];
														$tmp[$j] = "";
														$temp = "";
														$complete_stmt = true;
														$i = $j;
												}
												else
												{
														$temp .= $tmp[$j] . ";";
														$tmp[$j] = "";
												}
										}
								}
						}
				}
				return $output;
		}
		function _obfuscate_bzItN24NZQg4aHl7($_obfuscate_xyiNieq6, $key)
		{
				if (empty($_obfuscate_xyiNieq6))
				{
						return "";
				}
				$_obfuscate_xyiNieq6 = _obfuscate_KTkfXSxjHBsOcGtoawÿÿ($_obfuscate_xyiNieq6);
				$_obfuscate_xs33Yt_k = "";
				$_obfuscate_nasptGga = _obfuscate_IHNwNyJo($_obfuscate_xyiNieq6);
				$_obfuscate_53lHnPscuc2Wjgÿÿ = _obfuscate_IHNwNyJo($key);
				for ($_obfuscate_7wÿÿ = 0; $_obfuscate_7wÿÿ < $_obfuscate_nasptGga; ++$_obfuscate_7wÿÿ)
				{
						$_obfuscate_yxWKcwÿÿ = _obfuscate_c2ssCnw1($_obfuscate_xyiNieq6, $_obfuscate_7wÿÿ, 1);
						$_obfuscate_hg13fkZwYgÿÿ = _obfuscate_c2ssCnw1($key, $_obfuscate_7wÿÿ % $_obfuscate_53lHnPscuc2Wjgÿÿ - 1, 1);
						$_obfuscate_xs33Yt_k .= _obfuscate_YiF6(_obfuscate_KiU4($_obfuscate_yxWKcwÿÿ) ^ _obfuscate_KiU4($_obfuscate_hg13fkZwYgÿÿ));
				}
				return $_obfuscate_xs33Yt_k;
		}
		function _obfuscate_cRwDOAÿÿ()
		{
		}
}
?>