Ejemplo n.º 1
0
/**
 * Print the list of selected issues and the legend for the status colors.
 *
 * @param $p_bug_ids_array   An array of issue ids.
 */
function bug_group_action_print_bug_list($p_bug_ids_array)
{
    $t_legend_position = config_get('status_legend_position');
    if (STATUS_LEGEND_POSITION_TOP == $t_legend_position) {
        html_status_legend();
        echo '<br />';
    }
    echo '<div align="center">';
    echo '<table class="width75" cellspacing="1">';
    echo '<tr class="row-1">';
    echo '<td class="category" colspan="2">';
    echo lang_get('actiongroup_bugs');
    echo '</td>';
    echo '</tr>';
    $t_i = 1;
    foreach ($p_bug_ids_array as $t_bug_id) {
        $t_class = sprintf("row-%d", $t_i++ % 2 + 1);
        echo sprintf("<tr bgcolor=\"%s\"> <td>%s</td> <td>%s</td> </tr>\n", get_status_color(bug_get_field($t_bug_id, 'status')), string_get_bug_view_link($t_bug_id), string_attribute(bug_get_field($t_bug_id, 'summary')));
    }
    echo '</table>';
    echo '</form>';
    echo '</div>';
    if (STATUS_LEGEND_POSITION_BOTTOM == $t_legend_position) {
        echo '<br />';
        html_status_legend();
    }
}
Ejemplo n.º 2
0
/**
 * Print Change Status to: AJAXified button
 * This code is similar to button_bug_change_status except that the 
 * button is AJAXified.
 * Uses projax.php
 *
 * @param int $p_bug_id
 * @param int $t_project_id
 * @param int $t_user_id
 * @return null
 */
function kanban_ajax_button_bug_change_status($p_bug_id, $t_project_id, $t_user_id)
{
    global $g_projax;
    $t_bug_project_id = bug_get_field($p_bug_id, 'project_id');
    $t_bug_current_state = bug_get_field($p_bug_id, 'status');
    $t_current_access = access_get_project_level($t_bug_project_id);
    $t_enum_list = get_status_option_list($t_current_access, $t_bug_current_state, false, bug_get_field($p_bug_id, 'reporter_id') == auth_get_current_user_id() && ON == config_get('allow_reporter_close'), $t_bug_project_id);
    if (count($t_enum_list) > 0) {
        # resort the list into ascending order after noting the key from the first element (the default)
        $t_default_arr = each($t_enum_list);
        $t_default = $t_default_arr['key'];
        ksort($t_enum_list);
        reset($t_enum_list);
        echo "<div id=\"ajax_statuschange\"><form method=\"post\" id=\"ajax_status_form\" action=\"xmlhttprequest.php\">";
        # CSRF protection not required here - form does not result in modifications
        echo "<input type=\"hidden\" name=\"project_id\" id=\"project_id\" value=\"{$t_project_id}\" />";
        echo "<input type=\"hidden\" name=\"user_id\" id=\"user_id\" value=\"{$t_user_id}\" />";
        echo "<input type=\"hidden\" name=\"entrypoint\" id=\"entrypoint\" value=\"bug_update_status\" />";
        $t_button_text = lang_get('bug_status_to_button');
        // AJAX button options
        $options = array('url' => plugin_page('kanban_ajax_request'), 'with' => true, 'confirm' => lang_get('confirm_change_status'), 'success' => 'location.reload()', 'failure' => 'alert("Error: " ' + request . status + ')');
        echo $g_projax->submit_to_remote('ajax_status', $t_button_text, $options);
        echo " <select name=\"new_status\">";
        # space at beginning of line is important
        foreach ($t_enum_list as $key => $val) {
            echo "<option value=\"{$key}\" ";
            check_selected($key, $t_default);
            echo ">{$val}</option>";
        }
        echo '</select>';
        $t_bug_id = string_attribute($p_bug_id);
        echo "<input type=\"hidden\" name=\"id\" value=\"{$t_bug_id}\" />\n";
        echo "</form></div>\n";
    }
}
Ejemplo n.º 3
0
function print_option_list_from_array($p_array, $p_filter_value)
{
    foreach ($p_array as $t_key => $t_value) {
        echo "<option value='{$t_key}'";
        check_selected($p_filter_value, $t_key);
        echo '>' . string_attribute($t_value) . "</option>\n";
    }
}
Ejemplo n.º 4
0
function projax_array_serialize_for_autocomplete($p_array)
{
    $t_matches = '<ul>';
    foreach ($p_array as $t_entry) {
        $t_matches .= '<li>' . string_attribute($t_entry) . '</li>';
    }
    $t_matches .= '</ul>';
    return $t_matches;
}
Ejemplo n.º 5
0
/**
 * return the mailto: href string link
 * @param string $p_email
 * @param string $p_text
 * @return string
 */
