I'm trying to create a ban appeal system based on the default report system, which will post a thread in a "Ban Appeals" section so that Admins can discuss it.
I've created a copy of
report.php, renamed it
appeal.php and have the following inside:
PHP Code:
<?php
// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE & ~8192);
// #################### DEFINE IMPORTANT CONSTANTS #######################
define('THIS_SCRIPT', 'report');
define('CSRF_PROTECTION', true);
// ################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array('messaging');
// get special data templates from the datastore
$specialtemplates = array();
// pre-cache templates used by all actions
$globaltemplates = array(
'newpost_usernamecode',
'reportitem'
);
// pre-cache templates used by specific actions
$actiontemplates = array();
// ######################### REQUIRE BACK-END ############################
require_once('./global.php');
require_once(DIR . '/includes/functions_misc.php'); // for fetch_phrase
require_once(DIR . '/includes/class_reportitem.php');
// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################
$reportthread = ($rpforumid = $vbulletin->options['rpforumid'] AND $rpforuminfo = fetch_foruminfo($rpforumid));
$reportemail = ($vbulletin->options['enableemail'] AND $vbulletin->options['rpemail']);
if (!$reportthread AND !$reportemail)
{
eval(standard_error(fetch_error('emaildisabled')));
}
$reportobj =& new vB_ReportItem_Post($vbulletin);
$reportobj->set_extrainfo('forum', $foruminfo);
$reportobj->set_extrainfo('thread', $threadinfo);
$perform_floodcheck = $reportobj->need_floodcheck();
if ($perform_floodcheck)
{
$reportobj->perform_floodcheck_precommit();
}
if (empty($_REQUEST['do']))
{
$_REQUEST['do'] = 'report';
}
// check if there is a forum password and if so, ensure the user has it set
verify_forum_password($foruminfo['forumid'], $foruminfo['password']);
($hook = vBulletinHook::fetch_hook('report_start')) ? eval($hook) : false;
if ($_REQUEST['do'] == 'report')
{
// draw nav bar
$navbits = array();
$parentlist = array_reverse(explode(',', $foruminfo['parentlist']));
foreach ($parentlist AS $forumID)
{
$forumTitle = $vbulletin->forumcache["$forumID"]['title'];
$navbits['forumdisplay.php?' . $vbulletin->session->vars['sessionurl'] . "f=$forumID"] = $forumTitle;
}
$navbits['showthread.php?' . $vbulletin->session->vars['sessionurl'] . "p=$postid"] = $threadinfo['prefix_plain_html'] . ' ' . $threadinfo['title'];
$navbits[''] = $vbphrase['report_bad_post'];
$navbits = construct_navbits($navbits);
require_once(DIR . '/includes/functions_editor.php');
$textareacols = fetch_textarea_width();
eval('$usernamecode = "' . fetch_template('newpost_usernamecode') . '";');
eval('$navbar = "' . fetch_template('navbar') . '";');
($hook = vBulletinHook::fetch_hook('report_form_start')) ? eval($hook) : false;
$url = 'showthread.php?' . $vbulletin->session->vars['sessionurl'] . "p=$postid#post$postid";
$forminfo = $reportobj->set_forminfo($postinfo);
eval('print_output("' . fetch_template('banappeal') . '");');
}
if ($_POST['do'] == 'sendemail')
{
$vbulletin->input->clean_array_gpc('p', array(
'reason' => TYPE_STR,
));
if ($vbulletin->GPC['reason'] == '')
{
eval(standard_error(fetch_error('noreason')));
}
if ($perform_floodcheck)
{
$reportobj->perform_floodcheck_commit();
}
$reportobj->do_report($vbulletin->GPC['reason'], $postinfo);
eval(print_standard_redirect('redirect_reportthanks'));
}
?>
Currently the page loads fine, but on clicking submit it performs
sendemail but the page just remains blank.
I'm guessing I need to remove the parts where it defines the post being reported and nullify them, however I'm not entirely sure what to edit.
I also need to have the threads be posted in a forum set from inside this page instead of retrieving it from vBUlletin Options, I tried changing the line
"$reportthread = ($rpforumid = $vbulletin->options['rpforumid'] AND $rpforuminfo = fetch_foruminfo($rpforumid));" however I didn't have any luck there either.
If it's any help the page template too:
PHP Code:
$stylevar[htmldoctype]
<html xmlns="http://www.w3.org/1999/xhtml" dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
$headinclude
<title>$vboptions[bbtitle] - Ban Appeal</title>
</head>
<body>
$header
$navbar
<form action="appeal.php?do=$forminfo[action]" method="post">
<input type="hidden" name="s" value="$session[sessionhash]" />
<input type="hidden" name="securitytoken" value="$bbuserinfo[securitytoken]" />
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
<td class="tcat">
<span class="smallfont" style="float:$stylevar[right]"><strong>$forminfo[reporttype]</strong>: <a href="$forminfo[itemlink]">$forminfo[itemname]</a></span>
Ban Appeal
</td>
</tr>
<tr>
<td class="panelsurround" align="center">
<div class="panel">
<div style="width:$stylevar[formwidth]" align="$stylevar[left]">
$usernamecode
<!-- report field -->
<div class="fieldset">
<div class="smallfont">$vbphrase[message]:</div>
<textarea name="reason" rows="6" cols="$textareacols"></textarea>
</div>
<!-- / report field -->
<div class="fieldset">
<B>Note:</B> To make sure that the staff members who will judge your appeal understand your case fully and clearly please make sure that you explain your reasons in as much detail as possible, it can only help your case.
</div>
</div>
</div>
<div style="margin-top:$stylevar[cellpadding]px">
$forminfo[hiddenfields]
<input type="hidden" name="do" value="appeal.php?do=$forminfo[action]" />
<input type="hidden" name="url" value="$url" />
<input type="submit" class="button" value="Send Appeal" accesskey="s" />
</div>
</td>
</tr>
</table>
</form>
$footer
</body>
</html>
Can anybody help me with this?