Exemple #1
0
         // Execute post and decode result
         $result = json_decode(curl_exec($ch), true);
         // Close connection
         curl_close($ch);
         if ($result['success'] === false) {
             $error = '<li>The reCAPTCHA wasn\'t right, please try again.</li>';
         }
     } else {
         $error = '<li>reCAPTCHA must be filled out.</li>';
     }
 }
 if ($error == '') {
     // Define accepted fields, and their human-friendly names
     $fields = array('offer' => 'Offer', 'name' => 'Full Name', 'email' => 'Email');
     // Validate, sanitize, and store contact form input
     $result = validateAndSanitize($fields);
     $field_data = $result['field_data'];
     $missing_fields = $result['missing_fields'];
 }
 foreach ($missing_fields as $field) {
     $error .= "<li>{$fields[$field]} must be filled out</li>";
 }
 if ($error == '' && empty($missing_fields)) {
     $mail = new PHPMailer();
     // If SMTP server and email password are filled out, use SMTP
     if ($config['smtp_server'] != '' && $config['recipient_email_password'] != '') {
         // Verbose debugging messages
         //$mail->SMTPDebug = 3;
         // Set mailer to use SMTP
         $mail->isSMTP();
         // Specify main SMTP server
Exemple #2
0
        // Does not match
        echo '<p><strong>Error:</strong> the account you logged in with has a different email than the <code style="background:#FFFFCA">editor_login_email</code> setting found in the config.php file. Please change that setting to the email associated with your account.</p><p><a href="./auth/">Take me back to the login screen</a></p>';
        exit;
    }
}
// -------------------------------------------------------------------
// 2. Process saved changes
// -------------------------------------------------------------------
// Changes will be sent using an AJAX request from the editor.js file
if (isset($_GET['editor']) && isset($_GET['ajax'])) {
    $error = '';
    $success = false;
    $field_data = array();
    $fields_not_required = array('domains' => '', 'enable_domain_portfolio' => '', 'enable_recaptcha' => '', 'recaptcha_public_key' => '', 'recaptcha_private_key' => '', 'image' => '', 'tint' => '', 'texture' => '', 'email' => '', 'phone' => '', 'twitter_handle' => '');
    // Validate, sanitize, and store contact form input
    $result = validateAndSanitize($_POST, $fields_not_required);
    $field_data = $result['field_data'];
    $missing_fields = $result['missing_fields'];
    foreach ($missing_fields as $field) {
        $error .= "<li>" . ucwords($field) . " must be filled out</li>";
    }
    // Save input in config.php file
    if ($error == '') {
        // Read config template
        if ($config_template = file_get_contents('includes/config-template.php')) {
            // Go through each config setting
            // If new value for setting was entered, use it
            // example key: 'editor_auth_methods'
            foreach ($config as $key => $value) {
                if (isset($field_data[$key])) {
                    $config[$key] = $field_data[$key];