auth_challenge($config); } if (!$err) { $id = empty($_GET['id']) ? 0 : $_GET['id']; // see if we want requests logged, and potentially do so $log_responses = empty($config['log_response']) ? '' : $config['log_response']; if ($config['log_request']) { log_file($_SERVER['QUERY_STRING'], $config); } // make sure required parameters have been sent if (!$id) { $err = 'Parameter id required'; } } if (!$err) { $mash_data = data_mash($id, auth_userid(), $config); if (!empty($mash_data['error'])) { $err = $mash_data['error']; } else { $response['data'] = $mash_data; } } if ($err) { $response['error'] = $err; } else { $response['ok'] = 1; } $json = json_encode($response); print $json . "\n\n"; if (!empty($log_responses)) { log_file($json, $config);
} } if (!$err) { if ($config['log_request']) { log_file(print_r($request, 1), $config); } $id = empty($request['id']) ? '' : $request['id']; if (!$id) { $err = 'Parameter id required'; } } if (!$err) { // grab mash data from input or file $uid = auth_userid(); if (empty($request['label'])) { $mash = data_mash($id, $uid, $config); if (!$mash) { $err = 'Could not find mash ' . $id; } } else { // assume we were sent a complete mash payload requiring saving $err = data_save_mash($request, $uid, $config); $mash = $request; } } if (!$err) { // post export transcode job $result = api_export(array('id' => $id, 'mash' => $mash), array('include_progress' => 1), $config); if (!empty($result['error'])) { $err = $result['error']; } else {