本文整理汇总了PHP中access_ensure_project_level函数的典型用法代码示例。如果您正苦于以下问题:PHP access_ensure_project_level函数的具体用法?PHP access_ensure_project_level怎么用?PHP access_ensure_project_level使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了access_ensure_project_level函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: billing_ensure_reporting_access
/**
* 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);
}
示例2: 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;
}
示例3: billing_get_for_project
/**
* Gets the billing information for the specified project during the specified date range.
*
* @param integer $p_project_id A project identifier or ALL_PROJECTS.
* @param string $p_from Starting date (yyyy-mm-dd) inclusive, if blank, then ignored.
* @param string $p_to Ending date (yyyy-mm-dd) inclusive, if blank, then ignored.
* @param integer $p_cost_per_hour Cost per hour.
* @return array array of bugnotes
* @access public
*/
function billing_get_for_project($p_project_id, $p_from, $p_to, $p_cost_per_hour)
{
$t_params = array();
$c_to = strtotime($p_to) + SECONDS_PER_DAY - 1;
$c_from = strtotime($p_from);
if ($c_to === false || $c_from === false) {
error_parameters(array($p_from, $p_to));
trigger_error(ERROR_GENERIC, ERROR);
}
db_param_push();
if (ALL_PROJECTS != $p_project_id) {
access_ensure_project_level(config_get('view_bug_threshold'), $p_project_id);
$t_project_where = ' AND b.project_id = ' . db_param() . ' AND bn.bug_id = b.id ';
$t_params[] = $p_project_id;
} else {
$t_project_ids = user_get_all_accessible_projects();
$t_project_where = ' AND b.project_id in (' . implode(', ', $t_project_ids) . ')';
}
if (!is_blank($c_from)) {
$t_from_where = ' AND bn.date_submitted >= ' . db_param();
$t_params[] = $c_from;
} else {
$t_from_where = '';
}
if (!is_blank($c_to)) {
$t_to_where = ' AND bn.date_submitted <= ' . db_param();
$t_params[] = $c_to;
} else {
$t_to_where = '';
}
$t_results = array();
$t_query = 'SELECT bn.id id, bn.time_tracking minutes, bn.date_submitted as date_submitted, bnt.note note,
u.realname realname, b.project_id project_id, c.name bug_category, b.summary bug_summary, bn.bug_id bug_id, bn.reporter_id reporter_id
FROM {user} u, {bugnote} bn, {bug} b, {bugnote_text} bnt, {category} c
WHERE u.id = bn.reporter_id AND bn.time_tracking != 0 AND bn.bug_id = b.id AND bnt.id = bn.bugnote_text_id AND c.id=b.category_id
' . $t_project_where . $t_from_where . $t_to_where . '
ORDER BY bn.id';
$t_result = db_query($t_query, $t_params);
$t_cost_per_min = $p_cost_per_hour / 60.0;
$t_access_level_required = config_get('time_tracking_view_threshold');
while ($t_row = db_fetch_array($t_result)) {
if (!access_has_bugnote_level($t_access_level_required, $t_row['id'])) {
continue;
}
$t_total_cost = $t_cost_per_min * $t_row['minutes'];
$t_row['cost'] = $t_total_cost;
$t_results[] = $t_row;
}
$t_billing_rows = billing_rows_to_array($t_results);
return $t_billing_rows;
}
示例4: trigger_error
$t_dst_project_id = $f_other_project_id;
} else {
trigger_error(ERROR_GENERIC, ERROR);
}
}
# only admins can set global defaults.for ALL_PROJECT
if ($f_manage_page && $t_dst_project_id == ALL_PROJECTS && !current_user_is_administrator()) {
access_denied();
}
# only MANAGERS can set global defaults.for a project
if ($f_manage_page && $t_dst_project_id != ALL_PROJECTS) {
access_ensure_project_level(MANAGER, $t_dst_project_id);
}
# user should only be able to set columns for a project that is accessible.
if ($t_dst_project_id != ALL_PROJECTS) {
access_ensure_project_level(VIEWER, $t_dst_project_id);
}
# Calculate the user id to set the configuration for.
if ($f_manage_page) {
$t_user_id = NO_USER;
} else {
$t_user_id = auth_get_current_user_id();
}
$t_all_columns = columns_get_all();
$t_default = null;
$t_view_issues_page_columns = config_get('view_issues_page_columns', $t_default, $t_user_id, $t_src_project_id);
$t_view_issues_page_columns = columns_remove_invalid($t_view_issues_page_columns, $t_all_columns);
$t_print_issues_page_columns = config_get('print_issues_page_columns', $t_default, $t_user_id, $t_src_project_id);
$t_print_issues_page_columns = columns_remove_invalid($t_print_issues_page_columns, $t_all_columns);
$t_csv_columns = config_get('csv_columns', $t_default, $t_user_id, $t_src_project_id);
$t_csv_columns = columns_remove_invalid($t_csv_columns, $t_all_columns);
示例5: require_api
* @uses news_api.php
* @uses print_api.php
* @uses string_api.php
*/
require_once 'core.php';
require_api('access_api.php');
require_api('config_api.php');
require_api('constant_inc.php');
require_api('helper_api.php');
require_api('html_api.php');
require_api('lang_api.php');
require_api('news_api.php');
require_api('print_api.php');
require_api('string_api.php');
news_ensure_enabled();
access_ensure_project_level(VIEWER);
html_page_top();
?>
<br />
<?php
# Select the news posts
$rows = news_get_rows(helper_get_current_project());
$t_count = count($rows);
if ($t_count > 0) {
?>
<ul><?php
# Loop through results
for ($i = 0; $i < $t_count; $i++) {
extract($rows[$i], EXTR_PREFIX_ALL, 'v');
if (VS_PRIVATE == $v_view_state && !access_has_project_level(config_get('private_news_threshold'), $v_project_id)) {
示例6: form_security_validate
# along with MantisBT. If not, see <http://www.gnu.org/licenses/>.
/**
* @package MantisBT
* @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
* @copyright Copyright (C) 2002 - 2013 MantisBT Team - mantisbt-dev@lists.sourceforge.net
* @link http://www.mantisbt.org
*/
/**
* MantisBT Core API's
*/
require_once 'core.php';
form_security_validate('manage_proj_subproj_delete');
auth_reauthenticate();
$f_project_id = gpc_get_int('project_id');
$f_subproject_id = gpc_get_int('subproject_id');
access_ensure_project_level(config_get('manage_project_threshold'), $f_project_id);
project_hierarchy_remove($f_subproject_id, $f_project_id);
form_security_purge('manage_proj_subproj_delete');
$t_redirect_url = 'manage_proj_edit_page.php?project_id=' . $f_project_id;
html_page_top(null, $t_redirect_url);
?>
<br />
<div align="center">
<?php
echo lang_get('operation_successful') . '<br />';
print_bracket_link($t_redirect_url, lang_get('proceed'));
?>
</div>
<?php
html_page_bottom();
示例7: config_get
require_once 'core.php';
$t_core_path = config_get('core_path');
# helper_ensure_post();
$f_user_id = gpc_get_int('user_id');
$f_project_id = gpc_get_int('project_id');
$f_config_option = gpc_get_string('config_option');
$f_type = gpc_get_string('type');
$f_value = gpc_get_string('value');
if (is_blank($f_config_option)) {
error_parameters('config_option');
trigger_error(ERROR_EMPTY_FIELD, ERROR);
}
if ($f_project_id == ALL_PROJECTS) {
access_ensure_global_level(config_get('set_configuration_threshold'));
} else {
access_ensure_project_level(config_get('set_configuration_threshold'), $f_project_id);
}
# make sure that configuration option specified is a valid one.
$t_not_found_value = '***CONFIG OPTION NOT FOUND***';
if (config_get_global($f_config_option, $t_not_found_value) === $t_not_found_value) {
error_parameters($f_config_option);
trigger_error(ERROR_CONFIG_OPT_NOT_FOUND, ERROR);
}
# make sure that configuration option specified can be stored in the database
if (!config_can_set_in_database($f_config_option)) {
error_parameters($f_config_option);
trigger_error(ERROR_CONFIG_OPT_CANT_BE_SET_IN_DB, ERROR);
}
if ($f_type === 'default') {
$t_config_global_value = config_get_global($f_config_option);
if (is_string($t_config_global_value)) {
示例8: helper_project_specific_where
function helper_project_specific_where($p_project_id, $p_user_id = null)
{
if (null === $p_user_id) {
$p_user_id = auth_get_current_user_id();
}
if (ALL_PROJECTS == $p_project_id) {
$t_topprojects = $t_project_ids = user_get_accessible_projects($p_user_id);
foreach ($t_topprojects as $t_project) {
$t_project_ids = array_merge($t_project_ids, user_get_all_accessible_subprojects($p_user_id, $t_project));
}
$t_project_ids = array_unique($t_project_ids);
} else {
access_ensure_project_level(VIEWER, $p_project_id);
$t_project_ids = user_get_all_accessible_subprojects($p_user_id, $p_project_id);
array_unshift($t_project_ids, $p_project_id);
}
$t_project_ids = array_map('db_prepare_int', $t_project_ids);
if (0 == count($t_project_ids)) {
$t_project_filter = ' 1<>1';
} elseif (1 == count($t_project_ids)) {
$t_project_filter = ' project_id=' . $t_project_ids[0];
} else {
$t_project_filter = ' project_id IN (' . join(',', $t_project_ids) . ')';
}
return $t_project_filter;
}
示例9: require_api
* @copyright Copyright 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
* @copyright Copyright 2002 MantisBT Team - mantisbt-dev@lists.sourceforge.net
* @link http://www.mantisbt.org
*
* @uses core.php
* @uses access_api.php
* @uses config_api.php
* @uses constant_inc.php
* @uses html_api.php
* @uses lang_api.php
*/
require_once 'core.php';
require_api('access_api.php');
require_api('config_api.php');
require_api('constant_inc.php');
require_api('html_api.php');
require_api('lang_api.php');
if (!config_get('time_tracking_enabled')) {
trigger_error(ERROR_ACCESS_DENIED, ERROR);
}
access_ensure_project_level(config_get('time_tracking_reporting_threshold'));
html_page_top(lang_get('time_tracking_billing_link'));
?>
<br />
<?php
# Work break-down
define('BILLING_INC_ALLOW', true);
include dirname(__FILE__) . DIRECTORY_SEPARATOR . 'billing_inc.php';
html_page_bottom();
示例10: require_api
* @uses lang_api.php
* @uses print_api.php
* @uses string_api.php
* @uses utility_api.php
*/
require_once 'core.php';
require_api('access_api.php');
require_api('config_api.php');
require_api('gpc_api.php');
require_api('html_api.php');
require_api('lang_api.php');
require_api('print_api.php');
require_api('string_api.php');
require_api('utility_api.php');
html_page_top();
access_ensure_project_level(config_get('create_permalink_threshold'));
$f_url = string_sanitize_url(gpc_get_string('url'));
?>
<div>
<p>
<?php
echo lang_get('filter_permalink'), '<br />';
$t_safe_url = string_display_line($f_url);
echo "<a href=\"{$t_safe_url}\">{$t_safe_url}</a></p>";
$t_create_short_url = config_get('create_short_url');
if (!is_blank($t_create_short_url)) {
print_bracket_link(sprintf($t_create_short_url, $f_url), lang_get('create_short_link'), true);
}
?>
</div>
<?php
示例11: Copyright
# Mantis - a php based bugtracking system
# Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
# Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net
# This program is distributed under the terms and conditions of the GPL
# See the README and LICENSE files for details
# --------------------------------------------------------
# $Id: manage_proj_ver_delete.php,v 1.22 2004/12/14 20:37:07 marcelloscata Exp $
# --------------------------------------------------------
require_once 'core.php';
$t_core_path = config_get('core_path');
require_once $t_core_path . 'version_api.php';
$f_version_id = gpc_get_int('version_id');
$t_version_info = version_get($f_version_id);
$t_redirect_url = 'manage_proj_edit_page.php?project_id=' . $t_version_info->project_id;
access_ensure_project_level(config_get('manage_project_threshold'), $t_version_info->project_id);
# Confirm with the user
helper_ensure_confirmed(lang_get('version_delete_sure') . '<br/>' . lang_get('version') . ': ' . $t_version_info->version, lang_get('delete_version_button'));
version_remove($f_version_id);
html_page_top1();
html_meta_redirect($t_redirect_url);
html_page_top2();
?>
<br />
<div align="center">
<?php
echo lang_get('operation_successful') . '<br />';
print_bracket_link($t_redirect_url, lang_get('proceed'));
?>
</div>
示例12: user_get_all_accessible_projects
function user_get_all_accessible_projects($p_user_id, $p_project_id)
{
if (ALL_PROJECTS == $p_project_id) {
$t_topprojects = $t_project_ids = user_get_accessible_projects($p_user_id);
foreach ($t_topprojects as $t_project) {
$t_project_ids = array_merge($t_project_ids, user_get_all_accessible_subprojects($p_user_id, $t_project));
}
$t_project_ids = array_unique($t_project_ids);
} else {
access_ensure_project_level(VIEWER, $p_project_id);
$t_project_ids = user_get_all_accessible_subprojects($p_user_id, $p_project_id);
array_unshift($t_project_ids, $p_project_id);
}
return $t_project_ids;
}
示例13: Copyright
<?php
# Copyright (c) 2012 John Reese
# Licensed under the MIT license
access_ensure_project_level(plugin_config_get('update_threshold'));
$f_changeset_id = gpc_get_int('id');
$t_changeset = SourceChangeset::load($f_changeset_id);
$t_repos = SourceRepo::load_by_changesets($t_changeset);
if (count($t_repos) < 1) {
trigger_error(ERROR_GENERIC, ERROR);
}
$t_repo = array_shift($t_repos);
$t_repo->load_branches();
if (plugin_config_get('enable_porting')) {
$f_ported = gpc_get_string('ported', '');
if (0 == $f_ported || in_array($f_ported, $t_repo->branches)) {
$t_changeset->ported = $f_ported;
}
}
$t_changeset->save();
print_successful_redirect(plugin_page('view', true) . '&id=' . $t_changeset->id);
示例14: form_security_validate
# along with MantisBT. If not, see <http://www.gnu.org/licenses/>.
/**
* @package MantisBT
* @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
* @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net
* @link http://www.mantisbt.org
*/
/**
* MantisBT Core API's
*/
require_once 'core.php';
require_once 'email_api.php';
form_security_validate('manage_config_email_set');
auth_reauthenticate();
$t_can_change_level = min(config_get_access('notify_flags'), config_get_access('default_notify_flags'));
access_ensure_project_level($t_can_change_level);
$t_redirect_url = 'manage_config_email_page.php';
$t_project = helper_get_current_project();
$f_flags = gpc_get('flag', array());
$f_thresholds = gpc_get('flag_threshold', array());
$f_actions_access = gpc_get_int('notify_actions_access');
html_page_top(lang_get('manage_email_config'), $t_redirect_url);
$t_access = current_user_get_access_level();
$t_can_change_flags = $t_access >= config_get_access('notify_flags');
$t_can_change_defaults = $t_access >= config_get_access('default_notify_flags');
# build a list of the possible actions and flags
$t_valid_actions = array('owner', 'reopened', 'deleted', 'bugnote');
if (config_get('enable_sponsorship') == ON) {
$t_valid_actions[] = 'sponsor';
}
$t_valid_actions[] = 'relation';
示例15: require_api
require_api('constant_inc.php');
require_api('gpc_api.php');
require_api('html_api.php');
require_api('lang_api.php');
require_api('news_api.php');
require_api('print_api.php');
news_ensure_enabled();
$f_news_id = gpc_get_int('news_id', null);
html_page_top();
?>
<?php
if ($f_news_id !== null) {
$t_project_id = news_get_field($f_news_id, 'project_id');
if (news_is_private($f_news_id)) {
access_ensure_project_level(config_get('private_news_threshold'), $t_project_id);
} else {
access_ensure_project_level(config_get('view_bug_threshold', null, null, $t_project_id), $t_project_id);
}
print_news_string_by_news_id($f_news_id);
}
?>
<div id="news-menu">
<?php
print_bracket_link('news_list_page.php', lang_get('archives'));
?>
</div>
<?php
html_page_bottom();