Changeset 1865


Ignore:
Timestamp:
12/17/09 10:56:50 (14 years ago)
Author:
amuller
Message:

Ticket #597 - Melhoria do FM, Implementação do arquivamento

Location:
sandbox/filemanager
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • sandbox/filemanager/inc/class.vfs_functions.inc.php

    r1854 r1865  
    2727                        'delete'=>True, 
    2828                        'archive'=>True, 
     29                        'unarchive'=>True, 
    2930                        'summary' => True 
    3031                ); 
     
    294295                        $this->delete(); 
    295296                } 
     297                function unarchive(){ 
     298                        $command = escapeshellarg($this->file); 
     299                        if (strlen($this->pswd) > 0){ 
     300                                $command = " -P ".(base64_decode($this->pswd) ^ $this->path)." ".$command; 
     301                        } 
     302 
     303                        exec("cd ".escapeshellarg($this->bo->vfs->basedir.$this->path).";".escapeshellcmd("nice -n19 unzip ".$command),$output, $return_var); 
     304                        exec("history -c"); // privacy is good, we dont want get passwords! 
     305 
     306                        if ($return_var == 9 || $return_var == 5 || $return_var == 82){ 
     307                                echo "wpasswd:$command"; 
     308                                return false; 
     309                        }else if($return_var > 1){ 
     310                                echo "False:"; 
     311                        } 
     312 
     313                        $this->fileman[] = $this->file; 
     314                        $this->delete(); 
     315                        $this->bo->vfs->update_real(array( 
     316                                        'string'        => $this->path, 
     317                                        'relatives'     => array(RELATIVE_NONE) 
     318                                )); 
     319                } 
    296320                function editComment() 
    297321                { 
  • sandbox/filemanager/js/common_functions.js

    r1846 r1865  
    7979        } 
    8080} 
    81  
     81function crypt(data1,data2){ 
     82        ret = ""; 
     83        for (var i=0;i < data1.length; i++) 
     84        { 
     85                ret += String.fromCharCode(data1.charCodeAt(i) ^ data2.charCodeAt(i)); 
     86        } 
     87        return ret; 
     88} 
    8289/* 
    8390 * base64.js - Base64 encoding and decoding functions 
  • sandbox/filemanager/js/draw_api.js

    r1854 r1865  
    236236                        retBuff += '<td></td>'; 
    237237 
    238                 if (file.mime == 'text/html') 
    239                         retBuff += '<td><a href="./index.php?menuaction=filemanager.uifilemanager.export&file='+base64_encode(file.name)+'&path='+base64_encode(currentPath)+'"><img alt="'+get_lang('export')+'" title="'+get_lang('export')+'" src="'+templatePath+'images/button_export.png"></a></td>'; 
    240                 else 
    241                         retBuff += '<td></td>'; 
     238                switch (file.mime) 
     239                { 
     240                        case 'text/html': 
     241                                retBuff += '<td><a href="./index.php?menuaction=filemanager.uifilemanager.export&file='+base64_encode(file.name)+'&path='+base64_encode(currentPath)+'"><img alt="'+get_lang('export')+'" title="'+get_lang('export')+'" src="'+templatePath+'images/button_export.png"></a></td>'; 
     242                                break; 
     243                        case 'application/zip': 
     244                                retBuff += '<td><a href="javascript:unarchive(\''+file.name+'\')"><img alt="'+get_lang('unarchive')+'" title="'+get_lang('unarchive')+'" src="'+templatePath+'images/button_export.png"></a></td>' 
     245                                break; 
     246                        default: 
     247                                retBuff += '<td></td>'; 
     248                } 
    242249                retBuff += fl.td+'<img src="'+(file.icon)+'">'; 
    243250                if((file.mime).toUpperCase().indexOf('IMAGE') == 0) 
     
    481488                        } 
    482489                        password = prompt(get_lang('Please, type a strong password (suggestion: at least 8 characters, letters and numbers) or leave it empty to archive only')); 
     490                        if (password == null) 
     491                                return; 
    483492                        if (password.length > 0) 
    484493                        { 
     
    491500                        } 
    492501                        // TODO use DES, or something strong 
    493                         pswd = ""; 
    494                         for (var i=0;i < password.length; i++) 
    495                         { 
    496                                 pswd += String.fromCharCode(password.charCodeAt(i) ^ currentPath.charCodeAt(i)); 
    497                         } 
     502                        var pswd = crypt(password,currentPath); 
    498503                        cExecute('./index.php?menuaction=filemanager.vfs_functions.archive&pswd='+base64_encode(pswd.toString())+'&path='+base64_encode(currentPath)+filesUrl,handler.archive); 
    499504                        break; 
     
    575580var toolbar = new toolbar(); 
    576581 
     582function unarchive(filename){ 
     583        password = prompt(get_lang('Please, type archive password or leave it empty if it is not encrypted')); 
     584        if (password == null) 
     585                return; 
     586        var pswd = crypt(password,currentPath); 
     587        cExecute('./index.php?menuaction=filemanager.vfs_functions.unarchive&pswd='+base64_encode(pswd)+'&path='+base64_encode(currentPath)+'&file='+base64_encode(filename),handler.archive); 
     588} 
    577589 
    578590function draw_card(filename){ 
     
    590602                menu.width = "100%"; 
    591603                menu.innerHTML = '<img src="'+url+'">'; 
    592                 menu.onmouseout = function () { menuTimeout = setTimeout("document.getElementById('menu_newFile"+id+"').style.visibility = 'hidden'",50);} 
     604                menu.onmouseout = function () { menuTimeout = setTimeout("var e=document.getElementById('menu_newFile"+id+"');if(e!=null) e.style.visibility = 'hidden'",50);} 
    593605                menu.onmouseover = function () { clearTimeout(menuTimeout); }; 
    594606                menu.style.zIndex='1'; 
     
    603615        menu.style.visibility = 'visible'; 
    604616        clearTimeout(menuTimeout); 
    605         menuTimeout = setTimeout("document.getElementById('menu_newFile"+id+"').style.visibility = 'hidden'",3000); 
    606 } 
    607  
     617        menuTimeout = setTimeout("var e=document.getElementById('menu_newFile"+id+"'); if (e!=null) e.style.visibility = 'hidden'",2000); 
     618} 
     619 
  • sandbox/filemanager/js/handler.js

    r1854 r1865  
    8686} 
    8787handler.prototype.archive = function(data) { 
     88        returnVal = data.split(':'); 
     89        if (returnVal[0] == 'False') 
     90        { 
     91                write_error(get_lang('It was not possible to execute it')); 
     92        } 
     93        else 
     94        if (returnVal[0] == 'wpasswd') 
     95        { 
     96                write_error(get_lang('Wrong password')); 
     97                return; 
     98        } 
     99        else 
     100                 write_msg(get_lang('Your operation was successfully executed')); 
    88101        toolbar.control('reload'); 
     102 
    89103} 
    90104 
  • sandbox/filemanager/setup/phpgw_pt-br.lang

    r1854 r1865  
    9595Files moved to %1 successfuly   filemanager     pt-br   Arquivos movidos para %1 com sucesso 
    9696Archive filemanager     pt-br   Arquivar 
     97Your operation was successfully executed        filemanager     pt-br   Sua operação foi executada com sucesso 
     98Wrong password  filemanager     pt-br   Senha errada 
     99It was not possible to execute it       filemanager     pt-br   Pelo menos um erro houve na operação 
     100Please, type archive password or leave it empty if it is not encrypted  filemanager     pt-br   Por favor digite a senha, ou deixe em branco caso o arquivo não seja protegido por senha 
    97101no files in this directory.     filemanager     pt-br   Nenhum arquivo nesse diretório 
    98102no version history for this file/directory      filemanager     pt-br   Sem histórico de versão para este arquivo/pasta 
Note: See TracChangeset for help on using the changeset viewer.