Ejemplo n.º 1
0
require_api('html_api.php');
require_api('lang_api.php');
require_api('print_api.php');
require_api('project_api.php');
require_api('user_api.php');
form_security_validate('manage_proj_user_remove');
auth_reauthenticate();
$f_project_id = gpc_get_int('project_id');
$f_user_id = gpc_get_int('user_id', 0);
# We should check both since we are in the project section and an
#  admin might raise the first threshold and not realize they need
#  to raise the second
access_ensure_project_level(config_get('manage_project_threshold'), $f_project_id);
access_ensure_project_level(config_get('project_user_threshold'), $f_project_id);
if (0 == $f_user_id) {
    # Confirm with the user
    helper_ensure_confirmed(lang_get('remove_all_users_sure_msg'), lang_get('remove_all_users_button'));
    project_remove_all_users($f_project_id, access_get_project_level($f_project_id));
} else {
    # Don't allow removal of users from the project who have a higher access level than the current user
    access_ensure_project_level(access_get_project_level($f_project_id, $f_user_id), $f_project_id);
    $t_user = user_get_row($f_user_id);
    # Confirm with the user
    helper_ensure_confirmed(lang_get('remove_user_sure_msg') . '<br/>' . lang_get('username_label') . lang_get('word_separator') . $t_user['username'], lang_get('remove_user_button'));
    project_remove_user($f_project_id, $f_user_id);
}
form_security_purge('manage_proj_user_remove');
$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();
Ejemplo n.º 2
0
function project_delete($p_project_id)
{
    $t_email_notifications = config_get('enable_email_notification');
    # temporarily disable all notifications
    config_set_cache('enable_email_notification', OFF, CONFIG_TYPE_INT);
    $c_project_id = db_prepare_int($p_project_id);
    $t_project_table = db_get_table('project');
    # Delete the bugs
    bug_delete_all($p_project_id);
    # Delete associations with custom field definitions.
    custom_field_unlink_all($p_project_id);
    # Delete the project categories
    category_remove_all($p_project_id);
    # Delete the project versions
    version_remove_all($p_project_id);
    # Delete relations to other projects
    project_hierarchy_remove_all($p_project_id);
    # Delete the project files
    project_delete_all_files($p_project_id);
    # Delete the records assigning users to this project
    project_remove_all_users($p_project_id);
    # Delete all news entries associated with the project being deleted
    news_delete_all($p_project_id);
    # Delete project specific configurations
    config_delete_project($p_project_id);
    # Delete any user prefs that are project specific
    user_pref_delete_project($p_project_id);
    # Delete the project entry
    $query = "DELETE FROM {$t_project_table}\n\t\t\t\t  WHERE id=" . db_param();
    db_query_bound($query, array($c_project_id));
    config_set_cache('enable_email_notification', $t_email_notifications, CONFIG_TYPE_INT);
    project_clear_cache($p_project_id);
    # db_query errors on failure so:
    return true;
}
# See the README and LICENSE files for details
# --------------------------------------------------------
# $Id: manage_proj_user_remove.php,v 1.8 2005/07/19 13:47:44 vboctor Exp $
# --------------------------------------------------------
require_once 'core.php';
$f_project_id = gpc_get_int('project_id');
$f_user_id = gpc_get_int('user_id', 0);
# We should check both since we are in the project section and an
#  admin might raise the first threshold and not realize they need
#  to raise the second
access_ensure_project_level(config_get('manage_project_threshold'), $f_project_id);
access_ensure_project_level(config_get('project_user_threshold'), $f_project_id);
if (0 == $f_user_id) {
    # Confirm with the user
    helper_ensure_confirmed(lang_get('remove_all_users_sure_msg'), lang_get('remove_all_users_button'));
    project_remove_all_users($f_project_id);
} else {
    $t_user = user_get_row($f_user_id);
    # Confirm with the user
    helper_ensure_confirmed(lang_get('remove_user_sure_msg') . '<br/>' . lang_get('username') . ': ' . $t_user['username'], lang_get('remove_user_button'));
    project_remove_user($f_project_id, $f_user_id);
}
$t_redirect_url = 'manage_proj_edit_page.php?project_id=' . $f_project_id;
html_page_top1();
html_meta_redirect($t_redirect_url);
html_page_top2();
?>
<br />
<div align="center">
<?php 
echo lang_get('operation_successful') . '<br />';
Ejemplo n.º 4
0
/**
 * Delete a project
 * @param integer $p_project_id A project identifier.
 * @return void
 */
function project_delete($p_project_id)
{
    event_signal('EVENT_MANAGE_PROJECT_DELETE', array($p_project_id));
    $t_email_notifications = config_get('enable_email_notification');
    # temporarily disable all notifications
    config_set_cache('enable_email_notification', OFF, CONFIG_TYPE_INT);
    # Delete the bugs
    bug_delete_all($p_project_id);
    # Delete associations with custom field definitions.
    custom_field_unlink_all($p_project_id);
    # Delete the project categories
    category_remove_all($p_project_id);
    # Delete the project versions
    version_remove_all($p_project_id);
    # Delete relations to other projects
    project_hierarchy_remove_all($p_project_id);
    # Delete the project files
    project_delete_all_files($p_project_id);
    # Delete the records assigning users to this project
    project_remove_all_users($p_project_id);
    # Delete all news entries associated with the project being deleted
    news_delete_all($p_project_id);
    # Delete project specific configurations
    config_delete_project($p_project_id);
    # Delete any user prefs that are project specific
    user_pref_delete_project($p_project_id);
    # Delete the project entry
    $t_query = 'DELETE FROM {project} WHERE id=' . db_param();
    db_query($t_query, array($p_project_id));
    config_set_cache('enable_email_notification', $t_email_notifications, CONFIG_TYPE_INT);
    project_clear_cache($p_project_id);
}