function xmlhttprequest_issue_reporter_combobox()
{
    $f_bug_id = gpc_get_int('issue_id');
    access_ensure_bug_level(config_get('update_bug_threshold'), $f_bug_id);
    $t_reporter_id = bug_get_field($f_bug_id, 'reporter_id');
    $t_project_id = bug_get_field($f_bug_id, 'project_id');
    echo '<select name="reporter_id">';
    print_reporter_option_list($t_reporter_id, $t_project_id);
    echo '</select>';
}
Example #2
0
 function display_commit_message($event, $bugid)
 {
     if (!$bugid) {
         return;
     }
     $t_fields = config_get('bug_view_page_fields');
     $t_fields = columns_filter_disabled($t_fields);
     $tpl_show_id = in_array('id', $t_fields);
     $tpl_show_description = in_array('description', $t_fields);
     $tpl_show_status = in_array('status', $t_fields);
     if ($tpl_show_id && $tpl_show_description && $tpl_show_status) {
         bug_ensure_exists($bugid);
         $bug = bug_get($bugid, true);
         access_ensure_bug_level(VIEWER, $bugid);
         $tpl_description = string_display_links($bug->summary);
         $tpl_status = get_enum_element('status', $bug->status);
         $tpl_link = config_get('path') . string_get_bug_view_url($bugid, null);
         $message = sprintf('%s - #JJ%d: %s<br/>%s', strtoupper($tpl_status), $bugid, $tpl_description, $tpl_link);
         echo '<tr ', helper_alternate_class(), '>';
         echo '<td class="category">', plugin_lang_get('commit_message'), '</td>';
         echo '<td colspan="5">' . $message . '</td>';
         echo '</tr>';
     }
 }
Example #3
0
/**
 * Detach a tag from a bug.
 * @param integer Tag ID
 * @param integer Bug ID
 * @param boolean Add history entries to bug
 * @param integer User Id (or null for current logged in user)
 */
