Skip to content

Commit

Permalink
svn path=/trunk/boinc/; revision=25544
Browse files Browse the repository at this point in the history
  • Loading branch information
davidpanderson committed Apr 11, 2012
1 parent 8b9c871 commit 30ec61b
Showing 1 changed file with 28 additions and 2 deletions.
30 changes: 28 additions & 2 deletions html/user/tree_threader.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
<?php

// Handler for TreeThreader remote job submission.
//
// Assumptions:
// - there is a file "three_threader_templates" in the project root
// containing (one per line) the names of files containing
// gzipped collections of template files
// - These files are in the download hierarchy.

require_once("../inc/boinc_db.inc");
require_once("../inc/submit_db.inc");
Expand All @@ -18,7 +24,10 @@ function error($s) {
exit;
}

function handle_submit($r) {
function handle_submit($r, $user) {

$batch_id = BoincBatch::insert("(user_id, create_time, njobs, name, app_id, state) values ($user->id, $now, $njobs, '$batch_name', $app->id, ".BATCH_STATE_IN_PROGRESS.")"
);
}

function handle_abort($r) {
Expand All @@ -41,8 +50,25 @@ function handle_retire($r) {
error("can't parse request message");
}

// authenticate the user
//
$auth = (string)$r->auth;
$user = BoincUser::lookup("auth='$auth'");
if (!$user) error("invalid authenticator");
$user_submit = BoincUserSubmit::lookup_userid($user->id);
if (!$user_submit) error("no submit access");
$app = BoincApp::lookup("name='tree_threader'");
if (!$app) error("no tree_threader app");

if (!$user_submit->submit_all) {
$usa = BoincUserSubmitApp::lookup("user_id=$user->id and app_id=$app->id");
if (!$usa) {
error("no submit access");
}
}

switch ($r->getName()) {
case 'submit': handle_submit($r); break;
case 'submit': handle_submit($r, $user); break;
case 'abort': handle_abort($r); break;
case 'status': handle_status($r); break;
case 'get_output': handle_get_output($r); break;
Expand Down

0 comments on commit 30ec61b

Please sign in to comment.