[16379] | 1 | <?php |
---|
| 2 | if (!defined('BATCH_DOWNLOAD_PATH')) die('Hacking attempt!'); |
---|
| 3 | |
---|
| 4 | if (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_timeout' => intval($_POST['archive_timeout']), |
---|
| 12 | 'max_elements' => intval($_POST['max_elements']), |
---|
| 13 | 'max_size' => intval($_POST['max_size']), |
---|
| 14 | 'last_clean' => $conf['batch_download']['last_clean'], |
---|
| 15 | ); |
---|
[16689] | 16 | $conf['batch_download_comment'] = trim($_POST['archive_comment']); |
---|
[16379] | 17 | |
---|
| 18 | conf_update_param('batch_download', serialize($conf['batch_download'])); |
---|
[16689] | 19 | conf_update_param('batch_download_comment', $conf['batch_download_comment']); |
---|
[16379] | 20 | } |
---|
| 21 | |
---|
| 22 | // groups |
---|
| 23 | $query = ' |
---|
| 24 | SELECT id, name |
---|
| 25 | FROM '.GROUPS_TABLE.' |
---|
| 26 | ORDER BY name ASC |
---|
| 27 | ;'; |
---|
| 28 | $group_options = simple_hash_from_query($query, 'id', 'name'); |
---|
| 29 | |
---|
| 30 | // levels |
---|
| 31 | $level_options = get_privacy_level_options(); |
---|
| 32 | |
---|
| 33 | // sizes |
---|
| 34 | $enabled = ImageStdParams::get_defined_type_map(); |
---|
| 35 | $disabled = @unserialize(@$conf['disabled_derivatives']); |
---|
| 36 | if ($disabled === false) $disabled = array(); |
---|
| 37 | |
---|
| 38 | $sizes_keys = array_diff(array_keys($enabled), array_keys($disabled)); |
---|
| 39 | $sizes_names = array_map(create_function('$s', 'return l10n($s);'), $sizes_keys); |
---|
| 40 | |
---|
| 41 | $sizes_options = array_combine($sizes_keys, $sizes_names); |
---|
| 42 | $sizes_options['original'] = l10n('Original'); |
---|
| 43 | |
---|
[16392] | 44 | // max values |
---|
| 45 | $conf['batch_download']['max_elements_value'] = isset($conf['batch_download_max_elements']) ? $conf['batch_download_max_elements'] : 1000; |
---|
[16689] | 46 | $conf['batch_download']['max_size_value'] = isset($conf['batch_download_max_size']) ? $conf['batch_download_max_size'] : 500; |
---|
[16392] | 47 | |
---|
[16379] | 48 | $template->assign(array( |
---|
| 49 | 'group_options' => $group_options, |
---|
| 50 | 'level_options' => $level_options, |
---|
| 51 | 'sizes_options' => $sizes_options, |
---|
| 52 | 'batch_download' => $conf['batch_download'], |
---|
[16689] | 53 | 'batch_download_comment' => stripslashes($conf['batch_download_comment']), |
---|
[16379] | 54 | )); |
---|
| 55 | |
---|
| 56 | |
---|
| 57 | $template->set_filename('batch_download', dirname(__FILE__) . '/template/config.tpl'); |
---|
| 58 | |
---|
| 59 | ?> |
---|