示例#1
0
 /**
  * Method used to get the details of a FAQ entry for a given FAQ ID.
  *
  * @access  public
  * @param   integer $faq_id The FAQ entry ID
  * @return  array The FAQ entry details
  */
 function getDetails($faq_id)
 {
     $stmt = "SELECT\n                    *\n                 FROM\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "faq\n                 WHERE\n                    faq_id=" . Misc::escapeInteger($faq_id);
     $res = $GLOBALS["db_api"]->dbh->getRow($stmt, DB_FETCHMODE_ASSOC);
     if (PEAR::isError($res)) {
         Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
         return "";
     } else {
         if (Customer::doesBackendUseSupportLevels($res['faq_prj_id'])) {
             // get all of the support level associations here as well
             $res['support_levels'] = array_keys(FAQ::getAssociatedSupportLevels($res['faq_prj_id'], $res['faq_id']));
         }
         if (empty($res['faq_updated_date'])) {
             $res['faq_updated_date'] = $res['faq_created_date'];
         }
         $res['faq_updated_date'] = Date_API::getFormattedDate($res['faq_updated_date']);
         $res['message'] = Misc::activateLinks(nl2br(htmlspecialchars($res['faq_message'])));
         return $res;
     }
 }
示例#2
0
// |                                                                      |
// | You should have received a copy of the GNU General Public License    |
// | along with this program; if not, write to:                           |
// |                                                                      |
// | Free Software Foundation, Inc.                                       |
// | 59 Temple Place - Suite 330                                          |
// | Boston, MA 02111-1307, USA.                                          |
// +----------------------------------------------------------------------+
// | Authors: João Prado Maia <*****@*****.**>                             |
// +----------------------------------------------------------------------+
//
// @(#) $Id: s.news.php 1.1 04/01/13 20:02:51-00:00 jpradomaia $
//
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.news.php";
include_once APP_INC_PATH . "class.date.php";
include_once APP_INC_PATH . "db_access.php";
$tpl = new Template_API();
$tpl->setTemplate('news.tpl.html');
Auth::checkAuthentication(APP_COOKIE, 'index.php?err=5', true);
$prj_id = Auth::getCurrentProject();
if (!empty($HTTP_GET_VARS["id"])) {
    $t = News::getDetails($HTTP_GET_VARS['id']);
    $t['nws_created_date'] = Date_API::getFormattedDate($t["nws_created_date"]);
    $tpl->assign("news", array($t));
} else {
    $tpl->assign("news", News::getListByProject($prj_id, TRUE));
}
$tpl->displayTemplate();
示例#3
0
 /**
  * Method used to format a RFC 822 compliant date for the given unix
  * timestamp.
  *
  * @access  public
  * @param   integer $ts The unix timestamp
  * @return  string The formatted date string
  */
 function formatReplyDate($ts)
 {
     // On Fri, 01 Apr 2005, 17:07:44 GMT
     return Date_API::getFormattedDate($ts);
 }
示例#4
0
 /**
  * Method used to get all of the support email entries associated
  * with a given issue.
  *
  * @access  public
  * @param   integer $issue_id The issue ID
  * @return  array The list of support emails
  */
 function getEmailsByIssue($issue_id)
 {
     $usr_id = Auth::getUserID();
     $stmt = "SELECT\n                    sup_id,\n                    sup_ema_id,\n                    sup_from,\n                    sup_to,\n                    sup_cc,\n                    sup_date,\n                    sup_subject,\n                    seb_body,\n                    sup_has_attachment,\n                    CONCAT(sup_ema_id, '-', sup_id) AS composite_id\n                 FROM\n                    (\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "support_email,\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "support_email_body,\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "email_account,\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue\n                    )\n                 WHERE\n                    sup_id=seb_sup_id AND\n                    ema_id=sup_ema_id AND\n                    iss_id = sup_iss_id AND\n                    ema_prj_id=iss_prj_id AND\n                    sup_iss_id=" . Misc::escapeInteger($issue_id) . "\n                 ORDER BY\n                    sup_id 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 {
         if (count($res) == 0) {
             return "";
         } else {
             for ($i = 0; $i < count($res); $i++) {
                 $res[$i]["sup_date"] = Date_API::getFormattedDate($res[$i]["sup_date"]);
                 $res[$i]["sup_subject"] = Mime_Helper::fixEncoding($res[$i]["sup_subject"]);
                 $res[$i]["sup_from"] = Mime_Helper::fixEncoding($res[$i]["sup_from"]);
                 $res[$i]["sup_to"] = Mime_Helper::fixEncoding($res[$i]["sup_to"]);
                 $res[$i]["sup_cc"] = Mime_Helper::fixEncoding($res[$i]["sup_cc"]);
             }
             return $res;
         }
     }
 }
