/**
 * Returns an array of 'items' corresponding to the search id.
 * It can be either a quick search or a regular search.
 *
 * @param int $search_id
 * @param bool $super_order_by
 * @param string $images_where optional aditional restriction on images table
 * @return array
 */
function get_search_results($search_id, $super_order_by, $images_where = '')
{
    $search = get_search_array($search_id);
    if (!isset($search['q'])) {
        $result['items'] = get_regular_search_results($search, $images_where);
        return $result;
    } else {
        return get_quick_search_results($search['q'], array('super_order_by' => $super_order_by, 'images_where' => $images_where));
    }
}
示例#2
0
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', $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']) . ')
;';