PageRenderTime 44ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/main_page.php

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