示例#5
0
$usr_id = Auth::getUserID();
$prj_id = Auth::getCurrentProject();
if (!Customer::hasCustomerIntegration($prj_id)) {
    // show all FAQ entries
    $support_level_id = -1;
} else {
    if (!Customer::doesBackendUseSupportLevels($prj_id)) {
        // show all FAQ entries
        $support_level_id = -1;
    } else {
        if (Auth::getCurrentRole() != User::getRoleID('Customer')) {
            // show all FAQ entries
            $support_level_id = -1;
        } else {
            $customer_id = User::getCustomerID(Auth::getUserID());
            $support_level_id = Customer::getSupportLevelID($prj_id, $customer_id);
        }
    }
}
$tpl->assign("faqs", FAQ::getListBySupportLevel($support_level_id));
if (!empty($HTTP_GET_VARS["id"])) {
    $t = FAQ::getDetails($HTTP_GET_VARS['id']);
    // check if this customer should have access to this FAQ entry or not
    if ($support_level_id != -1 && !in_array($support_level_id, $t['support_levels'])) {
        $tpl->assign('faq', -1);
    } else {
        $t['faq_created_date'] = Date_API::getFormattedDate($t["faq_created_date"]);
        $tpl->assign("faq", $t);
    }
}
$tpl->displayTemplate();
示例#6
0
 /**
  * Method used to get the list of issues in a project, and group
  * them by the assignee.
  *
  * @access  public
  * @param   integer $prj_id The project ID
  * @return  array The list of issues
  */
 function getIssuesByUser($prj_id)
 {
     $stmt = "SELECT\n                    usr_full_name,\n                    iss_id,\n                    iss_summary,\n                    sta_title,\n                    iss_sta_id,\n                    iss_created_date,\n                    sta_color\n                 FROM\n                    (\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue,\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_user,\n                    " . ETEL_USER_TABLE . "\n                    )\n                 LEFT JOIN\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "status\n                 ON\n                    iss_sta_id=sta_id\n                 WHERE\n                    iss_prj_id=" . Misc::escapeInteger($prj_id) . " AND\n                    iss_id=isu_iss_id AND\n                    isu_usr_id=usr_id\n                 ORDER BY\n                    usr_full_name";
     $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 {
         Time_Tracking::getTimeSpentByIssues($res);
         $issues = array();
         for ($i = 0; $i < count($res); $i++) {
             $issues[$res[$i]['usr_full_name']][$res[$i]['iss_id']] = array('iss_summary' => $res[$i]['iss_summary'], 'sta_title' => $res[$i]['sta_title'], 'iss_created_date' => Date_API::getFormattedDate($res[$i]['iss_created_date']), 'time_spent' => Misc::getFormattedTime($res[$i]['time_spent']), 'status_color' => $res[$i]['sta_color']);
         }
         return $issues;
     }
 }
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;
}
示例#8
0
 /**
  * Method used to get the list of changes made against a specific issue.
  *
  * @access  public
  * @param   integer $iss_id The issue ID
  * @param   string $order_by The order to sort the history
  * @return  array The list of changes
  */
 function getListing($iss_id, $order_by = 'DESC')
 {
     $stmt = "SELECT\n                    *\n                 FROM\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_history,\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "history_type\n                 WHERE\n                    htt_id = his_htt_id AND\n                    his_is_hidden != 1 AND\n                    his_iss_id=" . Misc::escapeInteger($iss_id) . " AND\n                    htt_role <= " . Auth::getCurrentRole() . "\n                 ORDER BY\n                    his_id {$order_by}";
     $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 {
         for ($i = 0; $i < count($res); $i++) {
             $res[$i]["his_created_date"] = Date_API::getFormattedDate($res[$i]["his_created_date"]);
             $res[$i]["his_summary"] = Mime_Helper::fixEncoding($res[$i]["his_summary"]);
         }
         return $res;
     }
 }
