1<?php
2// +-----------------------------------------------------------------------+
3// | This file is part of Piwigo.                                          |
4// |                                                                       |
5// | For copyright and license information, please view the COPYING.txt    |
6// | file that was distributed with this source code.                      |
7// +-----------------------------------------------------------------------+
8
9if (!defined('PHPWG_ROOT_PATH'))
10{
11  die('Hacking attempt!');
12}
13
14$upgrade_description = 'Add upload form parameters in database';
15
16global $conf;
17
18load_conf_from_db();
19
20$upload_form_config = array(
21  'websize_resize' => true,
22  'websize_maxwidth' => 800,
23  'websize_maxheight' => 600,
24  'websize_quality' => 95,
25  'thumb_maxwidth' => 128,
26  'thumb_maxheight' => 96,
27  'thumb_quality' => 95,
28  'thumb_crop' => false,
29  'thumb_follow_orientation' => true,
30  'hd_keep' => true,
31  'hd_resize' => false,
32  'hd_maxwidth' => 2000,
33  'hd_maxheight' => 2000,
34  'hd_quality' => 95,
35);
36
37$inserts = array();
38
39foreach ($upload_form_config as $param_shortname => $param)
40{
41  $param_name = 'upload_form_'.$param_shortname;
42
43  if (!isset($conf[$param_name]))
44  {
45    $conf[$param_name] = $param;
46
47    array_push(
48      $inserts,
49      array(
50        'param' => $param_name,
51        'value' => boolean_to_string($param),
52        )
53      );
54  }
55}
56
57if (count($inserts) > 0)
58{
59  mass_inserts(
60    CONFIG_TABLE,
61    array_keys($inserts[0]),
62    $inserts
63    );
64}
65
66echo
67"\n"
68. $upgrade_description
69."\n"
70;
71?>