function tag_bug_detach($p_tag_id, $p_bug_id, $p_add_history = true, $p_user_id = null)
{
    if ($p_user_id === null) {
        $t_user_id = auth_get_current_user_id();
    } else {
        $t_user_id = $p_user_id;
    }
    if (!tag_bug_is_attached($p_tag_id, $p_bug_id)) {
        trigger_error(TAG_NOT_ATTACHED, ERROR);
    }
    $t_tag_row = tag_bug_get_row($p_tag_id, $p_bug_id);
    if ($t_user_id == tag_get_field($p_tag_id, 'user_id') || $t_user_id == $t_tag_row['user_id']) {
        $t_detach_level = config_get('tag_detach_own_threshold');
    } else {
        $t_detach_level = config_get('tag_detach_threshold');
    }
    access_ensure_bug_level($t_detach_level, $p_bug_id, $t_user_id);
    $c_tag_id = db_prepare_int($p_tag_id);
    $c_bug_id = db_prepare_int($p_bug_id);
    $t_bug_tag_table = db_get_table('bug_tag');
    $query = "DELETE FROM {$t_bug_tag_table}\n\t\t\t\t\tWHERE tag_id=" . db_param() . ' AND bug_id=' . db_param();
    db_query_bound($query, array($c_tag_id, $c_bug_id));
    if ($p_add_history) {
        $t_tag_name = tag_get_field($p_tag_id, 'name');
        history_log_event_special($p_bug_id, TAG_DETACHED, $t_tag_name);
    }
    # updated the last_updated date
    bug_update_date($p_bug_id);
    return true;
}
$f_files = gpc_get_fileCustom('ufile', -1);
if ($f_bug_id == -1 && $f_files == -1) {
    # _POST/_FILES does not seem to get populated if you exceed size limit so check if bug_id is -1
    trigger_error(ERROR_FILE_TOO_BIG, ERROR);
}
form_security_validate('bug_file_add');
$t_bug = bug_get($f_bug_id, true);
if ($t_bug->project_id != helper_get_current_project()) {
    # in case the current project is not the same project of the bug we are viewing...
    # ... override the current project. This to avoid problems with categories and handlers lists etc.
    $g_project_override = $t_bug->project_id;
}
if (!file_allow_bug_upload($f_bug_id)) {
    access_denied();
}
access_ensure_bug_level(config_get('upload_bug_file_threshold'), $f_bug_id);
// Process array of files to upload
for ($i = 0; $i < count($f_files); $i++) {
    if (!empty($f_files[$i]['name'])) {
        $t_file['name'] = $f_files[$i]['name'];
        $t_file['tmp_name'] = $f_files[$i]['tmp_name'];
        $t_file['type'] = $f_files[$i]['type'];
        $t_file['error'] = $f_files[$i]['error'];
        $t_file['size'] = $f_files[$i]['size'];
        file_add($f_bug_id, $t_file, 'bug');
    }
}
form_security_purge('bug_file_add');
# Determine which view page to redirect back to.
$t_redirect_url = string_get_bug_view_url($f_bug_id);
html_page_top(null, $t_redirect_url);
Example #5
0
$f_time_tracking = gpc_get_string('time_tracking', '0:00');
$f_bugnote_text = trim(gpc_get_string('bugnote_text', ''));
$f_files = gpc_get_file('ufile', null);
$t_bug = bug_get($f_bug_id, true);
if ($t_bug->project_id != helper_get_current_project()) {
    # in case the current project is not the same project of the bug we are viewing...
    # ... override the current project. This to avoid problems with categories and handlers lists etc.
    $g_project_override = $t_bug->project_id;
}
if (bug_is_readonly($t_bug->id)) {
    error_parameters($t_bug->id);
    trigger_error(ERROR_BUG_READ_ONLY_ACTION_DENIED, ERROR);
}
access_ensure_bug_level(config_get('add_bugnote_threshold'), $t_bug->id);
if ($f_private) {
    access_ensure_bug_level(config_get('set_view_status_threshold'), $t_bug->id);
}
# Handle the file upload
if ($f_files !== null) {
    if (!file_allow_bug_upload($f_bug_id)) {
        access_denied();
    }
    file_process_posted_files_for_bug($f_bug_id, $f_files);
}
# We always set the note time to BUGNOTE, and the API will overwrite it with TIME_TRACKING
# if $f_time_tracking is not 0 and the time tracking feature is enabled.
$t_bugnote_id = bugnote_add($t_bug->id, $f_bugnote_text, $f_time_tracking, $f_private, BUGNOTE);
if (!$t_bugnote_id) {
    error_parameters(lang_get('bugnote'));
    trigger_error(ERROR_EMPTY_FIELD, ERROR);
}
Example #6
0
# Mantis is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Mantis.  If not, see <http://www.gnu.org/licenses/>.
# --------------------------------------------------------
# $Id: bug_monitor.php,v 1.28.16.1 2007-10-13 22:32:42 giallu Exp $
# --------------------------------------------------------
# This file turns monitoring on or off for a bug for the current user
require_once 'core.php';
$t_core_path = config_get('core_path');
require_once $t_core_path . 'bug_api.php';
# helper_ensure_post();
$f_bug_id = gpc_get_int('bug_id');
$t_bug = bug_get($f_bug_id, true);
if ($t_bug->project_id != helper_get_current_project()) {
    # in case the current project is not the same project of the bug we are viewing...
    # ... override the current project. This to avoid problems with categories and handlers lists etc.
    $g_project_override = $t_bug->project_id;
}
$f_action = gpc_get_string('action');
access_ensure_bug_level(config_get('monitor_bug_threshold'), $f_bug_id);
if ('delete' == $f_action) {
    bug_unmonitor($f_bug_id, auth_get_current_user_id());
} else {
    # should be 'add' but we have to account for other values
    bug_monitor($f_bug_id, auth_get_current_user_id());
}
print_successful_redirect_to_bug($f_bug_id);
/**
 * MantisBT Core API's
 */
