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