예제 #1
0
 /**
  * Code to run after saving
  *
  * @param	boolean	Do the query?
  *
  * @return	boolean	Whether this code executed correctly
  *
  */
 function post_save_each($doquery = true)
 {
     $failed = false;
     $failed_full = false;
     require_once DIR . '/includes/functions_album.php';
     $picture = array_merge($this->existing, $this->picture);
     // Check for filedata in an information field
     if (!empty($this->info['filedata'])) {
         $filename = verify_picture_fs_path($picture, false) ? fetch_picture_fs_path($picture, false) : '';
         if ($filename and $fp = fopen($filename, 'wb')) {
             if (!fwrite($fp, $this->info['filedata'])) {
                 $failed = true;
                 $failed_full = true;
             }
             fclose($fp);
             #remove possible existing thumbnail in case no thumbnail is written in the next step.
             $thumb_path = fetch_picture_fs_path($picture, true);
             if (file_exists($thumb_path)) {
                 @unlink($thumb_path);
             }
         } else {
             $failed = true;
         }
     }
     if (!$failed and !empty($this->info['thumbnail'])) {
         // write out thumbnail now
         $filename = verify_picture_fs_path($picture, true) ? fetch_picture_fs_path($picture, true) : '';
         if ($filename and $fp = fopen($filename, 'wb')) {
             if (!fwrite($fp, $this->info['thumbnail'])) {
                 $failed = true;
             }
             fclose($fp);
         } else {
             $failed = true;
         }
     }
     parent::post_save_each($doquery);
     if ($failed) {
         if ($this->condition === null) {
             $this->condition = "pictureid = " . $this->fetch_field('pictureid');
             $this->log = false;
             $this->delete();
         }
         $this->error('upload_copyfailed', '', $failed_full ? fetch_picture_fs_path($picture) : fetch_picture_fs_path($picture, true));
         return false;
     } else {
         return true;
     }
 }
예제 #2
0
파일: album.php 프로젝트: holandacz/nb4
         }
     } else {
         if ($vbulletin->GPC['type_old'] == 'fs_directthumb' and $vbulletin->GPC['type_new'] == 'fs') {
             $pic_dir = fetch_picture_fs_path($picture, false, false);
             $thumb_path = fetch_picture_fs_path($picture, true);
             if (file_exists($thumb_path)) {
                 if (!@copy($thumb_path, $pic_dir . '/' . basename($thumb_path))) {
                     $picerror = true;
                 }
             }
         } else {
             if ($vbulletin->GPC['type_old'] == 'fs' and $vbulletin->GPC['type_new'] == 'fs_directthumb') {
                 $old_thumb_path = fetch_picture_fs_path($picture, true);
                 if (file_exists($old_thumb_path)) {
                     $vbulletin->options['album_dataloc'] = $vbulletin->GPC['type_new'];
                     verify_picture_fs_path($picture, true);
                     if (!@copy($old_thumb_path, fetch_picture_fs_path($picture, true))) {
                         $picerror = true;
                     }
                     $vbulletin->options['album_dataloc'] = $vbulletin->GPC['type_old'];
                 }
             } else {
                 print_stop_message('please_complete_required_fields');
             }
         }
     }
 }
 if ($vbulletin->debug) {
     $print_cap = substr($picture['caption'], 0, 35) . (strlen($picture['caption']) > 35 ? '...' : '');
     if ($print_cap === '') {
         $print_cap = ' ';