source: extensions/BatchDownloader/admin/config.php @ 21422

Revision 21422, 2.4 KB checked in by mistic100, 6 years ago (diff)

add option too allow/disallow download of categories/collections/specials

Line 
1<?php
2if (!defined('BATCH_DOWNLOAD_PATH')) die('Hacking attempt!');
3
4if (isset($_POST['save_config']))
5{
6  if (!defined('USER_COLLEC_ID')) $_POST['what']['collections'] = 'on';
7 
8  $conf['batch_download'] = array(
9    'groups'          => isset($_POST['groups']) ? $_POST['groups'] : array(),
10    'level'           => $_POST['level'],
11    'what'            => isset($_POST['what']) ? array_keys($_POST['what']) : array(),
12    'photo_size'      => $_POST['photo_size'],
13    'archive_prefix'  => trim($_POST['archive_prefix']),
14    'archive_timeout' => intval($_POST['archive_timeout']),
15    'max_elements'    => intval($_POST['max_elements']),
16    'max_size'        => intval($_POST['max_size']),
17    'last_clean'      => $conf['batch_download']['last_clean'],
18    );
19  $conf['batch_download_comment'] = trim($_POST['archive_comment']);
20 
21  conf_update_param('batch_download', serialize($conf['batch_download']));
22  conf_update_param('batch_download_comment', $conf['batch_download_comment']);
23}
24
25
26// groups
27$query = '
28SELECT id, name
29  FROM '.GROUPS_TABLE.'
30  ORDER BY name ASC
31;';
32$group_options = simple_hash_from_query($query, 'id', 'name');
33
34// levels
35$level_options = get_privacy_level_options();
36
37// sizes
38$enabled = ImageStdParams::get_defined_type_map();
39$disabled = @unserialize(@$conf['disabled_derivatives']);
40if ($disabled === false) $disabled = array();
41
42$sizes_keys = array_diff(array_keys($enabled), array_keys($disabled));
43$sizes_names = array_map(create_function('$s', 'return l10n($s);'), $sizes_keys);
44
45$sizes_options = array_combine($sizes_keys, $sizes_names);
46$sizes_options['original'] = l10n('Original');
47
48// max values
49$conf['batch_download']['max_elements_value'] = isset($conf['batch_download_max_elements']) ? $conf['batch_download_max_elements'] : 1000;
50$conf['batch_download']['max_size_value'] =     isset($conf['batch_download_max_size']) ?     $conf['batch_download_max_size'] :     500;
51
52
53$template->assign(array(
54  'group_options' => $group_options,
55  'level_options' => $level_options,
56  'sizes_options' => $sizes_options,
57  'USER_COLLEC_LOADED' => defined('USER_COLLEC_ID'),
58  'batch_download' => $conf['batch_download'],
59  'batch_download_comment' => stripslashes($conf['batch_download_comment']),
60  'use_ziparchive' => class_exists('ZipArchive') && !isset($conf['batch_downloader_force_pclzip']),
61  'PHP_VERSION' => PHP_VERSION,
62  ));
63
64
65$template->set_filename('batch_download', dirname(__FILE__) . '/template/config.tpl');
66
67?>
Note: See TracBrowser for help on using the repository browser.