Changeset 659 for devel/lib/uploadlib.php
- Timestamp:
- 10/21/06 20:56:09 (2 years ago)
- Files:
-
- devel/lib/uploadlib.php (modified) (22 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
devel/lib/uploadlib.php
r534 r659 107 107 $a->name = $this->files[$name]['originalname']; 108 108 $a->problem = $this->files[$name]['uploadlog']; 109 $msg = sprintf( gettext('Your file upload has failed because there was a problem with one of the files, %s.<br /> Here is a log of the problems:<br />%s<br />Not recovering.'), $a->name, $a->problem);109 $msg = sprintf(__gettext('Your file upload has failed because there was a problem with one of the files, %s.<br /> Here is a log of the problems:<br />%s<br />Not recovering.'), $a->name, $a->problem); 110 110 if (!$this->config->silent) { 111 111 notify($msg); … … 133 133 $a->oldname = $this->files[$name]['name']; 134 134 $a->newname = $newname; 135 $this->files[$name]['uploadlog'] .= sprintf( gettext('File was renamed from %s to %s because of invalid characters.'), $a->oldname, $a->newname);135 $this->files[$name]['uploadlog'] .= sprintf(__gettext('File was renamed from %s to %s because of invalid characters.'), $a->oldname, $a->newname); 136 136 } 137 137 $this->files[$name]['name'] = $newname; … … 162 162 } 163 163 if ($file['size'] > $this->config->maxbytes) { 164 $file['uploadlog'] .= "\n". sprintf( gettext('Sorry, but that file is too big (limit is %s)'), display_size($this->config->maxbytes));164 $file['uploadlog'] .= "\n". sprintf(__gettext('Sorry, but that file is too big (limit is %s)'), display_size($this->config->maxbytes)); 165 165 return false; 166 166 } … … 215 215 chmod($destination .'/'. $this->files[$i]['name'], $CFG->filepermissions); 216 216 $this->files[$i]['fullpath'] = $destination.'/'.$this->files[$i]['name']; 217 $this->files[$i]['uploadlog'] .= "\n". gettext('File uploaded successfully');217 $this->files[$i]['uploadlog'] .= "\n".__gettext('File uploaded successfully'); 218 218 $this->files[$i]['saved'] = true; 219 219 $exceptions[] = $this->files[$i]['name']; … … 230 230 $this->status = false; 231 231 if ((empty($this->config->allownull) && !empty($this->inputname)) || (empty($this->inputname) && empty($this->config->allownullmultiple))) { 232 notify( gettext('No file was found - are you sure you selected one to upload?'));232 notify(__gettext('No file was found - are you sure you selected one to upload?')); 233 233 } 234 234 return false; … … 266 266 } 267 267 if ($deletedsomething) { 268 $msg = gettext('The old file(s) in your upload area have been deleted');268 $msg = __gettext('The old file(s) in your upload area have been deleted'); 269 269 if (!$this->config->silent) { 270 270 notify($msg); … … 297 297 } 298 298 $a->newname = $file['name']; 299 $file['uploadlog'] .= "\n". sprintf( gettext('File was renamed from %s to %s because there was a filename conflict.'), $a->oldname, $a->newname);299 $file['uploadlog'] .= "\n". sprintf(__gettext('File was renamed from %s to %s because there was a filename conflict.'), $a->oldname, $a->newname); 300 300 } 301 301 } … … 338 338 case 0: // UPLOAD_ERR_OK 339 339 if ($file['size'] > 0) { 340 $errmessage = sprintf( gettext('An unknown problem occurred while uploading the file \'%s\' (perhaps it was too large?)'), $file['name']);340 $errmessage = sprintf(__gettext('An unknown problem occurred while uploading the file \'%s\' (perhaps it was too large?)'), $file['name']); 341 341 } else { 342 $errmessage = gettext('No file was found - are you sure you selected one to upload?'); /// probably a dud file name342 $errmessage = __gettext('No file was found - are you sure you selected one to upload?'); /// probably a dud file name 343 343 } 344 344 break; 345 345 346 346 case 1: // UPLOAD_ERR_INI_SIZE 347 $errmessage = gettext('Uploaded file exceeded the maximum size limit set by the server');347 $errmessage = __gettext('Uploaded file exceeded the maximum size limit set by the server'); 348 348 break; 349 349 350 350 case 2: // UPLOAD_ERR_FORM_SIZE 351 $errmessage = gettext('Uploaded file exceeded the maximum size limit set by the form');351 $errmessage = __gettext('Uploaded file exceeded the maximum size limit set by the form'); 352 352 break; 353 353 354 354 case 3: // UPLOAD_ERR_PARTIAL 355 $errmessage = gettext('File was only partially uploaded');355 $errmessage = __gettext('File was only partially uploaded'); 356 356 break; 357 357 358 358 case 4: // UPLOAD_ERR_NO_FILE 359 $errmessage = gettext('No file was found - are you sure you selected one to upload?');359 $errmessage = __gettext('No file was found - are you sure you selected one to upload?'); 360 360 break; 361 361 362 362 default: 363 $errmessage = sprintf( gettext('An unknown problem occurred while uploading the file \'%s\' (perhaps it was too large?)'), $file['name']);363 $errmessage = sprintf(__gettext('An unknown problem occurred while uploading the file \'%s\' (perhaps it was too large?)'), $file['name']); 364 364 } 365 365 return $errmessage; … … 375 375 continue; 376 376 } 377 $str .= '<strong>'. sprintf( gettext('Upload log for file %u'), $i+1) .' '377 $str .= '<strong>'. sprintf(__gettext('Upload log for file %u'), $i+1) .' ' 378 378 .((!empty($this->files[$key]['originalname'])) ? '('.$this->files[$key]['originalname'].')' : '') 379 379 .'</strong> :'. nl2br($this->files[$key]['uploadlog']) .'<br />'; … … 468 468 if ($uselabels) { 469 469 $lname = ((is_array($labelnames) && !empty($labelnames[$i])) ? $labelnames[$i] : 'LABEL_'.$i); 470 $str .= gettext('Title:').' <input type="text" size="50" name="'. $lname .'" alt="'. $lname470 $str .= __gettext('Title:').' <input type="text" size="50" name="'. $lname .'" alt="'. $lname 471 471 .'" /><br /><br />'."\n"; 472 472 } … … 507 507 clam_log_infected($file, $CFG->quarantinedir.'/'. $now .'-user-'. $userid .'-infected', $userid); 508 508 if ($basiconly) { 509 $notice .= "\n". gettext('The file has been moved to a quarantine directory.');509 $notice .= "\n". __gettext('The file has been moved to a quarantine directory.'); 510 510 } 511 511 else { 512 $notice .= "\n". sprintf( gettext('The file has been moved to your specified quarantine directory, the new location is %s'), $CFG->quarantinedir.'/'. $now .'-user-'. $userid .'-infected');512 $notice .= "\n". sprintf(__gettext('The file has been moved to your specified quarantine directory, the new location is %s'), $CFG->quarantinedir.'/'. $now .'-user-'. $userid .'-infected'); 513 513 } 514 514 } 515 515 else { 516 516 if ($basiconly) { 517 $notice .= "\n". gettext('The file has been deleted');517 $notice .= "\n". __gettext('The file has been deleted'); 518 518 } 519 519 else { 520 $notice .= "\n". sprintf( gettext('Could not move the file into your specified quarantine directory, %s. You need to fix this as files are being deleted if they\'re found to be infected.'), $CFG->quarantinedir);520 $notice .= "\n". sprintf(__gettext('Could not move the file into your specified quarantine directory, %s. You need to fix this as files are being deleted if they\'re found to be infected.'), $CFG->quarantinedir); 521 521 } 522 522 } … … 524 524 else { 525 525 if ($basiconly) { 526 $notice .= "\n". gettext('The file has been deleted');526 $notice .= "\n". __gettext('The file has been deleted'); 527 527 } 528 528 else { 529 $notice .= "\n". sprintf( gettext('Could not move the file into your specified quarantine directory, %s. You need to fix this as files are being deleted if they\'re found to be infected.'), $CFG->quarantinedir);529 $notice .= "\n". sprintf(__gettext('Could not move the file into your specified quarantine directory, %s. You need to fix this as files are being deleted if they\'re found to be infected.'), $CFG->quarantinedir); 530 530 } 531 531 } … … 533 533 if (unlink($file)) { 534 534 clam_log_infected($file, '', $userid); 535 $notice .= "\n". gettext('The file has been deleted');535 $notice .= "\n". __gettext('The file has been deleted'); 536 536 } 537 537 else { 538 538 if ($basiconly) { 539 539 // still tell the user the file has been deleted. this is only for admins. 540 $notice .= "\n". gettext('The file has been deleted');540 $notice .= "\n". __gettext('The file has been deleted'); 541 541 } 542 542 else { 543 $notice .= "\n". gettext('The file could not be deleted');543 $notice .= "\n". __gettext('The file could not be deleted'); 544 544 } 545 545 } … … 557 557 */ 558 558 function clam_replace_infected_file($file) { 559 $newcontents = gettext('This file that has been uploaded was found to contain a virus and has been moved or delted and the user notified.');559 $newcontents = __gettext('This file that has been uploaded was found to contain a virus and has been moved or delted and the user notified.'); 560 560 if (!$f = fopen($file, 'w')) { 561 561 return false; … … 593 593 if (!$CFG->pathtoclam || !file_exists($CFG->pathtoclam) || !is_executable($CFG->pathtoclam)) { 594 594 $newreturn = 1; 595 $notice = sprintf( gettext('Elgg is configured to run clam on file upload, but the path supplied to Clam AV, %s, is invalid.'), $CFG->pathtoclam);595 $notice = sprintf(__gettext('Elgg is configured to run clam on file upload, but the path supplied to Clam AV, %s, is invalid.'), $CFG->pathtoclam); 596 596 if ($CFG->clamfailureonupload == 'actlikevirus') { 597 $notice .= "\n". gettext('In addition, Elgg is configured so that if clam fails to run, files are treated like viruses. This essentially means that no student can upload a file successfully until you fix this.');597 $notice .= "\n". __gettext('In addition, Elgg is configured so that if clam fails to run, files are treated like viruses. This essentially means that no student can upload a file successfully until you fix this.'); 598 598 $notice .= "\n". clam_handle_infected_file($fullpath); 599 599 $newreturn = false; … … 601 601 clam_mail_admins($notice); 602 602 if ($appendlog) { 603 $file['uploadlog'] .= "\n". gettext('Your administrator has enabled virus checking for file uploads but has misconfigured something.<br />Your file upload was NOT successful. Your administrator has been emailed to notify them so they can fix it.<br />Maybe try uploading this file later.');603 $file['uploadlog'] .= "\n". __gettext('Your administrator has enabled virus checking for file uploads but has misconfigured something.<br />Your file upload was NOT successful. Your administrator has been emailed to notify them so they can fix it.<br />Maybe try uploading this file later.'); 604 604 $file['clam'] = 1; 605 605 } … … 619 619 case 1: // bad wicked evil, we have a virus. 620 620 $info->user = $USER->name; 621 $notice = sprintf( gettext('Attention administrator! Clam AV has found a virus in a file uploaded by %s. Here is the output of clamscan:'), $info->user);621 $notice = sprintf(__gettext('Attention administrator! Clam AV has found a virus in a file uploaded by %s. Here is the output of clamscan:'), $info->user); 622 622 $notice .= "\n\n". implode("\n", $output); 623 623 $notice .= "\n\n". clam_handle_infected_file($fullpath); … … 625 625 if ($appendlog) { 626 626 $info->filename = $file['originalname']; 627 $file['uploadlog'] .= "\n". sprintf( gettext('The file you have uploaded, %s, has been scanned by a virus checker and found to be infected! Your file upload was NOT successful.'), $info->filename);627 $file['uploadlog'] .= "\n". sprintf(__gettext('The file you have uploaded, %s, has been scanned by a virus checker and found to be infected! Your file upload was NOT successful.'), $info->filename); 628 628 $file['virus'] = 1; 629 629 } … … 631 631 default: 632 632 // error - clam failed to run or something went wrong 633 $notice .= sprintf( gettext('Clam AV has failed to run. The return error message was %s. Here is the output from Clam:'), get_clam_error_code($return));633 $notice .= sprintf(__gettext('Clam AV has failed to run. The return error message was %s. Here is the output from Clam:'), get_clam_error_code($return)); 634 634 $notice .= "\n\n". implode("\n", $output); 635 635 $newreturn = true; … … 640 640 clam_mail_admins($notice); 641 641 if ($appendlog) { 642 $file['uploadlog'] .= "\n". gettext('Your administrator has enabled virus checking for file uploads but has misconfigured something.<br />Your file upload was NOT successful. Your administrator has been emailed to notify them so they can fix it.<br />Maybe try uploading this file later.');642 $file['uploadlog'] .= "\n". __gettext('Your administrator has enabled virus checking for file uploads but has misconfigured something.<br />Your file upload was NOT successful. Your administrator has been emailed to notify them so they can fix it.<br />Maybe try uploading this file later.'); 643 643 $file['clam'] = 1; 644 644 } … … 656 656 global $CFG; 657 657 658 $subject = sprintf( gettext('%s :: Clam AV notification'), $CFG->sitename);658 $subject = sprintf(__gettext('%s :: Clam AV notification'), $CFG->sitename); 659 659 $user = new StdClass; 660 660 $user->email = $CFG->sysadminemail; 661 $user->name = $CFG->sitename.' '. gettext('Administrator');661 $user->name = $CFG->sitename.' '.__gettext('Administrator'); 662 662 email_to_user($user,$user,$subject,$notice); 663 663 /* … … 700 700 if ($returncodes[$returncode]) 701 701 return $returncodes[$returncode]; 702 return gettext('There was an unknown error with clam.');702 return __gettext('There was an unknown error with clam.'); 703 703 704 704 }
