realtimeprojects / quixplorer

simply upload and download files to your webserver with a web-interface
33 stars 27 forks source link

Fun_extra contains a bug for mimetypes Quixplorer Version 2.5.7 #29

Closed Dutchman01 closed 8 years ago

Dutchman01 commented 9 years ago

Fun_extra contains a bug for mimetypes so that it does not display! For this i revert to older code for this moment

Fun_extra.php

/**

// Bug used_mime_types not displayed! needs fix!

function get_mime_type ($dir, $item, $query)

{

switch (filetype(get_abs_item($dir, $item)))

{

    case "dir":

        $mime_type  = $GLOBALS["super_mimes"]["dir"][0];

        $image      = $GLOBALS["super_mimes"]["dir"][1];

        break;

    case "link":

        $mime_type  = $GLOBALS["super_mimes"]["link"][0];

        $image      = $GLOBALS["super_mimes"]["link"][1];

        break;

    default:

        list($mime_type, $image, $type) = _get_used_mime_info($item);

        if ($mime_type != NULL)

            break;

        if ((function_exists("is_executable") && @is_executable(get_abs_item($dir,$item)))

        || @eregi($GLOBALS["super_mimes"]["exe"][2], $item))

        {

            $mime_type  = $GLOBALS["super_mimes"]["exe"][0];

            $image      = $GLOBALS["super_mimes"]["exe"][1];

        }

        else

        {

            // unknown file

            $mime_type  = $GLOBALS["super_mimes"]["file"][0];

            $image      = $GLOBALS["super_mimes"]["file"][1];

        }

}

switch ($query)

{

    case "img": return $image;

    case "ext": return $type;

    default:    return $mime_type;

}

}

*/

// End Bug code

// Start older code

/**

determine the mime type of an item

*/

function get_mime_type($dir, $item, $query) { // get file's mimetype

if(get_is_dir($dir, $item)) {

    $mime_type  = $GLOBALS["super_mimes"]["dir"][0];

    $image      = $GLOBALS["super_mimes"]["dir"][1];

    if($query=="img") return $image;

    else return $mime_type;

}

            // mime_type

foreach($GLOBALS["used_mime_types"] as $mime) {

    list($desc,$img,$ext)   = $mime;

    if(@eregi($ext,$item)) {

        $mime_type  = $desc;

        $image      = $img;

        if($query=="img") return $image;

        else return $mime_type;

    }

}

if((function_exists("is_executable") && @is_executable(get_abs_item($dir,$item))) 

|| @eregi($GLOBALS["super_mimes"]["exe"][2],$item))     

{                       // executable

    $mime_type  = $GLOBALS["super_mimes"]["exe"][0];

    $image      = $GLOBALS["super_mimes"]["exe"][1];

} else {                    // unknown file

    $mime_type  = $GLOBALS["super_mimes"]["file"][0];

    $image      = $GLOBALS["super_mimes"]["file"][1];

}

if($query=="img") return $image;

else return $mime_type;

}

// End older code

I hope you fix this for next release.

Regards, Dutchman01

realtimeprojects commented 9 years ago

Hi,

finally I did some investigations on this item. I cannot reproduce your problem with my configuration. In the list view, the mime type icons are displayed correctly.

The mime types are used in several places in quixplorer.

Could you please explain in detail, how your problem looks like? Which action do you do? What are you missing? What is displayed wrong?

In order to help finding the problem, I made a patch in the master branch which generates a debug message in your apache_error.log whenever get_mime_types() is called. If you can try one run with this version and send me the quixplorer log messages from your logfile, this would help find the problem. However, this patch does not fix the problem at all.

Dutchman01 commented 9 years ago

Hi,

First let me thank you for looking,

Made some screenshots as those say more than a thousand words.

fun_extra.php used from you gives screenshot 1-wrong

fun-extra.php with the replaced older code:

/**

determine the mime type of an item

*/

