Rev 172 Rev 185
1 <?php 1 <?php
2 # vim:et:ts=3:sts=3:sw=3:fdm=marker: 2 # vim:et:ts=3:sts=3:sw=3:fdm=marker:
3   3  
4 // WebSVN - Subversion repository viewing via the web using PHP 4 // WebSVN - Subversion repository viewing via the web using PHP
5 // Copyright © 2004-2006 Tim Armes, Matt Sicker 5 // Copyright © 2004-2006 Tim Armes, Matt Sicker
6 // 6 //
7 // This program is free software; you can redistribute it and/or modify 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 8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation; either version 2 of the License, or 9 // the Free Software Foundation; either version 2 of the License, or
10 // (at your option) any later version. 10 // (at your option) any later version.
11 // 11 //
12 // This program is distributed in the hope that it will be useful, 12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details. 15 // GNU General Public License for more details.
16 // 16 //
17 // You should have received a copy of the GNU General Public License 17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software 18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // 20 //
21 // -- 21 // --
22 // 22 //
23 // listing.php 23 // listing.php
24 // 24 //
25 // Show the listing for the given repository/path/revision 25 // Show the listing for the given repository/path/revision
26   26  
27 require_once("include/setup.inc"); 27 require_once("include/setup.inc");
28 require_once("include/svnlook.inc"); 28 require_once("include/svnlook.inc");
29 require_once("include/utils.inc"); 29 require_once("include/utils.inc");
30 require_once("include/template.inc"); 30 require_once("include/template.inc");
31 require_once("include/bugtraq.inc"); 31 require_once("include/bugtraq.inc");
32   32  
33 function removeURLSeparator($url) 33 function removeURLSeparator($url)
34 { 34 {
35 return preg_replace('#(\?|&(amp;)?)$#', '', $url); 35 return preg_replace('#(\?|&(amp;)?)$#', '', $url);
36 } 36 }
37   37  
38 function fileLink($path, $file, $returnjoin = false) 38 function fileLink($path, $file, $returnjoin = false)
39 { 39 {
40 global $rep, $passrev, $showchanged, $config; 40 global $rep, $passrev, $showchanged, $config;
41 41
42 if ($path == "" || $path{0} != "/") 42 if ($path == "" || $path{0} != "/")
43 $ppath = "/".$path; 43 $ppath = "/".$path;
44 else 44 else
45 $ppath = $path; 45 $ppath = $path;
46   46  
47 if ($ppath{strlen($ppath)-1} != "/") 47 if ($ppath{strlen($ppath)-1} != "/")
48 $ppath .= "/"; 48 $ppath .= "/";
49 49
50 if ($file{0} == "/") 50 if ($file{0} == "/")
51 $pfile = substr($file, 1); 51 $pfile = substr($file, 1);
52 else 52 else
53 $pfile = $file; 53 $pfile = $file;
54 //$pfile = rawurldecode($pfile); -  
55   54  
56 if ($returnjoin) 55 if ($returnjoin)
57 return $ppath.$pfile; 56 return $ppath.$pfile;
58   57  
59 $isDir = $pfile{strlen($pfile) - 1} == "/"; 58 $isDir = $pfile{strlen($pfile) - 1} == "/";
60 59
61 if ($passrev) $passrevstr = "rev=$passrev&amp;"; else $passrevstr = ""; 60 if ($passrev) $passrevstr = "rev=$passrev&amp;"; else $passrevstr = "";
62 if ($showchanged) $showchangedstr = "sc=$showchanged"; else $showchangedstr = ""; 61 if ($showchanged) $showchangedstr = "sc=$showchanged"; else $showchangedstr = "";
63   62  
64 if ($isDir) 63 if ($isDir)
65 { 64 {
66 $url = $config->getURL($rep, $ppath.$pfile, "dir"); 65 $url = $config->getURL($rep, $ppath.$pfile, "dir");
67   66  
68 // XHTML doesn't allow slashes in IDs ~J 67 // XHTML doesn't allow slashes in IDs ~J
69 $id = str_replace('/', '_', $ppath.$pfile); 68 $id = str_replace('/', '_', $ppath.$pfile);
70 $url = "<a id='$id' href=\"${url}$passrevstr$showchangedstr"; 69 $url = "<a id='$id' href=\"${url}$passrevstr$showchangedstr";
71   70  
72 $url = removeURLSeparator($url); 71 $url = removeURLSeparator($url);
73 if ($config->treeView) $url .= "#$id"; 72 if ($config->treeView) $url .= "#$id";
74 $url .= "\">$pfile</a>"; 73 $url .= "\">$pfile</a>";
75 } 74 }
76 else 75 else
77 { 76 {
78 $url = $config->getURL($rep, $ppath.$pfile, "file"); 77 $url = $config->getURL($rep, $ppath.$pfile, "file");
79 $url .= $passrevstr.$showchangedstr; 78 $url .= $passrevstr.$showchangedstr;
80 $url = removeURLSeparator($url); 79 $url = removeURLSeparator($url);
81 $url = "<a href=\"${url}\">$pfile</a>"; 80 $url = "<a href=\"${url}\">$pfile</a>";
82 } 81 }
83   82  
84 return $url; 83 return $url;
85 } 84 }
86   85  
87 function showDirFiles($svnrep, $subs, $level, $limit, $rev, $listing, $index, $treeview = true) 86 function showDirFiles($svnrep, $subs, $level, $limit, $rev, $listing, $index, $treeview = true)
88 { 87 {
89 global $rep, $passrev, $showchanged, $config, $lang; 88 global $rep, $passrev, $showchanged, $config, $lang;
90   89  
91 $path = ""; 90 $path = "";
92   91  
93 if (!$treeview) 92 if (!$treeview)
94 $level = $limit; 93 $level = $limit;
95   94  
96 for ($n = 0; $n <= $level; $n++) 95 for ($n = 0; $n <= $level; $n++)
97 { 96 {
98 $path .= $subs[$n]."/"; 97 $path .= $subs[$n]."/";
99 } 98 }
100   99  
101 $contents = $svnrep->dirContents($path, $rev); 100 $contents = $svnrep->dirContents($path, $rev);
102   101  
103 // List each file in the current directory 102 // List each file in the current directory
104 $loop = 0; 103 $loop = 0;
105 $last_index = 0; 104 $last_index = 0;
106 $openDir = false; 105 $openDir = false;
107 $fullaccess = $rep->hasReadAccess($path, false); 106 $fullaccess = $rep->hasReadAccess($path, false);
108 107
109 foreach($contents as $file) 108 foreach($contents as $file)
110 { 109 {
111 $isDir = ($file{strlen($file) - 1} == "/"?1:0); 110 $isDir = ($file{strlen($file) - 1} == "/"?1:0);
112 $access = false; 111 $access = false;
113   112  
114 if ($isDir) 113 if ($isDir)
115 { 114 {
116 if ($rep->hasReadAccess($path.$file, true)) 115 if ($rep->hasReadAccess($path.$file, true))
117 { 116 {
118 $access = true; 117 $access = true;
119 $openDir = (!strcmp($subs[$level+1]."/", $file) || !strcmp($subs[$level+1], $file)); 118 $openDir = (!strcmp($subs[$level+1]."/", $file) || !strcmp($subs[$level+1], $file));
120 119
121 if ($openDir) 120 if ($openDir)
122 $listing[$index]["filetype"] = "diropen"; 121 $listing[$index]["filetype"] = "diropen";
123 else 122 else
124 $listing[$index]["filetype"] = "dir"; 123 $listing[$index]["filetype"] = "dir";
125   124  
126 if ($rep->isDownloadAllowed($path.$file)) 125 if ($rep->isDownloadAllowed($path.$file))
127 { 126 {
128 $dlurl = $config->getURL($rep, $path.$file, "dl"); 127 $dlurl = $config->getURL($rep, $path.$file, "dl");
129 $listing[$index]["fileviewdllink"] = "<a href=\"${dlurl}rev=$passrev&amp;isdir=1\">${lang["TARBALL"]}</a>"; 128 $listing[$index]["fileviewdllink"] = "<a href=\"${dlurl}rev=$passrev&amp;isdir=1\">${lang["TARBALL"]}</a>";
130 } 129 }
131 else 130 else
132 $listing[$index]["fileviewdllink"] = "&nbsp;"; 131 $listing[$index]["fileviewdllink"] = "&nbsp;";
133 } 132 }
134 } 133 }
135 else 134 else
136 { 135 {
137 if ($fullaccess) 136 if ($fullaccess)
138 { 137 {
139 $access = true; 138 $access = true;
140 if ($level != $limit) 139 if ($level != $limit)
141 { 140 {
142 // List directories only, skip all files 141 // List directories only, skip all files
143 continue; 142 continue;
144 } 143 }
145 144
146 $listing[$index]["fileviewdllink"] = "&nbsp;"; 145 $listing[$index]["fileviewdllink"] = "&nbsp;";
147 $listing[$index]["filetype"] = strrchr($file, "."); 146 $listing[$index]["filetype"] = strrchr($file, ".");
148 } 147 }
149 } 148 }
150 149
151 if ($access) 150 if ($access)
152 { 151 {
153 $listing[$index]["rowparity"] = ($index % 2)?"1":"0"; 152 $listing[$index]["rowparity"] = ($index % 2)?"1":"0";
154 153
155 if ($treeview) 154 if ($treeview)
156 $listing[$index]["compare_box"] = "<input type=\"checkbox\" name=\"compare[]\" value=\"".fileLink($path, $file, true)."@$passrev\" onclick=\"checkCB(this)\" />"; 155 $listing[$index]["compare_box"] = "<input type=\"checkbox\" name=\"compare[]\" value=\"".fileLink($path, $file, true)."@$passrev\" onclick=\"checkCB(this)\" />";
157 else 156 else
158 $listing[$index]["compare_box"] = ""; 157 $listing[$index]["compare_box"] = "";
159 158
160 if ($openDir) 159 if ($openDir)
161 $listing[$index]["filelink"] = "<b>".fileLink($path, $file)."</b>"; 160 $listing[$index]["filelink"] = "<b>".fileLink($path, $file)."</b>";
162 else 161 else
163 $listing[$index]["filelink"] = fileLink($path, $file); 162 $listing[$index]["filelink"] = fileLink($path, $file);
164 163
165 // The history command doesn't return with a trailing slash. We need to remember here if the 164 // The history command doesn't return with a trailing slash. We need to remember here if the
166 // file is a directory or not! 165 // file is a directory or not!
167 166
168 $listing[$index]["isDir"] = $isDir; 167 $listing[$index]["isDir"] = $isDir;
169 168
170 if ($treeview) 169 if ($treeview)
171 $listing[$index]["level"] = $level; 170 $listing[$index]["level"] = $level;
172 else 171 else
173 $listing[$index]["level"] = 0; 172 $listing[$index]["level"] = 0;
174   173  
175 $listing[$index]["node"] = 0; // t-node 174 $listing[$index]["node"] = 0; // t-node
176 175
177 $fileurl = $config->getURL($rep, $path.$file, "log"); 176 $fileurl = $config->getURL($rep, $path.$file, "log");
178 $listing[$index]["fileviewloglink"] = "<a href=\"${fileurl}rev=$passrev&amp;sc=$showchanged&amp;isdir=$isDir\">${lang["VIEWLOG"]}</a>"; 177 $listing[$index]["fileviewloglink"] = "<a href=\"${fileurl}rev=$passrev&amp;sc=$showchanged&amp;isdir=$isDir\">${lang["VIEWLOG"]}</a>";
179 178
180 $rssurl = $config->getURL($rep, $path.$file, "rss"); 179 $rssurl = $config->getURL($rep, $path.$file, "rss");
181 if ($rep->getHideRss()) 180 if ($rep->getHideRss())
182 { 181 {
183 $listing[$index]["rsslink"] = "<a href=\"${rssurl}rev=$passrev&amp;sc=$showchanged&amp;isdir=$isDir\">${lang["RSSFEED"]}</a>"; 182 $listing[$index]["rsslink"] = "<a href=\"${rssurl}rev=$passrev&amp;sc=$showchanged&amp;isdir=$isDir\">${lang["RSSFEED"]}</a>";
184 $listing[$index]["rssanchor"] = "<a href=\"${rssurl}rev=$passrev&amp;sc=$showchanged&amp;isdir=$isDir\">"; 183 $listing[$index]["rssanchor"] = "<a href=\"${rssurl}rev=$passrev&amp;sc=$showchanged&amp;isdir=$isDir\">";
185 } 184 }
186 185
187 $index++; 186 $index++;
188 $loop++; 187 $loop++;
189 $last_index = $index; 188 $last_index = $index;
190 189
191 if (($level != $limit) && ($isDir)) 190 if (($level != $limit) && ($isDir))
192 { 191 {
193 if (!strcmp($subs[$level + 1]."/", $file)) 192 if (!strcmp($subs[$level + 1]."/", $file))
194 { 193 {
195 $listing = showDirFiles($svnrep, $subs, $level + 1, $limit, $rev, $listing, $index); 194 $listing = showDirFiles($svnrep, $subs, $level + 1, $limit, $rev, $listing, $index);
196 $index = count($listing); 195 $index = count($listing);
197 } 196 }
198 } 197 }
199   198  
200 } 199 }
201 } 200 }
202   201  
203 if ($last_index != 0 && $treeview) 202 if ($last_index != 0 && $treeview)
204 { 203 {
205 $listing[$last_index - 1]["node"] = 1; // l-node 204 $listing[$last_index - 1]["node"] = 1; // l-node
206 } 205 }
207   206  
208 return $listing; 207 return $listing;
209 } 208 }
210   209  
211 function showTreeDir($svnrep, $path, $rev, $listing) 210 function showTreeDir($svnrep, $path, $rev, $listing)
212 { 211 {
213 global $vars, $config; 212 global $vars, $config;
214   213  
215 $subs = explode("/", $path); 214 $subs = explode("/", $path);
216   215  
217 // For directory, the last element in the subs is empty. 216 // For directory, the last element in the subs is empty.
218 // For file, the last element in the subs is the file name. 217 // For file, the last element in the subs is the file name.
219 // Therefore, it is always count($subs) - 2 218 // Therefore, it is always count($subs) - 2
220 $limit = count($subs) - 2; 219 $limit = count($subs) - 2;
221   220  
222 for ($n = 0; $n < $limit; $n++) 221 for ($n = 0; $n < $limit; $n++)
223 { 222 {
224 $vars["last_i_node"][$n] = FALSE; 223 $vars["last_i_node"][$n] = FALSE;
225 } 224 }
226   225  
227 return showDirFiles($svnrep, $subs, 0, $limit, $rev, $listing, 0, $config->treeView); 226 return showDirFiles($svnrep, $subs, 0, $limit, $rev, $listing, 0, $config->treeView);
228   227  
229 } 228 }
230   229  
231 // Make sure that we have a repository 230 // Make sure that we have a repository
232 if (!isset($rep)) 231 if (!isset($rep))
233 { 232 {
234 echo $lang["NOREP"]; 233 echo $lang["NOREP"];
235 exit; 234 exit;
236 } 235 }
237   236  
238 $svnrep = new SVNRepository($rep); 237 $svnrep = new SVNRepository($rep);
239   238  
240 // Revision info to pass along chain 239 // Revision info to pass along chain
241 $passrev = $rev; 240 $passrev = $rev;
242   241  
243 // Get the directory contents of the given revision, or HEAD if not defined 242 // Get the directory contents of the given revision, or HEAD if not defined
244 $contents = $svnrep->dirContents($path, @$rev); 243 $contents = $svnrep->dirContents($path, @$rev);
245   244  
246 // If there's no revision info, go to the lastest revision for this path 245 // If there's no revision info, go to the lastest revision for this path
247 $history = $svnrep->getLog($path, "", "", false); 246 $history = $svnrep->getLog($path, "", "", false);
248   247  
249 if (!empty($history->entries[0])) 248 if (!empty($history->entries[0]))
250 $youngest = $history->entries[0]->rev; 249 $youngest = $history->entries[0]->rev;
251 else 250 else
252 $youngest = -1; 251 $youngest = -1;
253   252  
254 // Unless otherwise specified, we get the log details of the latest change 253 // Unless otherwise specified, we get the log details of the latest change
255 if (empty($rev)) 254 if (empty($rev))
256 $logrev = $youngest; 255 $logrev = $youngest;
257 else 256 else
258 $logrev = $rev; 257 $logrev = $rev;
259   258  
260 if ($logrev != $youngest) 259 if ($logrev != $youngest)
261 { 260 {
262 $logEntry = $svnrep->getLog($path, $logrev, $logrev, false); 261 $logEntry = $svnrep->getLog($path, $logrev, $logrev, false);
263 $logEntry = $logEntry->entries[0]; 262 $logEntry = $logEntry->entries[0];
264 } 263 }
265 else 264 else
266 $logEntry = $history->entries[0]; 265 $logEntry = $history->entries[0];
267   266  
268 $headlog = $svnrep->getLog("/", "", "", true, 1); 267 $headlog = $svnrep->getLog("/", "", "", true, 1);
269 $headrev = $headlog->entries[0]->rev; 268 $headrev = $headlog->entries[0]->rev;
270   269  
271 // If we're not looking at a specific revision, get the HEAD revision number 270 // If we're not looking at a specific revision, get the HEAD revision number
272 // (the revision of the rest of the tree display) 271 // (the revision of the rest of the tree display)
273   272  
274 if (empty($rev)) 273 if (empty($rev))
275 { 274 {
276 $rev = $headrev; 275 $rev = $headrev;
277 } 276 }
278   277  
279 if ($path == "" || $path{0} != "/") 278 if ($path == "" || $path{0} != "/")
280 $ppath = "/".$path; 279 $ppath = "/".$path;
281 else 280 else
282 $ppath = $path; 281 $ppath = $path;
283   282  
284 $vars["repname"] = $rep->getDisplayName(); 283 $vars["repname"] = $rep->getDisplayName();
285   284  
286 $dirurl = $config->getURL($rep, $path, "dir"); 285 $dirurl = $config->getURL($rep, $path, "dir");
287 $logurl = $config->getURL($rep, $path, "log"); 286 $logurl = $config->getURL($rep, $path, "log");
288 $rssurl = $config->getURL($rep, $path, "rss"); 287 $rssurl = $config->getURL($rep, $path, "rss");
289 $dlurl = $config->getURL($rep, $path, "dl"); 288 $dlurl = $config->getURL($rep, $path, "dl");
290 $compurl = $config->getURL($rep, "/", "comp"); 289 $compurl = $config->getURL($rep, "/", "comp");
291   290  
292 if ($passrev != 0 && $passrev != $headrev && $youngest != -1) 291 if ($passrev != 0 && $passrev != $headrev && $youngest != -1)
293 $vars["goyoungestlink"] = "<a href=\"${dirurl}opt=dir&amp;sc=1\">${lang["GOYOUNGEST"]}</a>"; 292 $vars["goyoungestlink"] = "<a href=\"${dirurl}opt=dir&amp;sc=1\">${lang["GOYOUNGEST"]}</a>";
294 else 293 else
295 $vars["goyoungestlink"] = ""; 294 $vars["goyoungestlink"] = "";
296   295  
297 $bugtraq = new Bugtraq($rep, $svnrep, $ppath); 296 $bugtraq = new Bugtraq($rep, $svnrep, $ppath);
298   297  
299 $vars["action"] = ""; 298 $vars["action"] = "";
300 $vars["rev"] = $rev; 299 $vars["rev"] = $rev;
301 $vars["path"] = $ppath; 300 $vars["path"] = $ppath;
302 $vars["lastchangedrev"] = $logrev; 301 $vars["lastchangedrev"] = $logrev;
303 $vars["date"] = $logEntry->date; 302 $vars["date"] = $logEntry->date;
304 $vars["author"] = $logEntry->author; 303 $vars["author"] = $logEntry->author;
305 $vars["log"] = nl2br($bugtraq->replaceIDs(create_anchors($logEntry->msg))); 304 $vars["log"] = nl2br($bugtraq->replaceIDs(create_anchors($logEntry->msg)));
306   305  
307 if (!$showchanged) 306 if (!$showchanged)
308 { 307 {
309 $vars["showchangeslink"] = "<a href=\"${dirurl}rev=$passrev&amp;sc=1\">${lang["SHOWCHANGED"]}</a>"; 308 $vars["showchangeslink"] = "<a href=\"${dirurl}rev=$passrev&amp;sc=1\">${lang["SHOWCHANGED"]}</a>";
310 $vars["hidechangeslink"] = ""; 309 $vars["hidechangeslink"] = "";
311   310  
312 $vars["hidechanges"] = true; 311 $vars["hidechanges"] = true;
313 $vars["showchanges"] = false; 312 $vars["showchanges"] = false;
314 } 313 }
315 else 314 else
316 { 315 {
317 $vars["showchangeslink"] = ""; 316 $vars["showchangeslink"] = "";
318 317
319 $changes = $logEntry->mods; 318 $changes = $logEntry->mods;
320 319
321 $firstAdded = true; 320 $firstAdded = true;
322 $firstModded = true; 321 $firstModded = true;
323 $firstDeleted = true; 322 $firstDeleted = true;
324   323  
325 $vars["newfilesbr"] = ""; 324 $vars["newfilesbr"] = "";
326 $vars["newfiles"] = ""; 325 $vars["newfiles"] = "";
327 $vars["changedfilesbr"] = ""; 326 $vars["changedfilesbr"] = "";
328 $vars["changedfiles"] = ""; 327 $vars["changedfiles"] = "";
329 $vars["deletedfilesbr"] = ""; 328 $vars["deletedfilesbr"] = "";
330 $vars["deletedfiles"] = ""; 329 $vars["deletedfiles"] = "";
331   330  
332 foreach ($changes as $file) 331 foreach ($changes as $file)
333 { 332 {
334 switch ($file->action) 333 switch ($file->action)
335 { 334 {
336 case "A": 335 case "A":
337 if (!$firstAdded) $vars["newfilesbr"] .= "<br />"; 336 if (!$firstAdded) $vars["newfilesbr"] .= "<br />";
338 $firstAdded = false; 337 $firstAdded = false;
339 $vars["newfilesbr"] .= fileLink("", $file->path); 338 $vars["newfilesbr"] .= fileLink("", $file->path);
340 $vars["newfiles"] .= " ".fileLink("", $file->path); 339 $vars["newfiles"] .= " ".fileLink("", $file->path);
341 break; 340 break;
342 341
343 case "M": 342 case "M":
344 if (!$firstModded) $vars["changedfilesbr"] .= "<br />"; 343 if (!$firstModded) $vars["changedfilesbr"] .= "<br />";
345 $firstModded = false; 344 $firstModded = false;
346 $vars["changedfilesbr"] .= fileLink("", $file->path); 345 $vars["changedfilesbr"] .= fileLink("", $file->path);
347 $vars["changedfiles"] .= " ".fileLink("", $file->path); 346 $vars["changedfiles"] .= " ".fileLink("", $file->path);
348 break; 347 break;
349   348  
350 case "D": 349 case "D":
351 if (!$firstDeleted) $vars["deletedfilesbr"] .= "<br />"; 350 if (!$firstDeleted) $vars["deletedfilesbr"] .= "<br />";
352 $firstDeleted = false; 351 $firstDeleted = false;
353 $vars["deletedfilesbr"] .= $file->path; 352 $vars["deletedfilesbr"] .= $file->path;
354 $vars["deletedfiles"] .= " ".$file->path; 353 $vars["deletedfiles"] .= " ".$file->path;
355 break; 354 break;
356 } 355 }
357 } 356 }
358 357
359 $vars["hidechangeslink"] = "<a href=\"${dirurl}rev=$passrev&amp;sc=0\">${lang["HIDECHANGED"]}</a>"; 358 $vars["hidechangeslink"] = "<a href=\"${dirurl}rev=$passrev&amp;sc=0\">${lang["HIDECHANGED"]}</a>";
360 359
361 $vars["hidechanges"] = false; 360 $vars["hidechanges"] = false;
362 $vars["showchanges"] = true; 361 $vars["showchanges"] = true;
363 } 362 }
364   363  
365 createDirLinks($rep, $ppath, $passrev, $showchanged); 364 createDirLinks($rep, $ppath, $passrev, $showchanged);
366 $vars["curdirloglink"] = "<a href=\"${logurl}rev=$passrev&amp;sc=$showchanged&amp;isdir=1\">${lang["VIEWLOG"]}</a>"; 365 $vars["curdirloglink"] = "<a href=\"${logurl}rev=$passrev&amp;sc=$showchanged&amp;isdir=1\">${lang["VIEWLOG"]}</a>";
367   366  
368 if ($rev != $headrev) 367 if ($rev != $headrev)
369 { 368 {
370 $history = $svnrep->getLog($path, $rev, "", false); 369 $history = $svnrep->getLog($path, $rev, "", false);
371 } 370 }
372   371  
373 if (isset($history->entries[1]->rev)) 372 if (isset($history->entries[1]->rev))
374 { 373 {
375 $vars["curdircomplink"] = "<a href=\"${compurl}compare%5B%5D=". 374 $vars["curdircomplink"] = "<a href=\"${compurl}compare[]=".
376 urlencode($history->entries[1]->path)."@".$history->entries[1]->rev. 375 urlencode($history->entries[1]->path)."@".$history->entries[1]->rev.
377 "&amp;compare%5B%5D=".urlencode($history->entries[0]->path)."@".$history->entries[0]->rev. 376 "&amp;compare[]=".urlencode($history->entries[0]->path)."@".$history->entries[0]->rev.
378 "\">${lang["DIFFPREV"]}</a>"; 377 "\">${lang["DIFFPREV"]}</a>";
379 } 378 }
380 else 379 else
381 { 380 {
382 $vars["curdircomplink"] = ""; 381 $vars["curdircomplink"] = "";
383 } 382 }
384   383  
385 if ($rep->getHideRss()) 384 if ($rep->getHideRss())
386 { 385 {
387 $vars["curdirrsslink"] = "<a href=\"${rssurl}rev=$passrev&amp;sc=$showchanged&amp;isdir=1\">${lang["RSSFEED"]}</a>"; 386 $vars["curdirrsslink"] = "<a href=\"${rssurl}rev=$passrev&amp;sc=$showchanged&amp;isdir=1\">${lang["RSSFEED"]}</a>";
388 $vars["curdirrsshref"] = "${rssurl}rev=$passrev&amp;sc=$showchanged&amp;isdir=1"; 387 $vars["curdirrsshref"] = "${rssurl}rev=$passrev&amp;sc=$showchanged&amp;isdir=1";
389 $vars["curdirrssanchor"] = "<a href=\"${rssurl}rev=$passrev&amp;sc=$showchanged&amp;isdir=1\">"; 388 $vars["curdirrssanchor"] = "<a href=\"${rssurl}rev=$passrev&amp;sc=$showchanged&amp;isdir=1\">";
390 } 389 }
391   390  
392 // Set up the tarball link 391 // Set up the tarball link
393   392  
394 $subs = explode("/", $path); 393 $subs = explode("/", $path);
395 $level = count($subs) - 2; 394 $level = count($subs) - 2;
396 if ($rep->isDownloadAllowed($path)) 395 if ($rep->isDownloadAllowed($path))
397 $vars["curdirdllink"] = "<a href=\"${dlurl}rev=$passrev&amp;isdir=1\">${lang["TARBALL"]}</a>"; 396 $vars["curdirdllink"] = "<a href=\"${dlurl}rev=$passrev&amp;isdir=1\">${lang["TARBALL"]}</a>";
398 else 397 else
399 $vars["curdirdllink"] = ""; 398 $vars["curdirdllink"] = "";
400 399
401 $url = $config->getURL($rep, "/", "comp"); 400 $url = $config->getURL($rep, "/", "comp");
402   401  
403 $vars["compare_form"] = "<form action=\"$url\" method=\"post\" name=\"compareform\">"; 402 $vars["compare_form"] = "<form action=\"$url\" method=\"post\" name=\"compareform\">";
404 $vars["compare_submit"] = "<input name=\"comparesubmit\" type=\"submit\" value=\"${lang["COMPAREPATHS"]}\" />"; 403 $vars["compare_submit"] = "<input name=\"comparesubmit\" type=\"submit\" value=\"${lang["COMPAREPATHS"]}\" />";
405 $vars["compare_endform"] = "<input type=\"hidden\" name=\"op\" value=\"comp\" /><input type=\"hidden\" name=\"sc\" value=\"$showchanged\" /></form>"; 404 $vars["compare_endform"] = "<input type=\"hidden\" name=\"op\" value=\"comp\" /><input type=\"hidden\" name=\"sc\" value=\"$showchanged\" /></form>";
406   405  
407 $listing = array(); 406 $listing = array();
408 $listing = showTreeDir($svnrep, $path, $rev, $listing); 407 $listing = showTreeDir($svnrep, $path, $rev, $listing);
409   408  
410 $vars["version"] = $version; 409 $vars["version"] = $version;
411   410  
412 if (!$rep->hasReadAccess($path, true)) 411 if (!$rep->hasReadAccess($path, true))
413 $vars["noaccess"] = true; 412 $vars["noaccess"] = true;
414   413  
415 if (!$rep->hasReadAccess($path, false)) 414 if (!$rep->hasReadAccess($path, false))
416 $vars["restricted"] = true; 415 $vars["restricted"] = true;
417   416  
418 parseTemplate($rep->getTemplatePath()."header.tmpl", $vars, $listing); 417 parseTemplate($rep->getTemplatePath()."header.tmpl", $vars, $listing);
419 parseTemplate($rep->getTemplatePath()."directory.tmpl", $vars, $listing); 418 parseTemplate($rep->getTemplatePath()."directory.tmpl", $vars, $listing);
420 parseTemplate($rep->getTemplatePath()."footer.tmpl", $vars, $listing); 419 parseTemplate($rep->getTemplatePath()."footer.tmpl", $vars, $listing);
421   420  
422 ?> 421 ?>