| @@ 13-140 (lines=128) @@ | ||
| 10 | Released under the GNU General Public License |
|
| 11 | */ |
|
| 12 | ||
| 13 | class OSCOM_Braintree_Cfg_ssl_version { |
|
| 14 | var $default = '0'; |
|
| 15 | var $title; |
|
| 16 | var $description; |
|
| 17 | var $sort_order = 350; |
|
| 18 | ||
| 19 | function OSCOM_Braintree_Cfg_ssl_version() { |
|
| 20 | global $OSCOM_Braintree; |
|
| 21 | ||
| 22 | $this->title = $OSCOM_Braintree->getDef('cfg_ssl_version_title'); |
|
| 23 | $this->description = $OSCOM_Braintree->getDef('cfg_ssl_version_desc'); |
|
| 24 | } |
|
| 25 | ||
| 26 | function getSetField() { |
|
| 27 | global $OSCOM_Braintree; |
|
| 28 | ||
| 29 | $info_url = 'https://library.oscommerce.com/Package&braintree&oscom23&ssl_version'; |
|
| 30 | ||
| 31 | $test_button = $OSCOM_Braintree->drawButton($OSCOM_Braintree->getDef('cfg_ssl_version_button_connection_test'), '#', 'warning', 'data-button="sslVersionTestButton"'); |
|
| 32 | $info_button = addslashes($OSCOM_Braintree->drawButton($OSCOM_Braintree->getDef('cfg_ssl_version_button_more_info'), $info_url, 'info')); |
|
| 33 | ||
| 34 | $dialog_connection_test_title = addslashes($OSCOM_Braintree->getDef('cfg_ssl_version_dialog_connection_test_title')); |
|
| 35 | $dialog_connection_test_button_more_info = addslashes($OSCOM_Braintree->getDef('cfg_ssl_version_dialog_button_more_info')); |
|
| 36 | $dialog_connection_test_button_close = addslashes($OSCOM_Braintree->getDef('cfg_ssl_version_dialog_button_close')); |
|
| 37 | $dialog_connection_test_processing = addslashes($OSCOM_Braintree->getDef('cfg_ssl_version_dialog_processing')); |
|
| 38 | $dialog_connection_test_curl_version = addslashes($OSCOM_Braintree->getDef('cfg_ssl_version_dialog_curl_version')); |
|
| 39 | $dialog_connection_test_curl_ssl_version = addslashes($OSCOM_Braintree->getDef('cfg_ssl_version_dialog_curl_ssl_version')); |
|
| 40 | $dialog_connection_test_default_setting = addslashes($OSCOM_Braintree->getDef('cfg_ssl_version_dialog_default_setting')); |
|
| 41 | $dialog_connection_test_tlsv12_setting = addslashes($OSCOM_Braintree->getDef('cfg_ssl_version_dialog_tlsv12_setting')); |
|
| 42 | $dialog_connection_test_success = addslashes($OSCOM_Braintree->getDef('cfg_ssl_version_dialog_success')); |
|
| 43 | $dialog_connection_test_failed = addslashes($OSCOM_Braintree->getDef('cfg_ssl_version_dialog_failed')); |
|
| 44 | $dialog_connection_test_default_failed = addslashes($OSCOM_Braintree->getDef('cfg_ssl_version_dialog_default_failed')); |
|
| 45 | $dialog_connection_test_tlsv12_failed = addslashes($OSCOM_Braintree->getDef('cfg_ssl_version_dialog_tlsv12_failed')); |
|
| 46 | $dialog_connection_test_general_error = addslashes($OSCOM_Braintree->getDef('cfg_ssl_version_dialog_general_error')); |
|
| 47 | ||
| 48 | $has_json = function_exists('json_encode') ? 'true' : 'false'; |
|
| 49 | ||
| 50 | $input = '<input type="radio" id="sslVersionSelectionDefault" name="ssl_version" value="0"' . (OSCOM_APP_PAYPAL_BRAINTREE_SSL_VERSION == '0' ? ' checked="checked"' : '') . '><label for="sslVersionSelectionDefault">' . $OSCOM_Braintree->getDef('cfg_ssl_version_default') . '</label>' . |
|
| 51 | '<input type="radio" id="sslVersionSelectionTls12" name="ssl_version" value="1"' . (OSCOM_APP_PAYPAL_BRAINTREE_SSL_VERSION == '1' ? ' checked="checked"' : '') . '><label for="sslVersionSelectionTls12">' . $OSCOM_Braintree->getDef('cfg_ssl_version_tls12') . '</label>'; |
|
| 52 | ||
| 53 | $connection_test_url = tep_href_link('braintree.php', 'action=ssltest'); |
|
| 54 | ||
| 55 | $result = <<<EOT |
|
| 56 | <div> |
|
| 57 | <p> |
|
| 58 | <label>{$this->title}</label> |
|
| 59 | ||
| 60 | {$this->description} |
|
| 61 | ||
| 62 | <small id="sslTestButton">{$test_button}</small> |
|
| 63 | </p> |
|
| 64 | ||
| 65 | <div id="sslVersionSelection"> |
|
| 66 | {$input} |
|
| 67 | </div> |
|
| 68 | </div> |
|
| 69 | ||
| 70 | <div id="dialogSslTest" title="{$dialog_connection_test_title}"></div> |
|
| 71 | ||
| 72 | <script> |
|
| 73 | $(function() { |
|
| 74 | $('#dialogSslTest').dialog({ |
|
| 75 | autoOpen: false, |
|
| 76 | modal: true, |
|
| 77 | buttons: { |
|
| 78 | '{$dialog_connection_test_button_more_info}': function() { |
|
| 79 | window.open('{$info_url}'); |
|
| 80 | }, |
|
| 81 | '{$dialog_connection_test_button_close}': function() { |
|
| 82 | $(this).dialog('close'); |
|
| 83 | } |
|
| 84 | } |
|
| 85 | }); |
|
| 86 | ||
| 87 | $('#sslVersionSelection').buttonset(); |
|
| 88 | ||
| 89 | if ('{$has_json}' == 'true') { |
|
| 90 | $('a[data-button="sslVersionTestButton"]').click(function(e) { |
|
| 91 | e.preventDefault(); |
|
| 92 | ||
| 93 | $('#dialogSslTest').html('<p>{$dialog_connection_test_processing}</p>'); |
|
| 94 | ||
| 95 | $('#dialogSslTest').dialog('open'); |
|
| 96 | ||
| 97 | $.getJSON('{$connection_test_url}', function (data) { |
|
| 98 | if ( (typeof data == 'object') && ('rpcStatus' in data) && (data.rpcStatus == 1) ) { |
|
| 99 | var content = '<p>{$dialog_connection_test_curl_version} ' + data.curl_version + '<br />{$dialog_connection_test_curl_ssl_version} ' + data.curl_ssl_version + '</p><p>{$dialog_connection_test_default_setting} '; |
|
| 100 | ||
| 101 | if (data.default == true) { |
|
| 102 | content += '<span style="color: green; font-weight: bold;">{$dialog_connection_test_success}</span>'; |
|
| 103 | } else { |
|
| 104 | content += '<span style="color: red; font-weight: bold;">{$dialog_connection_test_failed}</span>'; |
|
| 105 | } |
|
| 106 | ||
| 107 | content += '<br />{$dialog_connection_test_tlsv12_setting} '; |
|
| 108 | ||
| 109 | if (data.tlsv12 == true) { |
|
| 110 | content += '<span style="color: green; font-weight: bold;">{$dialog_connection_test_success}</span>'; |
|
| 111 | } else { |
|
| 112 | content += '<span style="color: red; font-weight: bold;">{$dialog_connection_test_failed}</span>'; |
|
| 113 | } |
|
| 114 | ||
| 115 | content += '</p>'; |
|
| 116 | ||
| 117 | if (data.tlsv12 != true) { |
|
| 118 | content += '<p>{$dialog_connection_test_tlsv12_failed}</p>'; |
|
| 119 | } else if (data.default != true) { |
|
| 120 | content += '<p>{$dialog_connection_test_default_failed}</p>'; |
|
| 121 | } |
|
| 122 | ||
| 123 | $('#dialogSslTest').html(content); |
|
| 124 | } else { |
|
| 125 | $('#dialogSslTest').html('<p>{$dialog_connection_test_general_error}</p>'); |
|
| 126 | } |
|
| 127 | }).fail(function() { |
|
| 128 | $('#dialogSslTest').html('<p>{$dialog_connection_test_general_error}</p>'); |
|
| 129 | }); |
|
| 130 | }); |
|
| 131 | } else { |
|
| 132 | $('#sslTestButton').html('{$info_button}'); |
|
| 133 | } |
|
| 134 | }); |
|
| 135 | </script> |
|
| 136 | EOT; |
|
| 137 | ||
| 138 | return $result; |
|
| 139 | } |
|
| 140 | } |
|
| 141 | ?> |
|
| 142 | ||
| @@ 13-140 (lines=128) @@ | ||
| 10 | Released under the GNU General Public License |
|
| 11 | */ |
|
| 12 | ||
| 13 | class OSCOM_PayPal_Cfg_ssl_version { |
|
| 14 | var $default = '0'; |
|
| 15 | var $title; |
|
| 16 | var $description; |
|
| 17 | var $sort_order = 350; |
|
| 18 | ||
| 19 | function OSCOM_PayPal_Cfg_ssl_version() { |
|
| 20 | global $OSCOM_PayPal; |
|
| 21 | ||
| 22 | $this->title = $OSCOM_PayPal->getDef('cfg_ssl_version_title'); |
|
| 23 | $this->description = $OSCOM_PayPal->getDef('cfg_ssl_version_desc'); |
|
| 24 | } |
|
| 25 | ||
| 26 | function getSetField() { |
|
| 27 | global $OSCOM_PayPal; |
|
| 28 | ||
| 29 | $info_url = 'https://library.oscommerce.com/Package&paypal&oscom23&ssl_version'; |
|
| 30 | ||
| 31 | $test_button = $OSCOM_PayPal->drawButton($OSCOM_PayPal->getDef('cfg_ssl_version_button_connection_test'), '#', 'warning', 'data-button="ppSslVersionTestButton"'); |
|
| 32 | $info_button = addslashes($OSCOM_PayPal->drawButton($OSCOM_PayPal->getDef('cfg_ssl_version_button_more_info'), $info_url, 'info')); |
|
| 33 | ||
| 34 | $dialog_connection_test_title = addslashes($OSCOM_PayPal->getDef('cfg_ssl_version_dialog_connection_test_title')); |
|
| 35 | $dialog_connection_test_button_more_info = addslashes($OSCOM_PayPal->getDef('cfg_ssl_version_dialog_button_more_info')); |
|
| 36 | $dialog_connection_test_button_close = addslashes($OSCOM_PayPal->getDef('cfg_ssl_version_dialog_button_close')); |
|
| 37 | $dialog_connection_test_processing = addslashes($OSCOM_PayPal->getDef('cfg_ssl_version_dialog_processing')); |
|
| 38 | $dialog_connection_test_curl_version = addslashes($OSCOM_PayPal->getDef('cfg_ssl_version_dialog_curl_version')); |
|
| 39 | $dialog_connection_test_curl_ssl_version = addslashes($OSCOM_PayPal->getDef('cfg_ssl_version_dialog_curl_ssl_version')); |
|
| 40 | $dialog_connection_test_default_setting = addslashes($OSCOM_PayPal->getDef('cfg_ssl_version_dialog_default_setting')); |
|
| 41 | $dialog_connection_test_tlsv12_setting = addslashes($OSCOM_PayPal->getDef('cfg_ssl_version_dialog_tlsv12_setting')); |
|
| 42 | $dialog_connection_test_success = addslashes($OSCOM_PayPal->getDef('cfg_ssl_version_dialog_success')); |
|
| 43 | $dialog_connection_test_failed = addslashes($OSCOM_PayPal->getDef('cfg_ssl_version_dialog_failed')); |
|
| 44 | $dialog_connection_test_default_failed = addslashes($OSCOM_PayPal->getDef('cfg_ssl_version_dialog_default_failed')); |
|
| 45 | $dialog_connection_test_tlsv12_failed = addslashes($OSCOM_PayPal->getDef('cfg_ssl_version_dialog_tlsv12_failed')); |
|
| 46 | $dialog_connection_test_general_error = addslashes($OSCOM_PayPal->getDef('cfg_ssl_version_dialog_general_error')); |
|
| 47 | ||
| 48 | $has_json = function_exists('json_encode') ? 'true' : 'false'; |
|
| 49 | ||
| 50 | $input = '<input type="radio" id="sslVersionSelectionDefault" name="ssl_version" value="0"' . (OSCOM_APP_PAYPAL_SSL_VERSION == '0' ? ' checked="checked"' : '') . '><label for="sslVersionSelectionDefault">' . $OSCOM_PayPal->getDef('cfg_ssl_version_default') . '</label>' . |
|
| 51 | '<input type="radio" id="sslVersionSelectionTls12" name="ssl_version" value="1"' . (OSCOM_APP_PAYPAL_SSL_VERSION == '1' ? ' checked="checked"' : '') . '><label for="sslVersionSelectionTls12">' . $OSCOM_PayPal->getDef('cfg_ssl_version_tls12') . '</label>'; |
|
| 52 | ||
| 53 | $connection_test_url = tep_href_link('paypal.php', 'action=ssltest'); |
|
| 54 | ||
| 55 | $result = <<<EOT |
|
| 56 | <div> |
|
| 57 | <p> |
|
| 58 | <label>{$this->title}</label> |
|
| 59 | ||
| 60 | {$this->description} |
|
| 61 | ||
| 62 | <small id="ppSslTestButton">{$test_button}</small> |
|
| 63 | </p> |
|
| 64 | ||
| 65 | <div id="sslVersionSelection"> |
|
| 66 | {$input} |
|
| 67 | </div> |
|
| 68 | </div> |
|
| 69 | ||
| 70 | <div id="dialogSslTest" title="{$dialog_connection_test_title}"></div> |
|
| 71 | ||
| 72 | <script> |
|
| 73 | $(function() { |
|
| 74 | $('#dialogSslTest').dialog({ |
|
| 75 | autoOpen: false, |
|
| 76 | modal: true, |
|
| 77 | buttons: { |
|
| 78 | '{$dialog_connection_test_button_more_info}': function() { |
|
| 79 | window.open('{$info_url}'); |
|
| 80 | }, |
|
| 81 | '{$dialog_connection_test_button_close}': function() { |
|
| 82 | $(this).dialog('close'); |
|
| 83 | } |
|
| 84 | } |
|
| 85 | }); |
|
| 86 | ||
| 87 | $('#sslVersionSelection').buttonset(); |
|
| 88 | ||
| 89 | if ('{$has_json}' == 'true') { |
|
| 90 | $('a[data-button="ppSslVersionTestButton"]').click(function(e) { |
|
| 91 | e.preventDefault(); |
|
| 92 | ||
| 93 | $('#dialogSslTest').html('<p>{$dialog_connection_test_processing}</p>'); |
|
| 94 | ||
| 95 | $('#dialogSslTest').dialog('open'); |
|
| 96 | ||
| 97 | $.getJSON('{$connection_test_url}', function (data) { |
|
| 98 | if ( (typeof data == 'object') && ('rpcStatus' in data) && (data.rpcStatus == 1) ) { |
|
| 99 | var content = '<p>{$dialog_connection_test_curl_version} ' + data.curl_version + '<br />{$dialog_connection_test_curl_ssl_version} ' + data.curl_ssl_version + '</p><p>{$dialog_connection_test_default_setting} '; |
|
| 100 | ||
| 101 | if (data.default == true) { |
|
| 102 | content += '<span style="color: green; font-weight: bold;">{$dialog_connection_test_success}</span>'; |
|
| 103 | } else { |
|
| 104 | content += '<span style="color: red; font-weight: bold;">{$dialog_connection_test_failed}</span>'; |
|
| 105 | } |
|
| 106 | ||
| 107 | content += '<br />{$dialog_connection_test_tlsv12_setting} '; |
|
| 108 | ||
| 109 | if (data.tlsv12 == true) { |
|
| 110 | content += '<span style="color: green; font-weight: bold;">{$dialog_connection_test_success}</span>'; |
|
| 111 | } else { |
|
| 112 | content += '<span style="color: red; font-weight: bold;">{$dialog_connection_test_failed}</span>'; |
|
| 113 | } |
|
| 114 | ||
| 115 | content += '</p>'; |
|
| 116 | ||
| 117 | if (data.tlsv12 != true) { |
|
| 118 | content += '<p>{$dialog_connection_test_tlsv12_failed}</p>'; |
|
| 119 | } else if (data.default != true) { |
|
| 120 | content += '<p>{$dialog_connection_test_default_failed}</p>'; |
|
| 121 | } |
|
| 122 | ||
| 123 | $('#dialogSslTest').html(content); |
|
| 124 | } else { |
|
| 125 | $('#dialogSslTest').html('<p>{$dialog_connection_test_general_error}</p>'); |
|
| 126 | } |
|
| 127 | }).fail(function() { |
|
| 128 | $('#dialogSslTest').html('<p>{$dialog_connection_test_general_error}</p>'); |
|
| 129 | }); |
|
| 130 | }); |
|
| 131 | } else { |
|
| 132 | $('#ppSslTestButton').html('{$info_button}'); |
|
| 133 | } |
|
| 134 | }); |
|
| 135 | </script> |
|
| 136 | EOT; |
|
| 137 | ||
| 138 | return $result; |
|
| 139 | } |
|
| 140 | } |
|
| 141 | ?> |
|
| 142 | ||