I cleaned it up for you. Removed unnecessary definitions of variables and a couple of other things. Note that I didn't test it so I'm not sure if it will actually work like this.
if(isset($vbulletin->GPC['p']) && ctype_digit($vbulletin->GPC['p']))
{
// Set post, thread and forum info.
$postinfo = fetch_postinfo($vbulletin->GPC['p']);
$threadinfo = fetch_threadinfo($postinfo['threadid']);
$foruminfo = fetch_foruminfo(260);
// Don't allow self voting.
if ($postinfo['userid'] == $vbulletin->userinfo['userid']){
die("Whoops, I'm sorry, you may not nominate your own poem." . "<br><br>" . "Please press back-button on your browser. Thank you");
}
/*Create a new datamanager for posting*/
$threaddm =& datamanager_init('Thread_FirstPost', $vbulletin, ERRTYPE_ARRAY, 'threadpost');
$threaddm->set_info('forum', $foruminfo);
$threaddm->set_info('thread', $threadinfo);
$threaddm->setr('forumid', 260);
$threaddm->setr('userid', $vbulletin->userinfo['userid']);
$threaddm->setr('pagetext', $pagetext);
$threaddm->setr('title', $title);
$threaddm->set('allowsmilie', 0);
$threaddm->set('visible', 1);
// Lets see what happens if we save the page
$threaddm->pre_save();
if(count($threaddm->errors) < 1) {
$threadid = $threaddm->save();
unset($threaddm);
} else {
var_dump($threaddm->errors);
exit;
}
//$threadid = $threaddm->save();
eval(print_standard_redirect('')); //Return to thread/post
}else{
die("No post id in URL.");
}