'.l10n('Home').''.$conf['level_separator'].l10n('Batch Downloader').$conf['level_separator']; $page['title'] = l10n('Batch Downloader'); switch (@$tokens[1]) { case 'init_zip': $page['sub_section'] = 'init_zip'; $page['section_title'].= l10n('Generate ZIP'); break; case 'view': $page['sub_section'] = 'view'; $page['section_title'].= l10n('Edit the set'); break; default: redirect('index.php'); } } } function batch_download_page_header() { global $page; $page['body_id'] = 'theBatchDownloader'; } /* download section */ function batch_download_page() { global $page; if (isset($page['section']) and $page['section'] == 'download') { include(BATCH_DOWNLOAD_PATH . '/include/download.inc.php'); } } /* add buttons on thumbnails list */ function batch_download_index_button() { global $page, $template, $user, $conf; // check accesses if ( !count($page['items']) or !isset($page['section']) ) return; if (check_download_access() === false) return; switch ($page['section']) { case 'categories': if (!isset($page['category'])) return; // don't download the full gallery in flat mode ! if (!in_array('categories', $conf['batch_download']['what'])) return; break; case 'collections': if (!in_array('collections', $conf['batch_download']['what'])) return; break; default: if (!in_array('specials', $conf['batch_download']['what'])) return; } // download the set if ( isset($_GET['action']) and $_GET['action']=='advdown_set' ) { $set = get_set_info_from_page(); if ($set !== false) { $BatchDownloader = new BatchDownloader('new', $page['items'], $set['type'], $set['id']); $BatchDownloader->getEstimatedArchiveNumber(); // if we plan only one zip with less elements than 'max_elements', the download starts immediately if ( $BatchDownloader->getParam('nb_images') <= $conf['batch_download']['max_elements'] and $BatchDownloader->getParam('nb_zip') == 1 ) { $BatchDownloader->createNextArchive(true); // make sure we have only one zip, even if 'max_size' is exceeded $u_download = get_root_url().BATCH_DOWNLOAD_PATH . 'download.php?set_id='.$BatchDownloader->getParam('id').'&zip=1'; $null = null; $template->block_footer_script(null, 'setTimeout("document.location.href = \''.$u_download.'\';", 1000);', $null, $null); array_push($page['infos'], sprintf(l10n('The archive is downloading, if the download doesn\'t start automatically please click here'), $u_download)); } // oterwise we go to summary page else { redirect(add_url_params(BATCH_DOWNLOAD_PUBLIC . 'init_zip', array('set_id'=>$BatchDownloader->getParam('id')))); } } } if ($page['section'] == 'collections') { $url = $_SERVER['REQUEST_URI']; } else { $url = duplicate_index_url(array(), array('action')); } $url = add_url_params($url, array('action'=>'advdown_set')); // toolbar button $button = '