Merging the updates from the GeSHi vendor to the trunk
[viewsvn.git] / view.php
1 <?php
2 /*=====================================================================*\
3 || ###################################################################
4 || # ViewSVN [#]version[#]
5 || # Copyright ©2002-[#]year[#] Iris Studios, Inc.
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; version [#]gpl[#] of the License.
10 || #
11 || # This program is distributed in the hope that it will be useful, but
12 || # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 || # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 || # more details.
15 || #
16 || # You should have received a copy of the GNU General Public License along
17 || # with this program; if not, write to the Free Software Foundation, Inc.,
18 || # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 || ###################################################################
20 \*=====================================================================*/
21
22 $fetchtemplates = array(
23 'view',
24 'property'
25 );
26
27 define('SVN', '$Id$');
28
29 require_once('./global.php');
30
31 $navbar = ConstructNavbar();
32
33 // ###################################################################
34
35 $revision = new Revision($input->in['repos'], $input->in['rev'], $input->in['path']);
36
37 // ###################################################################
38
39 $revision->getRevisionInfo();
40
41 $catdata = $lib->run('cat -r' . $revision->revision . ' ' . $lib->arg($repos->fetchPath($input->in['repos']) . $input->in['path']), true);
42
43 // ###################################################################
44
45 $props = $revision->getPropsForPath($input->in['path']);
46 $show['props'] = (sizeof($props) > 0);
47 $proplist = FormatPropList($props);
48
49 // ###################################################################
50
51 // get language information
52 require_once('./includes/file_types.php');
53 $extension = BSFunctions::FetchExtension($input->in['path']);
54 $language = (isset($filetypes["$extension"]) ? $filetypes["$extension"] : null);
55
56 // initialize GeSHi
57 $mtstart = microtime();
58 require_once('./includes/geshi/geshi.php');
59 $geshi = new Geshi($catdata, $language[MIMES_GESHI_LANGUAGE]);
60
61 // use CSS
62 $geshi->enable_classes();
63
64 // header
65 $geshi->set_header_type(GESHI_HEADER_DIV);
66
67 // disable links
68 $urls = (isset($geshi->language_data['URLS']) ? array_keys($geshi->language_data['URLS']) : array());
69 foreach ($urls AS $key)
70 {
71 $geshi->set_url_for_keyword_group($key, '');
72 }
73
74 // don't do anything stupid
75 $geshi->set_case_keywords(GESHI_CAPS_NO_CHANGE);
76
77 // encoding
78 $geshi->set_encoding('UTF-8');
79
80 // tab width
81 $geshi->set_tab_width(5);
82
83 // parse the code
84 $catdata = $geshi->parse_code();
85
86 BSRegister::Debug("time in GeSHi = " . BSFunctions::FetchMicrotimeDiff($mtstart));
87
88 // ###################################################################
89
90 eval('$template->flush("' . $template->fetch('view') . '");');
91
92 /*=====================================================================*\
93 || ###################################################################
94 || # $HeadURL$
95 || # $Id$
96 || ###################################################################
97 \*=====================================================================*/
98 ?>