From: <var...@us...> - 2021-11-30 17:30:33
|
Revision: 10713 http://sourceforge.net/p/phpwiki/code/10713 Author: vargenau Date: 2021-11-30 17:30:27 +0000 (Tue, 30 Nov 2021) Log Message: ----------- FileInfo plugin: remove Windows stuff, update help page Modified Paths: -------------- trunk/lib/plugin/FileInfo.php trunk/locale/de/LC_MESSAGES/phpwiki.mo trunk/locale/es/LC_MESSAGES/phpwiki.mo trunk/locale/fr/LC_MESSAGES/phpwiki.mo trunk/locale/it/LC_MESSAGES/phpwiki.mo trunk/locale/ja/LC_MESSAGES/phpwiki.mo trunk/locale/nl/LC_MESSAGES/phpwiki.mo trunk/locale/po/de.po trunk/locale/po/es.po trunk/locale/po/fr.po trunk/locale/po/it.po trunk/locale/po/ja.po trunk/locale/po/nl.po trunk/locale/po/phpwiki.pot trunk/locale/po/sv.po trunk/locale/po/zh.po trunk/locale/sv/LC_MESSAGES/phpwiki.mo trunk/locale/zh/LC_MESSAGES/phpwiki.mo trunk/pgsrc/Help%2FFileInfoPlugin Modified: trunk/lib/plugin/FileInfo.php =================================================================== --- trunk/lib/plugin/FileInfo.php 2021-11-30 16:55:09 UTC (rev 10712) +++ trunk/lib/plugin/FileInfo.php 2021-11-30 17:30:27 UTC (rev 10713) @@ -24,13 +24,13 @@ */ /** - * This plugin displays the version, date, size, perms of an uploaded file. + * This plugin displays the date, size, path, etc. of an uploaded file. * Only files relative and below to the uploads path can be handled. * * Usage: - * <<FileInfo file=Upload:setup.exe display=version,date >> - * <<FileInfo file=Upload:setup.exe display=name,version,date - * format="%s (version: %s, date: %s)" >> + * <<FileInfo file=Upload:image.png display=size,date >> + * <<FileInfo file=Upload:image.png display=name,size,date + * format="%s (size: %s, date: %s)" >> * * @author: Reini Urban */ @@ -40,7 +40,7 @@ { function getDescription() { - return _("Display file information like version, size, date... of uploaded files."); + return _("Display file information like size, date... of uploaded files."); } function getDefaultArguments() @@ -47,7 +47,7 @@ { return array( 'file' => false, // relative path from PHPWIKI_DIR. (required) - 'display' => false, // version,phonysize,size,date,mtime,owner,name,path,dirname,link. (required) + 'display' => false, // size,phonysize,date,mtime,owner,group,name,path,dirname,magic,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) @@ -107,9 +107,6 @@ $modes = explode(",", $display); foreach ($modes as $mode) { switch ($mode) { - case 'version': - $s[] = $this->exeversion($file); - break; case 'size': $s[] = filesize($file); break; @@ -142,9 +139,6 @@ case 'magic': $s[] = $this->magic($file); break; - case 'mime-typ': - $s[] = $this->mime_type($file); - break; case 'link': if ($is_Upload) { $s[] = " [" . $args['file'] . "]"; @@ -192,11 +186,6 @@ return $result; } - function mime_type($file) - { - return ''; - } - private function _formatsize($n, $factor, $suffix = '') { if ($n > $factor) { @@ -207,7 +196,7 @@ return ''; } - function phonysize($a) + private function phonysize($a) { $factor = 1024 * 1024 * 1000; if ($a > $factor) @@ -223,131 +212,4 @@ else return $a; } - - function exeversion($file) - { - if (!isWindows()) return "?"; - if (class_exists('ffi') or loadPhpExtension('ffi')) - return $this->exeversion_ffi($file); - if (function_exists('res_list_type') or loadPhpExtension('win32std')) - return $this->exeversion_resopen($file); - return exeversion_showver($file); - } - - // http://www.codeproject.com/dll/showver.asp - function exeversion_showver($file) - { - $path = realpath($file); - $result = `showver $path`; - return "?"; - } - - function exeversion_ffi($file) - { - if (!DEBUG) - return "?"; // not yet stable - - if (function_exists('ffi') or loadPhpExtension('ffi')) { - $win32_idl = " -struct VS_FIXEDFILEINFO { - DWORD dwSignature; - DWORD dwStrucVersion; - DWORD dwFileVersionMS; - DWORD dwFileVersionLS; - DWORD dwProductVersionMS; - DWORD dwProductVersionLS; - DWORD dwFileFlagsMask; - DWORD dwFileFlags; - DWORD dwFileOS; - DWORD dwFileType; - DWORD dwFileSubtype; - DWORD dwFileDateMS; - DWORD dwFileDateLS; -}; -struct VS_VERSIONINFO { struct VS_VERSIONINFO - WORD wLength; - WORD wValueLength; - WORD wType; - WCHAR szKey[1]; - WORD Padding1[1]; - VS_FIXEDFILEINFO Value; - WORD Padding2[1]; - WORD Children[1]; -}; -[lib='kernel32.dll'] DWORD GetFileVersionInfoSizeA(char *szFileName, DWORD *dwVerHnd); -[lib='kernel32.dll'] int GetFileVersionInfoA(char *sfnFile, DWORD dummy, DWORD size, struct VS_VERSIONINFO *pVer); -"; - $ffi = new ffi($win32_idl); - $dummy = 0; // &DWORD - $size = $ffi->GetFileVersionInfoSizeA($file, $dummy); - //$pVer = str_repeat($size+1); - $pVer = new ffi_struct($ffi, "VS_VERSIONINFO"); - if ($ffi->GetFileVersionInfoA($file, 0, $size, $pVer) - and $pVer->wValueLength - ) { - // analyze the VS_FIXEDFILEINFO(Value); - // $pValue = new ffi_struct($ffi, "VS_FIXEDFILEINFO"); - $pValue =& $pVer->Value; - return sprintf("%d.%d.%d.%d", - $pValue->dwFileVersionMS >> 16, - $pValue->dwFileVersionMS & 0xFFFF, - $pValue->dwFileVersionLS >> 16, - $pValue->dwFileVersionLS & 0xFFFF); - } - } - return ''; - } - - // Read "RT_VERSION/VERSIONINFO" exe/dll resource info for MSWin32 binaries - // The "win32std" extension is not ready yet to pass back a VERSIONINFO struct - function exeversion_resopen($file) - { - if (function_exists('res_list_type') or loadPhpExtension('win32std')) { - // See http://msdn.microsoft.com/workshop/networking/predefined/res.asp - $v = file_get_contents('res://' . realpath($file) . urlencode('/RT_VERSION/#1')); - if ($v) { - // This is really a binary VERSIONINFO block, with lots of - // nul bytes (widechar) which cannot be transported as string. - return "$v"; - } else { - $h = res_open(realpath($file)); - $v = res_get($h, 'RT_VERSION', 'FileVersion'); - res_close($h); - if ($v) return $v; - - $h = res_open(realpath($file)); - $v = res_get($h, '#1', 'RT_VERSION', 1); - res_close($h); - if ($v) return $v; - } - - /* The version consists of two 32-bit integers, defined by four 16-bit integers. - For example, "FILEVERSION 3,10,0,61" is translated into two doublewords: - 0x0003000a and 0x0000003d, in that order. */ - /* - $h = res_open(realpath($file)); - - echo "Res list of '$file': \n"; - $list= res_list_type($h, true); - if( $list===FALSE ) err( "Can't list type" ); - - for( $i= 0; $i<count($list); $i++ ) { - echo $list[$i]."\n"; - $res= res_list($h, $list[$i]); - for( $j= 0; $j<count($res); $j++ ) { - echo "\t".$res[$j]."\n"; - } - } - echo "Res get: ".res_get( $h, 'A_TYPE', 'A_RC_NAME' )."\n\n"; - res_close( $h ); - */ - if ($v) - return "$v"; - else - return ""; - } else { - return ""; - } - - } } Modified: trunk/locale/de/LC_MESSAGES/phpwiki.mo =================================================================== (Binary files differ) Modified: trunk/locale/es/LC_MESSAGES/phpwiki.mo =================================================================== (Binary files differ) Modified: trunk/locale/fr/LC_MESSAGES/phpwiki.mo =================================================================== (Binary files differ) Modified: trunk/locale/it/LC_MESSAGES/phpwiki.mo =================================================================== (Binary files differ) Modified: trunk/locale/ja/LC_MESSAGES/phpwiki.mo =================================================================== (Binary files differ) Modified: trunk/locale/nl/LC_MESSAGES/phpwiki.mo =================================================================== (Binary files differ) Modified: trunk/locale/po/de.po =================================================================== --- trunk/locale/po/de.po 2021-11-30 16:55:09 UTC (rev 10712) +++ trunk/locale/po/de.po 2021-11-30 17:30:27 UTC (rev 10713) @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PhpWiki 1.6.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-11-30 10:11+0100\n" +"POT-Creation-Date: 2021-11-30 18:25+0100\n" "PO-Revision-Date: 2000-10-31 02:23+0200\n" "Last-Translator: Reini Urban <ru...@x-...>, Carsten Klapp " "<car...@us...>, Helmer Pardun <pardunpress@t-online." @@ -1684,7 +1684,7 @@ msgid "Display a Facebook Like button." msgstr "" -msgid "Display file information like version, size, date... of uploaded files." +msgid "Display file information like size, date... of uploaded files." msgstr "" msgid "" Modified: trunk/locale/po/es.po =================================================================== --- trunk/locale/po/es.po 2021-11-30 16:55:09 UTC (rev 10712) +++ trunk/locale/po/es.po 2021-11-30 17:30:27 UTC (rev 10713) @@ -11,7 +11,7 @@ msgstr "" "Project-Id-Version: PhpWiki 1.6.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-11-30 10:11+0100\n" +"POT-Creation-Date: 2021-11-30 18:25+0100\n" "PO-Revision-Date: 2000-02-01 00:50-0500\n" "Last-Translator: Pablo Roca <pr...@cl...>\n" "Language-Team: \n" @@ -1654,7 +1654,7 @@ msgid "Display a Facebook Like button." msgstr "" -msgid "Display file information like version, size, date... of uploaded files." +msgid "Display file information like size, date... of uploaded files." msgstr "" msgid "" Modified: trunk/locale/po/fr.po =================================================================== --- trunk/locale/po/fr.po 2021-11-30 16:55:09 UTC (rev 10712) +++ trunk/locale/po/fr.po 2021-11-30 17:30:27 UTC (rev 10713) @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PhpWiki 1.6.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-11-30 10:11+0100\n" +"POT-Creation-Date: 2021-11-30 18:25+0100\n" "PO-Revision-Date: 2004-06-22 21:10+0200\n" "Last-Translator: Pierrick Meignen <mei...@wa...>, Roland " "Trique <rol...@fr...>, Stéphane Gourichon <stephane.gourichon@lip6." @@ -1677,10 +1677,10 @@ msgid "Display a Facebook Like button." msgstr "Afficher un bouton Facebook « J'aime »." -msgid "Display file information like version, size, date... of uploaded files." +msgid "Display file information like size, date... of uploaded files." msgstr "" -"Afficher des informations telles que la version, la taille, la date... des " -"fichiers téléchargés." +"Afficher des informations telles que la taille, la date... des fichiers " +"téléchargés." msgid "" "Output suppressed. FileInfoPlugin with local files require a locked page." Modified: trunk/locale/po/it.po =================================================================== --- trunk/locale/po/it.po 2021-11-30 16:55:09 UTC (rev 10712) +++ trunk/locale/po/it.po 2021-11-30 17:30:27 UTC (rev 10713) @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: PhpWiki 1.6.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-11-30 10:11+0100\n" +"POT-Creation-Date: 2021-11-30 18:25+0100\n" "PO-Revision-Date: 2005-02-12 16:23+0100\n" "Last-Translator: Antonio Bonifati ant[(at)]monitor.deis.unical.it\n" "Language-Team: \n" @@ -1637,7 +1637,7 @@ msgid "Display a Facebook Like button." msgstr "" -msgid "Display file information like version, size, date... of uploaded files." +msgid "Display file information like size, date... of uploaded files." msgstr "" msgid "" Modified: trunk/locale/po/ja.po =================================================================== --- trunk/locale/po/ja.po 2021-11-30 16:55:09 UTC (rev 10712) +++ trunk/locale/po/ja.po 2021-11-30 17:30:27 UTC (rev 10713) @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PhpWiki 1.6.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-11-30 10:11+0100\n" +"POT-Creation-Date: 2021-11-30 18:25+0100\n" "PO-Revision-Date: 2003-06-07 09:01+0900\n" "Last-Translator: Tadashi Jokagi <web...@el...>\n" "Language-Team: LANGUAGE <LL...@li...>\n" @@ -1623,7 +1623,7 @@ msgid "Display a Facebook Like button." msgstr "" -msgid "Display file information like version, size, date... of uploaded files." +msgid "Display file information like size, date... of uploaded files." msgstr "" msgid "" Modified: trunk/locale/po/nl.po =================================================================== --- trunk/locale/po/nl.po 2021-11-30 16:55:09 UTC (rev 10712) +++ trunk/locale/po/nl.po 2021-11-30 17:30:27 UTC (rev 10713) @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: PhpWiki 1.6.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-11-30 10:11+0100\n" +"POT-Creation-Date: 2021-11-30 18:25+0100\n" "PO-Revision-Date: 2000-09-30 02:23+0200\n" "Last-Translator: Jan Nieuwenhuizen <ja...@gn...>\n" "Language-Team: Dutch <nl...@li...>\n" @@ -1629,7 +1629,7 @@ msgid "Display a Facebook Like button." msgstr "" -msgid "Display file information like version, size, date... of uploaded files." +msgid "Display file information like size, date... of uploaded files." msgstr "" msgid "" Modified: trunk/locale/po/phpwiki.pot =================================================================== --- trunk/locale/po/phpwiki.pot 2021-11-30 16:55:09 UTC (rev 10712) +++ trunk/locale/po/phpwiki.pot 2021-11-30 17:30:27 UTC (rev 10713) @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PhpWiki-1.6.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-11-30 10:11+0100\n" +"POT-Creation-Date: 2021-11-30 18:25+0100\n" "PO-Revision-Date: 2002-12-14 17:51-0500\n" "Last-Translator: Reini Urban <ru...@us...>\n" "Language-Team: LANGUAGE <LL...@li...>\n" @@ -1623,7 +1623,7 @@ msgid "Display a Facebook Like button." msgstr "" -msgid "Display file information like version, size, date... of uploaded files." +msgid "Display file information like size, date... of uploaded files." msgstr "" msgid "" Modified: trunk/locale/po/sv.po =================================================================== --- trunk/locale/po/sv.po 2021-11-30 16:55:09 UTC (rev 10712) +++ trunk/locale/po/sv.po 2021-11-30 17:30:27 UTC (rev 10713) @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: PhpWiki 1.6.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-11-30 10:11+0100\n" +"POT-Creation-Date: 2021-11-30 18:25+0100\n" "PO-Revision-Date: 2001-01-27 01:58+0200\n" "Last-Translator: Jon Åslund <jo...@he...>\n" "Language-Team: \n" @@ -1624,7 +1624,7 @@ msgid "Display a Facebook Like button." msgstr "" -msgid "Display file information like version, size, date... of uploaded files." +msgid "Display file information like size, date... of uploaded files." msgstr "" msgid "" Modified: trunk/locale/po/zh.po =================================================================== --- trunk/locale/po/zh.po 2021-11-30 16:55:09 UTC (rev 10712) +++ trunk/locale/po/zh.po 2021-11-30 17:30:27 UTC (rev 10713) @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PhpWiki 1.6.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-11-30 10:11+0100\n" +"POT-Creation-Date: 2021-11-30 18:25+0100\n" "PO-Revision-Date: 2004-04-21 10:08+0800\n" "Last-Translator: DruryL <dr...@us...>\n" "Language-Team: DruryL <dr...@us...>\n" @@ -1630,7 +1630,7 @@ msgid "Display a Facebook Like button." msgstr "" -msgid "Display file information like version, size, date... of uploaded files." +msgid "Display file information like size, date... of uploaded files." msgstr "" msgid "" Modified: trunk/locale/sv/LC_MESSAGES/phpwiki.mo =================================================================== (Binary files differ) Modified: trunk/locale/zh/LC_MESSAGES/phpwiki.mo =================================================================== (Binary files differ) Modified: trunk/pgsrc/Help%2FFileInfoPlugin =================================================================== --- trunk/pgsrc/Help%2FFileInfoPlugin 2021-11-30 16:55:09 UTC (rev 10712) +++ trunk/pgsrc/Help%2FFileInfoPlugin 2021-11-30 17:30:27 UTC (rev 10713) @@ -1,4 +1,4 @@ -Date: Tue, 30 Nov 2021 13:09:40 +0000 +Date: Tue, 30 Nov 2021 18:23:12 +0000 Mime-Version: 1.0 (Produced by PhpWiki 1.6.0) Content-Type: application/x-phpwiki; pagename=Help%2FFileInfoPlugin; @@ -6,18 +6,15 @@ charset=UTF-8 Content-Transfer-Encoding: binary -The **~FileInfo** [[Help:WikiPlugin|plugin]] displays the version, date, size, -perms of an uploaded file. Only files relative and below to the uploads path -can be handled. +The **~FileInfo** [[Help:WikiPlugin|plugin]] displays the date, size, path, etc. +of an uploaded file. Only files relative and below to the uploads path can be handled. -For exe files the **version** argument might work to display the VERSIONINFO ressource string. (highly experimental). - == Typical Usage == {{{ -<<FileInfo file=uploads/setup.exe display=version,date>> -<<FileInfo file=uploads/setup.exe display=name,version,date - format="%s (version: %s, date: %s)">> +<<FileInfo file=Upload:image.png display=size,date >> +<<FileInfo file=Upload:image.png display=name,size,date + format="%s (size: %s, date: %s)" >> }}} == Arguments == @@ -33,7 +30,7 @@ | //None// (required argument) |- | **display** -| Comma-separated string of version, size, phonysize, date, mtime, owner, name, path, dirname, link, mime-typ, magic. +| Comma-separated string of size, phonysize, date, mtime, owner, group, name, path, dirname, magic, link | //None// (required argument) |- | **format** @@ -41,14 +38,18 @@ | (optional) |- | **quiet** -| Boolean. If true, print no error if file is not found +| Boolean. If true, print no error if file is not found. | false |} -== Examples == +== Example == +{{{ This wiki was installed at <<FileInfo file=config/config.ini display=date>>. +}}} +This wiki was installed at <<FileInfo file=config/config.ini display=date>>. + <noinclude> ---- [[PhpWikiDocumentation]] [[CategoryWikiPlugin]] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |