Rev Author Line No. Line
185 miho 1 <?php
2 // WebSVN - Subversion repository viewing via the web using PHP
4988 kaklik 3 // Copyright (C) 2004-2006 Tim Armes
185 miho 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
4988 kaklik 12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
185 miho 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
4988 kaklik 17 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
185 miho 18 //
19 // --
20 //
21 // listing.php
22 //
23 // Show the listing for the given repository/path/revision
24  
4988 kaklik 25 require_once 'include/setup.php';
26 require_once 'include/svnlook.php';
27 require_once 'include/utils.php';
28 require_once 'include/template.php';
29 require_once 'include/bugtraq.php';
185 miho 30  
31 function removeURLSeparator($url)
32 {
4988 kaklik 33 return preg_replace('#(\?|&(amp;)?)$#', '', $url);
185 miho 34 }
35  
4988 kaklik 36 function urlForPath($fullpath, $passRevString)
185 miho 37 {
4988 kaklik 38 global $config, $rep;
185 miho 39  
4988 kaklik 40 $isDir = $fullpath[strlen($fullpath) - 1] == '/';
185 miho 41  
4988 kaklik 42 if ($isDir)
43 {
44 if ($config->treeView)
45 {
46 $url = $config->getURL($rep, $fullpath, 'dir').$passRevString;
47 $id = anchorForPath($fullpath);
48 $url .= '#'.$id.'" id="'.$id;
49 }
50 else
51 {
52 $url = $config->getURL($rep, $fullpath, 'dir').$passRevString;
53 }
54 }
55 else
56 {
57 $url = $config->getURL($rep, $fullpath, 'file').$passRevString;
58 }
59 return removeURLSeparator($url);
60 }
185 miho 61  
4988 kaklik 62 function showDirFiles($svnrep, $subs, $level, $limit, $rev, $peg, $listing, $index, $treeview = true)
63 {
64 global $config, $lang, $rep, $passrev, $peg, $passRevString;
185 miho 65  
4988 kaklik 66 $path = '';
185 miho 67  
4988 kaklik 68 if (!$treeview)
69 {
70 $level = $limit;
71 }
185 miho 72  
4988 kaklik 73 // TODO: Fix node links to use the path and number of peg revision (if exists)
74 // This applies to file detail, log, and RSS -- leave the download link as-is
75 for ($n = 0; $n <= $level; $n++)
76 {
77 $path .= $subs[$n].'/';
78 }
185 miho 79  
4988 kaklik 80 // List each file in the current directory
81 $loop = 0;
82 $last_index = 0;
83 $accessToThisDir = $rep->hasReadAccess($path, false);
185 miho 84  
4988 kaklik 85 // If using flat view and not at the root, create a '..' entry at the top.
86 if (!$treeview && count($subs) > 2)
87 {
88 $parentPath = $subs;
89 unset($parentPath[count($parentPath) - 2]);
90 $parentPath = implode('/', $parentPath);
1189 miho 91  
4988 kaklik 92 if ($rep->hasReadAccess($parentPath, false))
93 {
94 $listvar = &$listing[$index];
95 $listvar['rowparity'] = $index % 2;
96 $listvar['path'] = str_replace('%2F', '/', rawurlencode($parentPath));
97 $listvar['filetype'] = 'dir';
98 $listvar['filename'] = '..';
99 $listvar['fileurl'] = urlForPath($parentPath, $passRevString);
100 $listvar['filelink'] = '<a href="'.$listvar['fileurl'].'">'.$listvar['filename'].'</a>';
101 $listvar['level'] = 0;
102 $listvar['node'] = 0; // t-node
103 $listvar['revision'] = $rev;
104 $listvar['revurl'] = $config->getURL($rep, $parentPath, 'revision').'rev='.$rev.'&amp;isdir=1';
105 global $vars;
106 $listvar['date'] = $vars['date'];
107 $listvar['age'] = datetimeFormatDuration(time() - strtotime($vars['date']), true, true);
108 $index++;
109 }
110 }
1189 miho 111  
4988 kaklik 112 $openDir = false;
113 $logList = $svnrep->getList($path, $rev, $peg);
1189 miho 114  
4988 kaklik 115 if (!$logList)
116 {
117 return $listing;
118 }
1189 miho 119  
4988 kaklik 120 $downloadRevAndPeg = createRevAndPegString($rev, $peg ? $peg : $rev);
121 foreach ($logList->entries as $entry)
122 {
123 $isDir = $entry->isdir;
124 if (!$isDir && $level != $limit)
125 {
126 continue; // Skip any files outside the current directory
127 }
128 $file = $entry->file;
129 $isDirString = ($isDir) ? 'isdir=1&amp;' : '';
1189 miho 130  
4988 kaklik 131 // Only list files/directories that are not designated as off-limits
132 $access = ($isDir) ? $rep->hasReadAccess($path.$file, false)
133 : $accessToThisDir;
1189 miho 134  
4988 kaklik 135 if (!$access)
136 {
137 continue;
138 }
139  
140 $listvar = &$listing[$index];
141 $listvar['rowparity'] = $index % 2;
142  
143 if ($isDir)
144 {
145 $openDir = isset($subs[$level + 1]) && (!strcmp($subs[$level + 1].'/', $file) || !strcmp($subs[$level + 1], $file));
146 $listvar['filetype'] = ($openDir) ? 'diropen' : 'dir';
147 }
148 else
149 {
150 $openDir = false;
151 $listvar['filetype'] = strtolower(strrchr($file, '.'));
152 }
153  
154 $listvar['isDir'] = $isDir;
155 $listvar['openDir'] = $openDir;
156 $listvar['level'] = ($treeview) ? $level : 0;
157 $listvar['node'] = 0; // t-node
158 $listvar['path'] = str_replace('%2F', '/', rawurlencode($path.$file));
159 $listvar['filename'] = escape($file);
160  
161 if ($isDir)
162 {
163 $listvar['fileurl'] = urlForPath($path.$file, $passRevString);
164 }
165 else
166 {
167 $listvar['fileurl'] = urlForPath($path.$file, createDifferentRevAndPegString($passrev, $peg));
168 }
169  
170 $listvar['filelink'] = '<a href="'.$listvar['fileurl'].'">'.$listvar['filename'].'</a>';
171  
172 if ($isDir)
173 {
174 $listvar['logurl'] = $config->getURL($rep, $path.$file, 'log').$isDirString.$passRevString;
175 }
176 else
177 {
178 $listvar['logurl'] = $config->getURL($rep, $path.$file, 'log').$isDirString.createDifferentRevAndPegString($passrev, $peg);
179 }
180  
181 if ($treeview)
182 {
183 $listvar['compare_box'] = '<input type="checkbox" name="compare[]" value="'.escape($path.$file).'@'.$passrev.'" onclick="enforceOnlyTwoChecked(this)" />';
184 }
185  
186 if ($config->showLastModInListing())
187 {
188 $listvar['committime'] = $entry->committime;
189 $listvar['revision'] = $entry->rev;
190 $listvar['author'] = $entry->author;
191 $listvar['age'] = $entry->age;
192 $listvar['date'] = $entry->date;
193 $listvar['revurl'] = $config->getURL($rep, $path.$file, 'revision').$isDirString.createRevAndPegString($entry->rev, $peg ? $peg : $rev);
194 }
195  
196 if ($rep->isDownloadAllowed($path.$file))
197 {
198 $downloadurl = $config->getURL($rep, $path.$file, 'dl').$isDirString.$downloadRevAndPeg;
199  
200 if ($isDir)
201 {
202 $listvar['downloadurl'] = $downloadurl;
203 $listvar['downloadplainurl'] = '';
204 }
205 else
206 {
207 $listvar['downloadplainurl'] = $downloadurl;
208 $listvar['downloadurl'] = '';
209 }
210 }
211 else
212 {
213 $listvar['downloadplainurl'] = '';
214 $listvar['downloadurl'] = '';
215 }
216  
217 if ($rep->isRssEnabled())
218 {
219 // RSS should always point to the latest revision, so don't include rev
220 $listvar['rssurl'] = $config->getURL($rep, $path.$file, 'rss').$isDirString.createRevAndPegString('', $peg);
221 }
222  
223 $loop++;
224 $index++;
225 $last_index = $index;
226  
227 if ($isDir && ($level != $limit))
228 {
229 // @todo remove the alternate check with htmlentities when assured that there are not side effects
230 if (isset($subs[$level + 1]) && (!strcmp($subs[$level + 1].'/', $file) || !strcmp(htmlentities($subs[$level + 1], ENT_QUOTES).'/', htmlentities($file))))
231 {
232 $listing = showDirFiles($svnrep, $subs, $level + 1, $limit, $rev, $peg, $listing, $index);
233 $index = count($listing);
234 }
235 }
236 }
237  
238 // For an expanded tree, give the last entry an "L" node to close the grouping
239 if ($treeview && $last_index != 0)
240 {
241 $listing[$last_index - 1]['node'] = 1; // l-node
242 }
243  
244 return $listing;
1189 miho 245 }
246  
4988 kaklik 247 function showAllDirFiles($svnrep, $path, $rev, $peg, $listing, $index, $treeView = true)
185 miho 248 {
4988 kaklik 249 global $config, $lang, $rep, $passrev, $peg, $passRevString;
185 miho 250  
4988 kaklik 251 // List each file in the current directory
252 $loop = 0;
253 $last_index = 0;
254 $accessToThisDir = $rep->hasReadAccess($path, false);
185 miho 255  
4988 kaklik 256 // If using flat view and not at the root, create a '..' entry at the top.
257 if (!$treeView && count($subs) > 2)
258 {
259 $parentPath = $subs;
260 unset($parentPath[count($parentPath) - 2]);
261 $parentPath = implode('/', $parentPath);
1189 miho 262  
4988 kaklik 263 if ($rep->hasReadAccess($parentPath, false))
264 {
265 $listvar = &$listing[$index];
266 $listvar['rowparity'] = $index % 2;
267 $listvar['path'] = str_replace('%2F', '/', rawurlencode($parentPath));
268 $listvar['filetype'] = 'dir';
269 $listvar['filename'] = '..';
270 $listvar['fileurl'] = urlForPath($parentPath, $passRevString);
271 $listvar['filelink'] = '<a href="'.$listvar['fileurl'].'">'.$listvar['filename'].'</a>';
272 $listvar['level'] = 0;
273 $listvar['node'] = 0; // t-node
274 $listvar['revision'] = $rev;
275 $listvar['revurl'] = $config->getURL($rep, $parentPath, 'revision').'rev='.$rev.'&amp;isdir=1';
276 global $vars;
277 $listvar['date'] = $vars['date'];
278 $listvar['age'] = datetimeFormatDuration(time() - strtotime($vars['date']), true, true);
279 $index++;
280 }
281 }
1189 miho 282  
4988 kaklik 283 $openDir = false;
284 $logList = $svnrep->getList($path, $rev, $peg);
1189 miho 285  
4988 kaklik 286 if (!$logList)
287 {
288 return $listing;
289 }
1189 miho 290  
4988 kaklik 291 $downloadRevAndPeg = createRevAndPegString($rev, $peg ? $peg : $rev);
185 miho 292  
4988 kaklik 293 foreach ($logList->entries as $entry)
294 {
295 $isDir = $entry->isdir;
185 miho 296  
4988 kaklik 297 $file = $entry->file;
298 $isDirString = ($isDir) ? 'isdir=1&amp;' : '';
185 miho 299  
4988 kaklik 300 // Only list files/directories that are not designated as off-limits
301 $access = ($isDir) ? $rep->hasReadAccess($path.$file, false)
302 : $accessToThisDir;
185 miho 303  
4988 kaklik 304 if (!$access)
305 {
306 continue;
307 }
1189 miho 308  
4988 kaklik 309 $listvar = &$listing[$index];
310 $listvar['rowparity'] = $index % 2;
185 miho 311  
4988 kaklik 312 if ($isDir)
313 {
314 $listvar['filetype'] = 'dir';
315 $openDir = true;
316 }
317 else
318 {
319 $listvar['filetype'] = strtolower(strrchr($file, '.'));
320 $openDir = false;
321 }
1189 miho 322  
4988 kaklik 323 $listvar['isDir'] = $isDir;
324 $listvar['openDir'] = $openDir;
325 $listvar['path'] = str_replace('%2F', '/', rawurlencode($path.$file));
326 $tempelements = explode('/',$file);
1189 miho 327  
4988 kaklik 328 if ($tempelements[count($tempelements)-1] === "")
329 {
330 $lastindexfile = count($tempelements)-1 - 1;
331 $listvar['node'] = $lastindexfile; // t-node
332 $listvar['level'] = ($treeView) ? $lastindexfile : 0;
333 $listvar['filename'] = escape($tempelements[$lastindexfile]);
334 $listvar['classname'] = '';
1189 miho 335  
4988 kaklik 336 for ($n = 0; $n < $lastindexfile; ++$n)
337 {
338 $listvar['last_i_node'][$n] = false;
339 $listvar['classname'] = $listvar['classname'].$tempelements[$n].'/';
340 }
1189 miho 341  
4988 kaklik 342 $listvar['classname'] = $listvar['classname'].$tempelements[$lastindexfile];
343 $listvar['last_i_node'][$lastindexfile] = true;
344 }
345 else
346 {
347 $lastindexfile = count($tempelements)-1;
348 $listvar['node'] = $lastindexfile; // t-node
349 $listvar['level'] = ($treeView) ? $lastindexfile : 0;
350 $listvar['filename'] = escape($tempelements[$lastindexfile]);
351 $listvar['classname'] = '';
1189 miho 352  
4988 kaklik 353 for ($n=0; $n < $lastindexfile; ++$n)
354 {
355 $listvar['last_i_node'][$n] = false;
356 $listvar['classname'] = $listvar['classname'].$tempelements[$n].'/';
357 }
1189 miho 358  
4988 kaklik 359 $listvar['last_i_node'][$lastindexfile] = true;
360 }
185 miho 361  
4988 kaklik 362 if ($isDir)
363 {
364 $listvar['fileurl'] = urlForPath($path.$file, $passRevString);
365 }
366 else
367 {
368 $listvar['fileurl'] = urlForPath($path.$file, createDifferentRevAndPegString($passrev, $peg));
369 }
1189 miho 370  
4988 kaklik 371 $listvar['filelink'] = '<a href="'.$listvar['fileurl'].'">'.$listvar['filename'].'</a>';
1189 miho 372  
4988 kaklik 373 if ($isDir)
374 {
375 $listvar['logurl'] = $config->getURL($rep, $path.$file, 'log').$isDirString.$passRevString;
376 }
377 else
378 {
379 $listvar['logurl'] = $config->getURL($rep, $path.$file, 'log').$isDirString.createDifferentRevAndPegString($passrev, $peg);
380 }
1189 miho 381  
4988 kaklik 382 if ($treeView)
383 {
384 $listvar['compare_box'] = '<input type="checkbox" name="compare[]" value="'.escape($path.$file).'@'.$passrev.'" onclick="enforceOnlyTwoChecked(this)" />';
385 }
1189 miho 386  
4988 kaklik 387 if ($config->showLastModInListing())
388 {
389 $listvar['committime'] = $entry->committime;
390 $listvar['revision'] = $entry->rev;
391 $listvar['author'] = $entry->author;
392 $listvar['age'] = $entry->age;
393 $listvar['date'] = $entry->date;
394 $listvar['revurl'] = $config->getURL($rep, $path.$file, 'revision').$isDirString.createRevAndPegString($entry->rev, $peg ? $peg : $rev);
395 }
185 miho 396  
4988 kaklik 397 if ($rep->isDownloadAllowed($path.$file))
398 {
399 $downloadurl = $config->getURL($rep, $path.$file, 'dl').$isDirString.$downloadRevAndPeg;
185 miho 400  
4988 kaklik 401 if ($isDir)
402 {
403 $listvar['downloadurl'] = $downloadurl;
404 $listvar['downloadplainurl'] = '';
405 }
406 else
407 {
408 $listvar['downloadplainurl'] = $downloadurl;
409 $listvar['downloadurl'] = '';
410 }
411 }
412 else
413 {
414 $listvar['downloadplainurl'] = '';
415 $listvar['downloadurl'] = '';
416 }
185 miho 417  
4988 kaklik 418 if ($rep->isRssEnabled())
419 {
420 // RSS should always point to the latest revision, so don't include rev
421 $listvar['rssurl'] = $config->getURL($rep, $path.$file, 'rss').$isDirString.createRevAndPegString('', $peg);
422 }
423  
424 $loop++;
425 $index++;
426 $last_index = $index;
427 }
428  
429 return $listing;
185 miho 430 }
431  
4988 kaklik 432 function showTreeDir($svnrep, $path, $rev, $peg, $listing)
185 miho 433 {
4988 kaklik 434 global $vars, $config;
185 miho 435  
4988 kaklik 436 if ($config->showLoadAllRepos())
437 {
438 $vars['compare_box'] = ''; // Set blank once in case tree view is not enabled.
439 return showAllDirFiles($svnrep, $path, $rev, $peg, $listing, 0, $config->treeView);
440 }
185 miho 441  
4988 kaklik 442 $subs = explode('/', $path);
185 miho 443  
4988 kaklik 444 // The last element in "$subs" is empty for directories, some file name for files, but ALWAYS
445 // exists as an additional element. Hence, "-2" is necessary.
446 //
447 // Additionally, level and limit are conceptually different things, first to e.g. start access
448 // checks FROM, latter to process UNTIL. So don't merge those values too easily, especially as
449 // both values needed to be different in some environments in the past for some unkown reason.
450 //
451 // https://github.com/websvnphp/websvn/issues/146#issuecomment-913353366
452 $limit = count($subs) - 2;
453 $level = $limit;
454 $level = $level <= 0 ? 0 : $level;
185 miho 455  
4988 kaklik 456 for ($n = 0; $n < $limit; $n++)
457 {
458 $vars['last_i_node'][$n] = false;
459 }
185 miho 460  
4988 kaklik 461 $vars['compare_box'] = ''; // Set blank once in case tree view is not enabled.
462 return showDirFiles($svnrep, $subs, $level, $limit, $rev, $peg, $listing, 0, $config->treeView);
185 miho 463 }
464  
465 // Make sure that we have a repository
4988 kaklik 466 if (!$rep)
185 miho 467 {
4988 kaklik 468 renderTemplate404('directory','NOREP');
185 miho 469 }
470  
471 $svnrep = new SVNRepository($rep);
472  
4988 kaklik 473 if (!empty($rev))
474 {
475 $info = $svnrep->getInfo($path, $rev, $peg);
185 miho 476  
4988 kaklik 477 if ($info)
478 {
479 $path = $info->path;
480 $peg = (int)$info->rev;
481 }
482 }
185 miho 483  
4988 kaklik 484 $history = $svnrep->getLog($path, 'HEAD', 1, false, 2, ($path == '/') ? '' : $peg);
185 miho 485  
4988 kaklik 486 if (!$history)
487 {
488 unset($vars['error']);
489 $history = $svnrep->getLog($path, '', '', false, 2, ($path == '/') ? '' : $peg);
185 miho 490  
4988 kaklik 491 if (!$history)
492 {
493 renderTemplate404('directory','NOPATH');
494 }
495 }
496  
497 $youngest = ($history && isset($history->entries[0])) ? $history->entries[0]->rev : 0;
498  
185 miho 499 // Unless otherwise specified, we get the log details of the latest change
4988 kaklik 500 $lastChangedRev = ($passrev) ? $passrev : $youngest;
185 miho 501  
4988 kaklik 502 if ($lastChangedRev != $youngest)
185 miho 503 {
4988 kaklik 504 $history = $svnrep->getLog($path, $lastChangedRev, 1, false, 2, $peg);
185 miho 505 }
506  
4988 kaklik 507 $logEntry = ($history && isset($history->entries[0])) ? $history->entries[0] : 0;
185 miho 508  
4988 kaklik 509 $headlog = $svnrep->getLog('/', '', '', true, 1);
510 $headrev = ($headlog && isset($headlog->entries[0])) ? $headlog->entries[0]->rev : 0;
511  
185 miho 512 // If we're not looking at a specific revision, get the HEAD revision number
513 // (the revision of the rest of the tree display)
514  
515 if (empty($rev))
516 {
4988 kaklik 517 $rev = $headrev;
185 miho 518 }
519  
4988 kaklik 520 if ($path == '' || $path[0] != '/')
521 {
522 $ppath = '/'.$path;
523 }
185 miho 524 else
4988 kaklik 525 {
526 $ppath = $path;
527 }
185 miho 528  
4988 kaklik 529 createPathLinks($rep, $ppath, $passrev, $peg);
530 $passRevString = createRevAndPegString($passrev, $peg);
531 $isDirString = 'isdir=1&amp;';
185 miho 532  
4988 kaklik 533 $revurl = $config->getURL($rep, $path != '/' ? $path : '', 'dir');
534 $revurlSuffix = $path != '/' ? '#'.anchorForPath($path) : '';
185 miho 535  
4988 kaklik 536 if ($rev < $youngest)
537 {
538 if ($path == '/')
539 {
540 $vars['goyoungesturl'] = $config->getURL($rep, '', 'dir');
541 }
542 else
543 {
544 $vars['goyoungesturl'] = $config->getURL($rep, $path, 'dir').createRevAndPegString($youngest, $peg ? $peg: $rev).$revurlSuffix;
545 }
185 miho 546  
4988 kaklik 547 $vars['goyoungestlink'] = '<a href="'.$vars['goyoungesturl'].'"'.($youngest ? ' title="'.$lang['REV'].' '.$youngest.'"' : '').'>'.$lang['GOYOUNGEST'].'</a>';
185 miho 548  
4988 kaklik 549 $history2 = $svnrep->getLog($path, $rev, $youngest, true, 2, $peg);
185 miho 550  
4988 kaklik 551 if (isset($history2->entries[1]))
552 {
553 $nextRev = $history2->entries[1]->rev;
554 if ($nextRev != $youngest)
555 {
556 $vars['nextrev'] = $nextRev;
557 $vars['nextrevurl'] = $revurl.createRevAndPegString($nextRev, $peg).$revurlSuffix;
558 }
559 }
185 miho 560  
4988 kaklik 561 unset($vars['error']);
185 miho 562 }
4988 kaklik 563  
564 if (isset($history->entries[1]))
185 miho 565 {
4988 kaklik 566 $prevRev = $history->entries[1]->rev;
567 $prevPath = $history->entries[1]->path;
568 $vars['prevrev'] = $prevRev;
569 $vars['prevrevurl'] = $revurl.createRevAndPegString($prevRev, $peg).$revurlSuffix;
570 }
185 miho 571  
4988 kaklik 572 $bugtraq = new Bugtraq($rep, $svnrep, $ppath);
185 miho 573  
4988 kaklik 574 $vars['action'] = '';
575 $vars['rev'] = $rev;
576 $vars['peg'] = $peg;
577 $vars['path'] = str_replace('%2F', '/', rawurlencode($ppath));
578 $vars['safepath'] = escape($ppath);
579 $vars['lastchangedrev'] = $lastChangedRev;
1189 miho 580  
4988 kaklik 581 if ($logEntry)
582 {
583 $vars['date'] = $logEntry->date;
584 $vars['age'] = datetimeFormatDuration(time() - strtotime($logEntry->date));
585 $vars['author'] = $logEntry->author;
586 $vars['log'] = nl2br($bugtraq->replaceIDs(create_anchors(xml_entities($logEntry->msg))));
587 }
185 miho 588  
4988 kaklik 589 $vars['revurl'] = $config->getURL($rep, ($path == '/' ? '' : $path), 'revision').$isDirString.$passRevString;
590 $vars['revlink'] = '<a href="'.$vars['revurl'].'">'.$lang['LASTMOD'].'</a>';
1189 miho 591  
4988 kaklik 592 if ($history && count($history->entries) > 1)
593 {
594 $vars['compareurl'] = $config->getURL($rep, '', 'comp').'compare[]='.rawurlencode($history->entries[1]->path).'@'.$history->entries[1]->rev. '&amp;compare[]='.rawurlencode($history->entries[0]->path).'@'.$history->entries[0]->rev;
595 $vars['comparelink'] = '<a href="'.$vars['compareurl'].'">'.$lang['DIFFPREV'].'</a>';
596 }
1189 miho 597  
4988 kaklik 598 $vars['logurl'] = $config->getURL($rep, $path, 'log').$isDirString.$passRevString;
599 $vars['loglink'] = '<a href="'.$vars['logurl'].'">'.$lang['VIEWLOG'].'</a>';
600  
601 if ($rep->isRssEnabled())
602 {
603 $vars['rssurl'] = $config->getURL($rep, $path, 'rss').$isDirString.createRevAndPegString('', $peg);
604 $vars['rsslink'] = '<a href="'.$vars['rssurl'].'">'.$lang['RSSFEED'].'</a>';
185 miho 605 }
606  
4988 kaklik 607 // Set up the tarball link
608 $subs = explode('/', $path);
609 $level = count($subs) - 2;
185 miho 610  
4988 kaklik 611 if ($rep->isDownloadAllowed($path) && !isset($vars['warning']))
185 miho 612 {
4988 kaklik 613 $vars['downloadurl'] = $config->getURL($rep, $path, 'dl').$isDirString.$passRevString;
185 miho 614 }
615  
4988 kaklik 616 $vars['compare_form'] = '<form method="get" action="'.$config->getURL($rep, '', 'comp').'" id="compare">';
617  
618 if ($config->multiViews)
185 miho 619 {
4988 kaklik 620 $vars['compare_form'] .= '<input type="hidden" name="op" value="comp"/>';
185 miho 621 }
622 else
623 {
4988 kaklik 624 $vars['compare_form'] .= '<input type="hidden" name="repname" value="'.$repname.'" />';
185 miho 625 }
626  
4988 kaklik 627 $vars['compare_submit'] = '<input type="submit" value="'.$lang['COMPAREPATHS'].'" />';
628 $vars['compare_endform'] = '</form>';
185 miho 629  
4988 kaklik 630 $vars['showlastmod'] = $config->showLastModInListing();
185 miho 631  
4988 kaklik 632 $vars['loadalldir'] = $config->showLoadAllRepos();
633 $listing = showTreeDir($svnrep, $path, $rev, $peg, array());
185 miho 634  
4988 kaklik 635 if (!$rep->hasReadAccess($path))
636 {
637 $vars['error'] = $lang['NOACCESS'];
638 sendHeaderForbidden();
639 }
185 miho 640  
4988 kaklik 641 $vars['restricted'] = !$rep->hasReadAccess($path, false);
642 renderTemplate('directory', $path);