示例#9
0
 /**
  * Method used to list the history of triggered reminder actions
  * for a given issue.
  *
  * @access  public
  * @param   integer $iss_id The issue ID
  * @return  array The list of triggered reminder actions
  */
 function getHistoryList($iss_id)
 {
     $stmt = "SELECT\n                    rmh_created_date,\n                    rma_title\n                 FROM\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "reminder_history,\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "reminder_action\n                 WHERE\n                    rmh_iss_id=" . Misc::escapeInteger($iss_id) . " AND\n                    rmh_rma_id=rma_id\n                 ORDER BY\n                    rmh_created_date DESC";
     $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 array();
     } else {
         for ($i = 0; $i < count($res); $i++) {
             $res[$i]["rmh_created_date"] = Date_API::getFormattedDate($res[$i]["rmh_created_date"]);
         }
         return $res;
     }
 }
示例#10
0
 /**
  * Returns a list of drafts associated with an issue.
  *
  * @access  public
  * @param   integer $issue_id The ID of the issue.
  * @param   boolean $show_all If all draft statuses should be shown
  * @return  array An array of drafts.
  */
 function getList($issue_id, $show_all = false)
 {
     $issue_id = Misc::escapeInteger($issue_id);
     $stmt = "SELECT\n                    emd_id,\n                    emd_usr_id,\n                    emd_subject,\n                    emd_updated_date,\n                    emd_unknown_user,\n                    emd_status\n                 FROM\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "email_draft\n                 WHERE\n                    emd_iss_id={$issue_id}\n";
     if ($show_all == false) {
         $stmt .= "AND emd_status = 'pending'\n";
     }
     $stmt .= "ORDER BY\n                    emd_id";
     $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 {
         for ($i = 0; $i < count($res); $i++) {
             $res[$i]["emd_updated_date"] = Date_API::getFormattedDate($res[$i]["emd_updated_date"]);
             if (!empty($res[$i]['emd_unknown_user'])) {
                 $res[$i]['from'] = $res[$i]["emd_unknown_user"];
             } else {
                 $res[$i]['from'] = User::getFromHeader($res[$i]['emd_usr_id']);
             }
             list($res[$i]['to'], ) = Draft::getEmailRecipients($res[$i]['emd_id']);
             if (empty($res[$i]['to'])) {
                 $res[$i]['to'] = "Notification List";
             }
         }
         return $res;
     }
 }
示例#11
0
 /**
  * Method used to get the full listing of notes associated with
  * a specific issue.
  *
  * @access  public
  * @param   integer $issue_id The issue ID
  * @return  array The list of notes
  */
 function getListing($issue_id)
 {
     $issue_id = Misc::escapeInteger($issue_id);
     $stmt = "SELECT\n                    not_id,\n                    not_created_date,\n                    not_title,\n                    not_usr_id,\n                    not_unknown_user,\n                    not_has_attachment,\n                    IF(LENGTH(not_blocked_message) > 0, 1, 0) AS has_blocked_message,\n                    usr_full_name\n                 FROM\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "note,\n                    " . ETEL_USER_TABLE . "\n                 WHERE\n                    not_usr_id=usr_id AND\n                    not_iss_id={$issue_id} AND\n                    not_removed = 0\n                 ORDER BY\n                    not_created_date 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 {
         // only show the internal notes for users with the appropriate permission level
         $role_id = Auth::getCurrentRole();
         $t = array();
         for ($i = 0; $i < count($res); $i++) {
             if ($role_id < User::getRoleID('standard user')) {
                 continue;
             }
             // Display not_unknown_user instead of usr_full_name if not null.
             // This is so the original sender of a blocked email is displayed on the note.
             if (!empty($res[$i]["not_unknown_user"])) {
                 $res[$i]["usr_full_name"] = $res[$i]["not_unknown_user"];
             }
             $res[$i]["not_created_date"] = Date_API::getFormattedDate($res[$i]["not_created_date"]);
             $t[] = $res[$i];
         }
         return $t;
     }
 }
 /**
  * Method used to get the full listing of time entries in the system for a
  * specific issue
  *
  * @access  public
  * @param   integer $issue_id The issue ID
  * @return  array The full list of time entries
  */
 function getListing($issue_id)
 {
     $stmt = "SELECT\n                    ttr_id,\n                    ttr_created_date,\n                    ttr_summary,\n                    ttr_time_spent,\n                    ttc_title,\n                    ttr_usr_id,\n                    usr_full_name\n                 FROM\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "time_tracking,\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "time_tracking_category,\n                    " . ETEL_USER_TABLE . "\n                 WHERE\n                    ttr_ttc_id=ttc_id AND\n                    ttr_usr_id=usr_id AND\n                    ttr_iss_id=" . Misc::escapeInteger($issue_id) . "\n                 ORDER BY\n                    ttr_created_date 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 0;
     } else {
         $total_time_spent = 0;
         for ($i = 0; $i < count($res); $i++) {
             $res[$i]["ttr_summary"] = Link_Filter::processText(Issue::getProjectID($issue_id), nl2br(htmlspecialchars($res[$i]["ttr_summary"])));
             $res[$i]["formatted_time"] = Misc::getFormattedTime($res[$i]["ttr_time_spent"]);
             $res[$i]["ttr_created_date"] = Date_API::getFormattedDate($res[$i]["ttr_created_date"]);
             $total_time_spent += $res[$i]["ttr_time_spent"];
         }
         return array("total_time_spent" => Misc::getFormattedTime($total_time_spent), "list" => $res);
     }
 }
