Ejemplo n.º 1
0
 public function showNotices()
 {
     $this->checkVersion();
     // check to see if cache is being used
     $writeableDir = MM_PLUGIN_ABSPATH . "/com/membermouse/cache";
     $usingDbCache = false;
     if (class_exists("MM_Session")) {
         $usingDbCache = MM_Session::value(MM_Session::$KEY_USING_DB_CACHE);
         if (empty($usingDbCache)) {
             $usingDbCache = false;
         }
     }
     if (!isset($_GET['module']) || $_GET['module'] != MM_MODULE_REPAIR_INSTALL) {
         $cacheRepairUrl = MM_ModuleUtils::getUrl(MM_MODULE_GENERAL_SETTINGS, MM_MODULE_REPAIR_INSTALL);
         if (!file_exists($writeableDir) || is_dir($writeableDir) && !is_writeable($writeableDir)) {
             MM_Messages::addMessage("Currently MemberMouse can't utilize the cache. <a href='{$cacheRepairUrl}'>Click here to correct this.</a>");
             if (!file_exists($writeableDir)) {
                 @mkdir($writeableDir);
                 //if the cache directory is missing, attempt to create it silently if possible
             }
         } else {
             if ($usingDbCache) {
                 //this means the dbcache is in use, but the cache is now writeable, show banner and see if refresh is available
                 MM_Messages::addMessage("Currently MemberMouse can't utilize the cache. <a href='{$cacheRepairUrl}'>Click here to correct this.</a>");
                 $lastAuth = MM_OptionUtils::getOption(MM_OptionUtils::$OPTION_KEY_LAST_CODE_REFRESH);
                 $minInterval = time() - 60;
                 //(1 min)
                 if (class_exists("MM_MemberMouseService") && (empty($lastAuth) || $lastAuth <= $minInterval)) {
                     $refreshSuccess = MM_MemberMouseService::authorize();
                     MM_OptionUtils::setOption(MM_OptionUtils::$OPTION_KEY_LAST_CODE_REFRESH, time());
                 }
                 MM_Session::clear(MM_Session::$KEY_USING_DB_CACHE);
             }
         }
     }
     // check to see if this is a beta version
     if (MM_IS_BETA == true) {
         $mmVersion = self::getPluginVersion();
         $msg = "<div style='width:750px;'><em class='mm-beta'>beta</em><strong>MemberMouse {$mmVersion}</strong>";
         $msg .= "<div style='margin-left:20px; margin-top:5px; line-height:22px;'>This is a Beta version of MemberMouse.<br/>";
         $msg .= "<i class=\"fa fa-caret-right\"></i> <a href='http://membermouse.com/beta-release-notes.php?version={$mmVersion}' target='_blank'>Beta {$mmVersion} Release Notes</a><br/>";
         $msg .= "<i class=\"fa fa-caret-right\"></i> Email <a href='mailto:beta@membermouse.com'>beta@membermouse.com</a> for support or questions on the beta version</div>";
         $msg .= "</div>";
         MM_Messages::addError($msg);
     }
     // check to see if there's a new version of MM available
     if (class_exists("MM_MemberMouseService")) {
         // check if there's an upgrade available
         $crntMajorVersion = self::getPluginVersion();
         $upgradeVersion = MM_OptionUtils::getOption(MM_OptionUtils::$OPTION_KEY_UPGRADE_NOTICE);
         if (!empty($upgradeVersion)) {
             if (version_compare($upgradeVersion, $crntMajorVersion, ">") || MM_IS_BETA == true && version_compare($upgradeVersion, $crntMajorVersion, "==")) {
                 // verify that customer is on PHP 5.3+
                 if ((double) phpversion() < 5.3) {
                     $phpWarning = "<div style='width:750px;'><i class=\"fa fa-exclamation-triangle\"></i> <strong>Warning:</strong> A new version of MemberMouse is available. In order to upgrade to the latest version of MemberMouse you will need to upgrade to PHP 5.3 or higher.</div>";
                     MM_Messages::addError($phpWarning);
                 } else {
                     if (strpos($_SERVER["PHP_SELF"], "plugins.php") === false && !(isset($_GET["action"]) && $_GET["action"] == "upgrade-plugin")) {
                         MM_Messages::addMessage("<a href='https://membermouse.uservoice.com/knowledgebase/articles/319210-membermouse-versions' target='_blank'>MemberMouse {$upgradeVersion}</a> is available! <a href='plugins.php?plugin_update=membermouse&version={$upgradeVersion}'>Please update now</a>.");
                     }
                 }
             }
         }
         // check if plugin needs to be upgraded
         global $wpdb;
         $sql = "SELECT count(u.wp_user_id) as total FROM " . MM_TABLE_USER_DATA . " u, " . MM_TABLE_MEMBERSHIP_LEVELS . " m WHERE ";
         $sql .= "u.membership_level_id = m.id AND (u.status = '" . MM_Status::$ACTIVE . "' OR u.status = '" . MM_Status::$PENDING_CANCELLATION . "') ";
         $result = $wpdb->get_row($sql);
         if ($result) {
             $activeMembers = intval($result->total);
             $memberLimit = intval(MM_MemberMouseService::getMemberLimit());
             $upgradeUrl = MM_MemberMouseService::getUpgradeUrl();
             if ($memberLimit != -1 && $activeMembers > $memberLimit) {
                 MM_Messages::addMessage("MemberMouse is currently over the limit of " . number_format($memberLimit) . " members and will be deactivated within a week of going over the limit. Please <a href='{$upgradeUrl}' target='_blank'>upgrade your account</a> to avoid any service interruptions.");
             }
         }
         // check to see if in Safe Mode
         $safeMode = MM_SafeMode::getMode();
         if ($safeMode == MM_SafeMode::$MODE_ENABLED) {
             $safeModeUrl = MM_ModuleUtils::getUrl(MM_MODULE_GENERAL_SETTINGS, MM_MODULE_SAFE_MODE);
             MM_Messages::addError("<i class=\"fa fa-life-saver\"></i> MemberMouse Safe Mode is Enabled. <a href='{$safeModeUrl}'>Safe Mode Settings</a>");
         }
         //check to see if payment subsystem is in test mode or if test data is being used.
         $testPaymentSrvcEnabled = class_exists("MM_TestPaymentService") && MM_TestPaymentService::isSiteUsingTestService();
         $testDataEnabled = MM_OptionUtils::getOption(MM_OptionUtils::$OPTION_KEY_USE_CHECKOUT_FORM_TEST_DATA) == "1" ? true : false;
         if ($testPaymentSrvcEnabled || $testDataEnabled) {
             $errorMsg = "<i class=\"fa fa-flask\"></i> <strong>MemberMouse Testing Enabled</strong>";
             $errorMsg .= "<div style='margin-left:20px;'>";
             if ($testPaymentSrvcEnabled) {
                 $paymentSettingsUrl = MM_ModuleUtils::getUrl(MM_MODULE_PAYMENT_SETTINGS, MM_MODULE_PAYMENT_METHODS);
                 $errorMsg .= "<i class=\"fa fa-caret-right\"></i> Test Payment Service is enabled. ";
                 $errorMsg .= "All charges will be processed by the test payment service. ";
                 $errorMsg .= "<a href='{$paymentSettingsUrl}'>Payment Method Settings</a><br/>";
             }
             if ($testDataEnabled) {
                 $testDataSettingsUrl = MM_ModuleUtils::getUrl(MM_MODULE_PAYMENT_SETTINGS, MM_MODULE_TEST_DATA);
                 $errorMsg .= "<i class=\"fa fa-caret-right\"></i> Test Data is enabled. All checkout forms will be prepopulated with test data. <a href='{$testDataSettingsUrl}'>Test Data Settings</a>";
             }
             $errorMsg .= "</div>";
             MM_Messages::addError($errorMsg);
         }
     }
     // check PHP version
     if ((double) phpversion() < 5.3) {
         $phpWarning = "<div style='width:750px;'><i class=\"fa fa-exclamation-triangle\"></i> <strong>Warning:</strong> Your webserver is running PHP ";
         $phpWarning .= phpversion();
         $phpWarning .= ", which is an obsolete version of PHP. MemberMouse isn't compatible with versions of PHP lower than 5.3 and you will experience issues ";
         $phpWarning .= "using the MemberMouse plugin. Please contact your hosting provider and request a more recent version of PHP. ";
         $phpWarning .= "For more information, <a href='http://membermouse.uservoice.com/knowledgebase/articles/534052' target='_blank'>click here</a>.</div>";
         MM_Messages::addError($phpWarning);
     }
     // check to see if any trouble plugins are activated
     MM_Utils::getPluginWarnings();
     // get error messages
     $errors = MM_Messages::get(MM_Session::$KEY_ERRORS);
     $output = "";
     if (is_array($errors) && count($errors) > 0) {
         $output .= "<div class=\"error\">";
         foreach ($errors as $msg) {
             $output .= "<p>{$msg}</p>";
         }
         $output .= "</div>";
     }
     // get notices
     $messages = MM_Messages::get(MM_Session::$KEY_MESSAGES);
     if (is_array($messages) && count($messages) > 0) {
         $output .= "<div class=\"updated\">";
         foreach ($messages as $msg) {
             $output .= "<p>{$msg}</p>";
         }
         $output .= "</div>";
     }
     echo $output;
     MM_Messages::clear();
 }
