当前位置: 首页>>代码示例>>PHP>>正文


PHP project_ensure_exists函数代码示例

本文整理汇总了PHP中project_ensure_exists函数的典型用法代码示例。如果您正苦于以下问题:PHP project_ensure_exists函数的具体用法?PHP project_ensure_exists怎么用?PHP project_ensure_exists使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了project_ensure_exists函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: require_api

require_api('form_api.php');
require_api('gpc_api.php');
require_api('helper_api.php');
require_api('html_api.php');
require_api('lang_api.php');
require_api('print_api.php');
require_api('project_api.php');
require_api('project_hierarchy_api.php');
require_api('string_api.php');
require_api('user_api.php');
require_api('utility_api.php');
require_api('version_api.php');
auth_reauthenticate();
$f_project_id = gpc_get_int('project_id');
$f_show_global_users = gpc_get_bool('show_global_users');
project_ensure_exists($f_project_id);
access_ensure_project_level(config_get('manage_project_threshold'), $f_project_id);
$row = project_get_row($f_project_id);
$t_can_manage_users = access_has_project_level(config_get('project_user_threshold'), $f_project_id);
html_page_top(project_get_field($f_project_id, 'name'));
print_manage_menu('manage_proj_edit_page.php');
?>
<br />
<!-- PROJECT PROPERTIES -->
<div align="center">
<form method="post" action="manage_proj_update.php">
<?php 
echo form_security_field('manage_proj_update');
?>
<table class="width75" cellspacing="1">
开发者ID:kaos,项目名称:mantisbt,代码行数:30,代码来源:manage_proj_edit_page.php

示例2: require_api

