Ignore:
Timestamp:
12/20/10 17:42:25 (13 years ago)
Author:
alexandrecorreia
Message:

Ticket #1395 - Padronizacao das janelas do filemanager com as do Expresso ( Envio de arquivo e mensagens ).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2/filemanager/inc/upload.php

    r3415 r3610  
    11<?php 
     2 
    23require_once '../../header.session.inc.php'; 
     4 
    35/* This single file is used to increase upload_max_filesize and post_max_size using .htaccess*/ 
    46if(!isset($GLOBALS['phpgw_info'])){ 
     
    1921$path = $_POST['path']; 
    2022$notifUser = $_POST['notifTo']; 
    21 $show_upload_boxes = count($_FILES['upload_file']['name'])-1; 
    22  
    23 function create_summaryImage($file){ 
     23$show_upload_boxes = count($_FILES['upload_file']['name']); 
     24$filesUpload = $_FILES['upload_file']; 
     25 
     26function create_summaryImage($file) 
     27{ 
    2428        list($width, $height,$image_type) = getimagesize($file); 
     29 
    2530        switch($image_type) 
    2631        { 
    27         case 1: 
    28                 $image_big = imagecreatefromgif($file); 
    29                 break; 
    30         case 2: 
    31                 $image_big = imagecreatefromjpeg($file); 
    32                 break; 
    33         case 3: 
    34                 $image_big = imagecreatefrompng($file); 
    35                 break; 
    36         default: 
    37                 return false; 
    38         } 
     32                case 1: 
     33                        $image_big = imagecreatefromgif($file); 
     34                        break; 
     35                case 2: 
     36                        $image_big = imagecreatefromjpeg($file); 
     37                        break; 
     38                case 3: 
     39                        $image_big = imagecreatefrompng($file); 
     40                        break; 
     41                default: 
     42                        return false; 
     43        } 
     44 
    3945        $max_resolution = 48; 
    40         if ($width > $height){ 
     46 
     47        if ($width > $height) 
     48        { 
    4149                $new_width = $max_resolution; 
    4250                $new_height = $height*($new_width/$width); 
    4351        } 
    44         else { 
     52        else  
     53        { 
    4554                $new_height = $max_resolution; 
    4655                $new_width = $width*($new_height/$height); 
    4756        } 
     57         
    4858        $image_new = imagecreatetruecolor($new_width, $new_height); 
    4959        imagecopyresampled($image_new, $image_big, 0, 0, 0, 0, $new_width, $new_height, $width, $height); 
     
    5969        $command = "nice -n19 ".$current_config['filemanager_antivirus_command']; 
    6070        for($i = 0; $i != $show_upload_boxes; $i++) 
     71        { 
    6172                $command .= " ".$_FILES['upload_file']['tmp_name'][$i]; 
    62         $return=0; 
     73        } 
     74         
     75        $return = 0; 
     76         
    6377        exec("bash -c ".escapeshellcmd(escapeshellarg($command)),$output,$return); 
     78         
    6479        if ($return == 1) 
    6580        { 
     
    7085 
    7186if($path != '/') 
     87{ 
    7288        for($i = 0; $i != $show_upload_boxes; $i++) 
    7389        { 
     
    184200                } 
    185201        } 
    186  
    187 if(count($notifUser) > 0) 
     202} 
     203 
     204if( count($notifUser) > 0 ) 
    188205{ 
    189206        define('PHPGW_INCLUDE_ROOT','../../'); 
     
    200217        $mail->FromName = $GLOBALS['phpgw_info']['user']['fullname']; 
    201218        $mail->IsHTML(true); 
    202         foreach ($notifUser as $userMail) 
     219         
     220        foreach( $notifUser as $userMail ) 
    203221        { 
    204222                $mail->AddAddress($userMail); 
    205223                $mail->Subject = lang("Filemanager notification"); 
    206                 $mail->Body = lang("The user %1, sent the file \"%2\" (type %3) and asked to notify you.",$GLOBALS['phpgw_info']['user']['fullname'],$_FILES['upload_file']['name'][0],$_FILES['upload_file']['type'][0])."<br>"; 
    207                 $mail->Body .= lang("Comments by user: %1",$_POST['upload_comment'][0])."<br>"; 
    208                 $mail->Body .= lang("The file can be accessed by: %1","<a href=\"".$GLOBALS['phpgw']->link("index.php").">link</a><br>"); 
    209 //              $mail->Body .= lang("The file can be accessed by: %1","<a href=\"".$GLOBALS['phpgw']->link("../index.php","menuaction=filemanager.uifilemanager.view&file=" . urlencode(base64_encode($_FILES['upload_file']['name'][0]))."&path=".urlencode(base64_encode($path)))."\">link</a><br>"); 
    210                 if(!$mail->Send()) { 
     224                 
     225                $body  = "<div style='font-size: 9pt !important;'>";  
     226                $body .= lang("The user %1 sent the following files", "<span style='font-weight: bold;'>" . $GLOBALS['phpgw_info']['user']['fullname'] . "</span>") . "<br/><br/>"; 
     227 
     228                foreach( $filesUpload['name'] as $key => $name )  
     229                        $body .= "<div style='font-weight: bold;'> - " . $name ." ( " . $filesUpload['type'][$key] . " )</div>"; 
     230 
     231                $body  .= "<div style='margin-top:25px;'>".lang("To view the files %1", "<a href='../filemanager/index.php'>".lang("Click here")."</a>")."</div>"; 
     232                $body  .= "</div>"; 
     233                 
     234                $mail->Body = $body; 
     235                 
     236                if( !$mail->Send() ) 
     237                { 
    211238                        $return[] = $mail->ErrorInfo; 
    212239                } 
    213240        } 
    214 } 
    215  
    216 if (count($return) > 0){ 
    217                 $_SESSION['response'] = serialize($return); 
    218 } 
    219         else 
    220                  $_SESSION['response'] = serialize( array( 0 => 'Ok' ) ); 
     241         
     242        unset( $filesUpload ); 
     243         
     244} 
     245 
     246$_SESSION['response'] = ( count($return) > 0 ) ? serialize($return) : serialize( array( 0 => 'Ok' ) );  
     247 
    221248?> 
Note: See TracChangeset for help on using the changeset viewer.