From e072c85e653a9217dce9ebbe7bee34c41102d882 Mon Sep 17 00:00:00 2001 From: fiedorow Date: Mon, 23 Feb 2004 18:48:55 +0000 Subject: [PATCH] Displays file permissions for mimetex and uses md5_file if available --- filter/algebra/algebradebug.php | 13 +++++++++---- filter/tex/texdebug.php | 13 +++++++++---- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/filter/algebra/algebradebug.php b/filter/algebra/algebradebug.php index ddbe11f8e2..caff0f6311 100644 --- a/filter/algebra/algebradebug.php +++ b/filter/algebra/algebradebug.php @@ -236,10 +236,15 @@ function tex2image($texexp, $md5) { } if (file_exists($commandpath)) { echo "File size of mimetex executable $commandpath is " . filesize($commandpath) . "
"; - $handle = fopen($commandpath,"rb"); - $contents = fread($handle,16384); - fclose($handle); - echo "The md5 checksum of the first 16384 bytes is " . md5($contents) . "
"; + echo "The file permissions are: " . decoct(fileperms($commandpath)) . "
"; + if (function_exists("md5_file")) { + echo "The md5 checksum of the file is " . md5_file($commandpath) . "
"; + } else { + $handle = fopen($commandpath,"rb"); + $contents = fread($handle,16384); + fclose($handle); + echo "The md5 checksum of the first 16384 bytes is " . md5($contents) . "
"; + } } else { echo "mimetex executable $commandpath not found!
"; } diff --git a/filter/tex/texdebug.php b/filter/tex/texdebug.php index 3242697658..13b846421c 100644 --- a/filter/tex/texdebug.php +++ b/filter/tex/texdebug.php @@ -147,10 +147,15 @@ function tex2image($texexp) { } if (file_exists($commandpath)) { echo "File size of mimetex executable $commandpath is " . filesize($commandpath) . "
"; - $handle = fopen($commandpath,"rb"); - $contents = fread($handle,16384); - fclose($handle); - echo "The md5 checksum of the first 16384 bytes is " . md5($contents) . "
"; + echo "The file permissions are: " . decoct(fileperms($commandpath)) . "
"; + if (function_exists("md5_file")) { + echo "The md5 checksum of the file is " . md5_file($commandpath) . "
"; + } else { + $handle = fopen($commandpath,"rb"); + $contents = fread($handle,16384); + fclose($handle); + echo "The md5 checksum of the first 16384 bytes is " . md5($contents) . "
"; + } } else { echo "mimetex executable $commandpath not found!
"; } -- 2.39.5