Skip to content

Commit

Permalink
Manual update from 1.8.19 to 1.8.20.5.
Browse files Browse the repository at this point in the history
  • Loading branch information
remcotolsma committed Dec 17, 2014
1 parent 0b6149f commit f43ef1b
Show file tree
Hide file tree
Showing 18 changed files with 380 additions and 204 deletions.
50 changes: 50 additions & 0 deletions change_log.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,53 @@
-------------------------------------------------------------------------------------------------------------------
Version 1.8.20.5
- Fixed issue with exporting/importing some post field settings.
- Fixed notice when filter entries with empty filter value

-------------------------------------------------------------------------------------------------------------------
Version 1.8.20.4
- Fixed issue with password field on multi-page forms

-------------------------------------------------------------------------------------------------------------------
Version 1.8.20.3
- Fixed an issue with list field shim when RTL was enabled
- Fixed an issue with the results page where the 'show more' link retrieves duplicate values if some values of that field are empty.

-------------------------------------------------------------------------------------------------------------------
Version 1.8.20.2
- Fixed issue with section breaks getting displayed on {all_fields_display_empty} even when hidden by conditional logic.

-------------------------------------------------------------------------------------------------------------------
Version 1.8.20.1
- Fixed an issue where exporting lead data for checkbox fields did not work when the choice label included quotes.

-------------------------------------------------------------------------------------------------------------------
Version 1.8.20
- Added extra logging statements.
- Added South African Rand currency.
- Added portuguese translation.
- Added support for mysql encryption.
- Added "Processing" as an option for payment status when adding conditional logic rules.
- Added hook to allow users to disable script tag stripping.
- Updated merge tag list to exclude credit card field options, except the credit card number (last 4 digits) and credit card type for Confirmations and Notifications.
- Updated notification's From Name and Subject to use the Text version of merge tags.
- Updated notification's From Name so that it is sanitized before being used.
- Fixed conflict with WP-reCAPTCHA plugin.
- Fixed an issue with the multi-file upload field where the paths to the uploaded files can get removed from the entry if a third party add-on processes the entry before Gravity Forms. This fixes a compatibility issue with the Gravity Perks Conditional Logic Perk.
- Fixed a security issue with the file upload field.
- Fixed issue with outdated cached version of total field not getting refreshed.
- Fixed notice message.
- Fixed issue with {ip} merge tag replacing "wrong" IP when resending notifications.
- Fixed issue with the id attribute for the address field city label.
- Fixed issue when updating entry with conditional logic fields via the gform_entry_id_pre_save_lead.
- Fixed issue with conditional logic and the gf_inline class.
- Fixed an issue with the entry list filter, results page filters, export conditional logic where number field values would be treated as strings by the entry search query.
- AF: Fixed issue causing feeds not to get created when updating add-ons to the framework version.
- AF: Updated feed field mapping to include credit card number (last 4 digits) and credit card type as choices.
- AF: Updated feed field mapping to exclude credit card fields as choices.
- AF: Fixed an issue with the URL for the add-on settings tab.
- API: Fixed an issue with GFAPI::update_entry() where empty values are ignored when specifying a different entry ID to the ID in the entry array.
- API: Fixed an issue with GFAPI:get_entries() where number field values would be treated as strings.

-------------------------------------------------------------------------------------------------------------------
Version 1.8.19
- Fixed Notices
Expand Down
84 changes: 62 additions & 22 deletions common.php
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ public static function get_merge_tags($fields, $element_id, $hide_all_fields = f

}

$other_group[] = array('tag' => '{ip}', 'label' => __("Client IP Address", "gravityforms"));
$other_group[] = array('tag' => '{ip}', 'label' => __("User IP Address", "gravityforms"));
$other_group[] = array('tag' => '{date_mdy}', 'label' => __("Date", "gravityforms") . ' (mm/dd/yyyy)');
$other_group[] = array('tag' => '{date_dmy}', 'label' => __("Date", "gravityforms") . ' (dd/mm/yyyy)');
$other_group[] = array('tag' => '{embed_post:ID}', 'label' => __("Embed Post/Page Id", "gravityforms"));
Expand Down Expand Up @@ -469,9 +469,18 @@ public static function get_field_merge_tags($field, $option="") {
}

