root/branches/release-38/php/lib/function.mtcommentauthoridentity.php @ 2395

Revision 2395, 1.3 kB (checked in by bchoate, 19 months ago)

Applied fixes for commentauthoridentity and commentauthor tags. BugId:79329,79811

  • Property svn:keywords set to Author Date Id Revision
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_mtcommentauthoridentity($args, &$ctx) {
9    $cmt = $ctx->stash('comment');
10    $cmntr = $ctx->stash('commenter');
11    if (!$cmntr) {
12        if ($cmt['comment_commenter_id']) {
13            # load author related to this commenter.
14            $cmntr = $ctx->mt->db->fetch_author($cmt['comment_commenter_id']);
15            if (!$cmntr) return "";
16        }
17    }
18    if (!$cmntr) return "";
19    if (is_array($cmntr))
20        $cmntr = $cmntr[0];
21    if (isset($cmntr['author_url']))
22        $link = $cmntr['author_url'];
23    require_once "function.mtstaticwebpath.php";
24    $static_path = smarty_function_mtstaticwebpath($args, $ctx);
25    require_once "commenter_auth_lib.php";
26    $logo = _auth_icon_url($static_path, $cmntr);
27    if (!$logo) {
28        $root_url = $static_path . 'images/';
29        if (!preg_match('/\/$/', $root_url)) {
30            $root_url .= '/';
31        }
32        $logo = $root_url . "nav-commenters.gif";
33    }
34    $result = "<img alt=\"Author Profile Page\" src=\"$logo\" width=\"16\" height=\"16\" />";
35    if ($link) {
36        $result = "<a class=\"commenter-profile\" href=\"$link\">$result</a>";
37    }
38    return $result;
39}
Note: See TracBrowser for help on using the browser.