Remove the looping
[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 require_once('./global.php');
28
29 $navbar = $controller->construct_breadcrumb();
30
31 // ###################################################################
32
33 $latest = $controller->cachev->fetch_node();
34
35 $link['log'] = $controller->href_compound('log.php');
36
37 $show['head'] = ($latest['revision'] != $controller->revctx);
38 if ($show['head'])
39 {
40 $link['gohead'] = $controller->href_compound('view.php', null, Paths::fetch_rev_str(false, 'HEAD'));
41 $link['diffhead'] = $controller->href_compound('diff.php', null, Paths::fetch_rev_str(true, 'HEAD', $controller->revctx));
42 }
43
44 $show['prev'] = ($prev = $controller->cachev->fetch_prev_revision($controller->revctx));
45 if ($show['prev'])
46 {
47 $link['diffprev'] = $controller->href_compound('diff.php', null, Paths::fetch_rev_str(true, $controller->revctx, $prev['revision']));
48 }
49
50 // ###################################################################
51
52 $logmsg = $controller->cachev->fetch_revision($controller->revctx);
53 unset($logmsg['files']);
54
55 $logmsg['message_clean'] = SVNCommon::format_log_message($logmsg['message']);
56 $logmsg['date'] = SVNCommon::format_date_string($logmsg['dateline']);
57
58 $catdata = implode("\n", $controller->library->command('cat'));
59
60 // ###################################################################
61
62 $show['props'] = false;
63 $proplist = '';
64 if (sizeof($latest['properties']) > 0)
65 {
66 $show['props'] = true;
67 foreach ($latest['properties'] AS $propname => $propval)
68 {
69 $data = sprintf($lang->string('Property <strong>%1$s</strong> set to <em>%2$s</em>'), $propname, $propval);
70 eval('$proplist .= "' . $template->fetch('property') . '";');
71 }
72 }
73
74 // ###################################################################
75
76 // get language information
77 require_once('./includes/file_types.php');
78 $extension = $funct->fetch_extension($controller->path);
79 $language = (isset($filetypes["$extension"]) ? $filetypes["$extension"] : null);
80
81 // initialize GeSHi
82 $mtstart = microtime();
83 require_once('./includes/geshi/geshi.php');
84 $geshi = new Geshi($catdata, $language[MIMES_GESHI_LANGUAGE]);
85
86 // use CSS
87 $geshi->enable_classes();
88
89 // header
90 $geshi->set_header_type(GESHI_HEADER_DIV);
91
92 // disable links
93 $urls = (isset($geshi->language_data['URLS']) ? array_keys($geshi->language_data['URLS']) : array());
94 foreach ($urls AS $key)
95 {
96 $geshi->set_url_for_keyword_group($key, '');
97 }
98
99 // don't do anything stupid
100 $geshi->set_case_keywords(GESHI_CAPS_NO_CHANGE);
101
102 // encoding
103 $geshi->set_encoding('UTF-8');
104
105 // tab width
106 $geshi->set_tab_width(5);
107
108 // parse the code
109 $catdata = $geshi->parse_code();
110
111 $viewsvn->debug("time in GeSHi = " . $funct->fetch_microtime_diff($mtstart));
112
113 // ###################################################################
114
115 eval('$template->flush("' . $template->fetch('view') . '");');
116
117 /*=====================================================================*\
118 || ###################################################################
119 || # $HeadURL$
120 || # $Id$
121 || ###################################################################
122 \*=====================================================================*/
123 ?>