require_api('helper_api.php');
require_api('html_api.php');
require_api('lang_api.php');
require_api('print_api.php');
require_api('project_api.php');
require_api('string_api.php');
require_api('utility_api.php');
$f_project_id = gpc_get_string('project_id');
$f_make_default = gpc_get_bool('make_default');
$f_ref = gpc_get_string('ref', '');
$c_ref = string_prepare_header($f_ref);
$t_project = explode(';', $f_project_id);
$t_top = $t_project[0];
$t_bottom = $t_project[count($t_project) - 1];
if (ALL_PROJECTS != $t_bottom) {
    project_ensure_exists($t_bottom);
}
# Set default project
if ($f_make_default) {
    current_user_set_default_project($t_top);
}
helper_set_current_project($f_project_id);
# redirect to 'same page' when switching projects.
# for proxies that clear out HTTP_REFERER
if (!is_blank($c_ref)) {
    $t_redirect_url = $c_ref;
} else {
    if (!isset($_SERVER['HTTP_REFERER']) || is_blank($_SERVER['HTTP_REFERER'])) {
        $t_redirect_url = config_get('default_home_page');
    } else {
        $t_home_page = config_get('default_home_page');
开发者ID:derrickweaver,项目名称:mantisbt,代码行数:31,代码来源:set_project.php

示例3: config_set

/**
 * Sets the value of the given configuration option to the given value
 * If the configuration option does not exist, an ERROR is triggered
 *
 * @param string  $p_option  Configuration option name.
 * @param string  $p_value   Configuration option value.
 * @param integer $p_user    A user identifier. Defaults to NO_USER.
 * @param integer $p_project A project identifier. Defaults to ALL_PROJECTS.
 * @param integer $p_access  Access level. Defaults to DEFAULT_ACCESS_LEVEL.
 * @return boolean
 */
function config_set($p_option, $p_value, $p_user = NO_USER, $p_project = ALL_PROJECTS, $p_access = DEFAULT_ACCESS_LEVEL)
{
    if ($p_access == DEFAULT_ACCESS_LEVEL) {
        $p_access = config_get_global('admin_site_threshold');
    }
    if (is_array($p_value) || is_object($p_value)) {
        $t_type = CONFIG_TYPE_COMPLEX;
        $c_value = json_encode($p_value);
    } else {
        if (is_float($p_value)) {
            $t_type = CONFIG_TYPE_FLOAT;
            $c_value = (double) $p_value;
        } else {
            if (is_int($p_value) || is_numeric($p_value)) {
                $t_type = CONFIG_TYPE_INT;
                $c_value = (int) $p_value;
            } else {
                $t_type = CONFIG_TYPE_STRING;
                $c_value = $p_value;
            }
        }
    }
    if (config_can_set_in_database($p_option)) {
        # before we set in the database, ensure that the user and project id exist
        if ($p_project !== ALL_PROJECTS) {
            project_ensure_exists($p_project);
        }
        if ($p_user !== NO_USER) {
            user_ensure_exists($p_user);
        }
        $t_query = 'SELECT COUNT(*) from {config}
				WHERE config_id = ' . db_param() . ' AND
					project_id = ' . db_param() . ' AND
					user_id = ' . db_param();
        $t_result = db_query($t_query, array($p_option, (int) $p_project, (int) $p_user));
        $t_params = array();
        if (0 < db_result($t_result)) {
            $t_set_query = 'UPDATE {config}
					SET value=' . db_param() . ', type=' . db_param() . ', access_reqd=' . db_param() . '
					WHERE config_id = ' . db_param() . ' AND
						project_id = ' . db_param() . ' AND
						user_id = ' . db_param();
            $t_params = array((string) $c_value, $t_type, (int) $p_access, $p_option, (int) $p_project, (int) $p_user);
        } else {
            $t_set_query = 'INSERT INTO {config}
					( value, type, access_reqd, config_id, project_id, user_id )
					VALUES
					(' . db_param() . ', ' . db_param() . ', ' . db_param() . ', ' . db_param() . ', ' . db_param() . ',' . db_param() . ' )';
            $t_params = array((string) $c_value, $t_type, (int) $p_access, $p_option, (int) $p_project, (int) $p_user);
        }
        db_query($t_set_query, $t_params);
    }
    config_set_cache($p_option, $c_value, $t_type, $p_user, $p_project, $p_access);
    return true;
}
开发者ID:derrickweaver,项目名称:mantisbt,代码行数:66,代码来源:config_api.php

示例4: require_api

 * @uses project_api.php
 * @uses project_hierarchy_api.php
 */
require_once 'core.php';
require_api('access_api.php');
require_api('authentication_api.php');
require_api('config_api.php');
require_api('constant_inc.php');
require_api('form_api.php');
require_api('gpc_api.php');
require_api('html_api.php');
require_api('lang_api.php');
require_api('print_api.php');
require_api('project_api.php');
require_api('project_hierarchy_api.php');
form_security_validate('manage_proj_subproj_add');
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_ensure_exists($f_project_id);
project_ensure_exists($f_subproject_id);
if ($f_project_id == $f_subproject_id) {
    trigger_error(ERROR_GENERIC, ERROR);
}
project_hierarchy_add($f_subproject_id, $f_project_id);
form_security_purge('manage_proj_subproj_add');
$t_redirect_url = 'manage_proj_edit_page.php?project_id=' . $f_project_id;
html_page_top(null, $t_redirect_url);
html_operation_successful($t_redirect_url);
html_page_bottom();
开发者ID:N0ctrnl,项目名称:mantisbt,代码行数:31,代码来源:manage_proj_subproj_add.php

示例5: custom_field_link

/**
 * Add a custom field to a project
 * return true on success, false on failure or if already added
 * @param integer $p_field_id   Custom field identifier.
 * @param integer $p_project_id Project identifier.
 * @return boolean
 * @access public
 */
function custom_field_link($p_field_id, $p_project_id)
{
    custom_field_ensure_exists($p_field_id);
    project_ensure_exists($p_project_id);
    if (custom_field_is_linked($p_field_id, $p_project_id)) {
        return false;
    }
    $t_query = 'INSERT INTO {custom_field_project} ( field_id, project_id )
				  VALUES ( ' . db_param() . ', ' . db_param() . ')';
    db_query($t_query, array($p_field_id, $p_project_id));
    return true;
}
开发者ID:hamx0r,项目名称:mantisbt,代码行数:20,代码来源:custom_field_api.php

示例6: require_api

require_api('config_api.php');
require_api('constant_inc.php');
require_api('event_api.php');
require_api('form_api.php');
require_api('gpc_api.php');
require_api('print_api.php');
require_api('project_api.php');
require_api('version_api.php');
form_security_validate('manage_proj_ver_copy');
auth_reauthenticate();
$f_project_id = gpc_get_int('project_id');
$f_other_project_id = gpc_get_int('other_project_id');
$f_copy_from = gpc_get_bool('copy_from');
$f_copy_to = gpc_get_bool('copy_to');
project_ensure_exists($f_project_id);
project_ensure_exists($f_other_project_id);
access_ensure_project_level(config_get('manage_project_threshold'), $f_project_id);
access_ensure_project_level(config_get('manage_project_threshold'), $f_other_project_id);
if ($f_copy_from) {
    $t_src_project_id = $f_other_project_id;
    $t_dst_project_id = $f_project_id;
} else {
    if ($f_copy_to) {
        $t_src_project_id = $f_project_id;
        $t_dst_project_id = $f_other_project_id;
    } else {
        trigger_error(ERROR_VERSION_NO_ACTION, ERROR);
    }
}
$t_rows = version_get_all_rows($t_src_project_id);
foreach ($t_rows as $t_row) {
开发者ID:nextgens,项目名称:mantisbt,代码行数:31,代码来源:manage_proj_ver_copy.php

示例7: category_remove_all

/**
 * Remove all categories associated with a project
 * @param int $p_project_id Project ID
 * @param int $p_new_category_id new category id (to replace existing category)
 * @return bool
 * @access public
 */
 function category_remove_all( $p_project_id, $p_new_category_id = 0 ) {

	project_ensure_exists( $p_project_id );
	if( 0 != $p_new_category_id ) {
		category_ensure_exists( $p_new_category_id );
	}

	# cache category names
	category_get_all_rows( $p_project_id );

	$t_category_table = db_get_table( 'category' );
	$t_bug_table = db_get_table( 'bug' );

	# get a list of affected categories
	$t_query = "SELECT id FROM $t_category_table WHERE project_id=" . db_param();
	$t_result = db_query_bound( $t_query, array( $p_project_id ) );

	$t_category_ids = array();
	while( $t_row = db_fetch_array( $t_result ) ) {
		$t_category_ids[] = $t_row['id'];
	}

	# Handle projects with no categories
	if( count( $t_category_ids ) < 1 ) {
		return true;
	}

	$t_category_ids = join( ',', $t_category_ids );

	# update bug history entries
	$t_query = "SELECT id, category_id FROM $t_bug_table WHERE category_id IN ( $t_category_ids )";
	$t_result = db_query_bound( $t_query );

	while( $t_bug_row = db_fetch_array( $t_result ) ) {
		history_log_event_direct( $t_bug_row['id'], 'category', category_full_name( $t_bug_row['category_id'], false ), category_full_name( $p_new_category_id, false ) );
	}

	# update bug data
	$t_query = "UPDATE $t_bug_table SET category_id=" . db_param() . " WHERE category_id IN ( $t_category_ids )";
	db_query_bound( $t_query, array( $p_new_category_id ) );

	# delete categories
	$t_query = "DELETE FROM $t_category_table WHERE project_id=" . db_param();
	db_query_bound( $t_query, array( $p_project_id ) );

	return true;
}
开发者ID:rombert,项目名称:mantisbt,代码行数:54,代码来源:category_api.php

示例8: category_remove_all

function category_remove_all($p_project_id)
{
    $c_project_id = db_prepare_int($p_project_id);
    project_ensure_exists($p_project_id);
    $t_project_category_table = config_get('mantis_project_category_table');
    $t_bug_table = config_get('mantis_bug_table');
    $query = "DELETE FROM {$t_project_category_table}\n\t\t\t\t  WHERE project_id='{$c_project_id}'";
    db_query($query);
    $query = "UPDATE {$t_bug_table}\n\t\t\t\t  SET category=''\n\t\t\t\t  WHERE project_id='{$c_project_id}'";
    db_query($query);
    # db_query() errors on failure so:
    return true;
}
开发者ID:centaurustech,项目名称:BenFund,代码行数:13,代码来源:category_api.php

示例9: custom_field_link

function custom_field_link($p_field_id, $p_project_id)
{
    $c_field_id = db_prepare_int($p_field_id);
    $c_project_id = db_prepare_int($p_project_id);
    custom_field_ensure_exists($p_field_id);
    project_ensure_exists($p_project_id);
    if (custom_field_is_linked($p_field_id, $p_project_id)) {
        return false;
    }
    $t_custom_field_project_table = config_get('mantis_custom_field_project_table');
    $query = "INSERT INTO {$t_custom_field_project_table}\r\n\t\t\t\t\t( field_id, project_id )\r\n\t\t\t\t  VALUES\r\n\t\t\t\t\t( '{$c_field_id}', '{$c_project_id}' )";
    db_query($query);
    # db_query() errors on failure so:
    return true;
}
开发者ID:amjadtbssm,项目名称:website,代码行数:15,代码来源:custom_field_api.php

示例10: custom_field_link

/**
 * Add a custom field to a project
 * return true on success, false on failure or if already added
 * @param int $p_field_id custom field id
 * @param int $p_project_id project id
 * @return bool
 * @access public
 */
function custom_field_link($p_field_id, $p_project_id)
{
    $c_field_id = db_prepare_int($p_field_id);
    $c_project_id = db_prepare_int($p_project_id);
    custom_field_ensure_exists($p_field_id);
    project_ensure_exists($p_project_id);
    if (custom_field_is_linked($p_field_id, $p_project_id)) {
        return false;
    }
    $t_custom_field_project_table = db_get_table('custom_field_project');
    $query = "INSERT INTO {$t_custom_field_project_table}\n\t\t\t\t\t( field_id, project_id )\n\t\t\t\t  VALUES\n\t\t\t\t\t( " . db_param() . ', ' . db_param() . ')';
    db_query_bound($query, array($c_field_id, $c_project_id));
    # db_query errors on failure so:
    return true;
}
开发者ID:kaos,项目名称:mantisbt,代码行数:23,代码来源:custom_field_api.php

示例11: category_remove_all

/**
 * Remove all categories associated with a project.
 * This will skip processing of categories that can't be deleted.
 * @param integer $p_project_id      A Project identifier.
 * @param integer $p_new_category_id New category id (to replace existing category).
 * @return boolean
 * @access public
 */
function category_remove_all($p_project_id, $p_new_category_id = 0)
{
    project_ensure_exists($p_project_id);
    if (0 != $p_new_category_id) {
        category_ensure_exists($p_new_category_id);
    }
    # cache category names
    category_get_all_rows($p_project_id);
    # get a list of affected categories
    db_param_push();
    $t_query = 'SELECT id FROM {category} WHERE project_id=' . db_param();
    $t_result = db_query($t_query, array($p_project_id));
    $t_category_ids = array();
    while ($t_row = db_fetch_array($t_result)) {
        # Don't add category to the list if it can't be deleted
        if (!category_can_remove($t_row['id'])) {
            continue;
        }
        $t_category_ids[] = $t_row['id'];
    }
    # Handle projects with no categories
    if (count($t_category_ids) < 1) {
        return true;
    }
    $t_category_ids = join(',', $t_category_ids);
    # update bug history entries
    $t_query = 'SELECT id, category_id FROM {bug} WHERE category_id IN ( ' . $t_category_ids . ' )';
    $t_result = db_query($t_query);
    while ($t_bug_row = db_fetch_array($t_result)) {
        history_log_event_direct($t_bug_row['id'], 'category', category_full_name($t_bug_row['category_id'], false), category_full_name($p_new_category_id, false));
    }
    # update bug data
    db_param_push();
    $t_query = 'UPDATE {bug} SET category_id=' . db_param() . ' WHERE category_id IN ( ' . $t_category_ids . ' )';
    db_query($t_query, array($p_new_category_id));
    # delete categories
    db_param_push();
    $t_query = 'DELETE FROM {category} WHERE project_id=' . db_param();
    db_query($t_query, array($p_project_id));
    return true;
}
开发者ID:spring,项目名称:spring-website,代码行数:49,代码来源:category_api.php

示例12: config_set

/**
 * Sets the value of the given config option to the given value
 *  If the config option does not exist, an ERROR is triggered
 *
 * @param string $p_option config option
 * @param string $p_value config value
 * @param int $p_user user id
 * @param int $p_project project id
 * @param int $p_access access level
 * @return bool
 */
function config_set($p_option, $p_value, $p_user = NO_USER, $p_project = ALL_PROJECTS, $p_access = DEFAULT_ACCESS_LEVEL)
{
    if ($p_access == DEFAULT_ACCESS_LEVEL) {
        $p_access = config_get_global('admin_site_threshold');
    }
    if (is_array($p_value) || is_object($p_value)) {
        $t_type = CONFIG_TYPE_COMPLEX;
        $c_value = serialize($p_value);
    } else {
        if (is_float($p_value)) {
            $t_type = CONFIG_TYPE_FLOAT;
            $c_value = (double) $p_value;
        } else {
            if (is_int($p_value) || is_numeric($p_value)) {
                $t_type = CONFIG_TYPE_INT;
                $c_value = (int) $p_value;
            } else {
                $t_type = CONFIG_TYPE_STRING;
                $c_value = $p_value;
            }
        }
    }
    if (config_can_set_in_database($p_option)) {
        # before we set in the database, ensure that the user and project id exist
        if ($p_project !== ALL_PROJECTS) {
            project_ensure_exists($p_project);
        }
        if ($p_user !== NO_USER) {
            user_ensure_exists($p_user);
        }
        $t_config_table = db_get_table('config');
        $t_query = "SELECT COUNT(*) from {$t_config_table}\n\t\t\t\tWHERE config_id = " . db_param() . " AND\n\t\t\t\t\tproject_id = " . db_param() . " AND\n\t\t\t\t\tuser_id = " . db_param();
        $t_result = db_query_bound($t_query, array($p_option, (int) $p_project, (int) $p_user));
        $t_params = array();
        if (0 < db_result($t_result)) {
            $t_set_query = "UPDATE {$t_config_table}\n\t\t\t\t\tSET value=" . db_param() . ", type=" . db_param() . ", access_reqd=" . db_param() . "\n\t\t\t\t\tWHERE config_id = " . db_param() . " AND\n\t\t\t\t\t\tproject_id = " . db_param() . " AND\n\t\t\t\t\t\tuser_id = " . db_param();
            $t_params = array($c_value, $t_type, (int) $p_access, $p_option, (int) $p_project, (int) $p_user);
        } else {
            $t_set_query = "INSERT INTO {$t_config_table}\n\t\t\t\t\t( value, type, access_reqd, config_id, project_id, user_id )\n\t\t\t\t\tVALUES\n\t\t\t\t\t(" . db_param() . ', ' . db_param() . ', ' . db_param() . ', ' . db_param() . ', ' . db_param() . ',' . db_param() . ' )';
            $t_params = array($c_value, $t_type, (int) $p_access, $p_option, (int) $p_project, (int) $p_user);
        }
        $result = db_query_bound($t_set_query, $t_params);
    }
    config_set_cache($p_option, $c_value, $t_type, $p_user, $p_project, $p_access);
    return true;
}
开发者ID:N0ctrnl,项目名称:mantisbt,代码行数:57,代码来源:config_api.php


注:本文中的project_ensure_exists函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。