Changeset 3610 for branches/2.2/filemanager/inc/upload.php
- Timestamp:
- 12/20/10 17:42:25 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2/filemanager/inc/upload.php
r3415 r3610 1 1 <?php 2 2 3 require_once '../../header.session.inc.php'; 4 3 5 /* This single file is used to increase upload_max_filesize and post_max_size using .htaccess*/ 4 6 if(!isset($GLOBALS['phpgw_info'])){ … … 19 21 $path = $_POST['path']; 20 22 $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 26 function create_summaryImage($file) 27 { 24 28 list($width, $height,$image_type) = getimagesize($file); 29 25 30 switch($image_type) 26 31 { 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 39 45 $max_resolution = 48; 40 if ($width > $height){ 46 47 if ($width > $height) 48 { 41 49 $new_width = $max_resolution; 42 50 $new_height = $height*($new_width/$width); 43 51 } 44 else { 52 else 53 { 45 54 $new_height = $max_resolution; 46 55 $new_width = $width*($new_height/$height); 47 56 } 57 48 58 $image_new = imagecreatetruecolor($new_width, $new_height); 49 59 imagecopyresampled($image_new, $image_big, 0, 0, 0, 0, $new_width, $new_height, $width, $height); … … 59 69 $command = "nice -n19 ".$current_config['filemanager_antivirus_command']; 60 70 for($i = 0; $i != $show_upload_boxes; $i++) 71 { 61 72 $command .= " ".$_FILES['upload_file']['tmp_name'][$i]; 62 $return=0; 73 } 74 75 $return = 0; 76 63 77 exec("bash -c ".escapeshellcmd(escapeshellarg($command)),$output,$return); 78 64 79 if ($return == 1) 65 80 { … … 70 85 71 86 if($path != '/') 87 { 72 88 for($i = 0; $i != $show_upload_boxes; $i++) 73 89 { … … 184 200 } 185 201 } 186 187 if(count($notifUser) > 0) 202 } 203 204 if( count($notifUser) > 0 ) 188 205 { 189 206 define('PHPGW_INCLUDE_ROOT','../../'); … … 200 217 $mail->FromName = $GLOBALS['phpgw_info']['user']['fullname']; 201 218 $mail->IsHTML(true); 202 foreach ($notifUser as $userMail) 219 220 foreach( $notifUser as $userMail ) 203 221 { 204 222 $mail->AddAddress($userMail); 205 223 $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 { 211 238 $return[] = $mail->ErrorInfo; 212 239 } 213 240 } 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 221 248 ?>
Note: See TracChangeset
for help on using the changeset viewer.