/**
 * Posts a twitter update when a bug is resolved.
 *
 * @param $p_bug_id The bug id that was resolved.
 * @access public
 */
function twitter_issue_resolved($p_bug_id)
{
    if (!twitter_enabled()) {
        return true;
    }
    $t_bug = bug_get($p_bug_id, false);
    # Do not twitter except fixed issues
    if ($t_bug->resolution < config_get('bug_resolution_fixed_threshold') || $t_bug->resolution >= config_get('bug_resolution_not_fixed_threshold')) {
        return true;
    }
    # Do not twitter private bugs.
    if ($t_bug->view_state != VS_PUBLIC) {
        return true;
    }
    # Do not twitter bugs belonging to private projects.
    if (VS_PRIVATE == project_get_field($t_bug->project_id, 'view_state')) {
        return true;
    }
    $c_bug_id = db_prepare_int($p_bug_id);
    if (is_blank($t_bug->fixed_in_version)) {
        $t_message = sprintf(lang_get('twitter_resolved_no_version'), $c_bug_id, category_full_name($t_bug->category_id, false), $t_bug->summary, user_get_name($t_bug->handler_id));
    } else {
        $t_message = sprintf(lang_get('twitter_resolved'), $c_bug_id, category_full_name($t_bug->category_id, false), $t_bug->summary, user_get_name($t_bug->handler_id), $t_bug->fixed_in_version);
    }
    return twitter_update($t_message);
}
Example #2
0
    function renderIssues($status)
    {
        $content = array();
        $t_project_id = helper_get_current_project();
        $t_bug_table = db_get_table('mantis_bug_table');
        $t_user_id = auth_get_current_user_id();
        $specific_where = helper_project_specific_where($t_project_id, $t_user_id);
        if ($this->severity) {
            $severityCond = '= ' . $this->severity;
        } else {
            $severityCond = '> -1';
        }
        $query = "SELECT *\n\t\t\tFROM {$t_bug_table}\n\t\t\tWHERE {$specific_where}\n\t\t\tAND status = {$status}\n\t\t\tAND severity {$severityCond}\n\t\t\tORDER BY last_updated DESC\n\t\t\tLIMIT 20";
        $result = db_query_bound($query);
        $category_count = db_num_rows($result);
        for ($i = 0; $i < $category_count; $i++) {
            $row = db_fetch_array($result);
            //pre_var_dump($row);
            $content[] = '<div class="portlet ui-helper-clearfix" id="' . $row['id'] . '">
			<div class="portlet-header">' . string_get_bug_view_link($row['id']) . ': ' . $row['summary'] . '</div>
			<div class="portlet-content">' . ($row['reporter_id'] ? 'Reporter: ' . user_get_name($row['reporter_id']) . BR : '') . ($row['handler_id'] ? 'Assigned: ' . user_get_name($row['handler_id']) . BR : '') . '</div></div>';
        }
        if ($row) {
            //pre_var_dump(array_keys($row));
        }
        return $content;
    }
 /**
  * Returns html string to display
  * @return string
  */
 public function html()
 {
     $t_html = $this->html_start();
     $t_html .= '<div class="action">' . sprintf(lang_get('timeline_issue_created'), user_get_name($this->user_id), string_get_bug_view_link($this->issue_id)) . '</div>';
     $t_html .= $this->html_end();
     return $t_html;
 }
/**
 * prepares the name of the user given the id.  also makes it an email link.
 * @param int $p_user_id
 * @return string
 */
function prepare_user_name($p_user_id)
{
    # Catch a user_id of NO_USER (like when a handler hasn't been assigned)
    if (NO_USER == $p_user_id) {
        return '';
    }
    $t_username = user_get_name($p_user_id);
    if (user_exists($p_user_id) && user_get_field($p_user_id, 'enabled')) {
        $t_username = string_display_line($t_username);
        // WK/BFE: Original-Zeile auskommentiert: , LB/BFE 2015
        //		return '<a href="' . string_sanitize_url( 'view_user_page.php?id=' . $p_user_id, true ) . '">' . $t_username . '</a>';
        // ersetzt durch: (Link auf view_user_page nur wenn globale Rolle mindestens $g_manage_user_threshold
        if (user_is_administrator(auth_get_current_user_id())) {
            return '<a href="' . string_sanitize_url('view_user_page.php?id=' . $p_user_id, true) . '">' . $t_username . '</a>';
        } else {
            return $t_username;
        }
        // WK/BFE: Ende der Modifikation
    } else {
        $t_result = '<font STYLE="text-decoration: line-through">';
        $t_result .= string_display_line($t_username);
        $t_result .= '</font>';
        return $t_result;
    }
}
 /**
  * Returns html string to display
  * @return string
  */
 public function html()
 {
     $t_string = $this->tag ? lang_get('timeline_issue_tagged') : lang_get('timeline_issue_untagged');
     $t_tag_row = tag_get_by_name($this->tag_name);
     $t_html = $this->html_start();
     $t_html .= '<div class="action">' . sprintf($t_string, user_get_name($this->user_id), string_get_bug_view_link($this->issue_id), $t_tag_row ? tag_get_link($t_tag_row) : $this->tag_name) . '</div>';
     $t_html .= $this->html_end();
     return $t_html;
 }
    function view_bug_attachment($p_event, $p_attachment)
    {
        //log_event( LOG_EMAIL_RECIPIENT, "event=$p_event params=".var_export($p_attachment, true) );
        require_once MANTIS_CORE . '/database_api.php';
        require_once MANTIS_CORE . '/user_api.php';
        $t_query = 'SELECT user_id
		                FROM {bug_file}
		                WHERE id=' . db_param();
        $t_db_result = db_query($t_query, array($p_attachment['id']), 1);
        $t_name = user_get_name(db_result($t_db_result));
        return ' <span class="underline">@' . $t_name . '</span>';
    }
 /**
  * Returns html string to display
  * @return string
  */
 public function html()
 {
     if ($this->user_id == $this->handler_id) {
         $t_string = sprintf(lang_get('timeline_issue_assigned_to_self'), user_get_name($this->user_id), string_get_bug_view_link($this->issue_id));
     } else {
         $t_string = sprintf(lang_get('timeline_issue_assigned'), user_get_name($this->user_id), string_get_bug_view_link($this->issue_id), user_get_name($this->handler_id));
     }
     $t_html = $this->html_start();
     $t_html .= '<div class="action">' . $t_string . '</div>';
     $t_html .= $this->html_end();
     return $t_html;
 }
Example #8
0
/**
 * prepares the name of the user given the id.  also makes it an email link.
 * @param int $p_user_id
 * @return string
 */
function prepare_user_name( $p_user_id ) {
	# Catch a user_id of NO_USER (like when a handler hasn't been assigned)
	if( NO_USER == $p_user_id ) {
		return '';
	}

	$t_username = user_get_name( $p_user_id );
	$t_username = string_display_line( $t_username );
	if( user_exists( $p_user_id ) && user_get_field( $p_user_id, 'enabled' ) ) {
		return '<a class="user" href="' . string_sanitize_url( 'view_user_page.php?id=' . $p_user_id, true ) . '">' . $t_username . '</a>';
	} else {
		return '<del class="user">' . $t_username . '</del>';
	}
}
/**
 * prepares the name of the user given the id.  also makes it an email link.
 * @param int $p_user_id
 * @return string
 */
function prepare_user_name($p_user_id)
{
    # Catch a user_id of NO_USER (like when a handler hasn't been assigned)
    if (NO_USER == $p_user_id) {
        return '';
    }
    $t_username = user_get_name($p_user_id);
    if (user_exists($p_user_id) && user_get_field($p_user_id, 'enabled')) {
        $t_username = string_display_line($t_username);
        return '<a href="' . string_sanitize_url('view_user_page.php?id=' . $p_user_id, true) . '">' . $t_username . '</a>';
    } else {
        $t_result = '<font STYLE="text-decoration: line-through">';
        $t_result .= string_display_line($t_username);
        $t_result .= '</font>';
        return $t_result;
    }
}
 /**
  * Builds notification emails for the selected customers about changes made in bugs reports they are linked to
  *
  * @param array $customer_ids the ids of the customer to notify
  * @param string $from the start of the interval
  * @param string $to the end of the interval
  *
  * @return array notified customers
  */
 static function buildNotificationEmails($customer_ids, $from, $to)
 {
     $emails = array();
     lang_push(plugin_config_get('email_notification_language'));
     $fromDate = self::startOfDay(strtotime($from));
     $toDate = self::endOfDay(strtotime($to));
     $changedBugIds = CustomerManagementDao::findAllChangedBugIds($customer_ids, $fromDate, $toDate);
     $dateFormat = config_get('short_date_format');
     foreach ($customer_ids as $customer_id) {
         $changesForCustomer = array();
         foreach ($changedBugIds as $changedBugId) {
             if ($changedBugId['customer_id'] == $customer_id) {
                 $changesForCustomer[] = array('bug' => bug_get($changedBugId['bug_id']));
             }
         }
         if (count($changesForCustomer) > 0) {
             $counter = 0;
             $text = '';
             foreach ($changesForCustomer as $changeForCustomer) {
                 $counter++;
                 $bugId = $changeForCustomer['bug']->id;
                 $text .= $counter . '. ';
                 $text .= sprintf(plugin_lang_get('email_notification_bug_header'), $changeForCustomer['bug']->id, $changeForCustomer['bug']->summary, date($dateFormat, $changeForCustomer['bug']->date_submitted), get_enum_element('status', $changeForCustomer['bug']->status));
                 $text .= "\n";
                 $reporterName = user_get_name($changeForCustomer['bug']->reporter_id);
                 $reporterEmail = user_get_email($changeForCustomer['bug']->reporter_id);
                 $text .= sprintf(plugin_lang_get('email_notification_bug_reported_by'), $reporterName, $reporterEmail);
                 $text .= "\n";
                 $text .= sprintf(plugin_lang_get('email_notification_bug_description'), $changeForCustomer['bug']->description);
                 $text .= "\n\n";
             }
             $customer = CustomerManagementDao::getCustomer($customer_id);
             $email = new EmailData();
             $email->email = $customer['email'];
             $email->subject = sprintf(plugin_lang_get('email_notification_title'), $customer['name'], $from, $to);
             $email->body = $text;
             $email->metadata['priority'] = config_get('mail_priority');
             $email->metadata['charset'] = 'utf-8';
             array_push($emails, $email);
         }
     }
     lang_pop();
     return $emails;
 }
Example #11
0
function prepare_user_name($p_user_id)
{
    # Catch a user_id of NO_USER (like when a handler hasn't been assigned)
    if (NO_USER == $p_user_id) {
        return '';
    }
    $t_username = user_get_name($p_user_id);
    if (user_exists($p_user_id) && user_get_field($p_user_id, 'enabled')) {
        $t_email = user_get_email($p_user_id);
        if (!is_blank($t_email)) {
            return prepare_email_link($t_email, $t_username);
        } else {
            return string_display($t_username);
        }
    } else {
        $t_result = '<font STYLE="text-decoration: line-through">';
        $t_result .= string_display($t_username);
        $t_result .= '</font>';
        return $t_result;
    }
}
 /**
  * Returns html string to display
  * @return string
  */
 public function html()
 {
     $t_resolved = config_get('bug_resolved_status_threshold');
     $t_closed = config_get('bug_closed_status_threshold');
     if ($this->old_status < $t_closed && $this->new_status >= $t_closed) {
         $t_string = sprintf(lang_get('timeline_issue_closed'), user_get_name($this->user_id), string_get_bug_view_link($this->issue_id));
     } else {
         if ($this->old_status < $t_resolved && $this->new_status >= $t_resolved) {
             $t_string = sprintf(lang_get('timeline_issue_resolved'), user_get_name($this->user_id), string_get_bug_view_link($this->issue_id));
         } else {
             if ($this->old_status >= $t_resolved && $this->new_status < $t_resolved) {
                 $t_string = sprintf(lang_get('timeline_issue_reopened'), user_get_name($this->user_id), string_get_bug_view_link($this->issue_id));
             } else {
                 return '';
             }
         }
     }
     $t_html = $this->html_start();
     $t_html .= '<div class="action">' . $t_string . '</div>';
     $t_html .= $this->html_end();
     return $t_html;
 }