/**

// Bug used_mime_types not displayed! needs fix!

function get_mime_type ($dir, $item, $query = 'type')

{

_debug(_dump($dir, $item, $query));

switch (filetype(get_abs_item($dir, $item)))

{

    case "dir":

        $mime_type      = $GLOBALS["super_mimes"]["dir"][0];

        $image          = $GLOBALS["super_mimes"]["dir"][1];

        break;

    case "link":

        $mime_type      = $GLOBALS["super_mimes"]["link"][0];

        $image          = $GLOBALS["super_mimes"]["link"][1];

        break;

    default:

        list($mime_type, $image, $type) = _get_used_mime_info($item);

        if ($mime_type != NULL)

            break;

        if ((function_exists("is_executable") && @is_executable(get_abs_item($dir,$item)))

        || @eregi($GLOBALS["super_mimes"]["exe"][2], $item))

        {

            $mime_type  = $GLOBALS["super_mimes"]["exe"][0];

            $image             = $GLOBALS["super_mimes"]["exe"][1];

        }

        else

        {

            // unknown file

            $mime_type  = $GLOBALS["super_mimes"]["file"][0];

            $image             = $GLOBALS["super_mimes"]["file"][1];

        }

}

switch ($query)

{

    case "img": return $image;

    case "ext": return $type;

    default:    return $mime_type;

}

}

*/

// End Bug code

// Start older code

/**

determine the mime type of an item

*/

function get_mime_type($dir, $item, $query) { // get file's mimetype

   if(get_is_dir($dir, $item)) {

          $mime_type    = $GLOBALS["super_mimes"]["dir"][0];

          $image        = $GLOBALS["super_mimes"]["dir"][1];

          if($query=="img") return $image;

          else return $mime_type;

   }

                        // mime_type

   foreach($GLOBALS["used_mime_types"] as $mime) {

          list($desc,$img,$ext)       = $mime;

          if(@eregi($ext,$item)) {

                 $mime_type    = $desc;

                 $image        = $img;

                 if($query=="img") return $image;

                 else return $mime_type;

          }

   }

   if((function_exists("is_executable") && @is_executable(get_abs_item($dir,$item))) 

   || @eregi($GLOBALS["super_mimes"]["exe"][2],$item))            

   {                                         // executable

          $mime_type    = $GLOBALS["super_mimes"]["exe"][0];

          $image        = $GLOBALS["super_mimes"]["exe"][1];

   } else {                                  // unknown file

          $mime_type    = $GLOBALS["super_mimes"]["file"][0];

          $image        = $GLOBALS["super_mimes"]["file"][1];

   }

   if($query=="img") return $image;

   else return $mime_type;

}

// End older code

/**

Check if user is allowed to access $file in $directory

*/

function get_show_item ($directory, $file)

Now with the old above code I get screenshot 2-good.jpg

As you see mimetypes now correctly displayed.

Of course I have to tell you that we added and changes some code for adaption to nas4free!

That why I will include it’s quixplorer source.

May 23 00:52:20

nas4free

quixplorer[59995]: full_path: /mnt/Data/MIKE/Reference AUDIO test.txt

May 23 00:52:20

nas4free

quixplorer[59995]: full_path: /mnt/Data/MIKE/Taxi Zwart

May 23 00:52:20

nas4free

quixplorer[59995]: full_path: /mnt/Data/MIKE/Donateurs lijst.txt

May 23 00:52:20

nas4free

quixplorer[59995]: full_path: /mnt/Data/MIKE/EasyNote Le AADenNEL.txt

May 23 00:52:20

nas4free

quixplorer[59995]: full_path: /mnt/Data/MIKE/cv m.zoon.doc

May 23 00:52:20

nas4free

quixplorer[59995]: full_path: /mnt/Data/MIKE/Favorieten

May 23 00:52:20

nas4free

quixplorer[59995]: full_path: /mnt/Data/MIKE/config-nas4free.henrieweb-20140111212026.xml

May 23 00:52:20

nas4free

quixplorer[59995]: full_path: /mnt/Data/MIKE/router pa en ma.txt

May 23 00:52:20

nas4free