function prepare_email_link($p_email, $p_text)
{
    if (!access_has_project_level(config_get('show_user_email_threshold'))) {
        return string_display_line($p_text);
    }
    # If we apply string_url() to the whole mailto: link then the @
    #  gets turned into a %40 and you can't right click in browsers to
    #  do Copy Email Address.
    $t_mailto = string_attribute('mailto:' . $p_email);
    $p_text = string_display_line($p_text);
    return '<a href="' . $t_mailto . '">' . $p_text . '</a>';
}
Ejemplo n.º 6
0
function prepare_email_link($p_email, $p_text)
{
    if (!access_has_project_level(config_get('show_user_email_threshold'))) {
        return $p_text;
    }
    # If we apply string_url() to the whole mailto: link then the @
    #  gets turned into a %40 and you can't right click in browsers to
    #  do Copy Email Address.
    $t_mailto = string_attribute("mailto:{$p_email}");
    $p_text = string_display($p_text);
    return "<a href=\"{$t_mailto}\">{$p_text}</a>";
}
Ejemplo n.º 7
0
function custom_function_default_format_issue_summary($p_issue_id, $p_context = 0)
{
    switch ($p_context) {
        case SUMMARY_CAPTION:
            $t_string = bug_format_id($p_issue_id) . ': ' . string_attribute(bug_get_field($p_issue_id, 'summary'));
            break;
        case SUMMARY_FIELD:
            $t_string = bug_format_id($p_issue_id) . ': ' . string_attribute(bug_get_field($p_issue_id, 'summary'));
            break;
        case SUMMARY_EMAIL:
            $t_string = bug_format_id($p_issue_id) . ': ' . string_attribute(bug_get_field($p_issue_id, 'summary'));
            break;
        default:
            $t_string = string_attribute(bug_get_field($p_issue_id, 'summary'));
            break;
    }
    return $t_string;
}
Ejemplo n.º 8
0
    public function update_repo_form($p_repo)
    {
        $t_sf_project = isset($p_repo->info['sf_project']) ? $p_repo->info['sf_project'] : '';
        ?>
<tr <?php 
        echo helper_alternate_class();
        ?>
>
<td class="category"><?php 
        echo lang_get('plugin_SourceSFSVN_sf_project');
        ?>
</td>
<td><input name="sf_project" maxlength="250" size="40" value="<?php 
        echo string_attribute($t_sf_project);
        ?>
"/></td>
</tr>
<?php 
        return parent::update_repo_form($p_repo);
    }
Ejemplo n.º 9
0
function cfdef_input_textbox($p_field_def, $t_custom_field_value)
{
    echo '<input ' . helper_get_tab_index() . ' type="text" id="custom_field_' . $p_field_def['id'] . '" name="custom_field_' . $p_field_def['id'] . '" size="80"';
    if (0 < $p_field_def['length_max']) {
        echo ' maxlength="' . $p_field_def['length_max'] . '"';
    } else {
        echo ' maxlength="255"';
    }
    echo ' value="' . string_attribute($t_custom_field_value) . '"></input>';
}
Ejemplo n.º 10
0
        $t_custom_fields_found = true;
        ?>
	<tr>
		<th class="category">
			<?php 
        if ($t_def['require_report']) {
            ?>
				<span class="required">*</span>
			<?php 
        }
        ?>
			<?php 
        if ($t_def['type'] != CUSTOM_FIELD_TYPE_RADIO && $t_def['type'] != CUSTOM_FIELD_TYPE_CHECKBOX) {
            ?>
				<label for="custom_field_<?php 
            echo string_attribute($t_def['id']);
            ?>
"><?php 
            echo string_display(lang_get_defaulted($t_def['name']));
            ?>
</label>
			<?php 
        } else {
            echo string_display(lang_get_defaulted($t_def['name']));
        }
        ?>
		</th>
		<td>
			<?php 
        print_custom_field_input($t_def, $f_master_bug_id === 0 ? null : $f_master_bug_id);
        ?>
