jablonka.czprosek.czf

websvn

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

 

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);
443simandlif (is_string($history)) {
45 echo $history;
46 exit;
47}
481simandl 
49if (!empty($history->entries[0])) {
50 $youngest = $history->entries[0]->rev;
51} else {
52 $youngest = -1;
53}
54 
55// Unless otherwise specified, we get the log details of the latest change
56if (empty($rev)) {
57 $logrev = $youngest;
58} else {
59 $logrev = $rev;
60}
61 
62if ($logrev != $youngest) {
63 $logEntry = $svnrep->getLog($path, $logrev, $logrev, false);
643simandl if (is_string($logEntry)) {
65 echo $logEntry;
66 exit;
67 }
68 $logEntry = $logEntry ? $logEntry->entries[0] : false;
691simandl} else {
70 $logEntry = isset($history->entries[0]) ? $history->entries[0]: false;
71}
72 
73$headlog = $svnrep->getLog('/', '', '', true, 1);
743simandlif (is_string($headlog)) {
75 echo $headlog;
76 exit;
77}
781simandl$headrev = isset($headlog->entries[0]) ? $headlog->entries[0]->rev: 0;
79 
80// If we're not looking at a specific revision, get the HEAD revision number
81// (the revision of the rest of the tree display)
82 
83if (empty($rev)) {
84 $rev = $headrev;
85}
86 
87if ($path == '' || $path{0} != '/') {
88 $ppath = '/'.$path;
89} else {
90 $ppath = $path;
91}
92 
93$vars['repname'] = $rep->getDisplayName();
94 
95if ($passrev != 0 && $passrev != $headrev && $youngest != -1) {
96 $vars['goyoungestlink'] = '<a href="'.$config->getURL($rep, $path, 'revision').'opt=dir">'.$lang['GOYOUNGEST'].'</a>';
97} else {
98 $vars['goyoungestlink'] = '';
99}
100 
101$vars['listingurl'] = $config->getURL($rep, $path, 'dir').'rev='.$passrev;
102 
103$bugtraq = new Bugtraq($rep, $svnrep, $ppath);
104 
105$vars['action'] = '';
106$vars['rev'] = $rev;
107$vars['path'] = htmlentities($ppath, ENT_QUOTES, 'UTF-8');
108$vars['lastchangedrev'] = $logrev;
109$vars['date'] = $logEntry ? $logEntry->date: '';
110$vars['author'] = $logEntry ? $logEntry->author: '';
111$vars['log'] = $logEntry ? nl2br($bugtraq->replaceIDs(create_anchors($logEntry->msg))): '';
112 
1133simandl$changes = $logEntry ? $logEntry->mods : array();
1141simandlif (!is_array($changes)) {
115 $changes = array();
116}
117usort($changes, 'SVNLogEntry_compare');
118 
119$row = 0;
120$listing = array();
121 
122foreach ($changes as $file) {
123 $listing[] = array(
124 'file' => $file->path,
125 'added' => $file->action == 'A',
126 'modified' => $file->action == 'M',
127 'deleted' => $file->action == 'D',
128 'detailurl' => $config->getURL($rep, $file->path, 'file').'rev='.$passrev,
129 'logurl' => $config->getURL($rep, $file->path, 'log').'rev='.$passrev.'&amp;isdir=0',
130 'diffurl' => $config->getURL($rep, $file->path, 'diff').'rev='.$passrev,
131 'blameurl' => $config->getURL($rep, $file->path, 'blame').'rev='.$passrev,
132 'rowparity' => $row,
133 );
134 
135 $row = 1 - $row;
136}
137 
138createDirLinks($rep, $ppath, $passrev);
139 
140$logurl = $config->getURL($rep, $path, 'log');
141$vars['logurl'] = $logurl.'rev='.$passrev.'&amp;isdir=1';
142 
143$vars['indexurl'] = $config->getURL($rep, '', 'index');
144$vars['repurl'] = $config->getURL($rep, '', 'dir');
145 
146if ($rev != $headrev) {
1473simandl $history = $svnrep->getLog($ppath, $rev, '', false);
148 if (is_string($history)) {
149 echo $history;
150 exit;
151 }
1521simandl}
153 
154if (isset($history->entries[1]->rev)) {
155 $compurl = $config->getURL($rep, '/', 'comp');
156 $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>';
157 $vars['compareurl'] = $compurl.'compare[]='.urlencode($history->entries[1]->path).'@'.$history->entries[1]->rev. '&amp;compare[]='.urlencode($history->entries[0]->path).'@'.$history->entries[0]->rev;
158} else {
159 $vars['curdircomplink'] = '';
160 $vars['compareurl'] = '';
161}
162 
163if ($rep->getHideRss()) {
164 $rssurl = $config->getURL($rep, $path, 'rss');
165 // $vars["curdirrsslink"] = "<a href=\"${rssurl}rev=$passrev&amp;isdir=1\">${lang["RSSFEED"]}</a>";
166 // $vars["curdirrsshref"] = "${rssurl}rev=$passrev&amp;isdir=1";
167 // $vars["curdirrssanchor"] = "<a href=\"${rssurl}rev=$passrev&amp;isdir=1\">";
168 $vars['rssurl'] = $rssurl.'isdir=1';
169}
170 
171$vars['version'] = $version;
172 
173$vars['noaccess'] = !$rep->hasReadAccess($path, true);
174 
175$vars['restricted'] = !$rep->hasReadAccess($path, false);
176 
177parseTemplate($rep->getTemplatePath()."header.tmpl", $vars, $listing);
178parseTemplate($rep->getTemplatePath()."revision.tmpl", $vars, $listing);
179parseTemplate($rep->getTemplatePath()."footer.tmpl", $vars, $listing);

Powered by WebSVN 2.2.1