quixplorer[59995]: full_path: /mnt/Data/MIKE/kw405.mp3

May 23 00:52:20

nas4free

quixplorer[59995]: full_path: /mnt/Data/MIKE/FreeNAS__The_Free_NAS_Server.pdf

May 23 00:52:20

nas4free

quixplorer[59995]: full_path: /mnt/Data/MIKE/FreeNAS forum.7z

May 23 00:52:20

nas4free

quixplorer[59995]: full_path: /mnt/Data/MIKE/Henrie login.txt

May 23 00:52:20

nas4free

quixplorer[59995]: full_path: /mnt/Data/MIKE/Ovingon Theme Drupal 7.rar

May 23 00:52:20

nas4free

quixplorer[59995]: full_path: /mnt/Data/MIKE/Ovingon Theme Drupal 7

May 23 00:52:20

nas4free

quixplorer[59995]: full_path: /mnt/Data/MIKE/Ovingon Theme Joomla

May 23 00:52:20

nas4free

quixplorer[59995]: full_path: /mnt/Data/MIKE/Taxi Jaffna

May 23 00:52:20

nas4free

quixplorer[59995]: full_path: /mnt/Data/MIKE/Flatpress links.txt

May 23 00:52:20

nas4free

quixplorer[59995]: full_path: /mnt/Data/MIKE/BSD_04_2013.pdf

May 23 00:52:20

nas4free

quixplorer[59995]: full_path: /mnt/Data/MIKE/flatpress-1.0-solenne.rar

May 23 00:52:20

nas4free

quixplorer[59995]: full_path: /mnt/Data/MIKE/php-5.6.9.tar.bz2

May 23 00:52:20

nas4free

quixplorer[59995]: full_path: /mnt/Data/MIKE/Curriculum vitae m.zoon.doc

May 23 00:52:20

nas4free

quixplorer[59995]: full_path: /mnt/Data/MIKE/test.txt

May 23 00:52:20

nas4free

quixplorer[59995]: full_path: /mnt/Data/MIKE/wikiusers.csv

May 23 00:52:20

nas4free

quixplorer[59995]: full_path: /mnt/Data/MIKE/Weken Werknemers Werkpart 2012

May 23 00:52:20

nas4free

quixplorer[59995]: full_path: /mnt/Data/MIKE/test henrieweb

May 23 00:52:20

nas4free

quixplorer[59995]: full_path: /mnt/Data/MIKE/NAS4FREE VMWARE

May 23 00:52:20

nas4free

quixplorer[59995]: full_path: /mnt/Data/MIKE/NAS4Free Development

May 23 00:52:20

nas4free

quixplorer[59995]: full_path: /mnt/Data/MIKE/NAS4FREE Hosting

May 23 00:52:20

nas4free

quixplorer[59995]: full_path: /mnt/Data/MIKE/NAS4FREE backup

May 23 00:52:20

nas4free

quixplorer[59995]: full_path: /mnt/Data/MIKE/FREENAS DEVELOPMENT BACKUP

May 23 00:52:20

nas4free

quixplorer[59995]: full_path: /mnt/Data/MIKE/Complete CD's

May 23 00:52:20

nas4free

quixplorer[59995]: full_path: /mnt/Data/MIKE/PC Software

May 23 00:52:20

nas4free

quixplorer[59995]: full_path: /mnt/Data/MIKE/Photo's

May 23 00:52:20

nas4free

quixplorer[59995]: full_path: /mnt/Data/MIKE/.recycle

May 23 00:52:20

nas4free

quixplorer[59995]: full_path: /mnt/Data/MIKE/Games Update's

May 23 00:52:20

nas4free

quixplorer[59995]: full_path: /mnt/Data/MIKE/henri smit.txt

May 23 00:52:20

nas4free

quixplorer[59995]: full_path: /mnt/Data/MIKE/ANDROID

May 23 00:52:20

nas4free

quixplorer[59995]: full_path: /mnt/Data/MIKE/Coming Soon Website.rar

May 23 00:52:20

nas4free

