if ($cat == 'reply') { $details = Issue::getReplyDetails($_GET['issue_id']); if ($details != '') { $header = Misc::formatReplyPreamble($details['created_date_ts'], $details['reporter']); $details['seb_body'] = $header . Misc::formatReply($details['description']); $details['sup_from'] = Mail_Helper::getFormattedName($details['reporter'], $details['reporter_email']); $tpl->assign(array('email' => $details, 'parent_email_id' => 0, 'extra_title' => 'Issue #' . $_GET['issue_id'] . ': Reply')); } } if (!empty($issue_id)) { // list the available statuses $tpl->assign('statuses', Status::getAssocStatusList($prj_id, false)); $tpl->assign('current_issue_status', Issue::getStatusID($issue_id)); // set if the current user is allowed to send emails on this issue or not $sender_details = User::getDetails($usr_id); $tpl->assign('can_send_email', Support::isAllowedToEmail($issue_id, $sender_details['usr_email'])); $tpl->assign('subscribers', Notification::getSubscribers($issue_id, 'emails')); } if (!empty($_GET['ema_id']) || !empty($_POST['ema_id'])) { $ema_id = isset($_GET['ema_id']) ? (int) $_GET['ema_id'] : (isset($_POST['ema_id']) ? (int) $_POST['ema_id'] : null); $tpl->assign('ema_id', $ema_id); } $user_prefs = Prefs::get($usr_id); // list of users to display in the lookup field in the To: and Cc: fields $t = Project::getAddressBook($prj_id, $issue_id); $tpl->assign(array('from' => User::getFromHeader($usr_id), 'assoc_users' => $t, 'assoc_emails' => array_keys($t), 'canned_responses' => Email_Response::getAssocList($prj_id), 'js_canned_responses' => Email_Response::getAssocListBodies($prj_id), 'current_user_prefs' => $user_prefs, 'issue_access' => Access::getIssueAccessArray($issue_id, $usr_id), 'max_attachment_size' => Attachment::getMaxAttachmentSize(), 'max_attachment_bytes' => Attachment::getMaxAttachmentSize(true))); // don't add signature if it already exists. Note: This won't handle multiple user duplicate sigs. if (@(!empty($draft['emd_body'])) && $user_prefs['auto_append_email_sig'] == 1 && strpos($draft['emd_body'], $user_prefs['email_signature']) !== false) { $tpl->assign('body_has_sig_already', 1); } $tpl->displayTemplate();
* @license GNU General Public License, version 2 or later (GPL-2+) * * For the full copyright and license information, * please see the COPYING and AUTHORS files * that were distributed with this source code. */ require_once __DIR__ . '/../../init.php'; $tpl = new Template_Helper(); $tpl->setTemplate('manage/email_responses.tpl.html'); Auth::checkAuthentication(); $role_id = Auth::getCurrentRole(); if ($role_id < User::ROLE_MANAGER) { Misc::setMessage(ev_gettext('Sorry, you are not allowed to access this page.'), Misc::MSG_ERROR); $tpl->displayTemplate(); exit; } if (@$_POST['cat'] == 'new') { $res = Email_Response::insert(); Misc::mapMessages($res, array(1 => array(ev_gettext('Thank you, the email response was added successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to add the new email response.'), Misc::MSG_INFO), -2 => array(ev_gettext('Please enter the title for this new issue resolution.'), Misc::MSG_ERROR))); } elseif (@$_POST['cat'] == 'update') { $res = Email_Response::update(); Misc::mapMessages($res, array(1 => array(ev_gettext('Thank you, the email response was updated successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to update the new email response.'), Misc::MSG_INFO), -2 => array(ev_gettext('Please enter the title for this issue resolution.'), Misc::MSG_ERROR))); } elseif (@$_POST['cat'] == 'delete') { Email_Response::remove(); } if (@$_GET['cat'] == 'edit') { $tpl->assign('info', Email_Response::getDetails($_GET['id'])); } $tpl->assign('project_list', Project::getAll()); $tpl->assign('list', Email_Response::getList()); $tpl->displayTemplate();
include_once "../config.inc.php"; include_once APP_INC_PATH . "class.template.php"; include_once APP_INC_PATH . "class.auth.php"; include_once APP_INC_PATH . "class.user.php"; include_once APP_INC_PATH . "class.email_response.php"; include_once APP_INC_PATH . "db_access.php"; $tpl = new Template_API(); $tpl->setTemplate("manage/index.tpl.html"); Auth::checkAuthentication(APP_COOKIE); $tpl->assign("type", "email_responses"); $role_id = Auth::getCurrentRole(); if ($role_id == User::getRoleID('administrator') || $role_id == User::getRoleID('manager')) { if ($role_id == User::getRoleID('administrator')) { $tpl->assign("show_setup_links", true); } if (@$HTTP_POST_VARS["cat"] == "new") { $tpl->assign("result", Email_Response::insert()); } elseif (@$HTTP_POST_VARS["cat"] == "update") { $tpl->assign("result", Email_Response::update()); } elseif (@$HTTP_POST_VARS["cat"] == "delete") { Email_Response::remove(); } if (@$HTTP_GET_VARS["cat"] == "edit") { $tpl->assign("info", Email_Response::getDetails($HTTP_GET_VARS["id"])); } $tpl->assign("project_list", Project::getAll()); $tpl->assign("list", Email_Response::getList()); } else { $tpl->assign("show_not_allowed_msg", true); } $tpl->displayTemplate();
/** * Method used to get the list of canned email responses available in the * system. * * @access public * @return array The list of canned email responses */ function getList() { $stmt = "SELECT\n ere_id,\n ere_title\n FROM\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "email_response\n ORDER BY\n ere_title ASC"; $res = $GLOBALS["db_api"]->dbh->getAll($stmt, DB_FETCHMODE_ASSOC); if (PEAR::isError($res)) { Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__); return ""; } else { // get the list of associated projects for ($i = 0; $i < count($res); $i++) { $res[$i]['projects'] = implode(", ", array_values(Email_Response::getAssociatedProjects($res[$i]['ere_id']))); } return $res; } }
$details['seb_body'] = $header . Misc::formatReply($details['description']); $details['sup_from'] = Mail_API::getFormattedName($details['reporter'], $details['reporter_email']); $tpl->bulkAssign(array("email" => $details, "parent_email_id" => 0, "extra_title" => "Issue #" . $HTTP_GET_VARS['issue_id'] . ": Reply")); } } if (!empty($issue_id)) { // list the available statuses $tpl->assign("statuses", Status::getAssocStatusList($prj_id, false)); $tpl->assign("current_issue_status", Issue::getStatusID($issue_id)); // set if the current user is allowed to send emails on this issue or not $sender_details = User::getDetails($usr_id); $tpl->assign("can_send_email", Support::isAllowedToEmail($issue_id, $sender_details["usr_email"])); } if (!@empty($HTTP_GET_VARS["ema_id"]) || !@empty($HTTP_POST_VARS["ema_id"])) { @$tpl->assign("ema_id", $HTTP_GET_VARS["ema_id"] ? $HTTP_GET_VARS["ema_id"] : $HTTP_POST_VARS["ema_id"]); } $tpl->assign("from", User::getFromHeader($usr_id)); // list of users to display in the lookup field in the To: and Cc: fields $t = Project::getAddressBook($prj_id, $issue_id); $tpl->assign("assoc_users", $t); $tpl->assign("assoc_emails", array_keys($t)); $tpl->assign("canned_responses", Email_Response::getAssocList($prj_id)); $tpl->assign("js_canned_responses", Email_Response::getAssocListBodies($prj_id)); $tpl->assign('subscribers', Notification::getSubscribers($issue_id, 'emails')); $user_prefs = Prefs::get($usr_id); $tpl->assign("current_user_prefs", $user_prefs); // don't add signature if it already exists. Note: This won't handle multiple user duplicate sigs. if (@(!empty($draft['emd_body'])) && $user_prefs["auto_append_sig"] == 'yes' && strpos($draft['emd_body'], $user_prefs["email_signature"]) !== false) { $tpl->assign('body_has_sig_already', 1); } $tpl->displayTemplate();