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

Last change on this file since 25931 was 25931, checked in by mistic100, 10 years ago

allow to configure only one downloadable size

File size: 2.7 KB
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    'multisize'       => $_POST['multisize'] == 'true',
14    'archive_prefix'  => trim($_POST['archive_prefix']),
15    'archive_timeout' => intval($_POST['archive_timeout']),
16    'max_elements'    => intval($_POST['max_elements']),
17    'max_size'        => intval($_POST['max_size']),
18    'one_archive'     => isset($_POST['one_archive']),
19    'force_pclzip'    => isset($_POST['force_pclzip']),
20    'direct'          => isset($_POST['direct']),
21    'last_clean'      => $conf['batch_download']['last_clean'],
22    );
23  $conf['batch_download_comment'] = trim($_POST['archive_comment']);
24 
25  conf_update_param('batch_download', serialize($conf['batch_download']));
26  conf_update_param('batch_download_comment', $conf['batch_download_comment']);
27 
28  array_push($page['infos'], l10n('Information data registered in database'));
29}
30
31
32// groups
33$query = '
34SELECT id, name
35  FROM '.GROUPS_TABLE.'
36  ORDER BY name ASC
37;';
38$group_options = simple_hash_from_query($query, 'id', 'name');
39
40// levels
41$level_options = get_privacy_level_options();
42
43// sizes
44$type_map = ImageStdParams::get_defined_type_map();
45$sizes_keys = array_keys($type_map);
46$sizes_names = array_map(create_function('$s', 'return l10n($s);'), $sizes_keys);
47
48$sizes_options = array_combine($sizes_keys, $sizes_names);
49$sizes_options['original'] = l10n('Original');
50
51// max values
52$conf['batch_download']['max_elements_value'] = isset($conf['batch_download_max_elements']) ? $conf['batch_download_max_elements'] : 1000;
53$conf['batch_download']['max_size_value'] =     isset($conf['batch_download_max_size']) ?     $conf['batch_download_max_size'] :     500;
54
55
56$template->assign(array(
57  'group_options' => $group_options,
58  'level_options' => $level_options,
59  'sizes_options' => $sizes_options,
60  'USER_COLLEC_LOADED' => defined('USER_COLLEC_ID'),
61  'batch_download' => $conf['batch_download'],
62  'batch_download_comment' => stripslashes($conf['batch_download_comment']),
63  'use_ziparchive' => class_exists('ZipArchive') && !$conf['batch_download']['force_pclzip'],
64  'PHP_VERSION' => PHP_VERSION,
65  'ADVANCED_CONF' => load_language('advanced.html', BATCH_DOWNLOAD_PATH, array('return'=>true))
66  ));
67
68
69$template->set_filename('batch_download', dirname(__FILE__) . '/template/config.tpl');
70
71?>
Note: See TracBrowser for help on using the repository browser.