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.
PHP Code:
error_reporting(E_ALL & ~E_NOTICE & ~8192);
define('GET_EDIT_TEMPLATES', true);
define('THIS_SCRIPT', 'testingthread');
define('CSRF_PROTECTION', true);
require_once('./global.php');
require_once('./includes/functions_databuild.php');
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");
}
// Subject & Pagetext
$title = "Nomination for Member's Choice Award";
$pagetext = "Poet =" . $postinfo['username'] . "Poem Title =" . $threadinfo['title'] . "Forum = " . $foruminfo['title'] . "Poem Link =" . "[url]" . "http://localhost/poetsl/showthread.php?" . $postinfo['threadid'] . "[/url]";
/*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.");
}