本文整理汇总了PHP中config_get函数的典型用法代码示例。如果您正苦于以下问题:PHP config_get函数的具体用法?PHP config_get怎么用?PHP config_get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了config_get函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: skip
/**
* 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;
}
示例2: config_error
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;
}
示例3: initialize_gui
/**
*
*
*/
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;
}
示例4: flushHttpHeader
/**
* 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();
}
示例5: auth_does_password_match
/**
* @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;
}
示例6: mci_account_get_array_by_id
/**
* 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;
}
示例7: CheckTables
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 ""'));
}
示例8: action_attach_tags_validate
/**
* 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;
}
示例9: __construct
/**
* 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();
}
}
}
示例10: install
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;
}
示例11: bugCreateHelper
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;
}
示例12: initializeGui
/**
*
*/
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;
}
示例13: get_list_reports
/**
* 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;
}
示例14: kanban_ajax_button_bug_change_status
/**
* 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";
}
}
示例15: checkRights
/**
*/
function checkRights(&$db, &$userObj, $argsObjs)
{
if (!config_get("attachments")->enabled) {
redirect($_SESSION['basehref'], "top.location");
exit;
}
}