<commit_before><?php

use Sunlight\Comment\CommentService;
use Sunlight\Database\Database as DB;
use Sunlight\Extend;
use Sunlight\Paginator;
use Sunlight\Comment\Comment;
use Sunlight\Router;
use Sunlight\Template;
use Sunlight\User;
use Sunlight\Util\UrlHelper;

defined('_root') or exit;

if (!ctype_digit($_index['segment'])) {
    $_index['is_found'] = false;
    return;
}

// nacteni dat
$id = (int) $_index['segment'];
$userQuery = User::createQuery('p.author');
$query = DB::queryRow("SELECT p.*," . $userQuery['column_list'] . " FROM " . _comment_table . " p " . $userQuery['joins'] . " WHERE p.id=" . $id . " AND p.type=" . _post_forum_topic . " AND p.home=" . $_page['id'] . " AND p.xhome=-1");
if ($query === false) {
    $_index['is_found'] = false;
    return;
}

// drobecek
$_index['crumbs'][] = array(
    'title' => $query['subject'],
    'url' => Router::topic($id, $_page['slug'])
);

// extend
$continue = true;

Extend::call('topic.before', Extend::args($output, array(
    'topic' => &$query,
    'continue' => &$continue,
    'page' => $_page,
)));

if (!$continue) {
    return;
}

// atributy
$_index['title'] = $_page['title'] . ' ' . _titleseparator . ' ' . $query['subject'];
$_index['heading'] = $_page['title'];
$_index['url'] = Router::topic($id, $_page['slug']);

// priprava zpetneho odkazu
$_index['backlink'] = Router::page($_page['id'], $_page['slug']);
if (!$query['sticky']) {
    $_index['backlink'] = UrlHelper::appendParams($_index['backlink'], 'page=' . Paginator::getItemPage($_page['var1'], _comment_table, "bumptime>" . $query['bumptime'] . " AND xhome=-1 AND type=" . _post_forum_topic . " AND home=" . $_page['id']), false);
}

// sprava tematu
$topic_access = Comment::checkAccess($userQuery, $query);
$topic_admin = array();

if ($topic_access) {
    if (_priv_locktopics) {
        $topic_admin[] = "<a href='" . Router::module('locktopic', 'id=' . $id) . "'>" . (_lang('mod.locktopic.link' . (($query['locked'] == 1) ? '2' : ''))) . "</a>";
    }
    if (_priv_stickytopics) {
        $topic_admin[] = "<a href='" . Router::module('stickytopic', 'id=' . $id) . "'>" . (_lang('mod.stickytopic.link' . (($query['sticky'] == 1) ? '2' : ''))) . "</a>";
    }
    if (_priv_movetopics) {
        $topic_admin[] = "<a href='" . Router::module('movetopic', 'id=' . $id) . "'>" . (_lang('mod.movetopic.link')) . "</a>";
    }
}

// vystup
$output .= "<div class=\"topic\">\n";
$output .= "<h2>" . _lang('posts.topic') . ": " . $query['subject'] . ' ' . Template::rssLink(Router::rss($id, 6, false), true) . "</h2>\n";
$output .= CommentService::renderPost($query, $userQuery, array(
    'post_link' => false,
    'allow_reply' => false,
    'extra_actions' => $topic_admin,
));<commit_msg>Add missing CSS class for topic actions<commit_after><?php

use Sunlight\Comment\CommentService;
use Sunlight\Database\Database as DB;
use Sunlight\Extend;
use Sunlight\Paginator;
use Sunlight\Comment\Comment;
use Sunlight\Router;
use Sunlight\Template;
use Sunlight\User;
use Sunlight\Util\UrlHelper;

defined('_root') or exit;

if (!ctype_digit($_index['segment'])) {
    $_index['is_found'] = false;
    return;
}

// nacteni dat
$id = (int) $_index['segment'];
$userQuery = User::createQuery('p.author');
$query = DB::queryRow("SELECT p.*," . $userQuery['column_list'] . " FROM " . _comment_table . " p " . $userQuery['joins'] . " WHERE p.id=" . $id . " AND p.type=" . _post_forum_topic . " AND p.home=" . $_page['id'] . " AND p.xhome=-1");
if ($query === false) {
    $_index['is_found'] = false;
    return;
}

// drobecek
$_index['crumbs'][] = array(
    'title' => $query['subject'],
    'url' => Router::topic($id, $_page['slug'])
);

// extend
$continue = true;

Extend::call('topic.before', Extend::args($output, array(
    'topic' => &$query,
    'continue' => &$continue,
    'page' => $_page,
)));

if (!$continue) {
    return;
}

// atributy
$_index['title'] = $_page['title'] . ' ' . _titleseparator . ' ' . $query['subject'];
$_index['heading'] = $_page['title'];
$_index['url'] = Router::topic($id, $_page['slug']);

// priprava zpetneho odkazu
$_index['backlink'] = Router::page($_page['id'], $_page['slug']);
if (!$query['sticky']) {
    $_index['backlink'] = UrlHelper::appendParams($_index['backlink'], 'page=' . Paginator::getItemPage($_page['var1'], _comment_table, "bumptime>" . $query['bumptime'] . " AND xhome=-1 AND type=" . _post_forum_topic . " AND home=" . $_page['id']), false);
}

// sprava tematu
$topic_access = Comment::checkAccess($userQuery, $query);
$topic_admin = array();

if ($topic_access) {
    if (_priv_locktopics) {
        $topic_admin[] = "<a class=\"post-action-" . (($query['locked'] == 1) ? 'unlock' : 'lock') . "\" href='" . Router::module('locktopic', 'id=' . $id) . "'>" . (_lang('mod.locktopic.link' . (($query['locked'] == 1) ? '2' : ''))) . "</a>";
    }
    if (_priv_stickytopics) {
        $topic_admin[] = "<a class=\"post-action-" . (($query['sticky'] == 1) ? 'unsticky' : 'sticky') . "\"  href='" . Router::module('stickytopic', 'id=' . $id) . "'>" . (_lang('mod.stickytopic.link' . (($query['sticky'] == 1) ? '2' : ''))) . "</a>";
    }
    if (_priv_movetopics) {
        $topic_admin[] = "<a class=\"post-action-move\"  href='" . Router::module('movetopic', 'id=' . $id) . "'>" . (_lang('mod.movetopic.link')) . "</a>";
    }
}

// vystup
$output .= "<div class=\"topic\">\n";
$output .= "<h2>" . _lang('posts.topic') . ": " . $query['subject'] . ' ' . Template::rssLink(Router::rss($id, 6, false), true) . "</h2>\n";
$output .= CommentService::renderPost($query, $userQuery, array(
    'post_link' => false,
    'allow_reply' => false,
    'extra_actions' => $topic_admin,
));
{'fraction_non_alphanumeric': 0.250572283852791, 'fraction_numerical': 0.0038739214650466633, 'mean_word_length': 4.126353790613718, 'pattern_counts': {'":': 2, '<': 23, '<?xml version=': 0, '>': 39, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6067997', 'n_tokens_mistral': 2074, 'n_tokens_neox': 2082, 'n_words': 389}