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