Responsive FileManager com PHP8

Responsive FileManager com PHP8
Author: Eurai
Inclusão: 27/10/2021
Alteração: 31/10/2021

 

Após atualização para o PHP8, houveram alguns erros no responsiveFileManager. Buscando na internet, achei as correções para os arquivos e uma delas alterei.

Arquivo: filemanager\config\config.php

// mb_http_input('UTF-8');

mb_http_input();

 

Arquivo: filemanager\UploadHandler.php

Linha 495:

        // Keep an existing filename if this is part of a chunked upload:

        // $uploaded_bytes = $this->fix_integer_overflow((int)$content_range[1]);

        // while (is_file($this->get_upload_path($name))) {

        //     if ($uploaded_bytes === $this->get_file_size(

        //             $this->get_upload_path($name))) {

        //         break;

        //     }

        //     $name = $this->upcount_name($name);

        // }

        // return $name;

       // Keep an existing filename if this is part of a chunked upload:  



        if(isset($content_range[1])){

            $uploaded_bytes = $this->fix_integer_overflow((int)$content_range[1]);

       }



       while (is_file($this->get_upload_path($name))) {

           if(isset($uploaded_bytes)){

           if ($uploaded_bytes === $this->get_file_size(

                   $this->get_upload_path($name))) {

               break;

           }

           }

           $name = $this->upcount_name($name);

       }



       return $name;    

 

 

Linha 1460:

       // $response = array($this->options['param_name'] => $files);

        // $name = $file_name ? $file_name : $upload['name'][0];

        // $res = $this->generate_response($response, $print_response);

        // if(is_file($this->get_upload_path($name))){

        //     $uploaded_bytes = $this->fix_integer_overflow((int)$content_range[1]);

        //     $totalSize = $this->get_file_size($this->get_upload_path($name));

        //     if ($totalSize - $uploaded_bytes - $this->options['readfile_chunk_size'] < 0) {

        //         $this->onUploadEnd($res);

        //     }else{

        //         $this->head();

        //         $this->body(json_encode($res));

        //     }

        // }else{

        //     $this->head();

        //     $this->body(json_encode($res));

        // }

        // return $res;



      

        $response = array($this->options['param_name'] => $files);

        $name = $file_name ? $file_name : $upload['name'][0];

        $res = $this->generate_response($response, $print_response);

        if(is_file($this->get_upload_path($name))){

            if(isset($content_range[1])){

             $uploaded_bytes = $this->fix_integer_overflow((int)$content_range[1]);

            }

            else{

             $uploaded_bytes = 0;

            }

            $totalSize = $this->get_file_size($this->get_upload_path($name));

        

        

            if ($totalSize - $uploaded_bytes - $this->options['readfile_chunk_size'] < 0) {

        

                   $this->onUploadEnd($res);

        

            }else{

                $this->head();

                $this->body(json_encode($res));

            }

        }else{

            $this->head();

            $this->body(json_encode($res));

        }

        return $res;    

 

 

 

Arquivo: filemanager\config\dialog.php

Linha 693:

 

 

function filenameSort($x, $y)
{
    global $descending;

    if ($x['is_dir'] !== $y['is_dir']) {
        // return $y['is_dir'];
        return 0;
    } else {
        return ($descending)
            ? ($x['file_lcase'] < $y['file_lcase']?1:-1)
            : ($x['file_lcase'] >= $y['file_lcase']?-1:1);
    }
}

function dateSort($x, $y)
{
    global $descending;

    if ($x['is_dir'] !== $y['is_dir']) {
        // return $y['is_dir'];
        return 0;
    } else {
        return ($descending)
            ? ($x['date'] < $y['date']?1:-1)
            : ($x['date'] >= $y['date']?-1:1);
    }
}

function sizeSort($x, $y)
{
    global $descending;

    if ($x['is_dir'] !== $y['is_dir']) {
        // return $y['is_dir'];
        return 0;
    } else {
        return ($descending)
            ? ($x['size'] < $y['size']?1:-1)
            : ($x['size'] >= $y['size']?-1:1);
    }
}

function extensionSort($x, $y)
{
    global $descending;

    if ($x['is_dir'] !== $y['is_dir']) {
        // return $y['is_dir'];
        return 0;
    } else {
        return ($descending)
            ? ($x['extension'] < $y['extension']?1:-1)
            : ($x['extension'] >= $y['extension']?-1:1);
    }
} 

 

 

 

Complemento: A função uSort agora trabalha com o retorno em inteiro ao invés de bollean.

 

Fonte:

 

Gostou? Compartilhe com seus amigos e deixe um comentário! 😎

Um abraço, e até a próxima  

 

 

 

 

 

Esse conteúdo te ajudou? Ajude o canal com doação
Compartilhar
Comentários