Ejemplo n.º 11
0
function print_bug_attachments_list($p_bug_id)
{
    $t_attachments = file_get_visible_attachments($p_bug_id);
    $t_attachments_count = count($t_attachments);
    $i = 0;
    $image_previewed = false;
    foreach ($t_attachments as $t_attachment) {
        $t_file_display_name = string_display_line($t_attachment['display_name']);
        $t_filesize = number_format($t_attachment['size']);
        $t_date_added = date(config_get('normal_date_format'), $t_attachment['date_added']);
        if ($image_previewed) {
            $image_previewed = false;
            echo '<br />';
        }
        if ($t_attachment['can_download']) {
            $t_href_start = '<a href="' . string_attribute($t_attachment['download_url']) . '">';
            $t_href_end = '</a>';
            $t_href_clicket = " [<a href=\"file_download.php?file_id={$t_attachment['id']}&amp;type=bug\" target=\"_blank\">^</a>]";
        } else {
            $t_href_start = '';
            $t_href_end = '';
            $t_href_clicket = '';
        }
        if (!$t_attachment['exists']) {
            print_file_icon($t_file_display_name);
            echo '&#160;<span class="strike">' . $t_file_display_name . '</span>' . lang_get('word_separator') . '(' . lang_get('attachment_missing') . ')';
        } else {
            echo $t_href_start;
            print_file_icon($t_file_display_name);
            echo $t_href_end . '&#160;' . $t_href_start . $t_file_display_name . $t_href_end . $t_href_clicket . ' (' . $t_filesize . ' ' . lang_get('bytes') . ') ' . '<span class="italic">' . $t_date_added . '</span>';
        }
        if ($t_attachment['can_delete']) {
            echo '&#160;[';
            print_link('bug_file_delete.php?file_id=' . $t_attachment['id'] . form_security_param('bug_file_delete'), lang_get('delete_link'), false, 'small');
            echo ']';
        }
        if ($t_attachment['exists']) {
            if (FTP == config_get('file_upload_method') && $t_attachment['exists']) {
                echo ' (' . lang_get('cached') . ')';
            }
            if ($t_attachment['preview'] && $t_attachment['type'] == 'text') {
                $c_id = db_prepare_int($t_attachment['id']);
                $t_bug_file_table = db_get_table('mantis_bug_file_table');
                echo "<script type=\"text/javascript\" language=\"JavaScript\">\n<!--\nfunction swap_content( span ) {\ndisplayType = ( document.getElementById( span ).style.display == 'none' ) ? '' : 'none';\ndocument.getElementById( span ).style.display = displayType;\n}\n\n -->\n </script>";
                echo " <span id=\"hideSection_{$c_id}\">[<a class=\"small\" href='#' id='attmlink_" . $c_id . "' onclick='swap_content(\"hideSection_" . $c_id . "\");swap_content(\"showSection_" . $c_id . "\");return false;'>" . lang_get('show_content') . "</a>]</span>";
                echo " <span style='display:none' id=\"showSection_{$c_id}\">[<a class=\"small\" href='#' id='attmlink_" . $c_id . "' onclick='swap_content(\"hideSection_" . $c_id . "\");swap_content(\"showSection_" . $c_id . "\");return false;'>" . lang_get('hide_content') . "</a>]";
                echo "<pre>";
                /** @todo Refactor into a method that gets contents for download / preview. */
                switch (config_get('file_upload_method')) {
                    case DISK:
                        if ($t_attachment['exists']) {
                            $v_content = file_get_contents($t_attachment['diskfile']);
                        }
                        break;
                    case FTP:
                        if (file_exists($t_attachment['exists'])) {
                            file_get_contents($t_attachment['diskfile']);
                        } else {
                            $ftp = file_ftp_connect();
                            file_ftp_get($ftp, $t_attachment['diskfile'], $t_attachment['diskfile']);
                            file_ftp_disconnect($ftp);
                            $v_content = file_get_contents($t_attachment['diskfile']);
                        }
                        break;
                    default:
                        $query = "SELECT *\n\t                  \t\t\t\t\tFROM {$t_bug_file_table}\n\t\t\t\t            \t\t\tWHERE id=" . db_param();
                        $result = db_query_bound($query, array($c_id));
                        $row = db_fetch_array($result);
                        $v_content = $row['content'];
                }
                echo htmlspecialchars($v_content);
                echo "</pre></span>\n";
            }
            if ($t_attachment['can_download'] && $t_attachment['preview'] && $t_attachment['type'] == 'image') {
                $t_preview_style = 'border: 0;';
                $t_max_width = config_get('preview_max_width');
                if ($t_max_width > 0) {
                    $t_preview_style .= ' max-width:' . $t_max_width . 'px;';
                }
                $t_max_height = config_get('preview_max_height');
                if ($t_max_height > 0) {
                    $t_preview_style .= ' max-height:' . $t_max_height . 'px;';
                }
                $t_preview_style = 'style="' . $t_preview_style . '"';
                $t_title = file_get_field($t_attachment['id'], 'title');
                $t_image_url = $t_attachment['download_url'] . '&amp;show_inline=1' . form_security_param('file_show_inline');
                echo "\n<br />{$t_href_start}<img alt=\"{$t_title}\" {$t_preview_style} src=\"{$t_image_url}\" />{$t_href_end}";
                $image_previewed = true;
            }
        }
        if ($i != $t_attachments_count - 1) {
            echo "<br />\n";
            $i++;
        }
    }
}
Ejemplo n.º 12
0
/**
 * Prints a multi-value filter field.
 * @param string $p_field_name  Field name.
 * @param mixed  $p_field_value Field value.
 * @return void
 */