foreach($field["inputs"] as $input) {
$value = "{" . esc_html(GFCommon::get_label($field, $input["id"])) . ":" . $input["id"] . "{$tag_args}}";
$merge_tags[] = array( 'tag' => $value, 'label' => esc_html(GFCommon::get_label($field, $input["id"])) );
}
if( RGFormsModel::get_input_type( $field ) == 'creditcard' ) {
//only include the credit card type (field_id.4) and number (field_id.1)
if ( $input['id'] == $field['id'] . '.1' || $input['id'] == $field['id'] . '.4' ) {
$value = '{' . esc_html( GFCommon::get_label( $field, $input['id'] ) ) . ':' . $input['id'] . "{$tag_args}}";
$merge_tags[] = array( 'tag' => $value, 'label' => esc_html( GFCommon::get_label( $field, $input['id'] ) ) );
}
}
else {
$value = "{" . esc_html(GFCommon::get_label($field, $input["id"])) . ":" . $input["id"] . "{$tag_args}}";
$merge_tags[] = array( 'tag' => $value, 'label' => esc_html(GFCommon::get_label($field, $input["id"])) );
}
}

}
else {
Expand Down Expand Up @@ -908,7 +917,7 @@ public static function replace_variables($text, $form, $lead, $url_encode = fals
$post_url = get_bloginfo("wpurl") . "/wp-admin/post.php?action=edit&post=" . rgar($lead, "post_id");
$text = str_replace("{post_edit_url}", $url_encode ? urlencode($post_url) : $post_url, $text);

$text = self::replace_variables_prepopulate($text, $url_encode);
$text = self::replace_variables_prepopulate($text, $url_encode, $lead);

// hook allows for custom merge tags
$text = apply_filters('gform_replace_merge_tags', $text, $form, $lead, $url_encode, $esc_html, $nl2br, $format);
Expand Down Expand Up @@ -957,7 +966,7 @@ public static function get_embed_post(){
}
}

public static function replace_variables_prepopulate($text, $url_encode=false){
public static function replace_variables_prepopulate($text, $url_encode=false, $entry=false){

//embed url
$text = str_replace("{embed_url}", $url_encode ? urlencode(RGFormsModel::get_current_page_url()) : RGFormsModel::get_current_page_url(), $text);
Expand All @@ -973,7 +982,7 @@ public static function replace_variables_prepopulate($text, $url_encode=false){
$text = str_replace("{date_dmy}", $url_encode ? urlencode($local_date_dmy) : $local_date_dmy, $text);

// ip
$ip = GFFormsModel::get_ip();
$ip = isset( $entry['ip'] ) ? $entry['ip'] : GFFormsModel::get_ip();
$text = str_replace( '{ip}', $url_encode ? urlencode( $ip ) : $ip, $text );

global $post;
Expand Down Expand Up @@ -1064,7 +1073,12 @@ public static function get_submitted_fields($form, $lead, $display_empty=false,
break;

case "section" :
if((!GFCommon::is_section_empty($field, $form, $lead) || $display_empty) && !rgar($field, "adminOnly")){

if ( GFFormsModel::is_field_hidden( $form, $field, array(), $lead ) ){
continue;
}

if ( ( ! GFCommon::is_section_empty( $field, $form, $lead ) || $display_empty ) && !rgar( $field, "adminOnly" ) ) {

switch($format){
case "text" :
Expand Down Expand Up @@ -1446,9 +1460,9 @@ public static function send_notification($notification, $form, $lead){

//Running through variable replacement
$to = GFCommon::replace_variables($email_to, $form, $lead, false, false);
$subject = GFCommon::replace_variables(rgar($notification, "subject"), $form, $lead, false, false);
$subject = GFCommon::replace_variables(rgar($notification, "subject"), $form, $lead, false, false, true, 'text');
$from = GFCommon::replace_variables(rgar($notification, "from"), $form, $lead, false, false);
$from_name = GFCommon::replace_variables(rgar($notification, "fromName"), $form, $lead, false, false);
$from_name = GFCommon::replace_variables(rgar($notification, "fromName"), $form, $lead, false, false, true, 'text');
$bcc = GFCommon::replace_variables(rgar($notification, "bcc"), $form, $lead, false, false);
$replyTo = GFCommon::replace_variables(rgar($notification, "replyTo"), $form, $lead, false, false);

Expand Down Expand Up @@ -1621,7 +1635,7 @@ private static function send_email($from, $to, $bcc, $reply_to, $subject, $messa
$name = empty($from_name) ? $from : $from_name;

$headers = array();
$headers["From"] = "From: \"{$name}\" <{$from}>";
$headers["From"] = "From: \"" . wp_strip_all_tags($name, true) . "\" <{$from}>";

if(GFCommon::is_valid_email($reply_to))
$headers["Reply-To"] = "Reply-To: {$reply_to}";
Expand Down Expand Up @@ -3347,8 +3361,9 @@ public static function get_field_input($field, $value="", $lead_id=0, $form_id=0
$onchange= rgar($field,"passwordStrengthEnabled") ? "onchange='{$action}'" : "";
$onkeyup = rgar($field,"passwordStrengthEnabled") ? "onkeyup='{$action}'" : "";

$pass = RGForms::post("input_" . $id ."_2");
return sprintf("<div class='ginput_complex$class_suffix ginput_container' id='{$field_id}_container'><span id='" . $field_id . "_1_container' class='ginput_left'><input type='password' name='input_%d' id='%s' {$onkeyup} {$onchange} value='%s' $first_tabindex %s/><label for='%s'>" . apply_filters("gform_password_{$form_id}", apply_filters("gform_password",__("Enter Password", "gravityforms"), $form_id), $form_id) . "</label></span><span id='" . $field_id . "_2_container' class='ginput_right'><input type='password' name='input_%d_2' id='%s_2' {$onkeyup} {$onchange} value='%s' $last_tabindex %s/><label for='%s_2'>" . apply_filters("gform_password_confirm_{$form_id}", apply_filters("gform_password_confirm",__("Confirm Password", "gravityforms"), $form_id), $form_id) . "</label></span><div class='gf_clear gf_clear_complex'></div></div>{$strength}", $id, $field_id, esc_attr($value), $disabled_text, $field_id, $id, $field_id, esc_attr($pass), $disabled_text, $field_id);
$pass = is_array( $value ) ? rgar( $value, $id ) : $value;
$confirm_pass = RGForms::post("input_" . $id ."_2");
return sprintf("<div class='ginput_complex$class_suffix ginput_container' id='{$field_id}_container'><span id='" . $field_id . "_1_container' class='ginput_left'><input type='password' name='input_%d' id='%s' {$onkeyup} {$onchange} value='%s' $first_tabindex %s/><label for='%s'>" . apply_filters("gform_password_{$form_id}", apply_filters("gform_password",__("Enter Password", "gravityforms"), $form_id), $form_id) . "</label></span><span id='" . $field_id . "_2_container' class='ginput_right'><input type='password' name='input_%d_2' id='%s_2' {$onkeyup} {$onchange} value='%s' $last_tabindex %s/><label for='%s_2'>" . apply_filters("gform_password_confirm_{$form_id}", apply_filters("gform_password_confirm",__("Confirm Password", "gravityforms"), $form_id), $form_id) . "</label></span><div class='gf_clear gf_clear_complex'></div></div>{$strength}", $id, $field_id, esc_attr($pass), $disabled_text, $field_id, $id, $field_id, esc_attr($confirm_pass), $disabled_text, $field_id);

case "name" :
$prefix = "";
Expand Down Expand Up @@ -3455,7 +3470,7 @@ public static function get_field_input($field, $value="", $lead_id=0, $form_id=0

//city field
$tabindex = self::get_tabindex();
$city = sprintf("<span class='ginput_{$city_location}$class_suffix' id='" . $field_id . "_3_container'><input type='text' name='input_%d.3' id='%s_3' value='%s' $tabindex %s/><label for='%s_3' id='$field_id.3_label'>" . apply_filters("gform_address_city_{$form_id}", apply_filters("gform_address_city",__("City", "gravityforms"), $form_id), $form_id) . "</label></span>", $id, $field_id, $city_value, $disabled_text, $field_id);
$city = sprintf("<span class='ginput_{$city_location}$class_suffix' id='" . $field_id . "_3_container'><input type='text' name='input_%d.3' id='%s_3' value='%s' $tabindex %s/><label for='%s_3' id='{$field_id}_3_label'>" . apply_filters("gform_address_city_{$form_id}", apply_filters("gform_address_city",__("City", "gravityforms"), $form_id), $form_id) . "</label></span>", $id, $field_id, $city_value, $disabled_text, $field_id);

//state field
$style = (IS_ADMIN && rgget("hideState", $field)) ? "style='display:none;'" : "";
Expand Down Expand Up @@ -3925,7 +3940,9 @@ public static function get_field_input($field, $value="", $lead_id=0, $form_id=0

$has_columns = is_array(rgar($field, "choices"));
$columns = $has_columns ? rgar($field, "choices") : array(array());
$label_target_shim = sprintf( '<input type=\'text\' id=\'input_%1$s_%2$s_shim\' style=\'position:absolute;left:-999em;\' onfocus=\'jQuery( "#field_%1$s_%2$s table tr td:first-child input" ).focus();\' />', $form_id, $field['id'] );

$shim_style = is_rtl() ? 'position:absolute;left:999em;' : 'position:absolute;left:-999em;';
$label_target_shim = sprintf( '<input type=\'text\' id=\'input_%1$s_%2$s_shim\' style=\'%3$s\' onfocus=\'jQuery( "#field_%1$s_%2$s table tr td:first-child input" ).focus();\' />', $form_id, $field['id'], $shim_style );

$list = "<div class='ginput_container ginput_list'>" .
$label_target_shim .
Expand Down Expand Up @@ -5783,6 +5800,10 @@ public static function get_entry_info_filter_columns($get_users = true){
"text" => "Paid",
"value" => "Paid"
),
array(
"text" => "Processing",
"value" => "Processing"
),
array(
"text" => "Failed",
"value" => "Failed"
Expand Down Expand Up @@ -5961,19 +5982,38 @@ public static function compare_floats( $float1, $float2, $operator ) {
}

public static function encrypt( $text ) {
$use_mcrypt = apply_filters('gform_use_mcrypt', function_exists( 'mcrypt_encrypt' ) );

$iv_size = mcrypt_get_iv_size( MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB );
$key = substr( md5( wp_salt( 'nonce' ) ), 0, $iv_size );
if ( $use_mcrypt ){
$iv_size = mcrypt_get_iv_size( MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB );
$key = substr( md5( wp_salt( 'nonce' ) ), 0, $iv_size );

return trim( base64_encode( mcrypt_encrypt( MCRYPT_RIJNDAEL_256, $key, $text, MCRYPT_MODE_ECB, mcrypt_create_iv( $iv_size, MCRYPT_RAND ) ) ) );
}
$encrypted_value = trim( base64_encode( mcrypt_encrypt( MCRYPT_RIJNDAEL_256, $key, $text, MCRYPT_MODE_ECB, mcrypt_create_iv( $iv_size, MCRYPT_RAND ) ) ) );
}
else{
global $wpdb;
$encrypted_value = base64_encode( $wpdb->get_var( $wpdb->prepare('SELECT AES_ENCRYPT(%s, %s) AS data', $text, wp_salt( 'nonce' ) ) ) );
}

return $encrypted_value;
}

public static function decrypt( $text ) {

$iv_size = mcrypt_get_iv_size( MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB );
$key = substr( md5( wp_salt( 'nonce' ) ), 0, $iv_size );
$use_mcrypt = apply_filters('gform_use_mcrypt', function_exists( 'mcrypt_decrypt' ) );

if ( $use_mcrypt ){
$iv_size = mcrypt_get_iv_size( MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB );
$key = substr( md5( wp_salt( 'nonce' ) ), 0, $iv_size );

$decrypted_value = trim( mcrypt_decrypt( MCRYPT_RIJNDAEL_256, $key, base64_decode( $text ), MCRYPT_MODE_ECB, mcrypt_create_iv( $iv_size, MCRYPT_RAND ) ) );
}
else{
global $wpdb;
$decrypted_value = $wpdb->get_var( $wpdb->prepare('SELECT AES_DECRYPT(%s, %s) AS data', base64_decode( $text ), wp_salt( 'nonce' ) ) );
}

return trim( mcrypt_decrypt( MCRYPT_RIJNDAEL_256, $key, base64_decode( $text ), MCRYPT_MODE_ECB, mcrypt_create_iv( $iv_size, MCRYPT_RAND ) ) );
return $decrypted_value;
}

public static function esc_like( $value ) {
Expand Down
6 changes: 4 additions & 2 deletions currency.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,14 @@ public static function get_currencies(){
"PLN" => array("name" => __("Polish Zloty", "gravityforms"), "symbol_left" => '&#122;&#322;', "symbol_right" => "", "symbol_padding" => " ", "thousand_separator" => '.', "decimal_separator" => ',', "decimals" => 2),
"GBP" => array("name" => __("Pound Sterling", "gravityforms"), "symbol_left" => '&#163;', "symbol_right" => "", "symbol_padding" => " ", "thousand_separator" => ',', "decimal_separator" => '.', "decimals" => 2),
"SGD" => array("name" => __("Singapore Dollar", "gravityforms"), "symbol_left" => '$', "symbol_right" => "", "symbol_padding" => " ", "thousand_separator" => ',', "decimal_separator" => '.', "decimals" => 2),
"SEK" => array("name" => __("Swedish Krona", "gravityforms"), "symbol_left" => '', "symbol_right" => "Kr", "symbol_padding" => " ", "thousand_separator" => ' ', "decimal_separator" => ',', "decimals" => 2),
"ZAR" => array("name" => __("South African Rand", "gravityforms"), "symbol_left" => 'R', "symbol_right" => "", "symbol_padding" => "", "thousand_separator" => ',', "decimal_separator" => '.', "decimals" => 2),
"SEK" => array("name" => __("Swedish Krona", "gravityforms"), "symbol_left" => '', "symbol_right" => "Kr", "symbol_padding" => " ", "thousand_separator" => ' ', "decimal_separator" => ',', "decimals" => 2),
"CHF" => array("name" => __("Swiss Franc", "gravityforms"), "symbol_left" => 'Fr.', "symbol_right" => "", "symbol_padding" => " ", "thousand_separator" => "'", "decimal_separator" => '.', "decimals" => 2),
"TWD" => array("name" => __("Taiwan New Dollar", "gravityforms"), "symbol_left" => '$', "symbol_right" => "", "symbol_padding" => " ", "thousand_separator" => ',', "decimal_separator" => '.', "decimals" => 2),
"THB" => array("name" => __("Thai Baht", "gravityforms"), "symbol_left" => '&#3647;', "symbol_right" => "", "symbol_padding" => " ", "thousand_separator" => ',', "decimal_separator" => '.', "decimals" => 2),
"USD" => array("name" => __("U.S. Dollar", "gravityforms"), "symbol_left" => '$', "symbol_right" => "", "symbol_padding" => "", "thousand_separator" => ',', "decimal_separator" => '.', "decimals" => 2)
);

);

return apply_filters("gform_currencies", $currencies);
}
Expand Down
Loading

0 comments on commit f43ef1b

Please sign in to comment.