mirror of
https://github.com/Piwigo/Piwigo.git
synced 2025-04-26 11:19:55 +03:00
fixes #1930 remove search_rules
This commit is contained in:
parent
fdabd4a988
commit
0534202c40
5 changed files with 1 additions and 247 deletions
|
@ -90,7 +90,6 @@ $eligible_templates = array(
|
||||||
'redirect.tpl' => 'redirect',
|
'redirect.tpl' => 'redirect',
|
||||||
'register.tpl' => 'register',
|
'register.tpl' => 'register',
|
||||||
'search.tpl' => 'search',
|
'search.tpl' => 'search',
|
||||||
'search_rules.tpl' => 'search_rules',
|
|
||||||
'slideshow.tpl' => 'slideshow',
|
'slideshow.tpl' => 'slideshow',
|
||||||
'tags.tpl' => 'tags',
|
'tags.tpl' => 'tags',
|
||||||
'thumbnails.tpl' => 'index_thumbnails',
|
'thumbnails.tpl' => 'index_thumbnails',
|
||||||
|
|
|
@ -176,12 +176,6 @@ if ( empty($page['is_external']) )
|
||||||
|
|
||||||
if ('search' == $page['section'])
|
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');
|
include_once(PHPWG_ROOT_PATH.'include/functions_search.inc.php');
|
||||||
|
|
||||||
$my_search = get_search_array($page['search']);
|
$my_search = get_search_array($page['search']);
|
||||||
|
|
|
@ -65,9 +65,7 @@ $lang['Anti-flood system : please wait for a moment before trying to post anothe
|
||||||
$lang['Any tag'] = "Any tag";
|
$lang['Any tag'] = "Any tag";
|
||||||
$lang['Are you sure?'] = "Are you sure?";
|
$lang['Are you sure?'] = "Are you sure?";
|
||||||
$lang['ascending'] = "ascending";
|
$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'] = "Author";
|
||||||
$lang['author(s) : %s'] = 'author(s): %s';
|
|
||||||
$lang['Author: %s'] = "Author: %s";
|
$lang['Author: %s'] = "Author: %s";
|
||||||
$lang['Auto login'] = "Auto login";
|
$lang['Auto login'] = "Auto login";
|
||||||
$lang['available for administrators only'] = "available for administrators only";
|
$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['Display'] = "Display";
|
||||||
$lang['Download this file'] = "Download this file";
|
$lang['Download this file'] = "Download this file";
|
||||||
$lang['Download'] = "download";
|
$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 a comment'] = "Edit a comment";
|
||||||
$lang['edit'] = "edit"; //TO remove
|
$lang['edit'] = "edit"; //TO remove
|
||||||
$lang['Edit'] = 'Edit';
|
$lang['Edit'] = 'Edit';
|
||||||
|
@ -316,11 +313,9 @@ $lang['Search for words'] = "Search for words";
|
||||||
$lang['Search in albums'] = "Search in albums";
|
$lang['Search in albums'] = "Search in albums";
|
||||||
$lang['Search in sub-albums'] = "Search in sub-albums";
|
$lang['Search in sub-albums'] = "Search in sub-albums";
|
||||||
$lang['Search results'] = "Search results";
|
$lang['Search results'] = "Search results";
|
||||||
$lang['Search rules'] = "Search criteria";
|
|
||||||
$lang['Search tags'] = "Search tags";
|
$lang['Search tags'] = "Search tags";
|
||||||
$lang['Search'] = "Search";
|
$lang['Search'] = "Search";
|
||||||
$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['Send my connection settings by email'] = 'Send my connection settings by email';
|
||||||
$lang['Sent by'] = "Sent by";
|
$lang['Sent by'] = "Sent by";
|
||||||
$lang['set as album representative'] = "set as album thumbnail";
|
$lang['set as album representative'] = "set as album thumbnail";
|
||||||
|
|
228
search_rules.php
228
search_rules.php
|
@ -1,228 +0,0 @@
|
||||||
<?php
|
|
||||||
// +-----------------------------------------------------------------------+
|
|
||||||
// | This file is part of Piwigo. |
|
|
||||||
// | |
|
|
||||||
// | For copyright and license information, please view the COPYING.txt |
|
|
||||||
// | file that was distributed with this source code. |
|
|
||||||
// +-----------------------------------------------------------------------+
|
|
||||||
|
|
||||||
/**
|
|
||||||
* returns language value 'included' or 'excluded' depending on boolean
|
|
||||||
* value. This function is useful only to make duplicate code shorter
|
|
||||||
*
|
|
||||||
* @param bool is_included
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
function inc_exc_str($is_included)
|
|
||||||
{
|
|
||||||
return $is_included ? l10n('included') : l10n('excluded');
|
|
||||||
}
|
|
||||||
|
|
||||||
// +-----------------------------------------------------------------------+
|
|
||||||
// | initialization |
|
|
||||||
// +-----------------------------------------------------------------------+
|
|
||||||
|
|
||||||
define('PHPWG_ROOT_PATH','./');
|
|
||||||
include_once( PHPWG_ROOT_PATH.'include/common.inc.php' );
|
|
||||||
check_status(ACCESS_FREE);
|
|
||||||
include_once( PHPWG_ROOT_PATH.'include/functions_search.inc.php' );
|
|
||||||
|
|
||||||
$page['body_id'] = 'thePopuphelpPage';
|
|
||||||
$title = l10n('Piwigo Help');
|
|
||||||
$page['page_banner'] = '';
|
|
||||||
$page['meta_robots']=array('noindex'=>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');
|
|
||||||
?>
|
|
|
@ -85,12 +85,6 @@ str_added_by_widget_label = "{'Added by'|@translate}";
|
||||||
<span class="pwg-icon pwg-icon-category-edit"></span><span class="pwg-button-text">{'Edit'|@translate}</span>
|
<span class="pwg-icon pwg-icon-category-edit"></span><span class="pwg-button-text">{'Edit'|@translate}</span>
|
||||||
</a></li>
|
</a></li>
|
||||||
{/if}
|
{/if}
|
||||||
{if isset($U_SEARCH_RULES)}
|
|
||||||
{combine_script id='core.scripts' load='async' path='themes/default/js/scripts.js'}
|
|
||||||
<li><a href="{$U_SEARCH_RULES}" onclick="popuphelp(this.href); return false;" title="{'Search rules'|@translate}" class="pwg-state-default pwg-button" rel="nofollow">
|
|
||||||
<span class="pwg-icon pwg-icon-help"></span><span class="pwg-button-text">(?)</span>
|
|
||||||
</a></li>
|
|
||||||
{/if}
|
|
||||||
{if isset($U_SLIDESHOW)}
|
{if isset($U_SLIDESHOW)}
|
||||||
<li id="cmdSlideshow">{strip}<a href="{$U_SLIDESHOW}" title="{'slideshow'|@translate}" class="pwg-state-default pwg-button" rel="nofollow">
|
<li id="cmdSlideshow">{strip}<a href="{$U_SLIDESHOW}" title="{'slideshow'|@translate}" class="pwg-state-default pwg-button" rel="nofollow">
|
||||||
<span class="pwg-icon pwg-icon-slideshow"></span><span class="pwg-button-text">{'slideshow'|@translate}</span>
|
<span class="pwg-icon pwg-icon-slideshow"></span><span class="pwg-button-text">{'slideshow'|@translate}</span>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue