Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. /**
  2.  * Upload function will be called via the Flash uploader
  3.  *
  4.  * @class nggAdmin
  5.  * @param integer $galleryID
  6.  * @return string $result
  7.  */
  8. function swfupload_image($galleryID = 0) {
  9.  
  10.         global $nggdb;
  11.  
  12.         if ($galleryID == 0)
  13.                 return __('No gallery selected !', 'nggallery');
  14.  
  15.         // WPMU action
  16.         if (nggWPMU::check_quota())
  17.                 return '0';
  18.  
  19.         // Check the upload
  20.         if (!isset($_FILES['Filedata']) || !is_uploaded_file($_FILES['Filedata']['tmp_name']) || $_FILES['Filedata']['error'] != 0)
  21.                 return __('Invalid upload. Error Code : ', 'nggallery') . $_FILES['Filedata']['error'];
  22.  
  23.  [... snip ...]
  24.  
  25.         $dest_file = WINABSPATH . $gallery->path . '/' . $filename;
  26.  
  27.         // save temp file to gallery
  28.         if ( !@move_uploaded_file($_FILES["Filedata"]['tmp_name'], $dest_file) ){
  29.                 nggAdmin::check_safemode(WINABSPATH . $gallery->path);
  30.                 return __('Error, the file could not be moved to : ','nggallery'). esc_html( $dest_file );
  31.         }
  32.  
  33.         if ( !nggAdmin::chmod($dest_file) )
  34.                 return __('Error, the file permissions could not be set','nggallery');
  35.  
  36.         return '0';
  37. }