function RegErrors($errors)
 {
     $regplus = get_option('register_plus');
     $regplus_custom = get_option('register_plus_custom');
     if (!is_array($regplus_custom)) {
         $regplus_custom = array();
     }
     if ($regplus['email_exists']) {
         if ($errors->errors['email_exists']) {
             unset($errors->errors['email_exists']);
         }
     }
     if ($regplus['firstname'] && in_array('firstname', $regplus['profile_req'])) {
         if (empty($_POST['firstname']) || $_POST['firstname'] == '') {
             $errors->add('empty_firstname', __('<strong>ERROR</strong>: Please enter your First Name.', 'regplus'));
         }
     }
     if ($regplus['lastname'] && in_array('lastname', $regplus['profile_req'])) {
         if (empty($_POST['lastname']) || $_POST['lastname'] == '') {
             $errors->add('empty_lastname', __('<strong>ERROR</strong>: Please enter your Last Name.', 'regplus'));
         }
     }
     if ($regplus['website'] && in_array('website', $regplus['profile_req'])) {
         if (empty($_POST['website']) || $_POST['website'] == '') {
             $errors->add('empty_website', __('<strong>ERROR</strong>: Please enter your Website URL.', 'regplus'));
         }
     }
     if ($regplus['aim'] && in_array('aim', $regplus['profile_req'])) {
         if (empty($_POST['aim']) || $_POST['aim'] == '') {
             $errors->add('empty_aim', __('<strong>ERROR</strong>: Please enter your AIM username.', 'regplus'));
         }
     }
     if ($regplus['yahoo'] && in_array('yahoo', $regplus['profile_req'])) {
         if (empty($_POST['yahoo']) || $_POST['yahoo'] == '') {
             $errors->add('empty_yahoo', __('<strong>ERROR</strong>: Please enter your Yahoo IM username.', 'regplus'));
         }
     }
     if ($regplus['jabber'] && in_array('jabber', $regplus['profile_req'])) {
         if (empty($_POST['jabber']) || $_POST['jabber'] == '') {
             $errors->add('empty_jabber', __('<strong>ERROR</strong>: Please enter your Jabber / Google Talk username.', 'regplus'));
         }
     }
     if ($regplus['about'] && in_array('about', $regplus['profile_req'])) {
         if (empty($_POST['about']) || $_POST['about'] == '') {
             $errors->add('empty_about', __('<strong>ERROR</strong>: Please enter some information About Yourself.', 'regplus'));
         }
     }
     if (!empty($regplus_custom)) {
         foreach ($regplus_custom as $k => $v) {
             if ($v['required'] && $v['reg']) {
                 $id = $this->Label_ID($v['label']);
                 if (empty($_POST[$id]) || $_POST[$id] == '') {
                     $errors->add('empty_' . $id, __('<strong>ERROR</strong>: Please enter your ' . $v['label'] . '.', 'regplus'));
                 }
             }
         }
     }
     if ($regplus['password']) {
         if (empty($_POST['pass1']) || $_POST['pass1'] == '' || empty($_POST['pass2']) || $_POST['pass2'] == '') {
             $errors->add('empty_password', __('<strong>ERROR</strong>: Please enter a Password.', 'regplus'));
         } elseif ($_POST['pass1'] !== $_POST['pass2']) {
             $errors->add('password_mismatch', __('<strong>ERROR</strong>: Your Password does not match.', 'regplus'));
         } elseif (strlen($_POST['pass1']) < 6) {
             $errors->add('password_length', __('<strong>ERROR</strong>: Your Password must be at least 6 characters in length.', 'regplus'));
         } else {
             $_POST['user_pw'] = $_POST['pass1'];
         }
     }
     if ($regplus['code'] && $regplus['code_req']) {
         if (empty($_POST['regcode']) || $_POST['regcode'] == '') {
             $errors->add('empty_regcode', __('<strong>ERROR</strong>: Please enter the Invitation Code.', 'regplus'));
         } elseif (!in_array(strtolower($_POST['regcode']), $regplus['codepass'])) {
             $errors->add('regcode_mismatch', __('<strong>ERROR</strong>: Your Invitation Code is incorrect.', 'regplus'));
         }
     }
     if ($regplus['captcha'] == 1) {
         $key = $_SESSION['1k2j48djh'];
         $number = md5($_POST['captcha']);
         if ($number != $key) {
             $errors->add('captcha_mismatch', __("<strong>ERROR</strong>: Image Validation does not match.", 'regplus'));
             unset($_SESSION['1k2j48djh']);
         }
     } else {
         if ($regplus['captcha'] == 2) {
             require_once 'recaptchalib.php';
             $privatekey = $regplus['reCAP_private_key'];
             $resp = rp_recaptcha_check_answer($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]);
             if (!$resp->is_valid) {
                 $errors->add('recaptcha_mismatch', __("<strong>ERROR:</strong> The reCAPTCHA wasn't entered correctly.", 'regplus'));
                 //$errors->add('recaptcha_error', "(" . __("reCAPTCHA said: ", 'regplus') . $resp->error . ")");
             }
         }
     }
     if ($regplus['disclaimer']) {
         if (!$_POST['disclaimer']) {
             $errors->add('disclaimer', __('<strong>ERROR</strong>: Please accept the ', 'regplus') . stripslashes($regplus['disclaimer_title']) . '.');
         }
     }
     if ($regplus['license']) {
         if (!$_POST['license']) {
             $errors->add('license', __('<strong>ERROR</strong>: Please accept the ', 'regplus') . stripslashes($regplus['license_title']) . '.');
         }
     }
     if ($regplus['privacy']) {
         if (!$_POST['privacy']) {
             $errors->add('privacy', __('<strong>ERROR</strong>: Please accept the ', 'regplus') . stripslashes($regplus['privacy_title']) . '.');
         }
     }
     return $errors;
 }