function print_multivalue_field($p_field_name, $p_field_value)
{
    $t_output = '';
    $t_any_found = false;
    if (count($p_field_value) == 0) {
        echo lang_get('any');
    } else {
        $t_first_flag = true;
        $t_field_value = is_array($p_field_value) ? $p_field_value : array($p_field_value);
        foreach ($t_field_value as $t_current) {
            $t_current = stripslashes($t_current);
            ?>
				<input type="hidden" name="<?php 
            echo string_attribute($p_field_name);
            ?>
[]" value="<?php 
            echo string_attribute($t_current);
            ?>
" />
				<?php 
            $t_this_string = '';
            if ($t_current == META_FILTER_ANY && is_numeric($t_current) || is_blank($t_current)) {
                $t_any_found = true;
            } else {
                $t_this_string = string_display($t_current);
            }
            if ($t_first_flag != true) {
                $t_output .= '<br />';
            } else {
                $t_first_flag = false;
            }
            $t_output .= $t_this_string;
        }
        if (true == $t_any_found) {
            echo lang_get('any');
        } else {
            echo $t_output;
        }
    }
}
# --------------------------------------------------------
# $Id: manage_custom_field_delete.php,v 1.17.2.1 2007-10-13 22:33:27 giallu Exp $
# --------------------------------------------------------
require_once 'core.php';
$t_core_path = config_get('core_path');
require_once $t_core_path . 'custom_field_api.php';
form_security_validate('manage_custom_field_delete');
auth_reauthenticate();
access_ensure_global_level(config_get('manage_custom_fields_threshold'));
$f_field_id = gpc_get_int('field_id');
$f_return = strip_tags(gpc_get_string('return', 'manage_custom_field_page.php'));
$t_definition = custom_field_get_definition($f_field_id);
if (0 < count(custom_field_get_project_ids($f_field_id))) {
    helper_ensure_confirmed(lang_get('confirm_used_custom_field_deletion') . '<br/>' . lang_get('custom_field') . ': ' . string_attribute($t_definition['name']), lang_get('field_delete_button'));
} else {
    helper_ensure_confirmed(lang_get('confirm_custom_field_deletion') . '<br/>' . lang_get('custom_field') . ': ' . string_attribute($t_definition['name']), lang_get('field_delete_button'));
}
custom_field_destroy($f_field_id);
form_security_purge('manage_custom_field_delete');
html_page_top1();
html_meta_redirect($f_return);
html_page_top2();
?>

<br />
<div align="center">
<?php 
echo lang_get('operation_successful') . '<br />';
print_bracket_link($f_return, lang_get('proceed'));
?>
</div>
Ejemplo n.º 14
0
print_documentation_link('category');
?>
	</td>
	<td width="70%">
		<?php 
if ($t_changed_project) {
    echo "[" . project_get_field($t_bug->project_id, 'name') . "] ";
}
?>
		<select <?php 
echo helper_get_tab_index();
?>
 name="category">
			<?php 
if (is_blank($f_category)) {
    echo '<option value="" selected="selected">', string_attribute(lang_get('select_option')), '</option>';
}
print_category_option_list($f_category);
?>
		</select>
	</td>
</tr>


<!-- Reproducibility -->
<tr <?php 
echo helper_alternate_class();
?>
>
	<td class="category">
		<?php 
Ejemplo n.º 15
0
?>
	<tr <?php 
echo helper_alternate_class();
?>
>
		<td class="category">
			<span class="required">*</span><?php 
print_documentation_link('summary');
?>
		</td>
		<td>
			<input <?php 
echo helper_get_tab_index();
?>
 type="text" name="summary" size="105" maxlength="128" value="<?php 
echo string_attribute($f_summary);
?>
" />
		</td>
	</tr>
	<tr <?php 
echo helper_alternate_class();
?>
>
		<td class="category">
			<span class="required">*</span><?php 
print_documentation_link('description');
?>
		</td>
		<td>
			<textarea <?php 
Ejemplo n.º 16
0
function print_column_summary($p_row, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE)
{
    global $t_icon_path;
    $t_summary = string_attribute($p_row['summary']);
    echo '<td class="left">', $t_summary;
    if (VS_PRIVATE == $p_row['view_state']) {
        printf(' <img src="%s" alt="(%s)" title="%s" />', $t_icon_path . 'protected.gif', lang_get('private'), lang_get('private'));
    }
    echo '</td>';
}
Ejemplo n.º 17
0
# lost password feature disabled or reset password via email disabled -> stop here!
if (LDAP != config_get_global('login_method') && ON == config_get('lost_password_feature') && ON == config_get('send_reset_password') && ON == config_get('enable_email_notification')) {
    echo '<li><a href="lost_pwd_page.php">', lang_get('lost_password_link'), '</a></li>';
}
?>
			</ul>
			<div class="field-container">
				<label for="username"><span><?php 
echo lang_get('username');
?>
</span></label>
				<span class="input"><input id="username" type="text" name="username" size="32" maxlength="<?php 
echo DB_FIELD_SIZE_USERNAME;
?>
" value="<?php 
echo string_attribute($f_username);
?>
" class="<?php 
echo $t_username_field_autofocus;
?>
" /></span>
				<span class="label-style"></span>
			</div>
			<div class="field-container">
				<label for="password"><span><?php 
echo lang_get('password');
?>
</span></label>
				<span class="input"><input id="password" type="password" name="password" size="32" maxlength="<?php 
