From 217a2a2bd1dc457de433f5c97e16b67a33316531 Mon Sep 17 00:00:00 2001
From: CaMer0n <cameron@e107coders.org>
Date: Wed, 11 Nov 2009 16:02:42 +0000
Subject: [PATCH] small fixes

---
 class2.php                        |  8 ++++----
 e107_admin/plugin.php             | 10 ++++++----
 e107_files/shortcode/wmessage.php | 15 +++++++++------
 e107_handlers/event_class.php     | 17 +++++++++++------
 4 files changed, 30 insertions(+), 20 deletions(-)

diff --git a/class2.php b/class2.php
index 4fb2e7921..f7bbcba98 100644
--- a/class2.php
+++ b/class2.php
@@ -9,9 +9,9 @@
 * General purpose file
 *
 * $Source: /cvs_backup/e107_0.8/class2.php,v $
-* $Revision: 1.153 $
-* $Date: 2009-10-31 17:57:15 $
-* $Author: secretr $
+* $Revision: 1.154 $
+* $Date: 2009-11-11 16:02:36 $
+* $Author: e107coders $
 *
 */
 //
@@ -1007,7 +1007,7 @@ if ((e_QUERY == 'logout') || (($pref['user_tracking'] == 'session') && isset($_S
 	}
 
 	cookie(e_COOKIE, '', (time() - 2592000));
-	$e_event->trigger('logout');
+	e107::getEvent()->trigger('logout');
 	header('location:'.e_BASE.'index.php');
 	exit();
 }
diff --git a/e107_admin/plugin.php b/e107_admin/plugin.php
index 6aa09c84c..139ce17e7 100644
--- a/e107_admin/plugin.php
+++ b/e107_admin/plugin.php
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvs_backup/e107_0.8/e107_admin/plugin.php,v $
-|     $Revision: 1.54 $
-|     $Date: 2009-11-05 17:32:17 $
-|     $Author: secretr $
+|     $Revision: 1.55 $
+|     $Date: 2009-11-11 16:02:38 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
@@ -452,7 +452,9 @@ class pluginManager{
 
    function pluginUpgrade()
    {
-       global $plugin,$pref;
+       global $plugin,$pref,$admin_log;
+	   
+	   $sql = e107::getDb();
 	   
 	   		$emessage = eMessage::getInstance();
 
diff --git a/e107_files/shortcode/wmessage.php b/e107_files/shortcode/wmessage.php
index 21db5350c..7e6d5ca56 100644
--- a/e107_files/shortcode/wmessage.php
+++ b/e107_files/shortcode/wmessage.php
@@ -1,6 +1,6 @@
 <?php
 
-// $Id: wmessage.php,v 1.2 2009-07-09 20:51:57 e107coders Exp $
+// $Id: wmessage.php,v 1.3 2009-11-11 16:02:40 e107coders Exp $
 
 function wmessage_shortcode($parm)
 {
@@ -17,15 +17,18 @@ function wmessage_shortcode($parm)
 		$full_url = 'news.php';					// Set a default in case
 		$front_qry = '';
 		$uc_array = explode(',', USERCLASS_LIST);
-		foreach ($pref['frontpage'] as $fk => $fp)
+		if(varset($pref['frontpage']))
 		{
-			if (in_array($fk,$uc_array))
+			foreach ($pref['frontpage'] as $fk => $fp)
 			{
-				$full_url = $fp;
-				break;
+				if (in_array($fk,$uc_array))
+				{
+					$full_url = $fp;
+					break;
+				}
 			}
+			list($front_url, $front_qry) = explode('?', $full_url.'?'); // extra '?' ensure the array is filled
 		}
-		list($front_url, $front_qry) = explode('?', $full_url.'?'); // extra '?' ensure the array is filled
 	}
 
 	if (strpos($front_url, 'http') === FALSE) $front_url = SITEURL.$front_url;
diff --git a/e107_handlers/event_class.php b/e107_handlers/event_class.php
index 7c5109387..e615101ea 100644
--- a/e107_handlers/event_class.php
+++ b/e107_handlers/event_class.php
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvs_backup/e107_0.8/e107_handlers/event_class.php,v $
-|     $Revision: 1.9 $
-|     $Date: 2009-09-25 20:18:34 $
-|     $Author: secretr $
+|     $Revision: 1.10 $
+|     $Date: 2009-11-11 16:02:42 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
@@ -53,7 +53,7 @@ class e107_event
 	 * @param mixed $data
 	 * @return mixed
 	 */
-	function trigger($eventname, &$data)
+	function trigger($eventname, $data='')
 	{
 		/*if (isset($this->includes[$eventname]))
 		{
@@ -78,10 +78,12 @@ class e107_event
 				}
 				if(is_array($evt_func)) //class, method
 				{
+					$class = $evt_func[0];
+					$method = $evt_func[1];
+						
 					try
 					{
-						$class = $evt_func[0];
-						$method = $evt_func[1];
+					
 						$tmp = new $class($eventname);
 						$ret = $tmp->{$method}($data, $eventname); //let callback know what event is calling it
 						unset($tmp);
@@ -93,6 +95,9 @@ class e107_event
 					catch(Exception $e)
 					{
 						//TODO log errors $eventname, $location, $class, $method
+					//	echo "event didn't work. Class=".$class." Method=".$method;
+					//	echo "<br />".$e;
+						exit;
 					}
 				}
 				if (function_exists($evt_func))