mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-03-28 17:42:57 +01:00
search filters: avoid to write 3 times the same default configuration
This commit is contained in:
@@ -112,21 +112,12 @@ $display_info_checkboxes = array(
|
||||
'rating_score',
|
||||
);
|
||||
|
||||
$filters_names_checkboxes = array(
|
||||
'words',
|
||||
'tags',
|
||||
'post_date',
|
||||
'creation_date',
|
||||
'album',
|
||||
'author',
|
||||
'added_by',
|
||||
'file_type',
|
||||
'ratio',
|
||||
'rating',
|
||||
'file_size',
|
||||
'height',
|
||||
'width'
|
||||
);
|
||||
if (!isset($conf['filters_views']))
|
||||
{
|
||||
conf_update_param('filters_views', $conf['default_filters_views'], true);
|
||||
}
|
||||
|
||||
$filters_names_checkboxes = array_diff(array_keys(safe_unserialize($conf['filters_views'])), array('last_filters_conf'));
|
||||
|
||||
// image order management
|
||||
$sort_fields = array(
|
||||
@@ -701,7 +692,7 @@ switch ($page['section'])
|
||||
$template->assign(
|
||||
'search',
|
||||
array(
|
||||
'filters_views' => unserialize($conf['filters_views']),
|
||||
'filters_views' => safe_unserialize($conf['filters_views']),
|
||||
'filters_names' => $filters_names,
|
||||
),
|
||||
);
|
||||
|
||||
@@ -1027,12 +1027,37 @@ $conf['batch_manager_images_per_page_unit'] = 5;
|
||||
// how many missing md5sum should Piwigo compute at once.
|
||||
$conf['checksum_compute_blocksize'] = 50;
|
||||
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Search |
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
||||
// quicksearch engine: include all photos from sub-albums of any matching
|
||||
// album. For example, if search is "bear", then we display photos from
|
||||
// "bear/grizzly". When value changed, delete database cache files in
|
||||
// _data/cache directory
|
||||
$conf['quick_search_include_sub_albums'] = false;
|
||||
|
||||
// default configuration for search filters. It will then be configurable
|
||||
// with the configuration page. Having this setting in this file avoids to
|
||||
// duplicate it in several files
|
||||
$conf['default_filters_views'] = array(
|
||||
'words' => ['access'=>'everybody', 'default'=>true],
|
||||
'tags' => ['access'=>'everybody', 'default'=>false],
|
||||
'post_date' => ['access'=>'everybody', 'default'=>false],
|
||||
'creation_date' => ['access'=>'everybody', 'default'=>true],
|
||||
'album' => ['access'=>'everybody', 'default'=>true],
|
||||
'author' => ['access'=>'everybody', 'default'=>false],
|
||||
'added_by' => ['access'=>'everybody', 'default'=>false],
|
||||
'file_type' => ['access'=>'everybody', 'default'=>false],
|
||||
'ratio' => ['access'=>'everybody', 'default'=>false],
|
||||
'rating' => ['access'=>'everybody', 'default'=>false],
|
||||
'file_size' => ['access'=>'everybody', 'default'=>false],
|
||||
'height' => ['access'=>'everybody', 'default'=>false],
|
||||
'width' => ['access'=>'everybody', 'default'=>false],
|
||||
|
||||
'last_filters_conf' => true,
|
||||
);
|
||||
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | log |
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
||||
@@ -6,14 +6,7 @@
|
||||
// | file that was distributed with this source code. |
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
||||
if (isset($conf['filters_views']))
|
||||
{
|
||||
$filters_views = unserialize($conf['filters_views']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$filters_views = unserialize('a:14:{s:5:"words";a:2:{s:6:"access";s:9:"everybody";s:7:"default";b:1;}s:4:"tags";a:2:{s:6:"access";s:9:"everybody";s:7:"default";b:0;}s:9:"post_date";a:2:{s:6:"access";s:9:"everybody";s:7:"default";b:0;}s:13:"creation_date";a:2:{s:6:"access";s:9:"everybody";s:7:"default";b:1;}s:5:"album";a:2:{s:6:"access";s:9:"everybody";s:7:"default";b:1;}s:6:"author";a:2:{s:6:"access";s:9:"everybody";s:7:"default";b:0;}s:8:"added_by";a:2:{s:6:"access";s:9:"everybody";s:7:"default";b:0;}s:9:"file_type";a:2:{s:6:"access";s:9:"everybody";s:7:"default";b:0;}s:5:"ratio";a:2:{s:6:"access";s:9:"everybody";s:7:"default";b:0;}s:6:"rating";a:2:{s:6:"access";s:9:"everybody";s:7:"default";b:0;}s:9:"file_size";a:2:{s:6:"access";s:9:"everybody";s:7:"default";b:0;}s:6:"height";a:2:{s:6:"access";s:9:"everybody";s:7:"default";b:0;}s:5:"width";a:2:{s:6:"access";s:9:"everybody";s:7:"default";b:0;}s:17:"last_filters_conf";b:1;}');
|
||||
}
|
||||
$filters_views = safe_unserialize(conf_get_param('filters_views', $conf['default_filters_views']));
|
||||
|
||||
$template->assign('display_filter', $filters_views);
|
||||
|
||||
|
||||
@@ -80,4 +80,3 @@ INSERT INTO piwigo_config (param,value) VALUES ('index_search_in_set_action','tr
|
||||
INSERT INTO piwigo_config (param,value) VALUES ('upload_detect_duplicate','true');
|
||||
INSERT INTO piwigo_config (param,value) VALUES ('webmaster_id','1');
|
||||
INSERT INTO piwigo_config (param,value) VALUES ('use_standard_pages','true');
|
||||
INSERT INTO piwigo_config (param,value,comment) VALUES ('filters_views','a:14:{s:5:"words";a:2:{s:6:"access";s:9:"everybody";s:7:"default";b:1;}s:4:"tags";a:2:{s:6:"access";s:9:"everybody";s:7:"default";b:0;}s:9:"post_date";a:2:{s:6:"access";s:9:"everybody";s:7:"default";b:0;}s:13:"creation_date";a:2:{s:6:"access";s:9:"everybody";s:7:"default";b:1;}s:5:"album";a:2:{s:6:"access";s:9:"everybody";s:7:"default";b:1;}s:6:"author";a:2:{s:6:"access";s:9:"everybody";s:7:"default";b:0;}s:8:"added_by";a:2:{s:6:"access";s:9:"everybody";s:7:"default";b:0;}s:9:"file_type";a:2:{s:6:"access";s:9:"everybody";s:7:"default";b:0;}s:5:"ratio";a:2:{s:6:"access";s:9:"everybody";s:7:"default";b:0;}s:6:"rating";a:2:{s:6:"access";s:9:"everybody";s:7:"default";b:0;}s:9:"file_size";a:2:{s:6:"access";s:9:"everybody";s:7:"default";b:0;}s:6:"height";a:2:{s:6:"access";s:9:"everybody";s:7:"default";b:0;}s:5:"width";a:2:{s:6:"access";s:9:"everybody";s:7:"default";b:0;}s:17:"last_filters_conf";b:1;}','Filters displays configuration');
|
||||
@@ -13,11 +13,7 @@ if (!defined('PHPWG_ROOT_PATH'))
|
||||
|
||||
$upgrade_description = 'add config parameters to the gallery filters';
|
||||
|
||||
// Add line of conf to help with the display of filters and default filters in the gallery
|
||||
conf_update_param(
|
||||
'filters_views',
|
||||
'a:14:{s:5:"words";a:2:{s:6:"access";s:9:"everybody";s:7:"default";b:1;}s:4:"tags";a:2:{s:6:"access";s:9:"everybody";s:7:"default";b:0;}s:9:"post_date";a:2:{s:6:"access";s:9:"everybody";s:7:"default";b:0;}s:13:"creation_date";a:2:{s:6:"access";s:9:"everybody";s:7:"default";b:1;}s:5:"album";a:2:{s:6:"access";s:9:"everybody";s:7:"default";b:1;}s:6:"author";a:2:{s:6:"access";s:9:"everybody";s:7:"default";b:0;}s:8:"added_by";a:2:{s:6:"access";s:9:"everybody";s:7:"default";b:0;}s:9:"file_type";a:2:{s:6:"access";s:9:"everybody";s:7:"default";b:0;}s:5:"ratio";a:2:{s:6:"access";s:9:"everybody";s:7:"default";b:0;}s:6:"rating";a:2:{s:6:"access";s:9:"everybody";s:7:"default";b:0;}s:9:"file_size";a:2:{s:6:"access";s:9:"everybody";s:7:"default";b:0;}s:6:"height";a:2:{s:6:"access";s:9:"everybody";s:7:"default";b:0;}s:5:"width";a:2:{s:6:"access";s:9:"everybody";s:7:"default";b:0;}s:17:"last_filters_conf";b:1;}'
|
||||
);
|
||||
conf_update_param('filters_views', $conf['default_filters_views']);
|
||||
|
||||
echo "\n".$upgrade_description."\n";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user