issue #1953 improved privacy on searches and associate each search to its creator

* remove temporary functions ws_gallery_getSearch and ws_gallery_updateSearch
* split get_search_array into sub-functions to use them in web API
* use search_uuid as search_id instead of the numeric search.id : better privacy
* only the creator of the search can update it
* if a visitors tries to open the search of another user, it (the search) gets forked into a new search
This commit is contained in:
plegall
2023-08-09 19:18:30 +02:00
parent 73e61749fe
commit b787dfd291
9 changed files with 152 additions and 88 deletions
+2 -21
View File
@@ -9,6 +9,7 @@
//--------------------------------------------------------------------- include
define('PHPWG_ROOT_PATH','./');
include_once( PHPWG_ROOT_PATH.'include/common.inc.php' );
include_once(PHPWG_ROOT_PATH.'include/functions_search.inc.php');
// +-----------------------------------------------------------------------+
// | Check Access and exit when user status is not ok |
@@ -24,7 +25,6 @@ trigger_notify('loc_begin_search');
$words = array();
if (!empty($_GET['q']))
{
include_once(PHPWG_ROOT_PATH.'include/functions_search.inc.php');
$words = split_allwords($_GET['q']);
}
@@ -78,24 +78,5 @@ if (count($first_author) > 0)
);
}
list($dbnow) = pwg_db_fetch_row(pwg_query('SELECT NOW()'));
single_insert(
SEARCH_TABLE,
array(
'rules' => pwg_db_real_escape_string(serialize($search)),
'last_seen' => $dbnow,
)
);
$search_id = pwg_db_insert_id(SEARCH_TABLE);
redirect(
make_index_url(
array(
'section' => 'search',
'search' => $search_id,
)
)
);
save_search_and_redirect($search);
?>