source: bureau/admin/bro_main.php @ 102

Revision 102, 13.9 KB checked in by anarcat, 7 years ago (diff)

[project @ alternc: changeset 2003-06-10 06:45:16 by root]
remplacement des <br> par <br />

Original author: root
Date: 2003-06-10 06:45:20

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