In our "go to head" link in view.php, we want to use view and not browse as the action
[viewsvn.git] / view.php
1 <?php
2 /*=====================================================================*\
3 || ###################################################################
4 || # ViewSVN [#]version[#]
5 || # Copyright ©2002-[#]year[#] Blue Static
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 = $headRev = new Revision($input->in['repos'], $input->in['rev'], $input->in['path']);
36 if ($input->in['rev'])
37 {
38 $headRev = new Revision($input->in['repos'], 0, $input->in['path']);
39 if ($headRev->revision != $revision->revision)
40 {
41 $show['head'] = true;
42 $link['gohead'] = ConstructLink('view', $input->in['repos'], $input->in['path'], 0);
43 }
44 }
45
46 if ($revision->revision - 1 > 0)
47 {
48 $show['diff'] = true;
49 $link['diff'] = ConstructLink('diff', $input->in['repos'], $input->in['path'], $revision->revision);
50 }
51
52 $link['log'] = ConstructLink('log', $input->in['repos'], $input->in['path'], 0);
53
54 // ###################################################################
55
56 $revision->getRevisionInfo();
57
58 $catdata = $lib->run('cat -r' . $revision->revision . ' ' . $lib->arg($repos->fetchPath($input->in['repos']) . $input->in['path']), true);
59
60 // ###################################################################
61
62 $props = $revision->getPropsForPath($input->in['path']);
63 $show['props'] = (sizeof($props) > 0);
64 $proplist = FormatPropList($props);
65
66 // ###################################################################
67
68 // get language information
69 require_once('./includes/file_types.php');
70 $extension = BSFunctions::FetchExtension($input->in['path']);
71 $language = (isset($filetypes["$extension"]) ? $filetypes["$extension"] : null);
72
73 // initialize GeSHi
74 $mtstart = microtime();
75 require_once('./includes/geshi/geshi.php');
76 $geshi = new Geshi($catdata, $language[MIMES_GESHI_LANGUAGE]);
77
78 // use CSS
79 $geshi->enable_classes();
80
81 // header
82 $geshi->set_header_type(GESHI_HEADER_DIV);
83
84 // disable links
85 $urls = (isset($geshi->language_data['URLS']) ? array_keys($geshi->language_data['URLS']) : array());
86 foreach ($urls AS $key)
87 {
88 $geshi->set_url_for_keyword_group($key, '');
89 }
90
91 // don't do anything stupid
92 $geshi->set_case_keywords(GESHI_CAPS_NO_CHANGE);
93
94 // encoding
95 $geshi->set_encoding('UTF-8');
96
97 // tab width
98 $geshi->set_tab_width(5);
99
100 // parse the code
101 $catdata = $geshi->parse_code();
102
103 BSRegister::Debug("time in GeSHi = " . BSFunctions::FetchMicrotimeDiff($mtstart));
104
105 // ###################################################################
106
107 eval('$template->flush("' . $template->fetch('view') . '");');
108
109 /*=====================================================================*\
110 || ###################################################################
111 || # $HeadURL$
112 || # $Id$
113 || ###################################################################
114 \*=====================================================================*/
115 ?>