Ignore:
Timestamp:
Jun 17, 2013, 2:46:12 AM (11 years ago)
Author:
mistic100
Message:

new advanced param $confbatch_download_additional_ext, default is $confpicture_ext

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/BatchDownloader/include/events.inc.php

    r21422 r23280  
    8888    {
    8989      $BatchDownloader = new BatchDownloader('new', $page['items'], $set['type'], $set['id']);
    90       $BatchDownloader->getEstimatedArchiveNumber();
    9190     
    92       // if we plan only one zip with less elements than 'max_elements', the download starts immediately
    93       if (
    94         $BatchDownloader->getParam('nb_images') <= $conf['batch_download']['max_elements']
    95         and $BatchDownloader->getParam('nb_zip') == 1
    96       )
     91      if ($BatchDownloader->getParam('nb_images') != 0)
    9792      {
    98         $BatchDownloader->createNextArchive(true); // make sure we have only one zip, even if 'max_size' is exceeded
     93        $BatchDownloader->getEstimatedArchiveNumber();
    9994       
    100         $u_download = get_root_url().BATCH_DOWNLOAD_PATH . 'download.php?set_id='.$BatchDownloader->getParam('id').'&amp;zip=1';
    101        
    102         $null = null;
    103         $template->block_footer_script(null, 'setTimeout("document.location.href = \''.$u_download.'\';", 1000);', $null, $null);
    104        
    105         array_push($page['infos'], sprintf(l10n('The archive is downloading, if the download doesn\'t start automatically please <a href="%s">click here</a>'), $u_download));
     95        // if we plan only one zip with less elements than 'max_elements', the download starts immediately
     96        if (
     97          $BatchDownloader->getParam('nb_images') <= $conf['batch_download']['max_elements']
     98          and $BatchDownloader->getParam('nb_zip') == 1
     99        )
     100        {
     101          $BatchDownloader->createNextArchive(true); // make sure we have only one zip, even if 'max_size' is exceeded
     102         
     103          $u_download = get_root_url().BATCH_DOWNLOAD_PATH . 'download.php?set_id='.$BatchDownloader->getParam('id').'&amp;zip=1';
     104         
     105          $null = null;
     106          $template->block_footer_script(null, 'setTimeout("document.location.href = \''.$u_download.'\';", 1000);', $null, $null);
     107         
     108          $page['infos'][] = sprintf(l10n('The archive is downloading, if the download doesn\'t start automatically please <a href="%s">click here</a>'), $u_download);
     109        }
     110        // otherwise we go to summary page
     111        else
     112        {
     113          redirect(add_url_params(BATCH_DOWNLOAD_PUBLIC . 'init_zip', array('set_id'=>$BatchDownloader->getParam('id'))));
     114        }
    106115      }
    107       // oterwise we go to summary page
    108116      else
    109117      {
    110         redirect(add_url_params(BATCH_DOWNLOAD_PUBLIC . 'init_zip', array('set_id'=>$BatchDownloader->getParam('id'))));
     118        $BatchDownloader->delete();
     119        unset($BatchDownloader);
     120       
     121        $page['errors'][] = sprintf(l10n('Sorry, there is nothing to download. Some files may have been excluded because of <i title="Authorized types are : %s">filetype restrictions</i>.'), implode(', ', $conf['batch_download']['allowed_ext']));
    111122      }
    112123    }
Note: See TracChangeset for help on using the changeset viewer.