source: alternc/branches/franck-desktop/bureau/admin/bro_main.php @ 1797

Revision 1797, 14.3 KB checked in by franck, 6 years ago (diff)

Mise a jour en 0.9.6.2: a tester

Line 
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*/
31require_once("../class/config.php");
32include_once ("head.php");
33
34$p=$bro->GetPrefs();
35if (!$R && $p["golastdir"]) {
36  $R=$p["lastdir"];
37}
38$R=$bro->convertabsolute($R,1);
39// on fait ?
40if ($formu) {
41  switch ($formu) {
42  case 1:  // Créer le répertoire $R.$nomfich
43    $bro->CreateDir($R,$nomfich);
44    $p=$bro->GetPrefs();
45    break;
46  case 6: // Créer le fichier $R.$nomfich
47    $bro->CreateFile($R,$nomfich);
48    $p=$bro->GetPrefs();
49    if ($p["createfile"]==1) {
50      $file=$nomfich;
51      include("bro_editor.php");
52      exit();
53    }
54    break;
55  case 2:  // act vaut Supprimer Copier ou Renommer.
56    if ($actdel) {
57      $bro->DeleteFile($d,$R);
58    }
59    if ($actmove) {
60      $bro->MoveFile($d,$R,$actmoveto);
61    }
62    break;
63  case 4:  // Renommage Effectif...
64    $bro->RenameFile($R,$o,$d); // Rename $R (directory) $o (old) $d (new) names
65    break;
66  case 3:  // Upload de fichier...
67    $bro->UploadFile($R);
68    break;
69  }
70}
71
72/* Creation de la liste des fichiers courants */
73$c=$bro->filelist($R);
74if ($c===false) $error=$err->errstr();
75
76?>
77<h3><?php __("File browser"); ?></h3>
78<table border="0" width="100%" cellspacing="0">
79<tr><td>
80
81<hr />
82<table width="100%"><tr><td valign="top">
83<a href="bro_main.php?R=/"><?php echo $mem->user["login"]; ?></a>&nbsp;/&nbsp;<?php echo $bro->PathList($R,"bro_main.php") ?><br />
84<?php if ($error) echo "<font color=\"red\">$error</font>"; ?>
85</td><td valign="top" align="right">
86
87<form action="bro_main.php" method="post" name="nn" id="nn">
88<input type="hidden" name="R" value="<?php echo $R; ?>" />
89<table><tr>
90<td><input type="text" class="int" name="nomfich" size="22" maxlength="255" /></td>
91<td><input type="submit" class="inb" value="<?php __("Create"); ?>" /></td>
92</tr><tr><td>
93<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>
94<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>
95</td><td></td></tr></table>
96</form>
97</td></tr>
98</table>
99
100</td></tr>
101<tr><td valign="top">
102
103<?php
104/* Renommer / Copier / Déplacer les fichiers : */
105if ($formu==2 && $actrename && count($d)) {
106  echo "<table cellpadding=\"6\">\n";
107  echo "<form action=\"bro_main.php\" method=\"post\">\n";
108  echo "<input type=\"hidden\" name=\"R\" value=\"$R\" />\n";
109  echo "<input type=\"hidden\" name=\"formu\" value=\"4\" />\n";
110  echo "<tr><th colspan=\"2\">"._("Rename")."</th></tr>";
111  for ($i=0;$i<count($d);$i++) {
112    $d[$i]=ssla($d[$i]);
113    echo "<tr><td><input type=\"hidden\" name=\"o[$i]\" value=\"".$d[$i]."\" />".$d[$i]."</td>";
114    echo "<td><input type=\"text\" class=\"int\" name=\"d[$i]\" value=\"".$d[$i]."\" /></td></tr>";
115  }
116  echo "<tr><td colspan=\"2\" align=\"center\"><input type=\"submit\" class=\"inb\" name=\"submit\" value=\""._("Rename")."\" /></td></tr>";
117  echo "</table></form>\n";
118  echo "<hr />\n";
119}
120
121/* We draw the file list and button bar only if there is files here ! */
122if (count($c)) {
123
124?>
125<form action="bro_main.php" method="post" name="main" id="main">
126<input type="hidden" name="R" value="<?php echo $R; ?>" />
127<input type="hidden" name="formu" value="2" />
128<hr />
129<script type="text/javascript">
130<!--
131document.write("<input type=\"button\" value=\"<?php __("all/none"); ?>\" class=\"inb\" onclick=\"CheckAll();\" />");
132//  -->
133</script>
134<input type="submit" class="inb" name="actdel" value="<?php __("Delete"); ?>" />
135
136<input type="submit" class="inb" name="actrename" value="<?php __("Rename"); ?>" />
137&nbsp;&nbsp;&nbsp;
138<input type="submit" class="inb" name="actmove" value="<?php __("Move"); ?>" />&nbsp;:&nbsp;<input type="text" class="int" name="actmoveto" value="" />
139<script type="text/javascript">
140<!--
141document.write("<input type=\"button\" name=\"bff\" onclick=\"browseforfolder('main.actmoveto');\" value=\" ... \" class=\"inb\" />");
142//  -->
143</script>
144     <hr />
145
146
147
148<?php
149     switch ($p["listmode"]) {
150case 0:
151/* AFFICHE 1 COLONNE DETAILLEE */
152reset($c);
153echo "<table width=\"100%\" style=\"border: 0px\" cellpadding=\"0\" cellspacing=\"0\">";
154$col=1;
155for($i=0;$i<count($c);$i++) {
156$col=3-$col;
157echo "<tr class=\"lst$col\">\n";
158if ($c[$i]["type"]) {
159echo "  <td width=\"28\"><input type=\"checkbox\" class=\"inc\" name=\"d[]\" value=\"".htmlentities($c[$i]["name"])."\" /></td>";
160if ($p["showicons"]) {
161echo "<td width=\"28\"><img src=\"icon/".$bro->icon($c[$i]["name"])."\" width=\"16\" height=\"16\" alt=\"\" /></td>";
162}
163echo "<td><a href=\"";
164echo "bro_editor.php?file=".urlencode($c[$i]["name"])."&amp;R=".urlencode($R);
165echo "\">".htmlentities($c[$i]["name"])."</a></td>\n";
166echo "  <td>".format_size($c[$i]["size"])."</td>";
167echo "<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>";
168if ($p["showtype"]) {
169echo "<td>".$bro->mime($c[$i]["name"])."</td>";
170}
171$vu=$bro->viewurl($R,$c[$i]["name"]);
172if ($vu) {
173echo "<td><a href=\"$vu\">"._("View")."</a>";
174} else {
175echo "<td>&nbsp;";
176}
177echo "</td>\n";
178} else {           // DOSSIER :
179echo "  <td width=\"28\"><input type=\"checkbox\" class=\"inc\" name=\"d[]\" value=\"".htmlentities($c[$i]["name"])."\" /></td>";
180if ($p["showicons"]) {
181echo "<td width=\"28\"><img src=\"icon/folder.png\" width=\"16\" height=\"16\" alt=\"\" /></td>";
182}
183echo "<td><b><a href=\"";
184echo "bro_main.php?R=".urlencode($R."/".$c[$i]["name"]);
185echo "\">".htmlentities($c[$i]["name"])."/</a></b></td>\n";
186echo "  <td>".format_size($c[$i]["size"])."</td>";
187echo "<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>";
188if ($p["showtype"]) {
189echo "<td>Dossier</td>";
190}
191echo "<td>&nbsp;";
192echo "</td>\n";
193}
194
195echo "</tr>\n";
196}
197echo "</table>";
198break;
199case 1:
200/* AFFICHE 2 COLONNES COURTES */
201reset($c);
202echo "<table width=\"100%\" border=0 cellpadding=0 cellspacing=0>";
203echo "<tr><td valign=\"top\" width=\"50%\">";
204echo "<table width=\"100%\" border=0 cellpadding=0 cellspacing=0>";
205$col=1;
206for($i=0;$i<round(count($c)/2);$i++) {
207$col=3-$col;
208echo "<tr class=\"lst$col\">\n";
209if ($c[$i]["type"]) {
210echo "  <td width=\"28\"><input type=\"checkbox\" class=\"inc\" name=\"d[]\" value=\"".htmlentities($c[$i]["name"])."\" /></td><td><a href=\"";
211echo "bro_editor.php?file=".urlencode($c[$i]["name"])."&amp;R=".urlencode($R);
212echo "\">".htmlentities($c[$i]["name"])."</a></td>\n";
213echo "  <td>".format_size($c[$i]["size"])."</td><td>";
214$vu=$bro->viewurl($R,$c[$i]["name"]);
215if ($vu) {
216echo "<td><a href=\"$vu\">"._("V")."</a>";
217} else {
218echo "<td>&nbsp;";
219}
220echo "</td>\n";
221} else {
222echo "  <td width=\"28\"><input type=\"checkbox\" class=\"inc\" name=\"d[]\" value=\"".htmlentities($c[$i]["name"])."\" /></td><td><b><a href=\"";
223echo "bro_main.php?R=".urlencode($R."/".$c[$i]["name"]);
224echo "\">".htmlentities($c[$i]["name"])."/</a></b></td>\n";
225echo "  <td>".format_size($c[$i]["size"])."</td><td>";
226echo "&nbsp;";
227echo "</td>\n";
228}
229
230echo "</tr>\n";
231}
232echo "</table>";
233echo "</td><td valign=\"top\" width=\"50%\">";
234echo "<table width=\"100%\" border=0 cellpadding=0 cellspacing=0>";
235$col=1;
236for($i=round(count($c)/2);$i<count($c);$i++) {
237$col=3-$col;
238echo "<tr class=\"lst$col\">\n";
239if ($c[$i]["type"]) {
240echo "  <td width=\"28\"><input type=\"checkbox\" class=\"inc\" name=\"d[]\" value=\"".htmlentities($c[$i]["name"])."\" /></td><td><a href=\"";
241echo "bro_editor.php?file=".urlencode($c[$i]["name"])."&amp;R=".urlencode($R);
242echo "\">".htmlentities($c[$i]["name"])."</a></td>\n";
243echo "  <td>".format_size($c[$i]["size"])."</td><td>";
244$vu=$bro->viewurl($R,$c[$i]["name"]);
245if ($vu) {
246echo "<td><a href=\"$vu\">"._("V")."</a>";
247} else {
248echo "<td>&nbsp;";
249}
250echo "</td>\n";
251} else {
252echo "  <td width=\"28\"><input type=\"checkbox\" class=\"inc\" name=\"d[]\" value=\"".htmlentities($c[$i]["name"])."\" /></td><td><b><a href=\"";
253echo "bro_main.php?R=".urlencode($R."/".$c[$i]["name"]);
254echo "\">".htmlentities($c[$i]["name"])."/</a></b></td>\n";
255echo "  <td>".format_size($c[$i]["size"])."</td><td>";
256echo "&nbsp;";
257echo "</td>\n";
258}
259
260echo "</tr>\n";
261}
262echo "</table>";
263echo "</td></tr>";
264echo "</table>";
265break;
266case 2:
267/* AFFICHE 3 COLONNES COURTES */
268reset($c);
269echo "<table width=\"100%\" border=0 cellpadding=0 cellspacing=0>";
270echo "<tr><td valign=\"top\" width=\"33%\">";
271echo "<table width=\"100%\" border=0 cellpadding=0 cellspacing=0>";
272$col=1;
273for($i=0;$i<round(count($c)/3);$i++) {
274$col=3-$col;
275echo "<tr class=\"lst$col\">\n";
276if ($c[$i]["type"]) {
277echo "  <td width=\"28\"><input type=\"checkbox\" class=\"inc\" name=\"d[]\" value=\"".htmlentities($c[$i]["name"])."\" /></td><td><a href=\"";
278echo "bro_editor.php?file=".urlencode($c[$i]["name"])."&amp;R=".urlencode($R);
279echo "\">".htmlentities($c[$i]["name"])."</a></td>\n";
280echo "  <td>".format_size($c[$i]["size"])."</td><td>";
281$vu=$bro->viewurl($R,$c[$i]["name"]);
282if ($vu) {
283echo "<td><a href=\"$vu\">"._("V")."</a>";
284} else {
285echo "<td>&nbsp;";
286}
287echo "</td>\n";
288} else {
289echo "  <td width=\"28\"><input type=\"checkbox\" class=\"inc\" name=\"d[]\" value=\"".htmlentities($c[$i]["name"])."\" /></td><td><b><a href=\"";
290echo "bro_main.php?R=".urlencode($R."/".$c[$i]["name"]);
291echo "\">".htmlentities($c[$i]["name"])."/</a></b></td>\n";
292echo "  <td>".format_size($c[$i]["size"])."</td><td>";
293echo "&nbsp;";
294echo "</td>\n";
295}
296
297echo "</tr>\n";
298}
299echo "</table>";
300echo "</td><td valign=\"top\" width=\"33%\">";
301echo "<table width=\"100%\" border=0 cellpadding=0 cellspacing=0>";
302$col=1;
303for($i=round(count($c)/3);$i<round(2*count($c)/3);$i++) {
304$col=3-$col;
305echo "<tr class=\"lst$col\">\n";
306if ($c[$i]["type"]) {
307echo "  <td width=\"28\"><input type=\"checkbox\" class=\"inc\" name=\"d[]\" value=\"".htmlentities($c[$i]["name"])."\" /></td><td><a href=\"";
308echo "bro_editor.php?file=".urlencode($c[$i]["name"])."&amp;R=".urlencode($R);
309echo "\">".htmlentities($c[$i]["name"])."</a></td>\n";
310echo "  <td>".format_size($c[$i]["size"])."</td><td>";
311$vu=$bro->viewurl($R,$c[$i]["name"]);
312if ($vu) {
313echo "<td><a href=\"$vu\">"._("V")."</a>";
314} else {
315echo "<td>&nbsp;";
316}
317
318echo "</td>\n";
319} else {
320echo "  <td width=\"28\"><input type=\"checkbox\" class=\"inc\" name=\"d[]\" value=\"".htmlentities($c[$i]["name"])."\" /></td><td><b><a href=\"";
321echo "bro_main.php?R=".urlencode($R."/".$c[$i]["name"]);
322echo "\">".htmlentities($c[$i]["name"])."/</a></b></td>\n";
323echo "  <td>".format_size($c[$i]["size"])."</td><td>";
324echo "&nbsp;";
325echo "</td>\n";
326}
327
328echo "</tr>\n";
329}
330echo "</table>";
331echo "</td><td valign=\"top\" width=\"33%\">";
332echo "<table width=\"100%\" border=0 cellpadding=0 cellspacing=0>";
333$col=1;
334for($i=round(2*count($c)/3);$i<count($c);$i++) {
335$col=3-$col;
336echo "<tr class=\"lst$col\">\n";
337if ($c[$i]["type"]) {
338echo "  <td width=\"28\"><input TYPE=checkbox class=\"inc\" name=\"d[]\" value=\"".htmlentities($c[$i]["name"])."\" /></td><td><a href=\"";
339echo "bro_editor.php?file=".urlencode($c[$i]["name"])."&amp;R=".urlencode($R);
340echo "\">".htmlentities($c[$i]["name"])."</a></td>\n";
341echo "  <td>".format_size($c[$i]["size"])."</td><td>";
342$vu=$bro->viewurl($R,$c[$i]["name"]);
343if ($vu) {
344echo "<td><a href=\"$vu\">"._("View")."</a>";
345} else {
346echo "<td>&nbsp;";
347}
348echo "</td>\n";
349} else {
350echo "  <td width=\"28\"><input TYPE=checkbox class=\"inc\"  name=\"d[]\" value=\"".htmlentities($c[$i]["name"])."\" /></td><td><b><a href=\"";
351echo "bro_main.php?R=".urlencode($R."/".$c[$i]["name"]);
352echo "\">".htmlentities($c[$i]["name"])."/</a></b></td>\n";
353echo "  <td>".format_size($c[$i]["size"])."</td><td>";
354echo "&nbsp;";
355echo "</td>\n";
356}
357
358echo "</tr>\n";
359}
360echo "</table>";
361echo "</td></tr>";
362echo "</table>";
363break;
364}
365?>
366     </form>
367<?php
368         } // is there any files here ?
369else {
370  echo "<p class=\"error\">"._("No files in this folder")."</p>";
371}
372?>
373
374     </td></tr>
375     <tr><td colspan="2">
376
377
378     <form action="bro_main.php" enctype="multipart/form-data" method="post">
379     <input type="hidden" name="R" value="<?php echo $R; ?>" />
380     <input type="hidden" name="formu" value="3" />
381     <hr />
382     <?php __("Import this file"); ?>&nbsp;&nbsp;<input class="int" name="userfile" type="file" />
383     <input type="hidden" name="MAX_FILE_SIZE" value="10000000" />
384     <input type="submit" class="inb" value="<?php __("Send"); ?>" />
385     <hr />
386     </form>
387     <p>&nbsp;</p>
388
389     <?php
390
391
392     if ($id=$ftp->is_ftp($R)) {
393echo _("There is an ftp account in this folder")." <a href=\"ftp_edit?id=".urlencode($id)."\">"._("Click here to edit this ftp account.")."</a><br />";
394}
395else {
396echo "<a href=\"ftp_add.php?dir=".urlencode($R)."\">"._("Click here to create an ftp account in this folder.")."</a><br />";
397}
398
399if ($hta->is_protected($R)) {
400echo "<a href=\"hta_edit?dir=$R\">"._("This folder has restricted access")."</a><br />";
401}
402else {
403echo "<a href=\"hta_add.php?value=$R\">"._("Click here to protect this folder with login/password")."</a><br />";
404}
405?>
406<br />
407<a href="bro_tgzdown.php?dir=<?php echo $R; ?>"><?php __("Download"); ?></a> <?php __("this folder and its subfolders as a compressed file"); ?> (<?php echo $bro->l_tgz[$p["downfmt"]]; ?>)<br />
408<a href="bro_pref.php"><?php __("Configure the file browser"); ?></a><br />
409
410</td></tr></table>
411<?php include_once("foot.php"); ?>
Note: See TracBrowser for help on using the repository browser.