$tpl->assign("delete_phone_result", $res); } elseif (@$HTTP_GET_VARS["cat"] == "new_status") { // XXX: need to call the workflow api in the following function? $res = Issue::setStatus($HTTP_GET_VARS["iss_id"], $HTTP_GET_VARS["new_sta_id"], true); if ($res == 1) { History::add($HTTP_GET_VARS["iss_id"], $usr_id, History::getTypeID('status_changed'), "Issue manually set to status '" . Status::getStatusTitle($HTTP_GET_VARS["new_sta_id"]) . "' by " . User::getFullName($usr_id)); } $tpl->assign("new_status_result", $res); } elseif (@$HTTP_GET_VARS["cat"] == "new_category") { $res = Issue::setCategory($HTTP_GET_VARS["iss_id"], $HTTP_GET_VARS["iss_prc_id"], true); if ($res == 1) { History::add($HTTP_GET_VARS["iss_id"], $usr_id, History::getTypeID('status_changed'), "Issue manually set to category '" . Category::getTitle($HTTP_GET_VARS["iss_prc_id"]) . "' by " . User::getFullName($usr_id)); } $tpl->assign("new_status_result", $res); } elseif (@$HTTP_GET_VARS["cat"] == "new_project") { $res = Issue::setProject($HTTP_GET_VARS["iss_id"], $HTTP_GET_VARS["iss_prj_id"], true); if ($res == 1) { History::add($HTTP_GET_VARS["iss_id"], $usr_id, History::getTypeID('status_changed'), "Issue manually set to project '" . Project::getName($HTTP_GET_VARS["iss_prj_id"]) . "' by " . User::getFullName($usr_id)); } $tpl->assign("new_status_result", $res); } elseif (@$HTTP_GET_VARS['cat'] == 'authorize_reply') { $res = Authorized_Replier::addUser($HTTP_GET_VARS["iss_id"], $usr_id); $tpl->assign('authorize_reply_result', $res); } elseif (@$HTTP_GET_VARS['cat'] == 'remove_quarantine') { if (Auth::getCurrentRole() > User::getRoleID('Developer')) { $res = Issue::setQuarantine($HTTP_GET_VARS['iss_id'], 0); $tpl->assign('remove_quarantine_result', $res); } } $tpl->assign("current_user_prefs", Prefs::get($usr_id)); $tpl->displayTemplate();
$res = Support::removeEmails(); $tpl->assign('remove_email_result', $res); } elseif ($cat == 'clear_duplicate') { $res = Issue::clearDuplicateStatus($iss_id); $tpl->assign('clear_duplicate_result', $res); } elseif ($cat == 'delete_phone') { $res = Phone_Support::remove($id); $tpl->assign('delete_phone_result', $res); } elseif ($cat == 'new_status') { $res = Issue::setStatus($iss_id, $status_id, true); if ($res == 1) { History::add($iss_id, $usr_id, 'status_changed', "Issue manually set to status '{status}' by {user}", array('status' => Status::getStatusTitle($status_id), 'user' => User::getFullName($usr_id))); } $tpl->assign('new_status_result', $res); } elseif ($cat == 'authorize_reply') { $res = Authorized_Replier::addUser($iss_id, $usr_id); $tpl->assign('authorize_reply_result', $res); } elseif ($cat == 'remove_quarantine') { if (Auth::getCurrentRole() > User::getRoleID('Developer')) { $res = Issue::setQuarantine($iss_id, 0); $tpl->assign('remove_quarantine_result', $res); } } elseif ($cat == 'selfnotify') { if (Issue::canAccess($iss_id, $usr_id)) { $res = Notification::subscribeUser($usr_id, $iss_id, $usr_id, Notification::getDefaultActions($iss_id)); $tpl->assign('selfnotify_result', $res); } } $tpl->assign('current_user_prefs', Prefs::get($usr_id)); $tpl->assign('cat', $cat); $tpl->displayTemplate();
/** * Adds the specified email address to the list of authorized users. * * @access public * @param integer $issue_id The id of the issue. * @param string $email The email of the user. * @param boolean $add_history If this should be logged. */ function manualInsert($issue_id, $email, $add_history = true) { if (Authorized_Replier::isAuthorizedReplier($issue_id, $email)) { return -1; } else { $email = strtolower(Mail_API::getEmailAddress($email)); $workflow = Workflow::handleAuthorizedReplierAdded(Issue::getProjectID($issue_id), $issue_id, $email); if ($workflow === false) { // cancel subscribing the user return -1; } // first check if this is an actual user or just an email address $user_emails = User::getAssocEmailList(); $user_emails = array_map('strtolower', $user_emails); if (in_array($email, array_keys($user_emails))) { return Authorized_Replier::addUser($issue_id, $user_emails[$email], $add_history); } $stmt = "INSERT INTO\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_user_replier\n (\n iur_iss_id,\n iur_usr_id,\n iur_email\n ) VALUES (\n " . Misc::escapeInteger($issue_id) . ",\n " . APP_SYSTEM_USER_ID . ",\n '" . Misc::escapeString($email) . "'\n )"; $res = $GLOBALS["db_api"]->dbh->query($stmt); if (PEAR::isError($res)) { Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__); return -1; } else { if ($add_history) { // add the change to the history of the issue $summary = $email . ' added to the authorized repliers list by ' . User::getFullName(Auth::getUserID()); History::add($issue_id, Auth::getUserID(), History::getTypeID('replier_other_added'), $summary); } } return 1; } }