cvs: phpdoc-pl /reference/filesystem/functions fileperms.xml

From: Date: Thu, 24 Feb 2005 01:04:05 +0000
Subject: cvs: phpdoc-pl /reference/filesystem/functions fileperms.xml
Groups: php.doc.pl 
Request: Send a blank email to doc-pl+get-451@lists.php.net to get a copy of this message
leszek Wed Feb 23 20:04:05 2005 EDT Modified files: /phpdoc-pl/reference/filesystem/functions fileperms.xml Log: [adi] update to rev 1.9 http://cvs.php.net/diff.php/phpdoc-pl/reference/filesystem/functions/fileperms.xml?r1=1.2&r2=1.3&ty=u Index: phpdoc-pl/reference/filesystem/functions/fileperms.xml diff -u phpdoc-pl/reference/filesystem/functions/fileperms.xml:1.2 phpdoc-pl/reference/filesystem/functions/fileperms.xml:1.3 --- phpdoc-pl/reference/filesystem/functions/fileperms.xml:1.2 Wed Apr 17 03:16:09 2002 +++ phpdoc-pl/reference/filesystem/functions/fileperms.xml Wed Feb 23 20:04:05 2005 @@ -1,8 +1,6 @@ <?xml version="1.0" encoding="iso-8859-2"?> -<!-- splitted from ./pl/functions/filesystem.xml, last change in rev 1.1 --> -<!-- last change to 'fileperms' in en/ tree in rev 1.2 --> -<!-- EN-Revision: 1.2 Maintainer: adi Status: partial --> -<!-- OLD-Revision: 1.115/EN.1.2 --> +<!-- EN-Revision: 1.9 Maintainer: adi Status: ready --> +<!-- $Revision: 1.3 $ --> <refentry id="function.fileperms"> <refnamediv> <refname>fileperms</refname> @@ -14,18 +12,98 @@ <type>int</type><methodname>fileperms</methodname> <methodparam><type>string</type><parameter>nazwa_pliku</parameter></methodparam> </methodsynopsis> - <para> + <para> Zwraca prawa dostêpu pliku, lub &false; w przypadku b³êdu. - </para> + </para> + &note.clearstatcache; + &tip.fopen-wrapper.stat; + <example> + <title>Wy¶wietlanie uprawnieñ w postaci ósemkowej</title> + <programlisting role="php"> + <![CDATA[ + <?php + echo substr(sprintf('%o', fileperms('/tmp')), -4); + echo substr(sprintf('%o', fileperms('/etc/passwd')), -4); + ?> + ]]> + </programlisting> + <para>To powino wy¶wietliæ:</para> + <screen> + <![CDATA[ + 1777 + 0644 + ]]> + </screen> + </example> + <example> + <title>Wy¶wietlanie wszystkich uprawnieñ</title> + <programlisting role="php"> + <![CDATA[ + <?php + $perms = fileperms('/etc/passwd'); + + if (($perms & 0xC000) == 0xC000) { + // Gniazdo (socket) + $info = 's'; + } elseif (($perms & 0xA000) == 0xA000) { + // Link symboliczny + $info = 'l'; + } elseif (($perms & 0x8000) == 0x8000) { + // Zwyk³y plik + $info = '-'; + } elseif (($perms & 0x6000) == 0x6000) { + // Urz±dzenie blokowe + $info = 'b'; + } elseif (($perms & 0x4000) == 0x4000) { + // Katalog + $info = 'd'; + } elseif (($perms & 0x2000) == 0x2000) { + // Urz±dzenie znakowe + $info = 'c'; + } elseif (($perms & 0x1000) == 0x1000) { + // Potok (FIFO) + $info = 'p'; + } else { + // Nieznane + $info = 'u'; + } + + // W³a¶ciciel + $info .= (($perms & 0x0100) ? 'r' : '-'); + $info .= (($perms & 0x0080) ? 'w' : '-'); + $info .= (($perms & 0x0040) ? + (($perms & 0x0800) ? 's' : 'x' ) : + (($perms & 0x0800) ? 'S' : '-')); + + // Grupa + $info .= (($perms & 0x0020) ? 'r' : '-'); + $info .= (($perms & 0x0010) ? 'w' : '-'); + $info .= (($perms & 0x0008) ? + (($perms & 0x0400) ? 's' : 'x' ) : + (($perms & 0x0400) ? 'S' : '-')); + + // ¦wiat + $info .= (($perms & 0x0004) ? 'r' : '-'); + $info .= (($perms & 0x0002) ? 'w' : '-'); + $info .= (($perms & 0x0001) ? + (($perms & 0x0200) ? 't' : 'x' ) : + (($perms & 0x0200) ? 'T' : '-')); + + echo $info; + ?> + ]]> + </programlisting> + <para>To powino wy¶wietliæ:</para> + <screen> + <![CDATA[ + -r--r--r-- + ]]> + </screen> + </example> <simpara> - Ta funkcja nie dzia³a - <link linkend="features.remote-files">na zdalnych plikach</link>; sprawdzany - plik musi byæ dostêpny przez system plików serwera. + Patrz tak¿e: <function>is_readable</function>, + i <function>stat</function> </simpara> - <para> - Wyniki tej funkcji s± cachowane. Zobacz - <function>clearstatcache</function> aby uzyskaæ wiêcej szczegó³ów. - </para> </refsect1> </refentry>

« previous php.doc.pl (#451) next »