diff --git a/tools/inc/cli.php b/tools/inc/cli.php index fcf1c26a..8fdb6c39 100644 --- a/tools/inc/cli.php +++ b/tools/inc/cli.php @@ -8,6 +8,7 @@ * - ../ */ +set_time_limit(0); $shell_path = getcwd(); if(getenv('TINYBOARD_PATH') !== false) @@ -56,21 +57,33 @@ function get_httpd_privileges() { if(!is_writable('.')) die("get_httpd_privileges(): web directory is not writable\n"); - if(!is_writable('inc/')) - die("get_httpd_privileges(): inc/ directory is not writable\n"); - $filename = '.' . md5(rand()) . '.php'; + $inc_filename = '.' . md5(rand()) . '.php'; echo "Copying rebuilder to web directory...\n"; - copy($shell_path . '/' . $_SERVER['PHP_SELF'], $filename); - copy(__FILE__, 'inc/cli.php'); + // replace "/inc/cli.php" with its new filename + passthru("cat " . escapeshellarg($shell_path . '/' . $_SERVER['PHP_SELF']) . " | sed \"s/'\/inc\/cli\.php'/'\/{$inc_filename}'/\" > {$filename}"); + + // copy environment + $inc_header = "