/** * @param int $issue_id * @param int $note_id * @param string $target * @param bool $authorize_sender * @return string * @access protected */ public function convertNote($issue_id, $note_id, $target, $authorize_sender) { AuthCookie::setProjectCookie(Issue::getProjectID($issue_id)); $res = Note::convertNote($note_id, $target, $authorize_sender); if (empty($res)) { throw new RemoteApiException('Error converting note'); } return 'OK'; }
// +----------------------------------------------------------------------+ // // @(#) $Id$ // include_once "config.inc.php"; include_once APP_INC_PATH . "db_access.php"; include_once APP_INC_PATH . "class.template.php"; include_once APP_INC_PATH . "class.auth.php"; include_once APP_INC_PATH . "class.note.php"; include_once APP_INC_PATH . "class.draft.php"; include_once APP_INC_PATH . "class.support.php"; include_once APP_INC_PATH . "class.mime_helper.php"; include_once APP_INC_PATH . "class.mail.php"; include_once APP_INC_PATH . "class.date.php"; include_once APP_INC_PATH . "class.issue.php"; include_once APP_INC_PATH . "class.notification.php"; $tpl = new Template_API(); $tpl->setTemplate("convert_note.tpl.html"); Auth::checkAuthentication(APP_COOKIE, 'index.php?err=5', true); if (@$HTTP_POST_VARS['cat'] == 'convert') { if (@$HTTP_POST_VARS["add_authorized_replier"] == 1) { $authorize_sender = true; } else { $authorize_sender = false; } $tpl->assign("convert_result", Note::convertNote($HTTP_POST_VARS['note_id'], $HTTP_POST_VARS['target'], $authorize_sender)); } else { $tpl->assign("note_id", $HTTP_GET_VARS['id']); } $tpl->assign("current_user_prefs", Prefs::get(Auth::getUserID())); $tpl->displayTemplate();
function convertNote($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)); $note_id = XML_RPC_decode($p->getParam(3)); $target = XML_RPC_decode($p->getParam(4)); $authorize_sender = XML_RPC_decode($p->getParam(5)); createFakeCookie($email, Issue::getProjectID($issue_id)); $res = Note::convertNote($note_id, $target, $authorize_sender); if ($res) { return new XML_RPC_Response(XML_RPC_Encode("OK")); } else { return new XML_RPC_Response(0, $XML_RPC_erruser + 1, "Error converting note"); } }
// | 51 Franklin Street, Suite 330 | // | Boston, MA 02110-1301, USA. | // +----------------------------------------------------------------------+ // | Authors: João Prado Maia <*****@*****.**> | // +----------------------------------------------------------------------+ require_once dirname(__FILE__) . '/../init.php'; $tpl = new Template_Helper(); $tpl->setTemplate('convert_note.tpl.html'); Auth::checkAuthentication(APP_COOKIE, 'index.php?err=5', true); $usr_id = Auth::getUserID(); $note_id = !empty($_GET['id']) ? $_GET['id'] : $_POST['note_id']; $note = Note::getDetails($note_id); $issue_id = $note['not_iss_id']; if (User::getRoleByUser($usr_id, Issue::getProjectID($issue_id)) < User::getRoleID('Standard User') || !Access::canConvertNote($issue_id, Auth::getUserID())) { $tpl->setTemplate('permission_denied.tpl.html'); $tpl->displayTemplate(); exit; } if (@$_POST['cat'] == 'convert') { if (@$_POST['add_authorized_replier'] == 1) { $authorize_sender = true; } else { $authorize_sender = false; } $tpl->assign('convert_result', Note::convertNote($_POST['note_id'], $_POST['target'], $authorize_sender)); } else { $tpl->assign('note_id', $_GET['id']); } $tpl->assign('current_user_prefs', Prefs::get(Auth::getUserID())); $tpl->assign('issue_id', $issue_id); $tpl->displayTemplate();