Exemple #1
0
			<li><a href="<?php 
        echo MM_ModuleUtils::getUrl($crntPage, MM_MODULE_REPAIR_CORE_PAGES);
        ?>
"><i class="fa fa-wrench"></i> Repair Core Pages</a></li>
			<?php 
        if (isset($_GET['enable_diagnostic']) && $_GET['enable_diagnostic'] == "true") {
            ?>
			<li><a href="<?php 
            echo MM_ModuleUtils::getUrl($crntPage, MM_MODULE_DIAGNOSTICS);
            ?>
"><i class="fa fa-wrench"></i> Diagnostic Log</a></li>
			<?php 
        }
        ?>
			<?php 
        if (isLocalInstall()) {
            ?>
			<li><a href="<?php 
            echo MM_ModuleUtils::getUrl($crntPage, MM_MODULE_REPAIR_MEMBERMOUSE);
            ?>
"><i class="fa fa-wrench"></i> Repair MemberMouse (dev)</a></li>
			<?php 
        }
        ?>
		</ul>
	</li>
	<?php 
    } else {
        ?>
	<li> 
		<a href="<?php 
Exemple #2
0
/**
 * 
 * MemberMouse(TM) (http://www.membermouse.com)
 * (c) MemberMouse, LLC. All rights reserved.
 */
function isLocalInstall($specificServer = "localhost")
{
    return true;
}
define("MM_PREFIX", "mm_");
//$centralServer = (isLocalInstall("localhost") || isLocalInstall("membermouse2.localhost") || isLocalInstall("wordpress.test"))?"http://localhost/mmcentral/index.php?q=/":"http://hub.membermouse.com/index.php?q=/";
//$centralServerUrl = (isLocalInstall("localhost")  || isLocalInstall("membermouse2.localhost") || isLocalInstall("wordpress.test"))?"http://localhost/mmcentral":"http://hub.membermouse.com";
//$centralServerPrettyUrl = (isLocalInstall("localhost")  || isLocalInstall("membermouse2.localhost") || isLocalInstall("wordpress.test"))?"http://localhost/mmcentral":"http://hub.membermouse.com";
$centralServer = isLocalInstall("localhost") || isLocalInstall("membermouse2.localhost") || isLocalInstall("wordpress.test") ? "http://hub.membermouse.com/index.php?q=/" : "http://hub.membermouse.com/index.php?q=/";
$centralServerUrl = isLocalInstall("localhost") || isLocalInstall("membermouse2.localhost") || isLocalInstall("wordpress.test") ? "http://hub.membermouse.com" : "http://hub.membermouse.com";
$centralServerPrettyUrl = isLocalInstall("localhost") || isLocalInstall("membermouse2.localhost") || isLocalInstall("wordpress.test") ? "http://hub.membermouse.com" : "http://hub.membermouse.com";
$reservedGetParams = array('s' => 1, 'p' => 1, 'page_id' => 1, 'name' => 1);
define("MM_CENTRAL_SERVER_URL", $centralServerUrl);
define("MM_PRETTY_CENTRAL_SERVER_URL", $centralServerPrettyUrl);
define("MM_CENTRAL_SERVER", $centralServer);
define("MM_PLUGIN_ABSPATH", dirname(dirname(__FILE__)));
$pluginDirArray = explode(DIRECTORY_SEPARATOR, dirname(dirname(__FILE__)));
define("MM_PLUGIN_NAME", array_pop($pluginDirArray));
define("MM_LIB_DIR", MM_PLUGIN_ABSPATH . DIRECTORY_SEPARATOR . "lib");
define("MM_RESOURCES_URL", plugins_url(MM_PLUGIN_NAME . "/resources/"));
define("MM_IMAGES_URL", MM_RESOURCES_URL . "images/");
define("MM_NO_DATA", "&mdash;");
define("MM_GET_KEY", "345346539284890489234");
/** 
 * jQuery UI theme MemberMouse uses. Might want to think about 
 * making this an option at some point in the future 
Exemple #3
0
 public function configurePostMeta()
 {
     if (is_admin() && class_exists("MM_ProtectedContentView")) {
         $protectedContentView = new MM_ProtectedContentView();
         add_meta_box('membermouse_post_access', __('MemberMouse Options'), array($protectedContentView, 'postPublishingBox'), 'post', 'side', 'high');
         add_meta_box('membermouse_post_access', __('MemberMouse Options'), array($protectedContentView, 'postPublishingBox'), 'page', 'side', 'high');
         // add meta box to custom post types
         $args = array('public' => true, '_builtin' => false);
         $post_types = get_post_types($args, 'names', 'and');
         foreach ($post_types as $post_type) {
             add_meta_box('membermouse_post_access', __('MemberMouse Options'), array($protectedContentView, 'postPublishingBox'), $post_type, 'side', 'high');
         }
         $commonJSDir = "/resources/js/common/";
         $dependency = isLocalInstall() && file_exists(MM_PLUGIN_ABSPATH . "{$commonJSDir}mm-smarttag_library.js") || !file_exists(MM_PLUGIN_ABSPATH . "{$commonJSDir}mm-common-core.js") ? array('mm-smarttag_library.js') : array('mm-common-core.js');
         $version = self::getPluginVersion();
         //use plugin major version to control caching
         wp_enqueue_script('membermouse-postmeta', plugins_url('resources/js/admin/mm-accessrights.js', __FILE__), $dependency, $version);
         wp_enqueue_script('membermouse-corepages', plugins_url('resources/js/admin/mm-corepages.js', __FILE__), $dependency, $version);
     }
 }
Exemple #4
0
 public static function getClientIPAddress()
 {
     if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
         $ip = $_SERVER['HTTP_CLIENT_IP'];
     } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
         $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
     } else {
         $ip = $_SERVER['REMOTE_ADDR'];
     }
     //don't use ipv6 for local installs
     if (preg_match("/::/", $ip) && isLocalInstall()) {
         $ip = "127.0.0.1";
     }
     return $ip;
 }
Exemple #5
0
 public static function load($className, $canRecurse = true)
 {
     if (!$canRecurse) {
         LogMe::write("Missing {$className} from cache");
         showLoadedClasses($className, "Eval Missing {$className} from cache");
     }
     /** only try to load MemberMouse classes **/
     if (strpos($className, "MM_") !== 0 && !preg_match("/LogMe/", $className)) {
         return false;
     }
     $exclusions = array("MemberMouse");
     if (in_array($className, $exclusions)) {
         return false;
     }
     /** end exclusions **/
     $classFileName = str_replace("MM_", "", $className);
     if (self::includeLimitedLocalFiles($className, $classFileName)) {
         return true;
     }
     $forceUseDBCache = MM_OptionUtils::getOption(MM_OptionUtils::$OPTION_KEY_FORCE_USE_DB_CACHE) == "1" ? true : false;
     if (isLocalInstall("localhost") && !$forceUseDBCache) {
         // look locally
         if (self::includeLocalFiles($className, $classFileName)) {
             return true;
         }
         if (class_exists($className, false) || interface_exists($className, false)) {
             return true;
         } else {
             if (self::includeCacheFiles($className, $classFileName)) {
                 return true;
             }
             /// get db class
             if (self::includeDBClass($className, $classFileName)) {
                 if ($classFileName != "MemberMouseService") {
                     MM_Session::value(MM_Session::$KEY_USING_DB_CACHE, true);
                 }
                 return true;
             }
         }
     } else {
         if (class_exists($className, false) || interface_exists($className, false)) {
             return true;
         } else {
             if (self::includeCacheFiles($className, $classFileName)) {
                 return true;
             }
             // get class from DB
             if (self::includeDBClass($className, $classFileName)) {
                 if ($classFileName != "MemberMouseService") {
                     MM_Session::value(MM_Session::$KEY_USING_DB_CACHE, true);
                 }
                 return true;
             }
         }
         // look locally
         if (self::includeLocalFiles($className, $classFileName)) {
             return true;
         }
     }
     //if execution gets here, then a needed class is unloadable, meaning its not in the cache or in the dbcache
     //reauth if we haven't already done so in the last 10 mins, and attempt to populate both
     $lastAuth = MM_OptionUtils::getOption(MM_OptionUtils::$OPTION_KEY_LAST_CODE_REFRESH);
     $minInterval = time() - 600;
     //(600 secs = 10 min)
     if ($canRecurse && class_exists("MM_MemberMouseService") && (empty($lastAuth) || $lastAuth <= $minInterval)) {
         $authSuccess = MM_MemberMouseService::authorize();
         MM_OptionUtils::setOption(MM_OptionUtils::$OPTION_KEY_LAST_CODE_REFRESH, time());
         if ($authSuccess) {
             return MM_ClassLoader::load($className, false);
             //this will break if the session doesnt work.. but then you have bigger problems...
         }
     }
     return false;
 }