Rev 185 Rev 1189
Line 81... Line 81...
81 } 81 }
82   82  
83 return $url; 83 return $url;
84 } 84 }
85   85  
-   86 function fileLinkGetFile($path, $file)
-   87 {
-   88 global $rep, $passrev, $showchanged, $config;
-   89  
-   90 if ($path == "" || $path{0} != "/")
-   91 $ppath = "/".$path;
-   92 else
-   93 $ppath = $path;
-   94  
-   95 if ($ppath{strlen($ppath)-1} != "/")
-   96 $ppath .= "/";
-   97  
-   98 if ($file{0} == "/")
-   99 $pfile = substr($file, 1);
-   100 else
-   101 $pfile = $file;
-   102  
-   103 $isDir = $pfile{strlen($pfile) - 1} == "/";
-   104  
-   105 if (!$isDir)
-   106 {
-   107 $url = $config->getURL($rep, $ppath.$pfile, "file");
-   108 $url = removeURLSeparator($url);
-   109 $url = "<a href=\"${url}&getfile\">Get</a>";
-   110 }
-   111  
-   112 return $url;
-   113 }
-   114  
86 function showDirFiles($svnrep, $subs, $level, $limit, $rev, $listing, $index, $treeview = true) 115 function showDirFiles($svnrep, $subs, $level, $limit, $rev, $listing, $index, $treeview = true)
87 { 116 {
88 global $rep, $passrev, $showchanged, $config, $lang; 117 global $rep, $passrev, $showchanged, $config, $lang;
89   118  
90 $path = ""; 119 $path = "";
91   120  
-   121 // Explicitly requested file as attachment
-   122 if (isset($_REQUEST['getfile']))
-   123 {
-   124 $base = basename($path);
-   125  
-   126 header("Content-Type: application/octet-stream");
-   127 header("Content-Length: $size");
-   128 header("Content-Disposition: inline; filename=".urlencode($base));
-   129  
-   130 $svnrep->getFileContents($path, "", $rev);
-   131  
-   132 exit;
-   133 }
-   134  
92 if (!$treeview) 135 if (!$treeview)
93 $level = $limit; 136 $level = $limit;
94   137  
95 for ($n = 0; $n <= $level; $n++) 138 for ($n = 0; $n <= $level; $n++)
96 { 139 {
Line 114... Line 157...
114 { 157 {
115 if ($rep->hasReadAccess($path.$file, true)) 158 if ($rep->hasReadAccess($path.$file, true))
116 { 159 {
117 $access = true; 160 $access = true;
118 $openDir = (!strcmp($subs[$level+1]."/", $file) || !strcmp($subs[$level+1], $file)); 161 $openDir = (!strcmp($subs[$level+1]."/", $file) || !strcmp($subs[$level+1], $file));
119 162  
120 if ($openDir) 163 if ($openDir)
121 $listing[$index]["filetype"] = "diropen"; 164 $listing[$index]["filetype"] = "diropen";
122 else 165 else
123 $listing[$index]["filetype"] = "dir"; 166 $listing[$index]["filetype"] = "dir";
124   167  
Line 144... Line 187...
144 187
145 $listing[$index]["fileviewdllink"] = "&nbsp;"; 188 $listing[$index]["fileviewdllink"] = "&nbsp;";
146 $listing[$index]["filetype"] = strrchr($file, "."); 189 $listing[$index]["filetype"] = strrchr($file, ".");
147 } 190 }
148 } 191 }
149 192  
150 if ($access) 193 if ($access)
151 { 194 {
152 $listing[$index]["rowparity"] = ($index % 2)?"1":"0"; 195 $listing[$index]["rowparity"] = ($index % 2)?"L1":"L0";
153 196
154 if ($treeview) 197 if ($treeview)
155 $listing[$index]["compare_box"] = "<input type=\"checkbox\" name=\"compare[]\" value=\"".fileLink($path, $file, true)."@$passrev\" onclick=\"checkCB(this)\" />"; 198 $listing[$index]["compare_box"] = "<input type=\"checkbox\" name=\"compare[]\" value=\"".fileLink($path, $file, true)."@$passrev\" onclick=\"checkCB(this)\" />";
156 else 199 else
157 $listing[$index]["compare_box"] = ""; 200 $listing[$index]["compare_box"] = "";
158 201  
159 if ($openDir) 202 if ($openDir)
160 $listing[$index]["filelink"] = "<b>".fileLink($path, $file)."</b>"; 203 $listing[$index]["filelink"] = "<b>".fileLink($path, $file)."</b>";
161 else 204 else
162 $listing[$index]["filelink"] = fileLink($path, $file); 205 $listing[$index]["filelink"] = fileLink($path, $file);
-   206  
-   207 if ($isDir)
-   208 $listing[$index]["filelinkgetfile"] = "";
-   209 else
-   210 $listing[$index]["filelinkgetfile"] = fileLinkGetFile($path, $file);
163 211  
164 // The history command doesn't return with a trailing slash. We need to remember here if the 212 // The history command doesn't return with a trailing slash. We need to remember here if the
165 // file is a directory or not! 213 // file is a directory or not!
166 214  
167 $listing[$index]["isDir"] = $isDir; 215 $listing[$index]["isDir"] = $isDir;
168 216  
169 if ($treeview) 217 if ($treeview)
170 $listing[$index]["level"] = $level; 218 $listing[$index]["level"] = $level;
171 else 219 else
172 $listing[$index]["level"] = 0; 220 $listing[$index]["level"] = 0;
173   221  
174 $listing[$index]["node"] = 0; // t-node 222 $listing[$index]["node"] = 0; // t-node
175 223  
176 $fileurl = $config->getURL($rep, $path.$file, "log"); 224 $fileurl = $config->getURL($rep, $path.$file, "log");
177 $listing[$index]["fileviewloglink"] = "<a href=\"${fileurl}rev=$passrev&amp;sc=$showchanged&amp;isdir=$isDir\">${lang["VIEWLOG"]}</a>"; 225 $listing[$index]["fileviewloglink"] = "<a href=\"${fileurl}rev=$passrev&amp;sc=$showchanged&amp;isdir=$isDir\">${lang["VIEWLOG"]}</a>";
178 226  
179 $rssurl = $config->getURL($rep, $path.$file, "rss"); 227 $rssurl = $config->getURL($rep, $path.$file, "rss");
180 if ($rep->getHideRss()) 228 if ($rep->getHideRss())
181 { 229 {
182 $listing[$index]["rsslink"] = "<a href=\"${rssurl}rev=$passrev&amp;sc=$showchanged&amp;isdir=$isDir\">${lang["RSSFEED"]}</a>"; 230 $listing[$index]["rsslink"] = "<a href=\"${rssurl}rev=$passrev&amp;sc=$showchanged&amp;isdir=$isDir\">${lang["RSSFEED"]}</a>";
183 $listing[$index]["rssanchor"] = "<a href=\"${rssurl}rev=$passrev&amp;sc=$showchanged&amp;isdir=$isDir\">"; 231 $listing[$index]["rssanchor"] = "<a href=\"${rssurl}rev=$passrev&amp;sc=$showchanged&amp;isdir=$isDir\">";
184 } 232 }
185 233  
186 $index++; 234 $index++;
187 $loop++; 235 $loop++;
188 $last_index = $index; 236 $last_index = $index;
189 237  
190 if (($level != $limit) && ($isDir)) 238 if (($level != $limit) && ($isDir))
191 { 239 {
192 if (!strcmp($subs[$level + 1]."/", $file)) 240 if (!strcmp($subs[$level + 1]."/", $file))
193 { 241 {
194 $listing = showDirFiles($svnrep, $subs, $level + 1, $limit, $rev, $listing, $index); 242 $listing = showDirFiles($svnrep, $subs, $level + 1, $limit, $rev, $listing, $index);
195 $index = count($listing); 243 $index = count($listing);
196 } 244 }
197 } 245 }
198   246  
199 } 247 }
200 } 248 }
201   249  
202 if ($last_index != 0 && $treeview) 250 if ($last_index != 0 && $treeview)
Line 336... Line 384...
336 if (!$firstAdded) $vars["newfilesbr"] .= "<br />"; 384 if (!$firstAdded) $vars["newfilesbr"] .= "<br />";
337 $firstAdded = false; 385 $firstAdded = false;
338 $vars["newfilesbr"] .= fileLink("", $file->path); 386 $vars["newfilesbr"] .= fileLink("", $file->path);
339 $vars["newfiles"] .= " ".fileLink("", $file->path); 387 $vars["newfiles"] .= " ".fileLink("", $file->path);
340 break; 388 break;
341 -  
-   389  
342 case "M": 390 case "M":
343 if (!$firstModded) $vars["changedfilesbr"] .= "<br />"; 391 if (!$firstModded) $vars["changedfilesbr"] .= "<br />";
344 $firstModded = false; 392 $firstModded = false;
345 $vars["changedfilesbr"] .= fileLink("", $file->path); 393 $vars["changedfilesbr"] .= fileLink("", $file->path);
346 $vars["changedfiles"] .= " ".fileLink("", $file->path); 394 $vars["changedfiles"] .= " ".fileLink("", $file->path);
Line 352... Line 400...
352 $vars["deletedfilesbr"] .= $file->path; 400 $vars["deletedfilesbr"] .= $file->path;
353 $vars["deletedfiles"] .= " ".$file->path; 401 $vars["deletedfiles"] .= " ".$file->path;
354 break; 402 break;
355 } 403 }
356 } 404 }
357 405  
358 $vars["hidechangeslink"] = "<a href=\"${dirurl}rev=$passrev&amp;sc=0\">${lang["HIDECHANGED"]}</a>"; 406 $vars["hidechangeslink"] = "<a href=\"${dirurl}rev=$passrev&amp;sc=0\">${lang["HIDECHANGED"]}</a>";
359 407  
360 $vars["hidechanges"] = false; 408 $vars["hidechanges"] = false;
361 $vars["showchanges"] = true; 409 $vars["showchanges"] = true;
362 } 410 }
363   411  
364 createDirLinks($rep, $ppath, $passrev, $showchanged); 412 createDirLinks($rep, $ppath, $passrev, $showchanged);
Line 369... Line 417...
369 $history = $svnrep->getLog($path, $rev, "", false); 417 $history = $svnrep->getLog($path, $rev, "", false);
370 } 418 }
371   419  
372 if (isset($history->entries[1]->rev)) 420 if (isset($history->entries[1]->rev))
373 { 421 {
374 $vars["curdircomplink"] = "<a href=\"${compurl}compare[]=". 422 $vars["curdircomplink"] = "<a href=\"${compurl}compare[]=".
375 urlencode($history->entries[1]->path)."@".$history->entries[1]->rev. 423 urlencode($history->entries[1]->path)."@".$history->entries[1]->rev.
376 "&amp;compare[]=".urlencode($history->entries[0]->path)."@".$history->entries[0]->rev. 424 "&amp;compare[]=".urlencode($history->entries[0]->path)."@".$history->entries[0]->rev.
377 "\">${lang["DIFFPREV"]}</a>"; 425 "\">${lang["DIFFPREV"]}</a>";
378 } 426 }
379 else 427 else
380 { 428 {
381 $vars["curdircomplink"] = ""; 429 $vars["curdircomplink"] = "";
382 } 430 }
383   431  
384 if ($rep->getHideRss()) 432 if ($rep->getHideRss())
385 { 433 {
386 $vars["curdirrsslink"] = "<a href=\"${rssurl}rev=$passrev&amp;sc=$showchanged&amp;isdir=1\">${lang["RSSFEED"]}</a>"; 434 $vars["curdirrsslink"] = "<a href=\"${rssurl}rev=$passrev&amp;sc=$showchanged&amp;isdir=1\">${lang["RSSFEED"]}</a>";