Example #13
0
     }
     $writer->endElement();
     # custom_fields
 }
 # fetch and export bugnotes
 $t_bugnotes = bugnote_get_all_bugnotes($t_row->id);
 if (is_array($t_bugnotes) && count($t_bugnotes) > 0) {
     $writer->startElement('bugnotes');
     foreach ($t_bugnotes as $t_bugnote) {
         $writer->startElement('bugnote');
         # id
         $writer->writeElement('id', $t_bugnote->id);
         # reporter
         $writer->startElement('reporter');
         $writer->writeAttribute('id', $t_bugnote->reporter_id);
         $writer->text(user_get_name($t_bugnote->reporter_id));
         $writer->endElement();
         # bug note
         $writer->writeElement('note', $t_bugnote->note);
         # view state
         $writer->startElement('view_state');
         $writer->writeAttribute('id', $t_bugnote->view_state);
         $writer->text(get_enum_element('view_state', $t_bugnote->view_state));
         $writer->endElement();
         # date submitted
         $writer->writeElement('date_submitted', $t_bugnote->date_submitted);
         # last modified
         $writer->writeElement('last_modified', $t_bugnote->last_modified);
         # note type
         $writer->writeElement('note_type', $t_bugnote->note_type);
         # note attr
 name="name" value="<?php 
echo $t_tag_row['name'];
?>
"/></td>
	<td><?php 
if (access_has_global_level(config_get('tag_edit_threshold'))) {
    if (ON == config_get('use_javascript')) {
        $t_username = prepare_user_name($t_tag_row['user_id']);
        echo ajax_click_to_edit($t_username, 'user_id', 'entrypoint=user_combobox&amp;user_id=' . $t_tag_row['user_id'] . '&amp;access_level=' . config_get('tag_create_threshold'));
    } else {
        echo '<select ', helper_get_tab_index(), ' name="user_id">';
        print_user_option_list($t_tag_row['user_id'], ALL_PROJECTS, config_get('tag_create_threshold'));
        echo '</select>';
    }
} else {
    echo user_get_name($t_tag_row['user_id']);
}
?>
</td>
	<td><?php 
echo print_date(config_get('normal_date_format'), db_unixtimestamp($t_tag_row['date_created']));
?>
 </td>
	<td><?php 
echo print_date(config_get('normal_date_format'), db_unixtimestamp($t_tag_row['date_updated']));
?>
 </td>
</tr>

<!-- spacer -->
<tr class="spacer">
Example #15
0
/**
 * returns the handler name corresponding to the supplied bug
 * @param object $p_bug the bug
 * @return string formatted user name
 * @access public
 */
function csv_format_handler_id($p_bug)
{
    if ($p_bug->handler_id > 0) {
        return csv_escape_string(user_get_name($p_bug->handler_id));
    }
}
Example #16
0
if ($_REQUEST['mode'] == "player" && $_ADMIN->isCSR()) {
    $c .= "<h1>Player Administration</h1>";
    #$DBc_char = new mySQL($_CONF['mysql_error']);
    #$DBc_char->connect($_CONF['char_mysql_server'],$_CONF['char_mysql_user'],$_CONF['char_mysql_pass'],$_CONF['char_mysql_database']);
    $DBc_char = ryDB::getInstance("webig");
    //menu
    require_once "include/adm_render_csr.php";
    if (!is_user($_REQUEST['pid'])) {
        // no user ID
        $c .= csr_render_find_player();
    } else {
        $user = array();
        $user['id'] = $_REQUEST['pid'];
        $user['lang'] = 'en';
        $dta = user_get_data($_REQUEST['pid']);
        $user['char_name'] = user_get_name($_REQUEST['pid']);
        $user['race'] = substr($dta['race'], 2);
        $user['civ'] = substr($dta['civilisation'], 2);
        $user['cult'] = substr($dta['cult'], 2);
        $_USER = new RyzomUser($user);
        $menu = new AchMenu($_REQUEST['cat']);
        $open = $menu->getOpenCat();
        if ($open != 0) {
            if ($_REQUEST['cult']) {
                $cult = $_REQUEST['cult'];
                $_SESSION['cult'] = $cult;
            } elseif ($_SESSION['cult']) {
                $cult = $_SESSION['cult'];
            } else {
                $cult = $_USER->getCult();
            }
Example #17
0
if (OFF == plugin_config_get('worklog_view_window')) {
    html_page_top2();
}
$f_id = gpc_get_int('f_id');
# Select the faq posts
$query = "SELECT *, UNIX_TIMESTAMP(date_posted) as date_posted\n\t\t\tFROM {$g_mantis_worklog_table}\n\t\t\tWHERE  id='{$f_id}'";
$result = db_query_bound($query);
$worklog_count = db_num_rows($result);
# Loop through results
for ($i = 0; $i < $worklog_count; $i++) {
    $row = db_fetch_array($result);
    extract($row, EXTR_PREFIX_ALL, "v");
    $v_headline = string_display($v_headline);
    $v_content = string_display_links($v_content);
    $v_date_posted = date($g_normal_date_format, $v_date_posted);
    $t_poster_name = user_get_name($v_poster_id);
    $t_poster_email = user_get_email($v_poster_id);
    $t_project_name = " ";
    if ($v_project_id != 0) {
        $t_project_name = project_get_field($v_project_id, "name");
    }
    ?>
<p>
<div align="center">
<table class="width75" cellspacing="0">
<tr>
	<td class="worklog-heading">
		<span class="worklog-subject"><?php 
    echo '[' . worklog_type_display($v_log_type) . ']' . $v_subject;
    ?>
</span> -
for ($i = 0; $i < $t_issues_count; $i++) {
    $t_bug = $t_issues[$i];
    $about = $link = $t_path . "view.php?id=" . $t_bug->id;
    $title = bug_format_id($t_bug->id) . ': ' . $t_bug->summary;
    if ($t_bug->view_state == VS_PRIVATE) {
        $title .= ' [' . lang_get('private') . ']';
    }
    $description = string_rss_links($t_bug->description);
    # subject is category.
    $subject = category_full_name($t_bug->category_id, false);
    # optional DC value
    $date = $t_bug->last_updated;
    # author of item
    $author = '';
    if (access_has_global_level(config_get('show_user_email_threshold'))) {
        $t_author_name = user_get_name($t_bug->reporter_id);
        $t_author_email = user_get_field($t_bug->reporter_id, 'email');
        if (!is_blank($t_author_email)) {
            if (!is_blank($t_author_name)) {
                $author = $t_author_name . ' <' . $t_author_email . '>';
            } else {
                $author = $t_author_email;
            }
        }
    }
    # $comments = 'http://www.example.com/sometext.php?somevariable=somevalue&comments=1';	# url to comment page rss 2.0 value
    $comments = $t_path . 'view.php?id=' . $t_bug->id . '#bugnotes';
    # optional mod_im value for dispaying a different pic for every item
    $image = '';
    $rssfile->addRSSItem($about, $title, $link, $description, $subject, $date, $author, $comments, $image);
}
Example #19
0
function helper_get_default_export_filename($p_extension_with_dot, $p_prefix = '', $p_suffix = '')
{
    $t_filename = $p_prefix;
    $t_current_project_id = helper_get_current_project();
    if (ALL_PROJECTS == $t_current_project_id) {
        $t_filename .= user_get_name(auth_get_current_user_id());
    } else {
        $t_filename .= project_get_field($t_current_project_id, 'name');
    }
    return $t_filename . $p_suffix . $p_extension_with_dot;
}
 name="name" value="<?php 
echo $t_name;
?>
"/></td>
	<td><?php 
if (access_has_global_level(config_get('tag_edit_threshold'))) {
    if (ON == config_get('use_javascript')) {
        $t_username = prepare_user_name($t_tag_row['user_id']);
        echo ajax_click_to_edit($t_username, 'user_id', 'entrypoint=user_combobox&user_id=' . $t_tag_row['user_id'] . '&access_level=' . config_get('tag_create_threshold'));
    } else {
        echo '<select ', helper_get_tab_index(), ' name="user_id">';
        print_user_option_list($t_tag_row['user_id'], ALL_PROJECTS, config_get('tag_create_threshold'));
        echo '</select>';
    }
} else {
    echo string_display_line(user_get_name($t_tag_row['user_id']));
}
?>
</td>
	<td><?php 
echo date(config_get('normal_date_format'), $t_tag_row['date_created']);
?>
 </td>
	<td><?php 
echo date(config_get('normal_date_format'), $t_tag_row['date_updated']);
?>
 </td>
</tr>

<!-- spacer -->
<tr class="spacer">
Example #21
0
    echo lang_get('actions');
    ?>
			</td>
		</tr>
<?php 
}
foreach ($t_categories as $t_category) {
    $t_id = $t_category['id'];
    if ($t_category['project_id'] != $f_project_id) {
        $t_inherited = true;
    } else {
        $t_inherited = false;
    }
    $t_name = $t_category['name'];
    if (NO_USER != $t_category['user_id'] && user_exists($t_category['user_id'])) {
        $t_user_name = user_get_name($t_category['user_id']);
    } else {
        $t_user_name = '';
    }
    ?>
<!-- Repeated Info Row -->
		<tr <?php 
    echo helper_alternate_class();
    ?>
>
			<td>
				<?php 
    echo string_display(category_full_name($t_category['id'], $t_inherited, $f_project_id));
    ?>
			</td>
			<td>
Example #22
0
/**
 * Print reporter effectiveness report
 *
 * @param string $p_severity_enum_string   Severity enumeration string.
 * @param string $p_resolution_enum_string Resolution enumeration string.
 * @return void
 */
function summary_print_reporter_effectiveness($p_severity_enum_string, $p_resolution_enum_string)
{
    $t_reporter_summary_limit = config_get('reporter_summary_limit');
    $t_project_id = helper_get_current_project();
    $t_severity_multipliers = config_get('severity_multipliers');
    $t_resolution_multipliers = config_get('resolution_multipliers');
    # Get the severity values to use
    $c_sev_s = MantisEnum::getValues($p_severity_enum_string);
    $t_enum_sev_count = count($c_sev_s);
    # Get the resolution values to use
    $c_res_s = MantisEnum::getValues($p_resolution_enum_string);
    # Checking if it's a per project statistic or all projects
    $t_specific_where = helper_project_specific_where($t_project_id);
    if (' 1<>1' == $t_specific_where) {
        return;
    }
    # Get all of the bugs and split them up into an array
    $t_query = 'SELECT COUNT(id) as bugcount, reporter_id, resolution, severity
				FROM {bug}
				WHERE ' . $t_specific_where . '
				GROUP BY reporter_id, resolution, severity';
    $t_result = db_query($t_query);
    $t_reporter_ressev_arr = array();
    $t_reporter_bugcount_arr = array();
    $t_arr = db_fetch_array($t_result);
    while ($t_arr) {
        if (!isset($t_reporter_ressev_arr[$t_arr['reporter_id']])) {
            $t_reporter_ressev_arr[$t_arr['reporter_id']] = array();
            $t_reporter_bugcount_arr[$t_arr['reporter_id']] = 0;
        }
        if (!isset($t_reporter_ressev_arr[$t_arr['reporter_id']][$t_arr['severity']])) {
            $t_reporter_ressev_arr[$t_arr['reporter_id']][$t_arr['severity']] = array();
            $t_reporter_ressev_arr[$t_arr['reporter_id']][$t_arr['severity']]['total'] = 0;
        }
        if (!isset($t_reporter_ressev_arr[$t_arr['reporter_id']][$t_arr['severity']][$t_arr['resolution']])) {
            $t_reporter_ressev_arr[$t_arr['reporter_id']][$t_arr['severity']][$t_arr['resolution']] = 0;
        }
        $t_reporter_ressev_arr[$t_arr['reporter_id']][$t_arr['severity']][$t_arr['resolution']] += $t_arr['bugcount'];
        $t_reporter_ressev_arr[$t_arr['reporter_id']][$t_arr['severity']]['total'] += $t_arr['bugcount'];
        $t_reporter_bugcount_arr[$t_arr['reporter_id']] += $t_arr['bugcount'];
        $t_arr = db_fetch_array($t_result);
    }
    # Sort our total bug count array so that the reporters with the highest number of bugs are listed first,
    arsort($t_reporter_bugcount_arr);
    $t_row_count = 0;
    # We now have a multi dimensional array of users, resolutions and severities, with the
    # value of each resolution and severity for each user
    foreach ($t_reporter_bugcount_arr as $t_reporter_id => $t_total_user_bugs) {
        # Limit the number of reporters listed
        if ($t_row_count > $t_reporter_summary_limit) {
            break;
        }
        # Only print reporters who have reported at least one bug. This helps
        # prevent divide by zeroes, showing reporters not on this project, and showing
        # users that aren't actually reporters...
        if ($t_total_user_bugs > 0) {
            $t_arr2 = $t_reporter_ressev_arr[$t_reporter_id];
            echo '<tr>';
            $t_row_count++;
            echo '<td>';
            echo string_display_line(user_get_name($t_reporter_id));
            echo '</td>';
            $t_total_severity = 0;
            $t_total_errors = 0;
            for ($j = 0; $j < $t_enum_sev_count; $j++) {
                if (!isset($t_arr2[$c_sev_s[$j]])) {
                    continue;
                }
                $t_sev_bug_count = $t_arr2[$c_sev_s[$j]]['total'];
                $t_sev_mult = 1;
                if ($t_severity_multipliers[$c_sev_s[$j]]) {
                    $t_sev_mult = $t_severity_multipliers[$c_sev_s[$j]];
                }
                if ($t_sev_bug_count > 0) {
                    $t_total_severity += $t_sev_bug_count * $t_sev_mult;
                }
                foreach ($t_resolution_multipliers as $t_res => $t_res_mult) {
                    if (isset($t_arr2[$c_sev_s[$j]][$t_res])) {
                        $t_total_errors += $t_sev_mult * $t_res_mult;
                    }
                }
            }
            echo '<td class="right">' . $t_total_severity . '</td>';
            echo '<td class="right">' . $t_total_errors . '</td>';
            printf('<td class="right">%d</td>', $t_total_severity - $t_total_errors);
            echo '</tr>';
        }
    }
}
Example #23
0
/**
 * This populates an option list with the appropriate users by access level
 * @todo from print_reporter_option_list
 * @param integer|array $p_user_id    A user identifier or a list of them.
 * @param integer       $p_project_id A project identifier.
 * @param integer       $p_access     An access level.
 * @return void
 */
function print_user_option_list($p_user_id, $p_project_id = null, $p_access = ANYBODY)
{
    $t_current_user = auth_get_current_user_id();
    if (null === $p_project_id) {
        $p_project_id = helper_get_current_project();
    }
    if ($p_project_id === ALL_PROJECTS) {
        $t_projects = user_get_accessible_projects($t_current_user);
        # Get list of users having access level for all accessible projects
        $t_users = array();
        foreach ($t_projects as $t_project_id) {
            $t_project_users_list = project_get_all_user_rows($t_project_id, $p_access);
            # Do a 'smart' merge of the project's user list, into an
            # associative array (to remove duplicates)
            foreach ($t_project_users_list as $t_id => $t_user) {
                $t_users[$t_id] = $t_user;
            }
            # Clear the array to release memory
            unset($t_project_users_list);
        }
        unset($t_projects);
    } else {
        $t_users = project_get_all_user_rows($p_project_id, $p_access);
    }
    # Add the specified user ID to the list
    # If we have an array of user IDs, then we've been called from a filter
    # so don't add anything
    if (!is_array($p_user_id) && $p_user_id != NO_USER && !array_key_exists($p_user_id, $t_users)) {
        $t_row = user_get_row($p_user_id);
        if ($t_row === false) {
            # User doesn't exist - create a dummy record for display purposes
            $t_name = user_get_name($p_user_id);
            $t_row = array('id' => $p_user_id, 'username' => $t_name, 'realname' => $t_name);
        }
        $t_users[$p_user_id] = $t_row;
    }
    $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_key => $t_user) {
        $t_user_name = string_attribute($t_user['username']);
        $t_sort_name = utf8_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(' ', 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);
    unset($t_sort);
    $t_count = count($t_users);
    for ($i = 0; $i < $t_count; $i++) {
        $t_row = $t_users[$i];
        echo '<option value="' . $t_row['id'] . '" ';
        check_selected($p_user_id, (int) $t_row['id']);
        echo '>' . $t_display[$i] . '</option>';
    }
}
			</tr>
		</thead>

		<tbody>
<?php 
# Pre-generate a form security token to avoid performance issues when the
# db contains a large number of configurations
$t_form_security_token = form_security_token('adm_config_delete');
while ($t_row = db_fetch_array($t_result)) {
    extract($t_row, EXTR_PREFIX_ALL, 'v');
    ?>
<!-- Repeated Info Rows -->
			<tr width="100%">
				<td>
					<?php 
    echo $v_user_id == 0 ? lang_get('all_users') : string_display_line(user_get_name($v_user_id));
    ?>
				</td>
				<td><?php 
    echo string_display_line(project_get_name($v_project_id, false));
    ?>
</td>
				<td><?php 
    echo string_display_line($v_config_id);
    ?>
</td>
				<td><?php 
    echo string_display_line(get_config_type($v_type));
    ?>
</td>
				<td style="overflow-x:auto;"><?php 
function show_revision($t_revision)
{
    static $s_can_drop = null;
    static $s_drop_token = null;
    static $s_user_access = null;
    if (is_null($s_can_drop)) {
        $s_can_drop = access_has_bug_level(config_get('bug_revision_drop_threshold'), $t_revision['bug_id']);
        $s_drop_token = form_security_param('bug_revision_drop');
    }
    switch ($t_revision['type']) {
        case REV_DESCRIPTION:
            $t_label = lang_get('description');
            break;
        case REV_STEPS_TO_REPRODUCE:
            $t_label = lang_get('steps_to_reproduce');
            break;
        case REV_ADDITIONAL_INFO:
            $t_label = lang_get('additional_information');
            break;
        case REV_BUGNOTE:
            if (is_null($s_user_access)) {
                $s_user_access = access_has_bug_level(config_get('private_bugnote_threshold'), $t_revision['bug_id']);
            }
            if (!$s_user_access) {
                return null;
            }
            $t_label = lang_get('bugnote');
            break;
        default:
            $t_label = '';
    }
    $t_by_string = sprintf(lang_get('revision_by'), string_display_line(date(config_get('normal_date_format'), $t_revision['timestamp'])), string_display_line(user_get_name($t_revision['user_id'])));
    ?>
<tr class="spacer"><td><a id="revision-<?php 
    echo $t_revision['id'];
    ?>
"></a></td></tr>

<tr <?php 
    echo helper_alternate_class();
    ?>
>
<th class="category"><?php 
    echo lang_get('revision');
    ?>
</th>
<td colspan="2"><?php 
    echo $t_by_string;
    ?>
</td>
<td class="center" width="5%">
<?php 
    if ($s_can_drop) {
        print_bracket_link('bug_revision_drop.php?id=' . $t_revision['id'] . $s_drop_token, lang_get('revision_drop'));
    }
    ?>
</tr>

<tr <?php 
    echo helper_alternate_class();
    ?>
>
<th class="category"><?php 
    echo $t_label;
    ?>
</th>
<td colspan="3"><?php 
    echo string_display_links($t_revision['value']);
    ?>
</td>
</tr>

	<?php 
}
					</td>
				</tr>
			</table>
		</td>
		<td class="nopad" width="85%">
			<table class="hide" cellspacing="1">
			<tr>
				<td class="print">
					<?php 
        switch ($t_row['note_type']) {
            case REMINDER:
                echo '<div class="italic">' . lang_get('reminder_sent_to') . ': ';
                $t_note_attr = utf8_substr($t_row['note_attr'], 1, utf8_strlen($t_row['note_attr']) - 2);
                $t_to = array();
                foreach (explode('|', $t_note_attr) as $t_recipient) {
                    $t_to[] = string_display_line(user_get_name($t_recipient));
                }
                echo implode(', ', $t_to) . '</div><br />';
            default:
                echo $t_note;
        }
        ?>
				</td>
			</tr>
			</table>
		</td>
	</tr>
	<?php 
    }
    # end for loop
}
Example #27
0
/**
 * Prints the filter selection area for both the bug list view screen and
 * the bug list print screen. This function was an attempt to make it easier to
 * add new filters and rearrange them on screen for both pages.
 * @param integer $p_page_number Page number.
 * @param boolean $p_for_screen  Whether output is for screen view.
 * @param boolean $p_expanded    Whether to display expanded.
 * @return void
 */
function filter_draw_selection_area2($p_page_number, $p_for_screen = true, $p_expanded = true)
{
    $t_form_name_suffix = $p_expanded ? '_open' : '_closed';
    $t_filter = current_user_get_bug_filter();
    $t_filter = filter_ensure_valid_filter($t_filter === false ? array() : $t_filter);
    $t_project_id = helper_get_current_project();
    $t_page_number = (int) $p_page_number;
    $t_view_type = $t_filter['_view_type'];
    $t_tdclass = 'small-caption';
    $t_trclass = 'row-category2';
    $t_action = 'view_all_set.php?f=3';
    if ($p_for_screen == false) {
        $t_tdclass = 'print';
        $t_trclass = '';
        $t_action = 'view_all_set.php';
    }
    ?>

	<div class="filter-box">
		<form method="post" name="filters<?php 
    echo $t_form_name_suffix;
    ?>
" id="filters_form<?php 
    echo $t_form_name_suffix;
    ?>
" action="<?php 
    echo $t_action;
    ?>
">
		<?php 
    # CSRF protection not required here - form does not result in modifications
    ?>
		<input type="hidden" name="type" value="1" />
		<?php 
    if ($p_for_screen == false) {
        echo '<input type="hidden" name="print" value="1" />';
        echo '<input type="hidden" name="offset" value="0" />';
    }
    ?>
		<input type="hidden" name="page_number" value="<?php 
    echo $t_page_number;
    ?>
" />
		<input type="hidden" name="view_type" value="<?php 
    echo $t_view_type;
    ?>
" />
		<?php 
    $t_filter_cols = config_get('filter_custom_fields_per_row');
    if ($p_expanded) {
        ?>
		<table width="100%" cellspacing="1">
		<?php 
        $t_custom_cols = $t_filter_cols;
        $t_current_user_access_level = current_user_get_access_level();
        $t_accessible_custom_fields_ids = array();
        $t_accessible_custom_fields_names = array();
        $t_accessible_custom_fields_values = array();
        $t_num_custom_rows = 0;
        $t_per_row = 0;
        if (ON == config_get('filter_by_custom_fields')) {
            $t_custom_fields = custom_field_get_linked_ids($t_project_id);
            foreach ($t_custom_fields as $t_cfid) {
                $t_field_info = custom_field_cache_row($t_cfid, true);
                if ($t_field_info['access_level_r'] <= $t_current_user_access_level && $t_field_info['filter_by']) {
                    $t_accessible_custom_fields_ids[] = $t_cfid;
                    $t_accessible_custom_fields_names[] = $t_field_info['name'];
                    $t_accessible_custom_fields_types[] = $t_field_info['type'];
                    $t_accessible_custom_fields_values[] = custom_field_distinct_values($t_field_info);
                }
            }
            if (count($t_accessible_custom_fields_ids) > 0) {
                $t_per_row = config_get('filter_custom_fields_per_row');
                $t_num_custom_rows = ceil(count($t_accessible_custom_fields_ids) / $t_per_row);
            }
        }
        $t_filters_url = 'view_filters_page.php?for_screen=' . $p_for_screen;
        if ('advanced' == $t_view_type) {
            $t_filters_url = $t_filters_url . '&amp;view_type=advanced';
        }
        $t_filters_url = $t_filters_url . '&amp;target_field=';
        $t_show_product_version = version_should_show_product_version($t_project_id);
        $t_show_build = $t_show_product_version && config_get('enable_product_build') == ON;
        # overload handler_id setting if user isn't supposed to see them (ref #6189)
        if (!access_has_any_project(config_get('view_handler_threshold'))) {
            $t_filter[FILTER_PROPERTY_HANDLER_ID] = array(META_FILTER_ANY);
        }
        $t_dynamic_filter_expander_class = config_get('use_dynamic_filters') ? ' class="dynamic-filter-expander"' : '';
        ?>

		<tr <?php 
        echo 'class="' . $t_trclass . '"';
        ?>
>
			<td class="small-caption">
				<a href="<?php 
        echo $t_filters_url . FILTER_PROPERTY_REPORTER_ID . '[]';
        ?>
" id="reporter_id_filter"<?php 
        echo $t_dynamic_filter_expander_class;
        ?>
><?php 
        echo lang_get('reporter_label');
        ?>
</a>
			</td>
			<td class="small-caption">
				<a href="<?php 
        echo $t_filters_url . FILTER_PROPERTY_MONITOR_USER_ID . '[]';
        ?>
" id="user_monitor_filter"<?php 
        echo $t_dynamic_filter_expander_class;
        ?>
><?php 
        echo lang_get('monitored_by_label');
        ?>
</a>
			</td>
			<td class="small-caption">
				<a href="<?php 
        echo $t_filters_url . FILTER_PROPERTY_HANDLER_ID . '[]';
        ?>
" id="handler_id_filter"<?php 
        echo $t_dynamic_filter_expander_class;
        ?>
><?php 
        echo lang_get('assigned_to_label');
        ?>
</a>
			</td>
			<td colspan="2" class="small-caption">
				<a href="<?php 
        echo $t_filters_url . FILTER_PROPERTY_CATEGORY_ID . '[]';
        ?>
" id="show_category_filter"<?php 
        echo $t_dynamic_filter_expander_class;
        ?>
><?php 
        echo lang_get('category_label');
        ?>
</a>
			</td>
			<td class="small-caption">
				<a href="<?php 
        echo $t_filters_url . FILTER_PROPERTY_SEVERITY . '[]';
        ?>
" id="show_severity_filter"<?php 
        echo $t_dynamic_filter_expander_class;
        ?>
><?php 
        echo lang_get('severity_label');
        ?>
</a>
			</td>
			<td class="small-caption">
				<a href="<?php 
        echo $t_filters_url . FILTER_PROPERTY_RESOLUTION . '[]';
        ?>
" id="show_resolution_filter"<?php 
        echo $t_dynamic_filter_expander_class;
        ?>
><?php 
        echo lang_get('resolution_label');
        ?>
</a>
			</td>
			<td class="small-caption">
				<?php 
        if (ON == config_get('enable_profiles')) {
            ?>
					<a href="<?php 
            echo $t_filters_url . FILTER_PROPERTY_PROFILE_ID . '[]';
            ?>
" id="show_profile_filter"<?php 
            echo $t_dynamic_filter_expander_class;
            ?>
><?php 
            echo lang_get('profile_label');
            ?>
</a>
				<?php 
        }
        ?>
			</td>
			<?php 
        if ($t_filter_cols > 8) {
            echo '<td class="small-caption" colspan="' . ($t_filter_cols - 8) . '">&#160;</td>';
        }
        ?>
		</tr>

		<tr class="row-1">
			<td class="small-caption" id="reporter_id_filter_target">
							<?php 
        $t_output = '';
        $t_any_found = false;
        if (count($t_filter[FILTER_PROPERTY_REPORTER_ID]) == 0) {
            echo lang_get('any');
        } else {
            $t_first_flag = true;
            foreach ($t_filter[FILTER_PROPERTY_REPORTER_ID] as $t_current) {
                $t_this_name = '';
                echo '<input type="hidden" name="', FILTER_PROPERTY_REPORTER_ID, '[]" value="', string_attribute($t_current), '" />';
                if (filter_field_is_any($t_current)) {
                    $t_any_found = true;
                } else {
                    if (filter_field_is_myself($t_current)) {
                        if (access_has_project_level(config_get('report_bug_threshold'))) {
                            $t_this_name = '[' . lang_get('myself') . ']';
                        } else {
                            $t_any_found = true;
                        }
                    } else {
                        if (filter_field_is_none($t_current)) {
                            $t_this_name = lang_get('none');
                        } else {
                            $t_this_name = user_get_name($t_current);
                        }
                    }
                }
                if ($t_first_flag != true) {
                    $t_output = $t_output . '<br />';
                } else {
                    $t_first_flag = false;
                }
                $t_output = $t_output . string_display_line($t_this_name);
            }
            if (true == $t_any_found) {
                echo lang_get('any');
            } else {
                echo $t_output;
            }
        }
        ?>
			</td>
			<td class="small-caption" id="user_monitor_filter_target">
		<?php 
        $t_output = '';
        $t_any_found = false;
        if (count($t_filter[FILTER_PROPERTY_MONITOR_USER_ID]) == 0) {
            echo lang_get('any');
        } else {
            $t_first_flag = true;
            foreach ($t_filter[FILTER_PROPERTY_MONITOR_USER_ID] as $t_current) {
                echo '<input type="hidden" name="', FILTER_PROPERTY_MONITOR_USER_ID, '[]" value="', string_attribute($t_current), '" />';
                $t_this_name = '';
                if (filter_field_is_any($t_current)) {
                    $t_any_found = true;
                } else {
                    if (filter_field_is_myself($t_current)) {
                        if (access_has_project_level(config_get('monitor_bug_threshold'))) {
                            $t_this_name = '[' . lang_get('myself') . ']';
                        } else {
                            $t_any_found = true;
                        }
                    } else {
                        $t_this_name = user_get_name($t_current);
                    }
                }
                if ($t_first_flag != true) {
                    $t_output = $t_output . '<br />';
                } else {
                    $t_first_flag = false;
                }
                $t_output = $t_output . string_display_line($t_this_name);
            }
            if (true == $t_any_found) {
                echo lang_get('any');
            } else {
                echo string_display($t_output);
            }
        }
        ?>
			</td>
			<td class="small-caption" id="handler_id_filter_target">
							<?php 
        $t_output = '';
        $t_any_found = false;
        if (count($t_filter[FILTER_PROPERTY_HANDLER_ID]) == 0) {
            echo lang_get('any');
        } else {
            $t_first_flag = true;
            foreach ($t_filter[FILTER_PROPERTY_HANDLER_ID] as $t_current) {
                echo '<input type="hidden" name="', FILTER_PROPERTY_HANDLER_ID, '[]" value="', string_attribute($t_current), '" />';
                $t_this_name = '';
                if (filter_field_is_none($t_current)) {
                    $t_this_name = lang_get('none');
                } else {
                    if (filter_field_is_any($t_current)) {
                        $t_any_found = true;
                    } else {
                        if (filter_field_is_myself($t_current)) {
                            if (access_has_project_level(config_get('handle_bug_threshold'))) {
                                $t_this_name = '[' . lang_get('myself') . ']';
                            } else {
                                $t_any_found = true;
                            }
                        } else {
                            $t_this_name = user_get_name($t_current);
                        }
                    }
                }
                if ($t_first_flag != true) {
                    $t_output = $t_output . '<br />';
                } else {
                    $t_first_flag = false;
                }
                $t_output = $t_output . string_display_line($t_this_name);
            }
            if (true == $t_any_found) {
                echo lang_get('any');
            } else {
                echo string_display($t_output);
            }
        }
        ?>
			</td>
			<td colspan="2" class="small-caption" id="show_category_filter_target">
		<?php 
        $t_output = '';
        $t_any_found = false;
        if (count($t_filter[FILTER_PROPERTY_CATEGORY_ID]) == 0) {
            echo lang_get('any');
        } else {
            $t_first_flag = true;
            foreach ($t_filter[FILTER_PROPERTY_CATEGORY_ID] as $t_current) {
                echo '<input type="hidden" name="', FILTER_PROPERTY_CATEGORY_ID, '[]" value="', string_attribute($t_current), '" />';
                $t_this_string = '';
                if (filter_field_is_any($t_current)) {
                    $t_any_found = true;
                } else {
                    $t_this_string = $t_current;
                }
                if ($t_first_flag != true) {
                    $t_output = $t_output . '<br />';
                } else {
                    $t_first_flag = false;
                }
                $t_output = $t_output . string_display_line($t_this_string);
            }
            if (true == $t_any_found) {
                echo lang_get('any');
            } else {
                echo $t_output;
            }
        }
        ?>
			</td>
			<td class="small-caption" id="show_severity_filter_target">
		<?php 
        $t_output = '';
        $t_any_found = false;
        if (count($t_filter[FILTER_PROPERTY_SEVERITY]) == 0) {
            echo lang_get('any');
        } else {
            $t_first_flag = true;
            foreach ($t_filter[FILTER_PROPERTY_SEVERITY] as $t_current) {
                echo '<input type="hidden" name="', FILTER_PROPERTY_SEVERITY, '[]" value="', string_attribute($t_current), '" />';
                $t_this_string = '';
                if (filter_field_is_any($t_current)) {
                    $t_any_found = true;
                } else {
                    $t_this_string = get_enum_element('severity', $t_current);
                }
                if ($t_first_flag != true) {
                    $t_output = $t_output . '<br />';
                } else {
                    $t_first_flag = false;
                }
                $t_output = $t_output . string_display_line($t_this_string);
            }
            if (true == $t_any_found) {
                echo lang_get('any');
            } else {
                echo $t_output;
            }
        }
        ?>
			</td>
			<td class="small-caption" id="show_resolution_filter_target">
		<?php 
        $t_output = '';
        $t_any_found = false;
        if (count($t_filter[FILTER_PROPERTY_RESOLUTION]) == 0) {
            echo lang_get('any');
        } else {
            $t_first_flag = true;
            foreach ($t_filter[FILTER_PROPERTY_RESOLUTION] as $t_current) {
                echo '<input type="hidden" name="', FILTER_PROPERTY_RESOLUTION, '[]" value="', string_attribute($t_current), '" />';
                $t_this_string = '';
                if (filter_field_is_any($t_current)) {
                    $t_any_found = true;
                } else {
                    $t_this_string = get_enum_element('resolution', $t_current);
                }
                if ($t_first_flag != true) {
                    $t_output = $t_output . '<br />';
                } else {
                    $t_first_flag = false;
                }
                $t_output = $t_output . string_display_line($t_this_string);
            }
            if (true == $t_any_found) {
                echo lang_get('any');
            } else {
                echo $t_output;
            }
        }
        ?>
			</td>
			<?php 
        if (ON == config_get('enable_profiles')) {
            ?>
			<td class="small-caption" id="show_profile_filter_target">
		<?php 
            $t_output = '';
            $t_any_found = false;
            if (count($t_filter[FILTER_PROPERTY_PROFILE_ID]) == 0) {
                echo lang_get('any');
            } else {
                $t_first_flag = true;
                foreach ($t_filter[FILTER_PROPERTY_PROFILE_ID] as $t_current) {
                    echo '<input type="hidden" name="', FILTER_PROPERTY_PROFILE_ID, '[]" value="', string_attribute($t_current), '" />';
                    $t_this_string = '';
                    if (filter_field_is_any($t_current)) {
                        $t_any_found = true;
                    } else {
                        $t_profile = profile_get_row_direct($t_current);
                        $t_this_string = $t_profile['platform'] . ' ' . $t_profile['os'] . ' ' . $t_profile['os_build'];
                    }
                    if ($t_first_flag != true) {
                        $t_output = $t_output . '<br />';
                    } else {
                        $t_first_flag = false;
                    }
                    $t_output = $t_output . string_display_line($t_this_string);
                }
                if (true == $t_any_found) {
                    echo lang_get('any');
                } else {
                    echo $t_output;
                }
            }
            ?>
			</td>
			<?php 
        } else {
            ?>
				<td></td>
			<?php 
        }
        if ($t_filter_cols > 8) {
            echo '<td class="small-caption" colspan="' . ($t_filter_cols - 8) . '">&#160;</td>';
        }
        ?>
		</tr>
		<tr <?php 
        echo 'class="' . $t_trclass . '"';
        ?>
>
			<td class="small-caption">
				<a href="<?php 
        echo $t_filters_url . FILTER_PROPERTY_STATUS . '[]';
        ?>
" id="show_status_filter"<?php 
        echo $t_dynamic_filter_expander_class;
        ?>
><?php 
        echo lang_get('status_label');
        ?>
</a>
			</td>
			<td class="small-caption">
				<?php 
        if ('simple' == $t_view_type) {
            ?>
					<a href="<?php 
            echo $t_filters_url . FILTER_PROPERTY_HIDE_STATUS . '[]';
            ?>
" id="hide_status_filter"<?php 
            echo $t_dynamic_filter_expander_class;
            ?>
><?php 
            echo lang_get('hide_status_label');
            ?>
</a>
				<?php 
        }
        ?>
			</td>
			<td class="small-caption">
			<?php 
        if ($t_show_build) {
            ?>
				<a href="<?php 
            echo $t_filters_url . FILTER_PROPERTY_BUILD . '[]';
            ?>
" id="show_build_filter"<?php 
            echo $t_dynamic_filter_expander_class;
            ?>
><?php 
            echo lang_get('product_build_label');
            ?>
</a>
			<?php 
        }
        ?>
			</td>
			<?php 
        if ($t_show_product_version) {
            ?>
			<td colspan="2" class="small-caption">
				<a href="<?php 
            echo $t_filters_url . FILTER_PROPERTY_VERSION . '[]';
            ?>
" id="show_version_filter"<?php 
            echo $t_dynamic_filter_expander_class;
            ?>
><?php 
            echo lang_get('product_version_label');
            ?>
</a>
			</td>
			<td colspan="1" class="small-caption">
				<a href="<?php 
            echo $t_filters_url . FILTER_PROPERTY_FIXED_IN_VERSION . '[]';
            ?>
" id="show_fixed_in_version_filter"<?php 
            echo $t_dynamic_filter_expander_class;
            ?>
><?php 
            echo lang_get('fixed_in_version_label');
            ?>
</a>
			</td>
			<?php 
        } else {
            ?>
			<td colspan="2" class="small-caption">
				&#160;
			</td>
			<td colspan="1" class="small-caption">
				&#160;
			</td>
			<?php 
        }
        ?>
			<td colspan="1" class="small-caption">
				<a href="<?php 
        echo $t_filters_url . FILTER_PROPERTY_PRIORITY . '[]';
        ?>
" id="show_priority_filter"<?php 
        echo $t_dynamic_filter_expander_class;
        ?>
><?php 
        echo lang_get('priority_label');
        ?>
</a>
			</td>
			<?php 
        if ($t_show_product_version) {
            ?>
			<td colspan="1" class="small-caption">
				<a href="<?php 
            echo $t_filters_url . FILTER_PROPERTY_TARGET_VERSION . '[]';
            ?>
" id="show_target_version_filter"<?php 
            echo $t_dynamic_filter_expander_class;
            ?>
><?php 
            echo lang_get('target_version_label');
            ?>
</a>
			</td>
			<?php 
        } else {
            ?>
			<td colspan="1" class="small-caption">
				&#160;
			</td>
			<?php 
        }
        if ($t_filter_cols > 8) {
            echo '<td class="small-caption" colspan="' . ($t_filter_cols - 7) . '">&#160;</td>';
        }
        ?>
		</tr>

		<tr class="row-1">
			<td class="small-caption" id="show_status_filter_target">
		<?php 
        $t_output = '';
        $t_any_found = false;
        if (count($t_filter[FILTER_PROPERTY_STATUS]) == 0) {
            echo lang_get('any');
        } else {
            $t_first_flag = true;
            foreach ($t_filter[FILTER_PROPERTY_STATUS] as $t_current) {
                echo '<input type="hidden" name="', FILTER_PROPERTY_STATUS, '[]" value="', string_attribute($t_current), '" />';
                $t_this_string = '';
                if (filter_field_is_any($t_current)) {
                    $t_any_found = true;
                } else {
                    $t_this_string = get_enum_element('status', $t_current);
                }
                if ($t_first_flag != true) {
                    $t_output = $t_output . '<br />';
                } else {
                    $t_first_flag = false;
                }
                $t_output = $t_output . string_display_line($t_this_string);
            }
            if (true == $t_any_found) {
                echo lang_get('any');
            } else {
                echo $t_output;
            }
        }
        ?>
			</td>
			<td class="small-caption" id="hide_status_filter_target">
		<?php 
        if ('simple' == $t_view_type) {
            $t_output = '';
            $t_none_found = false;
            if (count($t_filter[FILTER_PROPERTY_HIDE_STATUS]) == 0) {
                echo lang_get('none');
            } else {
                $t_first_flag = true;
                foreach ($t_filter[FILTER_PROPERTY_HIDE_STATUS] as $t_current) {
                    echo '<input type="hidden" name="', FILTER_PROPERTY_HIDE_STATUS, '[]" value="', string_attribute($t_current), '" />';
                    $t_this_string = '';
                    if (filter_field_is_none($t_current)) {
                        $t_none_found = true;
                    } else {
                        $t_this_string = get_enum_element('status', $t_current);
                    }
                    if ($t_first_flag != true) {
                        $t_output = $t_output . '<br />';
                    } else {
                        $t_first_flag = false;
                    }
                    $t_output = $t_output . string_display_line($t_this_string);
                }
                $t_hide_status_post = '';
                if (count($t_filter[FILTER_PROPERTY_HIDE_STATUS]) == 1) {
                    $t_hide_status_post = ' (' . lang_get('and_above') . ')';
                }
                if (true == $t_none_found) {
                    echo lang_get('none');
                } else {
                    echo $t_output . string_display_line($t_hide_status_post);
                }
            }
        }
        ?>
			</td>
		<?php 
        if ($t_show_build) {
            ?>
			<td class="small-caption" id="show_build_filter_target">
		<?php 
            $t_output = '';
            $t_any_found = false;
            if (count($t_filter[FILTER_PROPERTY_BUILD]) == 0) {
                echo lang_get('any');
            } else {
                $t_first_flag = true;
                foreach ($t_filter[FILTER_PROPERTY_BUILD] as $t_current) {
                    $t_current = stripslashes($t_current);
                    echo '<input type="hidden" name="', FILTER_PROPERTY_BUILD, '[]" value="', string_attribute($t_current), '" />';
                    $t_this_string = '';
                    if (filter_field_is_any($t_current)) {
                        $t_any_found = true;
                    } else {
                        if (filter_field_is_none($t_current)) {
                            $t_this_string = lang_get('none');
                        } else {
                            $t_this_string = $t_current;
                        }
                    }
                    if ($t_first_flag != true) {
                        $t_output = $t_output . '<br />';
                    } else {
                        $t_first_flag = false;
                    }
                    $t_output = $t_output . string_display_line($t_this_string);
                }
                if (true == $t_any_found) {
                    echo lang_get('any');
                } else {
                    echo $t_output;
                }
            }
            ?>
			</td>
			<?php 
        } else {
            ?>
			<td class="small-caption"></td>
			<?php 
        }
        if ($t_show_product_version) {
            ?>
			<td colspan="2" class="small-caption" id="show_version_filter_target">
							<?php 
            $t_output = '';
            $t_any_found = false;
            if (count($t_filter[FILTER_PROPERTY_VERSION]) == 0) {
                echo lang_get('any');
            } else {
                $t_first_flag = true;
                foreach ($t_filter[FILTER_PROPERTY_VERSION] as $t_current) {
                    $t_current = stripslashes($t_current);
                    echo '<input type="hidden" name="', FILTER_PROPERTY_VERSION, '[]" value="', string_attribute($t_current), '" />';
                    $t_this_string = '';
                    if (filter_field_is_any($t_current)) {
                        $t_any_found = true;
                    } else {
                        if (filter_field_is_none($t_current)) {
                            $t_this_string = lang_get('none');
                        } else {
                            $t_this_string = $t_current;
                        }
                    }
                    if ($t_first_flag != true) {
                        $t_output = $t_output . '<br />';
                    } else {
                        $t_first_flag = false;
                    }
                    $t_output = $t_output . string_display_line($t_this_string);
                }
                if (true == $t_any_found) {
                    echo lang_get('any');
                } else {
                    echo $t_output;
                }
            }
            ?>
			</td>
			<td colspan="1" class="small-caption" id="show_fixed_in_version_filter_target">
							<?php 
            $t_output = '';
            $t_any_found = false;
            if (count($t_filter[FILTER_PROPERTY_FIXED_IN_VERSION]) == 0) {
                echo lang_get('any');
            } else {
                $t_first_flag = true;
                foreach ($t_filter[FILTER_PROPERTY_FIXED_IN_VERSION] as $t_current) {
                    $t_current = stripslashes($t_current);
                    echo '<input type="hidden" name="', FILTER_PROPERTY_FIXED_IN_VERSION, '[]" value="', string_attribute($t_current), '" />';
                    $t_this_string = '';
                    if (filter_field_is_any($t_current)) {
                        $t_any_found = true;
                    } else {
                        if (filter_field_is_none($t_current)) {
                            $t_this_string = lang_get('none');
                        } else {
                            $t_this_string = $t_current;
                        }
                    }
                    if ($t_first_flag != true) {
                        $t_output = $t_output . '<br />';
                    } else {
                        $t_first_flag = false;
                    }
                    $t_output = $t_output . string_display_line($t_this_string);
                }
                if (true == $t_any_found) {
                    echo lang_get('any');
                } else {
                    echo $t_output;
                }
            }
            ?>
			</td>
		<?php 
        } else {
            ?>
			<td colspan="2" class="small-caption">
				&#160;
			</td>
			<td colspan="1" class="small-caption">
				&#160;
			</td>
		<?php 
        }
        ?>
			<td colspan="1" class="small-caption" id="show_priority_filter_target">
		<?php 
        $t_output = '';
        $t_any_found = false;
        if (count($t_filter[FILTER_PROPERTY_PRIORITY]) == 0) {
            echo lang_get('any');
        } else {
            $t_first_flag = true;
            foreach ($t_filter[FILTER_PROPERTY_PRIORITY] as $t_current) {
                echo '<input type="hidden" name="', FILTER_PROPERTY_PRIORITY, '[]" value="', string_attribute($t_current), '" />';
                $t_this_string = '';
                if (filter_field_is_any($t_current)) {
                    $t_any_found = true;
                } else {
                    $t_this_string = get_enum_element('priority', $t_current);
                }
                if ($t_first_flag != true) {
                    $t_output = $t_output . '<br />';
                } else {
                    $t_first_flag = false;
                }
                $t_output = $t_output . string_display_line($t_this_string);
            }
            if (true == $t_any_found) {
                echo lang_get('any');
            } else {
                echo $t_output;
            }
        }
        ?>
		</td>
		<?php 
        if ($t_show_product_version) {
            ?>
		<td colspan="1" class="small-caption" id="show_target_version_filter_target">
							<?php 
            $t_output = '';
            $t_any_found = false;
            if (count($t_filter[FILTER_PROPERTY_TARGET_VERSION]) == 0) {
                echo lang_get('any');
            } else {
                $t_first_flag = true;
                foreach ($t_filter[FILTER_PROPERTY_TARGET_VERSION] as $t_current) {
                    $t_current = stripslashes($t_current);
                    echo '<input type="hidden" name="', FILTER_PROPERTY_TARGET_VERSION, '[]" value="', string_attribute($t_current), '" />';
                    $t_this_string = '';
                    if (filter_field_is_any($t_current)) {
                        $t_any_found = true;
                    } else {
                        if (filter_field_is_none($t_current)) {
                            $t_this_string = lang_get('none');
                        } else {
                            $t_this_string = $t_current;
                        }
                    }
                    if ($t_first_flag != true) {
                        $t_output = $t_output . '<br />';
                    } else {
                        $t_first_flag = false;
                    }
                    $t_output = $t_output . string_display_line($t_this_string);
                }
                if (true == $t_any_found) {
                    echo lang_get('any');
                } else {
                    echo $t_output;
                }
            }
            ?>
			</td>
		<?php 
        } else {
            ?>
			<td colspan="1" class="small-caption">
				&#160;
			</td>
		<?php 
        }
        if ($t_filter_cols > 8) {
            echo '<td class="small-caption" colspan="' . ($t_filter_cols - 7) . '">&#160;</td>';
        }
        ?>

		</tr>

		<tr <?php 
        echo 'class="' . $t_trclass . '"';
        ?>
>
			<td class="small-caption">
				<a href="<?php 
        echo $t_filters_url . FILTER_PROPERTY_ISSUES_PER_PAGE;
        ?>
" id="per_page_filter"<?php 
        echo $t_dynamic_filter_expander_class;
        ?>
><?php 
        echo lang_get('show_label');
        ?>
</a>
			</td>
			<td class="small-caption">
				<a href="<?php 
        echo $t_filters_url . FILTER_PROPERTY_VIEW_STATE;
        ?>
" id="view_state_filter"<?php 
        echo $t_dynamic_filter_expander_class;
        ?>
><?php 
        echo lang_get('view_status_label');
        ?>
</a>
			</td>
			<td class="small-caption">
				<a href="<?php 
        echo $t_filters_url . FILTER_PROPERTY_STICKY;
        ?>
" id="sticky_issues_filter"<?php 
        echo $t_dynamic_filter_expander_class;
        ?>
><?php 
        echo lang_get('sticky_label');
        ?>
</a>
			</td>
			<td class="small-caption" colspan="2">
			</td>
			<td class="small-caption" >
				<a href="<?php 
        echo $t_filters_url . FILTER_PROPERTY_FILTER_BY_DATE;
        ?>
" id="do_filter_by_date_filter"<?php 
        echo $t_dynamic_filter_expander_class;
        ?>
><?php 
        echo lang_get('use_date_filters_label');
        ?>
</a>
			</td>
			<td class="small-caption" colspan="2">
				<a href="<?php 
        echo $t_filters_url . FILTER_PROPERTY_RELATIONSHIP_TYPE;
        ?>
" id="relationship_type_filter"<?php 
        echo $t_dynamic_filter_expander_class;
        ?>
><?php 
        echo lang_get('bug_relationships_label');
        ?>
</a>
			</td>
			<?php 
        if ($t_filter_cols > 8) {
            echo '<td class="small-caption" colspan="' . ($t_filter_cols - 8) . '">&#160;</td>';
        }
        ?>
		</tr>
		<tr class="row-1">
			<td class="small-caption" id="per_page_filter_target">
				<?php 
        echo $t_filter[FILTER_PROPERTY_ISSUES_PER_PAGE] == 0 ? lang_get('all') : string_display_line($t_filter[FILTER_PROPERTY_ISSUES_PER_PAGE]);
        echo '<input type="hidden" name="', FILTER_PROPERTY_ISSUES_PER_PAGE, '" value="', string_attribute($t_filter[FILTER_PROPERTY_ISSUES_PER_PAGE]), '" />';
        ?>
			</td>
			<td class="small-caption" id="view_state_filter_target">
				<?php 
        if (VS_PUBLIC === $t_filter[FILTER_PROPERTY_VIEW_STATE]) {
            echo lang_get('public');
        } else {
            if (VS_PRIVATE === $t_filter[FILTER_PROPERTY_VIEW_STATE]) {
                echo lang_get('private');
            } else {
                echo lang_get('any');
                $t_filter[FILTER_PROPERTY_VIEW_STATE] = META_FILTER_ANY;
            }
        }
        echo '<input type="hidden" name="', FILTER_PROPERTY_VIEW_STATE, '" value="', string_attribute($t_filter[FILTER_PROPERTY_VIEW_STATE]), '" />';
        ?>
			</td>
			<td class="small-caption" id="sticky_issues_filter_target">
				<?php 
        $t_sticky_filter_state = gpc_string_to_bool($t_filter[FILTER_PROPERTY_STICKY]);
        print $t_sticky_filter_state ? lang_get('yes') : lang_get('no');
        ?>
				<input type="hidden" name="<?php 
        echo FILTER_PROPERTY_STICKY;
        ?>
" value="<?php 
        echo $t_sticky_filter_state ? 'on' : 'off';
        ?>
" />
			</td>
			<td class="small-caption" colspan="2">&#160;
			</td>
			<td class="small-caption" id="do_filter_by_date_filter_target">
		<?php 
        if ('on' == $t_filter[FILTER_PROPERTY_FILTER_BY_DATE]) {
            echo '<input type="hidden" name="', FILTER_PROPERTY_FILTER_BY_DATE, '" value="', string_attribute($t_filter[FILTER_PROPERTY_FILTER_BY_DATE]), '" />';
            echo '<input type="hidden" name="', FILTER_PROPERTY_START_MONTH, '" value="', string_attribute($t_filter[FILTER_PROPERTY_START_MONTH]), '" />';
            echo '<input type="hidden" name="', FILTER_PROPERTY_START_DAY, '" value="', string_attribute($t_filter[FILTER_PROPERTY_START_DAY]), '" />';
            echo '<input type="hidden" name="', FILTER_PROPERTY_START_YEAR, '" value="', string_attribute($t_filter[FILTER_PROPERTY_START_YEAR]), '" />';
            echo '<input type="hidden" name="', FILTER_PROPERTY_END_MONTH, '" value="', string_attribute($t_filter[FILTER_PROPERTY_END_MONTH]), '" />';
            echo '<input type="hidden" name="', FILTER_PROPERTY_END_DAY, '" value="', string_attribute($t_filter[FILTER_PROPERTY_END_DAY]), '" />';
            echo '<input type="hidden" name="', FILTER_PROPERTY_END_YEAR, '" value="', string_attribute($t_filter[FILTER_PROPERTY_END_YEAR]), '" />';
            $t_chars = preg_split('//', config_get('short_date_format'), -1, PREG_SPLIT_NO_EMPTY);
            $t_time = mktime(0, 0, 0, $t_filter[FILTER_PROPERTY_START_MONTH], $t_filter[FILTER_PROPERTY_START_DAY], $t_filter[FILTER_PROPERTY_START_YEAR]);
            foreach ($t_chars as $t_char) {
                if (strcasecmp($t_char, 'M') == 0) {
                    echo ' ';
                    echo date('F', $t_time);
                }
                if (strcasecmp($t_char, 'D') == 0) {
                    echo ' ';
                    echo date('d', $t_time);
                }
                if (strcasecmp($t_char, 'Y') == 0) {
                    echo ' ';
                    echo date('Y', $t_time);
                }
            }
            echo ' - ';
            $t_time = mktime(0, 0, 0, $t_filter[FILTER_PROPERTY_END_MONTH], $t_filter[FILTER_PROPERTY_END_DAY], $t_filter[FILTER_PROPERTY_END_YEAR]);
            foreach ($t_chars as $t_char) {
                if (strcasecmp($t_char, 'M') == 0) {
                    echo ' ';
                    echo date('F', $t_time);
                }
                if (strcasecmp($t_char, 'D') == 0) {
                    echo ' ';
                    echo date('d', $t_time);
                }
                if (strcasecmp($t_char, 'Y') == 0) {
                    echo ' ';
                    echo date('Y', $t_time);
                }
            }
        } else {
            echo lang_get('no');
        }
        ?>
			</td>

			<td class="small-caption" colspan="2" id="relationship_type_filter_target">
		<?php 
        echo '<input type="hidden" name="', FILTER_PROPERTY_RELATIONSHIP_TYPE, '" value="', string_attribute($t_filter[FILTER_PROPERTY_RELATIONSHIP_TYPE]), '" />';
        echo '<input type="hidden" name="', FILTER_PROPERTY_RELATIONSHIP_BUG, '" value="', string_attribute($t_filter[FILTER_PROPERTY_RELATIONSHIP_BUG]), '" />';
        $c_rel_type = $t_filter[FILTER_PROPERTY_RELATIONSHIP_TYPE];
        $c_rel_bug = $t_filter[FILTER_PROPERTY_RELATIONSHIP_BUG];
        if (-1 == $c_rel_type || 0 == $c_rel_bug) {
            echo lang_get('any');
        } else {
            echo relationship_get_description_for_history($c_rel_type) . ' ' . $c_rel_bug;
        }
        ?>
			</td>
			<?php 
        if ($t_filter_cols > 8) {
            echo '<td class="small-caption" colspan="' . ($t_filter_cols - 8) . '">&#160;</td>';
        }
        ?>
		</tr>
		<tr <?php 
        echo 'class="' . $t_trclass . '"';
        ?>
>
			<td class="small-caption">
				<?php 
        if (ON == config_get('enable_profiles')) {
            ?>
					<a href="<?php 
            echo $t_filters_url . FILTER_PROPERTY_PLATFORM;
            ?>
" id="platform_filter"<?php 
            echo $t_dynamic_filter_expander_class;
            ?>
><?php 
            echo lang_get('platform_label');
            ?>
</a>
				<?php 
        }
        ?>
			</td>
			<td class="small-caption">
				<?php 
        if (ON == config_get('enable_profiles')) {
            ?>
					<a href="<?php 
            echo $t_filters_url . FILTER_PROPERTY_OS;
            ?>
" id="os_filter"<?php 
            echo $t_dynamic_filter_expander_class;
            ?>
><?php 
            echo lang_get('os_label');
            ?>
</a>
				<?php 
        }
        ?>
			</td>
			<td class="small-caption">
				<?php 
        if (ON == config_get('enable_profiles')) {
            ?>
					<a href="<?php 
            echo $t_filters_url . FILTER_PROPERTY_OS_BUILD;
            ?>
" id="os_build_filter"<?php 
            echo $t_dynamic_filter_expander_class;
            ?>
><?php 
            echo lang_get('os_version_label');
            ?>
</a>
				<?php 
        }
        ?>
			</td>
			<td class="small-caption" colspan="5">
				<?php 
        if (access_has_global_level(config_get('tag_view_threshold'))) {
            ?>
				<a href="<?php 
            echo $t_filters_url . FILTER_PROPERTY_TAG_STRING;
            ?>
" id="tag_string_filter"<?php 
            echo $t_dynamic_filter_expander_class;
            ?>
><?php 
            echo lang_get('tags_label');
            ?>
</a>
				<?php 
        }
        ?>
			</td>
			<?php 
        if ($t_filter_cols > 8) {
            echo '<td class="small-caption" colspan="' . ($t_filter_cols - 8) . '">&#160;</td>';
        }
        ?>
		</tr>
		<tr class="row-1">
			<?php 
        if (ON == config_get('enable_profiles')) {
            ?>
			<td class="small-caption" id="platform_filter_target">
				<?php 
            print_multivalue_field(FILTER_PROPERTY_PLATFORM, $t_filter[FILTER_PROPERTY_PLATFORM]);
            ?>
			</td>
			<td class="small-caption" id="os_filter_target">
				<?php 
            print_multivalue_field(FILTER_PROPERTY_OS, $t_filter[FILTER_PROPERTY_OS]);
            ?>
			</td>
			<td class="small-caption" id="os_build_filter_target">
				<?php 
            print_multivalue_field(FILTER_PROPERTY_OS_BUILD, $t_filter[FILTER_PROPERTY_OS_BUILD]);
            ?>
			</td>
			<?php 
        } else {
            ?>
				<td colspan="3">&#160;</td>
			<?php 
        }
        ?>

			<td class="small-caption" id="tag_string_filter_target" colspan="5">
				<?php 
        $t_tag_string = $t_filter[FILTER_PROPERTY_TAG_STRING];
        if ($t_filter[FILTER_PROPERTY_TAG_SELECT] != 0 && tag_exists($t_filter[FILTER_PROPERTY_TAG_SELECT])) {
            $t_tag_string .= is_blank($t_tag_string) ? '' : config_get('tag_separator');
            $t_tag_string .= tag_get_field($t_filter[FILTER_PROPERTY_TAG_SELECT], 'name');
        }
        echo string_html_entities($t_tag_string);
        echo '<input type="hidden" name="', FILTER_PROPERTY_TAG_STRING, '" value="', string_attribute($t_tag_string), '" />';
        ?>
			</td>
		</tr>
		<?php 
        # get plugin filters
        $t_plugin_filters = filter_get_plugin_filters();
        $t_plugin_filter_links = array();
        $t_plugin_filter_fields = array();
        $t_column_count_by_row = array();
        $t_row = 0;
        foreach ($t_plugin_filters as $t_field_name => $t_filter_object) {
            # be sure the colspan is an integer
            $t_colspan = (int) $t_filter_object->colspan;
            # prevent silliness.
            if ($t_colspan < 0) {
                $t_colspan = abs($t_colspan);
            } else {
                if ($t_colspan > $t_filter_cols) {
                    $t_colspan = $t_filter_cols;
                } else {
                    if ($t_colspan == 0) {
                        $t_colspan = 1;
                    }
                }
            }
            # the row may already have elements in it. find out.
            $t_columns_available = $t_filter_cols - $t_column_count_by_row[$t_row];
            if ($t_columns_available == 0) {
                $t_row++;
            }
            # see if there is room in the current row
            if ($t_columns_available >= $t_colspan) {
                $t_assigned_row = $t_row;
                $t_column_count_by_row[$t_row] += $t_colspan;
            } else {
                $t_is_assigned = false;
                # find a row with space
                foreach ($t_column_count_by_row as $t_row_num => $t_col_count) {
                    if ($t_colspan <= $t_filter_cols - $t_col_count) {
                        $t_assigned_row = $t_row_num;
                        $t_column_count_by_row[$t_row_num] += $t_colspan;
                        $t_is_assigned = true;
                        break;
                    }
                }
                if (!$t_is_assigned) {
                    # no space was found in existing rows. Add a new row for it.
                    $t_assigned_row = count($t_plugin_filter_links);
                    $t_column_count_by_row[$t_assigned_row] = $t_colspan;
                }
            }
            $t_colspan_attr = $t_colspan > 1 ? 'colspan="' . $t_colspan . '" ' : '';
            $t_plugin_filter_links[$t_assigned_row][] = '<td ' . $t_colspan_attr . 'class="small-caption"> <a href="' . $t_filters_url . string_attribute($t_field_name) . '" id="' . string_attribute($t_field_name) . '_filter">' . string_display_line($t_filter_object->title) . '</a> </td>';
            $t_values = '<td ' . $t_colspan_attr . 'class="small-caption" id="' . string_attribute($t_field_name) . '_filter_target"> ';
            if (!isset($t_filter[$t_field_name])) {
                $t_values .= lang_get('any');
            } else {
                switch ($t_filter_object->type) {
                    case FILTER_TYPE_STRING:
                    case FILTER_TYPE_INT:
                        if (filter_field_is_any($t_filter[$t_field_name])) {
                            $t_values .= lang_get('any');
                        } else {
                            $t_values .= string_display_line($t_filter[$t_field_name]);
                        }
                        $t_values .= '<input type="hidden" name="' . string_attribute($t_field_name) . '" value="' . string_attribute($t_filter[$t_field_name]) . '"/>';
                        break;
                    case FILTER_TYPE_BOOLEAN:
                        $t_values .= string_display_line($t_filter_object->display((bool) $t_filter[$t_field_name]));
                        $t_values .= '<input type="hidden" name="' . string_attribute($t_field_name) . '" value="' . (bool) $t_filter[$t_field_name] . '"/>';
                        break;
                    case FILTER_TYPE_MULTI_STRING:
                    case FILTER_TYPE_MULTI_INT:
                        $t_first = true;
                        $t_output = '';
                        if (!is_array($t_filter[$t_field_name])) {
                            $t_filter[$t_field_name] = array($t_filter[$t_field_name]);
                        }
                        foreach ($t_filter[$t_field_name] as $t_current) {
                            if (filter_field_is_any($t_current)) {
                                $t_output .= lang_get('any');
                            } else {
                                $t_output .= ($t_first ? '' : '<br/>') . string_display_line($t_filter_object->display($t_current));
                                $t_first = false;
                            }
                            $t_values .= '<input type="hidden" name="' . string_attribute($t_field_name) . '[]" value="' . string_attribute($t_current) . '"/>';
                        }
                        $t_values .= $t_output;
                        break;
                }
            }
            $t_values .= '</td>';
            $t_plugin_filter_fields[$t_assigned_row][] = $t_values;
        }
        $t_row_count = count($t_plugin_filter_links);
        for ($i = 0; $i < $t_row_count; $i++) {
            if ($t_column_count_by_row[$i] < $t_filter_cols) {
                $t_plugin_filter_links[$i][] = '<td class="small-caption" colspan="' . ($t_filter_cols - $t_column_count_by_row[$i]) . '">&#160;</td>';
                $t_plugin_filter_fields[$i][] = '<td class="small-caption" colspan="' . ($t_filter_cols - $t_column_count_by_row[$i]) . '">&#160;</td>';
            }
            $t_links_row = "\n\t\t" . join("\n\t\t", $t_plugin_filter_links[$i]);
            $t_values_row = "\n\t\t" . join("\n\t\t", $t_plugin_filter_fields[$i]);
            echo "\n\t" . '<tr class="', $t_trclass, '">', $t_links_row, "\n\t</tr>";
            echo "\n\t" . '<tr class="row-1">', $t_values_row, "\n\t</tr>\n\t";
        }
        if (ON == config_get('filter_by_custom_fields')) {
            # -- Custom Field Searching --
            if (count($t_accessible_custom_fields_ids) > 0) {
                $t_per_row = config_get('filter_custom_fields_per_row');
                $t_num_fields = count($t_accessible_custom_fields_ids);
                $t_row_idx = 0;
                $t_col_idx = 0;
                $t_fields = '';
                $t_values = '';
                for ($i = 0; $i < $t_num_fields; $i++) {
                    if ($t_col_idx == 0) {
                        $t_fields = '<tr class="' . $t_trclass . '">';
                        $t_values = '<tr class="row-1">';
                    }
                    if (isset($t_accessible_custom_fields_names[$i])) {
                        $t_fields .= '<td class="small-caption"> ';
                        $t_fields .= '<a href="' . $t_filters_url . 'custom_field_' . $t_accessible_custom_fields_ids[$i] . '[]" id="custom_field_' . $t_accessible_custom_fields_ids[$i] . '_filter"' . $t_dynamic_filter_expander_class . '>';
                        $t_fields .= string_display_line(lang_get_defaulted($t_accessible_custom_fields_names[$i]));
                        $t_fields .= '</a> </td> ';
                    }
                    $t_output = '';
                    $t_any_found = false;
                    $t_values .= '<td class="small-caption" id="custom_field_' . $t_accessible_custom_fields_ids[$i] . '_filter_target"> ';
                    if (!isset($t_filter['custom_fields'][$t_accessible_custom_fields_ids[$i]])) {
                        $t_values .= lang_get('any');
                    } else {
                        if ($t_accessible_custom_fields_types[$i] == CUSTOM_FIELD_TYPE_DATE) {
                            $t_short_date_format = config_get('short_date_format');
                            if (!isset($t_filter['custom_fields'][$t_accessible_custom_fields_ids[$i]][1])) {
                                $t_filter['custom_fields'][$t_accessible_custom_fields_ids[$i]][1] = 0;
                            }
                            $t_start = date($t_short_date_format, $t_filter['custom_fields'][$t_accessible_custom_fields_ids[$i]][1]);
                            if (!isset($t_filter['custom_fields'][$t_accessible_custom_fields_ids[$i]][2])) {
                                $t_filter['custom_fields'][$t_accessible_custom_fields_ids[$i]][2] = 0;
                            }
                            $t_end = date($t_short_date_format, $t_filter['custom_fields'][$t_accessible_custom_fields_ids[$i]][2]);
                            switch ($t_filter['custom_fields'][$t_accessible_custom_fields_ids[$i]][0]) {
                                case CUSTOM_FIELD_DATE_ANY:
                                    $t_values .= lang_get('any');
                                    break;
                                case CUSTOM_FIELD_DATE_NONE:
                                    $t_values .= lang_get('none');
                                    break;
                                case CUSTOM_FIELD_DATE_BETWEEN:
                                    $t_values .= lang_get('between_date') . '<br />';
                                    $t_values .= $t_start . '<br />' . $t_end;
                                    break;
                                case CUSTOM_FIELD_DATE_ONORBEFORE:
                                    $t_values .= lang_get('on_or_before_date') . '<br />';
                                    $t_values .= $t_end;
                                    break;
                                case CUSTOM_FIELD_DATE_BEFORE:
                                    $t_values .= lang_get('before_date') . '<br />';
                                    $t_values .= $t_end;
                                    break;
                                case CUSTOM_FIELD_DATE_ON:
                                    $t_values .= lang_get('on_date') . '<br />';
                                    $t_values .= $t_start;
                                    break;
                                case CUSTOM_FIELD_DATE_AFTER:
                                    $t_values .= lang_get('after_date') . '<br />';
                                    $t_values .= $t_start;
                                    break;
                                case CUSTOM_FIELD_DATE_ONORAFTER:
                                    $t_values .= lang_get('on_or_after_date') . '<br />';
                                    $t_values .= $t_start;
                                    break;
                            }
                        } else {
                            $t_first_flag = true;
                            foreach ($t_filter['custom_fields'][$t_accessible_custom_fields_ids[$i]] as $t_current) {
                                $t_current = stripslashes($t_current);
                                $t_this_string = '';
                                if (filter_field_is_any($t_current)) {
                                    $t_any_found = true;
                                } else {
                                    if (filter_field_is_none($t_current)) {
                                        $t_this_string = lang_get('none');
                                    } else {
                                        $t_this_string = $t_current;
                                    }
                                }
                                if ($t_first_flag != true) {
                                    $t_output = $t_output . '<br />';
                                } else {
                                    $t_first_flag = false;
                                }
                                $t_output = $t_output . string_display_line($t_this_string);
                                $t_values .= '<input type="hidden" name="custom_field_' . $t_accessible_custom_fields_ids[$i] . '[]" value="' . string_attribute($t_current) . '" />';
                            }
                        }
                        if (true == $t_any_found) {
                            $t_values .= lang_get('any');
                        } else {
                            $t_values .= $t_output;
                        }
                    }
                    $t_values .= ' </td>';
                    $t_col_idx++;
                    if ($t_col_idx == $t_per_row) {
                        if ($t_filter_cols > $t_per_row) {
                            $t_fields .= '<td colspan="' . ($t_filter_cols - $t_per_row) . '">&#160;</td> ';
                            $t_values .= '<td colspan="' . ($t_filter_cols - $t_per_row) . '">&#160;</td> ';
                        }
                        $t_fields .= '</tr>' . "\n";
                        $t_values .= '</tr>' . "\n";
                        echo $t_fields;
                        echo $t_values;
                        $t_col_idx = 0;
                        $t_row_idx++;
                    }
                }
                if ($t_col_idx > 0) {
                    if ($t_col_idx < $t_per_row) {
                        $t_fields .= '<td colspan="' . ($t_per_row - $t_col_idx) . '">&#160;</td> ';
                        $t_values .= '<td colspan="' . ($t_per_row - $t_col_idx) . '">&#160;</td> ';
                    }
                    if ($t_filter_cols > $t_per_row) {
                        $t_fields .= '<td colspan="' . ($t_filter_cols - $t_per_row) . '">&#160;</td> ';
                        $t_values .= '<td colspan="' . ($t_filter_cols - $t_per_row) . '">&#160;</td> ';
                    }
                    $t_fields .= '</tr>' . "\n";
                    $t_values .= '</tr>' . "\n";
                    echo $t_fields;
                    echo $t_values;
                }
            }
        }
        ?>
		<tr class="row-1">
			<td class="small-caption category2">
				<a href="<?php 
        echo $t_filters_url . FILTER_PROPERTY_NOTE_USER_ID;
        ?>
" id="note_user_id_filter"<?php 
        echo $t_dynamic_filter_expander_class;
        ?>
>
					<?php 
        echo lang_get('note_user_id_label');
        ?>
				</a>
			</td>
			<td class="small-caption" id="note_user_id_filter_target">
				<?php 
        $t_output = '';
        $t_any_found = false;
        if (count($t_filter[FILTER_PROPERTY_NOTE_USER_ID]) == 0) {
            echo lang_get('any');
        } else {
            $t_first_flag = true;
            foreach ($t_filter[FILTER_PROPERTY_NOTE_USER_ID] as $t_current) {
                echo '<input type="hidden" name="', FILTER_PROPERTY_NOTE_USER_ID, '[]" value="', string_attribute($t_current), '" />';
                $t_this_name = '';
                if (filter_field_is_none($t_current)) {
                    $t_this_name = lang_get('none');
                } else {
                    if (filter_field_is_any($t_current)) {
                        $t_any_found = true;
                    } else {
                        if (filter_field_is_myself($t_current)) {
                            if (access_has_project_level(config_get('handle_bug_threshold'))) {
                                $t_this_name = '[' . lang_get('myself') . ']';
                            } else {
                                $t_any_found = true;
                            }
                        } else {
                            $t_this_name = user_get_name($t_current);
                        }
                    }
                }
                if ($t_first_flag != true) {
                    $t_output = $t_output . '<br />';
                } else {
                    $t_first_flag = false;
                }
                $t_output = $t_output . string_display_line($t_this_name);
            }
            if (true == $t_any_found) {
                echo lang_get('any');
            } else {
                echo $t_output;
            }
        }
        ?>
			</td>

			<!-- Sort by -->
			<td class="small-caption category2">
				<a href="<?php 
        echo $t_filters_url . 'show_sort';
        ?>
" id="show_sort_filter"<?php 
        echo $t_dynamic_filter_expander_class;
        ?>
>
					<?php 
        echo lang_get('sort_label');
        ?>
				</a>
			</td>
			<td class="small-caption" id="show_sort_filter_target">
				<?php 
        $t_sort_fields = explode(',', $t_filter[FILTER_PROPERTY_SORT_FIELD_NAME]);
        $t_dir_fields = explode(',', $t_filter[FILTER_PROPERTY_SORT_DIRECTION]);
        for ($i = 0; $i < 2; $i++) {
            if (isset($t_sort_fields[$i])) {
                if (0 < $i) {
                    echo ', ';
                }
                $t_sort = $t_sort_fields[$i];
                if (strpos($t_sort, 'custom_') === 0) {
                    $t_field_name = string_display(lang_get_defaulted(utf8_substr($t_sort, utf8_strlen('custom_'))));
                } else {
                    $t_field_name = string_get_field_name($t_sort);
                }
                echo $t_field_name . ' ' . lang_get('bugnote_order_' . utf8_strtolower($t_dir_fields[$i]));
                echo '<input type="hidden" name="', FILTER_PROPERTY_SORT_FIELD_NAME, '_', $i, '" value="', string_attribute($t_sort_fields[$i]), '" />';
                echo '<input type="hidden" name="', FILTER_PROPERTY_SORT_DIRECTION, '_', $i, '" value="', string_attribute($t_dir_fields[$i]), '" />';
            }
        }
        ?>
			</td>
<?php 
        if ('advanced' == $t_view_type) {
            ?>
			<!-- Project -->
			<td class="small-caption category2" colspan="2">
				<a href="<?php 
            echo $t_filters_url . FILTER_PROPERTY_PROJECT_ID;
            ?>
" id="project_id_filter"<?php 
            echo $t_dynamic_filter_expander_class;
            ?>
>
					<?php 
            echo lang_get('email_project_label');
            ?>
				</a>
			</td>
			<td class="small-caption" id="project_id_filter_target">
<?php 
            $t_output = '';
            if (!is_array($t_filter[FILTER_PROPERTY_PROJECT_ID])) {
                $t_filter[FILTER_PROPERTY_PROJECT_ID] = array($t_filter[FILTER_PROPERTY_PROJECT_ID]);
            }
            if (count($t_filter[FILTER_PROPERTY_PROJECT_ID]) == 0) {
                echo lang_get('current');
            } else {
                $t_first_flag = true;
                foreach ($t_filter[FILTER_PROPERTY_PROJECT_ID] as $t_current) {
                    echo '<input type="hidden" name="', FILTER_PROPERTY_PROJECT_ID, '[]" value="', string_attribute($t_current), '" />';
                    $t_this_name = '';
                    if (META_FILTER_CURRENT == $t_current) {
                        $t_this_name = '[' . lang_get('current') . ']';
                    } else {
                        $t_this_name = project_get_name($t_current, false);
                    }
                    if ($t_first_flag != true) {
                        $t_output = $t_output . '<br />';
                    } else {
                        $t_first_flag = false;
                    }
                    $t_output = $t_output . string_display_line($t_this_name);
                }
                echo $t_output;
            }
            ?>
			</td>
<?php 
            if ($t_filter_cols > 6) {
                echo '<td class="small-caption" colspan="' . ($t_filter_cols - 5) . '">&#160;</td>';
            }
        } else {
            if ($t_filter_cols > 3) {
                echo '<td class="small-caption" colspan="' . ($t_filter_cols - 2) . '">&#160;</td>';
            }
        }
        ?>
		</tr>

		<!-- Match Type -->
		<tr class="row-1">
			<td class="small-caption category2"><a href="<?php 
        echo $t_filters_url . FILTER_PROPERTY_MATCH_TYPE;
        ?>
" id="match_type_filter"><?php 
        echo lang_get('filter_match_type');
        ?>
:</a></td>
			<td class="small-caption" id="match_type_filter_target">
			<?php 
        switch ($t_filter[FILTER_PROPERTY_MATCH_TYPE]) {
            case FILTER_MATCH_ANY:
                echo lang_get('filter_match_any');
                break;
            case FILTER_MATCH_ALL:
            default:
                echo lang_get('filter_match_all');
                break;
        }
        ?>
			<input type="hidden" name="match_type" value="<?php 
        echo $t_filter[FILTER_PROPERTY_MATCH_TYPE];
        ?>
"/>
			</td>

			<td class="small-caption category2">
				<a id="highlight_changed_filter"
					href="<?php 
        echo $t_filters_url . FILTER_PROPERTY_HIGHLIGHT_CHANGED;
        ?>
"
					<?php 
        #echo $t_dynamic_filter_expander_class;
        ?>
>
					<?php 
        echo lang_get('changed_label');
        ?>
				</a>
			</td>
			<td class="small-caption" valign="top" id="highlight_changed_filter_target">
				<?php 
        echo $t_filter[FILTER_PROPERTY_HIGHLIGHT_CHANGED];
        ?>
				<input type="hidden"
					name="<?php 
        echo FILTER_PROPERTY_HIGHLIGHT_CHANGED;
        ?>
"
					value="<?php 
        echo string_attribute($t_filter[FILTER_PROPERTY_HIGHLIGHT_CHANGED]);
        ?>
"
				/>
			</td>

			<td colspan="4">&#160;</td>
		</tr>
	</table>
		<?php 
    }
    # expanded
    collapse_icon('filter');
    echo '<div class="search-box">';
    echo '<label>';
    echo lang_get('search') . '&#160;';
    echo '<input type="text" size="16" name="', FILTER_PROPERTY_SEARCH, '" value="', string_attribute($t_filter[FILTER_PROPERTY_SEARCH]), '" />';
    echo '</label>';
    echo '</div>';
    ?>
	<div class="submit-query"><input type="submit" name="filter" value="<?php 
    echo lang_get('filter_button');
    ?>
" /></div>
	</form>
	<?php 
    $t_stored_queries_arr = filter_db_get_available_queries();
    if (access_has_project_level(config_get('stored_query_create_threshold'))) {
        ?>
	<div class="save-query">
		<form method="post" name="save_query" action="query_store_page.php">
			<?php 
        # CSRF protection not required here - form does not result in modifications
        ?>
			<input type="submit" name="save_query_button" class="button-small" value="<?php 
        echo lang_get('save_query');
        ?>
" />
		</form>
	</div><?php 
    }
    if (count($t_stored_queries_arr) > 0) {
        ?>
	<div class="manage-queries">
		<form method="post" name="open_queries" action="query_view_page.php">
			<?php 
        # CSRF protection not required here - form does not result in modifications
        ?>
			<input type="submit" name="switch_to_query_button" class="button-small" value="<?php 
        echo lang_get('open_queries');
        ?>
" />
		</form>
	</div>
	<div class="stored-queries">
		<form method="get" name="list_queries<?php 
        echo $t_form_name_suffix;
        ?>
" action="view_all_set.php">
			<?php 
        # CSRF protection not required here - form does not result in modifications
        ?>
			<input type="hidden" name="type" value="3" />
			<select name="source_query_id">
				<option value="-1"><?php 
        echo '[' . lang_get('reset_query') . ']';
        ?>
</option>
				<option value="-1"></option>
				<?php 
        $t_source_query_id = isset($t_filter['_source_query_id']) ? (int) $t_filter['_source_query_id'] : -1;
        foreach ($t_stored_queries_arr as $t_query_id => $t_query_name) {
            echo '<option value="' . $t_query_id . '" ';
            check_selected($t_query_id, $t_source_query_id);
            echo '>' . string_display_line($t_query_name) . '</option>';
        }
        ?>
			</select>
			<input type="submit" name="switch_to_query_button" class="button-small" value="<?php 
        echo lang_get('use_query');
        ?>
" />
		</form>
	</div> <?php 
    } else {
        ?>
	<div class="reset-query">
		<form method="get" name="reset_query" action="view_all_set.php">
			<?php 
        # CSRF protection not required here - form does not result in modifications
        ?>
			<input type="hidden" name="type" value="3" />
			<input type="hidden" name="source_query_id" value="-1" />
			<input type="submit" name="reset_query_button" class="button-small" value="<?php 
        echo lang_get('reset_query');
        ?>
" />
		</form>
	</div><?php 
    }
    ?>

	<div class="filter-links">
		<?php 
    if (access_has_project_level(config_get('create_permalink_threshold'))) {
        ?>
			<form method="get" action="permalink_page.php">
				<?php 
        # CSRF protection not required here - form does not result in modifications
        ?>
				<input type="hidden" name="url" value="<?php 
        echo urlencode(filter_get_url($t_filter));
        ?>
" />
				<input type="submit" name="reset_query_button" class="button-small" value="<?php 
        echo lang_get('create_filter_link');
        ?>
" />
			</form>
			<?php 
    }
    $t_view_filters = config_get('view_filters');
    if (SIMPLE_ONLY != $t_view_filters && ADVANCED_ONLY != $t_view_filters) {
        ?>
			<form method="get" action="view_all_set.php">
				<?php 
        # CSRF protection not required here - form does not result in modifications
        ?>
				<input type="hidden" name="type" value="<?php 
        echo config_get('use_dynamic_filters') ? '6' : '';
        ?>
" />
				<input type="hidden" name="view_type" value="<?php 
        echo 'advanced' == $t_view_type ? 'simple' : 'advanced';
        ?>
" />
				<input type="submit" name="reset_query_button" class="button-small" value="<?php 
        echo 'advanced' == $t_view_type ? lang_get('simple_filters') : lang_get('advanced_filters');
        ?>
" />
			</form>
			<?php 
    }
    ?>
	</div>

	</div>
	<br />
<?php 
}
Example #28
0
/**
 * Checks if an obsolete configuration variable is still in use.  If so, an error
 * will be generated and the script will exit.
 *
 * @param string $p_var     Old configuration option.
 * @param string $p_replace New configuration option.
 * @return void
 */
function config_obsolete($p_var, $p_replace = '')
{
    global $g_cache_config;
    # @@@ we could trigger a WARNING here, once we have errors that can
    #     have extra data plugged into them (we need to give the old and
    #     new config option names in the warning text)
    if (config_is_set($p_var)) {
        $t_description = 'The configuration option <em>' . $p_var . '</em> is now obsolete';
        $t_info = '';
        # Check if set in the database
        if (is_array($g_cache_config) && array_key_exists($p_var, $g_cache_config)) {
            $t_info .= 'it is currently defined in ';
            if (isset($GLOBALS['g_' . $p_var])) {
                $t_info .= 'config_inc.php, as well as in ';
            }
            $t_info .= 'the database configuration for: <ul>';
            foreach ($g_cache_config[$p_var] as $t_user_id => $t_user) {
                $t_info .= '<li>' . ($t_user_id == 0 ? lang_get('all_users') : user_get_name($t_user_id)) . ': ';
                foreach ($t_user as $t_project_id => $t_project) {
                    $t_info .= project_get_name($t_project_id) . ', ';
                }
                $t_info = rtrim($t_info, ', ') . '</li>';
            }
            $t_info .= '</ul>';
        }
        # Replacement defined
        if (is_array($p_replace)) {
            $t_info .= 'please see the following options: <ul>';
            foreach ($p_replace as $t_option) {
                $t_info .= '<li>' . $t_option . '</li>';
            }
            $t_info .= '</ul>';
        } else {
            if (!is_blank($p_replace)) {
                $t_info .= 'please use ' . $p_replace . ' instead.';
            }
        }
        check_print_test_warn_row($t_description, false, $t_info);
    }
}
Example #29
0
function print_user_with_subject($p_user_id, $p_bug_id)
{
    $c_user_id = db_prepare_int($p_user_id);
    if (NO_USER == $p_user_id) {
        return;
    }
    $t_username = user_get_name($p_user_id);
    if (user_exists($p_user_id) && user_get_field($p_user_id, 'enabled')) {
        $t_email = user_get_email($p_user_id);
        print_email_link_with_subject($t_email, $t_username, $p_bug_id);
    } else {
        echo '<span style="text-decoration: line-through">';
        echo $t_username;
        echo '</span>';
    }
}
Example #30
0
    echo '<tr class="hidden"></tr>';
}
#
# Reporter
#
if ($t_show_reporter) {
    echo '<tr>';
    $t_spacer = 4;
    if ($t_show_reporter) {
        # Reporter
        echo '<th class="category"><label for="reporter_id">' . lang_get('reporter') . '</label></th>';
        echo '<td>';
        # Do not allow the bug's reporter to edit the Reporter field
        # when limit_reporters is ON
        if (ON == config_get('limit_reporters') && !access_has_project_level(REPORTER + 1, $t_bug->project_id)) {
            echo string_attribute(user_get_name($t_bug->reporter_id));
        } else {
            echo '<select ' . helper_get_tab_index() . ' id="reporter_id" name="reporter_id">';
            print_reporter_option_list($t_bug->reporter_id, $t_bug->project_id);
            echo '</select>';
        }
        echo '</td>';
    } else {
        $t_spacer += 2;
    }
    # spacer
    echo '<td colspan="', $t_spacer, '">&#160;</td>';
    echo '</tr>';
}
#
# Assigned To, Due Date