Example #1
0
<?php

/**
 * $Id$
 *
 * Takes a user id, returns this user's presentation image
 */
if (empty($_GET['id']) || !is_numeric($_GET['id'])) {
    die;
}
require_once 'find_config.php';
$fieldId = getUserdataFieldIdByType(USERDATA_TYPE_IMAGE);
$fileId = loadUserdataSetting($_GET['id'], $fieldId);
if ($fileId && !isInQueue($fileId, MODERATION_PRES_IMAGE)) {
    $h->files->sendFile($fileId, true);
}
function showForumPost($item, $islocked = false)
{
    global $h, $config;
    $subject = formatUserInputText($item['itemSubject']);
    $body = formatUserInputText($item['itemBody']);
    if (!$islocked) {
        $islocked = $item['locked'];
    }
    echo '<a name="post' . $item['itemId'] . '" id="post' . $item['itemId'] . '"></a>';
    echo '<table width="100%" class="forum_post_table">';
    echo '<tr class="forum_post_item">';
    echo '<td valign="top">';
    if ($subject) {
        echo '<h1>' . $subject . '</h1><hr/>';
    }
    echo '<div class="forum_post_details">';
    echo '<a href="forum.php?id=' . $item['parentId'] . '#post' . $item['itemId'] . '">';
    echo '<img src="' . coredev_webroot() . 'gfx/icon_forum_post.png" alt="Post"/></a> ';
    echo t('by') . ' ' . Users::link($item['authorId'], $item['authorName']) . ' ' . formatTime($item['timeCreated']);
    echo '</div><br/>';
    echo $body;
    $signature = loadUserdataSetting($h->session->id, $config['settings']['default_signature']);
    if ($signature) {
        echo '<hr/>' . $signature . '<br/>';
    }
    $h->files->showAttachments(FILETYPE_FORUM, $item['itemId']);
    echo '</td>';
    echo '<td width="120" valign="top" class="forum_item_text">';
    echo Users::linkThumb($item['authorId'], $item['authorName']) . '<br/><br/>';
    echo Users::getMode($item['authorId']) . '<br/>';
    //echo 'Join date: '.getUserCreated($item['authorId']).'<br/>';
    echo t('Posts') . ': ' . getForumPostsCount($item['authorId']);
    echo '</td>';
    echo '</tr>';
    if (!$h->session->id) {
        echo '</table><br/>';
        return;
    }
    echo '<tr class="forum_item">';
    echo '<td colspan="2" align="right">';
    if (!$islocked) {
        if (forumItemIsDiscussion($item['itemId'])) {
            echo '<a href="forum_new.php?id=' . $item['itemId'] . '&amp;q=' . $item['itemId'] . '">' . t('Quote') . '</a> ';
        } else {
            echo '<a href="forum_new.php?id=' . $item['parentId'] . '&amp;q=' . $item['itemId'] . '">' . t('Quote') . '</a> ';
        }
        if ($item['authorId'] == $h->session->id || $h->session->isAdmin) {
            echo '<a href="forum_edit.php?id=' . $item['itemId'] . '">' . t('Edit') . '</a> ';
        }
    }
    if (!$islocked && $h->session->isAdmin) {
        echo '<a href="forum_delete.php?id=' . $item['itemId'] . '">' . t('Remove') . '</a> ';
    }
    if (forumItemIsDiscussion($item['itemId'])) {
        echo '<a href="forum_tipsa.php?id=' . $item['itemId'] . '">' . t('Tell a friend') . '</a> ';
        if ($h->session->isAdmin) {
            if (!$item['locked']) {
                echo '<a href="forum_lock.php?id=' . $item['itemId'] . '">' . t('Lock') . '</a> ';
            } else {
                echo '<a href="forum_lock.php?id=' . $item['itemId'] . '&unlock">' . t('Unlock') . '</a> ';
            }
            echo '<a href="forum_move.php?id=' . $item['itemId'] . '">' . t('Move') . '</a> ';
        }
    }
    if ($h->session->id != $item['authorId']) {
        echo '<a href="forum_report.php?id=' . $item['itemId'] . '">' . t('Report') . '</a> ';
    }
    echo '</td></tr>';
    echo '</table><br/>';
}