/**
  * Display the widget!
  *
  * @param array MUST contain at least the basic display params
  */
 function display($params)
 {
     /**
      * @var ItemList2
      */
     global $MainList;
     global $BlogCache, $Blog;
     global $Item, $Settings;
     $this->init_display($params);
     $blog_ID = intval($this->disp_params['blog_ID']);
     $listBlog = $blog_ID ? $BlogCache->get_by_ID($blog_ID, false) : $Blog;
     if (empty($listBlog)) {
         echo $this->disp_params['block_start'];
         echo $this->disp_params['block_body_start'];
         echo T_('The requested Blog doesn\'t exist any more!');
         echo $this->disp_params['block_body_end'];
         echo $this->disp_params['block_end'];
         return;
     }
     // Define default template params that can be rewritten by skin
     $this->disp_params = array_merge(array('item_first_image_before' => '<div class="item_first_image">', 'item_first_image_after' => '</div>', 'item_first_image_placeholder' => '<div class="item_first_image_placeholder"><a href="$item_permaurl$"></a></div>', 'item_title_before' => '<div class="item_title">', 'item_title_after' => '</div>', 'item_title_single_before' => '', 'item_title_single_after' => '', 'item_excerpt_before' => '<div class="item_excerpt">', 'item_excerpt_after' => '</div>', 'item_content_before' => '<div class="item_content">', 'item_content_after' => '</div>', 'item_images_before' => '<div class="item_images">', 'item_images_after' => '</div>'), $this->disp_params);
     // Create ItemList
     // Note: we pass a widget specific prefix in order to make sure to never interfere with the mainlist
     $limit = intval($this->disp_params['limit']);
     if ($this->disp_params['disp_teaser']) {
         // We want to show some of the post content, we need to load more info: use ItemList2
         $ItemList = new ItemList2($listBlog, $listBlog->get_timestamp_min(), $listBlog->get_timestamp_max(), $limit, 'ItemCache', $this->code . '_');
     } else {
         // no excerpts, use ItemListLight
         load_class('items/model/_itemlistlight.class.php', 'ItemListLight');
         $ItemList = new ItemListLight($listBlog, $listBlog->get_timestamp_min(), $listBlog->get_timestamp_max(), $limit, 'ItemCacheLight', $this->code . '_');
     }
     $cat_array = sanitize_id_list($this->disp_params['cat_IDs'], true);
     // Filter list:
     $filters = array('cat_array' => $cat_array, 'orderby' => $this->disp_params['order_by'], 'order' => $this->disp_params['order_dir'], 'unit' => 'posts', 'coll_IDs' => $this->disp_params['blog_ID']);
     if ($this->disp_params['item_visibility'] == 'public') {
         // Get only the public items
         $filters['visibility_array'] = array('published');
     }
     if (isset($this->disp_params['page'])) {
         $filters['page'] = $this->disp_params['page'];
     }
     if ($this->disp_params['item_type'] != '#') {
         // Not "default", restrict to a specific type (or '' for all)
         $filters['types'] = $this->disp_params['item_type'];
     }
     if ($this->disp_params['follow_mainlist'] == 'tags') {
         // Restrict to Item tagged with some tag used in the Mainlist:
         if (!isset($MainList)) {
             // Nothing to follow, don't display anything
             return false;
         }
         $all_tags = $MainList->get_all_tags();
         if (empty($all_tags)) {
             // Nothing to follow, don't display anything
             return false;
         }
         $filters['tags'] = implode(',', $all_tags);
         if (!empty($Item)) {
             // Exclude current Item
             $filters['post_ID'] = '-' . $Item->ID;
         }
         // fp> TODO: in addition to just filtering, offer ordering in a way where the posts with the most matching tags come first
     }
     $chapter_mode = false;
     if ($this->disp_params['item_group_by'] == 'chapter') {
         // Group by chapter:
         $chapter_mode = true;
         # This is the list of categories to restrict the linkblog to (cats will be displayed recursively)
         # Example: $linkblog_cat = '4,6,7';
         $linkblog_cat = '';
         # This is the array if categories to restrict the linkblog to (non recursive)
         # Example: $linkblog_catsel = array( 4, 6, 7 );
         $linkblog_catsel = array();
         // $cat_array;
         // Compile cat array stuff:
         $linkblog_cat_array = array();
         $linkblog_cat_modifier = '';
         compile_cat_array($linkblog_cat, $linkblog_catsel, $linkblog_cat_array, $linkblog_cat_modifier, $listBlog->ID);
         $filters['cat_array'] = $linkblog_cat_array;
         $filters['cat_modifier'] = $linkblog_cat_modifier;
     }
     $ItemList->set_filters($filters, false);
     // we don't want to memorize these params
     // Run the query:
     $ItemList->query();
     if (!$ItemList->result_num_rows) {
         // Nothing to display:
         return;
     }
     // Check if the widget displays only single title
     $this->disp_params['disp_only_title'] = !($this->disp_params['attached_pics'] != 'none' || $this->disp_params['disp_excerpt'] || $this->disp_params['disp_teaser']);
     // Start to capture display content here in order to solve the issue to don't display empty widget
     ob_start();
     // This variable used to display widget. Will be set to true when content is displayed
     $content_is_displayed = false;
     // Get extra classes depending on widget settings:
     $block_css_class = $this->get_widget_extra_class();
     if (empty($block_css_class)) {
         // No extra class, Display default wrapper:
         echo $this->disp_params['block_start'];
     } else {
         // Append extra classes for widget block:
         echo preg_replace('/ class="([^"]+)"/', ' class="$1' . $block_css_class . '"', $this->disp_params['block_start']);
     }
     $title = sprintf($this->disp_params['title_link'] ? '<a href="' . $listBlog->gen_blogurl() . '" rel="nofollow">%s</a>' : '%s', $this->disp_params['title']);
     $this->disp_title($title);
     echo $this->disp_params['block_body_start'];
     if ($chapter_mode) {
         // List grouped by chapter/category:
         $items_map_by_chapter = array();
         $chapters_of_loaded_items = array();
         $group_by_blogs = false;
         $prev_chapter_blog_ID = NULL;
         while ($iterator_Item =& $ItemList->get_item()) {
             // Display contents of the Item depending on widget params:
             $Chapter =& $iterator_Item->get_main_Chapter();
             if (!isset($items_map_by_chapter[$Chapter->ID])) {
                 $items_map_by_chapter[$Chapter->ID] = array();
                 $chapters_of_loaded_items[] = $Chapter;
             }
             $items_map_by_chapter[$Chapter->ID][] = $iterator_Item;
             // Group by blogs if there are chapters from multiple blogs
             if (!$group_by_blogs && $Chapter->blog_ID != $prev_chapter_blog_ID) {
                 // group by blogs is not decided yet
                 $group_by_blogs = $prev_chapter_blog_ID != NULL;
                 $prev_chapter_blog_ID = $Chapter->blog_ID;
             }
         }
         usort($chapters_of_loaded_items, 'Chapter::compare_chapters');
         $displayed_blog_ID = NULL;
         if ($group_by_blogs && isset($this->disp_params['collist_start'])) {
             // Start list of blogs
             echo $this->disp_params['collist_start'];
         } else {
             // Display list start, all chapters are in the same group ( not grouped by blogs )
             echo $this->disp_params['list_start'];
         }
         foreach ($chapters_of_loaded_items as $Chapter) {
             if ($group_by_blogs && $displayed_blog_ID != $Chapter->blog_ID) {
                 $Chapter->get_Blog();
                 if ($displayed_blog_ID != NULL) {
                     // Display the end of the previous blog's chapter list
                     echo $this->disp_params['list_end'];
                 }
                 echo $this->disp_params['coll_start'] . $Chapter->Blog->get('shortname') . $this->disp_params['coll_end'];
                 // Display start of blog's chapter list
                 echo $this->disp_params['list_start'];
                 $displayed_blog_ID = $Chapter->blog_ID;
             }
             $content_is_displayed = $this->disp_chapter($Chapter, $items_map_by_chapter) || $content_is_displayed;
         }
         if ($content_is_displayed) {
             // End of a chapter list - if some content was displayed this is always required
             echo $this->disp_params['list_end'];
         }
         if ($group_by_blogs && isset($this->disp_params['collist_end'])) {
             // End of blog list
             echo $this->disp_params['collist_end'];
         }
     } else {
         // Plain list:
         echo $this->disp_params['list_start'];
         /**
          * @var ItemLight (or Item)
          */
         while ($Item =& $ItemList->get_item()) {
             // Display contents of the Item depending on widget params:
             $content_is_displayed = $this->disp_contents($Item) || $content_is_displayed;
         }
         if (isset($this->disp_params['page'])) {
             if (empty($this->disp_params['pagination'])) {
                 $this->disp_params['pagination'] = array();
             }
             $ItemList->page_links($this->disp_params['pagination']);
         }
         echo $this->disp_params['list_end'];
     }
     echo $this->disp_params['block_body_end'];
     echo $this->disp_params['block_end'];
     if ($content_is_displayed) {
         // Some content is displayed, Print out widget
         ob_end_flush();
     } else {
         // No content, Don't display widget
         ob_end_clean();
     }
 }
