note 27543 added to function.fileperms

From: Date: Tue, 10 Dec 2002 13:41:00 +0000
Subject: note 27543 added to function.fileperms
Groups: php.notes 
Request: Send a blank email to php-notes+get-40656@lists.php.net to get a copy of this message
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; }; -- http://www.php.net/manual/en/function.fileperms.php http://master.php.net/manage/user-notes.php?action=edit+27543 http://master.php.net/manage/user-notes.php?action=delete+27543 http://master.php.net/manage/user-notes.php?action=reject+27543

« previous php.notes (#40656) next »