From ca5f33655ba514325fffac8f28c57152b2053bcf Mon Sep 17 00:00:00 2001
From: Cameron <e107inc@gmail.com>
Date: Mon, 11 Dec 2017 17:11:22 -0800
Subject: [PATCH] BC Fixes for some old plugins.

---
 e107_admin/admin.php                |  3 ++-
 e107_handlers/e107_class.php        |  9 ++++-----
 e107_handlers/menu_class.php        |  7 ++++---
 e107_handlers/shortcode_handler.php |  2 +-
 e107_plugins/news/news.php          | 12 +++++++-----
 e107_plugins/pm/pm_func.php         |  8 +++++++-
 6 files changed, 25 insertions(+), 16 deletions(-)

diff --git a/e107_admin/admin.php b/e107_admin/admin.php
index f661c4698..591d69685 100644
--- a/e107_admin/admin.php
+++ b/e107_admin/admin.php
@@ -102,7 +102,8 @@ class admin_start
 			'lightbox'		=> 1.5,
 			'e107slider'	=> 0.1,
 			'forumthanks'   => 0.5,
-			'eclassifieds'   => 1.11
+			'eclassifieds'   => 1.11,
+			'jshelpers'     => '0.3b'
 
 	);
 
diff --git a/e107_handlers/e107_class.php b/e107_handlers/e107_class.php
index c79e4d93a..ff61f5f4f 100644
--- a/e107_handlers/e107_class.php
+++ b/e107_handlers/e107_class.php
@@ -4667,16 +4667,15 @@ class e107
 
 	/**
 	 * Retrieve & cache host name
-	 *
+	 * @deprecated but needed by some old plugins/menus.
+	 * @todo Find old calls and replace with code within.
 	 * @param string $ip_address
 	 * @return string host name
-	 * FIXME - moved to ipHandler - check for calls elsewhere
 	 */
-	 /*
 	public function get_host_name($ip_address)
 	{
-
-	} */
+		return self::getIPHandler()->get_host_name($ip_address);
+	}
 
 	/**
 	 * MOVED TO eHelper::parseMemorySize()
diff --git a/e107_handlers/menu_class.php b/e107_handlers/menu_class.php
index 629395e25..5ada2a048 100644
--- a/e107_handlers/menu_class.php
+++ b/e107_handlers/menu_class.php
@@ -603,9 +603,10 @@ class e_menu
 		global $sc_style, $e107_debug;
 				
 
-		$sql = e107::getDb();
-		$ns = e107::getRender();
-		$tp = e107::getParser();
+		$sql        = e107::getDb();
+		$ns         = e107::getRender();
+		$tp         = e107::getParser();
+		$e107cache  = e107::getCache(); // Often used by legacy menus.
 
 		if($tmp = e107::unserialize($parm)) // support e_menu.php e107 serialized parm.
 		{
diff --git a/e107_handlers/shortcode_handler.php b/e107_handlers/shortcode_handler.php
index 14f2583f1..47e5f9a9d 100644
--- a/e107_handlers/shortcode_handler.php
+++ b/e107_handlers/shortcode_handler.php
@@ -468,7 +468,7 @@ class e_parse_shortcode
 		}
 		else
 		{
-			e107::getDebug()->log("Couldn't Find Class '".$className."' in <b>".$path."</b>");
+			e107::getDebug()->log("File not available: <i>".$path."</i>. Couldn't Find Class '".$className."' in <b>".$path."</b>");
 		}
 
 	//	e107::getDebug()->log( "<div class='alert alert-danger'>Couldn't Load: <b>".$path."</b> with class-name:<b> {$className}</b> and pluginName <b>{$pluginName}</b></div>");
diff --git a/e107_plugins/news/news.php b/e107_plugins/news/news.php
index 6c7102ca2..d4c01d525 100644
--- a/e107_plugins/news/news.php
+++ b/e107_plugins/news/news.php
@@ -92,12 +92,12 @@ class news_front
 
 		$this->text .= $this->renderDefaultTemplate();
 
-		if(isset($this->pref['nfp_display']) && $this->pref['nfp_display'] == 2 && is_readable(e_PLUGIN."newforumposts_main/newforumposts_main.php"))
+		// BC replacement for newforumposts_main
+		if(e107::isInstalled('newforumposts_main') && !empty($this->pref['nfp_display']))
 		{
-			ob_start();
-			require_once(e_PLUGIN."newforumposts_main/newforumposts_main.php");
-			$this->text .= ob_get_contents();
-			ob_end_clean();
+			$parms = array('layout'=>'main', 'display'=>$this->pref['nfp_amount']);
+
+			$this->text .= e107::getMenu()->renderMenu('forum','newforumposts_menu', $parms, true);
 		}
 
 		$this->text .= $this->show_newsarchive();
@@ -107,6 +107,8 @@ class news_front
 	}
 
 
+
+
 	private function getRenderId()
 	{
 		$tmp = explode('/',$this->route);
diff --git a/e107_plugins/pm/pm_func.php b/e107_plugins/pm/pm_func.php
index 9ae73b594..84514b2d6 100755
--- a/e107_plugins/pm/pm_func.php
+++ b/e107_plugins/pm/pm_func.php
@@ -129,5 +129,11 @@ class pmbox_manager
 
 }
 
+// Backward compat. fix.
+function pm_getInfo($which = 'inbox')
+{
+	$pm = new pmbox_manager;
 
-?>
\ No newline at end of file
+	return $pm->pm_getInfo($which);
+
+}
\ No newline at end of file