Example #2
0
/**
 * wp.getPageList
 *
 * @see http://codex.wordpress.org/XML-RPC_wp#wp.getPageList
 *
 * @param xmlrpcmsg XML-RPC Message
 *					0 blogid (int): Unique identifier of the blog.
 *					1 username (string): User login.
 *					2 password (string): Password for said username.
 */
function wp_getpagelist($m)
{
    // CHECK LOGIN:
    /**
     * @var User
     */
    if (!($current_User =& xmlrpcs_login($m, 1, 2))) {
        // Login failed, return (last) error:
        return xmlrpcs_resperror();
    }
    // GET BLOG:
    /**
     * @var Blog
     */
    if (!($Blog =& xmlrpcs_get_Blog($m, 0))) {
        // Login failed, return (last) error:
        return xmlrpcs_resperror();
    }
    // Get the pages to display:
    load_class('items/model/_itemlistlight.class.php', 'ItemListLight');
    $MainList = new ItemListLight($Blog, NULL, NULL, 0);
    // Protected and private get checked by statuses_where_clause().
    $statuses = array('published', 'redirected', 'protected', 'private');
    if ($current_User->check_perm('blog_ismember', 'view', false, $Blog->ID)) {
        // These statuses require member status:
        $statuses = array_merge($statuses, array('draft', 'deprecated'));
    }
    logIO('Statuses: ' . implode(', ', $statuses));
    $MainList->set_filters(array('visibility_array' => $statuses, 'order' => 'DESC', 'unit' => 'posts', 'types' => '1000'));
    // Run the query:
    $MainList->query();
    logIO('Items:' . $MainList->result_num_rows);
    $data = array();
    while ($Item =& $MainList->get_item()) {
        logIO('Item:' . $Item->title . ' - Issued: ' . $Item->issue_date . ' - Modified: ' . $Item->datemodified);
        $data[] = new xmlrpcval(array('page_id' => new xmlrpcval($Item->ID, 'int'), 'page_title' => new xmlrpcval($Item->title), 'page_parent_id' => new xmlrpcval(isset($Item->parent_ID) ? $Item->parent_ID : 0, 'int'), 'dateCreated' => new xmlrpcval(datetime_to_iso8601($Item->issue_date), 'dateTime.iso8601'), 'date_created_gmt' => new xmlrpcval(datetime_to_iso8601($Item->issue_date, true), 'dateTime.iso8601')), 'struct');
    }
    logIO('OK.');
    return new xmlrpcresp(new xmlrpcval($data, 'array'));
}
 /**
  * Display the widget!
  *
  * @param array MUST contain at least the basic display params
  */
 function display($params)
 {
     /**
      * @var ItemList2
      */
     global $MainList;
     global $BlogCache, $Blog;
     global $Item;
     $this->init_display($params);
     if ($this->disp_params['order_by'] == 'RAND' && isset($this->BlockCache)) {
         // Do NOT cache if display order is random
         $this->BlockCache->abort_collect();
     }
     $listBlog = $this->disp_params['blog_ID'] ? $BlogCache->get_by_ID($this->disp_params['blog_ID'], false) : $Blog;
     if (empty($listBlog)) {
         echo $this->disp_params['block_start'];
         echo T_('The requested Blog doesn\'t exist any more!');
         echo $this->disp_params['block_end'];
         return;
     }
     // Create ItemList
     // Note: we pass a widget specific prefix in order to make sure to never interfere with the mainlist
     $limit = $this->disp_params['limit'];
     if ($this->disp_params['disp_teaser']) {
         // We want to show some of the post content, we need to load more info: use ItemList2
         $ItemList = new ItemList2($listBlog, $listBlog->get_timestamp_min(), $listBlog->get_timestamp_max(), $limit, 'ItemCache', $this->code . '_');
     } else {
         // no excerpts, use ItemListLight
         load_class('items/model/_itemlistlight.class.php', 'ItemListLight');
         $ItemList = new ItemListLight($listBlog, $listBlog->get_timestamp_min(), $listBlog->get_timestamp_max(), $limit, 'ItemCacheLight', $this->code . '_');
     }
     //$cat_array = sanitize_id_list($this->disp_params['cat_IDs'], true);
     // Filter list:
     $filters = array('orderby' => $this->disp_params['order_by'], 'order' => $this->disp_params['order_dir'], 'unit' => 'posts');
     if (isset($this->disp_params['page'])) {
         $filters['page'] = $this->disp_params['page'];
     }
     if ($this->disp_params['item_type'] != '#') {
         // Not "default", restrict to a specific type (or '' for all)
         $filters['types'] = $this->disp_params['item_type'];
     }
     if ($this->disp_params['follow_mainlist'] == 'tags') {
         // Restrict to Item tagged with some tag used in the Mainlist:
         if (!isset($MainList)) {
             // Nothing to follow, don't display anything
             return false;
         }
         $all_tags = $MainList->get_all_tags();
         if (empty($all_tags)) {
             // Nothing to follow, don't display anything
             return false;
         }
         $filters['tags'] = implode(',', $all_tags);
         if (!empty($Item)) {
             // Exclude current Item
             $filters['post_ID'] = '-' . $Item->ID;
         }
         // fp> TODO: in addition to just filtering, offer ordering in a way where the posts with the most matching tags come first
     }
     $chapter_mode = false;
     if ($this->disp_params['item_group_by'] == 'chapter') {
         // Group by chapter:
         $chapter_mode = true;
         # This is the list of categories to restrict the linkblog to (cats will be displayed recursively)
         # Example: $linkblog_cat = '4,6,7';
         $linkblog_cat = '';
         # This is the array if categories to restrict the linkblog to (non recursive)
         # Example: $linkblog_catsel = array( 4, 6, 7 );
         $linkblog_catsel = array();
         // $cat_array;
         // Compile cat array stuff:
         $linkblog_cat_array = array();
         $linkblog_cat_modifier = '';
         compile_cat_array($linkblog_cat, $linkblog_catsel, $linkblog_cat_array, $linkblog_cat_modifier, $listBlog->ID);
         $filters['cat_array'] = $linkblog_cat_array;
         $filters['cat_modifier'] = $linkblog_cat_modifier;
         $filters['orderby'] = 'main_cat_ID ' . $filters['orderby'];
     }
     $ItemList->set_filters($filters, false);
     // we don't want to memorize these params
     // Run the query:
     $ItemList->query();
     if (!$ItemList->result_num_rows) {
         // Nothing to display:
         return;
     }
     // Start to capture display content here in order to solve the issue to don't display empty widget
     ob_start();
     // This variable used to display widget. Will be set to true when content is displayed
     $content_is_displayed = false;
     if (!$this->disp_params['disp_title'] && in_array($this->disp_params['attached_pics'], array('first', 'all'))) {
         // Don't display bullets when we show only the pictures
         $block_css_class = 'nobullets';
     }
     if (empty($block_css_class)) {
         echo $this->disp_params['block_start'];
     } else {
         // Additional class for widget block
         echo preg_replace('/ class="([^"]+)"/', ' class="$1 ' . $block_css_class . '"', $this->disp_params['block_start']);
     }
     $title = sprintf($this->disp_params['title_link'] ? '<a href="' . $listBlog->gen_blogurl() . '" rel="nofollow">%s</a>' : '%s', $this->disp_params['title']);
     $this->disp_title($title);
     echo $this->disp_params['list_start'];
     if ($chapter_mode) {
         // List grouped by chapter/category:
         /**
          * @var ItemLight (or Item)
          */
         while ($Item =& $ItemList->get_category_group()) {
             // Open new cat:
             $Chapter =& $Item->get_main_Chapter();
             echo $this->disp_params['item_start'];
             echo '<a href="' . $Chapter->get_permanent_url() . '">' . $Chapter->get('name') . '</a>';
             echo $this->disp_params['group_start'];
             while ($Item =& $ItemList->get_item()) {
                 // Display contents of the Item depending on widget params:
                 $content_is_displayed = $this->disp_contents($Item) || $content_is_displayed;
             }
             // Close cat
             echo $this->disp_params['group_end'];
             echo $this->disp_params['item_end'];
         }
     } else {
         // Plain list:
         /**
          * @var ItemLight (or Item)
          */
         while ($Item =& $ItemList->get_item()) {
             // Display contents of the Item depending on widget params:
             $content_is_displayed = $this->disp_contents($Item) || $content_is_displayed;
         }
     }
     if (isset($this->disp_params['page'])) {
         $ItemList->page_links();
     }
     echo $this->disp_params['list_end'];
     echo $this->disp_params['block_end'];
     if ($content_is_displayed) {
         // Some content is displayed, Print out widget
         ob_end_flush();
     } else {
         // No content, Don't display widget
         ob_end_clean();
     }
 }
