本文整理汇总了PHP中project_exists函数的典型用法代码示例。如果您正苦于以下问题:PHP project_exists函数的具体用法?PHP project_exists怎么用?PHP project_exists使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了project_exists函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: project_ensure_exists
function project_ensure_exists($p_project_id)
{
if (!project_exists($p_project_id)) {
error_parameters($p_project_id);
trigger_error(ERROR_PROJECT_NOT_FOUND, ERROR);
}
}
示例2: config_get
}
# Manage filter's persistency through cookie
$t_cookie_name = config_get('manage_config_cookie');
if ($t_filter_save) {
# Save user's filter to the cookie
$t_cookie_string = implode(':', array($t_filter_user_value, $t_filter_project_value, $t_filter_config_value));
gpc_set_cookie($t_cookie_name, $t_cookie_string, true);
} else {
# Retrieve the filter from the cookie if it exists
$t_cookie_string = gpc_get_cookie($t_cookie_name, null);
if (null !== $t_cookie_string) {
$t_cookie_contents = explode(':', $t_cookie_string);
$t_filter_user_value = $t_cookie_contents[0];
$t_filter_project_value = $t_cookie_contents[1];
$t_filter_config_value = check_config_value($t_cookie_contents[2]);
if ($t_filter_project_value != META_FILTER_NONE && !project_exists($t_filter_project_value)) {
$t_filter_project_value = ALL_PROJECTS;
}
}
}
# Get config edit values
$t_edit_user_id = gpc_get_int('user_id', $t_filter_user_value == META_FILTER_NONE ? ALL_USERS : $t_filter_user_value);
$t_edit_project_id = gpc_get_int('project_id', $t_filter_project_value == META_FILTER_NONE ? ALL_PROJECTS : $t_filter_project_value);
$t_edit_option = gpc_get_string('config_option', $t_filter_config_value == META_FILTER_NONE ? '' : $t_filter_config_value);
$t_edit_type = gpc_get_string('type', CONFIG_TYPE_DEFAULT);
$t_edit_value = gpc_get_string('value', '');
# Apply filters
# Get users in db having specific configs
$t_query = 'SELECT DISTINCT user_id FROM {config} WHERE user_id <> ' . db_param();
$t_result = db_query($t_query, array(ALL_USERS));
if ($t_filter_user_value != META_FILTER_NONE && $t_filter_user_value != ALL_USERS) {
示例3: helper_get_current_project_trace
/**
* Return the current project id as stored in a cookie, in an Array
* If no cookie exists, the user's default project is returned
* If the current project is a subproject, the return value will include
* any parent projects
* @return array
*/
function helper_get_current_project_trace()
{
$t_cookie_name = config_get('project_cookie');
$t_project_id = gpc_get_cookie($t_cookie_name, null);
if (null === $t_project_id) {
$t_bottom = current_user_get_pref('default_project');
$t_parent = $t_bottom;
$t_project_id = array($t_bottom);
while (true) {
$t_parent = project_hierarchy_get_parent($t_parent);
if (0 == $t_parent) {
break;
}
array_unshift($t_project_id, $t_parent);
}
} else {
$t_project_id = explode(';', $t_project_id);
$t_bottom = $t_project_id[count($t_project_id) - 1];
}
if (!project_exists($t_bottom) || 0 == project_get_field($t_bottom, 'enabled') || !access_has_project_level(VIEWER, $t_bottom)) {
$t_project_id = array(ALL_PROJECTS);
}
return $t_project_id;
}
示例4: history_localize_item
/**
* Localizes one raw history item specified by set the next parameters: $p_field_name, $p_type, $p_old_value, $p_new_value
* Returns array with two elements indexed as 'note' and 'change'
* @param string $p_field_name The field name of the field being localized.
* @param integer $p_type The type of the history entry.
* @param string $p_old_value The old value of the field.
* @param string $p_new_value The new value of the field.
* @param boolean $p_linkify Whether to return a string containing hyperlinks.
* @return array
*/
function history_localize_item($p_field_name, $p_type, $p_old_value, $p_new_value, $p_linkify = true)
{
$t_note = '';
$t_change = '';
$t_field_localized = $p_field_name;
$t_raw = true;
if (PLUGIN_HISTORY == $p_type) {
$t_note = lang_get_defaulted('plugin_' . $p_field_name, $p_field_name);
$t_change = isset($p_new_value) ? $p_old_value . ' => ' . $p_new_value : $p_old_value;
return array('note' => $t_note, 'change' => $t_change, 'raw' => true);
}
switch ($p_field_name) {
case 'category':
$t_field_localized = lang_get('category');
break;
case 'status':
$p_old_value = get_enum_element('status', $p_old_value);
$p_new_value = get_enum_element('status', $p_new_value);
$t_field_localized = lang_get('status');
break;
case 'severity':
$p_old_value = get_enum_element('severity', $p_old_value);
$p_new_value = get_enum_element('severity', $p_new_value);
$t_field_localized = lang_get('severity');
break;
case 'reproducibility':
$p_old_value = get_enum_element('reproducibility', $p_old_value);
$p_new_value = get_enum_element('reproducibility', $p_new_value);
$t_field_localized = lang_get('reproducibility');
break;
case 'resolution':
$p_old_value = get_enum_element('resolution', $p_old_value);
$p_new_value = get_enum_element('resolution', $p_new_value);
$t_field_localized = lang_get('resolution');
break;
case 'priority':
$p_old_value = get_enum_element('priority', $p_old_value);
$p_new_value = get_enum_element('priority', $p_new_value);
$t_field_localized = lang_get('priority');
break;
case 'eta':
$p_old_value = get_enum_element('eta', $p_old_value);
$p_new_value = get_enum_element('eta', $p_new_value);
$t_field_localized = lang_get('eta');
break;
case 'view_state':
$p_old_value = get_enum_element('view_state', $p_old_value);
$p_new_value = get_enum_element('view_state', $p_new_value);
$t_field_localized = lang_get('view_status');
break;
case 'projection':
$p_old_value = get_enum_element('projection', $p_old_value);
$p_new_value = get_enum_element('projection', $p_new_value);
$t_field_localized = lang_get('projection');
break;
case 'sticky':
$p_old_value = gpc_string_to_bool($p_old_value) ? lang_get('yes') : lang_get('no');
$p_new_value = gpc_string_to_bool($p_new_value) ? lang_get('yes') : lang_get('no');
$t_field_localized = lang_get('sticky_issue');
break;
case 'project_id':
if (project_exists($p_old_value)) {
$p_old_value = project_get_field($p_old_value, 'name');
} else {
$p_old_value = '@' . $p_old_value . '@';
}
# Note that the new value maybe an intermediately project and not the
# current one.
if (project_exists($p_new_value)) {
$p_new_value = project_get_field($p_new_value, 'name');
} else {
$p_new_value = '@' . $p_new_value . '@';
}
$t_field_localized = lang_get('email_project');
break;
case 'handler_id':
$t_field_localized = lang_get('assigned_to');
case 'reporter_id':
if ('reporter_id' == $p_field_name) {
$t_field_localized = lang_get('reporter');
}
if (0 == $p_old_value) {
$p_old_value = '';
} else {
$p_old_value = user_get_name($p_old_value);
}
if (0 == $p_new_value) {
$p_new_value = '';
} else {
$p_new_value = user_get_name($p_new_value);
//.........这里部分代码省略.........
示例5: news_ensure_enabled
*/
/**
* MantisBT Core API's
*/
require_once 'core.php';
require_once 'news_api.php';
require_once 'string_api.php';
news_ensure_enabled();
$f_news_id = gpc_get_int('news_id');
$f_action = gpc_get_string('action', '');
# If deleting item redirect to delete script
if ('delete' == $f_action) {
form_security_validate('news_delete');
$row = news_get_row($f_news_id);
# This check is to allow deleting of news items that were left orphan due to bug #3723
if (project_exists($row['project_id'])) {
access_ensure_project_level(config_get('manage_news_threshold'), $row['project_id']);
}
helper_ensure_confirmed(lang_get('delete_news_sure_msg'), lang_get('delete_news_item_button'));
news_delete($f_news_id);
form_security_purge('news_delete');
print_header_redirect('news_menu_page.php', true);
}
# Retrieve news item data and prefix with v_
$row = news_get_row($f_news_id);
if ($row) {
extract($row, EXTR_PREFIX_ALL, 'v');
}
access_ensure_project_level(config_get('manage_news_threshold'), $v_project_id);
$v_headline = string_attribute($v_headline);
$v_body = string_textarea($v_body);
示例6:
}
if (isset($_GET['cat'])) {
echo '&cat=' . $_GET['cat'];
}
if (isset($_GET['pio'])) {
echo '&pio=' . $_GET['pio'];
}
echo '\';">x</div>';
if (isset($_POST['submit'])) {
if ($_POST['select'] == "uplpro" && $_POST['proname'] == "") {
$error[] = 'Du hast keinen Projektnamen eingegeben!';
}
if ($_POST['select'] == "uplpro" && $_POST['procat'] == "") {
$error[] = 'Du hast keine Projektkategorie ausgewählt!';
}
if ($_POST['select'] == "uplpro" && !project_exists($_POST['proname'])) {
$error[] = 'Der Projektname ist bereits vorhanden!';
}
if ($_POST['select'] != "uplpro" && $_POST['title'] == "") {
$error[] = 'Du hast keinen Titel eingetragen!';
}
if ($_POST['select'] == "uplsin" && $_POST['descr'] == "") {
$error[] = 'Du hast keine Beschreibung eingegeben!';
}
if ($_POST['select'] == "uplsin" && $_POST['type'] == "") {
$error[] = 'Du hast keinen Typ angegeben!';
}
if ($_POST['select'] == "uplscr" && $_POST['script'] == "") {
$error[] = 'Du hast keinen Text eingegeben!';
}
if ($_POST['select'] == "uplav" && $_POST['mtype'] == "") {
示例7: process_mailbox
public function process_mailbox($p_mailbox)
{
$this->_mailbox = $p_mailbox + ERP_get_default_mailbox();
if ($this->_functionality_enabled) {
if ($this->_mailbox['enabled']) {
// Check whether EmailReporting supports the mailbox type. The check is based on available default ports
if (isset($this->_default_ports[$this->_mailbox['mailbox_type']])) {
if (project_exists($this->_mailbox['project_id'])) {
if (category_exists($this->_mailbox['global_category_id'])) {
$t_upload_folder_passed = TRUE;
if ($this->_allow_file_upload && $this->_file_upload_method == DISK) {
$t_upload_folder_passed = FALSE;
$t_file_path = project_get_field($this->_mailbox['project_id'], 'file_path');
if ($t_file_path == '') {
$t_file_path = config_get('absolute_path_default_upload_folder');
}
$t_file_path = ERP_prepare_directory_string($t_file_path, TRUE);
$t_real_file_path = ERP_prepare_directory_string($t_file_path);
if (!file_exists($t_file_path) || !is_dir($t_file_path) || !is_writable($t_file_path) || !is_readable($t_file_path)) {
$this->custom_error('Upload folder is not writable: ' . $t_file_path . "\n");
} elseif (strcasecmp($t_real_file_path, $t_file_path) !== 0) {
$this->custom_error('Upload folder is not an absolute path' . "\n" . 'Upload folder: ' . $t_file_path . "\n" . 'Absolute path: ' . $t_real_file_path . "\n");
} else {
$t_upload_folder_passed = TRUE;
}
}
if ($t_upload_folder_passed) {
$this->prepare_mailbox_hostname();
if (!$this->_test_only && $this->_mail_debug) {
var_dump($this->_mailbox);
}
$this->show_memory_usage('Start process mailbox');
$t_process_mailbox_function = 'process_' . strtolower($this->_mailbox['mailbox_type']) . '_mailbox';
$this->{$t_process_mailbox_function}();
$this->show_memory_usage('Finished process mailbox');
}
} else {
$this->custom_error('Category does not exist');
}
} else {
$this->custom_error('Project does not exist');
}
} else {
$this->custom_error('Unknown mailbox type');
}
} else {
$this->custom_error('Mailbox disabled');
}
}
return $this->_result;
}
示例8: helper_get_current_project_trace
function helper_get_current_project_trace()
{
$t_cookie_name = config_get('project_cookie');
$t_project_id = gpc_get_cookie($t_cookie_name, null);
if (null === $t_project_id) {
$t_bottom = current_user_get_pref('default_project');
$t_project_id = array($t_bottom);
} else {
$t_project_id = split(';', $t_project_id);
$t_bottom = $t_project_id[count($t_project_id) - 1];
}
if (!project_exists($t_bottom) || 0 == project_get_field($t_bottom, 'enabled') || !access_has_project_level(VIEWER, $t_bottom)) {
$t_project_id = array(ALL_PROJECTS);
}
return $t_project_id;
}
示例9: mc_issue_update
/**
* Update Issue in database
*
* Created By KGB
* @param string $p_username The name of the user trying to add the issue.
* @param string $p_password The password of the user.
* @param Array $p_issue A IssueData structure containing information about the new issue.
* @return integer The id of the created issue.
*/
function mc_issue_update($p_username, $p_password, $p_issue_id, $p_issue)
{
$t_user_id = mci_check_login($p_username, $p_password);
if ($t_user_id === false) {
return new soap_fault('Client', '', 'Access Denied');
}
if (!bug_exists($p_issue_id)) {
return new soap_fault('Server', '', "Issue '{$p_issue_id}' does not exist.");
}
$t_project_id = bug_get_field($p_issue_id, 'project_id');
if (!mci_has_readwrite_access($t_user_id, $t_project_id)) {
return new soap_fault('Client', '', 'Access Denied');
}
extract($p_issue, EXTR_PREFIX_ALL, 'v');
$t_project_id = mci_get_project_id($v_project);
$t_handler_id = mci_get_user_id($v_handler);
$t_priority_id = mci_get_priority_id($v_priority);
$t_severity_id = mci_get_severity_id($v_severity);
$t_status_id = mci_get_status_id($v_status);
$t_reproducibility_id = mci_get_reproducibility_id($v_reproducibility);
$t_resolution_id = mci_get_resolution_id($v_resolution);
$t_projection_id = mci_get_projection_id($v_projection);
$t_eta_id = mci_get_eta_id($v_eta);
$t_view_state_id = mci_get_view_state_id($v_view_state);
$t_reporter_id = mci_get_user_id($v_reporter);
if ($t_reporter_id == 0) {
$t_reporter_id = $t_user_id;
}
if ($t_project_id == 0 || !project_exists($t_project_id)) {
if ($t_project_id == 0) {
return new soap_fault('Client', '', "Project '" . $v_project['name'] . "' does not exist.");
} else {
return new soap_fault('Client', '', "Project '{$t_project_id}' does not exist.");
}
}
if (!access_has_bug_level(config_get('update_bug_threshold'), $p_issue_id, $t_user_id)) {
return new soap_fault('Client', '', "User '{$t_user_id}' does not have access right to report issues.");
}
if ($t_handler_id != 0 && !user_exists($t_handler_id)) {
return new soap_fault('Client', '', "User '{$t_handler_id}' does not exist.");
}
if (!in_array($v_category, mci_category_get_all_rows($t_project_id, $t_user_id))) {
$t_error_when_category_not_found = config_get('mc_error_when_category_not_found');
if ($t_error_when_category_not_found == ON) {
if (is_blank($v_category) && count(category_get_all_rows($t_project_id)) == 0) {
$v_category = '';
// it is ok to have category as empty if project has no categories
} else {
return new soap_fault('Client', '', "Category '{$v_category}' does not exist in project '{$t_project_id}'.");
}
} else {
$t_category_when_not_found = config_get('mc_category_when_not_found');
$v_category = $t_category_when_not_found;
}
}
if (isset($v_version) && !is_blank($v_version) && !version_get_id($v_version, $t_project_id)) {
$t_error_when_version_not_found = config_get('mc_error_when_version_not_found');
if ($t_error_when_version_not_found == ON) {
$t_project_name = project_get_name($t_project_id);
return new soap_fault('Client', '', "Version '{$v_version}' does not exist in project '{$t_project_name}'.");
} else {
$t_version_when_not_found = config_get('mc_version_when_not_found');
$v_version = $t_version_when_not_found;
}
}
if (is_blank($v_summary)) {
return new soap_fault('Client', '', "Mandatory field 'summary' is missing.");
}
if (is_blank($v_description)) {
return new soap_fault('Client', '', "Mandatory field 'description' is missing.");
}
if ($v_priority == 0) {
$v_priority = config_get('default_bug_priority');
}
if ($v_severity == 0) {
$v_severity = config_get('default_bug_severity');
}
if ($v_view_state == 0) {
$v_view_state = config_get('default_bug_view_status');
}
if ($v_reproducibility == 0) {
$v_reproducibility = 10;
}
$t_bug_data = new BugData();
$t_bug_data->project_id = $t_project_id;
$t_bug_data->reporter_id = $t_reporter_id;
$t_bug_data->handler_id = $t_handler_id;
$t_bug_data->priority = $t_priority_id;
$t_bug_data->severity = $t_severity_id;
$t_bug_data->reproducibility = $t_reproducibility_id;
$t_bug_data->status = $t_status_id;
//.........这里部分代码省略.........
示例10: history_localize_item
function history_localize_item($p_field_name, $p_type, $p_old_value, $p_new_value)
{
$t_note = '';
$t_change = '';
$t_field_localized = $p_field_name;
switch ($p_field_name) {
case 'category':
$t_field_localized = lang_get('category');
break;
case 'status':
$p_old_value = get_enum_element('status', $p_old_value);
$p_new_value = get_enum_element('status', $p_new_value);
$t_field_localized = lang_get('status');
break;
case 'severity':
$p_old_value = get_enum_element('severity', $p_old_value);
$p_new_value = get_enum_element('severity', $p_new_value);
$t_field_localized = lang_get('severity');
break;
case 'reproducibility':
$p_old_value = get_enum_element('reproducibility', $p_old_value);
$p_new_value = get_enum_element('reproducibility', $p_new_value);
$t_field_localized = lang_get('reproducibility');
break;
case 'resolution':
$p_old_value = get_enum_element('resolution', $p_old_value);
$p_new_value = get_enum_element('resolution', $p_new_value);
$t_field_localized = lang_get('resolution');
break;
case 'priority':
$p_old_value = get_enum_element('priority', $p_old_value);
$p_new_value = get_enum_element('priority', $p_new_value);
$t_field_localized = lang_get('priority');
break;
case 'eta':
$p_old_value = get_enum_element('eta', $p_old_value);
$p_new_value = get_enum_element('eta', $p_new_value);
$t_field_localized = lang_get('eta');
break;
case 'view_state':
$p_old_value = get_enum_element('view_state', $p_old_value);
$p_new_value = get_enum_element('view_state', $p_new_value);
$t_field_localized = lang_get('view_status');
break;
case 'projection':
$p_old_value = get_enum_element('projection', $p_old_value);
$p_new_value = get_enum_element('projection', $p_new_value);
$t_field_localized = lang_get('projection');
break;
case 'sticky':
$p_old_value = gpc_string_to_bool($p_old_value) ? lang_get('yes') : lang_get('no');
$p_new_value = gpc_string_to_bool($p_new_value) ? lang_get('yes') : lang_get('no');
$t_field_localized = lang_get('sticky_issue');
break;
case 'project_id':
if (project_exists($p_old_value)) {
$p_old_value = project_get_field($p_old_value, 'name');
} else {
$p_old_value = '@' . $p_old_value . '@';
}
# Note that the new value maybe an intermediately project and not the
# current one.
if (project_exists($p_new_value)) {
$p_new_value = project_get_field($p_new_value, 'name');
} else {
$p_new_value = '@' . $p_new_value . '@';
}
$t_field_localized = lang_get('email_project');
break;
case 'handler_id':
$t_field_localized = lang_get('assigned_to');
case 'reporter_id':
if ('reporter_id' == $p_field_name) {
$t_field_localized = lang_get('reporter');
}
if (0 == $p_old_value) {
$p_old_value = '';
} else {
$p_old_value = user_get_name($p_old_value);
}
if (0 == $p_new_value) {
$p_new_value = '';
} else {
$p_new_value = user_get_name($p_new_value);
}
break;
case 'fixed_in_version':
$t_field_localized = lang_get('fixed_in_version');
break;
case 'date_submitted':
$t_field_localized = lang_get('date_submitted');
break;
case 'last_updated':
$t_field_localized = lang_get('last_update');
break;
case 'summary':
$t_field_localized = lang_get('summary');
break;
case 'duplicate_id':
$t_field_localized = lang_get('duplicate_id');
//.........这里部分代码省略.........
示例11: helper_get_current_project
$f_description = $t_bug->description;
$f_steps_to_reproduce = $t_bug->steps_to_reproduce;
$f_additional_info = $t_bug->additional_information;
$f_view_state = (int) $t_bug->view_state;
$f_due_date = $t_bug->due_date;
$t_project_id = $t_bug->project_id;
} else {
# Get Project Id and set it as current
$t_current_project = helper_get_current_project();
$t_project_id = gpc_get_int('project_id', $t_current_project);
# If all projects, use default project if set
$t_default_project = user_pref_get_pref(auth_get_current_user_id(), 'default_project');
if (ALL_PROJECTS == $t_project_id && ALL_PROJECTS != $t_default_project) {
$t_project_id = $t_default_project;
}
if ((ALL_PROJECTS == $t_project_id || project_exists($t_project_id)) && $t_project_id != $t_current_project && project_enabled($t_project_id)) {
helper_set_current_project($t_project_id);
# Reloading the page is required so that the project browser
# reflects the new current project
print_header_redirect($_SERVER['REQUEST_URI'], true, false, true);
}
# New issues cannot be reported for the 'All Project' selection
if (ALL_PROJECTS == $t_current_project) {
print_header_redirect('login_select_proj_page.php?ref=bug_report_page.php');
}
access_ensure_project_level(config_get('report_bug_threshold'));
$f_build = gpc_get_string('build', '');
$f_platform = gpc_get_string('platform', '');
$f_os = gpc_get_string('os', '');
$f_os_build = gpc_get_string('os_build', '');
$f_product_version = gpc_get_string('product_version', '');
示例12: helper_get_current_project
$f_view_state = (int)$t_bug->view_state;
$f_due_date = $t_bug->due_date;
$t_project_id = $t_bug->project_id;
} else {
# Get Project Id and set it as current
$t_current_project = helper_get_current_project();
$t_project_id = gpc_get_int( 'project_id', $t_current_project );
# If all projects, use default project if set
$t_default_project = user_pref_get_pref( auth_get_current_user_id(), 'default_project' );
if( ALL_PROJECTS == $t_project_id && ALL_PROJECTS != $t_default_project ) {
$t_project_id = $t_default_project;
}
if( ( ALL_PROJECTS == $t_project_id || project_exists( $t_project_id ) )
&& $t_project_id != $t_current_project
) {
helper_set_current_project( $t_project_id );
# Reloading the page is required so that the project browser
# reflects the new current project
print_header_redirect( $_SERVER['REQUEST_URI'], true, false, true );
}
# New issues cannot be reported for the 'All Project' selection
if( ALL_PROJECTS == $t_current_project ) {
print_header_redirect( 'login_select_proj_page.php?ref=bug_report_page.php' );
}
access_ensure_project_level( config_get( 'report_bug_threshold' ) );
示例13: display_document_header
display_document_header();
display_menu();
display_no_auth();
display_document_footer();
exit;
}
if (!isset($_POST['project_name']) || !isset($_POST['ocp_id'])) {
header('location: create_project_form.php');
exit;
}
$_POST['project_name'] = trim($_POST['project_name']);
if (empty($_POST['project_name']) || empty($_POST['ocp_id'])) {
display_warning('Wype³nij poprawnie formularz!');
exit;
} else {
if (project_exists($_POST['project_name'])) {
display_warning('Projekt o nazwie ' . htmlspecialchars(stripslashes($_POST['project_name'])) . ' ju¿ istnieje!');
exit;
}
}
if (isset($_POST['confirmed'])) {
if (!insert_project($_POST['project_name'], $_POST['ocp_id'])) {
display_warning('Utworzenie projektu zakoñczone niepowodzeniem!');
exit;
}
$orgs = str_replace("\r", '', $_POST['orgs']);
$orgs = explode("\n", $orgs);
$new_orgs = get_new_orgs($orgs);
if (!insert_new_orgs($new_orgs)) {
display_warning('Dodanie nowych organizacji zakoñczone niepowodzeniem!');
exit;
示例14: mc_project_get_issue_headers
function mc_project_get_issue_headers($p_username, $p_password, $p_project_id, $p_page_number, $p_per_page)
{
$t_user_id = mci_check_login($p_username, $p_password);
if ($t_user_id === false) {
return mci_soap_fault_login_failed();
}
if (!project_exists($p_project_id)) {
return new soap_fault('Client', '', "Project '{$p_project_id}' does not exist.");
}
if (!mci_has_readonly_access($t_user_id, $p_project_id)) {
return mci_soap_fault_access_denied($t_user_id);
}
$t_page_count = 0;
$t_bug_count = 0;
$t_rows = filter_get_bug_rows($p_page_number, $p_per_page, $t_page_count, $t_bug_count, null, $p_project_id);
$t_result = array();
foreach ($t_rows as $t_issue_data) {
$t_id = $t_issue_data->id;
$t_issue = array();
$t_issue['id'] = $t_id;
$t_issue['view_state'] = $t_issue_data->view_state;
$t_issue['last_updated'] = timestamp_to_iso8601($t_issue_data->last_updated);
$t_issue['project'] = $t_issue_data->project_id;
$t_issue['category'] = mci_get_category($t_issue_data->category_id);
$t_issue['priority'] = $t_issue_data->priority;
$t_issue['severity'] = $t_issue_data->severity;
$t_issue['status'] = $t_issue_data->status;
$t_issue['reporter'] = $t_issue_data->reporter_id;
$t_issue['summary'] = $t_issue_data->summary;
if (!empty($t_issue_data->handler_id)) {
$t_issue['handler'] = $t_issue_data->handler_id;
}
$t_issue['resolution'] = $t_issue_data->resolution;
$t_issue['attachments_count'] = count(mci_issue_get_attachments($t_issue_data->id));
$t_issue['notes_count'] = count(mci_issue_get_notes($t_issue_data->id));
$t_result[] = $t_issue;
}
return $t_result;
}
示例15: mc_issue_update
/**
* Update Issue in database
*
* Created By KGB
* @param string $p_username The name of the user trying to add the issue.
* @param string $p_password The password of the user.
* @param Array $p_issue A IssueData structure containing information about the new issue.
* @return integer The id of the created issue.
*/
function mc_issue_update( $p_username, $p_password, $p_issue_id, $p_issue ) {
global $g_project_override;
$t_user_id = mci_check_login( $p_username, $p_password );
if( $t_user_id === false ) {
return mci_soap_fault_login_failed();
}
if( !bug_exists( $p_issue_id ) ) {
return new soap_fault( 'Client', '', "Issue '$p_issue_id' does not exist." );
}
$t_project_id = bug_get_field( $p_issue_id, 'project_id' );
if( !mci_has_readwrite_access( $t_user_id, $t_project_id ) ) {
return mci_soap_fault_access_denied( $t_user_id );
}
$g_project_override = $t_project_id; // ensure that helper_get_current_project() calls resolve to this project id
$t_project_id = mci_get_project_id( $p_issue['project'] );
$t_reporter_id = isset( $p_issue['reporter'] ) ? mci_get_user_id( $p_issue['reporter'] ) : $t_user_id ;
$t_handler_id = isset( $p_issue['handler'] ) ? mci_get_user_id( $p_issue['handler'] ) : 0;
$t_project = $p_issue['project'];
$t_summary = isset( $p_issue['summary'] ) ? $p_issue['summary'] : '';
$t_description = isset( $p_issue['description'] ) ? $p_issue['description'] : '';
if(( $t_project_id == 0 ) || !project_exists( $t_project_id ) ) {
if( $t_project_id == 0 ) {
return new soap_fault( 'Client', '', "Project '" . $t_project['name'] . "' does not exist." );
}
return new soap_fault( 'Client', '', "Project '$t_project_id' does not exist." );
}
if( !access_has_bug_level( config_get( 'update_bug_threshold' ), $p_issue_id, $t_user_id ) ) {
return mci_soap_fault_access_denied( $t_user_id, "Not enough rights to update issues" );
}
if(( $t_handler_id != 0 ) && !user_exists( $t_handler_id ) ) {
return new soap_fault( 'Client', '', "User '$t_handler_id' does not exist." );
}
$t_category = isset ( $p_issue['category'] ) ? $p_issue['category'] : null;
$t_category_id = translate_category_name_to_id( $t_category, $t_project_id );
if ( $t_category_id == 0 && !config_get( 'allow_no_category' ) ) {
if ( isset( $p_issue['category'] ) && !is_blank( $p_issue['category'] ) ) {
return new soap_fault( 'Client', '', "Category field must be supplied." );
} else {
return new soap_fault( 'Client', '', "Category '" . $p_issue['category'] . "' not found for project '$t_project_name'." );
}
}
if ( isset( $p_issue['version'] ) && !is_blank( $p_issue['version'] ) && !version_get_id( $p_issue['version'], $t_project_id ) ) {
$t_error_when_version_not_found = config_get( 'mc_error_when_version_not_found' );
if( $t_error_when_version_not_found == ON ) {
$t_project_name = project_get_name( $t_project_id );
return new soap_fault( 'Client', '', "Version '" . $p_issue['version'] . "' does not exist in project '$t_project_name'." );
} else {
$t_version_when_not_found = config_get( 'mc_version_when_not_found' );
$p_issue['version'] = $t_version_when_not_found;
}
}
if ( is_blank( $t_summary ) ) {
return new soap_fault( 'Client', '', "Mandatory field 'summary' is missing." );
}
if ( is_blank( $t_description ) ) {
return new soap_fault( 'Client', '', "Mandatory field 'description' is missing." );
}
// fields which we expect to always be set
$t_bug_data = bug_get( $p_issue_id, true );
$t_bug_data->project_id = $t_project_id;
$t_bug_data->reporter_id = $t_reporter_id;
$t_bug_data->handler_id = $t_handler_id;
$t_bug_data->category_id = $t_category_id;
$t_bug_data->summary = $t_summary;
$t_bug_data->description = $t_description;
// fields which might not be set
if ( isset ( $p_issue['steps_to_reproduce'] ) )
$t_bug_data->steps_to_reproduce = $p_issue['steps_to_reproduce'];
if ( isset ( $p_issue['additional_information'] ) )
$t_bug_data->additional_information = $p_issue['additional_information'];
if ( isset( $p_issue['priority'] ) )
$t_bug_data->priority = mci_get_priority_id( $p_issue['priority'] );
if ( isset( $p_issue['severity'] ) )
$t_bug_data->severity = mci_get_severity_id( $p_issue['severity'] );
//.........这里部分代码省略.........