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(); } }
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"); } $eventId = $request['reference_id']; $eventType = $wpdb->get_var("SELECT event_type from " . MM_TABLE_SCHEDULED_EVENTS . " where id='{$eventId}'"); switch ($eventType) { case MM_ScheduledEvent::$PAYMENT_SERVICE_EVENT: $paymentEvent = new MM_ScheduledPaymentEvent($eventId); $billingStatus = $request['status']; $paymentEvent->setBillingStatus($billingStatus); if ($paymentEvent->getStatus() == MM_ScheduledEvent::$EVENT_PROCESSED) { returnStatus("ok", "Event {$eventId} already processed"); } $paymentService = MM_PaymentServiceFactory::getPaymentServiceById($paymentEvent->getPaymentServiceId()); if (is_null($paymentService)) { returnStatus("error", "Improper event configuration: Payment service with id {$paymentService->getPaymentServiceId()} not found"); }
exit; } try { $request = $_GET + $_POST; if (!isset($request['cmd']) || !isset($request['provider'])) { //script called incorrectly throw new Exception("Social login authenticator called incorrectly", "1001003"); } $providerToken = ucfirst(strtolower(htmlentities($request['provider']))); //hybridauth requires providers be all lowercase with the first letter capitalized $provider = MM_ExtensionsFactory::getExtension($providerToken); if (is_null($provider) || !$provider instanceof MM_AbstractSocialLoginExtension || !$provider->isActive()) { //can't access requested provider throw new Exception("Requested Social Login Provider not found", "1001004"); } if ($request['cmd'] == "login") { processLogin($request, $provider); exit; } else { if ($request['cmd'] == "signup") { processSignup($request, $provider); exit; } } } catch (Exception $e) { //redirect to error page $url = MM_CorePageEngine::getUrl(MM_CorePageType::$ERROR, MM_Error::$ACCESS_DENIED) . "&slcode={$e->getCode()}"; MM_DiagnosticLog::log(MM_DiagnosticLog::$MM_ERROR, "Exception encountered in social login: Code={$e->getCode()}, Message={$e->getMessage()}"); wp_redirect($url); exit; }
public function activationFailed() { if (isset($_GET[MM_Session::$PARAM_COMMAND_DEACTIVATE]) && isset($_GET[MM_Session::$PARAM_MESSAGE_KEY])) { echo "<div class='updated'>"; echo "<p>" . urldecode($_GET[MM_Session::$PARAM_MESSAGE_KEY]) . "</p>"; echo "</div>"; MM_DiagnosticLog::log(MM_DiagnosticLog::$MM_ERROR, "plugin deactivated from index::activationFailed()"); @deactivate_plugins(MM_PLUGIN_ABSPATH . "/index.php", false); } }
} else { if ($response->status == "partial_error" && is_array($response->message)) { $errorIdArray = array(); foreach ($response->message as $errorId) { //this next should perform the same escaping as mysql_real_escape_string, without relying on the open link $errorIdArray[] = $wpdb->prepare("%s", $errorId); } $errorIdString = implode(",", $errorIdArray); $wpdb->query("DELETE FROM {$queTable} WHERE (batch_id='{$batchIdentifier}') AND (event_id NOT IN ({$errorIdString}))"); } else { if ($response->status == "error") { //entire batch errored, do not remove any of them from the que table (ie. do nothing) } } } } } } else { $error = "Scheduler sync: Local database error encountered while synchronizing with scheduler" . !empty($wpdb->last_error) ? ":{$wpdb->last_error}" : ""; throw new Exception($error); } //check to see if there are any more events left $expiredBatchTime = gmdate("Y-m-d H:i:s", strtotime("-{$maxExecutionTime} seconds", time())); $remainingEvents = $wpdb->get_var("SELECT EXISTS (SELECT * FROM {$queTable} WHERE (batch_id IS NULL) OR ((batch_id != '{$batchIdentifier}') AND (batch_started < '{$expiredBatchTime}')))"); $queueEmpty = is_null($remainingEvents) || $remainingEvents == "0"; } while (!$queueEmpty); MM_DiagnosticLog::log(MM_DiagnosticLog::$MM_SUCCESS, "Completed Scheduled Event Queue Synchronization at " . gmdate("Y-m-d H:i:s", time())); } catch (Exception $e) { MM_DiagnosticLog::log(MM_DiagnosticLog::$MM_ERROR, $e->getMessage()); exit; }