quixplorer[59995]: full_path: /mnt/Data/MIKE/werk

May 23 00:52:20

nas4free

quixplorer[59995]: full_path: /mnt/Data/MIKE/SOURCE JETSTREAM

May 23 00:52:20

nas4free

quixplorer[59995]: full_path: /mnt/Data/MIKE/SOURCE ASPENNAS

May 23 00:52:20

nas4free

quixplorer[59995]: full_path: /mnt/Data/MIKE/Games

May 23 00:52:20

nas4free

quixplorer[59995]: full_path: /mnt/Data/MIKE/AV Software

May 23 00:52:20

nas4free

quixplorer[59995]: full_path: /mnt/Data/MIKE/BACKUP

May 23 00:52:20

nas4free

quixplorer[59995]: list_dir: displaying directory mnt/Data/MIKE

May 23 00:52:20

nas4free

quixplorer[59995]: system_filemanager.php: checking action list

May 23 00:52:20

nas4free

quixplorer[59995]: login(): session detected

May 23 00:52:20

nas4free

quixplorer[59995]: login required, checking login

May 23 00:52:20

nas4free

quixplorer[59995]: checking login

May 23 00:52:20

nas4free

quixplorer[59995]: xxx3 action: list//true

May 23 00:52:20

nas4free

quixplorer[59995]: xxx3 action: list//true

May 23 00:52:20

nas4free

quixplorer[59995]: Initializing ---------------------------------------------------

May 23 00:52:18

nas4free

quixplorer[59993]: full_path: /mnt/Data/.sujournal

May 23 00:52:18

nas4free

quixplorer[59993]: full_path: /mnt/Data/extensions

May 23 00:52:18

nas4free

quixplorer[59993]: full_path: /mnt/Data/.htusers.php

May 23 00:52:18

nas4free

quixplorer[59993]: full_path: /mnt/Data/log

May 23 00:52:18

nas4free

quixplorer[59993]: full_path: /mnt/Data/SHARE

May 23 00:52:18

nas4free

quixplorer[59993]: full_path: /mnt/Data/TRANSMISSION

May 23 00:52:18

nas4free

quixplorer[59993]: full_path: /mnt/Data/.recycle

May 23 00:52:18

nas4free

quixplorer[59993]: full_path: /mnt/Data/POPCORN

May 23 00:52:18

nas4free

quixplorer[59993]: full_path: /mnt/Data/WWW

May 23 00:52:18

nas4free

quixplorer[59993]: full_path: /mnt/Data/MIKE

May 23 00:52:18

nas4free

quixplorer[59993]: full_path: /mnt/Data/JANE

May 23 00:52:18

nas4free

quixplorer[59993]: full_path: /mnt/Data/fuppes.db

May 23 00:52:18

nas4free

quixplorer[59993]: full_path: /mnt/Data/.snap

May 23 00:52:18

nas4free

quixplorer[59993]: list_dir: displaying directory mnt/Data

May 23 00:52:18

nas4free

quixplorer[59993]: system_filemanager.php: checking action list

May 23 00:52:18

nas4free

quixplorer[59993]: login(): session detected

May 23 00:52:18

nas4free

quixplorer[59993]: login required, checking login

May 23 00:52:18

nas4free

quixplorer[59993]: checking login

May 23 00:52:18

nas4free

quixplorer[59993]: xxx3 action: list//true

May 23 00:52:18

nas4free

quixplorer[59993]: xxx3 action: list//true

May 23 00:52:18

nas4free

quixplorer[59993]: Initializing ---------------------------------------------------

May 23 00:52:16

nas4free

quixplorer[59991]: full_path: /mnt/Data

May 23 00:52:16

nas4free

quixplorer[59991]: list_dir: displaying directory mnt

May 23 00:52:16

nas4free

quixplorer[59991]: system_filemanager.php: checking action list

May 23 00:52:16

nas4free

quixplorer[59991]: login(): session detected

May 23 00:52:16

nas4free

quixplorer[59991]: login required, checking login

May 23 00:52:16

nas4free

