do
{
if (THIS_SCRIPT != 'showthread')
{
// Not a thread
break;
}
if (!$this->registry->options['dppa_insidepost'])
{
// Not enabled
break;
}
if (is_member_of($this->registry->userinfo, explode(',', $this->registry->options['dppa_insidepost_hidegroups'])))
{
// Hide group
break;
}
if ($this->registry->options['dppa_insidepost_showforums'] AND !in_array($thread['forumid'], explode (',', $this->registry->options['dppa_insidepost_showforums'])))
{
// Wrong forum
break;
}
if ($_REQUEST['p'] AND $this->post['postid'] != $_REQUEST['p'])
{
// Wrong post
break;
}
// Set the modulo
$post_modulus = $GLOBALS['perpage'] > 0 ? $this->post['postcount'] % $GLOBALS['perpage'] : 0;
if ($post_modulus != 1)
{
// Wrong post
break;
}
preg_match_all("#<br />(" . chr(13) . '|' . chr(10) . '|' . chr(13) . chr(10) . ")<br />#U", $this->post['message'], $matches, PREG_OFFSET_CAPTURE);
$matches[0][] = array (1 => strlen($this->post['message']));
$offset = $matches[0][array_rand($matches[0])][1];
$part1 = substr($this->post['message'], 0, $offset);
$part2 = substr($this->post['message'], $offset);
$this->post['message'] = $part1 . "<br />\n<br />" . $this->registry->options['dppa_insidepost_html'] . $part2;
}
while (false);
if (
$this->registry->options['dppa_afterpost'] AND
!is_member_of($this->registry->userinfo, explode(',', $this->registry->options['dppa_afterpost_hidegroups'])) AND
($this->post['postid'] == $_REQUEST['p'] OR (
$_REQUEST['t'] AND !$_REQUEST['p'] AND $post_modulus == 1)
)
)
{
$template_hook['postbit_end'] = $this->registry->options['dppa_afterpost_html'];
}