require_once 'core.php';
require_once 'bug_api.php';
require_once 'bugnote_api.php';
form_security_validate('bugnote_add');
$f_bug_id = gpc_get_int('bug_id');
$f_private = gpc_get_bool('private');
$f_time_tracking = gpc_get_string('time_tracking', '0:00');
$f_bugnote_text = trim(gpc_get_string('bugnote_text', ''));
$t_bug = bug_get($f_bug_id, true);
if ($t_bug->project_id != helper_get_current_project()) {
    # in case the current project is not the same project of the bug we are viewing...
    # ... override the current project. This to avoid problems with categories and handlers lists etc.
    $g_project_override = $t_bug->project_id;
}
if (bug_is_readonly($f_bug_id)) {
    error_parameters($f_bug_id);
    trigger_error(ERROR_BUG_READ_ONLY_ACTION_DENIED, ERROR);
}
access_ensure_bug_level(config_get('add_bugnote_threshold'), $f_bug_id);
// We always set the note time to BUGNOTE, and the API will overwrite it with TIME_TRACKING
// if $f_time_tracking is not 0 and the time tracking feature is enabled.
$t_bugnote_id = bugnote_add($f_bug_id, $f_bugnote_text, $f_time_tracking, $f_private, BUGNOTE);
if (!$t_bugnote_id) {
    error_parameters(lang_get('bugnote'));
    trigger_error(ERROR_EMPTY_FIELD, ERROR);
}
form_security_purge('bugnote_add');
print_successful_redirect_to_bug($f_bug_id);
Example #8
0
$g_allow_browser_cache = 1;
$f_bug_id = gpc_get_int('bug_id');
$t_bug = bug_get($f_bug_id, true);
if ($t_bug->project_id != helper_get_current_project()) {
    # in case the current project is not the same project of the bug we are viewing...
    # ... override the current project. This to avoid problems with categories and handlers lists etc.
    $g_project_override = $t_bug->project_id;
    $t_changed_project = true;
} else {
    $t_changed_project = false;
}
if (bug_is_readonly($f_bug_id)) {
    error_parameters($f_bug_id);
    trigger_error(ERROR_BUG_READ_ONLY_ACTION_DENIED, ERROR);
}
access_ensure_bug_level(config_get('update_bug_threshold'), $f_bug_id);
$t_fields = config_get('bug_update_page_fields');
$t_fields = columns_filter_disabled($t_fields);
$t_bug_id = $f_bug_id;
$t_action_button_position = config_get('action_button_position');
$t_top_buttons_enabled = $t_action_button_position == POSITION_TOP || $t_action_button_position == POSITION_BOTH;
$t_bottom_buttons_enabled = $t_action_button_position == POSITION_BOTTOM || $t_action_button_position == POSITION_BOTH;
$t_show_id = in_array('id', $t_fields);
$t_show_project = in_array('project', $t_fields);
$t_show_category = in_array('category_id', $t_fields);
$t_show_view_state = in_array('view_state', $t_fields);
$t_view_state = $t_show_view_state ? string_display_line(get_enum_element('view_state', $t_bug->view_state)) : '';
$t_show_date_submitted = in_array('date_submitted', $t_fields);
$t_show_last_updated = in_array('last_updated', $t_fields);
$t_show_reporter = in_array('reporter', $t_fields);
$t_show_handler = in_array('handler', $t_fields);
$f_bug_id = gpc_get_int( 'bug_id' );

$t_bug = bug_get( $f_bug_id, true );
if( $t_bug->project_id != helper_get_current_project() ) {
	# in case the current project is not the same project of the bug we are viewing...
	# ... override the current project. This to avoid problems with categories and handlers lists etc.
	$g_project_override = $t_bug->project_id;
}

if( bug_is_readonly( $f_bug_id ) ) {
	error_parameters( $f_bug_id );
	trigger_error( ERROR_BUG_READ_ONLY_ACTION_DENIED, ERROR );
}

access_ensure_bug_level( config_get( 'bug_reminder_threshold' ), $f_bug_id );

html_page_top( bug_format_summary( $f_bug_id, SUMMARY_CAPTION ) );
?>

<?php # Send reminder Form BEGIN ?>
<br />
<form method="post" action="bug_reminder.php">
<?php echo form_security_field( 'bug_reminder' ) ?>
<input type="hidden" name="bug_id" value="<?php echo $f_bug_id ?>" />
<div class="width75 form-container">
<table cellspacing="1">
<tr>
	<td class="form-title" colspan="2">
		<?php echo lang_get( 'bug_reminder' ) ?>
	</td>
