Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
Prev Previous Post   Next Post Next
  #1  
Old 01-14-2010, 12:15 AM
Josephish Josephish is offline
 
Join Date: Jan 2010
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Ban Appeal System based on Report System

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:</BTo 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 possibleit 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?
Reply With Quote
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:21 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03786 seconds
  • Memory Usage 2,436KB
  • Queries Executed 12 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (2)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (2)post_thanks_box
  • (2)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit_info
  • (2)postbit
  • (2)postbit_onlinestatus
  • (2)postbit_wrapper
  • (1)showthread_list
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_threadedmode.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids_threaded
  • showthread_threaded_construct_link
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete