| [ Index ] |
PHP Cross Reference of MantisBT |
[Summary view] [Print] [Text view]
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 * @package MantisBT 19 * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org 20 * @copyright Copyright (C) 2002 - 2011 MantisBT Team - mantisbt-dev@lists.sourceforge.net 21 * @link http://www.mantisbt.org 22 * 23 * @uses core.php 24 * @uses access_api.php 25 * @uses authentication_api.php 26 * @uses config_api.php 27 * @uses constant_inc.php 28 * @uses database_api.php 29 * @uses file_api.php 30 * @uses gpc_api.php 31 * @uses helper_api.php 32 * @uses html_api.php 33 * @uses lang_api.php 34 * @uses print_api.php 35 * @uses project_api.php 36 * @uses string_api.php 37 * @uses user_api.php 38 */ 39 40 /** 41 * MantisBT Core API's 42 */ 43 require_once ( 'core.php' ); 44 require_api( 'access_api.php' ); 45 require_api( 'authentication_api.php' ); 46 require_api( 'config_api.php' ); 47 require_api( 'constant_inc.php' ); 48 require_api( 'database_api.php' ); 49 require_api( 'file_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( 'print_api.php' ); 55 require_api( 'project_api.php' ); 56 require_api( 'string_api.php' ); 57 require_api( 'user_api.php' ); 58 59 $f_project_id = gpc_get_int( 'project_id', helper_get_current_project() ); 60 61 # Check if project documentation feature is enabled. 62 if ( OFF == config_get( 'enable_project_documentation' ) || !file_is_uploading_enabled() ) { 63 access_denied(); 64 } 65 66 # Override the current page to make sure we get the appropriate project-specific configuration 67 $g_project_override = $f_project_id; 68 69 $t_user_id = auth_get_current_user_id(); 70 $t_project_file_table = db_get_table( 'project_file' ); 71 $t_project_table = db_get_table( 'project' ); 72 $t_project_user_list_table = db_get_table( 'project_user_list' ); 73 $t_user_table = db_get_table( 'user' ); 74 $t_pub = VS_PUBLIC; 75 $t_priv = VS_PRIVATE; 76 $t_admin = config_get_global( 'admin_site_threshold' ); 77 78 if ( $f_project_id == ALL_PROJECTS ) { 79 # Select all the projects that the user has access to 80 $t_projects = user_get_accessible_projects( $t_user_id ); 81 } else { 82 # Select the specific project 83 $t_projects = array( $f_project_id ); 84 } 85 86 $t_projects[] = ALL_PROJECTS; # add "ALL_PROJECTS to the list of projects to fetch 87 88 $t_reqd_access = config_get( 'view_proj_doc_threshold' ); 89 if ( is_array( $t_reqd_access ) ) { 90 if ( 1 == count( $t_reqd_access ) ) { 91 $t_access_clause = "= " . array_shift( $t_reqd_access ) . " "; 92 } else { 93 $t_access_clause = "IN (" . implode( ',', $t_reqd_access ) . ")"; 94 } 95 } else { 96 $t_access_clause = ">= $t_reqd_access "; 97 } 98 99 $query = "SELECT pft.id, pft.project_id, pft.filename, pft.filesize, pft.title, pft.description, pft.date_added 100 FROM $t_project_file_table pft 101 LEFT JOIN $t_project_table pt ON pft.project_id = pt.id 102 LEFT JOIN $t_project_user_list_table pult 103 ON pft.project_id = pult.project_id AND pult.user_id = $t_user_id 104 LEFT JOIN $t_user_table ut ON ut.id = $t_user_id 105 WHERE pft.project_id in (" . implode( ',', $t_projects ) . ") AND 106 ( ( ( pt.view_state = $t_pub OR pt.view_state is null ) AND pult.user_id is null AND ut.access_level $t_access_clause ) OR 107 ( ( pult.user_id = $t_user_id ) AND ( pult.access_level $t_access_clause ) ) OR 108 ( ut.access_level >= $t_admin ) ) 109 ORDER BY pt.name ASC, pft.title ASC"; 110 $result = db_query( $query ); 111 $num_files = db_num_rows( $result ); 112 113 html_page_top( lang_get( 'docs_link' ) ); 114 ?> 115 <br /> 116 <div> 117 <table class="width100" cellspacing="1"> 118 <tr> 119 <td class="form-title"> 120 <?php echo lang_get( 'project_documentation_title' ) ?> 121 </td> 122 <td class="right"> 123 <?php print_doc_menu( 'proj_doc_page.php' ) ?> 124 </td> 125 </tr> 126 <?php 127 for ($i=0;$i<$num_files;$i++) { 128 $row = db_fetch_array( $result ); 129 extract( $row, EXTR_PREFIX_ALL, 'v' ); 130 $v_filesize = number_format( $v_filesize ); 131 $v_title = string_display( $v_title ); 132 $v_description = string_display_links( $v_description ); 133 $v_date_added = date( config_get( 'normal_date_format' ), $v_date_added ); 134 135 ?> 136 <tr <?php echo helper_alternate_class( $i ) ?>> 137 <td> 138 <?php 139 $t_href = '<a href="file_download.php?file_id='.$v_id.'&type=doc">'; 140 echo $t_href; 141 print_file_icon( $v_filename ); 142 echo '</a> ' . $t_href . $v_title . '</a> (' . $v_filesize . lang_get( 'word_separator' ) . lang_get( 'bytes' ) . ')'; 143 ?> 144 <br /> 145 <span class="small"> 146 <?php 147 if( $v_project_id == ALL_PROJECTS ) { 148 echo lang_get( 'all_projects' ) . '<br/>'; 149 } 150 else if( $v_project_id != $f_project_id ) { 151 $t_project_name = project_get_name( $v_project_id ); 152 echo $t_project_name . '<br/>'; 153 } 154 echo '(' . $v_date_added . ')'; 155 if ( access_has_project_level( config_get( 'upload_project_file_threshold', null, null, $v_project_id ), $v_project_id ) ) { 156 echo ' '; 157 print_button( 'proj_doc_edit_page.php?file_id='.$v_id, lang_get( 'edit_link' ) ); 158 echo ' '; 159 print_button( 'proj_doc_delete.php?file_id=' . $v_id, lang_get( 'delete_link' ) ); 160 } 161 ?> 162 </span> 163 </td> 164 <td> 165 <?php echo $v_description ?> 166 </td> 167 </tr> 168 <?php 169 } # end for loop 170 ?> 171 </table> 172 </div> 173 174 <?php 175 html_page_bottom();
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Thu Jul 28 15:48:31 2011 | Cross-referenced by PHPXref 0.7 |