--- /Users/ken/Drupal Development/MySite/_dev/5-2/contributions/modules/mysite/mysite.module	2008-01-06 12:42:12.000000000 -0500
+++ mysite.module	2008-01-17 13:39:43.000000000 -0500
@@ -960,15 +960,22 @@ function mysite_content($uid = NULL, $ty
   $submenu = mysite_content_menu();
   $check = FALSE;
 
-  $type = arg(3);
-  if (is_string($type) && in_array($type, variable_get('mysite_content', array()))) {
-    $only = $type;
-  }
   // get the $owner of this MySite page, use as a $user surrogate
   $uid = arg(1);
   if (is_numeric($uid) && $uid > 0) {
     $owner = user_load(array('uid' => $uid));
   }
+  
+  // Make sure the $type is valid and active.
+  $type = arg(3);
+  $allowed = variable_get('mysite_content', array());
+  if ($type === $allowed[$type]) {
+    $only = $type;
+  }
+  else {
+    drupal_goto('mysite/'. $uid .'/content');
+  }
+
   // set values if we are updating the admin settings
   if ($uid == 'admin' && user_access('administer mysite')) {
     $owner->uid = 0;
@@ -1642,7 +1649,6 @@ function mysite_content_form($owner, $ed
   $style = variable_get('mysite_browser', 'table');
   // load the types options
   $types = mysite_load_includes('types', $only);
-
   if (empty($types)) {
     drupal_set_message(t('No content is available.'), 'error');
     return;
@@ -2413,7 +2419,7 @@ function mysite_settings_link($uid, $mid
  * @ingroup mysite
  */
 function mysite_check($uid, $type, $type_id, $mid = NULL) {
-  static $result;
+  static $result = array();
   $key = $uid . '-'. $type .'-'. $type_id .'-'. $mid;
   if (!isset($result[$key]->mid)) {
     if (is_null($mid)) {
@@ -2748,7 +2754,7 @@ function mysite_teaser($node, $theme = '
  * @ingroup mysite
  */
 function mysite_content_menu() {
-  static $items;
+  static $items = array();
   if (empty($items)) {
     $types = mysite_load_includes('types', NULL);
     foreach ($types as $type) {
@@ -2965,8 +2971,6 @@ function mysite_ajax_sort($url = NULL) {
  * The type of include to return (a string).  If NULL, all will be returned.
  * @param $name
  * The filename of a specific include to return (but not it's file extension).
- * @param $reset
- * A boolean flag for resetting the static variable.
  * @return
  * File results are returned according to file_scan_directory()
  * with key of 'name'.
@@ -2974,25 +2978,21 @@ function mysite_ajax_sort($url = NULL) {
  *
  * @ingroup load
  */
-function mysite_get_includes($type = NULL, $name = NULL, $reset = FALSE) {
-  static $includes = array();
+function mysite_get_includes($type = NULL, $name = NULL) {
   if (is_null($type)) {
     drupal_set_message(t('The $type was not set'), 'error');
     return;
   }
-  $key = $type .'-'. $name;
-  if (!isset($includes[$key]) || $reset) {  
-    $dir = drupal_get_path('module', 'mysite') ."/plugins/$type";
-    $mask = mysite_get_mask($type);
-    if (!is_null($name)) {
-      $mask = $name . $mask;
-    }
-    $includes[$key] = file_scan_directory($dir, $mask, $nomask = array('.', '..', 'CVS'), $callback = 0, $recurse = FALSE, $key = 'name', $min_depth = 0, $depth = 0);
+  $dir = drupal_get_path('module', 'mysite') ."/plugins/$type";
+  $mask = mysite_get_mask($type);
+  if (!is_null($name)) {
+   $mask = $name . $mask;
   }
-  if (empty($includes[$key])) {
+  $includes = file_scan_directory($dir, $mask, $nomask = array('.', '..', 'CVS'), $callback = 0, $recurse = FALSE, $key = 'name', $min_depth = 0, $depth = 0);
+  if (empty($includes)) {
     mysite_plugin_failure($type, $name);
   }
-  return $includes[$key];
+  return $includes;
 }
 
 /**
@@ -3024,8 +3024,9 @@ function mysite_load_includes($type = NU
         }
         if (!empty($get_content)) {
           foreach ($get_content as $key => $value) {
-            if (!empty($value)) {
-              if ($value != '0') {
+            if (is_null($name)) {
+              // Value may be a name string or a complex data object.
+              if (is_string($value) || is_string($value->name)) {
                 $list[$key] = $value;
               }
             }
@@ -3049,8 +3050,11 @@ function mysite_load_includes($type = NU
         include_once($path .'/'. $type .'/'. $key . $mask);
       }
     }
+    return array_keys($list);
   }
-  return array_keys($list);
+  // Error sequence
+  drupal_set_message(t('No content types are active for MySite.  Please notify the site administrator.'), 'error');
+  return array();
 }
 
 /**
@@ -3365,12 +3369,12 @@ function theme_mysite_submenu($submenu, 
   $output = '<div class="'. $div .'">';
   $output .= '<h3>'. t('Options') .'</h3>';
   $output .= '<ul>';
-  $link = t('edit');
+  $link = 'edit';
   if ($content) {
     if (!$add_only) {
       $output .= '<li>'. l(t('Organize Content'), 'mysite/'. arg(1) .'/content') .'</li>';
     }
-    $link = t('content');
+    $link = 'content';
   }
   if (!empty($submenu)) {  
     foreach ($submenu as $key => $item) {