示例#13
0
 /**
  * Returns the mail queue for a specific issue.
  *
  * @access  public
  * @param   integer $issue_is The issue ID
  * @return  array An array of emails from the queue
  */
 function getListByIssueID($issue_id)
 {
     $issue_id = Misc::escapeInteger($issue_id);
     $stmt = "SELECT\n                    maq_id,\n                    maq_queued_date,\n                    maq_status,\n                    maq_recipient,\n                    maq_subject\n                 FROM\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "mail_queue\n                 WHERE\n                    maq_iss_id = " . Misc::escapeInteger($issue_id) . "\n                 ORDER BY\n                    maq_queued_date 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 false;
     }
     if (count($res) > 0) {
         for ($i = 0; $i < count($res); $i++) {
             $res[$i]['maq_recipient'] = Mime_Helper::decodeAddress($res[$i]['maq_recipient']);
             $res[$i]['maq_queued_date'] = Date_API::getFormattedDate(Date_API::getUnixTimestamp($res[$i]['maq_queued_date'], 'GMT'));
             $res[$i]['maq_subject'] = Mime_Helper::fixEncoding($res[$i]['maq_subject']);
         }
     }
     return $res;
 }
示例#14
0
 /**
  * Method used to get the details for a specific issue.
  *
  * @access  public
  * @param   integer $issue_id The issue ID
  * @param   boolean $force_refresh If the cache should not be used.
  * @return  array The details for the specified issue
  */
 function getDetails($issue_id, $force_refresh = false)
 {
     global $HTTP_SERVER_VARS;
     static $returns;
     $issue_id = Misc::escapeInteger($issue_id);
     if (empty($issue_id)) {
         return '';
     }
     if (!empty($returns[$issue_id]) && $force_refresh != true) {
         return $returns[$issue_id];
     }
     $stmt = "SELECT\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue.*,\n                    prj_title,\n                    prc_title,\n                    pre_title,\n                    pri_title,\n                    sta_title,\n                    sta_abbreviation,\n                    sta_color status_color,\n                    sta_is_closed,\n\t\t\t\t\tsup_id as last_sup_id,\n\t\t\t\t\tseb_body as last_seb_body,\n\t\t\t\t\tema_id,\n\t\t\t\t\ten_email as reporter_email\n                 FROM\n                    (\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue,\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "project\n                    )\n                 LEFT JOIN\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "project_priority\n                 ON\n                    iss_pri_id=pri_id\n                 LEFT JOIN\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "status\n                 ON\n                    iss_sta_id=sta_id\n                 LEFT JOIN\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "project_category\n                 ON\n                    iss_prc_id=prc_id\n                 LEFT JOIN\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "project_release\n                 ON\n                    iss_pre_id=pre_id\n                 LEFT JOIN\n                    " . ETEL_USER_TABLE_NOSUB . "\n                 ON\n                    iss_usr_id=en_ID\n                 LEFT JOIN\n                    (\n\t\t\t\t\t\tSelect sup_id,sup_iss_id,seb_body\n\t\t\t\t\t\tfrom " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "support_email\n\t\t\t\t\t\tleft join " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "support_email_body on seb_sup_id = sup_id \n\t\t\t\t\t\twhere sup_iss_id = {$issue_id} order by sup_date desc\n\t\t\t\t\t) as sup\n                 ON\n                    sup_iss_id = iss_id\n                 LEFT JOIN\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "email_account\n                 ON\n                    ema_prj_id = iss_prj_id\n                 WHERE\n                    iss_id={$issue_id} AND\n                    iss_prj_id=prj_id";
     $res = $GLOBALS["db_api"]->dbh->getRow($stmt, DB_FETCHMODE_ASSOC);
     if (PEAR::isError($res)) {
         Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
         return "";
     } else {
         if (empty($res)) {
             return "";
         } else {
             $created_date_ts = Date_API::getUnixTimestamp($res['iss_created_date'], Date_API::getDefaultTimezone());
             // get customer information, if any
             if (!empty($res['iss_customer_id']) && Customer::hasCustomerIntegration($res['iss_prj_id'])) {
                 $res['customer_business_hours'] = Customer::getBusinessHours($res['iss_prj_id'], $res['iss_customer_id']);
                 $res['contact_local_time'] = Date_API::getFormattedDate(Date_API::getCurrentDateGMT(), $res['iss_contact_timezone']);
                 $res['customer_info'] = Customer::getDetails($res['iss_prj_id'], $res['iss_customer_id']);
                 $res['redeemed_incidents'] = Customer::getRedeemedIncidentDetails($res['iss_prj_id'], $res['iss_id']);
                 $max_first_response_time = Customer::getMaximumFirstResponseTime($res['iss_prj_id'], $res['iss_customer_id']);
                 $res['max_first_response_time'] = Misc::getFormattedTime($max_first_response_time / 60);
                 if (empty($res['iss_first_response_date'])) {
                     $first_response_deadline = $created_date_ts + $max_first_response_time;
                     if (Date_API::getCurrentUnixTimestampGMT() <= $first_response_deadline) {
                         $res['max_first_response_time_left'] = Date_API::getFormattedDateDiff($first_response_deadline, Date_API::getCurrentUnixTimestampGMT());
                     } else {
                         $res['overdue_first_response_time'] = Date_API::getFormattedDateDiff(Date_API::getCurrentUnixTimestampGMT(), $first_response_deadline);
                     }
                 }
             }
             $res['iss_original_description'] = $res["iss_description"];
             if (!strstr($HTTP_SERVER_VARS["PHP_SELF"], 'update.php')) {
                 $res["iss_description"] = nl2br(htmlspecialchars($res["iss_description"]));
                 $res["iss_resolution"] = Resolution::getTitle($res["iss_res_id"]);
             }
             $res["iss_impact_analysis"] = nl2br(htmlspecialchars($res["iss_impact_analysis"]));
             $res["iss_created_date"] = Date_API::getFormattedDate($res["iss_created_date"]);
             $res['iss_created_date_ts'] = $created_date_ts;
             $res["assignments"] = @implode(", ", array_values(Issue::getAssignedUsers($res["iss_id"])));
             list($res['authorized_names'], $res['authorized_repliers']) = Authorized_Replier::getAuthorizedRepliers($res["iss_id"]);
             $temp = Issue::getAssignedUsersStatus($res["iss_id"]);
             $res["has_inactive_users"] = 0;
             $res["assigned_users"] = array();
             $res["assigned_inactive_users"] = array();
             foreach ($temp as $usr_id => $usr_status) {
                 if (!User::isActiveStatus($usr_status)) {
                     $res["assigned_inactive_users"][] = $usr_id;
                     $res["has_inactive_users"] = 1;
                 } else {
                     $res["assigned_users"][] = $usr_id;
                 }
             }
             if (@in_array(Auth::getUserID(), $res["assigned_users"])) {
                 $res["is_current_user_assigned"] = 1;
             } else {
                 $res["is_current_user_assigned"] = 0;
             }
             $res["associated_issues_details"] = Issue::getAssociatedIssuesDetails($res["iss_id"]);
             $res["associated_issues"] = Issue::getAssociatedIssues($res["iss_id"]);
             $res["reporter"] = User::getFullName($res["iss_usr_id"]);
             $res["email_list_details"] = Support::getFirstEmailer($issue_id);
             if (!$res["reporter"]) {
                 $first_emailer = Support::getFirstEmailer($issue_id);
                 $res["reporter"] = $first_emailer . " (No Account)";
                 $res["reporter_email"] = preg_replace('/.*<|>/', '', $first_emailer);
             }
             if (empty($res["iss_updated_date"])) {
                 $res["iss_updated_date"] = 'not updated yet';
             } else {
                 $res["iss_updated_date"] = Date_API::getFormattedDate($res["iss_updated_date"]);
             }
             $res["estimated_formatted_time"] = Misc::getFormattedTime($res["iss_dev_time"]);
             if (Release::isAssignable($res["iss_pre_id"])) {
                 $release = Release::getDetails($res["iss_pre_id"]);
                 $res["pre_title"] = $release["pre_title"];
                 $res["pre_status"] = $release["pre_status"];
             }
             // need to return the list of issues that are duplicates of this one
             $res["duplicates"] = Issue::getDuplicateList($res["iss_id"]);
             $res["duplicates_details"] = Issue::getDuplicateDetailsList($res["iss_id"]);
             // also get the issue title of the duplicated issue
             if (!empty($res['iss_duplicated_iss_id'])) {
                 $res['duplicated_issue'] = Issue::getDuplicatedDetails($res['iss_duplicated_iss_id']);
             }
             // get group information
             if (!empty($res["iss_grp_id"])) {
                 $res["group"] = Group::getDetails($res["iss_grp_id"]);
             }
             // get quarantine issue
             $res["quarantine"] = Issue::getQuarantineInfo($res["iss_id"]);
             $returns[$issue_id] = $res;
             return $res;
         }
     }
 }
