[ Index ]

PHP Cross Reference of Eventum

title

Body

[close]

/ -> get_remote_data.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: Bryan Alsdorf <bryan@mysql.com>                             |
  26  // +----------------------------------------------------------------------+
  27  //
  28  // @(#) $Id: get_remote_data.php 3258 2007-02-14 23:25:56Z glen $
  29  
  30  require_once(dirname(__FILE__) . "/init.php");
  31  require_once (APP_INC_PATH . "db_access.php");
  32  require_once (APP_INC_PATH . "class.auth.php");
  33  require_once (APP_INC_PATH . "class.note.php");
  34  require_once (APP_INC_PATH . "class.draft.php");
  35  require_once (APP_INC_PATH . "class.mail_queue.php");
  36  
  37  Auth::checkAuthentication(APP_COOKIE);
  38  
  39  /*
  40   * This page is used to return a single content to the expandable table using httpClient library.
  41   */
  42  
  43  $valid_functions = array('getEmail','getNote','getDraft','getPhoneSupport','getMailQueue');
  44  $action = Misc::escapeString($_REQUEST['action']);
  45  if (in_array($action, $valid_functions)) {
  46      echo $action($_REQUEST['list_id']);
  47  } else {
  48      echo $_REQUEST["ec_id"] . ":" . $_REQUEST['list_id'] . ":ERROR: Unable to call function $action";
  49  }
  50  exit;
  51  
  52  /**
  53   * Selects the email from the table and returns the contents. Since jsrs only supports returning one value, 
  54   * the string that is returned is in the format
  55   * of ec_id:id:email. If ec_id is not passed as a parameter, only the email is returned.
  56   * 
  57   * @param   string $id The sup_ema_id and sup_id seperated by a -.
  58   * @return  A string containing the body of the email, optionally prefaced by the ec_id and $id.
  59   */
  60  function getEmail($id)
  61  {
  62      $split = explode("-", $id);
  63      $info = Support::getEmailDetails($split[0],$split[1]);
  64      if (!empty($_GET["ec_id"])) {
  65          return Link_Filter::processText(Auth::getCurrentProject(), nl2br($_GET["ec_id"] . ":" . $id. ":" . Misc::highlightQuotedReply($info['seb_body'])));
  66      } else {
  67          return $info["seb_body"];
  68      }
  69  }
  70  
  71  
  72  /**
  73   * Selects a note from the table and returns the contents.
  74   * 
  75   * @param   string $id The ID of this note.
  76   * @return  A string containing the note.
  77   */
  78  function getNote($id)
  79  {
  80      $note = Note::getDetails($id);
  81      if (!empty($_GET["ec_id"])) {
  82          return Link_Filter::processText(Auth::getCurrentProject(), nl2br($_GET["ec_id"] . ":" . $id. ":" . Misc::highlightQuotedReply($note["not_note"])));
  83      } else {
  84          return $note["not_note"];
  85      }
  86  }
  87  
  88  
  89  /**
  90   * Selects a draft from the table and returns the contents.
  91   * 
  92   * @param   string $id The ID of this draft.
  93   * @return  A string containing the note.
  94   */
  95  function getDraft($id)
  96  {
  97      $info = Draft::getDetails($id);
  98      if (!empty($_GET["ec_id"])) {
  99          return Link_Filter::processText(Auth::getCurrentProject(), nl2br(htmlspecialchars($_GET["ec_id"] . ":" . $id. ":" . $info["emd_body"])));
 100      } else {
 101          return $info["emd_body"];
 102      }
 103  }
 104  
 105  
 106  /**
 107   * Selects a phone support entry from the table and returns the contents.
 108   * 
 109   * @param   string $id The phone support entry ID.
 110   * @return  A string containing the description.
 111   */
 112  function getPhoneSupport($id)
 113  {
 114      $res = Phone_Support::getDetails($id);
 115      if (!empty($_GET["ec_id"])) {
 116          return Link_Filter::processText(Auth::getCurrentProject(), nl2br(htmlspecialchars($_GET["ec_id"] . ":" . $id. ":" . $res["phs_description"])));
 117      } else {
 118          return $res["phs_description"];
 119      }
 120  }
 121  
 122  
 123  /**
 124   * Selects a mail queue entry from the table and returns the contents.
 125   * 
 126   * @param   string $id The mail queue entry ID.
 127   * @return  A string containing the body.
 128   */
 129  function getMailQueue($id)
 130  {
 131      if (Auth::getCurrentRole() < User::getRoleID('Developer')) {
 132          return;
 133      }
 134      $res = Mail_Queue::getEntry($id);
 135      if (!empty($_GET["ec_id"])) {
 136          return Link_Filter::processText(Auth::getCurrentProject(), nl2br(htmlspecialchars($_GET["ec_id"] . ":" . $id. ":" . $res["maq_headers"] . "\n" . $res["maq_body"])));
 137      } else {
 138          return $res["maq_body"];
 139      }
 140  }


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