root/branches/release-38/php/lib/function.mtcommentlink.php @ 2366

Revision 2366, 0.7 kB (checked in by takayama, 19 months ago)

Fixed BugId:79785
* Load entry from comment when entry is not found in the context

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_function_mtcommentlink($args, &$ctx) {
9    $args['no_anchor'] = 1;
10    $c = $ctx->stash('comment');
11    $e = $ctx->stash('entry');
12    $need_clear = false;
13    if (empty($e)) {
14        $e = $ctx->mt->db->fetch_entry($c['comment_entry_id']);
15        $ctx->stash('entry', $e);
16        $need_clear = true;
17    }
18    $entry_link = $ctx->tag('EntryPermalink', $args);
19    $entry_link .= '#comment-' . $c['comment_id'];
20
21    if ($need_clear)
22        $ctx->stash('entry', null);
23
24    return $entry_link;
25}
Note: See TracBrowser for help on using the browser.