stats-fe.php
changeset 16 01c6a003d762
parent 15 5e2d1514ccd0
child 20 e2f6e3af9959
equal deleted inserted replaced
15:5e2d1514ccd0 16:01c6a003d762
   120  */
   120  */
   121 
   121 
   122 function stats_merge($data)
   122 function stats_merge($data)
   123 {
   123 {
   124   global $stats_merged_data;
   124   global $stats_merged_data;
   125   foreach ( $data['counts'] as $channel => $chaninfo )
   125   if ( isset($data['counts']) )
   126   {
   126   {
   127     if ( isset($stats_merged_data['counts'][$channel]) )
   127     foreach ( $data['counts'] as $channel => $chaninfo )
   128     {
   128     {
   129       foreach ( $stats_merged_data['counts'][$channel] as $key => &$value )
   129       if ( isset($stats_merged_data['counts'][$channel]) )
   130       {
   130       {
   131         if ( is_int($value) )
   131         foreach ( $stats_merged_data['counts'][$channel] as $key => &$value )
   132         {
   132         {
   133           $value = max($value, $chaninfo[$key]);
   133           if ( is_int($value) )
   134         }
   134           {
   135         else if ( is_array($value) )
   135             $value = max($value, $chaninfo[$key]);
   136         {
   136           }
   137           $value = array_merge($value, $chaninfo[$key]);
   137           else if ( is_array($value) )
       
   138           {
       
   139             $value = array_merge($value, $chaninfo[$key]);
       
   140           }
   138         }
   141         }
   139       }
   142       }
   140     }
   143       else
   141     else
   144       {
   142     {
   145         $stats_merged_data['counts'][$channel] = $chaninfo;
   143       $stats_merged_data['counts'][$channel] = $chaninfo;
   146       }
   144     }
   147     }
   145   }
   148   }
   146   foreach ( $data['messages'] as $channel => $chandata )
   149   foreach ( $data['messages'] as $channel => $chandata )
   147   {
   150   {
   148     if ( isset($stats_merged_data['messages'][$channel]) )
   151     if ( isset($stats_merged_data['messages'][$channel]) )