WordPress.org

Plugin Directory

Changeset 756856


Ignore:
Timestamp:
08/15/13 20:33:06 (8 months ago)
Author:
joedolson
Message:

Dev version commit.

Location:
botsmasher/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • botsmasher/trunk/botsmasher.php

    r756381 r756856  
    181181<?php echo bs_update_settings(); ?> 
    182182<?php $bs_options = get_option( 'bs_options' ); 
    183 if ( !$options || !isset($options['bs_api_key'] ) || $options['bs_api_key'] == '' ) { 
     183if ( !$bs_options || !isset($bs_options['bs_api_key'] ) || $bs_options['bs_api_key'] == '' ) { 
    184184    $message = sprintf(__("You must <a href='%s'>enter a BotSmasher API key</a> to use BotSmasher.", 'botsmasher'), admin_url('options-general.php?page=botsmasher/botsmasher.php')); 
    185185    add_action('admin_notices', create_function( '', "if ( ! current_user_can( 'manage_options' ) ) { return; } else { echo \"<div class='error'><p>$message</p></div>\";}" ) ); 
  • botsmasher/trunk/bs-checking.php

    r755333 r756856  
    1717    // check the local registry (clears and blacklists) before querying BotSmasher 
    1818    if ( $action = 'check' ) { 
    19         $result = bs_check_local_registry( array( 'ip'=>$ip,'email'=>$email,'name'=>$author ) ); 
     19        $result = bs_check_local_registry( array( 'ip'=>$ip,'email'=>$email,'name'=>$name ) ); 
    2020    } 
    2121    if ( !$result ) { 
     
    3232        }        
    3333    } 
    34     do_action( 'bs_handle_results', $result, $ip, $email, $author, $action ); 
     34    do_action( 'bs_handle_results', $result, $ip, $email, $name, $action ); 
    3535    return ( $result === 1 || $result === true ) ? true : false; 
    3636} 
    3737 
    3838add_action( 'bs_handle_results', 'bs_local_registry', 10, 5 ); 
    39 function bs_local_registry( $result, $ip, $email, $author, $action ) { 
     39function bs_local_registry( $result, $ip, $email, $name, $action ) { 
    4040    if ( $action != 'check' ) { 
    4141        // insert into DB 
    42         $args = array( 'ip'=>$ip, 'email'=>$email, 'name'=>$author ); 
     42        $args = array( 'ip'=>$ip, 'email'=>$email, 'name'=>$name ); 
    4343        $title = md5($args['ip'].$args['email'].$args['name']); 
    4444        $post = array( 'post_title'=>$title, 'post_status'=>'publish', 'post_type'=>'bs_flags' ); 
     
    5252 
    5353function bs_check_local_registry( $args ) { 
    54     $result = $args['result']; 
    55     unset( $args['result'] ); 
     54    if ( isset( $args['result'] ) ) { 
     55        unset( $args['result'] ); 
     56    } 
    5657    $posts = get_posts( array( 'meta_key'=>'bs_flag_data', 'meta_value'=>json_encode($args) ) ); 
    5758    $count = count($posts); 
  • botsmasher/trunk/bs-contacts.php

    r755333 r756856  
    1919} 
    2020 
     21function bs_generate_array( $fields ) { 
     22    foreach ( $fields as $field ) { 
     23        $array[$field] = ' '; 
     24    } 
     25    $array['name'] == ''; 
     26    $array['email'] == ''; 
     27    $array['message'] == ''; 
     28    return $array;  
     29} 
     30 
    2131function bs_contact_form( $recipient, $submit, $fields, $labels, $required, $subject, $thanks, $template ) { 
    2232    $return = $status = ''; 
     33    $errors = array(); 
    2334    $options = get_option( 'bs_options' ); 
    2435    $lr = trim($options['bs_required_label']);   
     
    3041    } 
    3142    $labels = array_combine( $fields, $labels ); 
    32     $post = array_combine( $fields, array() );  
     43    $post = bs_generate_array( $fields );  
    3344    $return = bs_submit_form( $_POST, $recipient, $fields, $labels, $required, $subject, $thanks, $template ); 
    3445    $message = $return['message']; 
     46    $message = ( $message ) ? "<p class='bs-notice'>$message</p>" : ''; 
    3547    $hash = md5( $recipient.$fields.$labels.$required.$subject.$thanks.$template ); 
    3648    if ( is_array( $return['post'] ) ) { 
     
    6173    <div class='form'> 
    6274        <div class='header'> 
    63             <p class='bs-notice'>$message</p> 
     75            $message 
    6476        </div> 
    6577        <div class='body'> 
     
    170182    // hash ensures that forms are unique (widget won't submit main, etc.) 
    171183    $hash = md5( $recipient.$fields.$labels.$required.$subject.$thanks.$template ); 
     184    $return = ''; 
     185    $post = array( 'status'=>'', 'name'=>'', 'email'=>'', 'message'=>'' ); 
    172186    if ( isset($pd['bs_contact_form']) && $pd['bs_contact_form'] == $hash ) { 
    173187        if ( !wp_verify_nonce($pd['bs_contact_form_nonce'],'bs_contact_form') ) { wp_die(); } 
  • botsmasher/trunk/readme.txt

    r756381 r756856  
    5050== Changelog == 
    5151 
     52= 1.0.4 = 
     53 
     54* Miscellaneous warnings and notices in contact form submission. 
     55* Big fixes in local spam registry pre-check. 
     56 
    5257= 1.0.3 = 
    5358 
Note: See TracChangeset for help on using the changeset viewer.