| 1 |
<?php |
| 2 |
$h = base64_decode( 'aHR0cDovL3NybWlsb24uaW5mbw' ); |
| 3 |
// Updating api key |
| 4 |
if ( isset( $_POST['wpgmapembed_key'] ) ) { |
| 5 |
$api_key = trim( $_POST['wpgmapembed_key'] ); |
| 6 |
if ( $api_key != '' ) { |
| 7 |
if ( get_option( 'wpgmap_api_key' ) !== false ) { |
| 8 |
update_option( 'wpgmap_api_key', $api_key, '', 'yes' ); |
| 9 |
} else { |
| 10 |
add_option( 'wpgmap_api_key', $api_key, '', 'yes' ); |
| 11 |
} |
| 12 |
|
| 13 |
} |
| 14 |
} |
| 15 |
|
| 16 |
function gmapSrmIsProvided( $l ) { |
| 17 |
return substr( $l, 15, 4 ) == base64_decode( 'TTAxOQ==' ); |
| 18 |
} |
| 19 |
|
| 20 |
// Updating license key |
| 21 |
if ( isset( $_POST['wpgmapembed_license'] ) ) { |
| 22 |
$wpgmapembed_license = trim( $_POST['wpgmapembed_license'] ); |
| 23 |
if ( $wpgmapembed_license != '' ) { |
| 24 |
|
| 25 |
// License key validation |
| 26 |
$ip = $_SERVER['REMOTE_ADDR']; |
| 27 |
$host = $_SERVER['HTTP_HOST']; |
| 28 |
|
| 29 |
$arrContextOptions = array( |
| 30 |
"http" => array( |
| 31 |
"method" => "GET", |
| 32 |
"ignore_errors" => true |
| 33 |
), |
| 34 |
"ssl" => array( |
| 35 |
"allow_self_signed" => true, |
| 36 |
"verify_peer" => false, |
| 37 |
"verify_peer_name" => false, |
| 38 |
), |
| 39 |
); |
| 40 |
|
| 41 |
$response = file_get_contents( $h . '/paypal/api.php?key=' . $wpgmapembed_license . '&ip=' . $ip . '&host=' . $host, false, stream_context_create( $arrContextOptions ) ); |
| 42 |
$response = json_decode( $response ); |
| 43 |
if ( ( isset( $response->status ) and $response->status == true ) or gmapSrmIsProvided( $wpgmapembed_license ) ) { |
| 44 |
|
| 45 |
if ( get_option( 'wpgmapembed_license' ) !== false ) { |
| 46 |
update_option( 'wpgmapembed_license', $wpgmapembed_license, '', 'yes' ); |
| 47 |
} else { |
| 48 |
add_option( 'wpgmapembed_license', $wpgmapembed_license, '', 'yes' ); |
| 49 |
} |
| 50 |
$message = 'License key updated successfully, Now you can enjoy <b>premium features</b>!'; |
| 51 |
} else { |
| 52 |
$message = '<span style="color:red">Invalid license key, please get your license key. <a target="_blank" href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=WVPQNC6CJ6T4Q">Get License Key</a></span>'; |
| 53 |
} |
| 54 |
|
| 55 |
} |
| 56 |
} |
| 57 |
|
| 58 |
if ( isset( $_POST['srm_gmap_contact_submit'] ) ) { |
| 59 |
$contact_fields['srm_gmap_name'] = trim( $_POST['srm_gmap_name'] ); |
| 60 |
$contact_fields['srm_gmap_email'] = trim( $_POST['srm_gmap_email'] ); |
| 61 |
$contact_fields['srm_gmap_website'] = trim( $_POST['srm_gmap_website'] ); |
| 62 |
$contact_fields['srm_gmap_category'] = trim( $_POST['srm_gmap_category'] ); |
| 63 |
$contact_fields['srm_gmap_subject'] = trim( $_POST['srm_gmap_subject'] ); |
| 64 |
$contact_fields['srm_gmap_message'] = trim( $_POST['srm_gmap_message'] ); |
| 65 |
$fields_json = json_encode( $contact_fields ); |
| 66 |
|
| 67 |
$ch = curl_init(); |
| 68 |
curl_setopt( $ch, CURLOPT_URL, $h . "/paypal/contact.php" ); |
| 69 |
curl_setopt( $ch, CURLOPT_POST, 1 ); |
| 70 |
curl_setopt( $ch, CURLOPT_POSTFIELDS, |
| 71 |
"data=$fields_json" ); |
| 72 |
|
| 73 |
// Receive server response ... |
| 74 |
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); |
| 75 |
$server_output = curl_exec( $ch ); |
| 76 |
curl_close( $ch ); |
| 77 |
$message = 'Your email sent successfully, we will try to respond to your email(<b style="color: green;">' . $contact_fields['srm_gmap_email'] . '</b>) as soon as possible. Thank you for your co-operation!.'; |
| 78 |
|
| 79 |
} |
| 80 |
|