Changeset 23280
- Timestamp:
- Jun 17, 2013, 2:46:12 AM (11 years ago)
- Location:
- extensions/BatchDownloader
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/BatchDownloader/admin/sets.php
r21607 r23280 6 6 { 7 7 $BatchDownloader = new BatchDownloader($_GET['delete']); 8 $BatchDownloader->deleteLastArchive(); 9 $BatchDownloader->clearImages(); 10 pwg_query('DELETE FROM '.BATCH_DOWNLOAD_TSETS.' WHERE id = '.$_GET['delete'].';'); 8 $BatchDownloader->delete(); 9 unset($BatchDownloader); 11 10 } 12 11 if (isset($_GET['cancel'])) … … 17 16 $BatchDownloader->deleteLastArchive(); 18 17 $BatchDownloader->clearImages(); 18 unset($BatchDownloader); 19 19 } 20 20 if (isset($_POST['delete_done'])) … … 84 84 ) 85 85 )); 86 87 unset($set); 86 88 } 87 89 -
extensions/BatchDownloader/include/BatchDownloader.class.php
r18973 r23280 209 209 function addImages($image_ids) 210 210 { 211 global $conf; 212 211 213 if (empty($image_ids) or !is_array($image_ids)) return; 212 214 213 $image_ids = array_unique($image_ids); 215 $query = ' 216 SELECT id, file 217 FROM '.IMAGES_TABLE.' 218 WHERE id IN('.implode(',', array_unique($image_ids)).') 219 ;'; 220 $images = simple_hash_from_query($query, 'id', 'file'); 221 214 222 $inserts = array(); 215 223 216 foreach ($image _ids as $image_id)224 foreach ($images as $image_id => $file) 217 225 { 218 226 if ($this->isInSet($image_id)) continue; 227 if (!in_array(get_extension($file), $conf['batch_download']['allowed_ext'])) continue; 219 228 220 229 $this->images[ $image_id ] = 0; … … 681 690 return array_merge($set, $this->getNames()); 682 691 } 692 693 /** 694 * delete 695 */ 696 function delete() 697 { 698 $this->deleteLastArchive(); 699 $this->clearImages(); 700 pwg_query('DELETE FROM '.BATCH_DOWNLOAD_TSETS.' WHERE id = '.$this->data['id'].';'); 701 } 683 702 } 684 703 -
extensions/BatchDownloader/include/events.inc.php
r21422 r23280 88 88 { 89 89 $BatchDownloader = new BatchDownloader('new', $page['items'], $set['type'], $set['id']); 90 $BatchDownloader->getEstimatedArchiveNumber();91 90 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) 97 92 { 98 $BatchDownloader-> createNextArchive(true); // make sure we have only one zip, even if 'max_size' is exceeded93 $BatchDownloader->getEstimatedArchiveNumber(); 99 94 100 $u_download = get_root_url().BATCH_DOWNLOAD_PATH . 'download.php?set_id='.$BatchDownloader->getParam('id').'&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').'&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 } 106 115 } 107 // oterwise we go to summary page108 116 else 109 117 { 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'])); 111 122 } 112 123 } -
extensions/BatchDownloader/language/en_UK/plugin.lang.php
r21607 r23280 49 49 $lang['What can be downloaded?'] = 'What can be downloaded?'; 50 50 $lang['No result'] = 'No result'; 51 $lang['Sorry, there is nothing to download. Some files may have been excluded because of <i title="Authorized types are : %s">filetype restrictions</i>.'] = 'Sorry, there is nothing to download. Some files may have been excluded because of <i title="Authorized types are : %s">filetype restrictions</i>.'; 51 52 52 53 ?> -
extensions/BatchDownloader/language/fr_FR/plugin.lang.php
r21607 r23280 49 49 $lang['What can be downloaded?'] = 'Qu\'est-ce qui peut être téléchargé ?'; 50 50 $lang['No result'] = 'Aucun résultat'; 51 $lang['Sorry, there is nothing to download. Some files may have been excluded because of <i title="Authorized types are : %s">filetype restrictions</i>.'] = 'Désolé, il n\'y a rien à télécharger. Certains fichiers ont peut-être été exclu à cause de <i title="Les types autorisés sont : %s">leur type</i>.'; 51 52 52 53 ?> -
extensions/BatchDownloader/main.inc.php
r23167 r23280 4 4 Version: auto 5 5 Description: Allows users to download pictures sets in ZIP. Compatible with User Collections. 6 Plugin URI: http://piwigo.org/ext/extension_view.php?eid=6166 Plugin URI: auto 7 7 Author: Mistic 8 8 Author URI: http://www.strangeplanet.fr … … 11 11 /* 12 12 * advanced config: 13 * $conf['batch_download_max_elements'] max value of the elements slider (default 1000) 14 * $conf['batch_download_max_size'] max value of the size slider (default 500) 15 * $conf['batch_download_force_pclzip'] if true, force the usage of PclZip instead of ZipArchive 16 * $conf['batch_download_direct'] if true, the download script will redirect to the zip instead of deliver it through PHP 13 * $conf['batch_download_max_elements'] max value of the elements slider (default 1000) 14 * $conf['batch_download_max_size'] max value of the size slider (default 500) 15 * $conf['batch_download_force_pclzip'] if true, force the usage of PclZip instead of ZipArchive 16 * $conf['batch_download_direct'] if true, the download script will redirect to the zip instead of deliver it through PHP 17 * $conf['batch_download_additional_ext'] array containing downloadable filetypes (case sensitive), default is $conf['picture_ext'] 17 18 */ 18 19 … … 91 92 92 93 $conf['batch_download'] = unserialize($conf['batch_download']); 94 $conf['batch_download']['allowed_ext'] = $conf['picture_ext']; 95 if (!empty($conf['batch_download_additional_ext'])) 96 { 97 $conf['batch_download']['allowed_ext'] = array_merge($conf['batch_download']['allowed_ext'], $conf['batch_download_additional_ext']); 98 } 99 93 100 load_language('plugin.lang', BATCH_DOWNLOAD_PATH); 94 101 }
Note: See TracChangeset
for help on using the changeset viewer.