echo auth_get_password_max_size();
?>
    }
    get_capability_row_for_email(lang_get('email_on_relationship_changed'), 'relation');
    $t_statuses = MantisEnum::getAssocArrayIndexedByValues(config_get('status_enum_string'));
    foreach ($t_statuses as $t_status => $t_label) {
        get_capability_row_for_email(lang_get('status_changed_to') . ' \'' . get_enum_element('status', $t_status) . '\'', $t_label);
    }
    get_section_end_for_email();
    if ($g_can_change_flags || $g_can_change_defaults) {
        echo '<p>' . lang_get('notify_actions_change_access') . "\n";
        echo '<select name="notify_actions_access">' . "\n";
        print_enum_string_option_list('access_levels', config_get_access('notify_flags'));
        echo "\n</select></p>";
        echo '<input type="submit" class="button" value="' . lang_get('change_configuration') . '" />' . "\n";
        echo "</form>\n";
        echo '<div class="right">' . "\n";
        echo '<form id="mail_config_action" method="post" action="manage_config_revert.php">' . "\n";
        echo form_security_field('manage_config_revert') . "\n";
        echo '<input name="revert" type="hidden" value="notify_flags,default_notify_flags" />' . "\n";
        echo '<input name="project" type="hidden" value="' . $t_project . '" />' . "\n";
        echo '<input name="return" type="hidden" value="' . string_attribute(form_action_self()) . '" />' . "\n";
        echo '<input type="submit" class="button" value="';
        if (ALL_PROJECTS == $t_project) {
            echo lang_get('revert_to_system');
        } else {
            echo lang_get('revert_to_all_project');
        }
        echo '" />' . "\n";
        echo "</form></div>\n";
    }
}
html_page_bottom();
Ejemplo n.º 19
0
require_api('string_api.php');
require_api('utility_api.php');
# Check if project documentation feature is enabled.
if (OFF == config_get('enable_project_documentation') || !file_is_uploading_enabled() || !file_allow_project_upload()) {
    access_denied();
}
$f_file_id = gpc_get_int('file_id');
$c_file_id = db_prepare_int($f_file_id);
$t_project_id = file_get_field($f_file_id, 'project_id', 'project');
access_ensure_project_level(config_get('upload_project_file_threshold'), $t_project_id);
$t_proj_file_table = db_get_table('project_file');
$query = "SELECT *\n\t\tFROM {$t_proj_file_table}\n\t\tWHERE id=" . db_param();
$result = db_query_bound($query, array($c_file_id));
$row = db_fetch_array($result);
extract($row, EXTR_PREFIX_ALL, 'v');
$v_title = string_attribute($v_title);
$v_description = string_textarea($v_description);
$t_max_file_size = (int) min(ini_get_number('upload_max_filesize'), ini_get_number('post_max_size'), config_get('max_file_size'));
html_page_top();
?>

<br />
<div>
<form method="post" enctype="multipart/form-data" action="proj_doc_update.php">
<?php 
echo form_security_field('proj_doc_update');
?>
<table class="width75" cellspacing="1">
<tr>
	<td class="form-title">
		<input type="hidden" name="file_id" value="<?php 
Ejemplo n.º 20
0
/**
 * Get appropriate users assigned to a project by access level.
 *
 * @param string $p_username  The name of the user trying to access the versions.
 * @param string $p_password  The password of the user.
 * @param integer $p_project_id  The id of the project to retrieve the users for.
 * @param integer $p_access Minimum access level.
 * @return Array  representing a ProjectAttachmentDataArray structure.
 */
function mc_project_get_users($p_username, $p_password, $p_project_id, $p_access)
{
    $t_user_id = mci_check_login($p_username, $p_password);
    if ($t_user_id === false) {
        return mci_soap_fault_login_failed();
    }
    $t_users = array();
    $t_users = project_get_all_user_rows($p_project_id, $p_access);
    # handles ALL_PROJECTS case
    $t_display = array();
    $t_sort = array();
    $t_show_realname = ON == config_get('show_realname');
    $t_sort_by_last_name = ON == config_get('sort_by_last_name');
    foreach ($t_users as $t_user) {
        $t_user_name = string_attribute($t_user['username']);
        $t_sort_name = strtolower($t_user_name);
        if ($t_show_realname && $t_user['realname'] != "") {
            $t_user_name = string_attribute($t_user['realname']);
            if ($t_sort_by_last_name) {
                $t_sort_name_bits = explode(' ', strtolower($t_user_name), 2);
                $t_sort_name = (isset($t_sort_name_bits[1]) ? $t_sort_name_bits[1] . ', ' : '') . $t_sort_name_bits[0];
            } else {
                $t_sort_name = strtolower($t_user_name);
            }
        }
        $t_display[] = $t_user_name;
        $t_sort[] = $t_sort_name;
    }
    array_multisort($t_sort, SORT_ASC, SORT_STRING, $t_users, $t_display);
    $t_result = array();
    for ($i = 0; $i < count($t_sort); $i++) {
        $t_row = $t_users[$i];
        // This is not very performant - But we have to assure that the data returned is exactly
        // the same as the data that comes with an issue (test for equality - $t_row[] does not
        // contain email fields).
        $t_result[] = mci_account_get_array_by_id($t_row['id']);
    }
    return $t_result;
}
Ejemplo n.º 21
0
/**
 * return formatted string with all the details on the requested relationship
 * @param integer             $p_bug_id       A bug identifier.
 * @param BugRelationshipData $p_relationship A bug relationship object.
 * @param boolean             $p_html         Whether to return html or text output.
 * @param boolean             $p_html_preview Whether to include style/hyperlinks - if preview is false, we prettify the output.
 * @param boolean             $p_show_project Show Project details.
 * @return string
 */
