Esempio n. 1
0
/**
 * Prepare the MainList object for displaying skins.
 *
 * @param integer max # of posts on the page
 */
function init_MainList($items_nb_limit)
{
    global $MainList, $Blog, $Plugins;
    global $preview;
    global $disp;
    global $postIDlist, $postIDarray;
    // Allow plugins to prepare their own MainList object
    if (!$Plugins->trigger_event_first_true('InitMainList', array('MainList' => &$MainList, 'limit' => $items_nb_limit))) {
        $MainList = new ItemList2($Blog, $Blog->get_timestamp_min(), $Blog->get_timestamp_max(), $items_nb_limit);
        // COPY (FUNC)
        if (!$preview) {
            if ($disp == 'page') {
                // Get pages:
                $MainList->set_default_filters(array('types' => '1000'));
            }
            // else: we are in posts mode
            // pre_dump( $MainList->default_filters );
            $MainList->load_from_Request(false);
            // pre_dump( $MainList->filters );
            // echo '<br/>'.( $MainList->is_filtered() ? 'filtered' : 'NOT filtered' );
            // $MainList->dump_active_filters();
            // Run the query:
            $MainList->query();
            // Old style globals for category.funcs:
            $postIDlist = $MainList->get_page_ID_list();
            $postIDarray = $MainList->get_page_ID_array();
        } else {
            // We want to preview a single post, we are going to fake a lot of things...
            $MainList->preview_from_request();
            // Legacy for the category display
            $cat_array = array();
        }
    }
    param('more', 'integer', 0, true);
    param('page', 'integer', 1, true);
    // Post page to show
    param('c', 'integer', 0, true);
    // Display comments?
    param('tb', 'integer', 0, true);
    // Display trackbacks?
    param('pb', 'integer', 0, true);
    // Display pingbacks?
}