quixplorer[59991]: checking login

May 23 00:52:16

nas4free

quixplorer[59991]: xxx3 action: list//true

May 23 00:52:16

nas4free

quixplorer[59991]: xxx3 action: list//true

May 23 00:52:16

nas4free

quixplorer[59991]: Initializing ---------------------------------------------------

May 23 00:52:14

nas4free

quixplorer[59989]: full_path: //entropy

May 23 00:52:14

nas4free

quixplorer[59989]: full_path: //home

May 23 00:52:14

nas4free

quixplorer[59989]: full_path: //tmp

May 23 00:52:14

nas4free

quixplorer[59989]: full_path: //conf

May 23 00:52:14

nas4free

quixplorer[59989]: full_path: //proc

May 23 00:52:14

nas4free

quixplorer[59989]: full_path: //var

May 23 00:52:14

nas4free

quixplorer[59989]: full_path: //sbin

May 23 00:52:14

nas4free

quixplorer[59989]: full_path: //root

May 23 00:52:14

nas4free

quixplorer[59989]: full_path: //mnt

May 23 00:52:14

nas4free

quixplorer[59989]: full_path: //libexec

May 23 00:52:14

nas4free

quixplorer[59989]: full_path: //lib

May 23 00:52:14

nas4free

quixplorer[59989]: full_path: //etc

May 23 00:52:14

nas4free

quixplorer[59989]: full_path: //dev

May 23 00:52:14

nas4free

quixplorer[59989]: full_path: //conf.default

May 23 00:52:14

nas4free

quixplorer[59989]: full_path: //ftmp

May 23 00:52:14

nas4free

quixplorer[59989]: full_path: //cf

May 23 00:52:14

nas4free

quixplorer[59989]: full_path: //bin

May 23 00:52:14

nas4free

quixplorer[59989]: full_path: //boot

May 23 00:52:14

nas4free

quixplorer[59989]: full_path: //usr

May 23 00:52:14

nas4free

quixplorer[59989]: full_path: //.snap

May 23 00:52:14

nas4free

quixplorer[59989]: list_dir: displaying directory

May 23 00:52:14

nas4free

quixplorer[59989]: system_filemanager.php: checking action list

May 23 00:52:14

nas4free

quixplorer[59989]: login(): session detected

May 23 00:52:14

nas4free

quixplorer[59989]: login required, checking login

May 23 00:52:14

nas4free

quixplorer[59989]: checking login

Thanks,

Michael

Van: Claudio Klingler [mailto:notifications@github.com] Verzonden: vrijdag 22 mei 2015 10:14 Aan: realtimeprojects/quixplorer CC: Dutchman01 Onderwerp: Re: [quixplorer] Fun_extra contains a bug for mimetypes Quixplorer Version 2.5.7 (#29)

Hi,

finally I did some investigations on this item. I cannot reproduce your problem with my configuration. In the list view, the mime type icons are displayed correctly.

The mime types are used in several places in quixplorer.

Could you please explain in detail, how your problem looks like? Which action do you do? What are you missing? What is displayed wrong?

In order to help finding the problem, I made a patch in the master branch which generates a debug message in your apache_error.log whenever get_mime_types() is called. If you can try one run with this version and send me the quixplorer log messages from your logfile, this would help find the problem. However, this patch does not fix the problem at all.

— Reply to this email directly or view it on GitHub https://github.com/realtimeprojects/quixplorer/issues/29#issuecomment-104560801 . https://github.com/notifications/beacon/ALbwDuTx3rCDUtfONwnAoQnOEqdeGpe2ks5oLtyugaJpZM4ECep8.gif

SomeAverageDev commented 8 years ago

Hello, great project ! I had the same "non working icons" issue, I think the problem is line 139 in fun_extra.php, $image and $mime_type are not defined (not with these names)

so replace, return array($mime_type, $image, $type); with return array($mime, $img, $type);

And it should work (it works for me) by the way, eregi is deprecated, and should be replaced by preg_match.

realtimeprojects commented 8 years ago

Should be closed by #32