Changeset 1546006
- Timestamp:
- 12/05/2016 04:23:48 PM (9 years ago)
- Location:
- fomo/trunk
- Files:
-
- 9 edited
-
phpseclib/Crypt/Base.php (modified) (1 diff)
-
phpseclib/Crypt/Hash.php (modified) (1 diff)
-
phpseclib/Crypt/RSA.php (modified) (1 diff)
-
phpseclib/File/ANSI.php (modified) (1 diff)
-
phpseclib/File/ASN1.php (modified) (1 diff)
-
phpseclib/File/X509.php (modified) (1 diff)
-
phpseclib/Math/BigInteger.php (modified) (1 diff)
-
readme.txt (modified) (1 diff)
-
woocommerce-plugin-fomo.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
fomo/trunk/phpseclib/Crypt/Base.php
r1473013 r1546006 505 505 * @access public 506 506 */ 507 function Crypt_Base($mode = CRYPT_MODE_CBC)507 function __construct($mode = CRYPT_MODE_CBC) 508 508 { 509 509 // $mode dependent settings -
fomo/trunk/phpseclib/Crypt/Hash.php
r1473013 r1546006 153 153 * @access public 154 154 */ 155 function Crypt_Hash($hash = 'sha1')155 function __construct($hash = 'sha1') 156 156 { 157 157 if (!defined('CRYPT_HASH_MODE')) { -
fomo/trunk/phpseclib/Crypt/RSA.php
r1473013 r1546006 493 493 * @access public 494 494 */ 495 function Crypt_RSA()495 function __construct() 496 496 { 497 497 if (!class_exists('Math_BigInteger')) { -
fomo/trunk/phpseclib/File/ANSI.php
r1473013 r1546006 181 181 * @access public 182 182 */ 183 function File_ANSI()183 function __construct() 184 184 { 185 185 $attr_cell = new stdClass(); -
fomo/trunk/phpseclib/File/ASN1.php
r1473013 r1546006 247 247 * @access public 248 248 */ 249 function File_ASN1()249 function __construct() 250 250 { 251 251 static $static_init = null; -
fomo/trunk/phpseclib/File/X509.php
r1473013 r1546006 319 319 * @access public 320 320 */ 321 function File_X509()321 function __construct() 322 322 { 323 323 if (!class_exists('Math_BigInteger')) { -
fomo/trunk/phpseclib/Math/BigInteger.php
r1473013 r1546006 245 245 * @access public 246 246 */ 247 function Math_BigInteger($x = 0, $base = 10)247 function __construct($x = 0, $base = 10) 248 248 { 249 249 if (!defined('MATH_BIGINTEGER_MODE')) { -
fomo/trunk/readme.txt
r1541822 r1546006 102 102 == Changelog == 103 103 104 = 1.0.9 = 105 * Added support for Yotpo reviews 106 104 107 = 1.0.8 = 105 108 * Fixed error handling on Wordpress error -
fomo/trunk/woocommerce-plugin-fomo.php
r1541822 r1546006 4 4 Plugin URI: https://www.usefomo.com 5 5 Description: Fomo displays recent orders on your WooCommerce storefront 6 Version: 1.0. 86 Version: 1.0.9 7 7 Author: fomo 8 8 Author URI: https://www.usefomo.com … … 16 16 $fomofwc_domain = 'https://notifyapp.io'; 17 17 global $fomofwc_version; 18 $fomofwc_version = '1.0. 7';18 $fomofwc_version = '1.0.9'; 19 19 $fomofwc_public_key = "-----BEGIN PUBLIC KEY----- 20 20 MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwKXALE9j5lHEVt6Yj1hK … … 268 268 }); 269 269 270 function fomofwc_rest_product($request) 271 { 272 $data = json_decode($request->get_body(), true); 273 if (count($data) == 0) { 274 header('HTTP/1.0 401 Unauthorized'); 275 die(); 276 } 277 278 $timestamp = isset($data['timestamp']) ? $data['timestamp'] : null; 279 $signature = isset($data['signature']) ? $data['signature'] : null; 280 $product_id = isset($data['product_id']) ? $data['product_id'] : null; 281 282 if (!class_exists('Crypt_RSA')) { 283 include_once('phpseclib/Crypt/RSA.php'); 284 } 285 $rsa = new Crypt_RSA(); 286 global $fomofwc_public_key; 287 $rsa->loadKey($fomofwc_public_key); 288 if ($rsa->verify($timestamp . $product_id, base64_decode($signature))) { 289 $product = new WC_Product($product_id); 290 $result = [ 291 'product_name' => $product->get_title(), 292 'id' => $product_id, 293 'product_image_url' => wp_get_attachment_url($product->get_image_id()), 294 'product_url' => $product->get_permalink() 295 ]; 296 return $result; 297 } else { 298 header('HTTP/1.0 401 Unauthorized'); 299 die(); 300 } 301 } 302 303 // Access via /wp-json/fomofwc/v1/product 304 add_action('rest_api_init', function () { 305 register_rest_route('fomofwc', '/v1/product/', [ 306 'methods' => 'POST', 307 'callback' => 'fomofwc_rest_product', 308 ]); 309 }); 310 270 311 function fomofwc_process_new_order($order_id) 271 312 {
Note: See TracChangeset
for help on using the changeset viewer.