Changeset 3888


Ignore:
Timestamp:
03/22/11 18:15:51 (13 years ago)
Author:
alexandrecorreia
Message:

Ticket #1580 - Mensagem de erro pouco amigável para arquivos grandes

Location:
branches/2.2/filemanager
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2/filemanager/inc/class.uifilemanager.inc.php

    r3885 r3888  
    3232                 'dir_ls' => True, 
    3333                 'search' => True, 
     34                 'setFileMaxSize' => True, 
    3435                 'get_folders_list' => True, 
    3536                 'showUploadboxes' => True, 
     
    455456        } 
    456457 
     458        function setFileMaxSize() 
     459        { 
     460                $maxSize        = $_POST['maxFileSize']; 
     461                $file           = "setFileMaxSize.php"; 
     462                $writeFile = "<?php $"."SET_FILE_MAX_SIZE="."\"".base64_encode(serialize($maxSize))."\""." ?>"; 
     463                $filename = dirname(__FILE__).'/'.$file; 
     464                $content = $writeFile; 
     465                         
     466                if ( !$handle = fopen($filename, 'w+') ) 
     467                        return false; 
     468                 
     469                if (fwrite($handle, $content) === FALSE) 
     470                        return false; 
     471 
     472                fclose($handle); 
     473                 
     474                return true; 
     475        } 
     476 
    457477        function get_permissions() { 
    458478                /* get permissions */ 
  • branches/2.2/filemanager/js/common_functions.js

    r3879 r3888  
    2929{ 
    3030        element.firstChild.firstChild.checked = true; 
     31} 
     32 
     33function maxFileSize() 
     34{ 
     35        if( arguments.length > 0 ) 
     36        { 
     37                var _document           = arguments[0]; 
     38                var _maxFileSize                = ""; 
     39                 
     40                for(var i = 0 ;  i < _document.forms[0].elements.length ; i++ ) 
     41                { 
     42                        if( _document.forms[0].elements[i].type == "text" ) 
     43                        {        
     44                                var _name = (_document.forms[0].elements[i].name).toLowerCase(); 
     45                                 
     46                                if( _name.indexOf('filemanager_max_file_size') > - 1 ) 
     47                                        _maxFileSize = trim(_document.forms[0].elements[i].value); 
     48                        } 
     49                } 
     50                 
     51                var handlerSubmit = function(data) 
     52                { 
     53                        _document.forms[0].submit.click(); 
     54                } 
     55                 
     56                if( _maxFileSize != '' ) 
     57                { 
     58                        cExecute_( './index.php?menuaction=filemanager.uifilemanager.setFileMaxSize', handlerSubmit,'maxFileSize=' + _maxFileSize ); 
     59                } 
     60                else 
     61                { 
     62                        alert('É necessário informar um valor !'); 
     63                        return false; 
     64                } 
     65        } 
     66} 
     67 
     68function trim(inputString) 
     69{ 
     70        if ( typeof inputString != "string" ) 
     71                return inputString; 
     72 
     73        var retValue    = inputString; 
     74        var ch          = retValue.substring(0, 1); 
     75         
     76        while (ch == " ")  
     77        { 
     78                retValue = retValue.substring(1, retValue.length); 
     79                ch = retValue.substring(0, 1); 
     80        } 
     81         
     82        ch = retValue.substring(retValue.length-1, retValue.length); 
     83         
     84        while (ch == " ")  
     85        { 
     86                retValue = retValue.substring(0, retValue.length-1); 
     87                ch = retValue.substring(retValue.length-1, retValue.length); 
     88        } 
     89         
     90        while (retValue.indexOf("  ") != -1)  
     91        { 
     92                retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); 
     93        } 
     94         
     95        return retValue; 
    3196} 
    3297 
Note: See TracChangeset for help on using the changeset viewer.