All pastes #559908 Raw Edit

createFlexBuildFile.php

public php v1 · immutable
·published 2007-06-11 23:06 UTC
rendered paste body
<?php	/**	* Clean Posts To Prevent Attacks	*/	function PostClean($String, $nlbr = false) {		if (get_magic_quotes_gpc()) {			$String = stripslashes($String);		}		if ($nlbr) {			$String = nl2br($String);		}		return htmlspecialchars($String);	}	/*	* Validate Post Variables	*/	$User = PostClean(trim($_POST['user']));	$Project = PostClean(trim($_POST['project']));	/*	*  Create Build XML File	*/	$Code = "<?xml version="1.0" encoding=\"utf-8\"?>";	$Code = $Code . "<project name=\"" . $Project . "\" basedir=\".\">";	$Code = $Code . "<taskdef resource=\"flexTasks.tasks\" classpath=\"${basedir}/lib/flexTasks.jar\" />";	$Code = $Code . "<property name=\"FLEX_HOME\" value=\"/home/vipercre/www/fileglory/flexpad/sdk"/>";	$Code = $Code . "<property name=\"APP_ROOT\" value=\"/home/vipercre/www/fileglory/flexpad/user/" . $User . "/" . $Project . "\"/>";	$Code = $Code . "<property name=\"DEPLOY_DIR\" value=\"user/" . $User . "/" . $Project . "/bin\"/>";	$Code = $Code . "<target name=\"main\">";	$Code = $Code . "<mxmlc file=\"${App_Root}/\" . $Project . ".mxml\" output=\"${DeployDir}/" . $Project . ".swf\" actionscript-file-encoding=\"UTF-8\" keep-generated-actionscript=\"true\" incremental=\"true\">";	$Code = $Code . "<load-config filename=\"${Flex_Home}/frameworks/flex-config.xml\"/>";	$Code = $Code . "<source-path path-element=\"${Flex_Home}/frameworks\"/>";	$Code = $Code . "<compiler.library-path dir=\"${Flex_Home}/frameworks\" append=\"true\">";	$Code = $Code . "<include name=\"libs\" />";	$Code = $Code . "<include name=\"../bundles/{locale}\" />";	$Code = $Code . "</compiler.library-path>";	$Code = $Code . "<default-size width=\"500\" height=\"600\" />";	$Code = $Code . "</mxmlc>";	$Code = $Code . "</target>";	$Code = $Code . "<target name=\"clean\">";	$Code = $Code . "<delete dir=\"${App_Root}/generated\"/>";	$Code = $Code . "<delete>";	$Code = $Code . "<fileset dir=\"${Deploy_Dir}\" includes=\"" . $Project . ".swf\"/>";	$Code = $Code . "</delete> ";	$Code = $Code . "</target>";	$Code = $Code . "</project>";	/*	* Create/Overwrite Build File	*/	$File = fopen("/home/vipercre/www/fileglory/flexpad/user/" . $User . "/" . $Project . "/" . $Project . ".xml", "w") or die("Can't create file.");	$WriteFile = fwrite($File, $Code);	$CloseFile = fclose($File);	/*	* Execute Build File	*/	exec("/home/vipercre/www/fileglory/flexpad/ant/ant -buildfile users/" . $User . "/" . $Project . "/" . $Project . ".xml main");?>