Example #10
0
 *
 * @uses core.php
 * @uses access_api.php
 * @uses bug_revision_api.php
 * @uses config_api.php
 * @uses form_api.php
 * @uses gpc_api.php
 * @uses helper_api.php
 * @uses lang_api.php
 * @uses print_api.php
 */
/**
 * MantisBT Core API's
 */
require_once 'core.php';
require_api('access_api.php');
require_api('bug_revision_api.php');
require_api('config_api.php');
require_api('form_api.php');
require_api('gpc_api.php');
require_api('helper_api.php');
require_api('lang_api.php');
require_api('print_api.php');
form_security_validate('bug_revision_drop');
$f_revision_id = gpc_get_int('id');
$t_revision = bug_revision_get($f_revision_id);
access_ensure_bug_level(config_get('bug_revision_drop_threshold'), $t_revision['bug_id']);
helper_ensure_confirmed(lang_get('confirm_revision_drop'), lang_get('revision_drop'));
bug_revision_drop($f_revision_id);
form_security_purge('bug_revision_drop');
print_successful_redirect_to_bug($t_revision['bug_id']);
Example #11
0
       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.

   Notes: Based on the Time Tracking plugin by Elmar:
   2005 by Elmar Schumacher - GAMBIT Consulting GmbH
   http://www.mantisbt.org/forums/viewtopic.php?f=4&t=589	
*/
form_security_validate('plugin_TimeTracking_delete_record');
$f_bug_id = gpc_get_int('bug_id');
$f_delete_id = gpc_get_int('delete_id');
$table = plugin_table('data', 'TimeTracking');
$query_pull_timerecords = "SELECT * FROM {$table} WHERE id = {$f_delete_id} ORDER BY timestamp DESC";
$result_pull_timerecords = db_query($query_pull_timerecords);
$row = db_fetch_array($result_pull_timerecords);
$t_user_id = auth_get_current_user_id();
if ($row[user] == $t_user_id) {
    access_ensure_bug_level(plugin_config_get('admin_own_threshold'), $f_bug_id);
} else {
    access_ensure_bug_level(plugin_config_get('admin_threshold'), $f_bug_id);
}
$query_delete = "DELETE FROM {$table} WHERE id = {$f_delete_id}";
db_query($query_delete);
history_log_event_direct($f_bug_id, plugin_lang_get('history') . " " . plugin_lang_get('deleted'), date(config_get("short_date_format"), strtotime($row["expenditure_date"])) . ": " . number_format($row["hours"], 2, ',', '.') . " h.", "deleted", $user);
form_security_purge('plugin_TimeTracking_delete_record');
$t_url = string_get_bug_view_url($f_bug_id, auth_get_current_user_id());
print_successful_redirect($t_url . "#timerecord");
Example #12
0
require_api('event_api.php');
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('string_api.php');
require_api('tag_api.php');
require_api('utility_api.php');
form_security_validate('tag_attach');
$f_bug_id = gpc_get_int('bug_id');
$f_tag_select = gpc_get_int('tag_select');
$f_tag_string = gpc_get_string('tag_string');
$t_user_id = auth_get_current_user_id();
access_ensure_bug_level(config_get('tag_attach_threshold'), $f_bug_id, $t_user_id);
/** @todo The handling of tag strings which can include multiple tags should be moved
 *     to the APIs.  This is to allow other clients of the API to support such
 *     functionality.  The access level checks should also be moved to the API.
 */
