Exemple #1
0
        $search_query = htmlspecialchars($_GET['search-notes']);
    }
    $url_array = array();
    reset($_GET);
    while (list($name, $value) = each($_GET)) {
        if (is_array($_GET[$name])) {
            while (list(, $value2) = each($_GET[$name])) {
                if (!empty($value2)) {
                    $url_array[] = urlencode($name . '[]') . '=' . urlencode($value2);
                }
            }
        } elseif ($name != 'from') {
            if (!empty($value)) {
                $url_array[] = urlencode($name) . '=' . urlencode($value);
            }
        }
    }
    $url_string = join('&', $url_array);
    if ($rows > 0) {
        $items_from = $from + 1;
        $from + $limit > $rows ? $items_to = $rows : ($items_to = $from + $limit);
        print '<div style="padding-top:7px;text-align:center;font-size:0.85em">Search results ' . $items_from . '-' . $items_to . ' of <span id="total-items">' . $rows . '</span> in ' . $microtime . '.</div>';
        mobile_show_search_results($result, $display);
    } else {
        print '<div style="padding-top:100px;color:#bfbeb9;font-size:28px;text-align:center"><b>No Hits</b></div>';
    }
    print '</div>';
    if (isset($_GET['from']) && $_GET['from'] > 0) {
        cache_store();
    }
}
    if ($orderby == 'year' || $orderby == 'addition_date' || $orderby == 'rating' || $orderby == 'id') {
        $ordering = 'ORDER BY ' . $orderby . ' DESC';
    }
    if ($orderby == 'id') {
        $ordering = '';
    }
    perform_search("SELECT id FROM library {$all_in} {$ordering}");
    if ($rows > 0) {
        $result = $result->fetchAll(PDO::FETCH_ASSOC);
        foreach ($result as $item) {
            $display_files_array[] = $item['id'];
        }
        $display_files2 = join(",", $display_files_array);
        // Read clipboard files.
        attach_clipboard($dbHandle);
        $clip_result = $dbHandle->query("SELECT id FROM clipboard.files WHERE id IN ({$display_files2})");
        $clip_files = $clip_result->fetchAll(PDO::FETCH_COLUMN);
        $clip_result = null;
        $items_from = $from + 1;
        $from + $limit > $rows ? $items_to = $rows : ($items_to = $from + $limit);
        print '<div style="text-align:center;font-size:0.85em">Items ' . $items_from . '-' . $items_to . ' of <span id="total-items">' . $rows . '</span></div>';
        $rows % $limit == 0 ? $lastpage = $rows - $limit : ($lastpage = $rows - $rows % $limit);
        mobile_show_search_results($result, $clip_files);
    } else {
        print '<div style="padding-top:100px;color:#bfbeb9;font-size:28px;text-align:center"><b>No Items</b></div>';
    }
    echo '</div>';
}
if (isset($_GET['from']) && $_GET['from'] > 0) {
    cache_store();
}