diff --git a/admin.php b/admin.php index bb9b91274..af6937881 100644 --- a/admin.php +++ b/admin.php @@ -58,12 +58,14 @@ if (isset($_GET['plugins_new_order'])) if (isset($_GET['change_theme'])) { $admin_themes = array('roma', 'clear'); + $admin_theme_array = array($conf['admin_theme']); + $result = array_diff( + $admin_themes, + $admin_theme_array + ); $new_admin_theme = array_pop( - array_diff( - $admin_themes, - array($conf['admin_theme']) - ) + $result ); conf_update_param('admin_theme', $new_admin_theme); 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; } 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/picture_modify.php b/admin/picture_modify.php index 24cdc22d4..0e0aed520 100644 --- a/admin/picture_modify.php +++ b/admin/picture_modify.php @@ -209,6 +209,12 @@ SELECT $tag_selection = get_taglist($query); $row = $page['image']; + +if (isset($data['date_creation'])) +{ + $row['date_creation'] = $data['date_creation']; +} + $storage_category_id = null; if (!empty($row['storage_category_id'])) { 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} diff --git a/comments.php b/comments.php index d7f0fd3c4..ebd89a987 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/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/feedcreator.class.php b/include/feedcreator.class.php index 62ba6c06b..d3cbaeb7f 100644 --- a/include/feedcreator.class.php +++ b/include/feedcreator.class.php @@ -288,7 +288,7 @@ class FeedHtmlField { * Creates a new instance of FeedHtmlField. * @param $string: if given, sets the rawFieldContent property */ - function FeedHtmlField($parFieldContent) { + function __construct($parFieldContent) { if ($parFieldContent) { $this->rawFieldContent = $parFieldContent; } @@ -708,7 +708,7 @@ class FeedDate { * Accepts RFC 822, ISO 8601 date formats as well as unix time stamps. * @param mixed $dateString optional the date this FeedDate will represent. If not specified, the current date and time is used. */ - function FeedDate($dateString="") { + function __construct($dateString="") { if ($dateString=="") $dateString = date("r"); if (is_integer($dateString)) { @@ -884,7 +884,7 @@ class RSSCreator091 extends FeedCreator { */ var $RSSVersion; - function RSSCreator091() { + function __construct() { $this->_setRSSVersion("0.91"); $this->contentType = "application/rss+xml"; } @@ -1016,7 +1016,7 @@ class RSSCreator091 extends FeedCreator { */ class RSSCreator20 extends RSSCreator091 { - function RSSCreator20() { + function __construct() { parent::_setRSSVersion("2.0"); } @@ -1033,7 +1033,7 @@ class RSSCreator20 extends RSSCreator091 { */ class PIECreator01 extends FeedCreator { - function PIECreator01() { + function __construct() { $this->encoding = "utf-8"; } @@ -1091,7 +1091,7 @@ class PIECreator01 extends FeedCreator { */ class AtomCreator03 extends FeedCreator { - function AtomCreator03() { + function __construct() { $this->contentType = "application/atom+xml"; $this->encoding = "utf-8"; } @@ -1159,7 +1159,7 @@ class AtomCreator03 extends FeedCreator { */ class MBOXCreator extends FeedCreator { - function MBOXCreator() { + function __construct() { $this->contentType = "text/plain"; $this->encoding = "ISO-8859-15"; } @@ -1246,7 +1246,7 @@ class MBOXCreator extends FeedCreator { */ class OPMLCreator extends FeedCreator { - function OPMLCreator() { + function __construct() { $this->encoding = "utf-8"; } 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/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/include/section_init.inc.php b/include/section_init.inc.php index e2e0c0712..a5be2844d 100644 --- a/include/section_init.inc.php +++ b/include/section_init.inc.php @@ -625,6 +625,7 @@ if ( 'categories'==$page['section'] and isset($page['category']) ) if ($need_redirect) { + check_restrictions($page['category']['id']); $redirect_url = script_basename()=='picture' ? duplicate_picture_url() : duplicate_index_url(); if (!headers_sent()) 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) 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, 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/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}
{/if} - {include file='comment_list.tpl'} + {$COMMENT_LIST} {/if}
diff --git a/themes/elegant/scripts.js b/themes/elegant/scripts.js index 1f946303e..51da49fd6 100644 --- a/themes/elegant/scripts.js +++ b/themes/elegant/scripts.js @@ -26,7 +26,7 @@ if (menubar.length == 1 && p_main_menu!="disabled") { menuswitcher.html('
 
'); - if (session_storage['page-menu'] == undefined && p_main_menu == 'off') { + if (session_storage['page-menu'] === undefined && p_main_menu == 'off') { session_storage['page-menu'] = 'hidden'; } diff --git a/themes/elegant/scripts_pp.js b/themes/elegant/scripts_pp.js index 6accab0d0..f85570d7c 100644 --- a/themes/elegant/scripts_pp.js +++ b/themes/elegant/scripts_pp.js @@ -1,172 +1,172 @@ -(function() { - var session_storage = window.sessionStorage || {}; - - var menubar=jQuery("#menubar"), - menuswitcher, - content=jQuery("#the_page > .content"), - pcontent=jQuery("#content"), - imageInfos=jQuery("#imageInfos"), - infoswitcher, - theImage=jQuery("#theImage"), - comments=jQuery("#thePicturePage #comments"), - comments_button, - commentsswitcher, - comments_add, - comments_top_offset = 0; - - function hideMenu(delay) { - menubar.hide(delay); - menuswitcher.addClass("menuhidden").removeClass("menushown"); - content.addClass("menuhidden").removeClass("menushown"); - pcontent.addClass("menuhidden").removeClass("menushown"); - session_storage['picture-menu'] = 'hidden'; - } - - function showMenu(delay) { - menubar.show(delay); - menuswitcher.addClass("menushown").removeClass("menuhidden"); - content.addClass("menushown").removeClass("menuhidden"); - pcontent.addClass("menushown").removeClass("menuhidden"); - session_storage['picture-menu'] = 'visible'; - } - - function hideInfo(delay) { - imageInfos.hide(delay); - infoswitcher.addClass("infohidden").removeClass("infoshown"); - theImage.addClass("infohidden").removeClass("infoshown"); - session_storage['side-info'] = 'hidden'; - } - - function showInfo(delay) { - imageInfos.show(delay); - infoswitcher.addClass("infoshown").removeClass("infohidden"); - theImage.addClass("infoshown").removeClass("infohidden"); - session_storage['side-info'] = 'visible'; - } - - function commentsToggle() { - if (comments.hasClass("commentshidden")) { - comments.removeClass("commentshidden").addClass("commentsshown"); - comments_button.addClass("comments_toggle_off").removeClass("comments_toggle_on");; - session_storage['comments'] = 'visible'; - comments_top_offset = comments_add.offset().top - parseFloat(comments_add.css('marginTop').replace(/auto/, 0)); - } - else { - comments.addClass("commentshidden").removeClass("commentsshown"); - comments_button.addClass("comments_toggle_on").removeClass("comments_toggle_off");; +(function() { + var session_storage = window.sessionStorage || {}; + + var menubar=jQuery("#menubar"), + menuswitcher, + content=jQuery("#the_page > .content"), + pcontent=jQuery("#content"), + imageInfos=jQuery("#imageInfos"), + infoswitcher, + theImage=jQuery("#theImage"), + comments=jQuery("#thePicturePage #comments"), + comments_button, + commentsswitcher, + comments_add, + comments_top_offset = 0; + + function hideMenu(delay) { + menubar.hide(delay); + menuswitcher.addClass("menuhidden").removeClass("menushown"); + content.addClass("menuhidden").removeClass("menushown"); + pcontent.addClass("menuhidden").removeClass("menushown"); + session_storage['picture-menu'] = 'hidden'; + } + + function showMenu(delay) { + menubar.show(delay); + menuswitcher.addClass("menushown").removeClass("menuhidden"); + content.addClass("menushown").removeClass("menuhidden"); + pcontent.addClass("menushown").removeClass("menuhidden"); + session_storage['picture-menu'] = 'visible'; + } + + function hideInfo(delay) { + imageInfos.hide(delay); + infoswitcher.addClass("infohidden").removeClass("infoshown"); + theImage.addClass("infohidden").removeClass("infoshown"); + session_storage['side-info'] = 'hidden'; + } + + function showInfo(delay) { + imageInfos.show(delay); + infoswitcher.addClass("infoshown").removeClass("infohidden"); + theImage.addClass("infoshown").removeClass("infohidden"); + session_storage['side-info'] = 'visible'; + } + + function commentsToggle() { + if (comments.hasClass("commentshidden")) { + comments.removeClass("commentshidden").addClass("commentsshown"); + comments_button.addClass("comments_toggle_off").removeClass("comments_toggle_on"); + session_storage['comments'] = 'visible'; + comments_top_offset = comments_add.offset().top - parseFloat(comments_add.css('marginTop').replace(/auto/, 0)); + } + else { + comments.addClass("commentshidden").removeClass("commentsshown"); + comments_button.addClass("comments_toggle_on").removeClass("comments_toggle_off"); session_storage['comments'] = 'hidden'; - comments_top_offset = 0; - } - } - - jQuery(function(){ - // side-menu show/hide - if (menubar.length == 1 && p_main_menu!="disabled") { - menuswitcher=jQuery("#menuSwitcher"); - - menuswitcher.html('
 
'); - - if (session_storage['picture-menu'] == undefined && p_main_menu == 'off') { - session_storage['picture-menu'] = 'hidden'; - } - - if (session_storage['picture-menu'] == 'hidden') { - hideMenu(0); - } - else { - showMenu(0); - } - - menuswitcher.click(function(e){ - if (menubar.is(":hidden")) { - showMenu(0); - } - else { - hideMenu(0); - } - e.preventDefault(); - }); - } - - // info show/hide - if (imageInfos.length == 1 && p_pict_descr!="disabled") { - infoswitcher=jQuery("#infoSwitcher"); - - infoswitcher.html('
 
'); - - if (session_storage['side-info'] == undefined && p_pict_descr == 'off') { - session_storage['side-info'] = 'hidden'; - } - - if (session_storage['side-info'] == 'hidden') { - hideInfo(0); - } - else { - showInfo(0); - } - - infoswitcher.click(function(e){ - if (imageInfos.is(":hidden")) { - showInfo(0); - } - else { - hideInfo(0); - } - e.preventDefault(); - }); - } - - // comments show/hide - if (comments.length == 1 && p_pict_comment!="disabled") { - commentsswitcher=jQuery("#commentsSwitcher"); - comments_button=jQuery("#comments h3"); - comments_add=jQuery('#commentAdd'); - - commentsswitcher.html('
 
'); - - if (comments_button.length == 0) { - jQuery("#addComment").before("

Comments

"); - comments_button=jQuery("#comments h3"); - } - - if (session_storage['comments'] == undefined && p_pict_comment == 'off') { - session_storage['comments'] = 'hidden'; - } - - if (session_storage['comments'] == 'hidden') { - comments.addClass("commentshidden"); - comments_button.addClass("comments_toggle comments_toggle_on"); - } - else { - comments.addClass("commentsshown"); - comments_button.addClass("comments_toggle comments_toggle_off"); - } - - comments_button.click(commentsToggle); - commentsswitcher.click(commentsToggle); - - jQuery(window).scroll(function (event) { - if (comments_top_offset==0) return; - - var y = jQuery(this).scrollTop(); - - if (y >= comments_top_offset) { + comments_top_offset = 0; + } + } + + jQuery(function(){ + // side-menu show/hide + if (menubar.length == 1 && p_main_menu!="disabled") { + menuswitcher=jQuery("#menuSwitcher"); + + menuswitcher.html('
 
'); + + if (session_storage['picture-menu'] === undefined && p_main_menu == 'off') { + session_storage['picture-menu'] = 'hidden'; + } + + if (session_storage['picture-menu'] == 'hidden') { + hideMenu(0); + } + else { + showMenu(0); + } + + menuswitcher.click(function(e){ + if (menubar.is(":hidden")) { + showMenu(0); + } + else { + hideMenu(0); + } + e.preventDefault(); + }); + } + + // info show/hide + if (imageInfos.length == 1 && p_pict_descr!="disabled") { + infoswitcher=jQuery("#infoSwitcher"); + + infoswitcher.html('
 
'); + + if (session_storage['side-info'] === undefined && p_pict_descr == 'off') { + session_storage['side-info'] = 'hidden'; + } + + if (session_storage['side-info'] == 'hidden') { + hideInfo(0); + } + else { + showInfo(0); + } + + infoswitcher.click(function(e){ + if (imageInfos.is(":hidden")) { + showInfo(0); + } + else { + hideInfo(0); + } + e.preventDefault(); + }); + } + + // comments show/hide + if (comments.length == 1 && p_pict_comment!="disabled") { + commentsswitcher=jQuery("#commentsSwitcher"); + comments_button=jQuery("#comments h3"); + comments_add=jQuery('#commentAdd'); + + commentsswitcher.html('
 
'); + + if (comments_button.length == 0) { + jQuery("#addComment").before("

Comments

"); + comments_button=jQuery("#comments h3"); + } + + if (session_storage['comments'] === undefined && p_pict_comment == 'off') { + session_storage['comments'] = 'hidden'; + } + + if (session_storage['comments'] == 'hidden') { + comments.addClass("commentshidden"); + comments_button.addClass("comments_toggle comments_toggle_on"); + } + else { + comments.addClass("commentsshown"); + comments_button.addClass("comments_toggle comments_toggle_off"); + } + + comments_button.click(commentsToggle); + commentsswitcher.click(commentsToggle); + + jQuery(window).scroll(function (event) { + if (comments_top_offset==0) return; + + var y = jQuery(this).scrollTop(); + + if (y >= comments_top_offset) { comments_add.css({ 'position': 'absolute', 'top': y-comments.offset().top+10 - }); - } - else { + }); + } + else { comments_add.css({ 'position': 'static', 'top': 0 - }); - } - }); - - if (comments_add.is(":visible")) { - comments_top_offset = comments_add.offset().top - parseFloat(comments_add.css('marginTop').replace(/auto/, 0)); - } - } - }); -}()); \ No newline at end of file + }); + } + }); + + if (comments_add.is(":visible")) { + comments_top_offset = comments_add.offset().top - parseFloat(comments_add.css('marginTop').replace(/auto/, 0)); + } + } + }); +}());