Example #1
0
 // ikonky pro spravu
 if (_postAccess($query)) {
     $editlink = " &nbsp;\n<a href='index.php?m=editpost&amp;id=" . $id . "'><img src='" . _templateImage("icons/edit.png") . "' alt='edit' class='icon' title='" . $_lang['mod.editpost'] . "' /></a>\n" . (_loginright_locktopics ? "<a href='index.php?m=locktopic&amp;id=" . $id . "'><img src='" . _templateImage("icons/" . ($query['locked'] == 1 ? 'un' : '') . "lock.png") . "' alt='lock' class='icon' title='" . $_lang['mod.locktopic' . ($query['locked'] == 1 ? '2' : '')] . "' /></a>" : '') . "\n" . (_loginright_stickytopics ? "<a href='index.php?m=stickytopic&amp;id=" . $id . "'><img src='" . _templateImage("icons/" . ($query['sticky'] == 1 ? 'un' : '') . "stick.png") . "' alt='sticky' class='icon' title='" . $_lang['mod.stickytopic' . ($query['sticky'] == 1 ? '2' : '')] . "' /></a>" : '') . "\n" . (_loginright_movetopics ? "<a href='index.php?m=movetopic&amp;id=" . $id . "'><img src='" . _templateImage("icons/move.png") . "' alt='move' class='icon' title='" . $_lang['mod.movetopic'] . "' /></a>" : '');
 } else {
     $editlink = "";
 }
 // nacteni autora a avataru
 $avatar = '';
 if ($query['guest'] == "") {
     $author = _linkUser($query['author'], "post-author");
     if (_show_avatars) {
         $avatar = _getAvatar($query['author'], true, true);
         if (null === $avatar) {
             $avatar = '';
         } else {
             $author_name = _userDataCache($query['author']);
             if ('' !== $author_name['publicname']) {
                 $author_name = $author_name['publicname'];
             } else {
                 $author_name = $author_name['username'];
             }
             $avatar = "<img src='" . $avatar . "' alt='" . $author_name . "' class='topic-avatar' />";
         }
     }
 } else {
     $author = "<span class='post-author-guest' title='" . _showIP($query['ip']) . "'>" . $query['guest'] . "</span>";
 }
 // vystup
 $module .= "\n<h2>" . $_lang['posts.topic'] . ": " . $query['subject'] . _linkRSS($id, 6) . "</h2>\n<p><small>" . $_lang['global.postauthor'] . " " . $author . " " . _formatTime($query['time']) . "</small>" . $editlink . "</p>\n<p>" . $avatar . _parsePost($query['text']) . "</p>\n<div class='cleaner'></div>\n";
 // odpovedi
 require_once _indexroot . 'require/functions-posts.php';
/**
 * Ziskat kod avataru daneho uzivatele
 * @param int $id id uzivatele
 * @param bool $path_only ziskat pouze cestu namisto html kodu obrazku 1/0
 * @param bool $return_null vratit null pokud uzivatel nema avatar namisto vychoziho avataru 1/0
 * @param bool $full_size vynutit plnou velikost (pro pluginy) 1/0
 * @param bool $no_plugins ignorovat pluginy 1/0
 * @param bool $no_link neodkazovat na profil 1/0
 * @return string|null
 */
function _getAvatar($id, $path_only = false, $return_null = false, $full_size = false, $no_plugins = false, $no_link = false)
{
    // adresar
    $path = _indexroot . 'pictures/avatars/';
    // nacteni dat
    $exists = false;
    if ($id != -1) {
        $udata = _userDataCache($id);
        if (isset($udata['avatar'])) {
            $exists = true;
        }
    }
    // zpracovani rozsirenim
    if ($id != -1 && !$no_plugins) {
        $extend_return = false;
        _extend('call', 'user.avatar', array('return' => &$extend_return, 'udata' => $udata, 'path_only' => $path_only, 'return_null' => $return_null, 'full_size' => $full_size));
        if ($extend_return !== false) {
            return $extend_return;
        }
    }
    // neexistuje?
    if (!$exists && $return_null) {
        return;
    }
    // doplneni cesty
    $path .= ($exists ? $udata['avatar'] : 'no-avatar' . (_template_dark ? '-dark' : '')) . '.jpg';
    if ($path_only) {
        return $path;
    }
    // navrat kodu
    $output = '<img src="' . $path . '" alt="' . ($exists ? $udata['publicname'] === '' ? $udata['username'] : $udata['publicname'] : 'avatar') . '" class="avatar2" />';
    if ($id != -1 && !$no_link) {
        $output = '<a href="' . _indexroot . 'index.php?m=profile&amp;id=' . $udata['username'] . '">' . $output . '</a>';
    }
    return $output;
}