Exemple #1
0
<?php

if (!defined('MOD_INDEX')) {
    // Example of use
    require_once 'defaults.php';
    require_once INCLUDES_DIR . 'includes.php';
    require SMARTY_DIR . 'SmartyValidate.class.php';
    system_init();
    search_main();
    search_display();
}
function search_title($title, $sep)
{
    global $lang;
    return "{$title} {$sep} {$lang['search']['head']}";
}
function search_display()
{
    global $smarty;
    theme_init($smarty);
    $smarty->display('default.tpl');
    unset($smarty);
    do_action('shutdown');
}
function search_main()
{
    global $lang, $smarty;
    add_action('wp_title', 'search_title', 0, 2);
    if (empty($_GET)) {
        // display form
        $title = $lang['search']['head'];
Exemple #2
0
function index_main()
{
    global $fpdb, $smarty, $fp_config, $fp_params;
    $params = array();
    $module = 'index.tpl';
    $can404 = true;
    if (!empty($fp_params['entry'])) {
        index_singlepost($params, $module);
    } elseif (($explicit_req = $page = @$fp_params['page']) || empty($fp_params) && ($page = @$fp_config['general']['startpage'])) {
        index_staticpage($page, $explicit_req, $params, $module);
        return $module;
    } elseif (!empty($_GET['q'])) {
        include 'search.php';
        $module = search_main();
    } else {
        if (!empty($fp_params['feed'])) {
            $can404 = false;
            switch ($fp_params['feed']) {
                case 'atom':
                    header('Content-type: application/atom+xml');
                    $module = SHARED_TPLS . 'atom.tpl';
                    break;
                case 'rss2':
                default:
                    header('Content-type: application/rss+xml');
                    $module = SHARED_TPLS . 'rss.tpl';
            }
        }
        index_showposts($params, $module);
    }
    $params['fullparse'] = true;
    $fpdb->query($params);
    $q =& $fpdb->getQuery();
    list($id, $e) = $q->peekEntry();
    /* no entry found : 404 */
    if (!$e && $can404) {
        $module = index_404error();
    }
    return $module;
}