$t_tags = tag_parse_string($f_tag_string);
$t_can_create = access_has_global_level(config_get('tag_create_threshold'));
$t_tags_create = array();
$t_tags_attach = array();
$t_tags_failed = array();
foreach ($t_tags as $t_tag_row) {
    if (-1 == $t_tag_row['id']) {
        if ($t_can_create) {
            $t_tags_create[] = $t_tag_row;
        } else {
            $t_tags_failed[] = $t_tag_row;
require_api('gpc_api.php');
require_api('html_api.php');
require_api('lang_api.php');
require_api('print_api.php');
require_api('sponsorship_api.php');
if (!config_get('enable_sponsorship')) {
    trigger_error(ERROR_SPONSORSHIP_NOT_ENABLED, ERROR);
}
form_security_validate('account_sponsor_update');
auth_ensure_user_authenticated();
$f_bug_list = gpc_get_string('buglist', '');
$t_bug_list = explode(',', $f_bug_list);
foreach ($t_bug_list as $t_bug) {
    list($t_bug_id, $t_sponsor_id) = explode(':', $t_bug);
    $c_bug_id = (int) $t_bug_id;
    bug_ensure_exists($c_bug_id);
    # dies if bug doesn't exist
    access_ensure_bug_level(config_get('handle_sponsored_bugs_threshold'), $c_bug_id);
    # dies if user can't handle bug
    $t_bug = bug_get($c_bug_id);
    $t_sponsor = sponsorship_get((int) $t_sponsor_id);
    $t_new_payment = gpc_get_int('sponsor_' . $c_bug_id . '_' . $t_sponsor->id, $t_sponsor->paid);
    if ($t_new_payment != $t_sponsor->paid) {
        sponsorship_update_paid($t_sponsor_id, $t_new_payment);
    }
}
form_security_purge('account_sponsor_update');
$t_redirect_url = 'account_sponsor_page.php';
html_page_top(null, $t_redirect_url);
html_operation_successful($t_redirect_url, lang_get('payment_updated'));
html_page_bottom();
}

form_security_validate( 'account_sponsor_update' );

auth_ensure_user_authenticated();

$f_bug_list = gpc_get_string( 'buglist', '' );
$t_bug_list = explode( ',', $f_bug_list );

foreach ( $t_bug_list as $t_bug ) {
	list( $t_bug_id, $t_sponsor_id ) = explode( ':', $t_bug );
	$c_bug_id = (int) $t_bug_id;

	bug_ensure_exists( $c_bug_id ); # dies if bug doesn't exist

	access_ensure_bug_level( config_get( 'handle_sponsored_bugs_threshold' ), $c_bug_id ); # dies if user can't handle bug

	$t_bug = bug_get( $c_bug_id );
	$t_sponsor = sponsorship_get( (int) $t_sponsor_id );

	$t_new_payment = gpc_get_int( 'sponsor_' . $c_bug_id . '_' . $t_sponsor->id, $t_sponsor->paid );
	if ( $t_new_payment != $t_sponsor->paid ) {
		sponsorship_update_paid( $t_sponsor_id, $t_new_payment );
	}
}

form_security_purge( 'account_sponsor_update' );

$t_redirect = 'account_sponsor_page.php';
html_page_top( null, $t_redirect );
    # in case the current project is not the same project of the bug we are viewing...
    # ... override the current project. This to avoid problems with categories and handlers lists etc.
    $g_project_override = $t_bug->project_id;
}
$f_handler_id = gpc_get_int('handler_id', auth_get_current_user_id());
# check that current user has rights to assign the issue
access_ensure_bug_level(config_get('update_bug_assign_threshold', config_get('update_bug_threshold')), $f_bug_id);
$t_bug_sponsored = sponsorship_get_amount(sponsorship_get_all_ids($f_bug_id)) > 0;
if ($t_bug_sponsored) {
    if (!access_has_bug_level(config_get('assign_sponsored_bugs_threshold'), $f_bug_id)) {
        trigger_error(ERROR_SPONSORSHIP_ASSIGNER_ACCESS_LEVEL_TOO_LOW, ERROR);
    }
}
if ($f_handler_id != NO_USER) {
    # check that new handler has rights to handle the issue
    access_ensure_bug_level(config_get('handle_bug_threshold'), $f_bug_id, $f_handler_id);
    if ($t_bug_sponsored) {
        if (!access_has_bug_level(config_get('handle_sponsored_bugs_threshold'), $f_bug_id, $f_handler_id)) {
            trigger_error(ERROR_SPONSORSHIP_HANDLER_ACCESS_LEVEL_TOO_LOW, ERROR);
        }
    }
}
# Update handler and status
$t_bug->handler_id = $f_handler_id;
if (ON == config_get('auto_set_status_to_assigned') && NO_USER != $f_handler_id) {
    $t_bug->status = config_get('bug_assigned_status');
}
# Plugin support
$t_new_bug = event_signal('EVENT_UPDATE_BUG', $t_bug, $f_bug_id);
if (!is_null($t_new_bug)) {
    $t_bug = $t_new_bug;
Example #16
0
# anonymous users are not allowed to sponsor issues
if (current_user_is_anonymous()) {
    access_denied();
}
$f_bug_id = gpc_get_int('bug_id');
$f_amount = gpc_get_int('amount');
$t_bug = bug_get($f_bug_id, true);
if ($t_bug->project_id != helper_get_current_project()) {
    # in case the current project is not the same project of the bug we are viewing...
    # ... override the current project. This to avoid problems with categories and handlers lists etc.
    $g_project_override = $t_bug->project_id;
}
if (config_get('enable_sponsorship') == OFF) {
    trigger_error(ERROR_SPONSORSHIP_NOT_ENABLED, ERROR);
}
access_ensure_bug_level(config_get('sponsor_threshold'), $f_bug_id);
helper_ensure_confirmed(sprintf(lang_get('confirm_sponsorship'), $f_bug_id, sponsorship_format_amount($f_amount)), lang_get('sponsor_issue'));
if ($f_amount == 0) {
    # if amount == 0, delete sponsorship by current user (if any)
    $t_sponsorship_id = sponsorship_get_id($f_bug_id);
    if ($t_sponsorship_id !== false) {
        sponsorship_delete($t_sponsorship_id);
    }
} else {
    # add sponsorship
    $t_user = auth_get_current_user_id();
    if (is_blank(user_get_email($t_user))) {
        trigger_error(ERROR_SPONSORSHIP_SPONSOR_NO_EMAIL, ERROR);
    } else {
        $sponsorship = new SponsorshipData();
        $sponsorship->bug_id = $f_bug_id;
Example #17
0
/**
 * Detach a tag from a bug.
 * @param integer Tag ID
 * @param integer Bug ID
 * @param boolean Add history entries to bug
 * @param integer User Id (or null for current logged in user)	 
 */
function tag_bug_detach($p_tag_id, $p_bug_id, $p_add_history = true, $p_user_id = null)
{
    if ($p_user_id === null) {
        $t_user_id = auth_get_current_user_id();
    } else {
        $t_user_id = $p_user_id;
    }
    if (!tag_bug_is_attached($p_tag_id, $p_bug_id)) {
        trigger_error(TAG_NOT_ATTACHED, ERROR);
    }
    $t_tag_row = tag_bug_get_row($p_tag_id, $p_bug_id);
    if ($t_user_id == tag_get_field($p_tag_id, 'user_id') || $t_user_id == $t_tag_row['user_id']) {
        $t_detach_level = config_get('tag_detach_own_threshold');
    } else {
        $t_detach_level = config_get('tag_detach_threshold');
    }
    access_ensure_bug_level($t_detach_level, $p_bug_id, $t_user_id);
    $c_tag_id = db_prepare_int($p_tag_id);
    $c_bug_id = db_prepare_int($p_bug_id);
    $t_bug_tag_table = config_get('mantis_bug_tag_table');
    $query = "DELETE FROM {$t_bug_tag_table} \r\n\t\t\t\t\tWHERE tag_id='{$c_tag_id}' AND bug_id='{$c_bug_id}'";
    db_query($query);
    if ($p_add_history) {
        $t_tag_name = tag_get_field($p_tag_id, 'name');
        history_log_event_special($p_bug_id, TAG_DETACHED, $t_tag_name);
    }
    return true;
}
Example #18
0
require_api('helper_api.php');
require_api('print_api.php');
require_api('user_api.php');
form_security_validate('bug_monitor_delete');
$f_bug_id = gpc_get_int('bug_id');
$t_bug = bug_get($f_bug_id, true);
$f_user_id = gpc_get_int('user_id', NO_USER);
$t_logged_in_user_id = auth_get_current_user_id();
if ($f_user_id === NO_USER) {
    $t_user_id = $t_logged_in_user_id;
} else {
    user_ensure_exists($f_user_id);
    $t_user_id = $f_user_id;
}
if (user_is_anonymous($t_user_id)) {
    trigger_error(ERROR_PROTECTED_ACCOUNT, E_USER_ERROR);
}
bug_ensure_exists($f_bug_id);
if ($t_bug->project_id != helper_get_current_project()) {
    # in case the current project is not the same project of the bug we are viewing...
    # ... override the current project. This to avoid problems with categories and handlers lists etc.
    $g_project_override = $t_bug->project_id;
}
if ($t_logged_in_user_id == $t_user_id) {
    access_ensure_bug_level(config_get('monitor_bug_threshold'), $f_bug_id);
} else {
    access_ensure_bug_level(config_get('monitor_delete_others_bug_threshold'), $f_bug_id);
}
bug_unmonitor($f_bug_id, $t_user_id);
form_security_purge('bug_monitor_delete');
print_successful_redirect_to_bug($f_bug_id);
Example #19
0
 * @uses lang_api.php
 * @uses print_api.php
 */
require_once 'core.php';
require_api('access_api.php');
require_api('bug_api.php');
require_api('config_api.php');
require_api('file_api.php');
require_api('form_api.php');
require_api('gpc_api.php');
require_api('helper_api.php');
require_api('lang_api.php');
require_api('print_api.php');
form_security_validate('bug_file_delete');
$f_file_id = gpc_get_int('file_id');
$t_bug_id = file_get_field($f_file_id, 'bug_id');
$t_bug = bug_get($t_bug_id, true);
if ($t_bug->project_id != helper_get_current_project()) {
    # in case the current project is not the same project of the bug we are viewing...
    # ... override the current project. This to avoid problems with categories and handlers lists etc.
    $g_project_override = $t_bug->project_id;
}
$t_attachment_owner = file_get_field($f_file_id, 'user_id');
$t_current_user_is_attachment_owner = $t_attachment_owner == auth_get_current_user_id();
if (!$t_current_user_is_attachment_owner || $t_current_user_is_attachment_owner && !config_get('allow_delete_own_attachments')) {
    access_ensure_bug_level(config_get('delete_attachments_threshold'), $t_bug_id);
}
helper_ensure_confirmed(lang_get('delete_attachment_sure_msg'), lang_get('delete_attachment_button'));
file_delete($f_file_id, 'bug');
form_security_purge('bug_file_delete');
print_header_redirect_view($t_bug_id);
# $Id: bug_view_advanced_page.php,v 1.87.2.1 2007-10-13 22:32:59 giallu Exp $
# --------------------------------------------------------
require_once 'core.php';
$t_core_path = config_get('core_path');
require_once $t_core_path . 'bug_api.php';
require_once $t_core_path . 'custom_field_api.php';
require_once $t_core_path . 'file_api.php';
require_once $t_core_path . 'compress_api.php';
require_once $t_core_path . 'date_api.php';
require_once $t_core_path . 'relationship_api.php';
require_once $t_core_path . 'last_visited_api.php';
require_once $t_core_path . 'tag_api.php';
$f_bug_id = gpc_get_int('bug_id');
$f_history = gpc_get_bool('history', config_get('history_default_visible'));
bug_ensure_exists($f_bug_id);
access_ensure_bug_level(VIEWER, $f_bug_id);
$t_bug = bug_prepare_display(bug_get($f_bug_id, true));
if ($t_bug->project_id != helper_get_current_project()) {
    # in case the current project is not the same project of the bug we are viewing...
    # ... override the current project. This to avoid problems with categories and handlers lists etc.
    $g_project_override = $t_bug->project_id;
}
if (SIMPLE_ONLY == config_get('show_view')) {
    print_header_redirect('bug_view_page.php?bug_id=' . $f_bug_id);
}
compress_enable();
html_page_top1(bug_format_summary($f_bug_id, SUMMARY_CAPTION));
html_page_top2();
print_recently_visited();
$t_access_level_needed = config_get('view_history_threshold');
$t_can_view_history = access_has_bug_level($t_access_level_needed, $f_bug_id);
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with MantisBT.  If not, see <http://www.gnu.org/licenses/>.
/**
 * This file sticks or unsticks a bug to the top of the view page
 *
 * @package MantisBT
 * @copyright Copyright (C) 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
 * @copyright Copyright (C) 2002 - 2012  MantisBT Team - mantisbt-dev@lists.sourceforge.net
 * @link http://www.mantisbt.org
 */
/**
 * MantisBT Core API's
 */
require_once 'core.php';
require_once 'bug_api.php';
form_security_validate('bug_stick');
$f_bug_id = gpc_get_int('bug_id');
$t_bug = bug_get($f_bug_id, true);
$f_action = gpc_get_string('action');
if ($t_bug->project_id != helper_get_current_project()) {
    # in case the current project is not the same project of the bug we are viewing...
    # ... override the current project. This to avoid problems with categories and handlers lists etc.
    $g_project_override = $t_bug->project_id;
}
access_ensure_bug_level(config_get('set_bug_sticky_threshold'), $f_bug_id);
bug_set_field($f_bug_id, 'sticky', 'stick' == $f_action);
form_security_purge('bug_stick');
print_successful_redirect_to_bug($f_bug_id);
    print_header_redirect('login_select_proj_page.php?ref=bug_report_page.php');
}
if (ADVANCED_ONLY == config_get('show_report')) {
    print_header_redirect('bug_report_advanced_page.php' . (0 == $f_master_bug_id) ? '' : '?m_id=' . $f_master_bug_id);
}
if ($f_master_bug_id > 0) {
    # master bug exists...
    bug_ensure_exists($f_master_bug_id);
    # master bug is not read-only...
    if (bug_is_readonly($f_master_bug_id)) {
        error_parameters($f_master_bug_id);
        trigger_error(ERROR_BUG_READ_ONLY_ACTION_DENIED, ERROR);
    }
    $t_bug = bug_prepare_edit(bug_get($f_master_bug_id, true));
    # the user can at least update the master bug (needed to add the relationship)...
    access_ensure_bug_level(config_get('update_bug_threshold', null, $t_bug->project_id), $f_master_bug_id);
    #@@@ (thraxisp) Note that the master bug is cloned into the same project as the master, independent of
    #       what the current project is set to.
    if ($t_bug->project_id != helper_get_current_project()) {
        # in case the current project is not the same project of the bug we are viewing...
        # ... override the current project. This to avoid problems with categories and handlers lists etc.
        $g_project_override = $t_bug->project_id;
        $t_changed_project = true;
    } else {
        $t_changed_project = false;
    }
    access_ensure_project_level(config_get('report_bug_threshold'));
    $f_product_version = $t_bug->version;
    $f_category = $t_bug->category;
    $f_reproducibility = $t_bug->reproducibility;
    $f_severity = $t_bug->severity;
 * @uses relationship_graph_api.php
 */
require_once 'core.php';
require_api('access_api.php');
require_api('authentication_api.php');
require_api('bug_api.php');
require_api('compress_api.php');
require_api('config_api.php');
require_api('constant_inc.php');
require_api('gpc_api.php');
require_api('relationship_graph_api.php');
# If relationship graphs were made disabled, we disallow any access to
# this script.
auth_ensure_user_authenticated();
if (ON != config_get('relationship_graph_enable')) {
    access_denied();
}
$f_bug_id = gpc_get_int('bug_id');
$f_type = gpc_get_string('graph', 'relation');
$f_orientation = gpc_get_string('orientation', config_get('relationship_graph_orientation'));
$t_bug = bug_get($f_bug_id, true);
access_ensure_bug_level(config_get('view_bug_threshold', null, null, $t_bug->project_id), $f_bug_id);
compress_enable();
$t_graph_relation = 'relation' == $f_type;
$t_graph_horizontal = 'horizontal' == $f_orientation;
if ($t_graph_relation) {
    $t_graph = relgraph_generate_rel_graph($f_bug_id);
} else {
    $t_graph = relgraph_generate_dep_graph($f_bug_id, $t_graph_horizontal);
}
relgraph_output_image($t_graph);