Chris@76: $topic, Chris@76: ) Chris@76: ); Chris@76: // Redirect to the boardindex if no valid topic id is provided. Chris@76: if ($smcFunc['db_num_rows']($request) == 0) Chris@76: redirectexit(); Chris@76: $row = $smcFunc['db_fetch_assoc']($request); Chris@76: $smcFunc['db_free_result']($request); Chris@76: Chris@76: // Lets "output" all that info. Chris@76: loadTemplate('Printpage'); Chris@76: $context['template_layers'] = array('print'); Chris@76: $context['board_name'] = $board_info['name']; Chris@76: $context['category_name'] = $board_info['cat']['name']; Chris@76: $context['poster_name'] = $row['poster_name']; Chris@76: $context['post_time'] = timeformat($row['poster_time'], false); Chris@76: $context['parent_boards'] = array(); Chris@76: foreach ($board_info['parent_boards'] as $parent) Chris@76: $context['parent_boards'][] = $parent['name']; Chris@76: Chris@76: // Split the topics up so we can print them. Chris@76: $request = $smcFunc['db_query']('', ' Chris@76: SELECT subject, poster_time, body, IFNULL(mem.real_name, poster_name) AS poster_name Chris@76: FROM {db_prefix}messages AS m Chris@76: LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member) Chris@76: WHERE m.id_topic = {int:current_topic}' . ($modSettings['postmod_active'] && !allowedTo('approve_posts') ? ' Chris@76: AND (m.approved = {int:is_approved}' . ($user_info['is_guest'] ? '' : ' OR m.id_member = {int:current_member}') . ')' : '') . ' Chris@76: ORDER BY m.id_msg', Chris@76: array( Chris@76: 'current_topic' => $topic, Chris@76: 'is_approved' => 1, Chris@76: 'current_member' => $user_info['id'], Chris@76: ) Chris@76: ); Chris@76: $context['posts'] = array(); Chris@76: while ($row = $smcFunc['db_fetch_assoc']($request)) Chris@76: { Chris@76: // Censor the subject and message. Chris@76: censorText($row['subject']); Chris@76: censorText($row['body']); Chris@76: Chris@76: $context['posts'][] = array( Chris@76: 'subject' => $row['subject'], Chris@76: 'member' => $row['poster_name'], Chris@76: 'time' => timeformat($row['poster_time'], false), Chris@76: 'timestamp' => forum_time(true, $row['poster_time']), Chris@76: 'body' => parse_bbc($row['body'], 'print'), Chris@76: ); Chris@76: Chris@76: if (!isset($context['topic_subject'])) Chris@76: $context['topic_subject'] = $row['subject']; Chris@76: } Chris@76: $smcFunc['db_free_result']($request); Chris@76: Chris@76: // Set a canonical URL for this page. Chris@76: $context['canonical_url'] = $scripturl . '?topic=' . $topic . '.0'; Chris@76: } Chris@76: Chris@76: ?>