Example #1
0
/**
 * Delete a version.
 *
 * @param string $p_username  The name of the user trying to delete the version.
 * @param string $p_password  The password of the user.
 * @param integer $p_version_id A version's id
 * @return bool returns true or false depending on the success of the delete action
 */
function mc_project_version_delete($p_username, $p_password, $p_version_id)
{
    $t_user_id = mci_check_login($p_username, $p_password);
    if ($t_user_id === false) {
        return mci_soap_fault_login_failed();
    }
    if (is_blank($p_version_id)) {
        return new soap_fault('Client', '', 'Mandatory field "version_id" was missing');
    }
    if (!version_exists($p_version_id)) {
        return new soap_fault('Client', '', "Version '{$p_version_id}' does not exist.");
    }
    $t_project_id = version_get_field($p_version_id, 'project_id');
    if (!mci_has_readwrite_access($t_user_id, $t_project_id)) {
        return mci_soap_fault_access_denied($t_user_id);
    }
    if (!mci_has_access(config_get('manage_project_threshold'), $t_user_id, $t_project_id)) {
        return mci_soap_fault_access_denied($t_user_id);
    }
    return version_remove($p_version_id);
}
Example #2
0
/** 
 * Delete a version.
 *
 * @param string $p_username  The name of the user trying to delete the version.
 * @param string $p_password  The password of the user.
 * @param integer $p_version_id A version's id
 * @return bool returns true or false depending on the success of the delete action
 */
function mc_project_version_delete($p_username, $p_password, $p_version_id)
{
    $t_user_id = mci_check_login($p_username, $p_password);
    if ($t_user_id === false) {
        return new soap_fault('Client', '', 'Access Denied', 'Username/password combination was incorrect');
    }
    if (!mci_has_administrator_access($t_user_id)) {
        return new soap_fault('Client', '', 'Access Denied', 'User does not have administrator access');
    }
    if (is_blank($p_version_id)) {
        return new soap_fault('Client', '', 'Mandatory field "version_id" was missing');
    }
    if (!version_exists($p_version_id)) {
        return new soap_fault('Client', '', "Version '{$p_version_id}' does not exist.");
    }
    return version_remove($p_version_id);
}
/**
 * Delete a version.
 *
 * @param string  $p_username   The name of the user trying to delete the version.
 * @param string  $p_password   The password of the user.
 * @param integer $p_version_id A version's id.
 * @return boolean returns true or false depending on the success of the delete action
 */
function mc_project_version_delete($p_username, $p_password, $p_version_id)
{
    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 (is_blank($p_version_id)) {
        return SoapObjectsFactory::newSoapFault('Client', 'Mandatory field "version_id" was missing');
    }
    if (!version_exists($p_version_id)) {
        return SoapObjectsFactory::newSoapFault('Client', 'Version \'' . $p_version_id . '\' does not exist.');
    }
    $t_project_id = version_get_field($p_version_id, 'project_id');
    $g_project_override = $t_project_id;
    if (!mci_has_readwrite_access($t_user_id, $t_project_id)) {
        return mci_soap_fault_access_denied($t_user_id);
    }
    if (!mci_has_access(config_get('manage_project_threshold'), $t_user_id, $t_project_id)) {
        return mci_soap_fault_access_denied($t_user_id);
    }
    return version_remove($p_version_id);
}
# 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>

<?php 
html_page_bottom1(__FILE__);
<?php

require_once SPECMANAGEMENT_CORE_URI . 'specmanagement_database_api.php';
auth_reauthenticate();
$specmanagement_database_api = new specmanagement_database_api();
$version_id = gpc_get_int('version_id');
$version = version_get($version_id);
access_ensure_project_level(config_get('manage_project_threshold'), $version->project_id);
helper_ensure_confirmed(lang_get('version_delete_sure') . '<br/>' . lang_get('word_separator') . string_display_line($version->version), lang_get('delete_version_button'));
$plugin_version_row = $specmanagement_database_api->get_plugin_version_row_by_version_id($version_id);
$p_version_id = $plugin_version_row[0];
$specmanagement_database_api->update_source_version_set_null($p_version_id);
$specmanagement_database_api->delete_version_row($version_id);
version_remove($version_id);
print_successful_redirect(plugin_page('manage_versions', true));