本文整理汇总了PHP中Issue::canAccess方法的典型用法代码示例。如果您正苦于以下问题:PHP Issue::canAccess方法的具体用法?PHP Issue::canAccess怎么用?PHP Issue::canAccess使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Issue
的用法示例。
在下文中一共展示了Issue::canAccess方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendDirectEmail
/**
* Method used to send emails directly from the sender to the
* recipient. This will not re-write the sender's email address
* to issue-xxxx@ or whatever.
*
* @param integer $issue_id The issue ID
* @param string $from The sender of this message
* @param string $to The primary recipient of this message
* @param string $cc The extra recipients of this message
* @param string $subject The subject of this message
* @param string $body The message body
* @param string $message_id The message-id
* @param integer $sender_usr_id The ID of the user sending this message.
* @param array $attachment An array with attachment information.
* @return void
*/
public function sendDirectEmail($issue_id, $from, $to, $cc, $subject, $body, $attachment, $message_id, $sender_usr_id = false)
{
$prj_id = Issue::getProjectID($issue_id);
$subject = Mail_Helper::formatSubject($issue_id, $subject);
$recipients = self::getRecipientsCC($cc);
$recipients[] = $to;
// send the emails now, one at a time
foreach ($recipients as $recipient) {
$mail = new Mail_Helper();
if (!empty($issue_id)) {
// add the warning message to the current message' body, if needed
$fixed_body = Mail_Helper::addWarningMessage($issue_id, $recipient, $body, array());
$mail->setHeaders(array('Message-Id' => $message_id));
// skip users who don't have access to this issue (but allow non-users and users without access to this project) to get emails
$recipient_usr_id = User::getUserIDByEmail(Mail_Helper::getEmailAddress($recipient), true);
if (!empty($recipient_usr_id) && (!Issue::canAccess($issue_id, $recipient_usr_id) && User::getRoleByUser($recipient_usr_id, $prj_id) != null) || empty($recipient_usr_id) && Issue::isPrivate($issue_id)) {
continue;
}
} else {
$fixed_body = $body;
}
if (User::getRoleByUser(User::getUserIDByEmail(Mail_Helper::getEmailAddress($from)), Issue::getProjectID($issue_id)) == User::getRoleID('Customer')) {
$type = 'customer_email';
} else {
$type = 'other_email';
}
if ($attachment && !empty($attachment['name'][0])) {
$mail->addAttachment($attachment['name'][0], file_get_contents($attachment['tmp_name'][0]), $attachment['type'][0]);
}
$mail->setTextBody($fixed_body);
$mail->send($from, $recipient, $subject, true, $issue_id, $type, $sender_usr_id);
}
}
示例2: Template_API
// | |
// | Free Software Foundation, Inc. |
// | 59 Temple Place - Suite 330 |
// | Boston, MA 02111-1307, USA. |
// +----------------------------------------------------------------------+
// | Authors: João Prado Maia <jpm@mysql.com> |
// +----------------------------------------------------------------------+
//
// @(#) $Id$
//
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.time_tracking.php";
include_once APP_INC_PATH . "db_access.php";
$tpl = new Template_API();
$tpl->setTemplate("add_time_tracking.tpl.html");
Auth::checkAuthentication(APP_COOKIE, 'index.php?err=5', true);
$issue_id = @$HTTP_POST_VARS["issue_id"] ? $HTTP_POST_VARS["issue_id"] : $HTTP_GET_VARS["iss_id"];
if (!Issue::canAccess($issue_id, Auth::getUserID())) {
$tpl = new Template_API();
$tpl->setTemplate("permission_denied.tpl.html");
$tpl->displayTemplate();
exit;
}
if (@$HTTP_POST_VARS["cat"] == "add_time") {
$res = Time_Tracking::insertEntry();
$tpl->assign("time_add_result", $res);
}
$tpl->assign(array("issue_id" => $issue_id, "time_categories" => Time_Tracking::getAssocCategories(), "current_user_prefs" => Prefs::get(Auth::getUserID())));
$tpl->displayTemplate();
示例3: dirname
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
// | GNU General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with this program; if not, write to: |
// | |
// | Free Software Foundation, Inc. |
// | 51 Franklin Street, Suite 330 |
// | Boston, MA 02110-1301, USA. |
// +----------------------------------------------------------------------+
// | Authors: João Prado Maia <jpm@mysql.com> |
// +----------------------------------------------------------------------+
require_once dirname(__FILE__) . '/../init.php';
$tpl = new Template_Helper();
$tpl->setTemplate('add_phone_entry.tpl.html');
Auth::checkAuthentication(APP_COOKIE, 'index.php?err=5', true);
$issue_id = @$_POST['issue_id'] ? $_POST['issue_id'] : $_GET['iss_id'];
if (!Issue::canAccess($issue_id, Auth::getUserID()) || Auth::getCurrentRole() <= User::getRoleID('Customer')) {
$tpl = new Template_Helper();
$tpl->setTemplate('permission_denied.tpl.html');
$tpl->displayTemplate();
exit;
}
if (@$_POST['cat'] == 'add_phone') {
$res = Phone_Support::insert();
$tpl->assign('add_phone_result', $res);
}
$prj_id = Issue::getProjectID($issue_id);
$usr_id = Auth::getUserID();
$tpl->assign(array('issue_id' => $issue_id, 'phone_categories' => Phone_Support::getCategoryAssocList($prj_id), 'current_user_prefs' => Prefs::get($usr_id)));
$tpl->displayTemplate();
示例4: array_keys
$contract = $crm->getContract($contract_id);
// TODOCRM: Active contacts only
$contact_emails = array_keys($contract->getContactEmailAssocList());
} catch (CRMException $e) {
$contact_emails = array();
}
$unknown_contacts = array();
foreach ($sender_emails as $email => $address) {
if (!@in_array($email, $contact_emails)) {
$usr_id = User::getUserIDByEmail($email);
if (empty($usr_id)) {
$unknown_contacts[] = $address;
} else {
// if we got a real user ID, check if the customer user is the correct one
// (e.g. a contact from the customer associated with the selected issue)
if (User::getRoleByUser($usr_id, $prj_id) == User::getRoleID('Customer')) {
if (!Issue::canAccess($_GET['issue_id'], $usr_id)) {
$unknown_contacts[] = $address;
}
}
}
}
}
if (count($unknown_contacts) > 0) {
$tpl->assign('unknown_contacts', $unknown_contacts);
}
}
}
}
$tpl->assign('current_user_prefs', Prefs::get(Auth::getUserID()));
$tpl->displayTemplate();
示例5: removeTimeEntry
/**
* Method used to remove a specific time entry from the system.
*
* @param integer $time_id The time entry ID
* @param integer $usr_id The user ID of the person trying to remove this entry
* @return integer 1 if the update worked, -1 otherwise
*/
public static function removeTimeEntry($time_id, $usr_id)
{
$stmt = 'SELECT
ttr_iss_id issue_id,
ttr_usr_id owner_usr_id
FROM
{{%time_tracking}}
WHERE
ttr_id=?';
$details = DB_Helper::getInstance()->getRow($stmt, array($time_id));
// check if the owner is the one trying to remove this entry
if ($details['owner_usr_id'] != $usr_id || !Issue::canAccess($details['issue_id'], $usr_id)) {
return -1;
}
$stmt = 'DELETE FROM
{{%time_tracking}}
WHERE
ttr_id=?';
try {
DB_Helper::getInstance()->query($stmt, array($time_id));
} catch (DbException $e) {
return -1;
}
Issue::markAsUpdated($details['issue_id']);
History::add($details['issue_id'], $usr_id, 'time_removed', 'Time tracking entry removed by {user}', array('user' => User::getFullName($usr_id)));
return 1;
}
示例6: processResult
private function processResult(&$data, $date_field, $issue_field)
{
$timezone = Date_Helper::getPreferredTimezone($this->usr_id);
foreach ($data as &$res) {
if (!Issue::canAccess($res[$issue_field], $this->usr_id)) {
continue;
}
$res['customer'] = null;
if ($this->crm) {
try {
$customer = $this->crm->getCustomer(Issue::getCustomerID($res[$issue_field]));
$res['customer'] = $customer->getName();
} catch (CRMException $e) {
}
}
$res['date'] = Date_Helper::getFormattedDate($res[$date_field], $timezone);
// need to decode From:, To: mail headers
if (isset($res['sup_from'])) {
$res['sup_from'] = Mime_Helper::fixEncoding($res['sup_from']);
}
if (isset($res['sup_to'])) {
$res['sup_to'] = Mime_Helper::fixEncoding($res['sup_to']);
}
}
}
示例7: notifyAutoCreatedIssue
/**
* Method used to send an email notification to the sender of an
* email message that was automatically converted into an issue.
*
* @param integer $prj_id The project ID
* @param integer $issue_id The issue ID
* @param string $sender The sender of the email message (and the recipient of this notification)
* @param string $date The arrival date of the email message
* @param string $subject The subject line of the email message
* @param bool|string $additional_recipient The user who should receive this email who is not the sender of the original email.
* @return void
*/
public static function notifyAutoCreatedIssue($prj_id, $issue_id, $sender, $date, $subject, $additional_recipient = false)
{
if (CRM::hasCustomerIntegration($prj_id)) {
$crm = CRM::getInstance($prj_id);
$crm->notifyAutoCreatedIssue($issue_id, $sender, $date, $subject);
$sent = true;
} else {
$sent = false;
}
if ($sent === false) {
if ($additional_recipient != false) {
$recipient = $additional_recipient;
$is_message_sender = false;
} else {
$recipient = $sender;
$is_message_sender = true;
}
$recipient_usr_id = User::getUserIDByEmail(Mail_Helper::getEmailAddress($recipient));
if (!Workflow::shouldEmailAddress($prj_id, Mail_Helper::getEmailAddress($recipient), $issue_id, 'auto_created')) {
return;
}
$data = Issue::getDetails($issue_id);
// open text template
$tpl = new Template_Helper();
$tpl->setTemplate('notifications/new_auto_created_issue.tpl.text');
$tpl->assign(array('app_title' => Misc::getToolCaption(), 'data' => $data, 'sender_name' => Mail_Helper::getName($sender), 'recipient_name' => Mail_Helper::getName($recipient), 'is_message_sender' => $is_message_sender));
// figure out if sender has a real account or not
$sender_usr_id = User::getUserIDByEmail(Mail_Helper::getEmailAddress($sender), true);
if (!empty($sender_usr_id) && Issue::canAccess($issue_id, $sender_usr_id)) {
$can_access = 1;
} else {
$can_access = 0;
}
$tpl->assign(array('sender_can_access' => $can_access, 'email' => array('date' => $date, 'from' => Mime_Helper::fixEncoding($sender), 'subject' => $subject)));
// change the current locale
if (!empty($recipient_usr_id)) {
Language::set(User::getLang($recipient_usr_id));
} else {
Language::set(APP_DEFAULT_LOCALE);
}
$text_message = $tpl->getTemplateContents();
// send email (use PEAR's classes)
$mail = new Mail_Helper();
$mail->setTextBody($text_message);
$mail->setHeaders(Mail_Helper::getBaseThreadingHeaders($issue_id));
$setup = $mail->getSMTPSettings();
$from = self::getFixedFromHeader($issue_id, $setup['from'], 'issue');
$recipient = Mime_Helper::fixEncoding($recipient);
// TRANSLATORS: %1: $issue_id, %2 = iss_summary
$subject = ev_gettext('[#%1$s] Issue Created: %2$s', $issue_id, $data['iss_summary']);
$mail->send($from, $recipient, $subject, 0, $issue_id, 'auto_created_issue');
Language::restore();
}
}
示例8: processResult
function processResult($res, $date_field, $issue_field)
{
global $prj_id;
global $usr_id;
$data = array();
for ($i = 0; $i < count($res); $i++) {
if (!Issue::canAccess($res[$i][$issue_field], $usr_id)) {
continue;
}
if (Customer::hasCustomerIntegration($prj_id)) {
$details = Customer::getDetails($prj_id, Issue::getCustomerID($res[$i][$issue_field]));
$res[$i]["customer"] = @$details['customer_name'];
}
$res[$i]["date"] = Date_API::getFormattedDate($res[$i][$date_field], Date_API::getPreferredTimezone($usr_id));
// need to decode From:, To: mail headers
if (isset($res[$i]["sup_from"])) {
$res[$i]["sup_from"] = Mime_Helper::fixEncoding($res[$i]["sup_from"]);
}
if (isset($res[$i]["sup_to"])) {
$res[$i]["sup_to"] = Mime_Helper::fixEncoding($res[$i]["sup_to"]);
}
$data[] = $res[$i];
}
return $data;
}
示例9: Template_API
include_once APP_INC_PATH . "class.note.php";
include_once APP_INC_PATH . "class.user.php";
include_once APP_INC_PATH . "db_access.php";
$tpl = new Template_API();
$tpl->setTemplate("view_note.tpl.html");
Auth::checkAuthentication(APP_COOKIE, 'index.php?err=5', true);
$usr_id = Auth::getUserID();
$note = Note::getDetails($HTTP_GET_VARS["id"]);
if ($note == '') {
$tpl->assign("note", '');
$tpl->displayTemplate();
exit;
} else {
$note["message"] = $note["not_note"];
$issue_id = Note::getIssueID($HTTP_GET_VARS["id"]);
$usr_id = Auth::getUserID();
}
if (User::getRoleByUser($usr_id, Issue::getProjectID($issue_id)) < User::getRoleID('Standard User') || !Issue::canAccess($issue_id, Auth::getUserID())) {
$tpl->setTemplate("permission_denied.tpl.html");
$tpl->displayTemplate();
exit;
}
$note = Note::getDetails($HTTP_GET_VARS["id"]);
$note["message"] = $note["not_note"];
$issue_id = Note::getIssueID($HTTP_GET_VARS["id"]);
$tpl->bulkAssign(array("note" => $note, "issue_id" => $issue_id, 'extra_title' => "Note #" . $HTTP_GET_VARS['num'] . ": " . $note['not_title']));
if (!empty($issue_id)) {
$sides = Note::getSideLinks($issue_id, $HTTP_GET_VARS["id"]);
$tpl->assign(array('previous' => $sides['previous'], 'next' => $sides['next']));
}
$tpl->displayTemplate();
示例10: removeEntry
/**
* Method used to remove a specific time entry from the system.
*
* @access public
* @param integer $time_id The time entry ID
* @param integer $usr_id The user ID of the person trying to remove this entry
* @return integer 1 if the update worked, -1 otherwise
*/
function removeEntry($time_id, $usr_id)
{
$time_id = Misc::escapeInteger($time_id);
$stmt = "SELECT\n ttr_iss_id issue_id,\n ttr_usr_id owner_usr_id\n FROM\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "time_tracking\n WHERE\n ttr_id={$time_id}";
$details = $GLOBALS["db_api"]->dbh->getRow($stmt, DB_FETCHMODE_ASSOC);
// check if the owner is the one trying to remove this entry
if ($details['owner_usr_id'] != $usr_id || !Issue::canAccess($details['issue_id'], $usr_id)) {
return -1;
}
$stmt = "DELETE FROM\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "time_tracking\n WHERE\n ttr_id={$time_id}";
$res = $GLOBALS["db_api"]->dbh->query($stmt);
if (PEAR::isError($res)) {
Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
return -1;
} else {
Issue::markAsUpdated($details['issue_id']);
// need to save a history entry for this
History::add($details['issue_id'], $usr_id, History::getTypeID('time_removed'), 'Time tracking entry removed by ' . User::getFullName($usr_id));
return 1;
}
}
示例11: ev_gettext
Workflow::prePage($prj_id, 'update');
// check if the requested issue is a part of the 'current' project. If it doesn't
// check if issue exists in another project and if it does, switch projects
$iss_prj_id = Issue::getProjectID($issue_id);
$auto_switched_from = false;
if (!empty($iss_prj_id) && $iss_prj_id != $prj_id && in_array($iss_prj_id, $associated_projects)) {
$cookie = Auth::getCookieInfo(APP_PROJECT_COOKIE);
Auth::setCurrentProject($iss_prj_id, $cookie['remember'], true);
$auto_switched_from = $iss_prj_id;
$prj_id = $iss_prj_id;
Misc::setMessage(ev_gettext('Note: Project automatically switched to "%1$s" from "%2$s".', Auth::getCurrentProjectName(), Project::getName($iss_prj_id)));
}
$tpl->assign('issue', $details);
$tpl->assign('extra_title', ev_gettext('Update Issue #%1$s', $issue_id));
// in the case of a customer user, also need to check if that customer has access to this issue
if ($role_id == User::getRoleID('customer') && (empty($details) || User::getCustomerID($usr_id) != $details['iss_customer_id']) || !Issue::canAccess($issue_id, $usr_id) || !($role_id > User::getRoleID('Reporter')) || !Issue::canUpdate($issue_id, $usr_id)) {
$tpl->setTemplate('base_full.tpl.html');
Misc::setMessage(ev_gettext('Sorry, you do not have the required privileges to update this issue.'), Misc::MSG_ERROR);
$tpl->displayTemplate();
exit;
}
if (Issue_Lock::acquire($issue_id, $usr_id)) {
$issue_lock = false;
} else {
$issue_lock = Issue_Lock::getInfo($issue_id);
$issue_lock['locker'] = User::getDetails($issue_lock['usr_id']);
$issue_lock['expires_formatted_time'] = Date_Helper::getFormattedDate($issue_lock['expires']);
}
$tpl->assign('issue_lock', $issue_lock);
$new_prj_id = Issue::getProjectID($issue_id);
$cancel_update = isset($_POST['cancel']);
示例12: dirname
// | along with this program; if not, write to: |
// | |
// | Free Software Foundation, Inc. |
// | 51 Franklin Street, Suite 330 |
// | Boston, MA 02110-1301, USA. |
// +----------------------------------------------------------------------+
// | Authors: João Prado Maia <jpm@mysql.com> |
// +----------------------------------------------------------------------+
require_once dirname(__FILE__) . '/../init.php';
$usr_id = Auth::getUserID();
$prj_id = Auth::getCurrentProject();
$tpl = new Template_Helper();
$tpl->setTemplate('view_email.tpl.html');
Auth::checkAuthentication(APP_COOKIE, 'index.php?err=5', true);
$issue_id = Support::getIssueFromEmail($_GET['id']);
if ($issue_id != 0 && !Issue::canAccess($issue_id, $usr_id) || $issue_id == 0 && User::getRoleByUser($usr_id, $prj_id) < User::ROLE_USER) {
$tpl->setTemplate('permission_denied.tpl.html');
$tpl->displayTemplate();
exit;
}
$email = Support::getEmailDetails($_GET['ema_id'], $_GET['id']);
$email['seb_body'] = str_replace('&nbsp;', ' ', $email['seb_body']);
$tpl->assign(array('email' => $email, 'issue_id' => $issue_id, 'extra_title' => ev_gettext('Issue #%1$s Email #%3$s: %2$s', $issue_id, $email['sup_subject'], Support::getSequenceByID($_GET['id'])), 'email_accounts' => Email_Account::getAssocList(array_keys(Project::getAssocList(Auth::getUserID())), true), 'recipients' => Mail_Queue::getMessageRecipients(array('customer_email', 'other_email'), $_GET['id'])));
if (@$_GET['cat'] == 'list_emails') {
$sides = Support::getListingSides($_GET['id']);
$tpl->assign(array('previous' => $sides['previous'], 'next' => $sides['next']));
} elseif (@$_GET['cat'] == 'move_email' && Auth::getCurrentRole() >= User::getRoleID('Standard User')) {
$res = Support::moveEmail(@$_GET['id'], @$_GET['ema_id'], @$_GET['new_ema_id']);
$tpl->assign('move_email_result', $res);
$tpl->assign('current_user_prefs', Prefs::get(Auth::getUserID()));
} else {
示例13: header
// | 59 Temple Place - Suite 330 |
// | Boston, MA 02111-1307, USA. |
// +----------------------------------------------------------------------+
// | Authors: João Prado Maia <jpm@mysql.com> |
// +----------------------------------------------------------------------+
//
// @(#) $Id: s.download.php 1.14 04/01/26 20:37:04-06:00 joao@kickass. $
//
include_once "config.inc.php";
include_once APP_INC_PATH . "class.auth.php";
include_once APP_INC_PATH . "class.attachment.php";
include_once APP_INC_PATH . "db_access.php";
Auth::checkAuthentication(APP_COOKIE);
if (stristr(APP_BASE_URL, 'https:')) {
// fix for IE 5.5/6 with SSL sites
header('Pragma: cache');
}
// fix for IE6 (KB812935)
header('Cache-Control: must-revalidate');
if ($HTTP_GET_VARS['cat'] == 'attachment') {
$file = Attachment::getDetails($HTTP_GET_VARS["id"]);
if (!empty($file)) {
if (!Issue::canAccess($file['iat_iss_id'], Auth::getUserID())) {
$tpl = new Template_API();
$tpl->setTemplate("permission_denied.tpl.html");
$tpl->displayTemplate();
exit;
}
Attachment::outputDownload($file['iaf_file'], $file["iaf_filename"], $file['iaf_filesize'], $file['iaf_filetype']);
}
}
示例14: bulkUpdate
/**
* Method used to bulk update a list of issues
*
* @access public
* @return boolean
*/
function bulkUpdate()
{
global $HTTP_POST_VARS;
// check if user performing this chance has the proper role
if (Auth::getCurrentRole() < User::getRoleID('Manager')) {
return -1;
}
$items = Misc::escapeInteger($HTTP_POST_VARS['item']);
$new_status_id = Misc::escapeInteger($_POST['status']);
$new_release_id = Misc::escapeInteger($_POST['release']);
$new_priority_id = Misc::escapeInteger($_POST['priority']);
$new_category_id = Misc::escapeInteger($_POST['category']);
$new_project_id = Misc::escapeInteger($_POST['project']);
for ($i = 0; $i < count($items); $i++) {
if (!Issue::canAccess($items[$i], Auth::getUserID())) {
continue;
} elseif (Issue::getProjectID($HTTP_POST_VARS['item'][$i]) != Auth::getCurrentProject()) {
// make sure issue is not in another project
continue;
}
$updated_fields = array();
// update assignment
if (count(@$HTTP_POST_VARS['users']) > 0) {
$users = Misc::escapeInteger($HTTP_POST_VARS['users']);
// get who this issue is currently assigned too
$stmt = "SELECT\n isu_usr_id,\n CONCAT(en_firstname,' ', en_lastname) as usr_full_name\n FROM\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_user,\n " . ETEL_USER_TABLE_NOSUB . "\n WHERE\n isu_usr_id = en_ID AND\n isu_iss_id = " . $items[$i];
$current_assignees = $GLOBALS["db_api"]->dbh->getAssoc($stmt);
if (PEAR::isError($current_assignees)) {
Error_Handler::logError(array($current_assignees->getMessage(), $current_assignees->getDebugInfo()), __FILE__, __LINE__);
return -1;
}
foreach ($current_assignees as $usr_id => $usr_name) {
if (!in_array($usr_id, $users)) {
Issue::deleteUserAssociation($items[$i], $usr_id, false);
}
}
$new_user_names = array();
$new_assignees = array();
foreach ($users as $usr_id) {
$new_user_names[$usr_id] = User::getFullName($usr_id);
// check if the issue is already assigned to this person
$stmt = "SELECT\n COUNT(*) AS total\n FROM\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_user\n WHERE\n isu_iss_id=" . $items[$i] . " AND\n isu_usr_id=" . $usr_id;
$total = $GLOBALS["db_api"]->dbh->getOne($stmt);
if ($total > 0) {
continue;
} else {
$new_assignees[] = $usr_id;
// add the assignment
Issue::addUserAssociation(Auth::getUserID(), $items[$i], $usr_id, false);
Notification::subscribeUser(Auth::getUserID(), $items[$i], $usr_id, Notification::getAllActions());
Workflow::handleAssignment(Auth::getCurrentProject(), $items[$i], Auth::getUserID());
}
}
Notification::notifyNewAssignment($new_assignees, $items[$i]);
$updated_fields['Assignment'] = History::formatChanges(join(', ', $current_assignees), join(', ', $new_user_names));
}
// update status
if (!empty($new_status_id)) {
$old_status_id = Issue::getStatusID($items[$i]);
$res = Issue::setStatus($items[$i], $new_status_id, false);
if ($res == 1) {
$updated_fields['Status'] = History::formatChanges(Status::getStatusTitle($old_status_id), Status::getStatusTitle($new_status_id));
}
}
// update release
if (!empty($new_release_id)) {
$old_release_id = Issue::getRelease($items[$i]);
$res = Issue::setRelease($items[$i], $new_release_id);
if ($res == 1) {
$updated_fields['Release'] = History::formatChanges(Release::getTitle($old_release_id), Release::getTitle($new_release_id));
}
}
// update priority
if (!empty($new_priority_id)) {
$old_priority_id = Issue::getPriority($items[$i]);
$res = Issue::setPriority($items[$i], $new_priority_id);
if ($res == 1) {
$updated_fields['Priority'] = History::formatChanges(Priority::getTitle($old_priority_id), Priority::getTitle($new_priority_id));
}
}
// update category
if (!empty($new_category_id)) {
$old_category_id = Issue::getCategory($items[$i]);
$res = Issue::setCategory($items[$i], $new_category_id);
if ($res == 1) {
$updated_fields['Category'] = History::formatChanges(Category::getTitle($old_category_id), Category::getTitle($new_category_id));
}
}
// update project
if (!empty($new_project_id)) {
$old_project_id = Issue::getProjectID($items[$i]);
$res = Issue::setProject($items[$i], $new_project_id);
if ($res == 1) {
$updated_fields['Project'] = History::formatChanges(Category::getTitle($old_project_id), Category::getTitle($new_project_id));
//.........这里部分代码省略.........
示例15: getMailQueue
/**
* Selects a mail queue entry from the table and returns the contents.
*
* @param string $id The mail queue entry ID.
* @return A string containing the body.
*/
function getMailQueue($id)
{
if (Auth::getCurrentRole() < User::getRoleID('Developer')) {
return;
}
$res = Mail_Queue::getEntry($id);
if (!Issue::canAccess($res['maq_iss_id'], $GLOBALS['usr_id'])) {
return '';
}
if (empty($_GET['ec_id'])) {
return $res['maq_body'];
}
return Link_Filter::processText(Auth::getCurrentProject(), nl2br(htmlspecialchars($res['maq_headers'] . "\n" . $res['maq_body'])));
}