/**
  * @see	\wcf\data\IEditableObject::deleteAll()
  */
 public static function deleteAll(array $objectIDs = array())
 {
     $list = new NewsPictureList();
     $list->setObjectIDs($objectIDs);
     $list->readObjects();
     foreach ($list as $object) {
         $editor = new NewsPictureEditor($object);
         $editor->deletePicture();
     }
     return parent::deleteAll($objectIDs);
 }
 /**
  * Handles uploaded files.
  */
 public function upload()
 {
     // save files
     $files = $this->parameters['__files']->getFiles();
     $file = $files[0];
     try {
         if (!$file->getValidationErrorType()) {
             $data = array('title' => $file->getFilename(), 'fileExtension' => $file->getFileExtension(), 'fileType' => $file->getMimeType(), 'fileHash' => sha1_file($file->getLocation()), 'filesize' => $file->getFilesize(), 'uploadTime' => TIME_NOW);
             // save file
             $picture = NewsPictureEditor::create($data);
             // move uploaded file
             if (@copy($file->getLocation(), $picture->getLocation())) {
                 @unlink($file->getLocation());
                 // return result
                 return array('pictureID' => $picture->pictureID, 'title' => $picture->title, 'filesize' => $picture->filesize, 'formattedFilesize' => FileUtil::formatFilesize($picture->filesize), 'url' => $picture->getURL());
             } else {
                 // moving failed; delete file
                 $editor = new NewsPictureEditor($picture);
                 $editor->delete();
                 throw new UserInputException('picture', 'uploadFailed');
             }
         }
     } catch (UserInputException $e) {
         $file->setValidationErrorType($e->getType());
     }
     return array('errorType' => $file->getValidationErrorType());
 }