|
|
f2e824 |
|
|
|
f2e824 |
# Mantis - a php based bugtracking system
|
|
|
f2e824 |
|
|
|
f2e824 |
# Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
|
|
|
f2e824 |
# Copyright (C) 2002 - 2007 Mantis Team - mantisbt-dev@lists.sourceforge.net
|
|
|
f2e824 |
|
|
|
f2e824 |
# Mantis is free software: you can redistribute it and/or modify
|
|
|
f2e824 |
# it under the terms of the GNU General Public License as published by
|
|
|
f2e824 |
# the Free Software Foundation, either version 2 of the License, or
|
|
|
f2e824 |
# (at your option) any later version.
|
|
|
f2e824 |
#
|
|
|
f2e824 |
# Mantis is distributed in the hope that it will be useful,
|
|
|
f2e824 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
f2e824 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
f2e824 |
# GNU General Public License for more details.
|
|
|
f2e824 |
#
|
|
|
f2e824 |
# You should have received a copy of the GNU General Public License
|
|
|
f2e824 |
# along with Mantis. If not, see <http://www.gnu.org/licenses/>.
|
|
|
f2e824 |
|
|
|
f2e824 |
# --------------------------------------------------------
|
|
|
f2e824 |
# $Id: proj_doc_page.php,v 1.53.2.1 2007-10-13 22:34:24 giallu Exp $
|
|
|
f2e824 |
# --------------------------------------------------------
|
|
|
f2e824 |
|
|
|
f2e824 |
require_once( 'core.php' );
|
|
|
f2e824 |
|
|
|
f2e824 |
$t_core_path = config_get( 'core_path' );
|
|
|
f2e824 |
|
|
|
f2e824 |
require_once( $t_core_path.'string_api.php' );
|
|
|
f2e824 |
|
|
|
f2e824 |
$f_project_id = gpc_get_int( 'project_id', helper_get_current_project() );
|
|
|
f2e824 |
|
|
|
f2e824 |
# Check if project documentation feature is enabled.
|
|
|
f2e824 |
if ( OFF == config_get( 'enable_project_documentation' ) || !file_is_uploading_enabled() ) {
|
|
|
f2e824 |
access_denied();
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
# Override the current page to make sure we get the appropriate project-specific configuration
|
|
|
f2e824 |
$g_project_override = $f_project_id;
|
|
|
f2e824 |
|
|
|
f2e824 |
$t_user_id = auth_get_current_user_id();
|
|
|
f2e824 |
$t_project_file_table = config_get( 'mantis_project_file_table' );
|
|
|
f2e824 |
$t_project_table = config_get( 'mantis_project_table' );
|
|
|
f2e824 |
$t_project_user_list_table = config_get( 'mantis_project_user_list_table' );
|
|
|
f2e824 |
$t_user_table = config_get( 'mantis_user_table' );
|
|
|
f2e824 |
$t_pub = VS_PUBLIC;
|
|
|
f2e824 |
$t_priv = VS_PRIVATE;
|
|
|
f2e824 |
$t_admin = ADMINISTRATOR;
|
|
|
f2e824 |
|
|
|
f2e824 |
if ( $f_project_id == ALL_PROJECTS ) {
|
|
|
f2e824 |
# Select all the projects that the user has access to
|
|
|
f2e824 |
$t_projects = user_get_accessible_projects( $t_user_id );
|
|
|
f2e824 |
} else {
|
|
|
f2e824 |
# Select the specific project
|
|
|
f2e824 |
$t_projects = array( $f_project_id );
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
$t_projects[] = ALL_PROJECTS; # add "ALL_PROJECTS to the list of projects to fetch
|
|
|
f2e824 |
|
|
|
f2e824 |
$t_reqd_access = config_get( 'view_proj_doc_threshold' );
|
|
|
f2e824 |
if ( is_array( $t_reqd_access ) ) {
|
|
|
f2e824 |
if ( 1 == count( $t_reqd_access ) ) {
|
|
|
f2e824 |
$t_access_clause = "= " . array_shift( $t_reqd_access ) . " ";
|
|
|
f2e824 |
} else {
|
|
|
f2e824 |
$t_access_clause = "IN (" . implode( ',', $t_reqd_access ) . ")";
|
|
|
f2e824 |
}
|
|
|
f2e824 |
} else {
|
|
|
f2e824 |
$t_access_clause = ">= $t_reqd_access ";
|
|
|
f2e824 |
}
|
|
|
f2e824 |
|
|
|
f2e824 |
$query = "SELECT pft.id, pft.project_id, pft.filename, pft.filesize, pft.title, pft.description, pft.date_added
|
|
|
f2e824 |
FROM $t_project_file_table pft
|
|
|
f2e824 |
LEFT JOIN $t_project_table pt ON pft.project_id = pt.id
|
|
|
f2e824 |
LEFT JOIN $t_project_user_list_table pult
|
|
|
f2e824 |
ON pft.project_id = pult.project_id AND pult.user_id = $t_user_id
|
|
|
f2e824 |
LEFT JOIN $t_user_table ut ON ut.id = $t_user_id
|
|
|
f2e824 |
WHERE pft.project_id in (" . implode( ',', $t_projects ) . ") AND
|
|
|
f2e824 |
( ( ( 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
|
|
|
f2e824 |
( ( pult.user_id = $t_user_id ) AND ( pult.access_level $t_access_clause ) ) OR
|
|
|
f2e824 |
( ut.access_level = $t_admin ) )
|
|
|
f2e824 |
ORDER BY pt.name ASC, pft.title ASC";
|
|
|
f2e824 |
$result = db_query( $query );
|
|
|
f2e824 |
$num_files = db_num_rows( $result );
|
|
|
f2e824 |
|
|
|
f2e824 |
html_page_top1( lang_get( 'docs_link' ) );
|
|
|
f2e824 |
html_page_top2();
|
|
|
f2e824 |
?>
|
|
|
f2e824 |
|
|
|
f2e824 |
|
|
|
f2e824 |
|
|
|
f2e824 |
|
|
|
f2e824 |
|
|
|
f2e824 |
|
|
|
f2e824 |
|
|
|
f2e824 |
|
|
|
f2e824 |
|
|
|
f2e824 |
|
|
|
f2e824 |
|
|
|
f2e824 |
|
|
|
f2e824 |
for ($i=0;$i<$num_files;$i++) {
|
|
|
f2e824 |
$row = db_fetch_array( $result );
|
|
|
f2e824 |
extract( $row, EXTR_PREFIX_ALL, 'v' );
|
|
|
f2e824 |
$v_filesize = number_format( $v_filesize );
|
|
|
f2e824 |
$v_title = string_display( $v_title );
|
|
|
f2e824 |
$v_description = string_display_links( $v_description );
|
|
|
f2e824 |
$v_date_added = date( config_get( 'normal_date_format' ), db_unixtimestamp( $v_date_added ) );
|
|
|
f2e824 |
|
|
|
f2e824 |
?>
|
|
|
f2e824 |
>
|
|
|
f2e824 |
|
|
|
f2e824 |
|
|
|
f2e824 |
$t_href = '';
|
|
|
f2e824 |
echo $t_href;
|
|
|
f2e824 |
print_file_icon( $v_filename );
|
|
|
f2e824 |
echo ' ' . $t_href . $v_title . ' ('.$v_filesize.' bytes)';
|
|
|
f2e824 |
?>
|
|
|
f2e824 |
|
|
|
f2e824 |
|
|
|
f2e824 |
|
|
|
f2e824 |
if( $v_project_id == ALL_PROJECTS ) {
|
|
|
f2e824 |
echo lang_get( 'all_projects' ) . ' ';
|
|
|
f2e824 |
}
|
|
|
f2e824 |
elseif( $v_project_id != $f_project_id ) {
|
|
|
f2e824 |
$t_project_name = project_get_name( $v_project_id );
|
|
|
f2e824 |
echo $t_project_name . ' ';
|
|
|
f2e824 |
}
|
|
|
f2e824 |
echo '(' . $v_date_added . ')';
|
|
|
f2e824 |
if ( access_has_project_level( config_get( 'manage_project_threshold', null, null, $v_project_id ), $v_project_id ) ) {
|
|
|
f2e824 |
echo ' ';
|
|
|
f2e824 |
print_button( 'proj_doc_edit_page.php?file_id='.$v_id, lang_get( 'edit_link' ) );
|
|
|
f2e824 |
echo ' ';
|
|
|
f2e824 |
print_button( 'proj_doc_delete.php?file_id=' . $v_id, lang_get( 'delete_link' ) );
|
|
|
f2e824 |
}
|
|
|
f2e824 |
?>
|
|
|
f2e824 |
|
|
|
f2e824 |
|
|
|
f2e824 |
|
|
|
f2e824 |
|
|
|
f2e824 |
|
|
|
f2e824 |
|
|
|
f2e824 |
|
|
|
f2e824 |
} # end for loop
|
|
|
f2e824 |
?>
|
|
|
f2e824 |
|
|
|
f2e824 |
|
|
|
f2e824 |
|
|
|
f2e824 |
|