root/branches/release-29/php/lib/block.mtpages.php @ 1335

Revision 1335, 1.4 kB (checked in by takayama, 22 months ago)

Fixed BugId:66853
* Never use category filter when category class was not folder.

Line 
1<?php
2# Movable Type (r) Open Source (C) 2001-2008 Six Apart, Ltd.
3# This program is distributed under the terms of the
4# GNU General Public License, version 2.
5#
6# $Id$
7
8require_once('block.mtentries.php');
9function smarty_block_mtpages($args, $content, &$ctx, &$repeat) {
10    $args['class'] = 'page';
11    if (isset($args['include_subfolders']) &&
12        $args['include_subfolders'] == 1)
13    {
14        $args['include_subcategories'] = 1;
15    }
16    if (isset($args['folder'])) {
17        $args['category'] = $args['folder'];
18    }
19
20    if(isset($args['no_folder'])) {
21        $folders =& $ctx->mt->db->fetch_folders(array("blog_id" => $ctx->stash('blog_id')));
22        $not_folder = '';
23        if (isset($folders)) {
24            foreach ($folders as $folder) {
25                if ($not_folder == '') {
26                    $not_folder = $folder['category_label'];
27                } else {
28                    $not_folder = $not_folder.' OR '.$folder['category_label'];
29                }
30            }
31        }
32        if ($not_folder != '') {
33            $args['category'] = "NOT ($not_folder)";
34        }
35    }
36
37    $localvars = array('current_timestamp', 'current_timestamp_end', 'current_archive_type');
38    $ctx->localize($localvars);
39    foreach ($localvars as $localvar) {
40        $ctx->__stash[$localvar] = null;
41    }
42
43    $out = smarty_block_mtentries($args, $content, $ctx, $repeat);
44
45    $ctx->restore($localvars);
46
47    return $out;
48}
49?>
Note: See TracBrowser for help on using the browser.