note 27543 deleted from function.fileperms by aidan
| From: | aidan@php.net | Date: | Sat, 10 Jul 2004 13:27:16 +0000 |
| Subject: | note 27543 deleted from function.fileperms by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-72995@lists.php.net to get a copy of this message | ||
Note Submitter: vbwebprofi@gmx.de
----
here is the correct translation for the fileperms like the ls shows is with the option -l (it's
for HTML-output) :
function mfunGetPerms( $in_Perms ) {
$sP;
if($in_Perms & 0x1000) // FIFO pipe
$sP = 'p';
elseif($in_Perms & 0x2000) // Character special
$sP = 'c';
elseif($in_Perms & 0x4000) // Directory
$sP = 'd';
elseif($in_Perms & 0x6000) // Block special
$sP = 'b';
elseif($in_Perms & 0x8000) // Regular
$sP = '−';
elseif($in_Perms & 0xA000) // Symbolic Link
$sP = 'l';
elseif($in_Perms & 0xC000) // Socket
$sP = 's';
else // UNKNOWN
$sP = 'u';
// owner
$sP .= (($in_Perms & 0x0100) ? 'r' : '−') .
(($in_Perms & 0x0080) ? 'w' : '−') .
(($in_Perms & 0x0040) ? (($in_Perms & 0x0800) ? 's' : 'x' ) :
(($in_Perms & 0x0800) ? 'S' :
'−'));
// group
$sP .= (($in_Perms & 0x0020) ? 'r' : '−') .
(($in_Perms & 0x0010) ? 'w' : '−') .
(($in_Perms & 0x0008) ? (($in_Perms & 0x0400) ? 's' : 'x' ) :
(($in_Perms & 0x0400) ? 'S' :
'−'));
// world
$sP .= (($in_Perms & 0x0004) ? 'r' : '−') .
(($in_Perms & 0x0002) ? 'w' : '−') .
(($in_Perms & 0x0001) ? (($in_Perms & 0x0200) ? 't' : 'x' )
:
(($in_Perms & 0x0200) ? 'T' :
'−'));
return $sP;
};