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

Last change on this file since 21422 was 21422, checked in by mistic100, 11 years ago

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

File size: 2.4 KB
RevLine 
[16379]1<?php
2if (!defined('BATCH_DOWNLOAD_PATH')) die('Hacking attempt!');
3
4if (isset($_POST['save_config']))
5{
[21422]6  if (!defined('USER_COLLEC_ID')) $_POST['what']['collections'] = 'on';
7 
[16379]8  $conf['batch_download'] = array(
9    'groups'          => isset($_POST['groups']) ? $_POST['groups'] : array(),
10    'level'           => $_POST['level'],
[21422]11    'what'            => isset($_POST['what']) ? array_keys($_POST['what']) : array(),
[16379]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    );
[16689]19  $conf['batch_download_comment'] = trim($_POST['archive_comment']);
[16379]20 
21  conf_update_param('batch_download', serialize($conf['batch_download']));
[16689]22  conf_update_param('batch_download_comment', $conf['batch_download_comment']);
[16379]23}
24
[21422]25
[16379]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
[16392]48// max values
49$conf['batch_download']['max_elements_value'] = isset($conf['batch_download_max_elements']) ? $conf['batch_download_max_elements'] : 1000;
[21422]50$conf['batch_download']['max_size_value'] =     isset($conf['batch_download_max_size']) ?     $conf['batch_download_max_size'] :     500;
[16392]51
[21422]52
[16379]53$template->assign(array(
54  'group_options' => $group_options,
55  'level_options' => $level_options,
56  'sizes_options' => $sizes_options,
[21422]57  'USER_COLLEC_LOADED' => defined('USER_COLLEC_ID'),
[16379]58  'batch_download' => $conf['batch_download'],
[16689]59  'batch_download_comment' => stripslashes($conf['batch_download_comment']),
[17880]60  'use_ziparchive' => class_exists('ZipArchive') && !isset($conf['batch_downloader_force_pclzip']),
61  'PHP_VERSION' => PHP_VERSION,
[16379]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.