SF.net SVN: phpwiki:[10714] trunk

vargenau--- via phpwiki-checkins <[email protected]>
Newsgroups gmane.comp.web.wiki.phpwiki.checkins
Message-ID <[email protected]>
Revision: 10714
          http://sourceforge.net/p/phpwiki/code/10714
Author:   vargenau
Date:     2021-11-30 17:50:13 +0000 (Tue, 30 Nov 2021)
Log Message:
-----------
FileInfo plugin: magic renamed as mime, fix corresponding code

Modified Paths:
--------------
    trunk/lib/plugin/FileInfo.php
    trunk/pgsrc/Help%2FFileInfoPlugin

Modified: trunk/lib/plugin/FileInfo.php
===================================================================
--- trunk/lib/plugin/FileInfo.php	2021-11-30 17:30:27 UTC (rev 10713)
+++ trunk/lib/plugin/FileInfo.php	2021-11-30 17:50:13 UTC (rev 10714)
@@ -47,7 +47,7 @@
     {
         return array(
             'file' => false, // relative path from PHPWIKI_DIR. (required)
-            'display' => false, // size,phonysize,date,mtime,owner,group,name,path,dirname,magic,link (required)
+            'display' => false, // size,phonysize,date,mtime,owner,group,name,path,dirname,mime,link (required)
             'format' => false, // printf format string with %s only, all display modes
             'quiet' => false // print no error if file not found
             // from above vars return strings (optional)
@@ -136,8 +136,8 @@
                 case 'dirname':
                     $s[] = dirname($file);
                     break;
-                case 'magic':
-                    $s[] = $this->magic($file);
+                case 'mime':
+                    $s[] = $this->mime($file);
                     break;
                 case 'link':
                     if ($is_Upload) {
@@ -175,14 +175,12 @@
         }
     }
 
-    function magic($file)
+    private function mime($file)
     {
-        // Valid finfo_open (i.e. libmagic) options:
-        // FILEINFO_NONE | FILEINFO_SYMLINK | FILEINFO_MIME | FILEINFO_COMPRESS | FILEINFO_DEVICES |
-        // FILEINFO_CONTINUE | FILEINFO_PRESERVE_ATIME | FILEINFO_RAW
-        $f = finfo_open( /*FILEINFO_MIME*/);
-        $result = finfo_file(realpath($file));
-        finfo_close($res);
+        // mime type and mime encoding as defined by RFC 2045
+        $f = finfo_open(FILEINFO_MIME);
+        $result = finfo_file($f, realpath($file));
+        finfo_close($f);
         return $result;
     }
 

Modified: trunk/pgsrc/Help%2FFileInfoPlugin
===================================================================
--- trunk/pgsrc/Help%2FFileInfoPlugin	2021-11-30 17:30:27 UTC (rev 10713)
+++ trunk/pgsrc/Help%2FFileInfoPlugin	2021-11-30 17:50:13 UTC (rev 10714)
@@ -1,4 +1,4 @@
-Date: Tue, 30 Nov 2021 18:23:12 +0000
+Date: Tue, 30 Nov 2021 18:48:42 +0000
 Mime-Version: 1.0 (Produced by PhpWiki 1.6.0)
 Content-Type: application/x-phpwiki;
   pagename=Help%2FFileInfoPlugin;
@@ -30,7 +30,7 @@
 | //None// (required argument)
 |-
 | **display**
-| Comma-separated string of size, phonysize, date, mtime, owner, group, name, path, dirname, magic, link
+| Comma-separated string of size, phonysize, date, mtime, owner, group, name, path, dirname, mime, link
 | //None// (required argument)
 |-
 | **format**

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.