Esempio n. 1
0
 public function getData()
 {
     if (class_exists("MM_MemberMouseService")) {
         if (method_exists("MM_MemberMouseService", "getLicense")) {
             MM_MemberMouseService::getLicense($this);
         } else {
             // TODO remove this after all customers migrated from 1.x
             // protect from 1.x versions of MemberMouse trying to upgrade directly
             $error = "<div style='font-family: sans-serif; font-size: 13px;'>";
             $error .= "<h3 style='color:#BC0B0B; margin-top:0px; margin-bottom:5px; font-size: 14px;'>Cannot Upgrade to MemberMouse 2.0</h3>";
             $error .= "<p style='margin-top:0px; margin-bottom:5px;'>Before you can upgrade MemberMouse 2.0 you must export your data and uninstall the current version of MemberMouse.</p>";
             $error .= "<p style='margin-top:0px; margin-bottom:5px;'>Please contact us at <a href='mailto:support@membermouse.com'>support@membermouse.com</a> for more information on upgrading to MemberMouse 2.0.</p>";
             $error .= "</div>";
             $vars = new stdClass();
             $vars->content = $error;
             echo $error;
             MM_DiagnosticLog::log(MM_DiagnosticLog::$MM_ERROR, "deactivated in MM_License::getData()");
             @deactivate_plugins(MM_PLUGIN_ABSPATH . "/index.php", false);
             exit;
         }
     } else {
         parent::invalidate();
     }
 }
Esempio n. 2
0
require_once "../../../../wp-load.php";
require_once "../includes/mm-constants.php";
require_once "../includes/init.php";
function returnStatus($status, $message)
{
    echo json_encode(array('status' => $status, 'message' => $message));
    exit(0);
}
$postdata = file_get_contents("php://input");
$request = json_decode($postdata, true);
if ($request === false || empty($request['reference_id'])) {
    MM_DiagnosticLog::log(MM_DiagnosticLog::$MM_ERROR, "Scheduler Endpoint: Invalid request received:" . print_r($postdata, true));
    returnStatus('error', 'Invalid Request');
}
$license = new MM_License("", false);
MM_MemberMouseService::getLicense($license);
if (function_exists("hash_hmac") && in_array("sha256", hash_algos())) {
    $apiKey = $license->getApiKey();
    $apiSecret = $license->getApiSecret();
    $timestamp = $request['time'];
    $remoteHash = $request['auth'];
    $contents = "{$timestamp}|{$request['reference_id']}|{$request['status']}";
    $hashKey = "{$apiKey}|{$timestamp}|{$apiSecret}";
    $hash = hash_hmac("sha256", $contents, $hashKey);
    if ($hash !== $remoteHash) {
        MM_DiagnosticLog::log(MM_DiagnosticLog::$MM_ERROR, "Scheduler Endpoint: Authentication Failed ({$hash} <> {$remoteHash})");
        returnStatus('error', 'Authentication Failed');
        exit;
    }
} else {
    MM_DiagnosticLog::log(MM_DiagnosticLog::$MM_ERROR, "System does not support sha256 hmac... proceeding to process schedules without auth");