diff --git a/admin/include/functions_history.inc.php b/admin/include/functions_history.inc.php index 43996c166..5ea27fa36 100644 --- a/admin/include/functions_history.inc.php +++ b/admin/include/functions_history.inc.php @@ -142,6 +142,7 @@ SELECT IP, section, category_id, + search_id, tag_ids, image_id, image_type diff --git a/admin/themes/default/js/history.js b/admin/themes/default/js/history.js index 995349a4e..d1fdc2ed8 100644 --- a/admin/themes/default/js/history.js +++ b/admin/themes/default/js/history.js @@ -367,6 +367,15 @@ function lineConstructor(line, id, imageDisplay) { newLine.find(".detail-item-1").html(str_list).addClass('icon-dice-solid'); newLine.find(".type-id").hide(); break; + case "search": + newLine.find(".type-name").html(line.SECTION); + newLine.find(".type-id").html("#" + line.SEARCH_ID); + if (!line.SEARCH_ID) + { + newLine.find(".type-id").hide(); + } + newLine.find(".detail-item-1").hide(); + break; case "favorites": newLine.find(".type-name").html(str_favorites); newLine.find(".detail-item-1").html(str_favorites).addClass('icon-heart'); diff --git a/include/functions.inc.php b/include/functions.inc.php index a26cc7406..7ade51abf 100644 --- a/include/functions.inc.php +++ b/include/functions.inc.php @@ -494,7 +494,7 @@ UPDATE '.USER_INFOS_TABLE.' $section = $page['section']; } } - + $query = ' INSERT INTO '.HISTORY_TABLE.' ( @@ -504,6 +504,7 @@ INSERT INTO '.HISTORY_TABLE.' IP, section, category_id, + search_id, image_id, image_type, format_id, @@ -518,6 +519,7 @@ INSERT INTO '.HISTORY_TABLE.' \''.$ip.'\', '.(isset($section) ? "'".$section."'" : 'NULL').', '.(isset($page['category']['id']) ? $page['category']['id'] : 'NULL').', + '.(isset($page['search_id']) ? $page['search_id'] : 'NULL').', '.(isset($image_id) ? $image_id : 'NULL').', '.(isset($image_type) ? "'".$image_type."'" : 'NULL').', '.(isset($format_id) ? $format_id : 'NULL').', diff --git a/include/functions_search.inc.php b/include/functions_search.inc.php index edf3409a3..c4dd5cd73 100644 --- a/include/functions_search.inc.php +++ b/include/functions_search.inc.php @@ -27,6 +27,8 @@ function get_search_id_pattern($candidate) function get_search_info($candidate) { + global $page; + // $candidate might be a search.id or a search_uuid $clause_pattern = get_search_id_pattern($candidate); @@ -57,6 +59,12 @@ SELECT * fatal_error('this search is not reachable with its id, need the search_uuid instead'); } + if (isset($page['section']) and 'search' == $page['section']) + { + // to be used later in pwg_log + $page['search_id'] = $searches[0]['id']; + } + return $searches[0]; } diff --git a/include/ws_functions/pwg.php b/include/ws_functions/pwg.php index 5510be027..9d97ca9a3 100644 --- a/include/ws_functions/pwg.php +++ b/include/ws_functions/pwg.php @@ -1023,6 +1023,7 @@ SELECT 'SECTION' => $line['section'], 'FULL_CATEGORY_PATH' => isset($full_cat_path[$line['category_id']]) ? strip_tags($full_cat_path[$line['category_id']]) : l10n('Root').$line['category_id'], 'CATEGORY' => isset($name_of_category[$line['category_id']]) ? $name_of_category[$line['category_id']] : l10n('Root').$line['category_id'], + 'SEARCH_ID' => $line['search_id'] ?? null, 'TAGS' => explode(",",$tag_names), 'TAGIDS' => explode(",",$tag_ids), ) diff --git a/install/db/168-database.php b/install/db/168-database.php new file mode 100644 index 000000000..e8ffe31d6 --- /dev/null +++ b/install/db/168-database.php @@ -0,0 +1,20 @@ + diff --git a/install/piwigo_structure-mysql.sql b/install/piwigo_structure-mysql.sql index cd15ae3e3..9072ae601 100644 --- a/install/piwigo_structure-mysql.sql +++ b/install/piwigo_structure-mysql.sql @@ -146,6 +146,7 @@ CREATE TABLE `piwigo_history` ( `IP` varchar(15) NOT NULL default '', `section` enum('categories','tags','search','list','favorites','most_visited','best_rated','recent_pics','recent_cats') default NULL, `category_id` smallint(5) default NULL, + `search_id` int(10) unsigned default NULL, `tag_ids` varchar(50) default NULL, `image_id` mediumint(8) default NULL, `image_type` enum('picture','high','other') default NULL,