Exemple #1
0
        }
        $search = new Search();
        //get all the addon filtered by category/query and other
        $data['addon_data'] = $search->searchAddons($searchinput['query'], $data['current_type'], '1', null, $offset, $mb['view_range']['addon_view_range']);
        //Calculate total number of page required
        $page_total = ceil($data['addon_data']['row_count'] / $mb['view_range']['addon_view_range']);
        //Current page URL without page number parameter
        $generated_url = $link['addon']['home'] . "s/?q=" . urlencode($searchinput['query']) . "&type=" . $addon_type;
        //Previous and Next page link for search engine optimization
        $generated_url_prev = $current_page == 1 ? null : $generated_url . '&p=' . ($current_page - 1);
        $generated_url_next = $page_total == $current_page ? null : $generated_url . '&p=' . ($current_page + 1);
        if ($data['is_overview']) {
            $data['addon_data_new'] = $search->searchAddons($searchinput['query'], $data['current_type'], '1', null, 0, 5, "publish_date DESC");
            $data['addon_data_updated'] = $search->searchAddons($searchinput['query'], $data['current_type'], '1', null, 0, 5, "update_date DESC");
            $data['addon_data_like'] = $search->searchAddons($searchinput['query'], $data['current_type'], '1', null, 0, 8, "downloadCount DESC, likesCount DESC", true);
            $data['top_members'] = $addon->getTopMembers();
        }
        if (isset($mb['main_menu']['add-ons']['sub_menu'][$addon_type]['desc'])) {
            $meta_description = $mb['main_menu']['add-ons']['sub_menu'][$addon_type]['desc'];
        } else {
            $meta_description = strip_tags($lang['addon_45']);
        }
        include_once $link['root'] . 'views/addons.search.template.php';
        exit;
    } else {
        header("HTTP/1.0 404 Not Found");
        include_once $link['404'];
        exit;
    }
} else {
    header("Location: " . $link['addon']['home'] . "s/?type=all&overview");