Skip to content

Commit

Permalink
E_NOTICE fix; related to wpsharks/s2member#97
Browse files Browse the repository at this point in the history
- TODO: authnet-responses.inc.php
- TODO: paypal-responses.inc.php
  • Loading branch information
JasWSInc committed Apr 18, 2014
1 parent cb4f63f commit efbea60
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public static function sc_authnet_form ($attr = FALSE, $content = FALSE, $shortc
*/
$hidden_inputs = '<input type="hidden" name="s2member_pro_authnet_cancellation[nonce]" id="s2member-pro-authnet-cancellation-nonce" value="' . esc_attr (wp_create_nonce ("s2member-pro-authnet-cancellation")) . '" />';
$hidden_inputs .= '<input type="hidden" name="s2member_pro_authnet_cancellation[attr]" id="s2member-pro-authnet-cancellation-attr" value="' . esc_attr (c_ws_plugin__s2member_utils_encryption::encrypt (serialize ($attr))) . '" />';
$hidden_inputs .= '<input type="hidden" name="s2p-option" value="'.esc_attr((string)$_REQUEST['s2p-option']).'" />';
$hidden_inputs .= '<input type="hidden" name="s2p-option" value="'.esc_attr((string)@$_REQUEST['s2p-option']).'" />';
/*
Get the form template.
*/
Expand Down Expand Up @@ -302,7 +302,7 @@ public static function sc_authnet_form ($attr = FALSE, $content = FALSE, $shortc
$hidden_inputs .= (!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_names"]) ? '<input type="hidden" id="s2member-pro-authnet-registration-names-not-required-or-not-possible" value="1" />' : '';
$hidden_inputs .= (!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_password"]) ? '<input type="hidden" id="s2member-pro-authnet-registration-password-not-required-or-not-possible" value="1" />' : '';
$hidden_inputs .= '<input type="hidden" name="s2member_pro_authnet_registration[attr]" id="s2member-pro-authnet-registration-attr" value="' . esc_attr (c_ws_plugin__s2member_utils_encryption::encrypt (serialize ($attr))) . '" />';
$hidden_inputs .= '<input type="hidden" name="s2p-option" value="'.esc_attr((string)$_REQUEST['s2p-option']).'" />';
$hidden_inputs .= '<input type="hidden" name="s2p-option" value="'.esc_attr((string)@$_REQUEST['s2p-option']).'" />';
/*
Get the form template.
*/
Expand Down Expand Up @@ -432,7 +432,7 @@ public static function sc_authnet_form ($attr = FALSE, $content = FALSE, $shortc
*/
$hidden_inputs = '<input type="hidden" name="s2member_pro_authnet_update[nonce]" id="s2member-pro-authnet-update-nonce" value="' . esc_attr (wp_create_nonce ("s2member-pro-authnet-update")) . '" />';
$hidden_inputs .= '<input type="hidden" name="s2member_pro_authnet_update[attr]" id="s2member-pro-authnet-update-attr" value="' . esc_attr (c_ws_plugin__s2member_utils_encryption::encrypt (serialize ($attr))) . '" />';
$hidden_inputs .= '<input type="hidden" name="s2p-option" value="'.esc_attr((string)$_REQUEST['s2p-option']).'" />';
$hidden_inputs .= '<input type="hidden" name="s2p-option" value="'.esc_attr((string)@$_REQUEST['s2p-option']).'" />';

/*
Get the form template.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,12 @@ public static function authnet_arb_response($post_vars = FALSE)

$trial = (!empty($post_vars["x_trial_occurrences"])) ? true : false; // Indicates existence of trial.

if((int)$post_vars["x_length"] === 30 && $post_vars["x_unit"] === "days")
if(isset($post_vars["x_length"], $post_vars["x_unit"]))
if((int)$post_vars["x_length"] === 30 && $post_vars["x_unit"] === "days")
{
$post_vars["x_length"] = 1;
$post_vars["x_unit"] = "months";
}

if(!empty($post_vars["x_method"]) && $post_vars["x_method"] === "create")
{
$xml = '<?xml version="1.0" encoding="utf-8"?>';
Expand Down Expand Up @@ -233,7 +233,6 @@ public static function authnet_arb_response($post_vars = FALSE)

$xml .= '</ARBCreateSubscriptionRequest>';
}

else if(!empty($post_vars["x_method"]) && $post_vars["x_method"] === "update")
{
$xml = '<?xml version="1.0" encoding="utf-8"?>';
Expand Down Expand Up @@ -275,7 +274,6 @@ public static function authnet_arb_response($post_vars = FALSE)

$xml .= '</ARBUpdateSubscriptionRequest>';
}

else if(!empty($post_vars["x_method"]) && $post_vars["x_method"] === "status")
{
$xml = '<?xml version="1.0" encoding="utf-8"?>';
Expand All @@ -291,7 +289,6 @@ public static function authnet_arb_response($post_vars = FALSE)

$xml .= '</ARBGetSubscriptionStatusRequest>';
}

else if(!empty($post_vars["x_method"]) && $post_vars["x_method"] === "cancel")
{
$xml = '<?xml version="1.0" encoding="utf-8"?>';
Expand All @@ -307,7 +304,6 @@ public static function authnet_arb_response($post_vars = FALSE)

$xml .= '</ARBCancelSubscriptionRequest>';
}

$req["headers"]["Accept"] = "application/xml; charset=UTF-8";
$req["headers"]["Content-Type"] = "application/xml; charset=UTF-8";

Expand Down Expand Up @@ -339,7 +335,7 @@ public static function authnet_arb_response($post_vars = FALSE)
$log4 = (is_multisite() && !is_main_site()) ? ($_log4 = $current_blog->domain.$current_blog->path)."\n".$log4 : $log4;
$log2 = (is_multisite() && !is_main_site()) ? "authnet-api-4-".trim(preg_replace("/[^a-z0-9]/i", "-", $_log4), "-").".log" : "authnet-api.log";

if(strlen($post_vars["x_card_num"]) > 4) // Only log last 4 digits for security.
if(!empty($post_vars["x_card_num"]) && strlen($post_vars["x_card_num"]) > 4) // Only log last 4 digits for security.
$post_vars["x_card_num"] = str_repeat("*", strlen($post_vars["x_card_num"]) - 4)
.substr($post_vars["x_card_num"], -4); // Then display last 4 digits.

Expand Down

0 comments on commit efbea60

Please sign in to comment.