root/alternc/tags/0.9.7/bureau/admin/bro_main.php

Revision 2002, 15.2 kB (checked in by anarcat, 1 year ago)

fix link to hta_edit

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