Example #4
0
 *
 * @version $Id: index.main.php 3157 2013-03-06 04:34:44Z fplanque $
 */
if (!defined('EVO_MAIN_INIT')) {
    die('Please, do not access this page directly.');
}
$Timer->resume('prepare list');
load_class('/items/model/_itemlistlight.class.php', 'ItemListLight');
// Use a LIGHT Item List:  (Sitemap = 50000 entries max)
$MainList = new ItemListLight($Blog, $Blog->get_timestamp_min(), $Blog->get_timestamp_max(), 50000);
// By default we only want items that have the MAIN cat in this blog,
// i-e with its canonical URL in this blog (cross posted stuff will be listed in its main blog)
// However this may be overriden in a stub (or param)
param('cat_focus', 'string', 'main');
// Filter list:
$MainList->set_filters(array('visibility_array' => array('published'), 'types' => '-' . implode(',', $posttypes_nopermanentURL), 'unit' => 'all', 'cat_focus' => $cat_focus));
// pre_dump( $cat_focus, $MainList->filters );
// Run the query:
$MainList->query();
// Old style globals for category.funcs:
// TODO: dh> check if still required.
$postIDlist = $MainList->get_page_ID_list();
$postIDarray = $MainList->get_page_ID_array();
$Timer->stop('prepare list');
$Timer->resume('display list');
// TODO: dh> add entry for homepage (lastmod of latest item)
// TODO: dh> take comments into consideration for prio
// TODO: dh> use main Blog URL only, since google requires them to be on the same domain/path
// (see sitemap_plugin)
// Note: since URLs are likely to be clean ASCII, $io_charset can probably be faked to UTF-8 here
headers_content_mightcache('application/xml', '#', 'UTF-8');
Example #5
0
    /**
     * Constructor
     *
     * Note: Weekly archives use MySQL's week numbering and MySQL default if applicable.
     * In MySQL < 4.0.14, WEEK() always uses mode 0: Week starts on Sunday;
     * Value range is 0 to 53; week 1 is the first week that starts in this year.
     *
     * @link http://dev.mysql.com/doc/mysql/en/date-and-time-functions.html
     *
     * @todo categories combined with 'ALL' are not supported (will output too many archives,
     * some of which will resolve to no results). We need subqueries to support this efficiently.
     *
     * @param string
     * @param integer
     * @param boolean
     */
    function ArchiveList($archive_mode = 'monthly', $limit = 100, $sort_order = 'date', $preserve_context = false, $dbtable = 'T_items__item', $dbprefix = 'post_', $dbIDname = 'ID')
    {
        global $DB;
        global $blog, $cat, $catsel;
        global $Blog;
        global $show_statuses;
        global $author, $assgn, $status, $types;
        global $s, $sentence, $exact;
        global $posttypes_specialtypes;
        $this->dbtable = $dbtable;
        $this->dbprefix = $dbprefix;
        $this->dbIDname = $dbIDname;
        $this->archive_mode = $archive_mode;
        /*
         * WE ARE GOING TO CONSTRUCT THE WHERE CLOSE...
         */
        $this->ItemQuery = new ItemQuery($this->dbtable, $this->dbprefix, $this->dbIDname);
        // TEMPORARY OBJ
        // - - Select a specific Item:
        // $this->ItemQuery->where_ID( $p, $title );
        if (is_admin_page()) {
            // Don't restrict by date in the Back-office
            $timestamp_min = NULL;
            $timestamp_max = NULL;
        } else {
            // Restrict posts by date started
            $timestamp_min = $Blog->get_timestamp_min();
            $timestamp_max = $Blog->get_timestamp_max();
        }
        if ($preserve_context) {
            // We want to preserve the current context:
            // * - - Restrict to selected blog/categories:
            $this->ItemQuery->where_chapter($blog, $cat, $catsel);
            // * Restrict to the statuses we want to show:
            $this->ItemQuery->where_visibility($show_statuses);
            // Restrict to selected authors:
            $this->ItemQuery->where_author($author);
            // Restrict to selected assignees:
            $this->ItemQuery->where_assignees($assgn);
            // Restrict to selected satuses:
            $this->ItemQuery->where_statuses($status);
            // - - - + * * timestamp restrictions:
            $this->ItemQuery->where_datestart('', '', '', '', $timestamp_min, $timestamp_max);
            // Keyword search stuff:
            $this->ItemQuery->where_keywords($s, $sentence, $exact);
            $this->ItemQuery->where_types($types);
        } else {
            // We want to preserve only the minimal context:
            // * - - Restrict to selected blog/categories:
            $this->ItemQuery->where_chapter($blog, '', array());
            // * Restrict to the statuses we want to show:
            $this->ItemQuery->where_visibility($show_statuses);
            // - - - + * * timestamp restrictions:
            $this->ItemQuery->where_datestart('', '', '', '', $timestamp_min, $timestamp_max);
            // Include all types except pages, intros and sidebar links:
            $this->ItemQuery->where_types('-' . implode(',', $posttypes_specialtypes));
        }
        $this->from = $this->ItemQuery->get_from();
        $this->where = $this->ItemQuery->get_where();
        $this->group_by = $this->ItemQuery->get_group_by();
        switch ($this->archive_mode) {
            case 'monthly':
                // ------------------------------ MONTHLY ARCHIVES ------------------------------------
                $sql = 'SELECT EXTRACT(YEAR FROM ' . $this->dbprefix . 'datestart) AS year, EXTRACT(MONTH FROM ' . $this->dbprefix . 'datestart) AS month,
																	COUNT(DISTINCT postcat_post_ID) AS count ' . $this->from . $this->where . '
													GROUP BY year, month
													ORDER BY year DESC, month DESC';
                break;
            case 'daily':
                // ------------------------------- DAILY ARCHIVES -------------------------------------
                $sql = 'SELECT EXTRACT(YEAR FROM ' . $this->dbprefix . 'datestart) AS year, MONTH(' . $this->dbprefix . 'datestart) AS month,
																	DAYOFMONTH(' . $this->dbprefix . 'datestart) AS day,
																	COUNT(DISTINCT postcat_post_ID) AS count ' . $this->from . $this->where . '
													GROUP BY year, month, day
													ORDER BY year DESC, month DESC, day DESC';
                break;
            case 'weekly':
                // ------------------------------- WEEKLY ARCHIVES -------------------------------------
                $sql = 'SELECT EXTRACT(YEAR FROM ' . $this->dbprefix . 'datestart) AS year, ' . $DB->week($this->dbprefix . 'datestart', locale_startofweek()) . ' AS week,
															COUNT(DISTINCT postcat_post_ID) AS count ' . $this->from . $this->where . '
													GROUP BY year, week
													ORDER BY year DESC, week DESC';
                break;
            case 'postbypost':
            default:
                // ----------------------------- POSY BY POST ARCHIVES --------------------------------
                $this->count_total_rows();
                $archives_list = new ItemListLight($Blog, $Blog->get_timestamp_min(), $Blog->get_timestamp_max(), $this->total_rows);
                $archives_list->set_filters(array('visibility_array' => array('published'), 'types' => '-' . implode(',', $posttypes_specialtypes)));
                if ($sort_order == 'title') {
                    $archives_list->set_filters(array('orderby' => 'title', 'order' => 'ASC'));
                }
                $archives_list->query();
                $this->rows = array();
                while ($Item = $archives_list->get_item()) {
                    $this->rows[] = $Item;
                }
                $this->result_num_rows = $archives_list->result_num_rows;
                $this->current_idx = 0;
                $this->arc_w_last = '';
                return;
        }
        // dh> Temp fix for MySQL bug - apparently in/around 4.1.21/5.0.24.
        // See http://forums.b2evolution.net/viewtopic.php?p=42529#42529
        if (in_array($this->archive_mode, array('monthly', 'daily', 'weekly'))) {
            $sql_version = $DB->get_version();
            if (version_compare($sql_version, '4', '>')) {
                $sql = 'SELECT SQL_CALC_FOUND_ROWS ' . substr($sql, 7);
                // "SQL_CALC_FOUND_ROWS" available since MySQL 4
            }
        }
        parent::Results($sql, 'archivelist_', '', $limit);
        $this->restart();
    }