/** * Retrieves the details about a given note. * * @param integer $note_id The note ID * @return array The note details */ public static function getDetails($note_id) { $stmt = 'SELECT {{%note}}.*, not_full_message, usr_full_name FROM {{%note}}, {{%user}} WHERE not_usr_id=usr_id AND not_id=?'; try { $res = DB_Helper::getInstance()->getRow($stmt, array($note_id)); } catch (DbException $e) { return ''; } if (count($res) > 0) { $res['timestamp'] = Date_Helper::getUnixTimestamp($res['not_created_date'], 'GMT'); if ($res['not_is_blocked'] == 1) { $res['has_blocked_message'] = true; } else { $res['has_blocked_message'] = false; } if (!empty($res['not_unknown_user'])) { $res['not_from'] = $res['not_unknown_user']; } else { $res['not_from'] = User::getFullName($res['not_usr_id']); } if ($res['not_has_attachment']) { $res['attachments'] = Mime_Helper::getAttachmentCIDs($res['not_full_message']); } return $res; } return ''; }
/** * Method used to get the support email entry details. * * @access public * @param integer $ema_id The support email account ID * @param integer $sup_id The support email ID * @return array The email entry details */ function getEmailDetails($ema_id, $sup_id) { $stmt = "SELECT\n " . APP_TABLE_PREFIX . "support_email.*,\n " . APP_TABLE_PREFIX . "support_email_body.*\n FROM\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "support_email,\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "support_email_body\n WHERE\n sup_id=seb_sup_id AND\n sup_id=" . Misc::escapeInteger($sup_id) . " AND\n sup_ema_id=" . Misc::escapeInteger($ema_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 { // gotta parse MIME based emails now $output = Mime_Helper::decode($res["seb_full_email"], true); $res["message"] = Mime_Helper::getMessageBody($output); // XXX: check which code relies on this var $res["attachments"] = Mime_Helper::getAttachmentCIDs($res["seb_full_email"]); $res["timestamp"] = Date_API::getUnixTimestamp($res['sup_date'], 'GMT'); $res["sup_date"] = Date_API::getFormattedDate($res["sup_date"]); $res["sup_subject"] = Mime_Helper::fixEncoding($res["sup_subject"]); // remove extra 'Re: ' from subject $res['reply_subject'] = Mail_API::removeExcessRe('Re: ' . $res["sup_subject"], true); $res["sup_from"] = Mime_Helper::fixEncoding($res["sup_from"]); $res["sup_to"] = Mime_Helper::fixEncoding($res["sup_to"]); if (!empty($res['sup_iss_id'])) { $res['reply_subject'] = Mail_API::formatSubject($res['sup_iss_id'], $res['reply_subject']); } return $res; } }
/** * Method used to get the support email entry details. * * @param integer $ema_id The support email account ID * @param integer $sup_id The support email ID * @return array The email entry details */ public static function getEmailDetails($ema_id, $sup_id) { // $ema_id is not needed anymore and will be re-factored away in the future $stmt = 'SELECT {{%support_email}}.*, {{%support_email_body}}.* FROM {{%support_email}}, {{%support_email_body}} WHERE sup_id=seb_sup_id AND sup_id=?'; try { $res = DB_Helper::getInstance()->getRow($stmt, array($sup_id)); } catch (DbException $e) { return ''; } $res['message'] = $res['seb_body']; $res['attachments'] = Mime_Helper::getAttachmentCIDs($res['seb_full_email']); $res['timestamp'] = Date_Helper::getUnixTimestamp($res['sup_date'], 'GMT'); $res['sup_date'] = Date_Helper::getFormattedDate($res['sup_date']); $res['sup_subject'] = Mime_Helper::fixEncoding($res['sup_subject']); // TRANSLATORS: %1 = email subject $res['reply_subject'] = Mail_Helper::removeExcessRe(ev_gettext('Re: %1$s', $res['sup_subject']), true); $res['sup_from'] = Mime_Helper::fixEncoding($res['sup_from']); $res['sup_to'] = Mime_Helper::fixEncoding($res['sup_to']); if (!empty($res['sup_iss_id'])) { $res['reply_subject'] = Mail_Helper::formatSubject($res['sup_iss_id'], $res['reply_subject']); } return $res; }
/** * Retrieves the details about a given note. * * @access public * @param integer $note_id The note ID * @return array The note details */ function getDetails($note_id) { $note_id = Misc::escapeInteger($note_id); $stmt = "SELECT\n " . APP_TABLE_PREFIX . "note.*,\n not_created_date,\n not_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_id='{$note_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 (count($res) > 0) { $res['timestamp'] = Date_API::getUnixTimestamp($res['not_created_date'], 'GMT'); $res['not_created_date'] = Date_API::getFormattedDate($res['not_created_date']); if (!empty($res['not_blocked_message'])) { $res['has_blocked_message'] = true; $res["attachments"] = Mime_Helper::getAttachmentCIDs($res['not_blocked_message']); } else { $res['has_blocked_message'] = false; } if (!empty($res["not_unknown_user"])) { $res["not_from"] = $res["not_unknown_user"]; } else { $res["not_from"] = User::getFullName($res['not_usr_id']); } return $res; } else { return ''; } } }