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

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

use new maintain class

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