Ejemplo n.º 1
0
 public function deployRelease($rest)
 {
     $post = $rest->getRequest()->getPost();
     MM_LogApi::logRequest(json_encode($post), "/deployRelease");
     if (!isset($post["version"])) {
         return new Response($rest, "Major version number is required", RESPONSE_ERROR_MESSAGE_MISSING_PARAMS . " : version", RESPONSE_ERROR_CODE_MISSING_PARAMS, RESPONSE_ERROR_MESSAGE_MISSING_PARAMS);
     }
     $majorVersion = $post["version"];
     $minorVersion = isset($post["minor_version"]) ? $post["minor_version"] : MM_MemberMouseService::$DEFAULT_MINOR_VERSION;
     $crntVersion = MemberMouse::getPluginVersion();
     if ($crntVersion != $majorVersion) {
         MM_OptionUtils::setOption(MM_OptionUtils::$OPTION_KEY_UPGRADE_NOTICE, $majorVersion);
         return new Response($rest, "Major version do not match. A notification will be displayed to the customer informing them an update is available.", "Major version do not match. A notification will be displayed to the customer informing them an update is available.", RESPONSE_ERROR_CODE_BAD_REQUEST, RESPONSE_ERROR_MESSAGE_MISSING_PARAMS);
     }
     // if major versions match, update cache with the latest files from central
     $writeableDir = MM_Utils::getCacheDir();
     // delete existing cache
     if (is_dir($writeableDir)) {
         if (is_writeable($writeableDir)) {
             if ($handle = opendir($writeableDir)) {
                 while (false !== ($file = readdir($handle))) {
                     if (!is_dir($file)) {
                         @unlink($writeableDir . "/" . $file);
                     }
                 }
                 closedir($handle);
             }
         }
     }
     // get updated classes from central
     MM_OptionUtils::setOption(MM_OptionUtils::$OPTION_KEY_MINOR_VERSION, $minorVersion);
     $ret = MM_MemberMouseService::authorize(true);
     if (MM_Response::isError($ret)) {
         return new Response($rest, "Could not find classes associated with version {$majorVersion}.{$minorVersion}", "Invalid major/minor version combination", RESPONSE_ERROR_CODE_BAD_REQUEST, RESPONSE_ERROR_MESSAGE_MISSING_PARAMS);
     }
     if (defined("DB_NAME")) {
         global $wpdb;
         if (file_exists($writeableDir . "/membermouse_schema.sql")) {
             $phpObj = new MM_PhpObj($wpdb, DB_NAME);
             if (!$phpObj->importFile($writeableDir . "/membermouse_schema.sql", true)) {
                 return new Response($rest, "Could not update MemberMouse database", "Could not update MemberMouse database", RESPONSE_ERROR_CODE_BAD_REQUEST, RESPONSE_ERROR_MESSAGE_MISSING_PARAMS);
             }
         }
     } else {
         return new Response($rest, "DB_NAME not defined", "DB_NAME not defined", RESPONSE_ERROR_CODE_BAD_REQUEST, RESPONSE_ERROR_MESSAGE_MISSING_PARAMS);
     }
     $version = $majorVersion;
     if (!empty($minorVersion)) {
         $version .= "-" . $minorVersion;
     }
     $versionRelease = MM_VersionRelease::findByVersion($version);
     $versionRelease->setVersion($version);
     $versionRelease->commitData();
     return new Response($rest);
 }
