Alternc  3.2
Alternc logiel libre pour l'hébergement
 All Data Structures Namespaces Files Functions Variables Pages
bro_main.php
Go to the documentation of this file.
1 <?php
2 /*
3  $Id: bro_main.php,v 1.11 2004/09/06 18:14:36 anonymous Exp $
4  ----------------------------------------------------------------------
5  AlternC - Web Hosting System
6  Copyright (C) 2002 by the AlternC Development Team.
7  http://alternc.org/
8  ----------------------------------------------------------------------
9  Based on:
10  Valentin Lacambre's web hosting softwares: http://altern.org/
11  ----------------------------------------------------------------------
12  LICENSE
13 
14  This program is free software; you can redistribute it and/or
15  modify it under the terms of the GNU General Public License (GPL)
16  as published by the Free Software Foundation; either version 2
17  of the License, or (at your option) any later version.
18 
19  This program is distributed in the hope that it will be useful,
20  but WITHOUT ANY WARRANTY; without even the implied warranty of
21  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  GNU General Public License for more details.
23 
24  To read the license please visit http://www.gnu.org/copyleft/gpl.html
25  ----------------------------------------------------------------------
26  Original Author of file: Benjamin Sonntag, Remi
27  Purpose of file: Online file Browser of AlternC
28  TODO : Voir ??? + D�placer / Copier
29  ----------------------------------------------------------------------
30  */
31 require_once("../class/config.php");
32 include_once ("head.php");
33 
34 $fields = array (
35  "R" => array ("request", "string", ""),
36  "o" => array ("request", "array", ""),
37  "d" => array ("request", "array", ""),
38  "perm" => array ("post", "array", array()),
39  "formu" => array ("request", "integer", ""),
40  "actextract" => array ("request", "string", ""),
41  "fileextract" => array ("request", "string", ""),
42  "actperms" => array ("request", "string", ""),
43  "actdel" => array ("request", "string", ""),
44  "actcopy" => array ("request", "string", ""),
45  "actrename" => array ("request", "string", ""),
46  "actmove" => array ("request", "string", ""),
47  "actmoveto" => array ("request", "string", ""),
48  "nomfich" => array ("request", "string", ""),
49  "del_confirm" => array ("request", "string", ""),
50  "cancel" => array ("request", "string", ""),
51  "showdirsize" => array ("request", "integer", "0"),
52  "nomfich" => array ("request", "string", ""),
53  );
55 
56 $p=$bro->GetPrefs();
57 if (! isset($R)) $R='';
58 if (!$R && $p["golastdir"]) {
59  $R=$p["lastdir"];
60 }
61 $R=$bro->convertabsolute($R,1);
62 // on fait ?
63 if (!empty($formu) && $formu) {
64  switch ($formu) {
65  case 1: // Cr�er le r�pertoire $R.$nomfich
66  if (!$bro->CreateDir($R,$nomfich)) {
67  $error = $err->errstr();
68  }
69  $p=$bro->GetPrefs();
70  break;
71  case 6: // Cr�er le fichier $R.$nomfich
72  if (!$bro->CreateFile($R,$nomfich)) {
73  $error = $err->errstr();
74  }
75  $p=$bro->GetPrefs();
76  if ($p["createfile"]==1) {
77  $editfile=$nomfich;
78  include("bro_editor.php");
79  exit();
80  }
81  break;
82  case 2: // act vaut Supprimer Copier ou Renommer.
83  if ($actdel) {
84  if (!empty($del_confirm) ) {
85  if (!$bro->DeleteFile($d,$R)) {
86  $error = $err->errstr();
87  }
88  } elseif (empty($cancel) && is_array($d)) {
89  include_once("head.php");
90  ?>
91  <h3><?php printf(_("Deleting files and/or directories")); ?> : </h3>
92  <form action="bro_main.php" method="post" name="main" id="main">
93  <input type="hidden" name="formu" value="2" />
94  <input type="hidden" name="actdel" value="1" />
95  <input type="hidden" name="R" value="<?php echo ehe($R)?>" />
96  <p class="alert alert-warning"><?php __("WARNING: Confirm the deletion of this files"); ?></p>
97  <h2><?php echo $mem->user["login"].$R."/"; ?></h2>
98  <ul>
99  <?php foreach($d as $editfile){ ?>
100  <li> <?php echo stripslashes($editfile); ?></li>
101  <input type="hidden" name="d[]" value="<?php echo htmlentities(stripslashes($editfile)); ?>" />
102  <?php } ?>
103  </ul>
104  <blockquote>
105  <input type="submit" class="inb ok" name="del_confirm" value="<?php __("Yes, delete those files/folders"); ?>" />&nbsp;&nbsp;
106  <input type="submit" class="inb cancel" name="cancel" value="<?php __("No, don't delete those files/folders"); ?>" />
107  </blockquote>
108  </form>
109  <?php
110  include_once("foot.php");
111  exit();
112  }
113  }
114  if ($actcopy) {
115  if (!$bro->CopyFile($d,$R,$actmoveto)) {
116  $error = $err->errstr();
117  }
118  }
119  if ($actmove) {
120  if (!$bro->MoveFile($d,$R,$actmoveto)) {
121  $error = $err->errstr();
122  }
123  }
124  break;
125  case 4: // Renommage Effectif...
126  if (!$bro->RenameFile($R,$o,$d)) { // Rename $R (directory) $o (old) $d (new) names
127  $error = $err->errstr();
128  }
129  break;
130  case 3: // Upload de fichier...
131  if (!$bro->UploadFile($R)) {
132  $error = $err->errstr();
133  }
134  break;
135  case 7: // Changement de permissions [ML]
136  if (!@$bro->ChangePermissions($R, $d, $perm)) {
137  $error = $err->errstr();
138  }
139  break;
140  }
141 }
142 
143 if (isset($actextract) && $actextract) {
144  print _("extracting...")."<br />\n"; flush();
145  if ($bro->ExtractFile($R. '/' . $fileextract, $R)) {
146  echo "<p class=\"alert alert-danger\">";
147  print $err->errstr();
148  print _("failed")."<br />\n";
149  echo "</p>";
150  } else {
151  print _("done")."<br />\n";
152  }
153 }
154 
155 ?>
156 <h3><?php __("File browser"); ?></h3>
157 <table border="0" width="100%" cellspacing="0">
158 <tr><td>
159 
160 <hr />
161 
162 <p class="breadcrumb">
163 <?php __("Path"); ?> / <a href="bro_main.php?R=/"><?php echo $mem->user["login"]; ?></a>&nbsp;/&nbsp;<?php echo $bro->PathList($R,"bro_main.php") ?>
164 </p>
165 
166 <?php
167 /* Creation de la liste des fichiers courants */
168 $c=$bro->filelist($R, $showdirsize );
169 if ($c===false) {
170  echo "<p class=\"alert alert-danger\">".$err->errstr()."</p>";
171  require_once('foot.php');
172  exit;
173 }
174 
175 if (isset($error) && $error) echo "<p class=\"alert alert-danger\">$error</p>";
176 ?>
177 
178 <table><tr>
179 <td class="formcell">
180 
181 <form action="bro_main.php" enctype="multipart/form-data" method="post">
182 <input type="hidden" name="R" value="<?php echo $R; ?>" />
183 <input type="hidden" name="formu" value="3" />
184 
185 <?php __("Send one file:"); ?><br />
186 <input class="int" name="userfile" type="file" />
187 <br />
188 <input type="submit" id="sendthisfile" class="ina" value="<?php __("Send this file"); ?>" />
189 <?php echo sprintf(_("Warning: max size: %s"),$bro->getMaxAllowedUploadSize() ); ?>
190 </form>
191 
192 </td>
193 <td style="width: 20px">&nbsp;</td>
194 <td class="formcell">
195 
196 <?php __("New file or folder:"); ?><br />
197 <form action="bro_main.php" method="post" name="nn" id="nn">
198 <input type="hidden" name="R" value="<?php echo $R; ?>" />
199 <table><tr>
200 <td><input type="text" class="int" name="nomfich" id="nomfich" size="22" maxlength="255" /></td>
201 <td><input type="submit" class="ina" value="<?php __("Create"); ?>" /></td>
202 </tr><tr><td>
203 <input type="radio" class="inc" id="nfile" onclick="document.nn.nomfich.focus();" name="formu" value="6" <?php if (!$p["crff"]) echo "checked=\"checked\""; ?> /><label for="nfile">&nbsp;<?php __("File"); ?></label>
204 <input type="radio" class="inc" id="nfold" onclick="document.nn.nomfich.focus();" name="formu" value="1" <?php if ($p["crff"]) echo "checked=\"checked\""; ?> /><label for="nfold">&nbsp;<?php __("Folder"); ?></label>
205 </td><td></td></tr></table>
206 </form>
207 </td></tr>
208 </table>
209 
210 
211 </td></tr>
212 <tr><td valign="top">
213 
214 <?php
215 /* Renommer / Copier / D�placer les fichiers : */
216 if (isset($formu) && $formu==2 && isset($actrename) && $actrename && count($d)) {
217  echo "<table cellpadding=\"6\">\n";
218  echo "<form action=\"bro_main.php\" method=\"post\">\n";
219  echo "<input type=\"hidden\" name=\"R\" value=\"$R\" />\n";
220  echo "<input type=\"hidden\" name=\"formu\" value=\"4\" />\n";
221  echo "<tr><th colspan=\"2\">"._("Rename")."</th></tr>";
222  for ($i=0;$i<count($d);$i++) {
223  $d[$i]=ssla($d[$i]);
224  echo "<tr><td><input type=\"hidden\" name=\"o[$i]\" value=\"".$d[$i]."\" />".$d[$i]."</td>";
225  echo "<td><input type=\"text\" class=\"int\" name=\"d[$i]\" value=\"".$d[$i]."\" /></td></tr>";
226  }
227  echo "<tr><td colspan=\"2\" align=\"center\"><input type=\"submit\" class=\"inb\" name=\"submit\" value=\""._("Rename")."\" /></td></tr>";
228  echo "</table></form>\n";
229  echo "<hr />\n";
230 }
231 
232 /* [ML] Changer les permissions : */
233 if ($formu==2 && ! (empty($actperms)) && count($d)) {
234  echo "<form action=\"bro_main.php\" method=\"post\">\n";
235  echo "<input type=\"hidden\" name=\"R\" value=\"$R\" />\n";
236  echo "<input type=\"hidden\" name=\"formu\" value=\"7\" />\n";
237  echo "<p>"._("Permissions")."</p>";
238 
239  $tmp_absdir = $bro->convertabsolute($R,0);
240 
241  echo "<table border=\"1\" cellpadding=\"4\" cellspacing=\"0\">";
242  echo "<tr>";
243  echo "<th>" . _("File") . "</th><th>"._("Permissions")."</th>";
244  echo "</tr>";
245 
246  for ($i=0;$i<count($d);$i++) {
247  $d[$i]=ssla($d[$i]);
248  $stats = stat($tmp_absdir . '/' . $d[$i]);
249  $modes = $stats[2];
250 
251  echo "<tr>";
252  echo "<td>".$d[$i]."</td>";
253 
254  // Owner
255  echo "<td>";
256  echo "<input type=\"hidden\" name=\"d[$i]\" value=\"".$d[$i]."\" />";
257  echo "<label for=\"permw$i\">"._("write")."</label> <input type=\"checkbox\" id=\"permw$i\" name=\"perm[$i][w]\" value=\"1\" ". (($modes & 0000200) ? 'checked="checked"' : '') ." />";
258  echo "</td>";
259 
260  echo "</tr>";
261  }
262 
263  echo "</table>";
264 
265  echo "<p><input type=\"submit\" class=\"inb\" name=\"submit\" value=\""._("Change permissions")."\" /></p>";
266  echo "</form>\n";
267  echo "<hr />\n";
268 }
269 
270 /* We draw the file list and button bar only if there is files here ! */
271 if (count($c)) {
272 
273  ?>
274  <form action="bro_main.php" method="post" name="main" id="main">
275  <input type="hidden" name="R" value="<?php echo $R; ?>" />
276  <input type="hidden" name="formu" value="2" />
277 
278  <br />
279 
280 
281  <table width="100%" style="border: 0px">
282  <tr><td class="" style="padding: 4px 4px 8px 4px">
283 
284  <input type="submit" class="ina" name="actdel" value="<?php __("Delete"); ?>" />
285  <input type="submit" class="ina" name="actrename" value="<?php __("Rename"); ?>" />
286  <input type="submit" class="ina" name="actperms" value="<?php __("Permissions"); ?>" />
287  &nbsp; |&nbsp;
288  <input type="submit" class="ina" name="actcopy" value="<?php __("Copy"); ?>" onClick=" return actmoveto_not_empty();"/>
289  <input type="submit" class="ina" name="actmove" value="<?php __("Move"); ?>" onClick=" return actmoveto_not_empty();"/>
290  <?php __("To"); ?>
291  <input type="text" class="int" id='actmoveto' name="actmoveto" value="" />
292  <?php display_browser( "" , "main.actmoveto" ); ?>
293 
294  </td></tr>
295 
296  </table>
297 
298 <script type="text/javascript">
299 function actmoveto_not_empty() {
300  if ( $('#actmoveto').val() =='' ) {
301  alert("<?php __("Please select a destination folder");?>");
302  return false;
303  }
304  return true;
305 }
306 </script>
307 
308 
309 
310  <?php
311  switch ($p["listmode"]) {
312  case 0:
313  /* AFFICHE 1 COLONNE DETAILLEE */
314  reset($c);
315  echo "<table width=\"100%\" id='tab_files_w_details' class=\"tlist\" style=\"border: 0px\" cellpadding=\"2\" cellspacing=\"0\"><thead>";
316  ?>
317  <tr><th>
318  <script type="text/javascript">
319  <!--
320  document.write("<input type=\"checkbox\" id=\"checkall\" value=\"1\" class=\"inb\" onclick=\"CheckAll();\" />");
321  // -->
322  </script>
323  </th>
324  <?php if ($p["showicons"]) { ?>
325  <th style="text-align: center;"><?php if (!empty($R)) { echo $bro->PathList($R,"bro_main.php",true); }?></th>
326  <?php } ?>
327  <th><?php __("Filename"); ?></th>
328  <th><?php __("Size"); ?></th>
329  <th><?php __("Last modification"); ?></th>
330  <?php if ($p["showtype"]) { ?>
331  <th><?php __("File Type"); ?></th>
332  <?php } ?>
333  <th></th>
334  </tr></thead><tbody>
335  <?php
336 
337  for($i=0;$i<count($c);$i++) {
338  echo "<tr class=\"lst\">\n";
339  if ($c[$i]["type"]) {
340  echo " <td width=\"28\"><input type=\"checkbox\" class=\"inc\" name=\"d[]\" value=\"".htmlentities($c[$i]["name"])."\" /></td>";
341  if ($p["showicons"]) {
342  echo "<td style='text-align: center;' width=\"28\"><img src=\"icon/".$bro->icon($c[$i]["name"])."\" width=\"16\" height=\"16\" alt=\"\" /></td>";
343  }
344  echo "<td><a href=\"";
345  $canedit = $bro->can_edit($R,$c[$i]["name"]);
346  if ($canedit) {
347  echo "bro_editor.php?editfile=".urlencode($c[$i]["name"])."&amp;R=".urlencode($R);
348  } else {
349  echo "bro_downloadfile.php?dir=".urlencode($R)."&amp;file=".urlencode($c[$i]["name"]);
350  }
351  echo "\">"; ehe($c[$i]["name"]);
352  echo"</a></td>\n";
353  echo " <td>".format_size($c[$i]["size"])."</td>";
354  echo "<td>".format_date(_('%3$d-%2$d-%1$d %4$d:%5$d'),date("Y-m-d H:i:s",$c[$i]["date"]))."<br /></td>";
355  if ($p["showtype"]) {
356  echo "<td>"._($bro->mime($c[$i]["name"]))."</td>";
357  }
358  $vu=$bro->viewurl($R,$c[$i]["name"]);
359  if ($vu) {
360  echo "<td><a href=\"$vu\">"._("View")."</a>";
361  } else {
362  echo "<td>&nbsp;";
363  }
364  $e = $bro->is_extractable($R,$c[$i]["name"]);
365  if ($e) {
366  echo " <a href=\"bro_main.php?actextract=1&amp;fileextract=".urlencode($c[$i]["name"])."&amp;R=".urlencode($R)."\">";
367  echo _("Extract");
368  echo "</a>";
369  }
370  $ez = $bro->is_sqlfile($R,$c[$i]["name"]);
371  if ($ez) {
372  echo " <a href=\"javascript:;\" onClick=\"$('#rest_db_$i').toggle();\">";
373  echo _("Restore SQL");
374  echo "</a>";
375  echo "<div id='rest_db_$i' style='display:none;'><fieldset><legend>"._("Restore SQL")."</legend>"._("In which database to you want to restore this dump?");
376  echo "<br/>";
377  echo "<input type='hidden' name ='filename' value='".htmlentities($R."/".$c[$i]["name"])."' />";
378  $dbl=array(); foreach ($mysql->get_dblist() as $v) { $dbl[]=$v['db'];}
379  echo "<select id='db_name_$i'>"; eoption($dbl,'',true); echo "</select>" ;
380  echo "<a href='javascript:;' onClick='window.location=\"sql_restore.php?filename=".urlencode($R."/".$c[$i]["name"])."&amp;id=\"+encodeURIComponent($(\"#db_name_$i\").val()) ;'>"._("Restore it")."</a>";
381  echo "</fieldset></div>";
382  }
383 
384  echo "</td>\n";
385  } else { // DOSSIER :
386  echo " <td width=\"28\"><input type=\"checkbox\" class=\"inc\" name=\"d[]\" value=\"".htmlentities($c[$i]["name"])."\" /></td>";
387  if ($p["showicons"]) {
388  echo "<td width=\"28\" style='text-align: center;'><img src=\"icon/folder.png\" width=\"16\" height=\"16\" alt=\"\" /></td>";
389  }
390  echo "<td><b><a href=\"";
391  echo "bro_main.php?R=".urlencode($R."/".$c[$i]["name"]);
392  echo "\">"; ehe($c[$i]["name"]); echo "/</a></b></td>\n";
393  echo " <td>".format_size($c[$i]["size"])."</td>";
394  echo "<td>".format_date(_('%3$d-%2$d-%1$d %4$d:%5$d'),date("Y-m-d h:i:s",$c[$i]["date"]))."<br /></td>";
395  if ($p["showtype"]) {
396  echo "<td>"._("Folder")."</td>";
397  }
398  echo "<td>&nbsp;";
399  echo "</td>\n";
400  }
401 
402  echo "</tr>\n";
403  }
404  echo "</tbody></table>";
405  break;
406  case 1:
407  /* AFFICHE 2 COLONNES COURTES */
408  reset($c);
409  echo "<table width=\"100%\" border=0 cellpadding=0 cellspacing=0>";
410  echo "<tr><td valign=\"top\" width=\"50%\">";
411  echo "<table width=\"100%\" border=0 cellpadding=0 cellspacing=0>";
412  for($i=0;$i<round(count($c)/2);$i++) {
413  echo "<tr class=\"lst\">\n";
414  if ($c[$i]["type"]) {
415  echo " <td width=\"28\"><input type=\"checkbox\" class=\"inc\" name=\"d[]\" value=\"".$c[$i]["name"]."\" /></td><td><a href=\"";
416  echo "bro_editor.php?editfile=".urlencode($c[$i]["name"])."&amp;R=".urlencode($R);
417  echo "\">".htmlentities($c[$i]["name"])."</a></td>\n";
418  echo " <td>".format_size($c[$i]["size"])."</td><td>";
419  $vu=$bro->viewurl($R,$c[$i]["name"]);
420  if ($vu) {
421  echo "<td><a href=\"$vu\">"._("V")."</a>";
422  } else {
423  echo "<td>&nbsp;";
424  }
425  echo "</td>\n";
426  } else {
427  echo " <td width=\"28\"><input TYPE=checkbox class=\"inc\" name=\"d[]\" value=\"".$c[$i]["name"]."\"></td><td><b><a href=\"";
428  echo "bro_main.php?R=".urlencode($R."/".$c[$i]["name"]);
429  echo "\">".htmlentities($c[$i]["name"])."/</a></b></td>\n";
430  echo " <td>".format_size($c[$i]["size"])."</td><td>";
431  echo "&nbsp;";
432  echo "</td>\n";
433  }
434 
435  echo "</tr>\n";
436  }
437  echo "</table>";
438  echo "</td><td valign=\"top\" width=\"50%\">";
439  echo "<table width=\"100%\" border=0 cellpadding=0 cellspacing=0>";
440  for($i=round(count($c)/2);$i<count($c);$i++) {
441  echo "<tr class=\"lst\">\n";
442  if ($c[$i]["type"]) {
443  echo " <td width=\"28\"><input TYPE=checkbox class=\"inc\" name=\"d[]\" value=\"".$c[$i]["name"]."\"></td><td><a href=\"";
444  echo "bro_editor.php?editfile=".urlencode($c[$i]["name"])."&amp;R=".urlencode($R);
445  echo "\">".htmlentities($c[$i]["name"])."</a></td>\n";
446  echo " <td>".format_size($c[$i]["size"])."</td><td>";
447  $vu=$bro->viewurl($R,$c[$i]["name"]);
448  if ($vu) {
449  echo "<td><a href=\"$vu\">"._("V")."</a>";
450  } else {
451  echo "<td>&nbsp;";
452  }
453  echo "</td>\n";
454  } else {
455  echo " <td width=\"28\"><input TYPE=checkbox class=\"inc\" name=\"d[]\" value=\"".$c[$i]["name"]."\"></td><td><b><a href=\"";
456  echo "bro_main.php?R=".urlencode($R."/".$c[$i]["name"]);
457  echo "\">".htmlentities($c[$i]["name"])."/</a></b></td>\n";
458  echo " <td>".format_size($c[$i]["size"])."</td><td>";
459  echo "&nbsp;";
460  echo "</td>\n";
461  }
462 
463  echo "</tr>\n";
464  }
465  echo "</table>";
466  echo "</td></tr>";
467  echo "</table>";
468  break;
469  case 2:
470  /* AFFICHE 3 COLONNES COURTES */
471  reset($c);
472  echo "<table width=\"100%\" border=0 cellpadding=0 cellspacing=0>";
473  echo "<tr><td valign=\"top\" width=\"33%\">";
474  echo "<table width=\"100%\" border=0 cellpadding=0 cellspacing=0>";
475  for($i=0;$i<round(count($c)/3);$i++) {
476  echo "<tr class=\"lst\">\n";
477  if ($c[$i]["type"]) {
478  echo " <td width=\"28\"><input TYPE=checkbox class=\"inc\" name=\"d[]\" value=\"".$c[$i]["name"]."\"></td><td><a href=\"";
479  echo "bro_editor.php?editfile=".urlencode($c[$i]["name"])."&amp;R=".urlencode($R);
480  echo "\">".htmlentities($c[$i]["name"])."</a></td>\n";
481  echo " <td>".format_size($c[$i]["size"])."</td><td>";
482  $vu=$bro->viewurl($R,$c[$i]["name"]);
483  if ($vu) {
484  echo "<td><a href=\"$vu\">"._("V")."</a>";
485  } else {
486  echo "<td>&nbsp;";
487  }
488  echo "</td>\n";
489  } else {
490  echo " <td width=\"28\"><input TYPE=checkbox class=\"inc\" name=\"d[]\" value=\"".$c[$i]["name"]."\"></td><td><b><a href=\"";
491  echo "bro_main.php?R=".urlencode($R."/".$c[$i]["name"]);
492  echo "\">".htmlentities($c[$i]["name"])."/</a></b></td>\n";
493  echo " <td>".format_size($c[$i]["size"])."</td><td>";
494  echo "&nbsp;";
495  echo "</td>\n";
496  }
497 
498  echo "</tr>\n";
499  }
500  echo "</table>";
501  echo "</td><td valign=\"top\" width=\"33%\">";
502  echo "<table width=\"100%\" border=0 cellpadding=0 cellspacing=0>";
503  for($i=round(count($c)/3);$i<round(2*count($c)/3);$i++) {
504  echo "<tr class=\"lst\">\n";
505  if ($c[$i]["type"]) {
506  echo " <td width=\"28\"><input TYPE=checkbox class=\"inc\" name=\"d[]\" value=\"".$c[$i]["name"]."\"></td><td><a href=\"";
507  echo "bro_editor.php?editfile=".urlencode($c[$i]["name"])."&amp;R=".urlencode($R);
508  echo "\">".htmlentities($c[$i]["name"])."</a></td>\n";
509  echo " <td>".format_size($c[$i]["size"])."</td><td>";
510  $vu=$bro->viewurl($R,$c[$i]["name"]);
511  if ($vu) {
512  echo "<td><a href=\"$vu\">"._("V")."</a>";
513  } else {
514  echo "<td>&nbsp;";
515  }
516 
517  echo "</td>\n";
518  } else {
519  echo " <td width=\"28\"><input TYPE=checkbox class=\"inc\" name=\"d[]\" value=\"".$c[$i]["name"]."\"></td><td><b><a href=\"";
520  echo "bro_main.php?R=".urlencode($R."/".$c[$i]["name"]);
521  echo "\">".htmlentities($c[$i]["name"])."/</a></b></td>\n";
522  echo " <td>".format_size($c[$i]["size"])."</td><td>";
523  echo "&nbsp;";
524  echo "</td>\n";
525  }
526 
527  echo "</tr>\n";
528  }
529  echo "</table>";
530  echo "</td><td valign=\"top\" width=\"33%\">";
531  echo "<table width=\"100%\" border=0 cellpadding=0 cellspacing=0>";
532  for($i=round(2*count($c)/3);$i<count($c);$i++) {
533  echo "<tr class=\"lst\">\n";
534  if ($c[$i]["type"]) {
535  echo " <td width=\"28\"><input TYPE=checkbox class=\"inc\" name=\"d[]\" value=\"".$c[$i]["name"]."\"></td><td><a href=\"";
536  echo "bro_editor.php?editfile=".urlencode($c[$i]["name"])."&amp;R=".urlencode($R);
537  echo "\">".htmlentities($c[$i]["name"])."</a></td>\n";
538  echo " <td>".format_size($c[$i]["size"])."</td><td>";
539  $vu=$bro->viewurl($R,$c[$i]["name"]);
540  if ($vu) {
541  echo "<td><a href=\"$vu\">"._("View")."</a>";
542  } else {
543  echo "<td>&nbsp;";
544  }
545  echo "</td>\n";
546  } else {
547  echo " <td width=\"28\"><input TYPE=checkbox class=\"inc\" name=\"d[]\" value=\"".$c[$i]["name"]."\"></td><td><b><a href=\"";
548  echo "bro_main.php?R=".urlencode($R."/".$c[$i]["name"]);
549  echo "\">".htmlentities($c[$i]["name"])."/</a></b></td>\n";
550  echo " <td>".format_size($c[$i]["size"])."</td><td>";
551  echo "&nbsp;";
552  echo "</td>\n";
553  }
554 
555  echo "</tr>\n";
556  }
557  echo "</table>";
558  echo "</td></tr>";
559  echo "</table>";
560  break;
561  }
562  ?>
563  </form>
564  <?php
565 } // is there any files here ?
566 else {
567  echo "<p class=\"alert alert-info\">"._("No files in this folder")."</p>";
568 }
569 ?>
570 
571 </td></tr>
572 <tr><td colspan="2" style="">
573 
574 <br/>
575 
576 <p>
577 <span class="ina"><a href="bro_main.php?R=<?php echo (($R)?$R:"/"); ?>&amp;showdirsize=1"><?php __("Show size of directories"); ?></a></span> <?php __("(slow)"); ?>
578 </p><p>&nbsp;</p><p>
579 <span class="ina"><?php
580 if ($hta->is_protected($R)) {
581  echo "<a href=\"hta_edit.php?dir=".(($R)?$R:"/")."\">"._("Edit this folder's protection")."</a>";
582 }
583 else {
584  echo "<a href=\"hta_add.php?dir=".(($R)?$R:"/")."\">"._("Protect this folder")."</a>";
585 }
586 ?></span> <?php __("with a login and a password"); ?>
587 </p><p>
588 <span class="ina">
589 <a href="bro_tgzdown.php?dir=<?php echo (($R)?$R:"/") ?>"><?php __("Download this folder"); ?></a>
590 </span> &nbsp;
591 <?php printf(_("as a %s file"),$bro->l_tgz[$p["downfmt"]]); ?>
592 </p>
593 <?php
594 
595 if ($id=$ftp->is_ftp($R)) {
596  ?>
597  <span class="ina">
598  <a href="ftp_edit.php?id=<?php ehe($id); ?>"><?php __("Edit the ftp account"); ?></a>
599  </span> &nbsp; <?php __("that exists in this folder"); ?>
600  <?php
601 }
602 else {
603  ?>
604  <span class="ina">
605  <a href="ftp_edit.php?create=1&amp;dir=<?php ehe($R); ?>"><?php __("Create an ftp account in this folder"); ?></a>
606  </span> &nbsp;
607  <?php
608 }
609 
610 ?>
611 <p>&nbsp;</p>
612 <p>
613 <span class="ina">
614 <a href="bro_pref.php"><?php __("Configure the file editor"); ?></a>
615 </span>
616 </p>
617 </td></tr></table>
618 
619 <script type="text/javascript">
620 $(document).ready(function() { $("#tab_files_w_details").tablesorter(); } );
621 </script>
622 
623 <?php include_once("foot.php"); ?>