function relationship_get_details($p_bug_id, BugRelationshipData $p_relationship, $p_html = false, $p_html_preview = false, $p_show_project = false)
{
    $t_summary_wrap_at = utf8_strlen(config_get('email_separator2')) - 28;
    $t_icon_path = config_get('icon_path');
    if ($p_bug_id == $p_relationship->src_bug_id) {
        # root bug is in the source side, related bug in the destination side
        $t_related_bug_id = $p_relationship->dest_bug_id;
        $t_related_project_name = project_get_name($p_relationship->dest_project_id);
        $t_relationship_descr = relationship_get_description_src_side($p_relationship->type);
    } else {
        # root bug is in the dest side, related bug in the source side
        $t_related_bug_id = $p_relationship->src_bug_id;
        $t_related_project_name = project_get_name($p_relationship->src_project_id);
        $t_relationship_descr = relationship_get_description_dest_side($p_relationship->type);
    }
    # related bug not existing...
    if (!bug_exists($t_related_bug_id)) {
        return '';
    }
    # user can access to the related bug at least as a viewer
    if (!access_has_bug_level(VIEWER, $t_related_bug_id)) {
        return '';
    }
    if ($p_html_preview == false) {
        $t_td = '<td>';
    } else {
        $t_td = '<td class="print">';
    }
    # get the information from the related bug and prepare the link
    $t_bug = bug_get($t_related_bug_id, false);
    $t_status_string = get_enum_element('status', $t_bug->status, auth_get_current_user_id(), $t_bug->project_id);
    $t_resolution_string = get_enum_element('resolution', $t_bug->resolution, auth_get_current_user_id(), $t_bug->project_id);
    $t_relationship_info_html = $t_td . string_no_break($t_relationship_descr) . '&#160;</td>';
    if ($p_html_preview == false) {
        $t_relationship_info_html .= '<td><a href="' . string_get_bug_view_url($t_related_bug_id) . '">' . string_display_line(bug_format_id($t_related_bug_id)) . '</a></td>';
        $t_relationship_info_html .= '<td><span class="issue-status" title="' . string_attribute($t_resolution_string) . '">' . string_display_line($t_status_string) . '</span></td>';
    } else {
        $t_relationship_info_html .= $t_td . string_display_line(bug_format_id($t_related_bug_id)) . '</td>';
        $t_relationship_info_html .= $t_td . string_display_line($t_status_string) . '&#160;</td>';
    }
    $t_relationship_info_text = utf8_str_pad($t_relationship_descr, 20);
    $t_relationship_info_text .= utf8_str_pad(bug_format_id($t_related_bug_id), 8);
    # get the handler name of the related bug
    $t_relationship_info_html .= $t_td;
    if ($t_bug->handler_id > 0) {
        $t_relationship_info_html .= string_no_break(prepare_user_name($t_bug->handler_id));
    }
    $t_relationship_info_html .= '&#160;</td>';
    # add project name
    if ($p_show_project) {
        $t_relationship_info_html .= $t_td . string_display_line($t_related_project_name) . '&#160;</td>';
    }
    # add summary
    if ($p_html == true) {
        $t_relationship_info_html .= $t_td . string_display_line_links($t_bug->summary);
        if (VS_PRIVATE == $t_bug->view_state) {
            $t_relationship_info_html .= sprintf(' <img src="%s" alt="(%s)" title="%s" />', $t_icon_path . 'protected.gif', lang_get('private'), lang_get('private'));
        }
    } else {
        if (utf8_strlen($t_bug->summary) <= $t_summary_wrap_at) {
            $t_relationship_info_text .= string_email_links($t_bug->summary);
        } else {
            $t_relationship_info_text .= utf8_substr(string_email_links($t_bug->summary), 0, $t_summary_wrap_at - 3) . '...';
        }
    }
    # add delete link if bug not read only and user has access level
    if (!bug_is_readonly($p_bug_id) && !current_user_is_anonymous() && $p_html_preview == false) {
        if (access_has_bug_level(config_get('update_bug_threshold'), $p_bug_id)) {
            $t_relationship_info_html .= ' [<a class="small" href="bug_relationship_delete.php?bug_id=' . $p_bug_id . '&amp;rel_id=' . $p_relationship->id . htmlspecialchars(form_security_param('bug_relationship_delete')) . '">' . lang_get('delete_link') . '</a>]';
        }
    }
    $t_relationship_info_html .= '&#160;</td>';
    $t_relationship_info_text .= "\n";
    if ($p_html_preview == false) {
        # choose color based on status
        $t_status_label = html_get_status_css_class($t_bug->status, auth_get_current_user_id(), $t_bug->project_id);
        $t_relationship_info_html = '<tr class="' . $t_status_label . '">' . $t_relationship_info_html . '</tr>' . "\n";
    } else {
        $t_relationship_info_html = '<tr>' . $t_relationship_info_html . '</tr>';
    }
    if ($p_html == true) {
        return $t_relationship_info_html;
    } else {
        return $t_relationship_info_text;
    }
}
Ejemplo n.º 22
0
				<span class="input"><input type="text" id="proj-category-name" name="name" size="32" maxlength="128" value="<?php echo string_attribute( $t_name ) ?>" /></span>
				<span class="label-style"></span>
			</div>
			<div class="field-container <?php echo helper_alternate_class_no_attribute(); ?>">
				<label for="proj-category-assigned-to"><span><?php echo lang_get( 'assigned_to' ) ?></span></label>
				<span class="select">
					<select id="proj-category-assigned-to" name="assigned_to">
						<option value="0"></option>
						<?php print_assign_to_option_list( $t_assigned_to, $t_project_id ) ?>
					</select>
				</span>
				<span class="label-style"></span>
			</div>
			<span class="submit-button"><input type="submit" class="button" value="<?php echo lang_get( 'update_category_button' ) ?>" /></span>
		</fieldset>
	</form>