Ejemplo n.º 2
0
 public static function getPluginWarnings()
 {
     $problemPlugins = array();
     $problemPlugins["W3 Total Cache"] = "w3-total-cache/w3-total-cache.php";
     $problemPlugins["WP Super Cache"] = "wp-super-cache/wp-cache.php";
     $plugins = get_option('active_plugins');
     foreach ($problemPlugins as $name => $location) {
         if (in_array($location, $plugins)) {
             if (!MM_Messages::isMessageHidden($location)) {
                 $hideWarningUrl = MM_Messages::getHideMessageUrl(self::constructPageUrl(), $location);
                 MM_Messages::addError("<i class=\"fa fa-exclamation-triangle\"></i> <strong>MemberMouse Warning</strong>: The <em>{$name}</em> plugin is known to cause issues with MemberMouse. <a href='https://membermouse.uservoice.com/knowledgebase/articles/319203-plugins-that-cause-problems' target='_blank'>Learn more</a> | <a href='{$hideWarningUrl}'>Hide this warning</a>");
             }
         }
     }
     // check if client is using Visual Composer
     $visualComposerPlugin = "js_composer/js_composer.php";
     if (in_array($visualComposerPlugin, $plugins)) {
         if (!MM_Messages::isMessageHidden($visualComposerPlugin)) {
             $hideWarningUrl = MM_Messages::getHideMessageUrl(self::constructPageUrl(), $visualComposerPlugin);
             $visualEditorMsg = "<p><i class=\"fa fa-exclamation-triangle\"></i> <strong>MemberMouse Warning: Visual Composer</strong></p>";
             $visualEditorMsg .= "<div style=\"margin-left:20px;\"><i class=\"fa fa-caret-right\"></i> ";
             $visualEditorMsg .= "You're using Visual Composer. To avoid issues make sure to follow the instructions in this article when <a href='http://membermouse.uservoice.com/knowledgebase/articles/792249' target='_blank'>using SmartTags</a> | <a href='{$hideWarningUrl}'>Hide this warning</a>";
             $visualEditorMsg .= "</div>";
             MM_Messages::addError($visualEditorMsg);
         }
     }
     // check if client is using WP Engine
     if (class_exists("WPE_API", false) || defined("WPE_APIKEY") || defined("WPE_ISP")) {
         if (!MM_Messages::isMessageHidden("wp-engine-warning")) {
             $hideWarningUrl = MM_Messages::getHideMessageUrl(self::constructPageUrl(), "wp-engine-warning");
             MM_Messages::addError("<i class=\"fa fa-exclamation-triangle\"></i> <strong>MemberMouse Warning</strong>: You're using WP Engine. Follow the instructions in this article to <a href='http://membermouse.uservoice.com/knowledgebase/articles/356866-configuring-wp-engine-hosting' target='_blank'>work with WP Engine to ensure your server is configured to allow MemberMouse to run properly</a>. | <a href='{$hideWarningUrl}'>Hide this warning</a>");
         }
     }
     // TODO this code can be removed after no active license is on a version less than 2.2.4
     $captchaSiteKey = MM_OptionUtils::getOption(MM_OptionUtils::$OPTION_KEY_CAPTCHA_KEY);
     $captchaPrivateKey = MM_OptionUtils::getOption(MM_OptionUtils::$OPTION_KEY_CAPTCHA_PRIVATE_KEY);
     $mmVersion = MemberMouse::getPluginVersion();
     // check if client is using recaptcha and on version 2.2.4 of MM
     if ($mmVersion == "2.2.4" && !empty($captchaSiteKey) && !empty($captchaPrivateKey)) {
         if (!MM_Messages::isMessageHidden("recaptcha-upgrade-warning")) {
             $hideWarningUrl = MM_Messages::getHideMessageUrl(self::constructPageUrl(), "recaptcha-upgrade-warning");
             MM_Messages::addError("<div style='width:750px;'><i class=\"fa fa-exclamation-triangle\"></i> <strong>MemberMouse Warning</strong>: It appears that you're currently using reCaptcha. In this version of MemberMouse reCaptcha has been upgraded and your <strong>action is required</strong> to ensure your checkout process continues to function correctly. <a href='http://membermouse.uservoice.com/knowledgebase/articles/718512#recaptcha-upgrade' target='_blank'>Watch this video for details</a>. | <a href='{$hideWarningUrl}'>Hide this warning</a></div>");
         }
     }
 }
Ejemplo n.º 3
0
<?php

/**
 *
 * MemberMouse(TM) (http://www.membermouse.com)
 * (c) MemberMouse, LLC. All rights reserved.
 */