Ejemplo n.º 2
0
<?php

/**
 * 
 * MemberMouse(TM) (http://www.membermouse.com)
 * (c) MemberMouse, LLC. All rights reserved.
 */
global $current_user;
$view = new MM_SafeModeView();
$currentMode = MM_SafeMode::getMode();
$modeList = MM_SafeMode::getModeLabels();
$modeListHtml = MM_HtmlUtils::generateSelectionsList($modeList, $currentMode);
?>
<div class="mm-wrap">
	<div style="width:750px;" class="mm-info-box blue">
		<p>3rd party software is commonly installed and run alongside the MemberMouse plugin within the WordPress environment. 
		This can include themes, plugins and custom code. Sometimes even themes and plugins that are functioning as intended can 
		interfer with MemberMouse so removing these external factors is an essential first step in diagnosing the source of 
		a problem.</p>
		
		<p>Our customer success team is here to help answer any questions you have in regards to using the MemberMouse software.
		If a 3rd party theme or plugin is causing an issue, you should contact the author of the 3rd party software for support 
		or discontinue using the offending software. For more information, please read our <a href="http://membermouse.uservoice.com/knowledgebase/articles/520776-membermouse-support-policy" target="_blank">support policy</a>.</p>
	</div>
	
	<div style="width:750px;" class="mm-info-box yellow">
    	<p>Enabling <em>Safe Mode</em> creates a "clean" environment by deactivating all plugins and switching to the default 
		WordPress theme (if available). When you disable <em>Safe Mode</em> MemberMouse will restore the plugins and theme 
		that were originally activated.</p>
		
		<p>Read this article if you'd prefer to <a href="http://membermouse.uservoice.com/knowledgebase/articles/319204-troubleshooting-plugin-and-theme-conflicts" target="_blank" style="color:#8a6d3b">deactivate your plugins and theme manually</a>.</p>