root/branches/release-40/php/lib/block.mtifarchivetypeenabled.php @ 2606

Revision 2606, 0.9 kB (checked in by takayama, 18 months ago)

Fixed BugId:80147
* The archive type without a mapping was disabled.

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
8function smarty_block_mtifarchivetypeenabled($args, $content, &$ctx, &$repeat) {
9    # status: complete
10    if (!isset($content)) {
11        $blog = $ctx->stash('blog');
12        $at = $args['type'];
13        $at or $at = $args['archive_type'];
14        $at = preg_quote($at);
15        $blog_at = ',' . $blog['blog_archive_type'] . ',';
16        $enabled = preg_match("/,$at,/", $blog_at);
17        $map = $ctx->mt->db->fetch_templatemap(
18            array('type' => $at, 'blog_id' => $blog['blog_id']));
19        if (empty($map))
20            $enabled = 0;
21        return $ctx->_hdlr_if($args, $content, $ctx, $repeat, $enabled);
22    } else {
23        return $ctx->_hdlr_if($args, $content, $ctx, $repeat);
24    }
25}
26?>
Note: See TracBrowser for help on using the browser.