$view = new MM_ActivityLogView();
$module = MM_ModuleUtils::getModule();
$isMemberDetailsArea = $module == MM_MODULE_MEMBER_DETAILS_ACTIVITY_LOG ? true : false;
if ($isMemberDetailsArea) {
    // include activity log JS
    $activityLogJS = plugins_url("../resources/js/admin/mm-" . MM_MODULE_ACTIVITY_LOG . ".js", __FILE__);
    wp_enqueue_script(basename($activityLogJS), $activityLogJS, array('membermouse-global'), MemberMouse::getPluginVersion());
    if (isset($_REQUEST[MM_Session::$PARAM_USER_ID])) {
        $_REQUEST["member_id"] = $_REQUEST[MM_Session::$PARAM_USER_ID];
    }
}
$eventsList = array_merge(array("" => "All"), MM_ActivityLog::getEventsList());
$eventTypeValue = "";
if (!empty($_REQUEST["event_type"])) {
    $eventTypeValue = $_REQUEST["event_type"];
}
$eventOptions = MM_HtmlUtils::generateSelectionsList($eventsList, $eventTypeValue);
$memberIdValue = "";
if (!empty($_REQUEST["member_id"])) {
    $memberIdValue = $_REQUEST["member_id"];
}
$fromDateValue = "";
if (!empty($_REQUEST["from_date"])) {
    $fromDateValue = $_REQUEST["from_date"];
Ejemplo n.º 4
0
 public function activate()
 {
     global $wpdb;
     ob_start();
     $error = "";
     if ($this->createDBCache()) {
         if ($this->updateMemberMouseClass()) {
             // reset minor version if this is a major version upgrade
             $crntMajorVersion = MemberMouse::getPluginVersion();
             $lastMajorVersion = MM_OptionUtils::getOption(MM_OptionUtils::$OPTION_KEY_MAJOR_VERSION);
             if (!empty($lastMajorVersion) && version_compare($lastMajorVersion, $crntMajorVersion) < 0) {
                 MM_OptionUtils::setOption(MM_OptionUtils::$OPTION_KEY_MINOR_VERSION, MM_MemberMouseService::$DEFAULT_MINOR_VERSION);
             }
             if ($this->authenticateWithMM() !== false) {
                 if ($this->alterMMTables()) {
                     $this->temporaryRestoreOrderItemAccessPatch();
                     $this->temporaryPendingOverdueSubscriptionPatch();
                     $this->populateOriginAffiliateIds();
                     if ($this->insertMMDefaultData()) {
                         // set new major version
                         $crntMajorVersion = MemberMouse::getPluginVersion();
                         MM_OptionUtils::setOption(MM_OptionUtils::$OPTION_KEY_MAJOR_VERSION, $crntMajorVersion);
                         //update version history
                         $versionDescription = $crntMajorVersion;
                         $minorVersion = MM_OptionUtils::getOption(MM_OptionUtils::$OPTION_KEY_MINOR_VERSION);
                         if ($minorVersion !== false && intval($minorVersion) > 0) {
                             $versionDescription .= "-" . $minorVersion;
                         } else {
                             $versionDescription .= "-" . MM_MemberMouseService::$DEFAULT_MINOR_VERSION;
                         }
                         $versionRelease = MM_VersionRelease::findByVersion($versionDescription);
                         $versionRelease->setVersion($versionDescription);
                         $versionRelease->commitData();
                         MM_MemberMouseService::activatePlugin();
                         // clear major version notice
                         $crntMajorVersion = MemberMouse::getPluginVersion();
                         $upgradeVersion = MM_OptionUtils::setOption(MM_OptionUtils::$OPTION_KEY_UPGRADE_NOTICE);
                         if (!empty($upgradeVersion) && version_compare($crntMajorVersion, $upgradeVersion, ">=")) {
                             MM_OptionUtils::setOption(MM_OptionUtils::$OPTION_KEY_UPGRADE_NOTICE, "");
                         }
                         ob_end_clean();
                         return true;
                     } else {
                         $error = "Could not install default data.";
                     }
                 } else {
                     $error = "Could not alter MemberMouse tables.";
                 }
             } else {
                 $error = "<div style='font-family: sans-serif; font-size: 13px;'>";
                 $error .= "<h3 style='color:#BC0B0B; margin-top:0px; margin-bottom:5px; font-size: 14px;'>This site is not authorized to use the MemberMouse plugin</h3>";
                 $error .= "<p style='margin-top:0px; margin-bottom:5px;'>In order to use the MemberMouse plugin you need to <a href=\"https://membermouse.uservoice.com/knowledgebase/articles/319186-installing-membermouse\" target=\\_blank\">register your site with membermouse.com</a>.</p>";
                 $error .= "</div>";
             }
         } else {
             $error = "Could not insert MM_MemberMouseService into DB cache";
         }
     } else {
         $error = "Could not create DB cache";
     }
     ob_end_clean();
     // an error occurred so deactivate the plugin
     $this->showError($error);
     exit;
 }
Ejemplo n.º 5
0
        ?>
</p>  
					    <p class="news-body"><?php 
        echo substr(esc_html($item->get_description()), 0, 200);
        ?>
</p>
    			<?php 
    }
}
?>
  
	   				</div>
	   				<!--/.mm-academy-feed-->
   				</div>
   				<!--/.mm-content-container-->
   			</div>
   			<!--/.mm-content-wrapper-->
   	
   	<?php 
$minorVersion = MM_OptionUtils::getOption(MM_OptionUtils::$OPTION_KEY_MINOR_VERSION);
if (empty($minorVersion)) {
    $minorVersion = MM_MemberMouseService::$DEFAULT_MINOR_VERSION;
}
?>
   	<div class="mm-version">MemberMouse Version <span><?php 
echo MemberMouse::getPluginVersion() . "-" . $minorVersion;
?>
</span></div>
   		
</div>
<!--/.mm-view-container-->