Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 129 lines (101 sloc) 3.654 kb
ab5f677 don't think I can split these up any more
Julian Fitzell authored
1 <?php
4d63b48 @siebrand Mantis -> MantisBT in file headers, comments, and elsewhere.
siebrand authored
2 # MantisBT - a php based bugtracking system
2669909 @giallu Merge back to HEAD the changes between tags:
giallu authored
3
4d63b48 @siebrand Mantis -> MantisBT in file headers, comments, and elsewhere.
siebrand authored
4 # MantisBT is free software: you can redistribute it and/or modify
2669909 @giallu Merge back to HEAD the changes between tags:
giallu authored
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 #
4d63b48 @siebrand Mantis -> MantisBT in file headers, comments, and elsewhere.
siebrand authored
9 # MantisBT is distributed in the hope that it will be useful,
2669909 @giallu Merge back to HEAD the changes between tags:
giallu authored
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
4d63b48 @siebrand Mantis -> MantisBT in file headers, comments, and elsewhere.
siebrand authored
15 # along with MantisBT. If not, see <http://www.gnu.org/licenses/>.
ab5f677 don't think I can split these up any more
Julian Fitzell authored
16
526bbaa @grangeway Comment updates for phpdoc ( http://www.mantisforge.org/dev/phpdoc/ )…
grangeway authored
17 /**
18 * @package MantisBT
19 * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
c757c81 @dregad Update copyright year to 2012
dregad authored
20 * @copyright Copyright (C) 2002 - 2012 MantisBT Team - mantisbt-dev@lists.sourceforge.net
526bbaa @grangeway Comment updates for phpdoc ( http://www.mantisforge.org/dev/phpdoc/ )…
grangeway authored
21 * @link http://www.mantisbt.org
22 */
23 /**
4d63b48 @siebrand Mantis -> MantisBT in file headers, comments, and elsewhere.
siebrand authored
24 * MantisBT Core API's
526bbaa @grangeway Comment updates for phpdoc ( http://www.mantisforge.org/dev/phpdoc/ )…
grangeway authored
25 */
1ac5f0b More require_once statements added. Note that these new statements en…
Jeroen Latour authored
26 require_once( 'core.php' );
638dcd0 Fixed inconsistencies in line-endings
Jeroen Latour authored
27
c36df5b @grangeway following giallu's change to use set_include_path to set first requir…
grangeway authored
28 require_once( 'filter_api.php' );
29 require_once( 'csv_api.php' );
30 require_once( 'columns_api.php' );
96760eb @vboctor Fixed #8922: Support including 'description', 'steps_to_reproduce', '…
vboctor authored
31
32 auth_ensure_user_authenticated();
33
00476a0 @vboctor Fixed #5725: Fatal error: Maximum execution time of 30 seconds exceed…
vboctor authored
34 helper_begin_long_process();
ab5f677 don't think I can split these up any more
Julian Fitzell authored
35
f24ca77 Fix issue #2962 'Call-time pass-by-reference'
Julian Fitzell authored
36 $t_page_number = 1;
37 $t_per_page = -1;
ab5f677 don't think I can split these up any more
Julian Fitzell authored
38 $t_bug_count = null;
39 $t_page_count = null;
40
661108e * Enh #3974: Make Mantis issues searchable by Search Engine
int2str authored
41 $t_nl = csv_get_newline();
42 $t_sep = csv_get_separator();
92b07e0 @vboctor Re-implemented exporting of csv to include the following:
vboctor authored
43
44 # Get bug rows according to the current filter
cc24849 @vboctor Fixed #3315: Allow user to add custom fields in Reports, Exports and …
vboctor authored
45 $t_rows = filter_get_bug_rows( $t_page_number, $t_per_page, $t_page_count, $t_bug_count );
46 if ( $t_rows === false ) {
afdf92d @vboctor Removed some direct references to cookies + checking return value for…
vboctor authored
47 print_header_redirect( 'view_all_set.php?type=0' );
48 }
45f4f52 @vincentsels Fix #13715: Export plugin columns to CSV and Excel
vincentsels authored
49
50 # pre-cache custom column data
51 columns_plugin_cache_issue_data( $t_rows );
afdf92d @vboctor Removed some direct references to cookies + checking return value for…
vboctor authored
52
cc24849 @vboctor Fixed #3315: Allow user to add custom fields in Reports, Exports and …
vboctor authored
53 $t_filename = csv_get_default_filename();
afdf92d @vboctor Removed some direct references to cookies + checking return value for…
vboctor authored
54
55 # Send headers to browser to activate mime loading
43e7bb1 Patched workaround for IE+SSL file download bug.
robertjf authored
56
57 # Make sure that IE can download the attachments under https.
58 header( 'Pragma: public' );
638dcd0 Fixed inconsistencies in line-endings
Jeroen Latour authored
59
dd92630 @rombert Fix #13370 : CSV export specifies incorrect MIME type
rombert authored
60 header( 'Content-Type: text/csv; name=' . urlencode( file_clean_name( $t_filename ) ) );
afdf92d @vboctor Removed some direct references to cookies + checking return value for…
vboctor authored
61 header( 'Content-Transfer-Encoding: BASE64;' );
43e7bb1 Patched workaround for IE+SSL file download bug.
robertjf authored
62
63 # Added Quotes (") around file name.
d2f77f2 @grangeway Fix: 0010421: Default filename corrupted if project name contains spe…
grangeway authored
64 header( 'Content-Disposition: attachment; filename="' . urlencode( file_clean_name( $t_filename ) ) . '"' );
ab5f677 don't think I can split these up any more
Julian Fitzell authored
65
92b07e0 @vboctor Re-implemented exporting of csv to include the following:
vboctor authored
66 # Get columns to be exported
67 $t_columns = csv_get_columns();
18506eb miscellaneous cleanup
Julian Fitzell authored
68
4fd5356 @VeMag Fix #0009034: CSV Export with special chars dont work properly
VeMag authored
69 # export BOM
70 if ( config_get( 'csv_add_bom' ) == ON ) {
71 echo "\xEF\xBB\xBF";
72 }
73
92b07e0 @vboctor Re-implemented exporting of csv to include the following:
vboctor authored
74 # export the titles
cc24849 @vboctor Fixed #3315: Allow user to add custom fields in Reports, Exports and …
vboctor authored
75 $t_first_column = true;
76 ob_start();
92b07e0 @vboctor Re-implemented exporting of csv to include the following:
vboctor authored
77 $t_titles = array();
cc24849 @vboctor Fixed #3315: Allow user to add custom fields in Reports, Exports and …
vboctor authored
78 foreach ( $t_columns as $t_column ) {
79 if ( !$t_first_column ) {
80 echo $t_sep;
81 } else {
82 $t_first_column = false;
83 }
84
96760eb @vboctor Fixed #8922: Support including 'description', 'steps_to_reproduce', '…
vboctor authored
85 echo column_get_title( $t_column );
92b07e0 @vboctor Re-implemented exporting of csv to include the following:
vboctor authored
86 }
00476a0 @vboctor Fixed #5725: Fatal error: Maximum execution time of 30 seconds exceed…
vboctor authored
87
cc24849 @vboctor Fixed #3315: Allow user to add custom fields in Reports, Exports and …
vboctor authored
88 echo $t_nl;
39631f1 @vboctor Fix #3728: CSV export shows &quot; instead of real quotes in bug title.
vboctor authored
89
cc24849 @vboctor Fixed #3315: Allow user to add custom fields in Reports, Exports and …
vboctor authored
90 $t_header = ob_get_clean();
39631f1 @vboctor Fix #3728: CSV export shows &quot; instead of real quotes in bug title.
vboctor authored
91
f447dac @vboctor 4872: CSV export uses , as separator but excel only recognizes ; in n…
vboctor authored
92 # Fixed for a problem in Excel where it prompts error message "SYLK: File Format Is Not Valid"
93 # See Microsoft Knowledge Base Article - 323626
39631f1 @vboctor Fix #3728: CSV export shows &quot; instead of real quotes in bug title.
vboctor authored
94 # http://support.microsoft.com/default.aspx?scid=kb;en-us;323626&Product=xlw
e345f2f @jreese Fix #10303: Use UTF-8 compatible string functions.
jreese authored
95 $t_first_three_chars = utf8_substr( $t_header, 0, 3 );
f447dac @vboctor 4872: CSV export uses , as separator but excel only recognizes ; in n…
vboctor authored
96 if ( strcmp( $t_first_three_chars, 'ID' . $t_sep ) == 0 ) {
97 $t_header = str_replace( 'ID' . $t_sep, 'Id' . $t_sep, $t_header );
39631f1 @vboctor Fix #3728: CSV export shows &quot; instead of real quotes in bug title.
vboctor authored
98 }
99 # end of fix
100
f447dac @vboctor 4872: CSV export uses , as separator but excel only recognizes ; in n…
vboctor authored
101 echo $t_header;
ab5f677 don't think I can split these up any more
Julian Fitzell authored
102
92b07e0 @vboctor Re-implemented exporting of csv to include the following:
vboctor authored
103 # export the rows
cc24849 @vboctor Fixed #3315: Allow user to add custom fields in Reports, Exports and …
vboctor authored
104 foreach ( $t_rows as $t_row ) {
105 $t_first_column = true;
106
107 foreach ( $t_columns as $t_column ) {
108 if ( !$t_first_column ) {
109 echo $t_sep;
110 } else {
111 $t_first_column = false;
92b07e0 @vboctor Re-implemented exporting of csv to include the following:
vboctor authored
112 }
ab5f677 don't think I can split these up any more
Julian Fitzell authored
113
45f4f52 @vincentsels Fix #13715: Export plugin columns to CSV and Excel
vincentsels authored
114 if ( column_get_custom_field_name( $t_column ) !== null || column_is_plugin_column( $t_column ) ) {
cc24849 @vboctor Fixed #3315: Allow user to add custom fields in Reports, Exports and …
vboctor authored
115 ob_start();
116 $t_column_value_function = 'print_column_value';
117 helper_call_custom_function( $t_column_value_function, array( $t_column, $t_row, COLUMNS_TARGET_CSV_PAGE ) );
118 $t_value = ob_get_clean();
119
a39a948 @dregad Fix custom enum types across projects in exports
dregad authored
120 echo csv_escape_string( $t_value );
cc24849 @vboctor Fixed #3315: Allow user to add custom fields in Reports, Exports and …
vboctor authored
121 } else {
122 $t_function = 'csv_format_' . $t_column;
a39a948 @dregad Fix custom enum types across projects in exports
dregad authored
123 echo $t_function( $t_row );
cc24849 @vboctor Fixed #3315: Allow user to add custom fields in Reports, Exports and …
vboctor authored
124 }
92b07e0 @vboctor Re-implemented exporting of csv to include the following:
vboctor authored
125 }
ab5f677 don't think I can split these up any more
Julian Fitzell authored
126
cc24849 @vboctor Fixed #3315: Allow user to add custom fields in Reports, Exports and …
vboctor authored
127 echo $t_nl;
92b07e0 @vboctor Re-implemented exporting of csv to include the following:
vboctor authored
128 }
Something went wrong with that request. Please try again.