We know SHOW the 'protected' files in the browser, so that you understand why you can't edit them

This commit is contained in:
Benjamin Sonntag 2015-11-11 09:43:57 +01:00
parent edf639d048
commit fa5ca54555
2 changed files with 19 additions and 7 deletions

View File

@ -62,13 +62,13 @@ $R=$bro->convertabsolute($R,1);
// on fait ?
if (!empty($formu) && $formu) {
switch ($formu) {
case 1: // Cr<EFBFBD>er le r<>pertoire $R.$nomfich
case 1: // Create the folder $R.$nomfich
if (!$bro->CreateDir($R,$nomfich)) {
$error = $err->errstr();
}
$p=$bro->GetPrefs();
break;
case 6: // Cr<EFBFBD>er le fichier $R.$nomfich
case 6: // Create the file $R.$nomfich
if (!$bro->CreateFile($R,$nomfich)) {
$error = $err->errstr();
}
@ -133,7 +133,7 @@ if (!empty($formu) && $formu) {
}
break;
case 7: // Changement de permissions [ML]
if (!@$bro->ChangePermissions($R, $d, $perm)) {
if (!$bro->ChangePermissions($R, $d, $perm)) {
$error = $err->errstr();
}
break;
@ -331,7 +331,7 @@ function actmoveto_not_empty() {
<?php } ?>
<th></th>
</tr></thead><tbody>
<?php
<?php
for($i=0;$i<count($c);$i++) {
echo "<tr class=\"lst\">\n";
@ -348,7 +348,11 @@ function actmoveto_not_empty() {
echo "bro_downloadfile.php?dir=".urlencode($R)."&amp;file=".urlencode($c[$i]["name"]);
}
echo "\">"; ehe($c[$i]["name"]);
echo"</a></td>\n";
echo"</a>";
if (!($c[$i]["permissions"] & 0000200)) {
echo " (<a href=\"bro_main.php?actperms=Permissions&R=".urlencode($R)."&amp;formu=2&amp;d[]=".urlencode($c[$i]["name"])."\">"._("protected")."</a>)";
}
echo "</td>\n";
echo " <td>".format_size($c[$i]["size"])."</td>";
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>";
if ($p["showtype"]) {

View File

@ -206,11 +206,15 @@ class m_bro {
$err->raise('bro', _("This directory is not readable."));
return false;
}
clearstatcache(true);
$c = array();
if ($dir = @opendir($absolute)) {
while (($file = readdir($dir)) !== false) {
if ($file != "." && $file != "..") {
$c[] = array("name" => $file, "size" => $this->fsize($absolute . "/" . $file, $showdirsize), "date" => filemtime($absolute . "/" . $file), "type" => (!is_dir($absolute . "/" . $file)));
$stat=stat($absolute . "/" . $file);
$c[] = array("name" => $file, "size" => $this->fsize($absolute . "/" . $file, $showdirsize),
"date" => filemtime($absolute . "/" . $file), "type" => (!is_dir($absolute . "/" . $file)),
"permissions" => $stat[2] );
}
}
closedir($dir);
@ -563,12 +567,14 @@ class m_bro {
$m = $m & (~ 0222); // ugo-w
}
$action->chmod($absolute . "/" . $d[$i], $m);
// We'd like to *wait* for this to complete, but since this is essentially asynchronous, we can't be sure easily
// So we chose to wait a little bit (2 sec) at the end of the loop...
if ($verbose) {
echo "chmod " . sprintf('%o', $m) . " file, was " . sprintf('%o', fileperms($absolute . "/" . $d[$i])) . " -- " . $perm[$i]['w'];
}
}
}
sleep(2);
return true;
}
@ -873,6 +879,8 @@ class m_bro {
include('foot.php');
exit;
}
$stat=stat($absolute);
if (!($stat[2] & 0000200)) return false;
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$mime = finfo_file($finfo, $absolute);
if (substr($mime, 0, 5) == "text/" || $mime == "application/x-empty" || $mime == "inode/x-empty") {