Example #1
0
function getSpamConfigForm()
{
    $form = new Form("spamconfig", "", __("Save"));
    // No border for this form:
    $form->html['start'] = <<<EOM
<form  enctype='multipart/form-data'  name='%name%' id='%name%' action="%action%" method='post'>
<table border='0' cellspacing='0' cellpadding='4' class='formclass' style="border-width: 0px !important;">
EOM;
    // Place the tooltips to the right of the textarea's, not below them.
    $form->html['textarea'] = <<<EOM
    <tr>
        <td valign="top">
            <label for="%name%">%label% %isrequired%</label>
        </td>
        <td valign="top">
            <textarea name="%name%" id="%name%" cols="%cols%" class="resizable %haserror%"  rows="%rows%" style="%style%" tabindex="%tabindex%" >%value%</textarea>
           %error%
        </td>
        <td valign="top">
            %text%
        </td>
    </tr>
EOM;
    $form->add(array('type' => "csrf", 'cookie' => "pivotxsession", 'sessionvariable' => "pivotxsession"));
    /* -- We're not doing anything with this yet..
    
        $form->add( array(
            'type' => 'text',
            'name' => 'spamthreshold',
            'label' => __('Spamscore Threshold'),
            'value' => '',
            'text' => makeJtip(__('Spamscore Threshold'), __("Each comment gets 'points', where a higher score means that it's more likely that the comment or trackback is spam. For instance: a failed Hascash raises the spamscore by 6.")),
            'error' => "Value must be a number bigger than or equal to zero.",
            'size' => 2,
            'isrequired' => 1,
            'validation' => 'integer|min=0'
        ));
    
    
    */
    $form->add(array('type' => 'checkbox', 'name' => 'hashcash', 'label' => __('Use HashCash'), 'value' => '', 'text' => makeJtip(__('Use HashCash'), __('HashCash is the most powerful, completely invisible spam protection available. It requires javascript to be enabled on the client. If this is unacceptable for you, then don\'t enable it.'))));
    $form->add(array('type' => 'checkbox', 'name' => 'hardened_trackback', 'label' => __('Use Hardened Trackback'), 'value' => '', 'text' => makeJtip(__('Use Hardened Trackback'), __('Hardened Trackback is a powerful trackback spam protection. It requires javascript to be enabled on the client. If this is unacceptable for you, then don\'t enable it.'))));
    $form->add(array('type' => 'text', 'name' => 'maxhrefs', 'label' => __('Number of links'), 'value' => '', 'text' => makeJtip(__('Number of links'), __('Maximum number of hyperlinks in allowed in comments. Useful to get rid of those pesky comment spammers. Set to 0 for unlimited links.')), 'error' => "Value must be a number bigger than or equal to zero.", 'size' => 2, 'isrequired' => 1, 'validation' => 'integer|min=0'));
    $form->add(array('type' => 'custom', 'text' => "<tr><td colspan='3'><h3>" . __('SpamQuiz') . "</h3></td></tr>"));
    $form->add(array('type' => 'checkbox', 'name' => 'spamquiz', 'label' => __('Use SpamQuiz'), 'value' => '', 'text' => makeJtip(__('Use SpamQuiz'), __('Before sending a comment, your users have to answer correctly a simple question everyone knows the answer to. This completely baffles automated spam bots because every blogger will choose something different.'))));
    $form->add(array('type' => 'text', 'name' => 'spamquiz_question', 'label' => __('Question'), 'text' => makeJtip(__('Question'), __('Example: What are the first two letters of the word "spam"?')), 'value' => '', 'size' => 60, 'isrequired' => 0, 'validation' => 'ifany|minlen=1|maxlen=500'));
    $form->add(array('type' => 'text', 'name' => 'spamquiz_answer', 'label' => __('Answer'), 'text' => makeJtip(__('Answer'), __('Example: <b>sp</b>')), 'value' => '', 'size' => 20, 'isrequired' => 0, 'validation' => 'ifany|minlen=1|maxlen=500'));
    $form->add(array('type' => 'text', 'name' => 'spamquiz_age', 'label' => __('Age'), 'text' => makeJtip(__('Age'), __('Only ask for the spamquiz question, when the entry is older than the given amount of days.')), 'value' => '', 'size' => 60, 'isrequired' => 0, 'validation' => 'ifany|minlen=1|maxlen=500'));
    $form->add(array('type' => 'textarea', 'name' => 'spamquiz_explain', 'label' => __('Explanation'), 'text' => makeJtip(__('Explanation'), __('Example: To prevent automated commentspam we require you to answer this silly question')), 'value' => '', 'rows' => 4, 'cols' => 60, 'isrequired' => 0, 'validation' => 'ifany|minlen=1|maxlen=500'));
    $form->use_javascript(true);
    return $form;
}