Changing empty fetch_rev_(str|num)() calls to the cached version in Paths
[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 );
25
26 require_once('./global.php');
27
28 $navbar = $viewsvn->paths->construct_breadcrumb($viewsvn->paths->path);
29
30 // ###################################################################
31
32 $link['log'] = $viewsvn->paths->out('log.php' . $viewsvn->paths->revstr, $viewsvn->paths->path);
33
34 $show['head'] = ($viewsvn->svn->common->fetch_head_rev($viewsvn->paths->path) != $viewsvn->paths->revnum AND $viewsvn->paths->revnum != 'HEAD');
35 if ($show['head'])
36 {
37 $link['gohead'] = $viewsvn->paths->out('browse.php' . $viewsvn->paths->fetch_rev_str(false, 'HEAD'), $viewsvn->paths->path);
38 $link['diffhead'] = $viewsvn->paths->out('diff.php' . $viewsvn->paths->fetch_rev_str(true, 'HEAD', $viewsvn->paths->revnum), $viewsvn->paths->path);
39 }
40
41 $show['prev'] = (($prev = $viewsvn->svn->common->fetch_prev_rev($viewsvn->paths->path, $viewsvn->paths->revnum)) != -1 ? true : false);
42 if ($show['prev'])
43 {
44 $link['diffprev'] = $viewsvn->paths->out('diff.php' . $viewsvn->paths->fetch_rev_str(true, $viewsvn->paths->revnum, $prev), $viewsvn->paths->path);
45 }
46
47 // ###################################################################
48
49 $logmsg = $viewsvn->svn->common->fetch_log($viewsvn->paths->path, $viewsvn->paths->revnum);
50 unset($logmsg['files']);
51
52 $logmsg['message_clean'] = $viewsvn->svn->format_log_message($logmsg['message']);
53
54 $catdata = implode("\n", $viewsvn->svn->cat($viewsvn->paths->repos, $viewsvn->paths->relpath, $viewsvn->paths->revnum));
55
56 // get language information
57 require_once('./includes/file_types.php');
58 $language = $filetypes[ $funct->fetch_extension($viewsvn->paths->relpath) ];
59
60 // initialize GeSHi
61 $mtstart = microtime();
62 require_once('./includes/geshi/geshi.php');
63 $geshi = new Geshi($catdata, $language[MIMES_GESHI_LANGUAGE]);
64
65 // use CSS
66 $geshi->enable_classes();
67
68 // header
69 $geshi->set_header_type(GESHI_HEADER_DIV);
70
71 // disable links
72 $urls = array_keys($geshi->language_data['URLS']);
73 foreach ($urls AS $key)
74 {
75 $geshi->set_url_for_keyword_group($key, '');
76 }
77
78 // don't do anything stupid
79 $geshi->set_case_keywords(GESHI_CAPS_NO_CHANGE);
80
81 // encoding
82 $geshi->set_encoding('UTF-8');
83
84 // tab width
85 $geshi->set_tab_width(5);
86
87 // parse the code
88 $catdata = $geshi->parse_code();
89
90 $viewsvn->debug("time in GeSHi = " . $funct->fetch_microtime_diff($mtstart));
91
92 // ###################################################################
93
94 eval('$template->flush("' . $template->fetch('view') . '");');
95
96 /*=====================================================================*\
97 || ###################################################################
98 || # $HeadURL$
99 || # $Id$
100 || ###################################################################
101 \*=====================================================================*/
102 ?>