</div>

<div class="form-container">
	<form method="post" action="manage_proj_cat_delete.php" class="action-button">
		<fieldset>
			<?php echo form_security_field( 'manage_proj_cat_delete' ) ?>
			<input type="hidden" name="id" value="<?php echo string_attribute( $f_category_id ) ?>" />
			<input type="hidden" name="project_id" value="<?php echo string_attribute( $f_project_id ) ?>" />
			<span class="submit-button"><input type="submit" class="button" value="<?php echo lang_get( 'delete_category_button' ) ?>" /></span>
		</fieldset>
	</form>
</div><?php

html_page_bottom();
Ejemplo n.º 23
0
    # 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);
html_page_top(lang_get('edit_news_title'));
# Edit News Form BEGIN
?>
<br />
<div align="center">
<form method="post" action="news_update.php">
<?php 
echo form_security_field('news_update');
?>
<table class="width75" cellspacing="1">
<tr>
	<td class="form-title">
		<input type="hidden" name="news_id" value="<?php 
echo $v_id;
Ejemplo n.º 24
0
		<?php 
echo lang_get('realname');
?>
	</td>
	<td width="70%">
		<?php 
// With LDAP
if ($t_ldap && ON == config_get('use_ldap_realname')) {
    echo string_display_line(user_get_realname($t_user_id));
} else {
    ?>
			<input type="text" size="32" maxlength="<?php 
    echo DB_FIELD_SIZE_REALNAME;
    ?>
" name="realname" value="<?php 
    echo string_attribute($t_user['realname']);
    ?>
" />
		<?php 
}
?>
	</td>
</tr>

<!-- Email -->
<tr <?php 
echo helper_alternate_class();
?>
>
	<td class="category">
		<?php 
Ejemplo n.º 25
0
    echo lang_get('status');
    ?>
</td>
	</tr>
<?php 
    $t_bug_list = array();
    $t_total_owing = 0;
    $t_total_paid = 0;
    for ($i = 0; $i < $t_sponsor_count; ++$i) {
        $t_sponsor_row = $t_sponsors[$i];
        $t_bug = bug_get($t_sponsor_row['bug']);
        $t_sponsor = sponsorship_get($t_sponsor_row['sponsor']);
        $t_buglist[] = $t_sponsor_row['bug'] . ':' . $t_sponsor_row['sponsor'];
        # describe bug
        $t_status = string_attribute(get_enum_element('status', $t_bug->status, auth_get_current_user_id(), $t_bug->project_id));
        $t_resolution = string_attribute(get_enum_element('resolution', $t_bug->resolution, auth_get_current_user_id(), $t_bug->project_id));
        $t_version_id = version_get_id($t_bug->fixed_in_version, $t_bug->project_id);
        if (false !== $t_version_id && VERSION_RELEASED == version_get_field($t_version_id, 'released')) {
            $t_released_label = '<a title="' . lang_get('released') . '">' . $t_bug->fixed_in_version . '</a>';
        } else {
            $t_released_label = $t_bug->fixed_in_version;
        }
        # choose color based on status
        $t_status_label = html_get_status_css_class($t_bug->status, auth_get_current_user_id(), $t_bug->project_id);
        echo '<tr class="' . $t_status_label . '">';
        echo '<td><a href="' . string_get_bug_view_url($t_sponsor_row['bug']) . '">' . bug_format_id($t_sponsor_row['bug']) . '</a></td>';
        echo '<td>' . string_display_line(project_get_field($t_bug->project_id, 'name')) . '&#160;</td>';
        echo '<td class="right">' . $t_released_label . '&#160;</td>';
        echo '<td><a title="' . $t_resolution . '"><span class="underline">' . $t_status . '</span>&#160;</a></td>';
        # summary
        echo '<td>' . string_display_line($t_bug->summary);
Ejemplo n.º 26
0
" />
		<input type="hidden" name="target_version" value="<?php 
    echo string_attribute($t_bug_data->target_version);
    ?>
" />
		<input type="hidden" name="build" value="<?php 
    echo string_attribute($t_bug_data->build);
    ?>
" />
		<input type="hidden" name="report_stay" value="1" />
		<input type="hidden" name="view_state" value="<?php 
    echo string_attribute($t_bug_data->view_state);
    ?>
" />
		<input type="hidden" name="due_date" value="<?php 
    echo string_attribute($t_bug_data->due_date);
    ?>
" />
		<input type="submit" class="button" value="<?php 
    echo lang_get('report_more_bugs');
    ?>
" />
	</form>
	</p>
<?php 
}
?>
</div>

<?php 
html_page_bottom();
Ejemplo n.º 27
0
/**
 * Prints the preview of an image file attachment.
 * @param array $p_attachment An attachment arrray from within the array returned by the file_get_visible_attachments() function
 */
