Line 1... |
Line 1... |
1 |
<?php |
1 |
<?php |
2 |
# vim:et:ts=3:sts=3:sw=3:fdm=marker: |
2 |
# vim:et:ts=3:sts=3:sw=3:fdm=marker: |
3 |
|
3 |
|
4 |
// WebSVN - Subversion repository viewing via the web using PHP |
4 |
// WebSVN - Subversion repository viewing via the web using PHP |
5 |
// Copyright © 2004-2006 Tim Armes, Matt Sicker |
5 |
// Copyright © 2004-2006 Tim Armes, Matt Sicker |
6 |
// |
6 |
// |
7 |
// This program is free software; you can redistribute it and/or modify |
7 |
// This program is free software; you can redistribute it and/or modify |
8 |
// it under the terms of the GNU General Public License as published by |
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 |
9 |
// the Free Software Foundation; either version 2 of the License, or |
10 |
// (at your option) any later version. |
10 |
// (at your option) any later version. |
11 |
// |
11 |
// |
12 |
// This program is distributed in the hope that it will be useful, |
12 |
// This program is distributed in the hope that it will be useful, |
13 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 |
// GNU General Public License for more details. |
15 |
// GNU General Public License for more details. |
16 |
// |
16 |
// |
17 |
// You should have received a copy of the GNU General Public License |
17 |
// You should have received a copy of the GNU General Public License |
18 |
// along with this program; if not, write to the Free Software |
18 |
// along with this program; if not, write to the Free Software |
19 |
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
19 |
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
20 |
// |
20 |
// |
21 |
// -- |
21 |
// -- |
22 |
// |
22 |
// |
23 |
// setup.inc |
23 |
// setup.inc |
24 |
// |
24 |
// |
25 |
// Global setup |
25 |
// Global setup |
26 |
|
26 |
|
27 |
// --- DON'T CHANGE THIS FILE --- |
27 |
// --- DON'T CHANGE THIS FILE --- |
28 |
// |
28 |
// |
29 |
// User changes should be done in config.ini |
29 |
// User changes should be done in config.ini |
30 |
|
30 |
|
31 |
// Include the configuration class |
31 |
// Include the configuration class |
32 |
require_once 'include/configclass.inc'; |
32 |
require_once 'include/configclass.inc'; |
33 |
require_once 'include/svnlook.inc'; |
33 |
|
34 |
|
34 |
// Create the config |
35 |
// Define the language array |
35 |
$config = new Config; |
36 |
$lang = array(); |
36 |
|
37 |
$langNames = array(); |
37 |
// Set up the default character encodings |
38 |
|
38 |
if (function_exists('iconv_get_encoding')) |
39 |
// Include a default language file. |
39 |
{ |
40 |
require 'languages/english.inc'; |
40 |
$config->setInputEncoding(iconv_get_encoding('input_encoding')); |
41 |
|
41 |
} |
42 |
// Set up locwebsvnhttp |
42 |
|
43 |
// Note: we will use nothing in MultiViews mode so that the URLs use the root |
43 |
// Define the language array |
44 |
// directory by default. |
44 |
$lang = array(); |
45 |
if (empty($locwebsvnhttp)) |
45 |
$langNames = array(); |
46 |
$locwebsvnhttp = defined('WSVN_MULTIVIEWS') ? '' : '.'; |
46 |
|
47 |
|
47 |
// Set up locwebsvnhttp |
48 |
if (empty($locwebsvnreal)) |
48 |
// Note: we will use nothing in MultiViews mode so that the URLs use the root |
49 |
$locwebsvnreal = '.'; |
49 |
// directory by default. |
50 |
|
50 |
if (empty($locwebsvnhttp)) |
51 |
$vars['locwebsvnhttp'] = $locwebsvnhttp; |
51 |
$locwebsvnhttp = defined('WSVN_MULTIVIEWS') ? '' : '.'; |
52 |
|
52 |
|
53 |
// Make sure that the input locale is set up correctly |
53 |
if (empty($locwebsvnreal)) |
54 |
setlocale(LC_ALL, ''); |
54 |
$locwebsvnreal = '.'; |
55 |
|
55 |
|
56 |
// Create the config |
56 |
$vars['locwebsvnhttp'] = $locwebsvnhttp; |
57 |
$config = new Config; |
57 |
|
58 |
|
58 |
// Include a default language file (must go before config.inc) |
59 |
// Set up the default character encodings |
59 |
require 'languages/english.inc'; |
60 |
if (function_exists('iconv_get_encoding')) |
60 |
|
61 |
{ |
61 |
// Get the user's personalised config (requires the locwebsvnhttp stuff above) |
62 |
$config->setInputEncoding(iconv_get_encoding('input_encoding')); |
62 |
require_once 'config.inc'; |
63 |
} |
63 |
|
64 |
|
64 |
// Load PHP_Compat if we're going to use it. This needs to be done after including config.inc (which contains |
65 |
// {{{ Content-Type's |
65 |
// the setting) but before svnlook.inc (which requires util.inc, which contains PHP4-incompatible functions) |
66 |
// Set up the default content-type extension handling |
66 |
if ($config->isPHPCompatEnabled()) { |
67 |
|
67 |
require_once($config->getPHPCompatFile()); |
68 |
$contentType = array ( |
68 |
require_once 'include/php5compat.inc'; |
69 |
|
69 |
} |
70 |
'.dwg' => 'application/acad', // AutoCAD Drawing files |
70 |
|
71 |
'.DWG' => 'application/acad', // AutoCAD Drawing files |
71 |
require_once 'include/svnlook.inc'; |
72 |
'.arj' => 'application/arj', // |
72 |
|
73 |
'.ccAD' => 'application/clariscad', // ClarisCAD files |
73 |
// Make sure that the input locale is set up correctly |
74 |
'.DRW' => 'application/drafting', // MATRA Prelude drafting |
74 |
setlocale(LC_ALL, ''); |
75 |
'.dxf' => 'application/dxf', // DXF (AutoCAD) |
75 |
|
76 |
'.DXF' => 'application/dxf', // DXF (AutoCAD) |
76 |
// {{{ Content-Type's |
77 |
'.xl' => 'application/excel', // Microsoft Excel |
77 |
// Set up the default content-type extension handling |
78 |
'.unv' => 'application/i-deas', //SDRC I-DEAS files |
78 |
|
79 |
'.UNV' => 'application/i-deas', //SDRC I-DEAS files |
79 |
$contentType = array ( |
80 |
'.igs' => 'application/iges', // IGES graphics format |
80 |
|
81 |
'.iges' => 'application/iges', // IGES graphics format |
81 |
'.dwg' => 'application/acad', // AutoCAD Drawing files |
82 |
'.IGS' => 'application/iges', // IGES graphics format |
82 |
'.DWG' => 'application/acad', // AutoCAD Drawing files |
83 |
'.IGES' => 'application/iges', // IGES graphics format |
83 |
'.arj' => 'application/arj', // |
84 |
'.hqx' => 'application/mac-binhex40', // Macintosh BinHex format |
84 |
'.ccAD' => 'application/clariscad', // ClarisCAD files |
85 |
'.word' => 'application/msword', // Microsoft Word |
85 |
'.DRW' => 'application/drafting', // MATRA Prelude drafting |
86 |
'.w6w' => 'application/msword', // Microsoft Word |
86 |
'.dxf' => 'application/dxf', // DXF (AutoCAD) |
87 |
'.doc' => 'application/msword', // Microsoft Word |
87 |
'.DXF' => 'application/dxf', // DXF (AutoCAD) |
88 |
'.wri' => 'application/mswrite', // Microsoft Write |
88 |
'.xl' => 'application/excel', // Microsoft Excel |
89 |
'.bin' => 'application/octet-stream', // Uninterpreted binary |
89 |
'.unv' => 'application/i-deas', //SDRC I-DEAS files |
90 |
'.exe' => 'application/x-msdownload', // Windows EXE |
90 |
'.UNV' => 'application/i-deas', //SDRC I-DEAS files |
91 |
'.EXE' => 'application/x-msdownload', // Windows EXE |
91 |
'.igs' => 'application/iges', // IGES graphics format |
92 |
'.oda' => 'application/oda', // |
92 |
'.iges' => 'application/iges', // IGES graphics format |
93 |
'.pdf' => 'application/pdf', // PDF (Adobe Acrobat) |
93 |
'.IGS' => 'application/iges', // IGES graphics format |
94 |
'.ai' => 'application/postscript', // PostScript |
94 |
'.IGES' => 'application/iges', // IGES graphics format |
95 |
'.PS' => 'application/postscript', // PostScript |
95 |
'.hqx' => 'application/mac-binhex40', // Macintosh BinHex format |
96 |
'.ps' => 'application/postscript', // PostScript |
96 |
'.word' => 'application/msword', // Microsoft Word |
97 |
'.eps' => 'application/postscript', // PostScript |
97 |
'.w6w' => 'application/msword', // Microsoft Word |
98 |
'.prt' => 'application/pro_eng', // PTC Pro/ENGINEER |
98 |
'.doc' => 'application/msword', // Microsoft Word |
99 |
'.PRT' => 'application/pro_eng', // PTC Pro/ENGINEER |
99 |
'.wri' => 'application/mswrite', // Microsoft Write |
100 |
'.part' => 'application/pro_eng', // PTC Pro/ENGINEER |
100 |
'.bin' => 'application/octet-stream', // Uninterpreted binary |
101 |
'.rtf' => 'application/rtf', // Rich Text Format |
101 |
'.exe' => 'application/x-msdownload', // Windows EXE |
102 |
'.set' => 'application/set', // SET (French CAD standard) |
102 |
'.EXE' => 'application/x-msdownload', // Windows EXE |
103 |
'.SET' => 'application/set', // SET (French CAD standard) |
103 |
'.oda' => 'application/oda', // |
104 |
'.stl' => 'application/sla', // Stereolithography |
104 |
'.pdf' => 'application/pdf', // PDF (Adobe Acrobat) |
105 |
'.STL' => 'application/sla', // Stereolithography |
105 |
'.ai' => 'application/postscript', // PostScript |
106 |
'.SOL' => 'application/solids', // MATRA Prelude Solids |
106 |
'.PS' => 'application/postscript', // PostScript |
107 |
'.stp' => 'application/STEP', // ISO-10303 STEP data files |
107 |
'.ps' => 'application/postscript', // PostScript |
108 |
'.STP' => 'application/STEP', // ISO-10303 STEP data files |
108 |
'.eps' => 'application/postscript', // PostScript |
109 |
'.step' => 'application/STEP', // ISO-10303 STEP data files |
109 |
'.prt' => 'application/pro_eng', // PTC Pro/ENGINEER |
110 |
'.STEP' => 'application/STEP', // ISO-10303 STEP data files |
110 |
'.PRT' => 'application/pro_eng', // PTC Pro/ENGINEER |
111 |
'.vda' => 'application/vda', // VDA-FS Surface data |
111 |
'.part' => 'application/pro_eng', // PTC Pro/ENGINEER |
112 |
'.VDA' => 'application/vda', // VDA-FS Surface data |
112 |
'.rtf' => 'application/rtf', // Rich Text Format |
113 |
'.dir' => 'application/x-director', // Macromedia Director |
113 |
'.set' => 'application/set', // SET (French CAD standard) |
114 |
'.dcr' => 'application/x-director', // Macromedia Director |
114 |
'.SET' => 'application/set', // SET (French CAD standard) |
115 |
'.dxr' => 'application/x-director', // Macromedia Director |
115 |
'.stl' => 'application/sla', // Stereolithography |
116 |
'.mif' => 'application/x-mif', // FrameMaker MIF Format |
116 |
'.STL' => 'application/sla', // Stereolithography |
117 |
'.csh' => 'application/x-csh', // C-shell script |
117 |
'.SOL' => 'application/solids', // MATRA Prelude Solids |
118 |
'.dvi' => 'application/x-dvi', // TeX DVI |
118 |
'.stp' => 'application/STEP', // ISO-10303 STEP data files |
119 |
'.gz' => 'application/x-gzip', // GNU Zip |
119 |
'.STP' => 'application/STEP', // ISO-10303 STEP data files |
120 |
'.gzip' => 'application/x-gzip', // GNU Zip |
120 |
'.step' => 'application/STEP', // ISO-10303 STEP data files |
121 |
'.hdf' => 'application/x-hdf', // ncSA HDF Data File |
121 |
'.STEP' => 'application/STEP', // ISO-10303 STEP data files |
122 |
'.latex' => 'application/x-latex', // LaTeX source |
122 |
'.vda' => 'application/vda', // VDA-FS Surface data |
123 |
'.nc' => 'application/x-netcdf', // Unidata netCDF |
123 |
'.VDA' => 'application/vda', // VDA-FS Surface data |
124 |
'.cdf' => 'application/x-netcdf', // Unidata netCDF |
124 |
'.dir' => 'application/x-director', // Macromedia Director |
125 |
'.sit' => 'application/x-stuffit', // Stiffut Archive |
125 |
'.dcr' => 'application/x-director', // Macromedia Director |
126 |
'.tcl' => 'application/x-tcl', // TCL script |
126 |
'.dxr' => 'application/x-director', // Macromedia Director |
127 |
'.texinfo' => 'application/x-texinfo', // Texinfo (Emacs) |
127 |
'.mif' => 'application/x-mif', // FrameMaker MIF Format |
128 |
'.texi' => 'application/x-texinfo', // Texinfo (Emacs) |
128 |
'.csh' => 'application/x-csh', // C-shell script |
129 |
'.t' => 'application/x-troff', // Troff |
129 |
'.dvi' => 'application/x-dvi', // TeX DVI |
130 |
'.tr' => 'application/x-troff', // Troff |
130 |
'.gz' => 'application/x-gzip', // GNU Zip |
131 |
'.roff' => 'application/x-troff', // Troff |
131 |
'.gzip' => 'application/x-gzip', // GNU Zip |
132 |
'.man' => 'application/x-troff-man', // Troff with MAN macros |
132 |
'.hdf' => 'application/x-hdf', // ncSA HDF Data File |
133 |
'.me' => 'application/x-troff-me', // Troff with ME macros |
133 |
'.latex' => 'application/x-latex', // LaTeX source |
134 |
'.ms' => 'application/x-troff-ms', // Troff with MS macros |
134 |
'.nc' => 'application/x-netcdf', // Unidata netCDF |
135 |
'.src' => 'application/x-wais-source', // WAIS source |
135 |
'.cdf' => 'application/x-netcdf', // Unidata netCDF |
136 |
'.bcpio' => 'application/x-bcpio', // Old binary CPIO |
136 |
'.sit' => 'application/x-stuffit', // Stiffut Archive |
137 |
'.cpio' => 'application/x-cpio', // POSIX CPIO |
137 |
'.tcl' => 'application/x-tcl', // TCL script |
138 |
'.gtar' => 'application/x-gtar', // GNU tar |
138 |
'.texinfo' => 'application/x-texinfo', // Texinfo (Emacs) |
139 |
'.shar' => 'application/x-shar', // Shell archive |
139 |
'.texi' => 'application/x-texinfo', // Texinfo (Emacs) |
140 |
'.sv4cpio' => 'application/x-sv4cpio', // SVR4 CPIO |
140 |
'.t' => 'application/x-troff', // Troff |
141 |
'.sv4crc' => 'application/x-sv4crc', // SVR4 CPIO with CRC |
141 |
'.tr' => 'application/x-troff', // Troff |
142 |
'.tar' => 'application/x-tar', // 4.3BSD tar format |
142 |
'.roff' => 'application/x-troff', // Troff |
143 |
'.ustar' => 'application/x-ustar', // POSIX tar format |
143 |
'.man' => 'application/x-troff-man', // Troff with MAN macros |
144 |
'.hlp' => 'application/x-winhelp', // Windows Help |
144 |
'.me' => 'application/x-troff-me', // Troff with ME macros |
145 |
'.zip' => 'application/zip', // ZIP archive |
145 |
'.ms' => 'application/x-troff-ms', // Troff with MS macros |
146 |
'.au' => 'audio/basic', // Basic audio (usually m-law) |
146 |
'.src' => 'application/x-wais-source', // WAIS source |
147 |
'.snd' => 'audio/basic', // Basic audio (usually m-law) |
147 |
'.bcpio' => 'application/x-bcpio', // Old binary CPIO |
148 |
'.aif' => 'audio/x-aiff', // AIFF audio |
148 |
'.cpio' => 'application/x-cpio', // POSIX CPIO |
149 |
'.aiff' => 'audio/x-aiff', // AIFF audio |
149 |
'.gtar' => 'application/x-gtar', // GNU tar |
150 |
'.aifc' => 'audio/x-aiff', // AIFF audio |
150 |
'.shar' => 'application/x-shar', // Shell archive |
151 |
'.ra' => 'audio/x-pn-realaudio', // RealAudio |
151 |
'.sv4cpio' => 'application/x-sv4cpio', // SVR4 CPIO |
152 |
'.ram' => 'audio/x-pn-realaudio', // RealAudio |
152 |
'.sv4crc' => 'application/x-sv4crc', // SVR4 CPIO with CRC |
153 |
'.rpm' => 'audio/x-pn-realaudio-plugin', // RealAudio (plug-in) |
153 |
'.tar' => 'application/x-tar', // 4.3BSD tar format |
154 |
'.wav' => 'audio/x-wav', // Windows WAVE audio |
154 |
'.ustar' => 'application/x-ustar', // POSIX tar format |
155 |
'.mp3' => 'audio/x-mp3', // MP3 files |
155 |
'.hlp' => 'application/x-winhelp', // Windows Help |
156 |
'.gif' => 'image/gif', // gif image |
156 |
'.zip' => 'application/zip', // ZIP archive |
157 |
'.ief' => 'image/ief', // Image Exchange Format |
157 |
'.au' => 'audio/basic', // Basic audio (usually m-law) |
158 |
'.jpg' => 'image/jpeg', // JPEG image |
158 |
'.snd' => 'audio/basic', // Basic audio (usually m-law) |
159 |
'.JPG' => 'image/jpeg', // JPEG image |
159 |
'.aif' => 'audio/x-aiff', // AIFF audio |
160 |
'.JPE' => 'image/jpeg', // JPEG image |
160 |
'.aiff' => 'audio/x-aiff', // AIFF audio |
161 |
'.jpe' => 'image/jpeg', // JPEG image |
161 |
'.aifc' => 'audio/x-aiff', // AIFF audio |
162 |
'.JPEG' => 'image/jpeg', // JPEG image |
162 |
'.ra' => 'audio/x-pn-realaudio', // RealAudio |
163 |
'.jpeg' => 'image/jpeg', // JPEG image |
163 |
'.ram' => 'audio/x-pn-realaudio', // RealAudio |
164 |
'.pict' => 'image/pict', // Macintosh PICT |
164 |
'.rpm' => 'audio/x-pn-realaudio-plugin', // RealAudio (plug-in) |
165 |
'.tiff' => 'image/tiff', // TIFF image |
165 |
'.wav' => 'audio/x-wav', // Windows WAVE audio |
166 |
'.tif' => 'image/tiff', // TIFF image |
166 |
'.mp3' => 'audio/x-mp3', // MP3 files |
167 |
'.ras' => 'image/x-cmu-raster', // CMU raster |
167 |
'.gif' => 'image/gif', // gif image |
168 |
'.pnm' => 'image/x-portable-anymap', // PBM Anymap format |
168 |
'.ief' => 'image/ief', // Image Exchange Format |
169 |
'.pbm' => 'image/x-portable-bitmap', // PBM Bitmap format |
169 |
'.jpg' => 'image/jpeg', // JPEG image |
170 |
'.pgm' => 'image/x-portable-graymap', // PBM Graymap format |
170 |
'.JPG' => 'image/jpeg', // JPEG image |
171 |
'.ppm' => 'image/x-portable-pixmap', // PBM Pixmap format |
171 |
'.JPE' => 'image/jpeg', // JPEG image |
172 |
'.rgb' => 'image/x-rgb', // RGB Image |
172 |
'.jpe' => 'image/jpeg', // JPEG image |
173 |
'.xbm' => 'image/x-xbitmap', // X Bitmap |
173 |
'.JPEG' => 'image/jpeg', // JPEG image |
174 |
'.xpm' => 'image/x-xpixmap', // X Pixmap |
174 |
'.jpeg' => 'image/jpeg', // JPEG image |
175 |
'.xwd' => 'image/x-xwindowdump', // X Windows dump (xwd) format |
175 |
'.pict' => 'image/pict', // Macintosh PICT |
176 |
'.zip' => 'multipart/x-zip', // PKZIP Archive |
176 |
'.tiff' => 'image/tiff', // TIFF image |
177 |
'.gzip' => 'multipart/x-gzip', // GNU ZIP Archive |
177 |
'.tif' => 'image/tiff', // TIFF image |
178 |
'.mpeg' => 'video/mpeg', // MPEG video |
178 |
'.ras' => 'image/x-cmu-raster', // CMU raster |
179 |
'.mpg' => 'video/mpeg', // MPEG video |
179 |
'.pnm' => 'image/x-portable-anymap', // PBM Anymap format |
180 |
'.MPG' => 'video/mpeg', // MPEG video |
180 |
'.pbm' => 'image/x-portable-bitmap', // PBM Bitmap format |
181 |
'.MPE' => 'video/mpeg', // MPEG video |
181 |
'.pgm' => 'image/x-portable-graymap', // PBM Graymap format |
182 |
'.mpe' => 'video/mpeg', // MPEG video |
182 |
'.ppm' => 'image/x-portable-pixmap', // PBM Pixmap format |
183 |
'.MPEG' => 'video/mpeg', // MPEG video |
183 |
'.rgb' => 'image/x-rgb', // RGB Image |
184 |
'.mpeg' => 'video/mpeg', // MPEG video |
184 |
'.xbm' => 'image/x-xbitmap', // X Bitmap |
185 |
'.qt' => 'video/quicktime', // QuickTime Video |
185 |
'.xpm' => 'image/x-xpixmap', // X Pixmap |
186 |
'.mov' => 'video/quicktime', // QuickTime Video |
186 |
'.xwd' => 'image/x-xwindowdump', // X Windows dump (xwd) format |
187 |
'.avi' => 'video/msvideo', // Microsoft Windows Video |
187 |
'.zip' => 'multipart/x-zip', // PKZIP Archive |
188 |
'.movie' => 'video/x-sgi-movie', // SGI Movieplayer format |
188 |
'.gzip' => 'multipart/x-gzip', // GNU ZIP Archive |
189 |
'.wrl' => 'x-world/x-vrml' // VRML Worlds |
189 |
'.mpeg' => 'video/mpeg', // MPEG video |
190 |
|
190 |
'.mpg' => 'video/mpeg', // MPEG video |
191 |
); |
191 |
'.MPG' => 'video/mpeg', // MPEG video |
192 |
|
192 |
'.MPE' => 'video/mpeg', // MPEG video |
193 |
// }}} |
193 |
'.mpe' => 'video/mpeg', // MPEG video |
194 |
|
194 |
'.MPEG' => 'video/mpeg', // MPEG video |
195 |
// {{{ Enscript file extensions |
195 |
'.mpeg' => 'video/mpeg', // MPEG video |
196 |
|
196 |
'.qt' => 'video/quicktime', // QuickTime Video |
197 |
// List of extensions recognised by enscript. |
197 |
'.mov' => 'video/quicktime', // QuickTime Video |
198 |
|
198 |
'.avi' => 'video/msvideo', // Microsoft Windows Video |
199 |
$extEnscript = array |
199 |
'.movie' => 'video/x-sgi-movie', // SGI Movieplayer format |
200 |
( |
200 |
'.wrl' => 'x-world/x-vrml', // VRML Worlds |
201 |
'.ada' => 'ada', |
201 |
'.odt' => 'application/vnd.oasis.opendocument.text', // OpenDocument Text |
202 |
'.adb' => 'ada', |
202 |
'.ott' => 'application/vnd.oasis.opendocument.text-template', // OpenDocument Text Template |
203 |
'.ads' => 'ada', |
203 |
'.ods' => 'application/vnd.oasis.opendocument.spreadsheet', // OpenDocument Spreadsheet |
204 |
'.awk' => 'awk', |
204 |
'.ots' => 'application/vnd.oasis.opendocument.spreadsheet-template', // OpenDocument Spreadsheet Template |
205 |
'.c' => 'c', |
205 |
'.odp' => 'application/vnd.oasis.opendocument.presentation', // OpenDocument Presentation |
206 |
'.c++' => 'cpp', |
206 |
'.otp' => 'application/vnd.oasis.opendocument.presentation-template', // OpenDocument Presentation Template |
207 |
'.cc' => 'cpp', |
207 |
'.odg' => 'application/vnd.oasis.opendocument.graphics', // OpenDocument Drawing |
208 |
'.cpp' => 'cpp', |
208 |
'.otg' => 'application/vnd.oasis.opendocument.graphics-template', // OpenDocument Drawing Template |
209 |
'.csh' => 'csh', |
209 |
'.odc' => 'application/vnd.oasis.opendocument.chart', // OpenDocument Chart |
210 |
'.cxx' => 'cpp', |
210 |
'.otc' => 'application/vnd.oasis.opendocument.chart-template', // OpenDocument Chart Template |
211 |
'.diff' => 'diffu', |
211 |
'.odf' => 'application/vnd.oasis.opendocument.formula', // OpenDocument Formula |
212 |
'.dpr' => 'delphi', |
212 |
'.otf' => 'application/vnd.oasis.opendocument.formula-template', // OpenDocument Formula Template |
213 |
'.el' => 'elisp', |
213 |
'.odi' => 'application/vnd.oasis.opendocument.image', // OpenDocument Image |
214 |
'.eps' => 'postscript', |
214 |
'.oti' => 'application/vnd.oasis.opendocument.image-template', // OpenDocument Image Template |
215 |
'.f' => 'fortran', |
215 |
'.odm' => 'application/vnd.oasis.opendocument.text-master', // OpenDocument Master Document |
216 |
'.for' => 'fortran', |
216 |
'.oth' => 'application/vnd.oasis.opendocument.text-web', // HTML Document Template |
217 |
'.gs' => 'haskell', |
217 |
'.odb' => 'application/vnd.oasis.opendocument.database', // OpenDocument Database |
218 |
'.h' => 'c', |
218 |
|
219 |
'.hpp' => 'cpp', |
219 |
); |
220 |
'.hs' => 'haskell', |
220 |
|
221 |
'.htm' => 'html', |
221 |
// }}} |
222 |
'.html' => 'html', |
222 |
|
223 |
'.idl' => 'idl', |
223 |
// {{{ Enscript file extensions |
224 |
'.java' => 'java', |
224 |
|
225 |
'.js' => 'javascript', |
225 |
// List of extensions recognised by enscript. |
226 |
'.lgs' => 'haskell', |
226 |
|
227 |
'.lhs' => 'haskell', |
227 |
$extEnscript = array |
228 |
'.m' => 'objc', |
228 |
( |
229 |
'.m4' => 'm4', |
229 |
'.ada' => 'ada', |
230 |
'.man' => 'nroff', |
230 |
'.adb' => 'ada', |
231 |
'.nr' => 'nroff', |
231 |
'.ads' => 'ada', |
232 |
'.p' => 'pascal', |
232 |
'.awk' => 'awk', |
233 |
'.pas' => 'delphi', |
233 |
'.c' => 'c', |
234 |
'.patch' => 'diffu', |
234 |
'.c++' => 'cpp', |
235 |
'.pkg' => 'sql', |
235 |
'.cc' => 'cpp', |
236 |
'.pl' => 'perl', |
236 |
'.cpp' => 'cpp', |
237 |
'.pm' => 'perl', |
237 |
'.csh' => 'csh', |
238 |
'.pp' => 'pascal', |
238 |
'.cxx' => 'cpp', |
239 |
'.ps' => 'postscript', |
239 |
'.diff' => 'diffu', |
240 |
'.s' => 'asm', |
240 |
'.dpr' => 'delphi', |
241 |
'.scheme' => 'scheme', |
241 |
'.el' => 'elisp', |
242 |
'.scm' => 'scheme', |
242 |
'.eps' => 'postscript', |
243 |
'.scr' => 'synopsys', |
243 |
'.f' => 'fortran', |
244 |
'.sh' => 'sh', |
244 |
'.for' => 'fortran', |
245 |
'.shtml' => 'html', |
245 |
'.gs' => 'haskell', |
246 |
'.sql' => 'sql', |
246 |
'.h' => 'c', |
247 |
'.st' => 'states', |
247 |
'.hpp' => 'cpp', |
248 |
'.syn' => 'synopsys', |
248 |
'.hs' => 'haskell', |
249 |
'.synth' => 'synopsys', |
249 |
'.htm' => 'html', |
250 |
'.tcl' => 'tcl', |
250 |
'.html' => 'html', |
251 |
'.tex' => 'tex', |
251 |
'.idl' => 'idl', |
252 |
'.texi' => 'tex', |
252 |
'.java' => 'java', |
253 |
'.texinfo' => 'tex', |
253 |
'.js' => 'javascript', |
254 |
'.v' => 'verilog', |
254 |
'.lgs' => 'haskell', |
255 |
'.vba' => 'vba', |
255 |
'.lhs' => 'haskell', |
256 |
'.vh' => 'verilog', |
256 |
'.m' => 'objc', |
257 |
'.vhd' => 'vhdl', |
257 |
'.m4' => 'm4', |
258 |
'.vhdl' => 'vhdl', |
258 |
'.man' => 'nroff', |
259 |
'.py' => 'python', |
259 |
'.nr' => 'nroff', |
260 |
|
260 |
'.p' => 'pascal', |
261 |
// The following are handled internally by WebSVN, since there's no |
261 |
'.pas' => 'delphi', |
262 |
// support for them in Enscript |
262 |
'.patch' => 'diffu', |
263 |
|
263 |
'.pkg' => 'sql', |
264 |
'.php' => 'php', |
264 |
'.pl' => 'perl', |
265 |
'.phtml' => 'php', |
265 |
'.pm' => 'perl', |
266 |
'.php3' => 'php', |
266 |
'.pp' => 'pascal', |
267 |
'.inc' => 'php' |
267 |
'.ps' => 'postscript', |
268 |
); |
268 |
'.s' => 'asm', |
269 |
|
269 |
'.scheme' => 'scheme', |
270 |
// }}} |
270 |
'.scm' => 'scheme', |
271 |
|
271 |
'.scr' => 'synopsys', |
272 |
// Default 'zipped' array |
272 |
'.sh' => 'sh', |
273 |
|
273 |
'.shtml' => 'html', |
274 |
$zipped = array (); |
274 |
'.sql' => 'sql', |
275 |
|
275 |
'.st' => 'states', |
276 |
// Get the user's personalised config |
276 |
'.syn' => 'synopsys', |
277 |
|
277 |
'.synth' => 'synopsys', |
278 |
require_once 'config.inc'; |
278 |
'.tcl' => 'tcl', |
279 |
|
279 |
'.tex' => 'tex', |
280 |
// Set up the version info |
280 |
'.texi' => 'tex', |
281 |
|
281 |
'.texinfo' => 'tex', |
282 |
initSvnVersion($major,$minor); |
282 |
'.v' => 'verilog', |
283 |
|
283 |
'.vba' => 'vba', |
284 |
// Get the language choice as defained as the default by config.inc |
284 |
'.vh' => 'verilog', |
285 |
$user_defaultLang = $lang['LANGUAGENAME']; |
285 |
'.vhd' => 'vhdl', |
286 |
|
286 |
'.vhdl' => 'vhdl', |
287 |
// Override this with the user choice if there is one, and memorise the setting |
287 |
'.py' => 'python', |
288 |
// as a cookie (since we don't have user accounts, we can't store the setting |
288 |
|
289 |
// anywhere else). We try to memorise a permanant cookie and a per session cookie |
289 |
// The following are handled internally by WebSVN, since there's no |
290 |
// in case the user's disabled permanant ones. |
290 |
// support for them in Enscript |
291 |
|
291 |
|
292 |
if (!empty($_REQUEST['langchoice'])) |
292 |
'.php' => 'php', |
293 |
{ |
293 |
'.phtml' => 'php', |
294 |
$user_defaultLang = $_REQUEST['langchoice']; |
294 |
'.php3' => 'php', |
295 |
setcookie('storedlang', $_REQUEST['langchoice'], time()+(3600*24*356*10), '/'); |
295 |
'.inc' => 'php' |
296 |
setcookie('storedsesslang', $_REQUEST['langchoice']); |
296 |
); |
297 |
} |
297 |
|
298 |
else // Try to read an existing cookie if there is one |
298 |
// }}} |
299 |
{ |
299 |
|
300 |
if (!empty($_COOKIE['storedlang'])) $user_defaultLang = $_COOKIE['storedlang']; |
300 |
// Default 'zipped' array |
301 |
else if (!empty($_COOKIE['storedsesslang'])) $user_defaultLang = $_COOKIE['storedsesslang']; |
301 |
|
302 |
} |
302 |
$zipped = array (); |
303 |
|
303 |
|
304 |
$user_defaultFile = ''; |
304 |
// Set up the version info |
305 |
if ($handle = opendir('languages')) |
305 |
|
306 |
{ |
306 |
initSvnVersion($major,$minor); |
307 |
// Read the language name for each language. |
307 |
|
308 |
while (false !== ($file = readdir($handle))) |
308 |
// Get the language choice as defained as the default by config.inc |
309 |
{ |
309 |
$user_defaultLang = $lang['LANGUAGENAME']; |
310 |
if ($file{0} != '.' && !is_dir('languages'.DIRECTORY_SEPARATOR.$file)) |
310 |
|
311 |
{ |
311 |
// Override this with the user choice if there is one, and memorise the setting |
312 |
$lang['LANGUAGENAME'] = ''; |
312 |
// as a cookie (since we don't have user accounts, we can't store the setting |
313 |
require 'languages/'.$file; |
313 |
// anywhere else). We try to memorise a permanant cookie and a per session cookie |
314 |
if ($lang['LANGUAGENAME'] != '') |
314 |
// in case the user's disabled permanant ones. |
315 |
{ |
315 |
|
316 |
$langNames[] = $lang['LANGUAGENAME']; |
316 |
if (!empty($_REQUEST['langchoice'])) |
317 |
if ($lang['LANGUAGENAME'] == $user_defaultLang) |
317 |
{ |
318 |
$user_defaultFile = $file; |
318 |
$user_defaultLang = $_REQUEST['langchoice']; |
319 |
} |
319 |
setcookie('storedlang', $_REQUEST['langchoice'], time()+(3600*24*356*10), '/'); |
320 |
} |
320 |
setcookie('storedsesslang', $_REQUEST['langchoice']); |
321 |
} |
321 |
} |
322 |
|
322 |
else // Try to read an existing cookie if there is one |
323 |
closedir($handle); |
323 |
{ |
324 |
|
324 |
if (!empty($_COOKIE['storedlang'])) $user_defaultLang = $_COOKIE['storedlang']; |
325 |
// XXX: this shouldn't be necessary |
325 |
else if (!empty($_COOKIE['storedsesslang'])) $user_defaultLang = $_COOKIE['storedsesslang']; |
326 |
// ^ i.e. just require english.inc, then the desired language |
326 |
} |
327 |
// Reload english to get untranslated strings |
327 |
|
328 |
require 'languages/english.inc'; |
328 |
$user_defaultFile = ''; |
329 |
|
329 |
if ($handle = opendir('languages')) |
330 |
// Reload the default language |
330 |
{ |
331 |
if (!empty($user_defaultFile)) |
331 |
// Read the language name for each language. |
332 |
require 'languages/'.$user_defaultFile; |
332 |
while (false !== ($file = readdir($handle))) |
333 |
|
333 |
{ |
334 |
$url = getParameterisedSelfUrl(true); |
334 |
if ($file{0} != '.' && !is_dir('languages'.DIRECTORY_SEPARATOR.$file)) |
335 |
$vars["lang_form"] = "<form action=\"$url\" method=\"post\" id=\"langform\">"; |
335 |
{ |
336 |
$vars["lang_select"] = "<select name=\"langchoice\" onchange=\"javascript:this.form.submit();\">"; |
336 |
$lang['LANGUAGENAME'] = ''; |
337 |
|
337 |
require 'languages/'.$file; |
338 |
reset($langNames); |
338 |
if ($lang['LANGUAGENAME'] != '') |
339 |
foreach ($langNames as $name) |
339 |
{ |
340 |
{ |
340 |
$langNames[] = $lang['LANGUAGENAME']; |
341 |
$sel = ""; |
341 |
if ($lang['LANGUAGENAME'] == $user_defaultLang) |
342 |
if ($name == $user_defaultLang) $sel = "selected"; |
342 |
$user_defaultFile = $file; |
343 |
$vars["lang_select"] .= "<option value=\"$name\" $sel>$name</option>"; |
343 |
} |
344 |
} |
344 |
} |
345 |
|
345 |
} |
346 |
$vars["lang_select"] .= "</select>"; |
346 |
|
347 |
$vars["lang_submit"] = "<input type=\"submit\" value=\"${lang["GO"]}\">"; |
347 |
closedir($handle); |
348 |
$vars["lang_endform"] = "</form>"; |
348 |
|
349 |
} |
349 |
// XXX: this shouldn't be necessary |
350 |
|
350 |
// ^ i.e. just require english.inc, then the desired language |
351 |
// Set up headers |
351 |
// Reload english to get untranslated strings |
352 |
|
352 |
require 'languages/english.inc'; |
353 |
header("Content-type: text/html; charset=".$config->outputEnc); |
353 |
|
354 |
|
354 |
// Reload the default language |
355 |
// Make sure that the user has set up a repository |
355 |
if (!empty($user_defaultFile)) |
356 |
|
356 |
require 'languages/'.$user_defaultFile; |
357 |
$reps = $config->getRepositories(); |
357 |
|
358 |
if (empty($reps[0])) |
358 |
$url = getParameterisedSelfUrl(true); |
359 |
{ |
359 |
$vars["lang_form"] = "<form action=\"$url\" method=\"post\" id=\"langform\">"; |
360 |
echo $lang["SUPPLYREP"]; |
360 |
$vars["lang_select"] = "<select name=\"langchoice\" onchange=\"javascript:this.form.submit();\">"; |
361 |
exit; |
361 |
|
362 |
} |
362 |
reset($langNames); |
363 |
|
363 |
foreach ($langNames as $name) |
364 |
// Override the rep parameter with the repository name if it's available |
364 |
{ |
365 |
$repname = @$_REQUEST["repname"]; |
365 |
$sel = ""; |
366 |
if (isset($repname)) |
366 |
if ($name == $user_defaultLang) $sel = "selected"; |
367 |
{ |
367 |
$vars["lang_select"] .= "<option value=\"$name\" $sel>$name</option>"; |
368 |
$rep = $config->findRepository($repname); |
368 |
} |
369 |
} |
369 |
|
370 |
else |
370 |
$vars["lang_select"] .= "</select>"; |
371 |
$rep = $reps[0]; |
371 |
$vars["lang_submit"] = "<input type=\"submit\" value=\"${lang["GO"]}\">"; |
372 |
|
372 |
$vars["lang_endform"] = "</form>"; |
373 |
// Retrieve other standard parameters |
373 |
} |
374 |
|
374 |
|
375 |
# due to possible XSS exploit, we need to clean up path first |
375 |
// Set up headers |
376 |
$path = !empty($_REQUEST['path']) ? $_REQUEST['path'] : null; |
376 |
|
377 |
$vars['safepath'] = htmlentities($path); |
377 |
header("Content-type: text/html; charset=".$config->outputEnc); |
378 |
$rev = (int)@$_REQUEST["rev"]; |
378 |
|
379 |
$showchanged = (@$_REQUEST["sc"] == 1)?1:0; |
379 |
// Make sure that the user has set up a repository |
380 |
|
380 |
|
381 |
// Function to create the project selection HTML form |
381 |
$reps = $config->getRepositories(); |
382 |
function createProjectSelectionForm() |
382 |
if (empty($reps[0])) |
383 |
{ |
383 |
{ |
384 |
global $config, $vars, $rep, $lang, $showchanged; |
384 |
echo $lang["SUPPLYREP"]; |
385 |
|
385 |
exit; |
386 |
$url = $config->getURL(-1, "", "form"); |
386 |
} |
387 |
$vars["projects_form"] = "<form action=\"$url\" method=\"post\" id=\"projectform\">"; |
387 |
|
388 |
|
388 |
// Override the rep parameter with the repository name if it's available |
389 |
$reps = $config->getRepositories(); |
389 |
$repname = @$_REQUEST["repname"]; |
390 |
$vars["projects_select"] = "<select name=\"repname\" onchange=\"javascript:this.form.submit();\">"; |
390 |
if (isset($repname)) |
391 |
|
391 |
{ |
392 |
foreach ($reps as $trep) |
392 |
$rep = $config->findRepository($repname); |
393 |
{ |
393 |
} |
394 |
if ($trep->hasReadAccess("/", true)) |
394 |
else |
395 |
{ |
395 |
$rep = $reps[0]; |
396 |
if ($rep->getDisplayName() == $trep->getDisplayName()) |
396 |
|
397 |
$sel = "selected"; |
397 |
// Retrieve other standard parameters |
398 |
else |
398 |
|
399 |
$sel = ""; |
399 |
# due to possible XSS exploit, we need to clean up path first |
400 |
|
400 |
$path = !empty($_REQUEST['path']) ? $_REQUEST['path'] : null; |
401 |
$vars["projects_select"] .= "<option value=\"".$trep->getDisplayName()."\" $sel>".$trep->getDisplayName()."</option>"; |
401 |
$vars['safepath'] = htmlentities($path); |
402 |
} |
402 |
$rev = (int)@$_REQUEST["rev"]; |
403 |
} |
403 |
$showchanged = (@$_REQUEST["sc"] == 1)?1:0; |
404 |
|
404 |
|
405 |
$vars["projects_select"] .= "</select>"; |
405 |
// Function to create the project selection HTML form |
406 |
|
406 |
function createProjectSelectionForm() |
407 |
$vars["projects_submit"] = "<input type=\"submit\" value=\"${lang["GO"]}\" />"; |
407 |
{ |
408 |
$vars["projects_endform"] = "<input type=\"hidden\" name=\"selectproj\" value=\"1\" /><input type=\"hidden\" name=\"op\" value=\"form\" /><input type=\"hidden\" name=\"sc\" value=\"$showchanged\" /></form>"; |
408 |
global $config, $vars, $rep, $lang, $showchanged; |
409 |
} |
409 |
|
410 |
|
410 |
$url = $config->getURL(-1, "", "form"); |
411 |
// Create the form if we're not in MultiViews. Otherwise wsvn must create the form once the current project has |
411 |
$vars["projects_form"] = "<form action=\"$url\" method=\"post\" id=\"projectform\">"; |
412 |
// been found |
412 |
|
413 |
|
413 |
$reps = $config->getRepositories(); |
414 |
if (!$config->multiViews) |
414 |
$vars["projects_select"] = "<select name=\"repname\" onchange=\"javascript:this.form.submit();\">"; |
415 |
{ |
415 |
|
416 |
createProjectSelectionForm(); |
416 |
foreach ($reps as $trep) |
417 |
} |
417 |
{ |
418 |
|
418 |
if ($trep->hasReadAccess("/", true)) |
419 |
if ($rep) |
419 |
{ |
420 |
{ |
420 |
if ($rep->getDisplayName() == $trep->getDisplayName()) |
421 |
$vars["allowdownload"] = $rep->getAllowDownload(); |
421 |
$sel = "selected"; |
422 |
$vars["repname"] = $rep->getDisplayName(); |
422 |
else |
423 |
} |
423 |
$sel = ""; |
424 |
|
424 |
|
425 |
// As of version 1.70 the output encoding is forced to be UTF-8, since this is the output |
425 |
$vars["projects_select"] .= "<option value=\"".$trep->getDisplayName()."\" $sel>".$trep->getDisplayName()."</option>"; |
426 |
// encoding returned by svn log --xml. This is good, since we are no longer reliant on PHP's |
426 |
} |
427 |
// rudimentary conversions. |
427 |
} |
428 |
|
428 |
|
429 |
$vars["charset"] = "UTF-8"; |
429 |
$vars["projects_select"] .= "</select>"; |
430 |
?> |
430 |
|
- |
|
431 |
$vars["projects_submit"] = "<input type=\"submit\" value=\"${lang["GO"]}\" />"; |
- |
|
432 |
$vars["projects_endform"] = "<input type=\"hidden\" name=\"selectproj\" value=\"1\" /><input type=\"hidden\" name=\"op\" value=\"form\" /><input type=\"hidden\" name=\"sc\" value=\"$showchanged\" /></form>"; |
- |
|
433 |
} |
- |
|
434 |
|
- |
|
435 |
// Create the form if we're not in MultiViews. Otherwise wsvn must create the form once the current project has |
- |
|
436 |
// been found |
- |
|
437 |
|
- |
|
438 |
if (!$config->multiViews) |
- |
|
439 |
{ |
- |
|
440 |
createProjectSelectionForm(); |
- |
|
441 |
} |
- |
|
442 |
|
- |
|
443 |
if ($rep) |
- |
|
444 |
{ |
- |
|
445 |
$vars["allowdownload"] = $rep->getAllowDownload(); |
- |
|
446 |
$vars["repname"] = $rep->getDisplayName(); |
- |
|
447 |
} |
- |
|
448 |
|
- |
|
449 |
// As of version 1.70 the output encoding is forced to be UTF-8, since this is the output |
- |
|
450 |
// encoding returned by svn log --xml. This is good, since we are no longer reliant on PHP's |
- |
|
451 |
// rudimentary conversions. |
- |
|
452 |
|
- |
|
453 |
$vars["charset"] = "UTF-8"; |
- |
|
454 |
?> |