From 011b12cfaa0f2b11e45bc297546855985b38bd84 Mon Sep 17 00:00:00 2001 From: flop25 Date: Fri, 1 Sep 2017 15:29:51 +0200 Subject: [PATCH 01/11] fixes #751, missing DROP statements at install --- install/piwigo_structure-mysql.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/install/piwigo_structure-mysql.sql b/install/piwigo_structure-mysql.sql index c7b33b9f7..8715b2235 100644 --- a/install/piwigo_structure-mysql.sql +++ b/install/piwigo_structure-mysql.sql @@ -168,6 +168,7 @@ CREATE TABLE `piwigo_image_category` ( -- Table structure for table `piwigo_image_format` -- +DROP TABLE IF EXISTS `piwigo_image_format`; CREATE TABLE `piwigo_image_format` ( `format_id` int(11) unsigned NOT NULL auto_increment, `image_id` mediumint(8) unsigned NOT NULL DEFAULT '0', @@ -370,6 +371,7 @@ CREATE TABLE `piwigo_user_access` ( -- Table structure for table `piwigo_user_auth_keys` -- +DROP TABLE IF EXISTS `piwigo_user_auth_keys`; CREATE TABLE `piwigo_user_auth_keys` ( `auth_key_id` int(11) unsigned NOT NULL AUTO_INCREMENT, `auth_key` varchar(255) NOT NULL, From 47164bc737019121200b8393c34e6b0bc046af61 Mon Sep 17 00:00:00 2001 From: flop25 Date: Fri, 1 Sep 2017 17:39:26 +0200 Subject: [PATCH 02/11] fixes #603 no more use of include in tpl for comment_list so comment_list can be replaced via template extension or extensions No HTML changes just tpl and php --- comments.php | 3 ++- include/picture_comment.inc.php | 2 ++ themes/default/template/comments.tpl | 4 ++-- themes/default/template/picture.tpl | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/comments.php b/comments.php index 7b05249e8..a4b526250 100644 --- a/comments.php +++ b/comments.php @@ -299,7 +299,7 @@ if (isset($action)) $title= l10n('User comments'); $page['body_id'] = 'theCommentsPage'; -$template->set_filenames(array('comments'=>'comments.tpl')); +$template->set_filenames(array('comments'=>'comments.tpl', 'comment_list'=>'comment_list.tpl')); $template->assign( array( 'F_ACTION'=>PHPWG_ROOT_PATH.'comments.php', @@ -559,6 +559,7 @@ if (!isset($themeconf['hide_menu_on']) OR !in_array('theCommentsPage', $themecon include(PHPWG_ROOT_PATH.'include/page_header.php'); trigger_notify('loc_end_comments'); flush_page_messages(); +if (count($comments) > 0) $template->assign_var_from_handle('COMMENT_LIST', 'comment_list'); $template->pparse('comments'); include(PHPWG_ROOT_PATH.'include/page_tail.php'); ?> \ No newline at end of file diff --git a/include/picture_comment.inc.php b/include/picture_comment.inc.php index 20a72e5ca..e8735ad08 100644 --- a/include/picture_comment.inc.php +++ b/include/picture_comment.inc.php @@ -274,6 +274,8 @@ SELECT } $template->assign('comment_add', $tpl_var); } + $template->set_filenames( array('comment_list' => 'comment_list.tpl')); + $template->assign_var_from_handle('COMMENT_LIST', 'comment_list'); } ?> \ No newline at end of file diff --git a/themes/default/template/comments.tpl b/themes/default/template/comments.tpl index 96f42b09b..6a38dcf99 100644 --- a/themes/default/template/comments.tpl +++ b/themes/default/template/comments.tpl @@ -102,9 +102,9 @@ {if !empty($navbar) }{include file='navigation_bar.tpl'|@get_extent:'navbar'}{/if} -{if isset($comments)} +{if isset($COMMENT_LIST)}
- {include file='comment_list.tpl' comment_derivative_params=$derivative_params} + {$COMMENT_LIST}
{/if} diff --git a/themes/default/template/picture.tpl b/themes/default/template/picture.tpl index bfc0c2498..d3f3127fb 100644 --- a/themes/default/template/picture.tpl +++ b/themes/default/template/picture.tpl @@ -380,7 +380,7 @@ function setPrivacyLevel(id, level){ {if !empty($navbar) }{include file='navigation_bar.tpl'|@get_extent:'navbar'}{/if} {/if} - {include file='comment_list.tpl'} + {$COMMENT_LIST} {/if}
From 2c07301467ede8faeea80dcca63706d13cc61cea Mon Sep 17 00:00:00 2001 From: MaximeBOURMAUD Date: Mon, 4 Sep 2017 14:23:50 +0200 Subject: [PATCH 03/11] Fixing issue #731 (#754) * Fixing issue #731, if NB_PHOTOS is upper than 1000 display it * Fixs issue #731 now number of picture between 1000 and 1999 are displayed * Fixs formatting --- admin/intro.php | 2 +- admin/themes/default/template/intro.tpl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/admin/intro.php b/admin/intro.php index 5f2d00080..23a5a4f5e 100644 --- a/admin/intro.php +++ b/admin/intro.php @@ -206,7 +206,7 @@ if ($du_gb > 100) $template->assign( array( - 'NB_PHOTOS' => number_format($nb_photos, 0, '.', ','), + 'NB_PHOTOS' => $nb_photos, 'NB_ALBUMS' => $nb_categories, 'NB_TAGS' => $nb_tags, 'NB_IMAGE_TAG' => $nb_image_tag, diff --git a/admin/themes/default/template/intro.tpl b/admin/themes/default/template/intro.tpl index 8f1187093..0aa0721bd 100644 --- a/admin/themes/default/template/intro.tpl +++ b/admin/themes/default/template/intro.tpl @@ -90,7 +90,7 @@ div.stat-box { {if $NB_PHOTOS > 1} -{$NB_PHOTOS}{'Photos'|translate} +{$NB_PHOTOS|number_format}{'Photos'|translate} {/if} From 08cce48d4bc6cadce44e580b4c298212e22a8008 Mon Sep 17 00:00:00 2001 From: flop25 Date: Mon, 4 Sep 2017 18:57:22 +0200 Subject: [PATCH 04/11] Fixes #755 Never thow '0000-00-00 00:00:00' as value but Null instead only for exif ; iptc is ok --- admin/include/functions_metadata.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/admin/include/functions_metadata.php b/admin/include/functions_metadata.php index 01b453816..794722c93 100644 --- a/admin/include/functions_metadata.php +++ b/admin/include/functions_metadata.php @@ -98,6 +98,10 @@ function get_sync_exif_data($file) if (preg_match('/^(\d{4}).(\d{2}).(\d{2}) (\d{2}).(\d{2}).(\d{2})/', $value, $matches)) { $exif[$pwg_key] = $matches[1].'-'.$matches[2].'-'.$matches[3].' '.$matches[4].':'.$matches[5].':'.$matches[6]; + if ($exif[$pwg_key] == '0000-00-00 00:00:00') + { + $exif[$pwg_key] = Null; + } } elseif (preg_match('/^(\d{4}).(\d{2}).(\d{2})/', $value, $matches)) { @@ -274,7 +278,7 @@ SELECT id, path, representative_ext } $data['date_metadata_update'] = CURRENT_DATE; - + $datas[] = $data; } From a1fc05c5866dde401c29b64c02cedd4d953085d5 Mon Sep 17 00:00:00 2001 From: MaximeBOURMAUD Date: Tue, 5 Sep 2017 11:20:26 +0200 Subject: [PATCH 05/11] Fixes #714 - doesn't exist (#758) --- include/ws_functions/pwg.permissions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/ws_functions/pwg.permissions.php b/include/ws_functions/pwg.permissions.php index 292ecc6af..1a1006f8a 100644 --- a/include/ws_functions/pwg.permissions.php +++ b/include/ws_functions/pwg.permissions.php @@ -101,7 +101,7 @@ SELECT group_id, cat_id // filter by group and user foreach ($perms as $cat_id => &$cat) { - if (isset($filters['group_id'])) + if (isset($params['group_id'])) { if (empty($cat['groups']) or count(array_intersect($cat['groups'], $params['group_id'])) == 0) { @@ -109,7 +109,7 @@ SELECT group_id, cat_id continue; } } - if (isset($filters['user_id'])) + if (isset($params['user_id'])) { if ( (empty($cat['users_indirect']) or count(array_intersect($cat['users_indirect'], $params['user_id'])) == 0) From 06a50ca8b099894fed024258c0c26e0cfad7a987 Mon Sep 17 00:00:00 2001 From: flop25 Date: Tue, 5 Sep 2017 14:47:27 +0200 Subject: [PATCH 06/11] Feature #759, choose to display all Tags and/or current ones This commit introduces a new config var and a minor change in a tpl (language key switch) It also change the default behaviour; can be set back to the previous one with $conf['menubar_tag_cloud_content'] = 'current_only' Potential Performance issue; test needed --- include/config_default.inc.php | 8 ++++++++ include/menubar.inc.php | 22 ++++++++++++++++++++-- themes/default/template/menubar_tags.tpl | 2 +- 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/include/config_default.inc.php b/include/config_default.inc.php index 5bc8691d3..5bf61d70d 100644 --- a/include/config_default.inc.php +++ b/include/config_default.inc.php @@ -635,6 +635,14 @@ $conf['full_tag_cloud_items_number'] = 200; // cloud in the menubar. Only the most represented tags will be shown $conf['menubar_tag_cloud_items_number'] = 20; +// menubar_tag_cloud_content: 'always_all', 'current_only' or 'all_or_current' +// For the tag cloud in the menubar. +// 'always_all': tag cloud always displays all tags available to the user +// 'current_only': tag cloud always displays the tags from the current pictures +// 'all_or_current': when pictures are displayed, tag cloud shows their tags, but +// when none are displayed, all the tags available to the user are shown. +$conf['menubar_tag_cloud_content'] = 'all_or_current'; + // content_tag_cloud_items_number: number of related tags to show in the tag // cloud on the content page, when the current section is not a set of // tags. Only the most represented tags will be shown diff --git a/include/menubar.inc.php b/include/menubar.inc.php index 9fe2ceaab..6b9a183f2 100644 --- a/include/menubar.inc.php +++ b/include/menubar.inc.php @@ -118,7 +118,7 @@ function initialize_menu() //------------------------------------------------------------------------ tags $block = $menu->get_block('mbTags'); - if ( $block!=null and !empty($page['items']) and 'picture' != script_basename() ) + if ( $block!=null and 'picture' != script_basename() ) { if ('tags'==@$page['section']) { @@ -147,9 +147,26 @@ function initialize_menu() ) ); } + $template->assign( 'IS_RELATED', false); } - else + //displays all tags available for the current user + else if ($conf['menubar_tag_cloud_content'] == 'always_all' or ($conf['menubar_tag_cloud_content'] == 'all_or_current' and empty($page['items'])) ) { + $tags = get_available_tags(); + foreach ($tags as $tag) + { + $block->data[] = array_merge( + $tag, + array( + 'URL' => make_index_url( array( 'tags' => array($tag) ) ), + ) + ); + } + $template->assign( 'IS_RELATED', false); + } + //displays only the tags available from the current thumbnails displayed + else if ( !empty($page['items']) and ($conf['menubar_tag_cloud_content'] == 'current_only' or $conf['menubar_tag_cloud_content'] == 'all_or_current') ) + { $selection = array_slice( $page['items'], $page['start'], $page['nb_image_page'] ); $tags = add_level_to_tags( get_common_tags($selection, $conf['content_tag_cloud_items_number']) ); foreach ($tags as $tag) @@ -161,6 +178,7 @@ function initialize_menu() ) ); } + $template->assign( 'IS_RELATED', true); } if ( !empty($block->data) ) { diff --git a/themes/default/template/menubar_tags.tpl b/themes/default/template/menubar_tags.tpl index d1a672837..9216e94d6 100644 --- a/themes/default/template/menubar_tags.tpl +++ b/themes/default/template/menubar_tags.tpl @@ -1,4 +1,4 @@ -
{'Related tags'|@translate}
+
{if $IS_RELATED}{'Related tags'|@translate}{else}{'Tags'|@translate}{/if}