Fixed #13021 $g_view_history_threshold ignored in print_bug_page.php
[mantis.git] / main_page.php
blobae782780a02a4126466d73f86ac5c4ab9fdaeb93
1 <?php
2 # MantisBT - A PHP based bugtracking system
4 # MantisBT is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation, either version 2 of the License, or
7 # (at your option) any later version.
9 # MantisBT is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with MantisBT. If not, see <http://www.gnu.org/licenses/>.
17 /**
18 * This is the first page a user sees when they login to the bugtracker
19 * News is displayed which can notify users of any important changes
21 * @package MantisBT
22 * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
23 * @copyright Copyright (C) 2002 - 2011 MantisBT Team - mantisbt-dev@lists.sourceforge.net
24 * @link http://www.mantisbt.org
26 * @uses core.php
27 * @uses access_api.php
28 * @uses authentication_api.php
29 * @uses config_api.php
30 * @uses constant_inc.php
31 * @uses current_user_api.php
32 * @uses gpc_api.php
33 * @uses helper_api.php
34 * @uses html_api.php
35 * @uses lang_api.php
36 * @uses news_api.php
37 * @uses print_api.php
38 * @uses rss_api.php
41 /**
42 * MantisBT Core API's
44 require_once( 'core.php' );
45 require_api( 'access_api.php' );
46 require_api( 'authentication_api.php' );
47 require_api( 'config_api.php' );
48 require_api( 'constant_inc.php' );
49 require_api( 'current_user_api.php' );
50 require_api( 'gpc_api.php' );
51 require_api( 'helper_api.php' );
52 require_api( 'html_api.php' );
53 require_api( 'lang_api.php' );
54 require_api( 'news_api.php' );
55 require_api( 'print_api.php' );
56 require_api( 'rss_api.php' );
58 access_ensure_project_level( VIEWER );
60 $f_offset = gpc_get_int( 'offset', 0 );
62 $t_project_id = helper_get_current_project();
64 $t_rss_enabled = config_get( 'rss_enabled' );
66 if ( OFF != $t_rss_enabled && news_is_enabled() ) {
67 $t_rss_link = rss_get_news_feed_url( $t_project_id );
68 html_set_rss_link( $t_rss_link );
71 html_page_top( lang_get( 'main_link' ) );
73 if ( !current_user_is_anonymous() ) {
74 $t_current_user_id = auth_get_current_user_id();
75 $t_hide_status = config_get( 'bug_resolved_status_threshold' );
76 echo '<div class="quick-summary-left">';
77 echo lang_get( 'open_and_assigned_to_me_label' ) . lang_get( 'word_separator' );
78 print_link( "view_all_set.php?type=1&handler_id=$t_current_user_id&hide_status=$t_hide_status", current_user_get_assigned_open_bug_count(), false, 'subtle' );
79 echo '</div>';
81 echo '<div class="quick-summary-right">';
82 echo lang_get( 'open_and_reported_to_me_label' ) . lang_get( 'word_separator' );
83 print_link( "view_all_set.php?type=1&reporter_id=$t_current_user_id&hide_status=$t_hide_status", current_user_get_reported_open_bug_count(), false, 'subtle' );
84 echo '</div>';
86 echo '<div class="quick-summary-left">';
87 echo lang_get( 'last_visit_label' ) . lang_get( 'word_separator' );
88 echo date( config_get( 'normal_date_format' ), current_user_get_field( 'last_visit' ) );
89 echo '</div>';
92 if ( news_is_enabled() ) {
93 $t_news_rows = news_get_limited_rows( $f_offset, $t_project_id );
94 $t_news_count = count( $t_news_rows );
96 if( $t_news_count ) {
97 echo '<div id="news-items">';
98 # Loop through results
99 for ( $i = 0; $i < $t_news_count; $i++ ) {
100 $t_row = $t_news_rows[$i];
102 # only show VS_PRIVATE posts to configured threshold and above
103 if ( ( VS_PRIVATE == $t_row[ 'view_state' ] ) &&
104 !access_has_project_level( config_get( 'private_news_threshold' ) ) ) {
105 continue;
108 print_news_entry_from_row( $t_row );
109 } # end for loop
110 echo '</div>';
113 echo '<div id="news-menu">';
115 print_bracket_link( 'news_list_page.php', lang_get( 'archives' ) );
116 $t_news_view_limit = config_get( 'news_view_limit' );
117 $f_offset_next = $f_offset + $t_news_view_limit;
118 $f_offset_prev = $f_offset - $t_news_view_limit;
120 if ( $f_offset_prev >= 0) {
121 print_bracket_link( 'main_page.php?offset=' . $f_offset_prev, lang_get( 'newer_news_link' ) );
124 if ( $t_news_count == $t_news_view_limit ) {
125 print_bracket_link( 'main_page.php?offset=' . $f_offset_next, lang_get( 'older_news_link' ) );
128 if ( OFF != $t_rss_enabled ) {
129 print_bracket_link( $t_rss_link, lang_get( 'rss' ) );
132 echo '</div>';
135 html_page_bottom();