示例#15
0
 /**
  * Method used to get the full list of checkins associated with an issue.
  *
  * @access  public
  * @param   integer $issue_id The issue ID
  * @return  array The list of checkins
  */
 function getCheckinList($issue_id)
 {
     $setup = Setup::load();
     $stmt = "SELECT\n                    *\n                 FROM\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_checkin\n                 WHERE\n                    isc_iss_id=" . Misc::escapeInteger($issue_id) . "\n                 ORDER BY\n                    isc_created_date 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 {
         if (empty($res)) {
             return "";
         } else {
             for ($i = 0; $i < count($res); $i++) {
                 $res[$i]["isc_commit_msg"] = Link_Filter::processText(Issue::getProjectID($issue_id), nl2br(htmlspecialchars($res[$i]["isc_commit_msg"])));
                 @($res[$i]["checkout_url"] = SCM::parseURL($setup["checkout_url"], $res[$i]));
                 @($res[$i]["diff_url"] = SCM::parseURL($setup["diff_url"], $res[$i]));
                 $res[$i]["isc_created_date"] = Date_API::getFormattedDate($res[$i]["isc_created_date"]);
             }
             return $res;
         }
     }
 }
 /**
  * Method used to get the full listing of phone support entries 
  * associated with a specific issue.
  *
  * @access  public
  * @param   integer $issue_id The issue ID
  * @return  array The list of notes
  */
 function getListing($issue_id)
 {
     $stmt = "SELECT\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "phone_support.*,\n                    usr_full_name,\n                    phc_title,\n                    iss_prj_id\n                 FROM\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "phone_support,\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "project_phone_category,\n                    " . ETEL_USER_TABLE . ",\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue\n                 WHERE\n                    phs_iss_id=iss_id AND\n                    iss_prj_id=phc_prj_id AND\n                    phs_phc_id=phc_id AND\n                    phs_usr_id=usr_id AND\n                    phs_iss_id=" . Misc::escapeInteger($issue_id) . "\n                 ORDER BY\n                    phs_created_date 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 {
         for ($i = 0; $i < count($res); $i++) {
             $res[$i]["phs_description"] = Misc::activateLinks(nl2br(htmlspecialchars($res[$i]["phs_description"])));
             $res[$i]["phs_description"] = Link_Filter::processText($res[$i]['iss_prj_id'], $res[$i]["phs_description"]);
             $res[$i]["phs_created_date"] = Date_API::getFormattedDate($res[$i]["phs_created_date"]);
         }
         return $res;
     }
 }