Changeset 2366

Show
Ignore:
Timestamp:
05/16/08 22:13:53 (21 months ago)
Author:
takayama
Message:

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

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/release-38/php/lib/function.mtcommentlink.php

    r2338 r2366  
    77 
    88function smarty_function_mtcommentlink($args, &$ctx) { 
     9    $args['no_anchor'] = 1; 
    910    $c = $ctx->stash('comment'); 
    10     $args['no_anchor'] = 1; 
     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    } 
    1118    $entry_link = $ctx->tag('EntryPermalink', $args); 
    1219    $entry_link .= '#comment-' . $c['comment_id']; 
     20 
     21    if ($need_clear) 
     22        $ctx->stash('entry', null); 
     23 
    1324    return $entry_link; 
    1425}