katman1971 Posted June 28, 2010 Posted June 28, 2010 Hi I'm getting this error message on the order confirmation page: Warning: fopen(/145816-2-data.txt) [function.fopen]: failed to open stream: Permission denied in /home/buildawe/public_html/catalog/includes/modules/payment/paypal_standard.php on line 331 Warning: fwrite(): supplied argument is not a valid stream resource in /home/buildawe/public_html/catalog/includes/modules/payment/paypal_standard.php on line 332 Warning: fclose(): supplied argument is not a valid stream resource in /home/buildawe/public_html/catalog/includes/modules/payment/paypal_standard.php on line 333 Warning: file_get_contents() [function.file-get-contents]: Filename cannot be empty in /home/buildawe/public_html/catalog/includes/modules/payment/paypal_standard.php on line 338 Warning: file_get_contents() [function.file-get-contents]: Filename cannot be empty in /home/buildawe/public_html/catalog/includes/modules/payment/paypal_standard.php on line 338 Warning: openssl_pkcs7_sign() [function.openssl-pkcs7-sign]: error getting private key in /home/buildawe/public_html/catalog/includes/modules/payment/paypal_standard.php on line 338 Warning: unlink(/145816-2-data.txt) [function.unlink]: No such file or directory in /home/buildawe/public_html/catalog/includes/modules/payment/paypal_standard.php on line 340 Warning: file_get_contents(/145816-2-signed.txt) [function.file-get-contents]: failed to open stream: No such file or directory in /home/buildawe/public_html/catalog/includes/modules/payment/paypal_standard.php on line 343 Warning: fopen(/145816-2-signed.txt) [function.fopen]: failed to open stream: Permission denied in /home/buildawe/public_html/catalog/includes/modules/payment/paypal_standard.php on line 347 Warning: fclose(): supplied argument is not a valid stream resource in /home/buildawe/public_html/catalog/includes/modules/payment/paypal_standard.php on line 349 Warning: file_get_contents() [function.file-get-contents]: Filename cannot be empty in /home/buildawe/public_html/catalog/includes/modules/payment/paypal_standard.php on line 353 Warning: unlink(/145816-2-signed.txt) [function.unlink]: No such file or directory in /home/buildawe/public_html/catalog/includes/modules/payment/paypal_standard.php on line 355 Warning: file_get_contents(/145816-2-encrypted.txt) [function.file-get-contents]: failed to open stream: No such file or directory in /home/buildawe/public_html/catalog/includes/modules/payment/paypal_standard.php on line 358 Warning: unlink(/145816-2-encrypted.txt) [function.unlink]: No such file or directory in /home/buildawe/public_html/catalog/includes/modules/payment/paypal_standard.php on line 362 this is the part of paypal_standard.php starting on line 331: $fp = fopen(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'data.txt', 'w'); fwrite($fp, $data); fclose($fp); unset($data); if (function_exists('openssl_pkcs7_sign') && function_exists('openssl_pkcs7_encrypt')) { openssl_pkcs7_sign(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'data.txt', MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'signed.txt', file_get_contents(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_PUBLIC_KEY), file_get_contents(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_PRIVATE_KEY), array('From' => MODULE_PAYMENT_PAYPAL_STANDARD_ID), PKCS7_BINARY); unlink(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'data.txt'); // remove headers from the signature $signed = file_get_contents(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'signed.txt'); $signed = explode("\n\n", $signed); $signed = base64_decode($signed[1]); $fp = fopen(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'signed.txt', 'w'); fwrite($fp, $signed); fclose($fp); unset($signed); openssl_pkcs7_encrypt(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'signed.txt', MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'encrypted.txt', file_get_contents(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_PAYPAL_KEY), array('From' => MODULE_PAYMENT_PAYPAL_STANDARD_ID), PKCS7_BINARY); unlink(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'signed.txt'); // remove headers from the encrypted result $data = file_get_contents(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'encrypted.txt'); $data = explode("\n\n", $data); $data = '-----BEGIN PKCS7-----' . "\n" . $data[1] . "\n" . '-----END PKCS7-----'; unlink(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'encrypted.txt'); } else { exec(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_OPENSSL . ' smime -sign -in ' . MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'data.txt -signer ' . MODULE_PAYMENT_PAYPAL_STANDARD_EWP_PUBLIC_KEY . ' -inkey ' . MODULE_PAYMENT_PAYPAL_STANDARD_EWP_PRIVATE_KEY . ' -outform der -nodetach -binary > ' . MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'signed.txt'); unlink(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'data.txt'); exec(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_OPENSSL . ' smime -encrypt -des3 -binary -outform pem ' . MODULE_PAYMENT_PAYPAL_STANDARD_EWP_PAYPAL_KEY . ' < ' . MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'signed.txt > ' . MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'encrypted.txt'); unlink(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'signed.txt'); $fh = fopen(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'encrypted.txt', 'rb'); $data = fread($fh, filesize(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'encrypted.txt')); fclose($fh); unlink(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'encrypted.txt'); } $process_button_string = tep_draw_hidden_field('cmd', '_s-xclick') . tep_draw_hidden_field('encrypted', $data); unset($data); } else { reset($parameters); while (list($key, $value) = each($parameters)) { $process_button_string .= tep_draw_hidden_field($key, $value); } } Thanks
Recommended Posts
Archived
This topic is now archived and is closed to further replies.