Пример #1
0
function showHelp($subject, $category)
{
    $smarty = new IBSSmarty();
    $smarty->default_template_handler_func = 'template_handler_func';
    $smarty->assign("tpl_file", getTplFile($subject, $category));
    $smarty->assign("subject", $subject);
    $smarty->assign("category", $category);
    $smarty->display("help/skeleton.tpl");
}
Пример #2
0
/**
 * Error processing function
 * @param string $reason
 * @param int $type
 * @return void
 */
function print_error($reason, $type = 0)
{
    $redirectOnFail = $_POST['redirectOnFail'];
    $replyEmailOnFail = $_POST['replyEmailOnFail'];
    if ($redirectOnFail == '') {
        build_body($title, $bgcolor, $text_color, $link_color, $vlink_color, $alink_color, $style_sheet);
        // for missing required data
        if ($type == "missing") {
            if ($missing_field_redirect) {
                header("Location: {$missing_field_redirect}?error={$reason}");
                exit;
            } else {
                $failMessage = 'The form was not submitted for the following reasons:<p>';
                $failMessage .= '<ul>' . $reason . "\n" . '</ul>';
                echo $failMessage;
                echo 'Please use your browser&#39;s back button to return to the form and try again.';
            }
        } else {
            // every other error
            $failMessage = 'The form was not submitted because of the following reasons:<p>';
            echo $failMessage;
        }
        echo "<br /><br />\n";
        echo "<small>This form is powered by <a href=\"http://phpmailer.sourceforge.net/\">PHPMailer-FE.php " . VERSION . "</a></small>\n\n";
    } else {
        $reason = str_replace('<li>', '', $reason);
        $reason = str_replace('</li>', '<br />', $reason);
        $failMessage = '';
        if ($type == "missing") {
            if ($missing_field_redirect) {
                $failMessage .= $reason;
            } else {
                $failMessage .= 'The form was not submitted for the following reasons:<br /><br />';
                $failMessage .= $reason;
            }
        } else {
            // every other error
            $failMessage .= ' The form was not submitted because of the following reasons:<br /><br />';
            $failMessage .= $reason;
        }
        $failMessage .= "<br />";
        $_POST['failMessage'] = $failMessage;
        $msgDisplay = getTplFile($redirectOnFail);
        echo $msgDisplay;
    }
    // code to send reply to sender on failure of form submission
    /* note your email HTML form has to include the variables
     * $recipient (this will be used as the TO: address)
     * $fromemail (this will be used as the FROM: address - should be your email address)
     * $fromname  (this will be used as the FROM: name    - should be your name)
     * all other aspects of the reply email have to be set by you ... you can use
     * variables from your form in the format $field.
     * in your form, use the code format
     * <php echo $recipient; ?>
     */
    if ($replyEmailOnFail != '') {
        $msgSend = getTplFile($replyEmailOnFail);
        $replyEmail = array();
        $replyEmail["text"] = stripslashes(html_entity_decode(strip_tags($msgSend)));
        $replyEmail["html"] = stripslashes($msgSend);
        $ccOrg = $cc;
        $cc = NULL;
        $bccOrg = $bcc;
        $bcc = NULL;
        if (trim($subjectEmailOnFail) != '') {
            $subject = $subjectEmailOnFail;
        }
        mail_it($replyEmail, $subject, $recipient, '', $email, false);
        $cc = $ccOrg;
        $bcc = $bccOrg;
    }
    // END code to send reply to sender on failure of form submission
    echo '<script type="text/javascript">document.getElementById("feprocessing").src="_src/complete.gif";</script>';
    exit;
    // exit so that no other processing is done after a failure or error
}