Example #2
0
if (version_compare($wp_version, '3.0.9', '>')) {
    $ust_admin_url = network_admin_url('settings.php?page=ust');
} else {
    $ust_admin_url = network_admin_url('ms-admin.php?page=ust');
}
//process form
if (isset($_POST['spam-submit']) && !get_option('ust_email_sent')) {
    $reason = wp_filter_nohtml_kses(stripslashes(trim($_POST['reason'])));
    if (strlen($reason) < 20) {
        $error1 = '<p class="error">' . __("Please enter a valid reason.", 'ust') . '</p>';
    }
    //check reCAPTCHA
    $recaptcha = get_site_option('ust_recaptcha');
    if ($recaptcha['privkey']) {
        require_once WP_PLUGIN_DIR . '/anti-splog/includes/recaptchalib.php';
        $resp = rp_recaptcha_check_answer($recaptcha['privkey'], $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]);
        if (!$resp->is_valid) {
            $error2 = '<p class="error">' . __("The reCAPTCHA wasn't entered correctly. Please try again.", 'ust') . '</p>';
        }
    }
    if (!$error1 && !$error2) {
        $admin_email = get_site_option("admin_email");
        $user_email = get_option('admin_email');
        $review_url = $ust_admin_url . "&tab=splogs&bid={$blog_id}";
        $unspam_url = network_admin_url("edit.php?action=confirm&action2=unspamblog&id={$blog_id}&ref=" . urlencode($ust_admin_url) . "&msg=" . urlencode(sprintf(__("You are about to unspam the blog %s"), get_bloginfo('name'))));
        $message_headers = "MIME-Version: 1.0\n" . "From: {$user_email}\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
        $subject = sprintf(__('Splog Review Request: %s', 'ust'), get_bloginfo('url'));
        $message = sprintf(__("Someone is disputing the spam status for the blog %s (%s).\nHere is their reason:\n_______________________\n\n%s\n\n_______________________\n", 'ust'), get_bloginfo('name'), get_bloginfo('url'), $reason);
        $message .= sprintf(__("Review: %s\n", 'ust'), $review_url);
        $message .= sprintf(__("Unspam: %s\n", 'ust'), $unspam_url);
        wp_mail($admin_email, $subject, $message, $message_headers);
Example #3
0
function ust_signup_errorcheck_bp()
{
    global $bp;
    $ust_settings = get_site_option("ust_settings");
    if ($ust_settings['signup_protect'] == 'recaptcha') {
        //check reCAPTCHA
        $recaptcha = get_site_option('ust_recaptcha');
        require_once 'includes/recaptchalib.php';
        $resp = rp_recaptcha_check_answer($recaptcha['privkey'], $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]);
        if (!$resp->is_valid) {
            $bp->signup->errors['recaptcha'] = __("The reCAPTCHA wasn't entered correctly. Please try again.", 'ust');
        }
    } else {
        if ($ust_settings['signup_protect'] == 'asirra') {
            require_once 'includes/asirra.php';
            $asirra = new AsirraValidator($_POST['Asirra_Ticket']);
            if (!$asirra->passed) {
                $bp->signup->errors['asirra'] = __("Please try to correctly identify the cats again.", 'ust');
            }
        } else {
            if ($ust_settings['signup_protect'] == 'questions') {
                $ust_qa = get_site_option("ust_qa");
                if (is_array($ust_qa) && count($ust_qa)) {
                    //check the encrypted answer field
                    $salt = get_site_option("ust_salt");
                    $datesalt = strtotime(date('Y-m-d H:00:00'));
                    $valid_fields = false;
                    foreach ($ust_qa as $qkey => $answer) {
                        $field_name = 'qa_' . md5($qkey . $salt . $datesalt);
                        if (isset($_POST[$field_name])) {
                            if (strtolower(trim($_POST[$field_name])) != strtolower(stripslashes($answer[1]))) {
                                $bp->signup->errors['qa'] = __("Incorrect Answer. Please try again.", 'ust');
                            }
                            $valid_fields = true;
                        }
                    }
                    //if no fields are valid try again for previous hour
                    if (!$valid_fields) {
                        $datesalt = strtotime('-1 hour', $datesalt);
                        foreach ($ust_qa as $qkey => $answer) {
                            $field_name = 'qa_' . md5($qkey . $salt . $datesalt);
                            if (isset($_POST[$field_name])) {
                                if (strtolower(trim($_POST[$field_name])) != strtolower(stripslashes($answer[1]))) {
                                    $bp->signup->errors['qa'] = __("Incorrect Answer. Please try again.", 'ust');
                                }
                            }
                        }
                    }
                }
            } else {
                if ($ust_settings['signup_protect'] == 'ayah') {
                    $ust_ayah = get_site_option("ust_ayah");
                    require_once "includes/ayah.php";
                    $integration = new AYAH(array("publisher_key" => @$ust_ayah['pubkey'], "scoring_key" => @$ust_ayah['privkey']));
                    $score = $integration->scoreResult();
                    if (!$score) {
                        $bp->signup->errors['ayah'] = __("The Are You a Human test wasn't entered correctly. Please try again.", 'ust');
                    }
                }
            }
        }
    }
}