[ Index ] |
|
Code source de Mantis 1.1.0rc3 |
1 <?php 2 # Mantis - a php based bugtracking system 3 4 # Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org 5 # Copyright (C) 2002 - 2007 Mantis Team - mantisbt-dev@lists.sourceforge.net 6 7 # Mantis is free software: you can redistribute it and/or modify 8 # it under the terms of the GNU General Public License as published by 9 # the Free Software Foundation, either version 2 of the License, or 10 # (at your option) any later version. 11 # 12 # Mantis is distributed in the hope that it will be useful, 13 # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 # GNU General Public License for more details. 16 # 17 # You should have received a copy of the GNU General Public License 18 # along with Mantis. If not, see <http://www.gnu.org/licenses/>. 19 20 # -------------------------------------------------------- 21 # $Id: proj_doc_page.php,v 1.53.2.1 2007-10-13 22:34:24 giallu Exp $ 22 # -------------------------------------------------------- 23 24 require_once ( 'core.php' ); 25 26 $t_core_path = config_get( 'core_path' ); 27 28 require_once( $t_core_path.'string_api.php' ); 29 30 $f_project_id = gpc_get_int( 'project_id', helper_get_current_project() ); 31 32 # Check if project documentation feature is enabled. 33 if ( OFF == config_get( 'enable_project_documentation' ) || !file_is_uploading_enabled() ) { 34 access_denied(); 35 } 36 37 # Override the current page to make sure we get the appropriate project-specific configuration 38 $g_project_override = $f_project_id; 39 40 $t_user_id = auth_get_current_user_id(); 41 $t_project_file_table = config_get( 'mantis_project_file_table' ); 42 $t_project_table = config_get( 'mantis_project_table' ); 43 $t_project_user_list_table = config_get( 'mantis_project_user_list_table' ); 44 $t_user_table = config_get( 'mantis_user_table' ); 45 $t_pub = VS_PUBLIC; 46 $t_priv = VS_PRIVATE; 47 $t_admin = ADMINISTRATOR; 48 49 if ( $f_project_id == ALL_PROJECTS ) { 50 # Select all the projects that the user has access to 51 $t_projects = user_get_accessible_projects( $t_user_id ); 52 } else { 53 # Select the specific project 54 $t_projects = array( $f_project_id ); 55 } 56 57 $t_projects[] = ALL_PROJECTS; # add "ALL_PROJECTS to the list of projects to fetch 58 59 $t_reqd_access = config_get( 'view_proj_doc_threshold' ); 60 if ( is_array( $t_reqd_access ) ) { 61 if ( 1 == count( $t_reqd_access ) ) { 62 $t_access_clause = "= " . array_shift( $t_reqd_access ) . " "; 63 } else { 64 $t_access_clause = "IN (" . implode( ',', $t_reqd_access ) . ")"; 65 } 66 } else { 67 $t_access_clause = ">= $t_reqd_access "; 68 } 69 70 $query = "SELECT pft.id, pft.project_id, pft.filename, pft.filesize, pft.title, pft.description, pft.date_added 71 FROM $t_project_file_table pft 72 LEFT JOIN $t_project_table pt ON pft.project_id = pt.id 73 LEFT JOIN $t_project_user_list_table pult 74 ON pft.project_id = pult.project_id AND pult.user_id = $t_user_id 75 LEFT JOIN $t_user_table ut ON ut.id = $t_user_id 76 WHERE pft.project_id in (" . implode( ',', $t_projects ) . ") AND 77 ( ( ( 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 78 ( ( pult.user_id = $t_user_id ) AND ( pult.access_level $t_access_clause ) ) OR 79 ( ut.access_level = $t_admin ) ) 80 ORDER BY pt.name ASC, pft.title ASC"; 81 $result = db_query( $query ); 82 $num_files = db_num_rows( $result ); 83 84 html_page_top1( lang_get( 'docs_link' ) ); 85 html_page_top2(); 86 ?> 87 <br /> 88 <div align="center"> 89 <table class="width100" cellspacing="1"> 90 <tr> 91 <td class="form-title"> 92 <?php echo lang_get( 'project_documentation_title' ) ?> 93 </td> 94 <td class="right"> 95 <?php print_doc_menu( 'proj_doc_page.php' ) ?> 96 </td> 97 </tr> 98 <?php 99 for ($i=0;$i<$num_files;$i++) { 100 $row = db_fetch_array( $result ); 101 extract( $row, EXTR_PREFIX_ALL, 'v' ); 102 $v_filesize = number_format( $v_filesize ); 103 $v_title = string_display( $v_title ); 104 $v_description = string_display_links( $v_description ); 105 $v_date_added = date( config_get( 'normal_date_format' ), db_unixtimestamp( $v_date_added ) ); 106 107 ?> 108 <tr valign="top" <?php echo helper_alternate_class( $i ) ?>> 109 <td> 110 <?php 111 $t_href = '<a href="file_download.php?file_id='.$v_id.'&type=doc">'; 112 echo $t_href; 113 print_file_icon( $v_filename ); 114 echo '</a> ' . $t_href . $v_title . '</a> ('.$v_filesize.' bytes)'; 115 ?> 116 <br /> 117 <span class="small"> 118 <?php 119 if( $v_project_id == ALL_PROJECTS ) { 120 echo lang_get( 'all_projects' ) . '<br/>'; 121 } 122 elseif( $v_project_id != $f_project_id ) { 123 $t_project_name = project_get_name( $v_project_id ); 124 echo $t_project_name . '<br/>'; 125 } 126 echo '(' . $v_date_added . ')'; 127 if ( access_has_project_level( config_get( 'manage_project_threshold', null, null, $v_project_id ), $v_project_id ) ) { 128 echo ' '; 129 print_button( 'proj_doc_edit_page.php?file_id='.$v_id, lang_get( 'edit_link' ) ); 130 echo ' '; 131 print_button( 'proj_doc_delete.php?file_id=' . $v_id, lang_get( 'delete_link' ) ); 132 } 133 ?> 134 </span> 135 </td> 136 <td> 137 <?php echo $v_description ?> 138 </td> 139 </tr> 140 <?php 141 } # end for loop 142 ?> 143 </table> 144 </div> 145 146 <?php html_page_bottom1( __FILE__ ) ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Thu Nov 29 09:42:17 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |