From 0534202c40863fd2d8356002f5a83cbe15c61ec7 Mon Sep 17 00:00:00 2001 From: plegall Date: Tue, 27 Jun 2023 15:20:41 +0200 Subject: [PATCH] fixes #1930 remove search_rules --- admin/extend_for_templates.php | 3 +- index.php | 6 - language/en_UK/common.lang.php | 5 - search_rules.php | 228 ------------------------------ themes/default/template/index.tpl | 6 - 5 files changed, 1 insertion(+), 247 deletions(-) delete mode 100644 search_rules.php diff --git a/admin/extend_for_templates.php b/admin/extend_for_templates.php index 00bffd2d6..e771170ca 100644 --- a/admin/extend_for_templates.php +++ b/admin/extend_for_templates.php @@ -90,7 +90,6 @@ $eligible_templates = array( 'redirect.tpl' => 'redirect', 'register.tpl' => 'register', 'search.tpl' => 'search', - 'search_rules.tpl' => 'search_rules', 'slideshow.tpl' => 'slideshow', 'tags.tpl' => 'tags', 'thumbnails.tpl' => 'index_thumbnails', @@ -187,4 +186,4 @@ foreach ($tpl_extension as $file => $conditions) $template->assign('ADMIN_PAGE_TITLE', l10n('Extend for templates')); $template->assign_var_from_handle('ADMIN_CONTENT', 'extend_for_templates'); -?> \ No newline at end of file +?> diff --git a/index.php b/index.php index 03975ca3a..3b7e890d5 100644 --- a/index.php +++ b/index.php @@ -176,12 +176,6 @@ if ( empty($page['is_external']) ) if ('search' == $page['section']) { - // TODO remove the search_rules system (replaced by multi-criteria search filters and widgets) - $template->assign( - 'U_SEARCH_RULES', - get_root_url().'search_rules.php?search_id='.$page['search'] - ); - include_once(PHPWG_ROOT_PATH.'include/functions_search.inc.php'); $my_search = get_search_array($page['search']); diff --git a/language/en_UK/common.lang.php b/language/en_UK/common.lang.php index 48290c554..55021b3ab 100644 --- a/language/en_UK/common.lang.php +++ b/language/en_UK/common.lang.php @@ -65,9 +65,7 @@ $lang['Anti-flood system : please wait for a moment before trying to post anothe $lang['Any tag'] = "Any tag"; $lang['Are you sure?'] = "Are you sure?"; $lang['ascending'] = "ascending"; -$lang['At least one listed rule must be satisfied.'] = "At least one listed criterion must be satisfied."; $lang['Author'] = "Author"; -$lang['author(s) : %s'] = 'author(s): %s'; $lang['Author: %s'] = "Author: %s"; $lang['Auto login'] = "Auto login"; $lang['available for administrators only'] = "available for administrators only"; @@ -144,7 +142,6 @@ $lang['display your favorites photos'] = "display your favorites photos"; $lang['Display'] = "Display"; $lang['Download this file'] = "Download this file"; $lang['Download'] = "download"; -$lang['Each listed rule must be satisfied.'] = 'Each of the listed criteria must be satisfied.'; $lang['Edit a comment'] = "Edit a comment"; $lang['edit'] = "edit"; //TO remove $lang['Edit'] = 'Edit'; @@ -316,11 +313,9 @@ $lang['Search for words'] = "Search for words"; $lang['Search in albums'] = "Search in albums"; $lang['Search in sub-albums'] = "Search in sub-albums"; $lang['Search results'] = "Search results"; -$lang['Search rules'] = "Search criteria"; $lang['Search tags'] = "Search tags"; $lang['Search'] = "Search"; $lang['search'] = "search"; -$lang['searched words : %s'] = 'searched words: %s'; $lang['Send my connection settings by email'] = 'Send my connection settings by email'; $lang['Sent by'] = "Sent by"; $lang['set as album representative'] = "set as album thumbnail"; diff --git a/search_rules.php b/search_rules.php deleted file mode 100644 index 0c5fe2bda..000000000 --- a/search_rules.php +++ /dev/null @@ -1,228 +0,0 @@ -1, 'nofollow'=>1); -include(PHPWG_ROOT_PATH.'include/page_header.php'); - -$template->set_filenames(array('search_rules' => 'search_rules.tpl')); - -// +-----------------------------------------------------------------------+ -// | Textual rules creation | -// +-----------------------------------------------------------------------+ - -// Rules are stored in database, serialized in an array. This array must be -// transformed into a list of textual rules. - -$search = get_search_array($_GET['search_id']); - -if (isset($search['q'])) -{ - $template->append( 'search_words', htmlspecialchars($search['q']) ); -} -else -{ - $template->assign( - array( - 'INTRODUCTION' - => 'OR' == $search['mode'] - ? l10n('At least one listed rule must be satisfied.') - : l10n('Each listed rule must be satisfied.'), - ) - ); -} - -if (isset($search['fields']['allwords'])) -{ - $template->append( - 'search_words', - l10n( - 'searched words : %s', - join(', ', $search['fields']['allwords']['words']) - ) - ); -} - -if (isset($search['fields']['tags'])) -{ - $template->assign('SEARCH_TAGS_MODE', $search['fields']['tags']['mode']); - - $query = ' -SELECT name - FROM '.TAGS_TABLE.' - WHERE id IN ('.implode(',', $search['fields']['tags']['words']).') -;'; - $template->assign( - 'search_tags', - array_from_query($query, 'name') - ); -} - -if (isset($search['fields']['author'])) -{ - $template->append( - 'search_words', - l10n( - 'author(s) : %s', - join(', ', array_map('strip_tags', $search['fields']['author']['words'])) - ) - ); -} - -if (isset($search['fields']['cat'])) -{ - if ($search['fields']['cat']['sub_inc']) - { - // searching all the categories id of sub-categories - $cat_ids = get_subcat_ids($search['fields']['cat']['words']); - } - else - { - $cat_ids = $search['fields']['cat']['words']; - } - - $query = ' -SELECT id, uppercats, global_rank - FROM '.CATEGORIES_TABLE.' - WHERE id IN ('. - implode(',', $cat_ids). - ') -;'; - $result = pwg_query($query); - - $categories = array(); - if (!empty($result)) - { - while ($row = pwg_db_fetch_assoc($result)) - { - $categories[] = $row; - } - } - usort($categories, 'global_rank_compare'); - - foreach ($categories as $category) - { - $template->append( - 'search_categories', - get_cat_display_name_cache( - $category['uppercats'], - null // no url on category names - ) - ); - } -} - -foreach (array('date_available', 'date_creation') as $datefield) -{ - if ('date_available' == $datefield) - { - $lang_items = array( - 'date' => l10n('posted on %s'), - 'period' => l10n('posted between %s (%s) and %s (%s)'), - 'after' => l10n('posted after %s (%s)'), - 'before' => l10n('posted before %s (%s)'), - ); - } - elseif ('date_creation' == $datefield) - { - $lang_items = array( - 'date' => l10n('created on %s'), - 'period' => l10n('created between %s (%s) and %s (%s)'), - 'after' => l10n('created after %s (%s)'), - 'before' => l10n('created before %s (%s)'), - ); - } - - $keys = array( - 'date' => $datefield, - 'after' => $datefield.'-after', - 'before' => $datefield.'-before', - ); - - if (isset($search['fields'][ $keys['date'] ])) - { - $template->assign( - strtoupper($datefield), - sprintf( - $lang_items['date'], - format_date($search['fields'][ $keys['date'] ]) - ) - ); - } - elseif (isset($search['fields'][ $keys['before'] ]) - and isset($search['fields'][ $keys['after'] ])) - { - $template->assign( - strtoupper($datefield), - sprintf( - $lang_items['period'], - - format_date($search['fields'][ $keys['after'] ]['date']), - inc_exc_str($search['fields'][ $keys['after'] ]['inc']), - - format_date($search['fields'][ $keys['before'] ]['date']), - inc_exc_str($search['fields'][ $keys['before'] ]['inc']) - ) - ); - } - elseif (isset($search['fields'][ $keys['before'] ])) - { - $template->assign( - strtoupper($datefield), - sprintf( - $lang_items['before'], - - format_date($search['fields'][ $keys['before'] ]['date']), - inc_exc_str($search['fields'][ $keys['before'] ]['inc']) - ) - ); - } - elseif (isset($search['fields'][ $keys['after'] ])) - { - $template->assign( - strtoupper($datefield), - sprintf( - $lang_items['after'], - - format_date($search['fields'][ $keys['after'] ]['date']), - inc_exc_str($search['fields'][ $keys['after'] ]['inc']) - ) - ); - } -} - -// +-----------------------------------------------------------------------+ -// | html code display | -// +-----------------------------------------------------------------------+ - -$template->pparse('search_rules'); -include(PHPWG_ROOT_PATH.'include/page_tail.php'); -?> \ No newline at end of file diff --git a/themes/default/template/index.tpl b/themes/default/template/index.tpl index 584a8cce8..191815358 100644 --- a/themes/default/template/index.tpl +++ b/themes/default/template/index.tpl @@ -85,12 +85,6 @@ str_added_by_widget_label = "{'Added by'|@translate}"; {'Edit'|@translate} {/if} -{if isset($U_SEARCH_RULES)} - {combine_script id='core.scripts' load='async' path='themes/default/js/scripts.js'} -
  • - (?) -
  • -{/if} {if isset($U_SLIDESHOW)}
  • {strip} {'slideshow'|@translate}