1<?php 2# MantisBT - A PHP based bugtracking system 3 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. 8# 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. 13# 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/>. 16 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 20 * 21 * @package MantisBT 22 * @copyright Copyright 2000 - 2002 Kenzaburo Ito - kenito@300baud.org 23 * @copyright Copyright 2002 MantisBT Team - mantisbt-dev@lists.sourceforge.net 24 * @link http://www.mantisbt.org 25 * 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 39 */ 40 41require_once( 'core.php' ); 42require_api( 'access_api.php' ); 43require_api( 'authentication_api.php' ); 44require_api( 'config_api.php' ); 45require_api( 'constant_inc.php' ); 46require_api( 'current_user_api.php' ); 47require_api( 'gpc_api.php' ); 48require_api( 'helper_api.php' ); 49require_api( 'html_api.php' ); 50require_api( 'lang_api.php' ); 51require_api( 'news_api.php' ); 52require_api( 'print_api.php' ); 53require_api( 'rss_api.php' ); 54 55access_ensure_project_level( config_get( 'view_bug_threshold' ) ); 56 57$f_offset = gpc_get_int( 'offset', 0 ); 58 59$t_project_id = helper_get_current_project(); 60 61$t_rss_enabled = config_get( 'rss_enabled' ); 62 63if( OFF != $t_rss_enabled && news_is_enabled() ) { 64 $t_rss_link = rss_get_news_feed_url( $t_project_id ); 65 html_set_rss_link( $t_rss_link ); 66} 67 68layout_page_header( lang_get( 'main_link' ) ); 69 70layout_page_begin(); 71 72echo '<div class="col-md-6 col-xs-12">'; 73 74if( !current_user_is_anonymous() ) { 75 $t_current_user_id = auth_get_current_user_id(); 76 $t_hide_status = config_get( 'bug_resolved_status_threshold' ); 77 echo '<span class="bigger-120">'; 78 echo lang_get( 'open_and_assigned_to_me_label' ) . lang_get( 'word_separator' ); 79 print_link( "view_all_set.php?type=" . FILTER_ACTION_PARSE_NEW . "&handler_id=$t_current_user_id&hide_status=$t_hide_status", current_user_get_assigned_open_bug_count() ); 80 81 echo '<br />'; 82 83 echo lang_get( 'open_and_reported_to_me_label' ) . lang_get( 'word_separator' ); 84 print_link( "view_all_set.php?type=" . FILTER_ACTION_PARSE_NEW . "&reporter_id=$t_current_user_id&hide_status=$t_hide_status", current_user_get_reported_open_bug_count() ); 85 86 echo '<br />'; 87 88 echo lang_get( 'last_visit_label' ) . lang_get( 'word_separator' ); 89 echo date( config_get( 'normal_date_format' ), current_user_get_field( 'last_visit' ) ); 90 echo '</span>'; 91} 92 93echo '</div>'; 94echo '<div class="col-md-6 col-xs-12">'; 95 96if( news_is_enabled() && access_has_project_level( config_get( 'manage_news_threshold' ) ) ) { 97 # Admin can edit news for All Projects (site-wide) 98 if( ALL_PROJECTS != helper_get_current_project() || current_user_is_administrator() ) { 99 print_link_button( 'news_menu_page.php', lang_get( 'edit_news_link' ), 'pull-right'); 100 } else { 101 print_link_button( 'login_select_proj_page.php', lang_get( 'edit_news_link' ), 'pull-right'); 102 } 103} 104echo '</div>'; 105 106echo '<div class="col-md-12 col-xs-12">'; 107 108if( news_is_enabled() ) { 109 $t_news_rows = news_get_limited_rows( $f_offset, $t_project_id ); 110 $t_news_count = count( $t_news_rows ); 111 112 if( $t_news_count ) { 113 echo '<div id="news-items">'; 114 # Loop through results 115 for( $i = 0; $i < $t_news_count; $i++ ) { 116 $t_row = $t_news_rows[$i]; 117 118 # only show VS_PRIVATE posts to configured threshold and above 119 if( ( VS_PRIVATE == $t_row['view_state'] ) && 120 !access_has_project_level( config_get( 'private_news_threshold' ) ) ) { 121 continue; 122 } 123 124 print_news_entry_from_row( $t_row ); 125 } # end for loop 126 echo '</div>'; 127 } 128 129 echo '<div class="space-10"></div>'; 130 echo '<div class="btn-group">'; 131 132 print_link_button( 'news_list_page.php', lang_get( 'archives' ) ); 133 $t_news_view_limit = config_get( 'news_view_limit' ); 134 $f_offset_next = $f_offset + $t_news_view_limit; 135 $f_offset_prev = $f_offset - $t_news_view_limit; 136 137 if( $f_offset_prev >= 0 ) { 138 print_link_button( 'main_page.php?offset=' . $f_offset_prev, lang_get( 'newer_news_link' ) ); 139 } 140 141 if( $t_news_count == $t_news_view_limit ) { 142 print_link_button( 'main_page.php?offset=' . $f_offset_next, lang_get( 'older_news_link' ) ); 143 } 144 145 if( OFF != $t_rss_enabled ) { 146 print_link_button( $t_rss_link, lang_get( 'rss' ) ); 147 } 148 149 echo '</div>'; 150} 151echo '</div>'; 152layout_page_end(); 153