]> src.bluestatic.org Git - viewsvn.git/blob - view.php
Setting up paths in the controller
[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 $latest = $cachev->fetch_node($viewsvn->paths->relpath);
33
34 $link['log'] = $viewsvn->paths->out('log.php' . $viewsvn->paths->revstr, $viewsvn->paths->path);
35
36 $show['head'] = ($latest['revision'] != $viewsvn->paths->revnum AND $viewsvn->paths->revnum != 'HEAD');
37 if ($show['head'])
38 {
39 $link['gohead'] = $viewsvn->paths->out('browse.php' . $viewsvn->paths->fetch_rev_str(false, 'HEAD'), $viewsvn->paths->path);
40 $link['diffhead'] = $viewsvn->paths->out('diff.php' . $viewsvn->paths->fetch_rev_str(true, 'HEAD', $viewsvn->paths->revnum), $viewsvn->paths->path);
41 }
42
43 $show['prev'] = ($prev = $cachev->fetch_prev_revision($viewsvn->paths->relpath, $viewsvn->paths->revnum));
44 if ($show['prev'])
45 {
46 $link['diffprev'] = $viewsvn->paths->out('diff.php' . $viewsvn->paths->fetch_rev_str(true, $viewsvn->paths->revnum, $prev), $viewsvn->paths->path);
47 }
48
49 // ###################################################################
50
51 $logmsg = $cachev->fetch_revision($latest['revision']);
52 unset($logmsg['files']);
53
54 $logmsg['message_clean'] = $viewsvn->svn->format_log_message($logmsg['message']);
55 $logmsg['date'] = $viewsvn->svn->format_date_string($logmsg['dateline']);
56
57 $catdata = implode("\n", $viewsvn->svn->cat($viewsvn->paths->repos, $viewsvn->paths->relpath, $viewsvn->paths->revnum));
58
59 // get language information
60 require_once('./includes/file_types.php');
61 $extension = $funct->fetch_extension($viewsvn->paths->relpath);
62 $language = (isset($filetypes["$extension"]) ? $filetypes["$extension"] : null);
63
64 // initialize GeSHi
65 $mtstart = microtime();
66 require_once('./includes/geshi/geshi.php');
67 $geshi = new Geshi($catdata, $language[MIMES_GESHI_LANGUAGE]);
68
69 // use CSS
70 $geshi->enable_classes();
71
72 // header
73 $geshi->set_header_type(GESHI_HEADER_DIV);
74
75 // disable links
76 $urls = (isset($geshi->language_data['URLS']) ? array_keys($geshi->language_data['URLS']) : array());
77 foreach ($urls AS $key)
78 {
79 $geshi->set_url_for_keyword_group($key, '');
80 }
81
82 // don't do anything stupid
83 $geshi->set_case_keywords(GESHI_CAPS_NO_CHANGE);
84
85 // encoding
86 $geshi->set_encoding('UTF-8');
87
88 // tab width
89 $geshi->set_tab_width(5);
90
91 // parse the code
92 $catdata = $geshi->parse_code();
93
94 $viewsvn->debug("time in GeSHi = " . $funct->fetch_microtime_diff($mtstart));
95
96 // ###################################################################
97
98 eval('$template->flush("' . $template->fetch('view') . '");');
99
100 /*=====================================================================*\
101 || ###################################################################
102 || # $HeadURL$
103 || # $Id$
104 || ###################################################################
105 \*=====================================================================*/
106 ?>