Location: PHPKode > projects > PHP SQL tools > prfile/make_atf.php
<?
include("identify.php");
load_all("make_atf",5);
?>
<!doctype html public "-//w3c//dtd html 3.2//en">

<html>

<head>
<title>Building ATF file...</title>
<meta name="GENERATOR" content="Arachnophilia 4.0">
<meta name="FORMATTER" content="Arachnophilia 4.0">
</head>

<body bgcolor="<? echo "$theme_bgcolor"; ?>" text="<? echo "$theme_text_color"; ?>">

<? topheader(); 
$ATF_builder_ver = "0.56.1";
echo "Building ATF file... (Builder V$ATF_builder_ver)";
botheader(); ?>

<? topcontent(); 
if ($export_theme_id == NULL) {
	echo "<b>Error</b>:<br>";
	echo "No theme ID supplied, ATF file creation aborted";
	botcontent();
	include("botpage.inc");
	die;
}

$theme_table_name = 'themes';

	$sql = "
		SELECT *
		FROM $theme_table_name
		WHERE id = $export_theme_id
		ORDER BY id
	";
	$result = @mysql_query($sql, $main_settings->connection) or die("Couldn't execute query.");

	$row = mysql_fetch_array($result);

		echo "Reading theme variables...";
		$fd = fopen ("theme_vars.lst", "r");
	while (!feof ($fd)) {
   		$line = fgets($fd, 4096);
		$line = trim($line);
		$theme_var = $row[$line];
		if ($file_name == NULL) {
			$file_name = $theme_var . ".atf";
			$theme_name = $theme_var;
		}
		
		if ( !($theme_var == "") ) {
			$new_list[count($new_list)+1] = "var $line $theme_var\n";
		}
	}
	fclose ($fd); 
	echo "Done<br>";
	
	
	echo "Writing theme file(<b>$file_name</b>)...<br>";
	$fd = fopen ($file_name, "w");
	$info_block = "////////////////////////////////////
// Alkaline Theme File
// Built with V$ATF_builder_ver written by Chris Rasys
// --------------
// Theme $theme_name (Built on $main_settings->server_date)
////////////////////////////////////\n
";
	fwrite($fd, "ident alkalinephp theme file\n");
	fwrite($fd, $info_block);
	fwrite($fd, "// Importation settings\n");
	fwrite($fd, "set compat_level 2\n");
	fwrite($fd, "set locked 0\n");
	fwrite($fd, "set encrypted 0\n\n");
	fwrite($fd, "// Theme variables\n");
	for ($i = 1; $i <= count($new_list); $i++) {
		echo "---$new_list[$i]<br>";
		fwrite($fd, $new_list[$i]);
	}
	fclose($fd);
	echo "<br>Done<br>";
	
	echo "Return to <a href=\"themes.php\">Theme Manager</a>";

 botcontent(); 
include("botpage.inc"); ?>

</form>

</body>

</html>
Return current item: PHP SQL tools