diff --git a/tools/TGUICompiler.php b/tools/TGUICompiler.php new file mode 100644 index 00000000000..a51d41b9398 --- /dev/null +++ b/tools/TGUICompiler.php @@ -0,0 +1,184 @@ + 0 && strpos($name, '\\') == false && strpos($name, '/') == false){ + $ext = pathinfo($name, PATHINFO_EXTENSION); + $mime = $finfo->file($F['tmp_name']); + if($ext == 'ract' && $mime == 'text/plain') + $good_files[] = $F; + } + } + if(count($good_files) > 0){ + $tgtgui_path = $tgdir . $path_to_tgui_from_repo; + $requests_dir = $parent_dir . '/requests'; + if(!is_dir($requests_dir)) + mkdir($requests_dir); + $target_path = str_replace('\\', '/', tempnam($requests_dir, 'tgui')); + unlink($target_path); + recurse_copy($tgtgui_path, $target_path); + $parent_node = $parent_dir . '/node_modules'; + $target_node = $target_path . '/node_modules'; + exec('mklink /j "' . str_replace('/', '\\', $target_node) . '" "' . str_replace('/', '\\', $parent_node) . '"'); + + //now copy the uploads to the thing + $target_interfaces = $target_path . '/src/interfaces/'; + foreach($good_files as $F) + move_uploaded_file($F['tmp_name'], $target_interfaces . $F['name']); + + //compile + $command = '"' . $full_path_to_gulp . '" --cwd "' . str_replace('/', '\\', $target_path) . '" --min 2>&1'; + $output = shell_exec($command); + + $zip = new ZipArchive(); + $zippath = $target_path . '/TGUI.zip'; + if($zip->open($zippath, ZipArchive::CREATE) == TRUE){ + $zip->addFile($target_path . '/assets/tgui.css', 'tgui.css'); + $zip->addFile($target_path . '/assets/tgui.js', 'tgui.js'); + $zip->addFromString('gulp_output.txt', $output); + $zip->close(); + download_file($zippath); + } + exec('rmdir "' . str_replace('/', '\\', $target_node) . '"'); //improtant + rrmdir($target_path); + } +} + +?> + + + + TGUI .ract Compiler + + +

Upload up to .ract files

+

Based off revision: ' . $revision . '' : $revision; ?> +
+ Update to latest revision (don't use this unless you have to)
+
+
+
+ + +
+ + + +