jablonka.czprosek.czf

websvn

Subversion Repositories:
[/] [revision.php] - Blame information for rev 1

 

Line No. Rev Author Line
11simandl<?php
2// WebSVN - Subversion repository viewing via the web using PHP
3// Copyright (C) 2004-2006 Tim Armes
4//
5// This program is free software; you can redistribute it and/or modify
6// it under the terms of the GNU General Public License as published by
7// the Free Software Foundation; either version 2 of the License, or
8// (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18//
19// --
20//
21// revision.php
22//
23// Show the details for a given revision
24 
25require_once('include/setup.php');
26require_once('include/svnlook.php');
27require_once('include/utils.php');
28require_once('include/template.php');
29require_once('include/bugtraq.php');
30 
31// Make sure that we have a repository
32if (!isset($rep)) {
33 echo $lang['NOREP'];
34 exit;
35}
36 
37$svnrep = new SVNRepository($rep);
38 
39// Revision info to pass along chain
40$passrev = $rev;
41 
42// If there's no revision info, go to the lastest revision for this path
43$history = $svnrep->getLog($path, '', '', false);
44 
45if (!empty($history->entries[0])) {
46 $youngest = $history->entries[0]->rev;
47} else {
48 $youngest = -1;
49}
50 
51// Unless otherwise specified, we get the log details of the latest change
52if (empty($rev)) {
53 $logrev = $youngest;
54} else {
55 $logrev = $rev;
56}
57 
58if ($logrev != $youngest) {
59 $logEntry = $svnrep->getLog($path, $logrev, $logrev, false);
60 $logEntry = $logEntry->entries[0];
61} else {
62 $logEntry = isset($history->entries[0]) ? $history->entries[0]: false;
63}
64 
65$headlog = $svnrep->getLog('/', '', '', true, 1);
66$headrev = isset($headlog->entries[0]) ? $headlog->entries[0]->rev: 0;
67 
68// If we're not looking at a specific revision, get the HEAD revision number
69// (the revision of the rest of the tree display)
70 
71if (empty($rev)) {
72 $rev = $headrev;
73}
74 
75if ($path == '' || $path{0} != '/') {
76 $ppath = '/'.$path;
77} else {
78 $ppath = $path;
79}
80 
81$vars['repname'] = $rep->getDisplayName();
82 
83if ($passrev != 0 && $passrev != $headrev && $youngest != -1) {
84 $vars['goyoungestlink'] = '<a href="'.$config->getURL($rep, $path, 'revision').'opt=dir">'.$lang['GOYOUNGEST'].'</a>';
85} else {
86 $vars['goyoungestlink'] = '';
87}
88 
89$vars['listingurl'] = $config->getURL($rep, $path, 'dir').'rev='.$passrev;
90 
91$bugtraq = new Bugtraq($rep, $svnrep, $ppath);
92 
93$vars['action'] = '';
94$vars['rev'] = $rev;
95$vars['path'] = htmlentities($ppath, ENT_QUOTES, 'UTF-8');
96$vars['lastchangedrev'] = $logrev;
97$vars['date'] = $logEntry ? $logEntry->date: '';
98$vars['author'] = $logEntry ? $logEntry->author: '';
99$vars['log'] = $logEntry ? nl2br($bugtraq->replaceIDs(create_anchors($logEntry->msg))): '';
100 
101$changes = $logEntry->mods;
102if (!is_array($changes)) {
103 $changes = array();
104}
105usort($changes, 'SVNLogEntry_compare');
106 
107$row = 0;
108$listing = array();
109 
110foreach ($changes as $file) {
111 $listing[] = array(
112 'file' => $file->path,
113 'added' => $file->action == 'A',
114 'modified' => $file->action == 'M',
115 'deleted' => $file->action == 'D',
116 'detailurl' => $config->getURL($rep, $file->path, 'file').'rev='.$passrev,
117 'logurl' => $config->getURL($rep, $file->path, 'log').'rev='.$passrev.'&amp;isdir=0',
118 'diffurl' => $config->getURL($rep, $file->path, 'diff').'rev='.$passrev,
119 'blameurl' => $config->getURL($rep, $file->path, 'blame').'rev='.$passrev,
120 'rowparity' => $row,
121 );
122 
123 $row = 1 - $row;
124}
125 
126createDirLinks($rep, $ppath, $passrev);
127 
128$logurl = $config->getURL($rep, $path, 'log');
129$vars['logurl'] = $logurl.'rev='.$passrev.'&amp;isdir=1';
130 
131$vars['indexurl'] = $config->getURL($rep, '', 'index');
132$vars['repurl'] = $config->getURL($rep, '', 'dir');
133 
134if ($rev != $headrev) {
135 $history = $svnrep->getLog($path, $rev, '', false);
136}
137 
138if (isset($history->entries[1]->rev)) {
139 $compurl = $config->getURL($rep, '/', 'comp');
140 $vars['curdircomplink'] = '<a href="'.$compurl.'compare[]='.urlencode($history->entries[1]->path).'@'.$history->entries[1]->rev. '&amp;compare[]='.urlencode($history->entries[0]->path).'@'.$history->entries[0]->rev. '">'.$lang['DIFFPREV'].'</a>';
141 $vars['compareurl'] = $compurl.'compare[]='.urlencode($history->entries[1]->path).'@'.$history->entries[1]->rev. '&amp;compare[]='.urlencode($history->entries[0]->path).'@'.$history->entries[0]->rev;
142} else {
143 $vars['curdircomplink'] = '';
144 $vars['compareurl'] = '';
145}
146 
147if ($rep->getHideRss()) {
148 $rssurl = $config->getURL($rep, $path, 'rss');
149 // $vars["curdirrsslink"] = "<a href=\"${rssurl}rev=$passrev&amp;isdir=1\">${lang["RSSFEED"]}</a>";
150 // $vars["curdirrsshref"] = "${rssurl}rev=$passrev&amp;isdir=1";
151 // $vars["curdirrssanchor"] = "<a href=\"${rssurl}rev=$passrev&amp;isdir=1\">";
152 $vars['rssurl'] = $rssurl.'isdir=1';
153}
154 
155$vars['version'] = $version;
156 
157$vars['noaccess'] = !$rep->hasReadAccess($path, true);
158 
159$vars['restricted'] = !$rep->hasReadAccess($path, false);
160 
161parseTemplate($rep->getTemplatePath()."header.tmpl", $vars, $listing);
162parseTemplate($rep->getTemplatePath()."revision.tmpl", $vars, $listing);
163parseTemplate($rep->getTemplatePath()."footer.tmpl", $vars, $listing);

Powered by WebSVN 2.2.1