Beispiel #1
0
 /**
  * This method should be called at class load, and stores the mode, ip address, and creates a session identifier, so that these things only need to 
  * happen once within the life of the interpreter process
  */
 public static function init()
 {
     if (!self::$initialized) {
         $diagnosticMode = class_exists("MM_OptionUtils") ? MM_OptionUtils::getOption(MM_OptionUtils::$OPTION_KEY_DIAGNOSTIC_MODE) : "";
         self::$DIAGNOSTIC_MODE = empty($diagnosticMode) ? self::$MODE_OFF : $diagnosticMode;
         if (self::$DIAGNOSTIC_MODE !== self::$MODE_OFF) {
             self::$IP_ADDRESS = class_exists("MM_Utils") ? MM_Utils::getClientIPAddress() : "unknown";
             //the transaction key class logic for generating random identifiers is reused here, for convenience
             self::$SESSION = class_exists("MM_TransactionKey") ? MM_TransactionKey::createRandomIdentifier(8) : "unknown";
         }
         self::$initialized = true;
     }
 }
Beispiel #2
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();
     }
 }
Beispiel #3
0
<?php

/**
 * 
 * MemberMouse(TM) (http://www.membermouse.com)
 * (c) MemberMouse, LLC. All rights reserved.
 */
global $current_user;
$view = new MM_DiagnosticsView();
$currentMode = MM_DiagnosticLog::getMode();
$modeList = MM_DiagnosticLog::getModeLabels();
$modeListHtml = MM_HtmlUtils::generateSelectionsList($modeList, $currentMode);
// determine if this user's preference is to have the advanced search open
$showFilterOptionName = MM_OptionUtils::$OPTION_KEY_SHOW_DIAGNOSTICS_LOG_FILTERS . "-" . $current_user->ID;
$showFilterOptionValue = MM_OptionUtils::getOption($showFilterOptionName);
$showFilters = $showFilterOptionValue == "1";
?>
<div class="mm-wrap">
	<div>
		<table>
			<tr>
				<td>Current Mode:</td>
				<td><?php 
echo $modeList[$currentMode];
?>
</td>
			</tr>
			<tr>
				<td>Change mode to: </td>
				<td><select id="newMode" name="newMode">
						<?php 
Beispiel #4
0
				<tr>
					<td>Event Data</td>
					<td><input id="mm-event-data" type="text" size="25" /></td>
				</tr>
			</table>
			</td>
			
			<!-- CENTER COLUMN -->
			<td valign="top">
			<table cellspacing="5">
				<tr>
					<td>Event Types</td>
					<td>
						<select id="mm-event-types[]" size="6" multiple="multiple" style="width:300px;">
						<?php 
echo MM_HtmlUtils::generateSelectionsList(MM_DiagnosticLog::getEventTypeLabels(), $selectedEventType);
?>
						</select>
					</td>
				</tr>
			</table>
			</td>
		</tr>
	</table>
	
	<input type="button" class="mm-ui-button blue" value="Apply Filters" onclick="mmjs.search(0);">
	<input type="button" class="mm-ui-button" value="Reset Form" onclick="mmjs.resetForm();">
</div>

<script type='text/javascript'>
	jQuery(document).ready(function(){
Beispiel #5
0
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");
        }
Beispiel #6
0
 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);
     }
 }
Beispiel #7
0
    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;
}
Beispiel #8
0
                    } 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;
}