Fixed reference to missing key "counts" in stats-fe
authorDan
Sat, 11 Oct 2008 20:31:22 -0400
changeset 16 01c6a003d762
parent 15 5e2d1514ccd0
child 17 b07b23187b17
Fixed reference to missing key "counts" in stats-fe
stats-fe.php
--- a/stats-fe.php	Sat Oct 11 20:28:32 2008 -0400
+++ b/stats-fe.php	Sat Oct 11 20:31:22 2008 -0400
@@ -122,25 +122,28 @@
 function stats_merge($data)
 {
   global $stats_merged_data;
-  foreach ( $data['counts'] as $channel => $chaninfo )
+  if ( isset($data['counts']) )
   {
-    if ( isset($stats_merged_data['counts'][$channel]) )
+    foreach ( $data['counts'] as $channel => $chaninfo )
     {
-      foreach ( $stats_merged_data['counts'][$channel] as $key => &$value )
+      if ( isset($stats_merged_data['counts'][$channel]) )
       {
-        if ( is_int($value) )
+        foreach ( $stats_merged_data['counts'][$channel] as $key => &$value )
         {
-          $value = max($value, $chaninfo[$key]);
-        }
-        else if ( is_array($value) )
-        {
-          $value = array_merge($value, $chaninfo[$key]);
+          if ( is_int($value) )
+          {
+            $value = max($value, $chaninfo[$key]);
+          }
+          else if ( is_array($value) )
+          {
+            $value = array_merge($value, $chaninfo[$key]);
+          }
         }
       }
-    }
-    else
-    {
-      $stats_merged_data['counts'][$channel] = $chaninfo;
+      else
+      {
+        $stats_merged_data['counts'][$channel] = $chaninfo;
+      }
     }
   }
   foreach ( $data['messages'] as $channel => $chandata )