[ Index ]

PHP Cross Reference of Eventum

title

Body

[close]

/ -> view_email.php (source)

   1  <?php
   2  /* vim: set expandtab tabstop=4 shiftwidth=4 encoding=utf-8: */
   3  // +----------------------------------------------------------------------+
   4  // | Eventum - Issue Tracking System                                      |
   5  // +----------------------------------------------------------------------+
   6  // | Copyright (c) 2003, 2004, 2005, 2006, 2007 MySQL AB                  |
   7  // |                                                                      |
   8  // | This program is free software; you can redistribute it and/or modify |
   9  // | it under the terms of the GNU General Public License as published by |
  10  // | the Free Software Foundation; either version 2 of the License, or    |
  11  // | (at your option) any later version.                                  |
  12  // |                                                                      |
  13  // | This program is distributed in the hope that it will be useful,      |
  14  // | but WITHOUT ANY WARRANTY; without even the implied warranty of       |
  15  // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        |
  16  // | GNU General Public License for more details.                         |
  17  // |                                                                      |
  18  // | You should have received a copy of the GNU General Public License    |
  19  // | along with this program; if not, write to:                           |
  20  // |                                                                      |
  21  // | Free Software Foundation, Inc.                                       |
  22  // | 59 Temple Place - Suite 330                                          |
  23  // | Boston, MA 02111-1307, USA.                                          |
  24  // +----------------------------------------------------------------------+
  25  // | Authors: João Prado Maia <jpm@mysql.com>                             |
  26  // +----------------------------------------------------------------------+
  27  //
  28  // @(#) $Id: view_email.php 3338 2007-06-19 21:49:22Z balsdorf $
  29  
  30  require_once(dirname(__FILE__) . "/init.php");
  31  require_once (APP_INC_PATH . "class.template.php");
  32  require_once (APP_INC_PATH . "class.auth.php");
  33  require_once (APP_INC_PATH . "class.issue.php");
  34  require_once (APP_INC_PATH . "class.misc.php");
  35  require_once (APP_INC_PATH . "class.support.php");
  36  require_once (APP_INC_PATH . "db_access.php");
  37  
  38  $tpl = new Template_API();
  39  $tpl->setTemplate("view_email.tpl.html");
  40  
  41  Auth::checkAuthentication(APP_COOKIE, 'index.php?err=5', true);
  42  $issue_id = Support::getIssueFromEmail($_GET["id"]);
  43  
  44  if (!Issue::canAccess($issue_id, Auth::getUserID())) {
  45      $tpl->setTemplate("permission_denied.tpl.html");
  46      $tpl->displayTemplate();
  47      exit;
  48  }
  49  
  50  $email = Support::getEmailDetails($_GET["ema_id"], $_GET["id"]);
  51  $email['seb_body'] = str_replace("&amp;nbsp;", "&nbsp;", $email['seb_body']);
  52  $tpl->bulkAssign(array(
  53      "email"           => $email,
  54      "issue_id"        => $issue_id,
  55      'extra_title'     => "Email #" . $_GET['id'] . ": " . $email['sup_subject'],
  56      'email_accounts'  =>  Email_Account::getAssocList(array_keys(Project::getAssocList(Auth::getUserID())), true),
  57      'recipients'      =>  Mail_Queue::getMessageRecipients(array('customer_email', 'other_email'), $_GET["id"]),
  58  ));
  59  
  60  if (@$_GET['cat'] == 'list_emails') {
  61      $sides = Support::getListingSides($_GET["id"]);
  62      $tpl->assign(array(
  63          'previous' => $sides['previous'],
  64          'next'     => $sides['next']
  65      ));
  66  } elseif ((@$_GET['cat'] == 'move_email') && (Auth::getCurrentRole() >= User::getRoleID("Standard User"))) {
  67      $res = Support::moveEmail(@$_GET['id'], @$_GET['ema_id'], @$_GET['new_ema_id']);
  68      $tpl->assign("move_email_result", $res);
  69      $tpl->assign("current_user_prefs", Prefs::get(Auth::getUserID()));
  70  } else {
  71      $sides = Support::getIssueSides($issue_id, $_GET["id"]);
  72      $tpl->assign(array(
  73          'previous' => $sides['previous'],
  74          'next'     => $sides['next']
  75      ));
  76  }
  77  
  78  // set the page charset to whatever is set on this email
  79  $charset = Mime_Helper::getCharacterSet($email['seb_full_email']);
  80  if (!empty($charset)) {
  81      header("Content-Type: text/html; charset=" . $charset);
  82  }
  83  
  84  $tpl->displayTemplate();


Generated: Wed Dec 19 21:21:33 2007 Cross-referenced by PHPXref 0.7