function print_bug_attachment_preview_image($p_attachment)
{
    $t_preview_style = 'border: 0;';
    $t_max_width = config_get('preview_max_width');
    if ($t_max_width > 0) {
        $t_preview_style .= ' max-width:' . $t_max_width . 'px;';
    }
    $t_max_height = config_get('preview_max_height');
    if ($t_max_height > 0) {
        $t_preview_style .= ' max-height:' . $t_max_height . 'px;';
    }
    $t_title = file_get_field($p_attachment['id'], 'title');
    $t_image_url = $p_attachment['download_url'] . '&show_inline=1' . form_security_param('file_show_inline');
    echo "\n<div class=\"bug-attachment-preview-image\">";
    echo '<a href="' . string_attribute($p_attachment['download_url']) . '">';
    echo '<img src="' . string_attribute($t_image_url) . '" alt="' . string_attribute($t_title) . '" style="' . string_attribute($t_preview_style) . '" />';
    echo '</a></div>';
}
Ejemplo n.º 28
0
/**
 * List of users that are NOT in the specified project and that are enabled
 * if no project is specified use the current project
 * also exclude any administrators
 * @param integer $p_project_id A valid project identifier.
 * @return array List of users not assigned to the specified project
 */
function user_get_unassigned_by_project_id($p_project_id = null)
{
    if (null === $p_project_id) {
        $p_project_id = helper_get_current_project();
    }
    $t_adm = config_get_global('admin_site_threshold');
    $t_query = 'SELECT DISTINCT u.id, u.username, u.realname
				FROM {user} u
				LEFT JOIN {project_user_list} p
				ON p.user_id=u.id AND p.project_id=' . db_param() . '
				WHERE u.access_level<' . db_param() . ' AND
					u.enabled = ' . db_param() . ' AND
					p.user_id IS NULL
				ORDER BY u.realname, u.username';
    $t_result = db_query($t_query, array($p_project_id, $t_adm, true));
    $t_display = array();
    $t_sort = array();
    $t_users = array();
    $t_show_realname = ON == config_get('show_realname');
    $t_sort_by_last_name = ON == config_get('sort_by_last_name');
    while ($t_row = db_fetch_array($t_result)) {
        $t_users[] = $t_row['id'];
        $t_user_name = string_attribute($t_row['username']);
        $t_sort_name = $t_user_name;
        if (isset($t_row['realname']) && $t_row['realname'] != '' && $t_show_realname) {
            $t_user_name = string_attribute($t_row['realname']);
            if ($t_sort_by_last_name) {
                $t_sort_name_bits = explode(' ', utf8_strtolower($t_user_name), 2);
                $t_sort_name = (isset($t_sort_name_bits[1]) ? $t_sort_name_bits[1] . ', ' : '') . $t_sort_name_bits[0];
            } else {
                $t_sort_name = utf8_strtolower($t_user_name);
            }
        }
        $t_display[] = $t_user_name;
        $t_sort[] = $t_sort_name;
    }
    array_multisort($t_sort, SORT_ASC, SORT_STRING, $t_users, $t_display);
    $t_count = count($t_sort);
    $t_user_list = array();
    for ($i = 0; $i < $t_count; $i++) {
        $t_user_list[$t_users[$i]] = $t_display[$i];
    }
    return $t_user_list;
}
Ejemplo n.º 29
0
/**
 * Print column content for column summary
 *
 * @param BugData $p_bug bug object
 * @param int $p_columns_target see COLUMNS_TARGET_* in constant_inc.php
 * @return null
 * @access public
 */
function print_column_summary($p_bug, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE)
{
    if ($p_columns_target == COLUMNS_TARGET_CSV_PAGE) {
        $t_summary = string_attribute($p_bug->summary);
    } else {
        $t_summary = string_display_line_links($p_bug->summary);
    }
    echo '<td class="column-summary">' . $t_summary . '</td>';
}
Ejemplo n.º 30
0
			</td>
			<td class="center">
				<?php 
echo lang_get('actions');
?>
			</td>
		</tr>
<?php 
$t_users = project_get_all_user_rows($f_project_id, ANYBODY, $f_show_global_users);
$t_display = array();
$t_sort = array();
foreach ($t_users as $t_user) {
    $t_user_name = string_attribute($t_user['username']);
    $t_sort_name = utf8_strtolower($t_user_name);
    if (isset($t_user['realname']) && $t_user['realname'] > "" && ON == config_get('show_realname')) {
        $t_user_name = string_attribute($t_user['realname']) . " (" . $t_user_name . ")";
        if (ON == config_get('sort_by_last_name')) {
            $t_sort_name_bits = explode(' ', utf8_strtolower($t_user_name), 2);
            $t_sort_name = $t_sort_name_bits[1] . ', ' . $t_sort_name_bits[1];
        } else {
            $t_sort_name = utf8_strtolower($t_user_name);
        }
    }
    $t_display[] = $t_user_name;
    $t_sort[] = $t_sort_name;
}
array_multisort($t_sort, SORT_ASC, SORT_STRING, $t_users, $t_display);
# reset the class counter
helper_alternate_class(0);
$t_users_count = count($t_sort);
$t_removable_users_exist = false;