/** * 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; } }
/** * Method used to get the details of a FAQ entry for a given FAQ ID. * * @param integer $faq_id The FAQ entry ID * @return array The FAQ entry details */ public static function getDetails($faq_id) { $stmt = 'SELECT * FROM {{%faq}} WHERE faq_id=?'; try { $res = DB_Helper::getInstance()->getRow($stmt, array($faq_id)); } catch (DbException $e) { return ''; } if ($res == null) { return ''; } $res['support_levels'] = array_keys(self::getAssociatedSupportLevels($res['faq_prj_id'], $res['faq_id'])); if (empty($res['faq_updated_date'])) { $res['faq_updated_date'] = $res['faq_created_date']; } $res['message'] = Misc::activateLinks(nl2br(htmlspecialchars($res['faq_message']))); return $res; }
/** * Method used to get the full listing of phone support entries * associated with a specific issue. * * @param integer $issue_id The issue ID * @return array The list of notes */ public static function getListing($issue_id) { $stmt = 'SELECT {{%phone_support}}.*, usr_full_name, phc_title, iss_prj_id FROM {{%phone_support}}, {{%project_phone_category}}, {{%user}}, {{%issue}} WHERE phs_iss_id=iss_id AND iss_prj_id=phc_prj_id AND phs_phc_id=phc_id AND phs_usr_id=usr_id AND phs_iss_id=? ORDER BY phs_created_date ASC'; try { $res = DB_Helper::getInstance()->getAll($stmt, array($issue_id)); } catch (DbException $e) { return ''; } foreach ($res as &$row) { $row['phs_description'] = Misc::activateLinks(nl2br(htmlspecialchars($row['phs_description']))); $row['phs_description'] = Link_Filter::processText($row['iss_prj_id'], $row['phs_description']); $row['phs_created_date'] = Date_Helper::getFormattedDate($row['phs_created_date']); } return $res; }
/** * Processes text through all link filters. * * @param integer $prj_id The ID of the project * @param string $text The text to process * @param string $class The CSS class to use on the actual links * @return string The processed text. */ public static function processText($prj_id, $text, $class = 'link') { // process issue link seperatly since it has to do something special $text = Misc::activateLinks($text, $class); $filters = array_merge(self::getFilters(), self::getFiltersByProject($prj_id), Workflow::getLinkFilters($prj_id)); foreach ((array) $filters as $filter) { list($pattern, $replacement) = $filter; // replacement may be a callback, provided by workflow if (is_callable($replacement)) { $text = preg_replace_callback($pattern, $replacement, $text); } else { $text = preg_replace($pattern, $replacement, $text); } } return $text; }
/** * Processes text through all link filters. * * @access public * @param integer $prj_id The ID of the project * @param string $text The text to process * @param string $class The CSS class to use on the actual links * @return string The processed text. */ function processText($prj_id, $text, $class = "link") { // process issue link seperatly since it has to do something special $text = Misc::activateLinks($text, $class); $text = Link_Filter::processIssueSpecificLinks($text); $filters = Link_Filter::getFilters($prj_id); if (count($filters) > 0) { foreach ($filters as $filter) { $text = preg_replace('/' . $filter[0] . '/i', $filter[1], $text); } } return $text; }
/** * 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; } }