/** * @param int $issue_id * @param int $draft_id * @return string * @access protected */ public function sendDraft($issue_id, $draft_id) { $draft = Draft::getDraftBySequence($issue_id, $draft_id); AuthCookie::setProjectCookie(Issue::getProjectID($issue_id)); if (count($draft) < 1 || !is_array($draft)) { throw new RemoteApiException('Draft #' . $draft_id . " does not exist for issue #{$issue_id}"); } $res = Draft::send($draft['emd_id']); if ($res == 1) { return "Draft #{$draft_id} sent successfully.\n"; } throw new RemoteApiException('Error sending Draft #' . $draft_id . "\n"); }
function sendDraft($p) { $email = XML_RPC_decode($p->getParam(0)); $password = XML_RPC_decode($p->getParam(1)); $auth = authenticate($email, $password); if (is_object($auth)) { return $auth; } $issue_id = XML_RPC_decode($p->getParam(2)); $draft_id = XML_RPC_decode($p->getParam(3)); $draft = Draft::getDraftBySequence($issue_id, $draft_id); createFakeCookie($email, Issue::getProjectID($issue_id)); if (count($draft) < 1 || !is_array($draft)) { return new XML_RPC_Response(0, $XML_RPC_erruser + 1, "Draft #" . $draft_id . " does not exist for issue #{$issue_id}"); } $res = Draft::send($draft["emd_id"]); if ($res == 1) { return new XML_RPC_Response(XML_RPC_Encode("Draft #" . $draft_id . " sent successfully.\n")); } else { return new XML_RPC_Response(0, $XML_RPC_erruser + 1, "Error sending Draft #" . $draft_id . "\n"); } }