/** * Whether to skip this event after access checks * @return boolean */ function skip() { if (!access_has_bug_level(config_get('view_handler_threshold'), $this->issue_id)) { return true; } return false; }
function config_error($config) { $err = ''; $exception = 'http://169.254.169.254/latest/meta-data/public-hostname'; // for retrieving current EC2 Public DNS Name if (!$config) { $config = config_get(); } if (!$config) { $err = 'Problem getting configuration'; } if (!$err) { if (!empty($config['user_media_host']) && strpos($config['user_media_host'], '/') !== FALSE && $config['user_media_host'] != $exception) { $err = 'Configuration option user_media_host cannot contain slashes'; } } if (!$err) { if (!empty($config['module_host']) && strpos($config['module_host'], '/') !== FALSE && $config['module_host'] != $exception) { $err = 'Configuration option module_host cannot contain slashes'; } } if (!$err) { if (!empty($config['callback_host']) && strpos($config['callback_host'], '/') !== FALSE && $config['callback_host'] != $exception) { $err = 'Configuration option callback_host cannot contain slashes'; } } if (!$err) { $err = service_config_error($config); } return $err; }
/** * * */ function initialize_gui(&$dbHandler, &$argsObj) { $req_spec_mgr = new requirement_spec_mgr($dbHandler); $tproject_mgr = new testproject($dbHandler); $commandMgr = new reqSpecCommands($dbHandler); $gui = $commandMgr->initGuiBean(); $gui->req_spec_cfg = config_get('req_spec_cfg'); $gui->req_cfg = config_get('req_cfg'); // 20100810 - asimon - BUGID 3317: disabled total count of requirements by default $gui->external_req_management = $gui->req_cfg->external_req_management == ENABLED ? 1 : 0; $gui->grants = new stdClass(); $gui->grants->req_mgmt = has_rights($db, "mgt_modify_req"); $gui->req_spec = $req_spec_mgr->get_by_id($argsObj->req_spec_id); $gui->req_spec_id = $argsObj->req_spec_id; $gui->tproject_name = $argsObj->tproject_name; $gui->name = $gui->req_spec['title']; $gui->main_descr = lang_get('req_spec_short') . config_get('gui_title_separator_1') . "[{$gui->req_spec['doc_id']}] :: " . $gui->req_spec['title']; $gui->refresh_tree = 'no'; $gui->cfields = $req_spec_mgr->html_table_of_custom_field_values($argsObj->req_spec_id, $argsObj->tproject_id); $gui->attachments = getAttachmentInfosFrom($req_spec_mgr, $argsObj->req_spec_id); $gui->requirements_count = $req_spec_mgr->get_requirements_count($argsObj->req_spec_id); $gui->reqSpecTypeDomain = init_labels($gui->req_spec_cfg->type_labels); /* contribution BUGID 2999, show direct link */ $prefix = $tproject_mgr->getTestCasePrefix($argsObj->tproject_id); $gui->direct_link = $_SESSION['basehref'] . 'linkto.php?tprojectPrefix=' . urlencode($prefix) . '&item=reqspec&id=' . urlencode($gui->req_spec['doc_id']); return $gui; }
/** * Generate HTML header and send it to browser * @param string $format identifier of document format; value must be in $tlCfg->reports_formats * @param integer $doc_kind Magic number of document kind; see consts.inc.php for list * (for example: DOC_TEST_PLAN) * @author havlatm */ function flushHttpHeader($format, $doc_kind = 0) { $file_extensions = config_get('reports_file_extension'); $reports_applications = config_get('reports_applications'); switch ($doc_kind) { case DOC_TEST_SPEC: $kind_acronym = '_test_spec'; break; case DOC_TEST_PLAN: $kind_acronym = '_test_plan'; break; case DOC_TEST_REPORT: $kind_acronym = '_test_report'; break; case DOC_REQ_SPEC: $kind_acronym = '_req_spec'; break; default: $kind_acronym = ''; } if ($format == FORMAT_MAIL_HTML) { tLog('flushHttpHeader> Invalid format: ' . $format, 'ERROR'); } $filename = $_SESSION['testprojectPrefix'] . $kind_acronym . '-' . date('Y-m-d') . '.' . $file_extensions[$format]; tLog('Flush HTTP header for ' . $format); header("Content-Description: TestLink - Generated Document"); if ($format != FORMAT_HTML) { header("Content-Disposition: attachment; filename={$filename}"); } header("Content-type: {$reports_applications[$format]}; name='Testlink_{$format}'"); flush(); }
/** * @return array * obj->status_ok = true/false * obj->msg = message to explain what has happened to a human being. */ function auth_does_password_match(&$user, $cleartext_password) { $authCfg = config_get('authentication'); $ret = new stdClass(); $ret->status_ok = true; $ret->msg = 'ok'; switch ($authCfg['method']) { case 'LDAP': $msg[ERROR_LDAP_AUTH_FAILED] = lang_get('error_ldap_auth_failed'); $msg[ERROR_LDAP_SERVER_CONNECT_FAILED] = lang_get('error_ldap_server_connect_failed'); $msg[ERROR_LDAP_UPDATE_FAILED] = lang_get('error_ldap_update_failed'); $msg[ERROR_LDAP_USER_NOT_FOUND] = lang_get('error_ldap_user_not_found'); $msg[ERROR_LDAP_BIND_FAILED] = lang_get('error_ldap_bind_failed'); $dummy = ldap_authenticate($user->login, $cleartext_password); $ret->status_ok = $dummy->status_ok; $ret->msg = $msg[$dummy->status_code]; break; case 'LOCAL': if ($user->comparePassword($cleartext_password) != tl::OK) { $ret->status_ok = false; $ret->msg = lang_get('bad_user_passwd'); } break; default: // Custom implementation break; } return $ret; }
/** * Get username, realname and email from for a given user id * @param integer $p_user_id A valid user identifier. * @return array */ function mci_account_get_array_by_id($p_user_id) { $t_result = array(); $t_result['id'] = $p_user_id; if (user_exists($p_user_id)) { $t_current_user_id = auth_get_current_user_id(); $t_access_level = user_get_field($t_current_user_id, 'access_level'); $t_can_manage = access_has_global_level(config_get('manage_user_threshold')) && access_has_global_level($t_access_level); # this deviates from the behaviour of view_user_page.php, but it is more intuitive $t_is_same_user = $t_current_user_id === $p_user_id; $t_can_see_realname = access_has_project_level(config_get('show_user_realname_threshold')); $t_can_see_email = access_has_project_level(config_get('show_user_email_threshold')); $t_result['name'] = user_get_field($p_user_id, 'username'); if ($t_is_same_user || $t_can_manage || $t_can_see_realname) { $t_realname = user_get_realname($p_user_id); if (!empty($t_realname)) { $t_result['real_name'] = $t_realname; } } if ($t_is_same_user || $t_can_manage || $t_can_see_email) { $t_email = user_get_email($p_user_id); if (!empty($t_email)) { $t_result['email'] = $t_email; } } } return $t_result; }
function CheckTables() { if (!config_get('check-database')) { return; } db_create_table_safe('tester_contests', array('id' => 'INT NOT NULL PRIMARY KEY AUTO_INCREMENT', 'name' => 'TEXT', 'lid' => 'INT', 'status' => 'INT', 'settings' => 'TEXT NOT NULL DEFAULT ""')); }
/** * Validates the Attach Tags group action. * Gets called for every bug, but performs the real tag validation only * the first time. Any invalid tags will be skipped, as there is no simple * or clean method of presenting these errors to the user. * @param integer Bug ID * @return boolean True */ function action_attach_tags_validate($p_bug_id) { global $g_action_attach_tags_valid; if (!isset($g_action_attach_tags_valid)) { $f_tag_string = gpc_get_string('tag_string'); $f_tag_select = gpc_get_string('tag_select'); global $g_action_attach_tags_attach, $g_action_attach_tags_create, $g_action_attach_tags_failed; $g_action_attach_tags_attach = array(); $g_action_attach_tags_create = array(); $g_action_attach_tags_failed = array(); $t_tags = tag_parse_string($f_tag_string); $t_can_create = access_has_global_level(config_get('tag_create_threshold')); foreach ($t_tags as $t_tag_row) { if (-1 == $t_tag_row['id']) { if ($t_can_create) { $g_action_attach_tags_create[] = $t_tag_row; } else { $g_action_attach_tags_failed[] = $t_tag_row; } } elseif (-2 == $t_tag_row['id']) { $g_action_attach_tags_failed[] = $t_tag_row; } else { $g_action_attach_tags_attach[] = $t_tag_row; } } if (0 < $f_tag_select && tag_exists($f_tag_select)) { $g_action_attach_tags_attach[] = tag_get($f_tag_select); } } global $g_action_attach_tags_attach, $g_action_attach_tags_create, $g_action_attach_tags_failed; return true; }
/** * Construct and connect to BTS. * * @param str $type (see tlIssueTracker.class.php $systems property) * @param xml $cfg **/ function __construct($type, $config, $name) { $this->name = $name; $this->interfaceViaDB = false; $this->support = new jiraCommons(); $this->support->guiCfg = array('use_decoration' => true); $proxyCfg = config_get('proxy'); if (!is_null($proxyCfg->host)) { $key2loop = array('host', 'port', 'login', 'password'); foreach ($key2loop as $fi) { if (!is_null($proxyCfg->{$fi})) { $this->soapOpt['proxy_' . $fi] = $proxyCfg->{$fi}; } } } $this->methodOpt = array('buildViewBugLink' => array('addSummary' => true, 'colorByStatus' => true)); if ($this->setCfg($config)) { $this->completeCfg(); $this->connect(); $this->guiCfg = array('use_decoration' => true); // Attention has to be done AFTER CONNECT OK, because we need info setted there if ($this->isConnected()) { $this->setResolvedStatusCfg(); } } }
function install(){ $custom_group_actions = config_get('custom_group_actions'); $custom_group_actions[] = $this->getAction(); config_set('custom_group_actions', $custom_group_actions); return true; }
function bugCreateHelper($reproducibility, $severity, $priority, $summary, $description, $project_id, $reporter_id) { # Change this path to point to the Mantis installation core.php file require_once '../core.php'; $t_core_path = config_get('core_path'); require_once $t_core_path . 'bug_api.php'; access_ensure_project_level(config_get('report_bug_threshold')); $t_bug_data = new BugData(); $t_bug_data->view_state = config_get('default_bug_view_status'); $t_bug_data->reproducibility = $reproducibility; $t_bug_data->severity = $severity; $t_bug_data->priority = $priority; $t_bug_data->summary = $summary; $t_bug_data->description = $description; $t_bug_data->project_id = $project_id; $t_bug_data->reporter_id = user_get_id_by_name($reporter_id); if ($t_bug_data->reporter_id == "") { $tmp = "Reported by: " . $reporter_id . "\n---------------------------------------------------\n\n"; $tmp .= $t_bug_data->description; $t_bug_data->description = $tmp; } $t_bug_data->summary = trim($t_bug_data->summary); # Create the bug $t_bug_id = bug_create($t_bug_data); email_new_bug($t_bug_id); return $t_bug_id; }
/** * */ function initializeGui(&$dbHandler, $args) { $locale = isset($_SESSION['locale']) ? $_SESSION['locale'] : 'en_GB'; $localesDateFormat = config_get('locales_date_format'); $date_format = $localesDateFormat[$locale]; $gui = new stdClass(); $tplan_mgr = new testplan($dbHandler); $tproject_mgr = new testproject($dbHandler); $gui_open = config_get('gui_separator_open'); $gui_close = config_get('gui_separator_close'); $gui->str_option_any = $gui_open . lang_get('any') . $gui_close; $gui->str_option_none = $gui_open . lang_get('nobody') . $gui_close; $gui->tplan_id = $args->tplan_id; $gui->tproject_id = $args->tproject_id; $tplan_info = $tplan_mgr->get_by_id($gui->tplan_id); unset($tplan_mgr); $gui->tplan_name = $tplan_info['name']; $tproject_info = $tproject_mgr->get_by_id($gui->tproject_id); unset($tproject_mgr); $gui->tproject_name = $tproject_info['name']; $gui->users = new stdClass(); $gui->users->items = getUsersForHtmlOptions($dbHandler, ALL_USERS_FILTER, array(TL_USER_ANYBODY => $gui->str_option_any)); $gui->users->qty = count($gui->users->items); $reports_cfg = config_get('reportsCfg'); $startDate = strftime($date_format, time() - $reports_cfg->start_date_offset); $gui->selected_start_date = $startDate; $gui->selected_start_time = $reports_cfg->start_time; $gui->selected_end_date = strftime($date_format, time()); $gui->selected_end_time = null; return $gui; }
/** * Function returns array with input for reports navigator * * @param object $context * @param boolean $bug_interface_enabled * @param boolean $req_mgmt_enabled * @param integer $format format identifier * * @return array of array - described for array $g_reports_list in const.inc.php **/ public function get_list_reports($context, $bug_interface_enabled, $req_mgmt_enabled, $format) { $reportList = config_get('reports_list'); $items = array(); $toggleMsg = lang_get('show_hide_direct_link'); $canNotCreateDirectLink = lang_get('can_not_create_direct_link'); $apiKeyLen = strlen(trim($context->apikey)); $apiKeyIsValid = $apiKeyLen == 32 || $apiKeyLen == 64; // I'm sorry for MAGIC $xdx = 0; foreach ($reportList as &$reportItem) { // check validity of report if ($reportItem['enabled'] == 'all' || $reportItem['enabled'] == 'req' && $req_mgmt_enabled || $reportItem['enabled'] == 'bts' && $bug_interface_enabled) { if (strpos("," . $reportItem['format'], $format) > 0) { $reportUrl = $reportItem['url'] . (stristr($reportItem['url'], "?") ? '&' : '?'); $items[$xdx] = array('name' => lang_get($reportItem['title']), 'href' => $reportUrl, 'directLink' => ''); if (isset($reportItem['directLink']) && trim($reportItem['directLink']) != '') { if ($apiKeyIsValid) { $items[$xdx]['directLink'] = sprintf($reportItem['directLink'], $_SESSION['basehref'], $context->apikey, $context->tproject_id, $context->tplan_id); } else { $items[$xdx]['directLink'] = $canNotCreateDirectLink; } } $dl = $items[$xdx]['directLink']; $mask = '<img class="clickable" title="%s" alt="%s" ' . ' onclick="showHideByClass(' . "'div','%s');event.stopPropagation();" . '" ' . ' src="' . $context->imgSet['link_to_report'] . '" align="center" />'; $divClass = 'direct_link_' . $xdx; $items[$xdx]['toggle'] = sprintf($mask, $toggleMsg, $toggleMsg, $divClass); $items[$xdx]['directLinkDiv'] = '<div class="' . $divClass . '" ' . "style='display:none;border:1px solid;background-color:white;'>" . '<a href="' . $dl . '" target="_blank">' . $dl . '</a><br></div>'; $xdx++; } } } return $items; }
/** * Print Change Status to: AJAXified button * This code is similar to button_bug_change_status except that the * button is AJAXified. * Uses projax.php * * @param int $p_bug_id * @param int $t_project_id * @param int $t_user_id * @return null */ function kanban_ajax_button_bug_change_status($p_bug_id, $t_project_id, $t_user_id) { global $g_projax; $t_bug_project_id = bug_get_field($p_bug_id, 'project_id'); $t_bug_current_state = bug_get_field($p_bug_id, 'status'); $t_current_access = access_get_project_level($t_bug_project_id); $t_enum_list = get_status_option_list($t_current_access, $t_bug_current_state, false, bug_get_field($p_bug_id, 'reporter_id') == auth_get_current_user_id() && ON == config_get('allow_reporter_close'), $t_bug_project_id); if (count($t_enum_list) > 0) { # resort the list into ascending order after noting the key from the first element (the default) $t_default_arr = each($t_enum_list); $t_default = $t_default_arr['key']; ksort($t_enum_list); reset($t_enum_list); echo "<div id=\"ajax_statuschange\"><form method=\"post\" id=\"ajax_status_form\" action=\"xmlhttprequest.php\">"; # CSRF protection not required here - form does not result in modifications echo "<input type=\"hidden\" name=\"project_id\" id=\"project_id\" value=\"{$t_project_id}\" />"; echo "<input type=\"hidden\" name=\"user_id\" id=\"user_id\" value=\"{$t_user_id}\" />"; echo "<input type=\"hidden\" name=\"entrypoint\" id=\"entrypoint\" value=\"bug_update_status\" />"; $t_button_text = lang_get('bug_status_to_button'); // AJAX button options $options = array('url' => plugin_page('kanban_ajax_request'), 'with' => true, 'confirm' => lang_get('confirm_change_status'), 'success' => 'location.reload()', 'failure' => 'alert("Error: " ' + request . status + ')'); echo $g_projax->submit_to_remote('ajax_status', $t_button_text, $options); echo " <select name=\"new_status\">"; # space at beginning of line is important foreach ($t_enum_list as $key => $val) { echo "<option value=\"{$key}\" "; check_selected($key, $t_default); echo ">{$val}</option>"; } echo '</select>'; $t_bug_id = string_attribute($p_bug_id); echo "<input type=\"hidden\" name=\"id\" value=\"{$t_bug_id}\" />\n"; echo "</form></div>\n"; } }
/** */ function checkRights(&$db, &$userObj, $argsObjs) { if (!config_get("attachments")->enabled) { redirect($_SESSION['basehref'], "top.location"); exit; } }
function addIssue($dbHandler, $argsObj, $itsObj) { $opOK = false; $msg = ''; $resultsCfg = config_get('results'); $tcaseMgr = new testcase($dbHandler); $dummy = $tcaseMgr->tree_manager->get_node_hierarchy_info($argsObj->tcversion_id); $auditSign = $tcaseMgr->getAuditSignature((object) array('id' => $dummy['parent_id'])); $exec = current($tcaseMgr->getExecution($argsObj->exec_id, $argsObj->tcversion_id)); $dummy = $exec['status']; if (isset($resultsCfg['code_status'][$exec['status']])) { $dummy = $resultsCfg['code_status'][$exec['status']]; } $exec['statusVerbose'] = sprintf(lang_get('issue_exec_result'), $dummy); unset($tcaseMgr); $signature = sprintf(lang_get('issue_generated_description'), $argsObj->exec_id, $exec['tester_login'], $exec['testplan_name']); if ($exec['platform_id'] > 0) { $signature .= sprintf(lang_get('issue_platform'), $exec['platform_name']); } $signature .= sprintf(lang_get('issue_build') . lang_get('execution_ts_iso'), $exec['build_name'], $exec['execution_ts']) . "\n" . $exec['statusVerbose'] . "\n\n" . $exec['execution_notes']; $rs = $itsObj->addIssue($auditSign . ' - ' . sprintf(lang_get('execution_ts_iso'), $exec['execution_ts']), $signature); if ($rs['status_ok']) { $msg = $rs['msg']; $opOK = true; if (write_execution_bug($dbHandler, $argsObj->exec_id, $rs['id'])) { logAuditEvent(TLS("audit_executionbug_added", $rs['id']), "CREATE", $argsObj->exec_id, "executions"); } } else { $msg = $rs['msg']; } return array($opOK, $msg); }
/** * Ensure that the specified user has billing reporting access to the specified project. * * @param integer $p_project_id The project id or null for current project. * @param integer $p_user_id The user id or null for logged in user. */ function billing_ensure_reporting_access($p_project_id = null, $p_user_id = null) { if (config_get('time_tracking_enabled') == OFF) { trigger_error(ERROR_ACCESS_DENIED, ERROR); } access_ensure_project_level(config_get('time_tracking_reporting_threshold'), $p_project_id, $p_user_id); }
/** * * */ function initialize_gui(&$dbHandler, $argsObj) { $tproject_mgr = new testproject($dbHandler); $itemMgr = new requirement_spec_mgr($dbHandler); $commandMgr = new reqSpecCommands($dbHandler); $gui = $commandMgr->initGuiBean(); $gui->itemCfg = config_get('req_spec_cfg'); $gui->tproject_name = $argsObj->tproject_name; $gui->grants = new stdClass(); $gui->grants->req_mgmt = $argsObj->hasRight($dbHandler, "mgt_modify_req", $argsObj->tproject_id); $gui->tcasePrefix = $tproject_mgr->getTestCasePrefix($argsObj->tproject_id); $gui->glueChar = config_get('testcase_cfg')->glue_character; $gui->pieceSep = config_get('gui_title_separator_1'); $gui->item_id = $argsObj->item_id; $info = $itemMgr->getRevisionByID($gui->item_id, array('decode_user' => true)); $gui->item = $info; $gui->cfields = $itemMgr->html_table_of_custom_field_values(null, $gui->item_id, $argsObj->tproject_id); $gui->show_title = false; $gui->main_descr = lang_get('req_spec') . $gui->pieceSep . $gui->item['name']; $gui->showContextInfo = $argsObj->showContextInfo; if ($gui->showContextInfo) { $gui->parent_descr = lang_get('req_spec_short') . $gui->pieceSep . $gui->item['name']; } $gui->itemSpecStatus = null; $gui->itemTypeDomain = init_labels($gui->itemCfg->type_labels); return $gui; }
function SearchData($catid, $vendor, $string) { $pIFACE = content_lookup(config_get('document-root') . '/price')->GetData(); $words = explode(' ', preg_replace('/\\s+/', ' ', strtolower($string))); $result = array(); if (!isNumber($catid)) { return $result; } $subcats = $pIFACE->GetCatalogueData(1, $catid); $vendor = strtolower(trim($vendor)); for ($j = 0, $m = count($subcats); $j < $m; ++$j) { $data = $pIFACE->GetCatalogueData(2, $subcats[$j]['uid']); for ($i = 0, $n = count($data); $i < $n; ++$i) { $it = $data[$i]; if ($vendor != '' && strtolower($it['vendor']) != $vendor) { continue; } $found = true; $name = strtolower($it['name']); for ($k = 0, $l = count($words); $k < $l; ++$k) { if (trim($words[$k]) == '') { continue; } if (strpos($name, $words[$k]) == false) { $found = false; break; } } if ($found) { $result[] = $it; } } } return $result; }
function init_args(&$tcaseMgr) { $_REQUEST = strings_stripSlashes($_REQUEST); new dBug($_REQUEST); $args = new stdClass(); $args->doAction = isset($_REQUEST['doAction']) ? $_REQUEST['doAction'] : null; switch ($args->doAction) { case 'apply': break; default: $args->doAction = 'init'; break; } $args->tcase_id = isset($_REQUEST['tcase_id']) ? intval($_REQUEST['tcase_id']) : 0; $args->goback_url = isset($_REQUEST['goback_url']) ? $_REQUEST['goback_url'] : null; $args->uchoice = array(); $k2s = array('importance', 'status', 'execution_type'); foreach ($k2s as $tg) { $args->uchoice[$tg] = intval(isset($_REQUEST[$tg]) ? $_REQUEST[$tg] : -1); } $dummy = getConfigAndLabels('testCaseStatus', 'code'); $args->tcStatusCfg['status_code'] = $dummy['cfg']; $args->tcStatusCfg['code_label'] = $dummy['lbl']; $args->domainTCExecType = $tcaseMgr->get_execution_types(); $dummy = config_get('importance'); $args->domainTCImportance = $dummy['code_label']; return $args; }
/** * * */ function initialize_gui(&$dbHandler, &$argsObj) { $req_spec_mgr = new requirement_spec_mgr($dbHandler); $tproject_mgr = new testproject($dbHandler); $commandMgr = new reqSpecCommands($dbHandler); $gui = $commandMgr->initGuiBean(); $gui->refreshTree = $argsObj->refreshTree; $gui->req_spec_cfg = config_get('req_spec_cfg'); $gui->req_cfg = config_get('req_cfg'); $gui->external_req_management = $gui->req_cfg->external_req_management == ENABLED ? 1 : 0; $gui->grants = new stdClass(); $gui->grants->req_mgmt = $argsObj->user->hasRight($dbHandler, "mgt_modify_req", $argsObj->tproject_id); $gui->req_spec = $req_spec_mgr->get_by_id($argsObj->req_spec_id); $gui->revCount = $req_spec_mgr->getRevisionsCount($argsObj->req_spec_id); $gui->req_spec_id = $argsObj->req_spec_id; $gui->parentID = $argsObj->req_spec_id; $gui->req_spec_revision_id = $gui->req_spec['revision_id']; $gui->name = $gui->req_spec['title']; $gui->tproject_id = $argsObj->tproject_id; $gui->tproject_name = $argsObj->tproject_name; $gui->main_descr = lang_get('req_spec_short') . config_get('gui_title_separator_1') . "[{$gui->req_spec['doc_id']}] :: " . $gui->req_spec['title']; $gui->refresh_tree = 'no'; $gui->cfields = $req_spec_mgr->html_table_of_custom_field_values($argsObj->req_spec_id, $gui->req_spec_revision_id, $argsObj->tproject_id); $gui->attachments = $req_spec_mgr->getAttachmentInfos($argsObj->req_spec_id); $gui->requirements_count = $req_spec_mgr->get_requirements_count($argsObj->req_spec_id); $gui->reqSpecTypeDomain = init_labels($gui->req_spec_cfg->type_labels); $prefix = $tproject_mgr->getTestCasePrefix($argsObj->tproject_id); $gui->direct_link = $_SESSION['basehref'] . 'linkto.php?tprojectPrefix=' . urlencode($prefix) . '&item=reqspec&id=' . urlencode($gui->req_spec['doc_id']); $gui->actions = initializeActions($gui); return $gui; }
function string_emotions($p_note) { if (OFF == config_get('enable_smileys')) { return $p_note; } $images_dir = config_get('web_directory') . 'images/'; $smile = '<img src="' . $images_dir . 'smile.gif" width="15" height="15" alt=":)" />'; $sad = '<img src="' . $images_dir . 'sad.gif" width="15" height="15" alt=":(" />'; $wink = '<img src="' . $images_dir . 'wink.gif" width="15" height="15" alt=";)" />'; $big_smile = '<img src="' . $images_dir . 'bigsmile.gif" width="15" height="15" alt=":D" />'; $cool = '<img src="' . $images_dir . 'cool.gif" width="15" height="15" alt="8-D" />'; $mad = '<img src="' . $images_dir . 'mad.gif" width="15" height="15" alt=">-(" />'; $shocked = '<img src="' . $images_dir . 'shocked.gif" width="15" height="15" alt=":-*" />'; $p_note = str_replace(':)', $smile, $p_note); $p_note = str_replace(':-)', $smile, $p_note); $p_note = str_replace(':(', $sad, $p_note); $p_note = str_replace(':-(', $sad, $p_note); $p_note = str_replace(';)', $wink, $p_note); $p_note = str_replace(';-)', $wink, $p_note); $p_note = str_replace(':D', $big_smile, $p_note); $p_note = str_replace(':-D', $big_smile, $p_note); $p_note = str_replace('8-)', $cool, $p_note); $p_note = str_replace('>-(', $mad, $p_note); $p_note = str_replace(':-*', $shocked, $p_note); return $p_note; }
function getDataAndScale(&$dbHandler) { $obj = new stdClass(); $totals = null; $resultsCfg = config_get('results'); $dataSet = $_SESSION['statistics']['getTopLevelSuites']; $mapOfAggregate = $_SESSION['statistics']['getAggregateMap']; $obj->canDraw = !is_null($dataSet); if ($obj->canDraw) { // Process to enable alphabetical order foreach ($dataSet as $tsuite) { $item_descr[$tsuite['name']] = $tsuite['id']; } ksort($item_descr); foreach ($item_descr as $name => $tsuite_id) { $items[] = htmlspecialchars($name); $rmap = $mapOfAggregate[$tsuite_id]; unset($rmap['total']); foreach ($rmap as $key => $value) { $totals[$key][] = $value; } } } $obj->xAxis = new stdClass(); $obj->xAxis->values = $items; $obj->xAxis->serieName = 'Serie8'; $obj->series_color = null; foreach ($totals as $status => $values) { $obj->chart_data[] = $values; $obj->series_label[] = lang_get($resultsCfg['status_label'][$status]); $obj->series_color[] = $resultsCfg['charts']['status_colour'][$status]; } return $obj; }
function print_year_range_option_list($p_year = 0, $p_start = 0, $p_end = 0) { $t_current = date("Y"); $t_forward_years = config_get('forward_year_count'); $t_start_year = $p_start; if ($t_start_year == 0) { $t_start_year = $t_current; } if ($p_year < $t_start_year && $p_year != 0) { $t_start_year = $p_year; } $t_end_year = $p_end; if ($t_end_year == 0) { $t_end_year = $t_current + $t_forward_years; } if ($p_year > $t_end_year) { $t_end_year = $p_year + $t_forward_years; } for ($i = $t_start_year; $i <= $t_end_year; $i++) { if ($i == $p_year) { print "<option value=\"{$i}\" selected=\"selected\"> {$i} </option>"; } else { print "<option value=\"{$i}\"> {$i} </option>"; } } }
function compress_is_enabled() { global $g_compression_started; #@@@ temporarily disable compression when using IIS because of # issue #2953 return $g_compression_started && ON == config_get('compress_html') && OFF == config_get('use_iis') && 'ob_gzhandler' != ini_get('output_handler') && extension_loaded('zlib') && !ini_get('zlib.output_compression'); }
/** * * */ function initializeGui(&$control) { $gui = new stdClass(); // This logic is managed from execSetResults.php $gui->loadExecDashboard = true; if (isset($_SESSION['loadExecDashboard'][$control->form_token]) || $control->args->loadExecDashboard == 0) { $gui->loadExecDashboard = false; unset($_SESSION['loadExecDashboard'][$control->form_token]); } $gui->menuUrl = 'lib/execute/execSetResults.php'; $gui->args = $control->get_argument_string(); if ($control->args->loadExecDashboard == false) { $gui->src_workframe = ''; } else { $gui->src_workframe = $control->args->basehref . $gui->menuUrl . "?edit=testproject&id={$control->args->testproject_id}" . $gui->args; } $control->draw_export_testplan_button = true; $control->draw_import_xml_results_button = true; $dummy = config_get('results'); $gui->not_run = $dummy['status_code']['not_run']; $dummy = config_get('execution_filter_methods'); $gui->lastest_exec_method = $dummy['status_code']['latest_execution']; $gui->pageTitle = lang_get('href_execute_test'); return $gui; }
/** * Print the list of selected issues and the legend for the status colors. * * @param $p_bug_ids_array An array of issue ids. */ function bug_group_action_print_bug_list($p_bug_ids_array) { $t_legend_position = config_get('status_legend_position'); if (STATUS_LEGEND_POSITION_TOP == $t_legend_position) { html_status_legend(); echo '<br />'; } echo '<div align="center">'; echo '<table class="width75" cellspacing="1">'; echo '<tr class="row-1">'; echo '<td class="category" colspan="2">'; echo lang_get('actiongroup_bugs'); echo '</td>'; echo '</tr>'; $t_i = 1; foreach ($p_bug_ids_array as $t_bug_id) { $t_class = sprintf("row-%d", $t_i++ % 2 + 1); echo sprintf("<tr bgcolor=\"%s\"> <td>%s</td> <td>%s</td> </tr>\n", get_status_color(bug_get_field($t_bug_id, 'status')), string_get_bug_view_link($t_bug_id), string_attribute(bug_get_field($t_bug_id, 'summary'))); } echo '</table>'; echo '</form>'; echo '</div>'; if (STATUS_LEGEND_POSITION_BOTTOM == $t_legend_position) { echo '<br />'; html_status_legend(); } }
/** * Parse a workflow into a graph-like array of workflow transitions. * @param array The workflow enumeration to parse. * @return array The parsed workflow graph. */ function workflow_parse($p_enum_workflow) { $t_status_arr = MantisEnum::getAssocArrayIndexedByValues(config_get('status_enum_string')); if (count($p_enum_workflow) == 0) { # workflow is not set, default it to all transitions foreach ($t_status_arr as $t_status => $t_label) { $t_temp_workflow = array(); foreach ($t_status_arr as $t_next => $t_next_label) { if ($t_status != $t_next) { $t_temp_workflow[] = $t_next . ':' . $t_next_label; } } $p_enum_workflow[$t_status] = implode(',', $t_temp_workflow); } } $t_entry = array(); $t_exit = array(); # prepopulate new bug state (bugs go from nothing to here) $t_submit_status_array = config_get('bug_submit_status'); $t_new_label = MantisEnum::getLabel(lang_get('status_enum_string'), config_get('bug_submit_status')); if (is_array($t_submit_status_array)) { # @@@ (thraxisp) this is not implemented in bug_api.php foreach ($t_submit_status_array as $t_access => $t_status) { $t_entry[$t_status][0] = $t_new_label; $t_exit[0][$t_status] = $t_new_label; } } else { $t_status = $t_submit_status_array; $t_entry[$t_status][0] = $t_new_label; $t_exit[0][$t_status] = $t_new_label; } # add user defined arcs and implicit reopen arcs $t_reopen = config_get('bug_reopen_status'); $t_reopen_label = MantisEnum::getLabel(lang_get('resolution_enum_string'), config_get('bug_reopen_resolution')); $t_resolved_status = config_get('bug_resolved_status_threshold'); $t_default = array(); foreach ($t_status_arr as $t_status => $t_status_label) { if (isset($p_enum_workflow[$t_status])) { $t_next_arr = MantisEnum::getAssocArrayIndexedByValues($p_enum_workflow[$t_status]); foreach ($t_next_arr as $t_next => $t_next_label) { if (!isset($t_default[$t_status])) { $t_default[$t_status] = $t_next; } $t_exit[$t_status][$t_next] = ''; $t_entry[$t_next][$t_status] = ''; } } else { $t_exit[$t_status] = array(); } if ($t_status >= $t_resolved_status) { $t_exit[$t_status][$t_reopen] = $t_reopen_label; $t_entry[$t_reopen][$t_status] = $t_reopen_label; } if (!isset($t_entry[$t_status])) { $t_entry[$t_status] = array(); } } return array('entry' => $t_entry, 'exit' => $t_exit, 'default' => $t_default); }
function OptGet($opt, $cfg) { $val = opt_get($opt); if ($val == '') { $val = config_get($cfg); } return $val; }
/** * Checks the user rights for viewing the page * * @param $db resource the database connection handle * @param $user tlUser the object of the current user * * @return boolean return true if the page can be viewed, false if not */ function checkRights(&$db, &$user) { $execCfg = config_get('exec_cfg'); if ($execCfg->edit_notes != 1) { return false; } return $user->hasRight($db, "testplan_execute"); }