diff --git a/html/inc/submit.inc b/html/inc/submit.inc index d21ad7438c..67ef068ade 100644 --- a/html/inc/submit.inc +++ b/html/inc/submit.inc @@ -97,8 +97,10 @@ function do_http_op($req, $xml, $op) { curl_setopt($ch, CURLOPT_POSTFIELDS, $post); $reply = curl_exec($ch); if (!$reply) return array(null, "HTTP error"); - $r = simplexml_load_string($reply); - if (!$r) return array(null, "Can't parse reply XML:
".htmlentities($reply).""); + $r = @simplexml_load_string($reply); + if (!$r) { + return array(null, "Can't parse reply XML:\n$reply"); + } $e = (string)$r->error_msg; if ($e) { return array(null, $e); diff --git a/html/user/submit_example.php b/html/user/submit_example.php index 390a4650b5..f994459dd1 100644 --- a/html/user/submit_example.php +++ b/html/user/submit_example.php @@ -57,7 +57,7 @@ function handle_main() { $req->project = $project; $req->authenticator = $auth; list($batches, $errmsg) = boinc_query_batches($req); - if ($errmsg) error_page($errmsg); + if ($errmsg) error_page(htmlentities($errmsg)); page_head("Job submission and control"); @@ -270,7 +270,7 @@ function handle_create_action() { if ($get_estimate) { $req = form_to_request($project, $auth); list($e, $errmsg) = boinc_estimate_batch($req); - if ($errmsg) error_page($errmsg); + if ($errmsg) error_page(htmlentities($errmsg)); page_head("Batch estimate"); echo sprintf("Estimate: %.0f seconds", $e); echo "
Return to job control page\n"; @@ -278,7 +278,7 @@ function handle_create_action() { } else { $req = form_to_request($project, $auth); list($id, $errmsg) = boinc_submit_batch($req); - if ($errmsg) error_page($errmsg); + if ($errmsg) error_page(htmlentities($errmsg)); page_head("Batch submitted"); echo "Batch created, ID: $id\n"; echo "
Return to job control page\n"; @@ -294,7 +294,7 @@ function handle_query_batch() { $req->authenticator = $auth; $req->batch_id = get_int('batch_id'); list($batch, $errmsg) = boinc_query_batch($req); - if ($errmsg) error_page($errmsg); + if ($errmsg) error_page(htmlentities($errmsg)); page_head("Batch $req->batch_id"); start_table(); @@ -368,7 +368,7 @@ function handle_query_job() { $req->authenticator = $auth; $req->job_id = get_int('job_id'); list($reply, $errmsg) = boinc_query_job($req); - if ($errmsg) error_page($errmsg); + if ($errmsg) error_page(htmlentities($errmsg)); page_head("Job $req->job_id"); echo "job_id>View workunit page on BOINC server\n"; @@ -421,7 +421,7 @@ function handle_abort_batch() { $req->authenticator = $auth; $req->batch_id = get_int('batch_id'); $errmsg = boinc_abort_batch($req); - if ($errmsg) error_page($errmsg); + if ($errmsg) error_page(htmlentities($errmsg)); page_head("Batch aborted"); echo "
Return to job control page\n"; page_tail(); @@ -449,7 +449,7 @@ function handle_retire_batch() { $req->authenticator = $auth; $req->batch_id = get_int('batch_id'); $errmsg = boinc_retire_batch($req); - if ($errmsg) error_page($errmsg); + if ($errmsg) error_page(htmlentities($errmsg)); page_head("Batch retired"); echo "
Return to job control page\n"; page_tail(); diff --git a/tools/remote_submit b/tools/remote_submit index 638f5667df..393e565c5a 100755 --- a/tools/remote_submit +++ b/tools/remote_submit @@ -6,12 +6,13 @@ require_once("submit.inc"); -define("PROJECT", "http://casathome.ihep.ac.cn"); +define("PROJECT", "http://casathome.ihep.ac.cn/"); define("APP_NAME", "uppercase"); +define("LOCAL_DIR", ""); function usage() { global $argv; - die(" + echo " Usage: $argv[0] submit sequence_file (submit 1 job, print batch ID) $argv[0] query batch_id (get the status of a specific batch) @@ -20,11 +21,12 @@ $argv[0] query all (get the status of all batches) $argv[0] get_output batch_id (show URL of output file) $argv[0] abort batch_id (abort a batch) $argv[0] retire batch_id (retire a batch) -\n"); +"; + exit(1); } function get_auth() { - return trim(file_get_contents("auth")); + return trim(file_get_contents(LOCAL_DIR."auth")); } function handle_submit() { @@ -44,6 +46,7 @@ function handle_submit() { list($id, $errmsg) = boinc_submit_batch($req); if ($errmsg) { echo "Error: $errmsg\n"; + exit(1); } else { echo "batch ID: $id\n"; } @@ -97,7 +100,7 @@ function handle_query() { list($batches, $errmsg) = boinc_query_batches($req); if ($errmsg) { echo "Error: $errmsg\n"; - return; + exit(1); } if ($argv[2] == 'all') { foreach ($batches as $batch) { @@ -142,6 +145,7 @@ function handle_abort() { $errmsg = boinc_abort_batch($req); if ($errmsg) { echo "Error: $errmsg\n"; + exit(1); } else { echo "Batch aborted\n"; } @@ -156,6 +160,7 @@ function handle_retire() { $errmsg = boinc_retire_batch($req); if ($errmsg) { echo "Error: $errmsg\n"; + exit(1); } else { echo "Batch retired\n"; }