/** * Method used to return the full list of attachments related to a specific * issue in the database. * * @param integer $issue_id The issue ID * @return array The full list of attachments */ public static function getList($issue_id) { $usr_id = Auth::getUserID(); $prj_id = Issue::getProjectID($issue_id); $stmt = 'SELECT iat_id, iat_usr_id, usr_full_name, iat_created_date, iat_description, iat_unknown_user, iat_status FROM {{%issue_attachment}}, {{%user}} WHERE iat_iss_id=? AND iat_usr_id=usr_id'; if (User::getRoleByUser($usr_id, $prj_id) <= User::ROLE_CUSTOMER) { $stmt .= " AND iat_status='public' "; } $stmt .= ' ORDER BY iat_created_date ASC'; $params = array($issue_id); try { $res = DB_Helper::getInstance()->getAll($stmt, $params); } catch (DbException $e) { return ''; } foreach ($res as &$row) { $row['iat_description'] = Link_Filter::processText($prj_id, nl2br(htmlspecialchars($row['iat_description']))); $row['files'] = self::getFileList($row['iat_id']); // if there is an unknown user, user that instead of the user_full_name if (!empty($row['iat_unknown_user'])) { $row['usr_full_name'] = $row['iat_unknown_user']; } } return $res; }
/** * Method used to get the full listing of time entries in the system for a * specific issue * * @param integer $issue_id The issue ID * @return array The full list of time entries */ public static function getTimeEntryListing($issue_id) { $stmt = 'SELECT ttr_id, ttr_created_date, ttr_summary, ttr_time_spent, ttc_title, ttr_usr_id, usr_full_name FROM {{%time_tracking}}, {{%time_tracking_category}}, {{%user}} WHERE ttr_ttc_id=ttc_id AND ttr_usr_id=usr_id AND ttr_iss_id=? ORDER BY ttr_created_date ASC'; try { $res = DB_Helper::getInstance()->getAll($stmt, array($issue_id)); } catch (DbException $e) { return 0; } $total_time_spent = 0; $total_time_by_user = array(); foreach ($res as &$row) { $row['ttr_summary'] = Link_Filter::processText(Issue::getProjectID($issue_id), nl2br(htmlspecialchars($row['ttr_summary']))); $row['formatted_time'] = Misc::getFormattedTime($row['ttr_time_spent']); $row['ttr_created_date'] = Date_Helper::getFormattedDate($row['ttr_created_date']); if (isset($total_time_by_user[$row['ttr_usr_id']])) { $total_time_by_user[$row['ttr_usr_id']]['time_spent'] += $row['ttr_time_spent']; } else { $total_time_by_user[$row['ttr_usr_id']] = array('usr_full_name' => $row['usr_full_name'], 'time_spent' => $row['ttr_time_spent']); } $total_time_spent += $row['ttr_time_spent']; } usort($total_time_by_user, function ($a, $b) { return $a['time_spent'] < $b['time_spent']; }); foreach ($total_time_by_user as &$item) { $item['time_spent'] = Misc::getFormattedTime($item['time_spent']); } return array('total_time_spent' => Misc::getFormattedTime($total_time_spent), 'total_time_by_user' => $total_time_by_user, 'list' => $res); }
/** * Method used to get the full list of requirements and impact analysis for * a specific issue. * * @param integer $issue_id The issue ID * @return array The full list of requirements */ public static function getListing($issue_id) { $stmt = 'SELECT isr_id, isr_requirement, isr_dev_time, isr_impact_analysis, A.usr_full_name AS submitter_name, B.usr_full_name AS handler_name FROM ( {{%issue_requirement}}, {{%user}} A ) LEFT JOIN {{%user}} B ON isr_updated_usr_id=B.usr_id WHERE isr_iss_id=? AND isr_usr_id=A.usr_id'; try { $res = DB_Helper::getInstance()->getAll($stmt, array($issue_id)); } catch (DbException $e) { return ''; } if (count($res) == 0) { return ''; } $prj_id = Issue::getProjectID($issue_id); foreach ($res as &$row) { $row['isr_requirement'] = Link_Filter::processText($prj_id, nl2br(htmlspecialchars($row['isr_requirement']))); $row['isr_impact_analysis'] = Link_Filter::processText($prj_id, nl2br(htmlspecialchars($row['isr_impact_analysis']))); $row['formatted_dev_time'] = Misc::getFormattedTime($row['isr_dev_time']); } return $res; }
include_once APP_INC_PATH . "class.link_filter.php"; include_once APP_INC_PATH . "class.project.php"; include_once APP_INC_PATH . "db_access.php"; $tpl = new Template_API(); $tpl->setTemplate("manage/index.tpl.html"); Auth::checkAuthentication(APP_COOKIE); $tpl->assign("type", "link_filters"); $role_id = Auth::getCurrentRole(); if ($role_id == User::getRoleID('administrator') || $role_id == User::getRoleID('manager')) { if ($role_id == User::getRoleID('administrator')) { $tpl->assign("show_setup_links", true); } if (@$HTTP_POST_VARS["cat"] == "new") { $tpl->assign("result", Link_Filter::insert()); } elseif (@$HTTP_POST_VARS["cat"] == "update") { $tpl->assign("result", Link_Filter::update()); } elseif (@$HTTP_POST_VARS["cat"] == "delete") { $tpl->assign("result", Link_Filter::remove()); } if (@$HTTP_GET_VARS["cat"] == "edit") { $info = Link_Filter::getDetails($HTTP_GET_VARS["id"]); $tpl->assign("info", $info); } $user_roles = User::getRoles(); $tpl->assign("list", Link_Filter::getList()); $tpl->assign("project_list", Project::getAll()); $tpl->assign("user_roles", $user_roles); } else { $tpl->assign("show_not_allowed_msg", true); } $tpl->displayTemplate();
* that were distributed with this source code. */ require_once __DIR__ . '/../../init.php'; $tpl = new Template_Helper(); $tpl->setTemplate('manage/link_filters.tpl.html'); Auth::checkAuthentication(); $role_id = Auth::getCurrentRole(); if ($role_id < User::ROLE_MANAGER) { Misc::setMessage(ev_gettext('Sorry, you are not allowed to access this page.'), Misc::MSG_ERROR); $tpl->displayTemplate(); exit; } if (@$_POST['cat'] == 'new') { $res = Link_Filter::insert(); Misc::mapMessages($res, array(1 => array(ev_gettext('Thank you, the link filter was added successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to add the new link filter.'), Misc::MSG_INFO))); } elseif (@$_POST['cat'] == 'update') { $res = Link_Filter::update(); Misc::mapMessages($res, array(1 => array(ev_gettext('Thank you, the link filter was updated successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to update the link filter.'), Misc::MSG_INFO))); } elseif (@$_POST['cat'] == 'delete') { $res = Link_Filter::remove(); Misc::mapMessages($res, array(1 => array(ev_gettext('Thank you, the link filter was deleted successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to delete the link filter.'), Misc::MSG_INFO))); } if (@$_GET['cat'] == 'edit') { $info = Link_Filter::getDetails($_GET['id']); $tpl->assign('info', $info); } $user_roles = User::getRoles(); $tpl->assign('list', Link_Filter::getList()); $tpl->assign('project_list', Project::getAll()); $tpl->assign('user_roles', $user_roles); $tpl->displayTemplate();
/** * Callback function to be used from template class. * * @access public * @param string $text The text to process * @return string the processed text. */ function activateLinks($text) { return Link_Filter::processText(Auth::getCurrentProject(), $text); }
/** * 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); } }
<a class="white_link" href="javascript:void(null);" onClick="javascript:openRawHeaders();">Blocked Message Raw Headers</a> <?php } ?> </td> </tr> </table> </td> </tr> <tr> <td colspan="2" bgcolor="<?php echo $this->_tpl_vars['light_color']; ?> " id="email_message" class="default"> <?php echo is_array($_tmp = is_array($_tmp = is_array($_tmp = $this->_tpl_vars['note']['message']) ? $this->_run_mod_handler('highlight_quoted', true, $_tmp) : smarty_modifier_highlight_quoted($_tmp)) ? $this->_run_mod_handler('nl2br', true, $_tmp) : smarty_modifier_nl2br($_tmp)) ? $this->_run_mod_handler('activateLinks', true, $_tmp) : Link_Filter::activateLinks($_tmp); ?> </td> </tr> <tr> <td colspan="2" bgcolor="<?php echo $this->_tpl_vars['internal_color']; ?> " align="center"> <input class="button" type="button" value="Reply" onClick="javascript:reply(<?php echo $_GET['id']; ?> , <?php echo $this->_tpl_vars['issue_id']; ?>
/** * Selects a mail queue entry from the table and returns the contents. * * @param string $id The mail queue entry ID. * @return A string containing the body. */ function getMailQueue($id) { if (Auth::getCurrentRole() < User::getRoleID('Developer')) { return; } $res = Mail_Queue::getEntry($id); if (!empty($_GET["ec_id"])) { return Link_Filter::processText(Auth::getCurrentProject(), nl2br(htmlspecialchars($_GET["ec_id"] . ":" . $id . ":" . $res["maq_headers"] . "\n" . $res["maq_body"]))); } else { return $res["maq_body"]; } }
?> <BR> Status: <?php echo htmlspecialchars($issue['sta_title']); ?> <BR> Priority: <?php echo htmlspecialchars($issue['pri_title']); ?> <BR> Category: <?php echo htmlspecialchars($issue['prc_title']); ?> <BR> <BR><?php echo htmlspecialchars(Link_Filter::activateLinks(nl2br($issue['iss_description']))); ?> <BR> </description> <author><?php echo htmlspecialchars($issue['reporter']); ?> </author> <pubDate><?php echo Date_API::getRFC822Date($issue['iss_created_date'], "GMT"); ?> </pubDate> </item> <?php } ?>
$this->_sections['i']['first'] = $this->_sections['i']['iteration'] == 1; $this->_sections['i']['last'] = $this->_sections['i']['iteration'] == $this->_sections['i']['total']; ?> <b><?php echo $this->_tpl_vars['news'][$this->_sections['i']['index']]['nws_created_date']; ?> - <a href="news.php?id=<?php echo $this->_tpl_vars['news'][$this->_sections['i']['index']]['nws_id']; ?> " class="link" title="full news entry"><?php echo $this->_tpl_vars['news'][$this->_sections['i']['index']]['nws_title']; ?> </a></b> <br /><br /> <?php echo is_array($_tmp = $this->_tpl_vars['news'][$this->_sections['i']['index']]['nws_message']) ? $this->_run_mod_handler('activateLinks', true, $_tmp, 'links') : Link_Filter::activateLinks($_tmp, 'links'); ?> <br /><br /> <?php } } ?> <a href="news.php" class="link">Read All Notices</a> </td> </tr> </table> </td> </tr> </table> <br />
/** * Method used to get the full list of requirements and impact analysis for * a specific issue. * * @access public * @param integer $issue_id The issue ID * @return array The full list of requirements */ function getListing($issue_id) { $stmt = "SELECT\n isr_id,\n isr_requirement,\n isr_dev_time,\n isr_impact_analysis,\n CONCAT(A.en_firstname,' ', A.en_lastname) AS submitter_name,\n CONCAT(B.en_firstname,' ', B.en_lastname) AS handler_name\n FROM\n (\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_requirement,\n " . ETEL_USER_TABLE_NOSUB . " A\n )\n LEFT JOIN\n " . ETEL_USER_TABLE_NOSUB . " B\n ON\n isr_updated_usr_id=B.en_ID\n WHERE\n isr_iss_id=" . Misc::escapeInteger($issue_id) . " AND\n isr_usr_id=A.en_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 { if (count($res) == 0) { return ""; } else { for ($i = 0; $i < count($res); $i++) { $res[$i]["isr_requirement"] = Link_Filter::processText(Issue::getProjectID($issue_id), nl2br(htmlspecialchars($res[$i]["isr_requirement"]))); $res[$i]["isr_impact_analysis"] = Link_Filter::processText(Issue::getProjectID($issue_id), nl2br(htmlspecialchars($res[$i]["isr_impact_analysis"]))); $res[$i]["formatted_dev_time"] = Misc::getFormattedTime($res[$i]["isr_dev_time"]); } return $res; } } }
/** * 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; } } }
</tr> <tr> <td align="left" valign="top" bgcolor="<?php echo $this->_tpl_vars['cell_color']; ?> " width="150"> <span class="default_white"><b>Last Response:</b></span><br /> </td> <td colspan="3" bgcolor="<?php echo $this->_tpl_vars['dark_color']; ?> " class="default"><span style="white-space:pre" <?php echo smarty_function_get_display_style(array('element_name' => 'description'), $this); ?> ><?php echo is_array($_tmp = $this->_tpl_vars['issue']['last_seb_body']) ? $this->_run_mod_handler('activateLinks', true, $_tmp, 'link') : Link_Filter::activateLinks($_tmp, 'link'); ?> </span> </td> </tr> </table> </td> </tr> </table> <table width="100%" bgcolor="<?php echo $this->_tpl_vars['cell_color']; ?> " border="0" cellspacing="0" cellpadding="0" align="center" style="padding-left: 1;padding-right: 1;padding-top: 0;padding-bottom: 1"> <tr> <td> <table bgcolor="#FFFFFF" width="100%" cellspacing="1" cellpadding="2" border="0" style="padding-top: 0px">
/** * Method used to get the full list of checkins associated with an issue. * * @param integer $issue_id The issue ID * @return array The list of checkins */ public static function getCheckinList($issue_id) { $stmt = 'SELECT * FROM {{%issue_checkin}} WHERE isc_iss_id=? ORDER BY isc_created_date ASC'; try { $res = DB_Helper::getInstance()->getAll($stmt, array($issue_id)); } catch (DbException $e) { return array(); } if (empty($res)) { return array(); } foreach ($res as $i => &$checkin) { $scm = self::getScmCheckinByName($checkin['isc_reponame']); // add ADDED and REMOVED fields $checkin['added'] = !isset($checkin['isc_old_version']); $checkin['removed'] = !isset($checkin['isc_new_version']); $checkin['isc_commit_msg'] = Link_Filter::processText(Issue::getProjectID($issue_id), nl2br(htmlspecialchars($checkin['isc_commit_msg']))); $checkin['checkout_url'] = $scm->getCheckoutUrl($checkin); $checkin['diff_url'] = $scm->getDiffUrl($checkin); $checkin['scm_log_url'] = $scm->getLogUrl($checkin); } return $res; }
?> " class="default_white"> <nobr><b><?php echo $this->_tpl_vars['custom_fields'][$this->_sections['i']['index']]['fld_title']; ?> :</b> </nobr> </td> <td class="default" width="100%" bgcolor="<?php echo $this->_tpl_vars['row_color']; ?> "> <?php if ($this->_tpl_vars['custom_fields'][$this->_sections['i']['index']]['fld_type'] == 'textarea') { ?> <?php echo is_array($_tmp = is_array($_tmp = is_array($_tmp = $this->_tpl_vars['custom_fields'][$this->_sections['i']['index']]['icf_value']) ? $this->_run_mod_handler('escape', true, $_tmp, 'html') : smarty_modifier_escape($_tmp, 'html')) ? $this->_run_mod_handler('activateLinks', true, $_tmp, 'link') : Link_Filter::activateLinks($_tmp, 'link')) ? $this->_run_mod_handler('nl2br', true, $_tmp) : smarty_modifier_nl2br($_tmp); ?> <?php } else { ?> <?php echo is_array($_tmp = $this->_tpl_vars['custom_fields'][$this->_sections['i']['index']]['icf_value']) ? $this->_run_mod_handler('formatCustomValue', true, $_tmp, $this->_tpl_vars['custom_fields'][$this->_sections['i']['index']]['fld_id'], $_GET['id'], true) : Custom_Field::formatValue($_tmp, $this->_tpl_vars['custom_fields'][$this->_sections['i']['index']]['fld_id'], $_GET['id'], true); ?> <?php } ?> </td> </tr> <?php
/** * 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; }
/** * Selects a mail queue entry from the table and returns the contents. * * @param string $id The mail queue entry ID. * @return A string containing the body. */ function getMailQueue($id) { if (Auth::getCurrentRole() < User::getRoleID('Developer')) { return; } $res = Mail_Queue::getEntry($id); if (!Issue::canAccess($res['maq_iss_id'], $GLOBALS['usr_id'])) { return ''; } if (empty($_GET['ec_id'])) { return $res['maq_body']; } return Link_Filter::processText(Auth::getCurrentProject(), nl2br(htmlspecialchars($res['maq_headers'] . "\n" . $res['maq_body']))); }
/** * Formats the return value * * @access public * @param mixed $value The value to format * @param integer $fld_id The ID of the field * @param integer $issue_id The ID of the issue * @return mixed the formatted value. */ function formatValue($value, $fld_id, $issue_id, $functional = false) { $backend = Custom_Field::getBackend($fld_id); if (is_object($backend) && method_exists($backend, 'formatValue')) { return $backend->formatValue($value, $fld_id, $issue_id, $functional); } else { return Link_Filter::processText(Auth::getCurrentProject(), htmlspecialchars($value)); } }
/** * Formats the return value * * @param mixed $value The value to format * @param integer $fld_id The ID of the field * @param integer $issue_id The ID of the issue * @return mixed the formatted value. */ public function formatValue($value, $fld_id, $issue_id) { $backend = self::getBackend($fld_id); if (is_object($backend) && method_exists($backend, 'formatValue')) { return $backend->formatValue($value, $fld_id, $issue_id); } else { return Link_Filter::processText(Auth::getCurrentProject(), Misc::htmlentities($value)); } }
/** * 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; } }