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

Last change on this file since 16392 was 16392, checked in by mistic100, 12 years ago
  • stylish download page
  • if there is only one archive, the file is downloaded directly
  • improve configuration page + add sliders (needs Piwigo 2.4.2)
File size: 1.9 KB
Line 
1<?php
2if (!defined('BATCH_DOWNLOAD_PATH')) die('Hacking attempt!');
3
4if (isset($_POST['save_config']))
5{
6  $conf['batch_download'] = array(
7    'groups'          => isset($_POST['groups']) ? $_POST['groups'] : array(),
8    'level'           => $_POST['level'],
9    'photo_size'      => $_POST['photo_size'],
10    'archive_prefix'  => trim($_POST['archive_prefix']),
11    'archive_comment' => trim($_POST['archive_comment']),
12    'archive_timeout' => intval($_POST['archive_timeout']),
13    'max_elements'    => intval($_POST['max_elements']),
14    'max_size'        => intval($_POST['max_size']),
15    'last_clean'      => $conf['batch_download']['last_clean'],
16    );
17 
18  conf_update_param('batch_download', serialize($conf['batch_download']));
19}
20
21// groups
22$query = '
23SELECT id, name
24  FROM '.GROUPS_TABLE.'
25  ORDER BY name ASC
26;';
27$group_options = simple_hash_from_query($query, 'id', 'name');
28
29// levels
30$level_options = get_privacy_level_options();
31
32// sizes
33$enabled = ImageStdParams::get_defined_type_map();
34$disabled = @unserialize(@$conf['disabled_derivatives']);
35if ($disabled === false) $disabled = array();
36
37$sizes_keys = array_diff(array_keys($enabled), array_keys($disabled));
38$sizes_names = array_map(create_function('$s', 'return l10n($s);'), $sizes_keys);
39
40$sizes_options = array_combine($sizes_keys, $sizes_names);
41$sizes_options['original'] = l10n('Original');
42
43// max values
44$conf['batch_download']['max_elements_value'] = isset($conf['batch_download_max_elements']) ? $conf['batch_download_max_elements'] : 1000;
45$conf['batch_download']['max_size_value'] = isset($conf['batch_download_max_size']) ? $conf['batch_download_max_size'] : 1000;
46
47$template->assign(array(
48  'group_options' => $group_options,
49  'level_options' => $level_options,
50  'sizes_options' => $sizes_options,
51  'batch_download' => $conf['batch_download'],
52  ));
53
54
55$template->set_filename('batch_download', dirname(__FILE__) . '/template/config.tpl');
56
57?>
Note: See TracBrowser for help on using the repository browser.