var FindNode = document.getElementsByName("types[]")[0].parentNode; FindNode.parentNode.removeChild(FindNode); var FindNode = document.getElementsByName("image_id")[0].parentNode; FindNode.parentNode.removeChild(FindNode); var FindNode = document.getElementsByName("filename")[0].parentNode; FindNode.parentNode.removeChild(FindNode); '; $template->assign_block_vars('footer_element', array('CONTENT' => $js)); } } function fstats_change_array_value_null($v) { return ($v === 'NULL' ? null : $v); } function fstats_get_history($data, $search, $types) { $criteria = array(); if (isset($search['fields']['date-after'])) { $tokens = explode('-', $search['fields']['date-after']); $criteria['start_year'] = (int)$tokens[0]; $criteria['start_month'] = (int)$tokens[1]; $criteria['start_day'] = (int)$tokens[2]; } else { $criteria['start_year'] = (int)date('Y'); $criteria['start_month'] = (int)date('n'); $criteria['start_day'] = (int)date('j'); } if (isset($search['fields']['date-before'])) { $tokens = explode('-', $search['fields']['date-before']); $criteria['end_year'] = (int)$tokens[0]; $criteria['end_month'] = (int)$tokens[1]; $criteria['end_day'] = (int)$tokens[2]; } else { $criteria['end_year'] = $criteria['start_year']; $criteria['end_month'] = $criteria['start_month']; $criteria['end_day'] = $criteria['start_day']; } if (isset($search['fields']['user']) and $search['fields']['user'] != -1) { $criteria['user_id'] = $search['fields']['user']; } $y = $criteria['start_year']; $m = 0; $d = 0; $h = 0; //echo "
 \n";
  while ($y <= $criteria['end_year'])
  {
    if (is_dir(sprintf(FSTATS_FMT_RAW_DIR_Y, $y)))
    {
      $m = (($y == $criteria['start_year']) ? $criteria['start_month'] : 1);
      $m_end = (($y == $criteria['end_year']) ? $criteria['end_month'] : 12);
      while ($m <= $m_end)
      {
        if (is_dir(sprintf(FSTATS_FMT_RAW_DIR_M, $y, $m)))
        {
          $d = ((($y == $criteria['start_year']) and ($m == $criteria['start_month'])) ? $criteria['start_day'] : 1);
          $d_end = ((($y == $criteria['end_year']) and ($m == $criteria['end_month'])) ? $criteria['end_day'] : 31);
          while ($d <= $d_end)
          {
            if (is_dir(sprintf(FSTATS_FMT_RAW_DIR_D, $y, $m, $d)))
            {
              $h = 0;
              while ($h <= 23)
              {
                $dirname = sprintf(FSTATS_FMT_RAW_DIR_H, $y, $m, $d, $h);
                if (isset($criteria['user_id']))
                {
                  $fileuser = sprintf(FSTATS_FMT_RAW_FILE, $y, $m, $d, $h, $criteria['user_id']);
                }
                if (is_dir($dirname))
                {
                  //echo $dirname." \n";
                  if ($hdir = opendir($dirname))
                  {
                    while (($file = readdir($hdir)) !== false)
                    {
                      if (
                          !is_dir($dirname.'/'.$file)
                          and $file != '.'
                          and $file != '..'
                          and $file != '.svn'
                          and (!isset($criteria['user_id']) or ($file == $fileuser))
                         )
                      {
                        $filename = $dirname.'/'.$file;
                        //echo $filename." \n";
                        $file_contents = @file_get_contents($filename);
                        if ($file_contents === false)
                        {
                          die('CANNOT LOAD '.$filename);
                        }
                        foreach (explode("\n", $file_contents) as $row)
                        {
                          if (!empty($row))
                          {
                            //echo 'r '.$row." \n";
                            //$row = array_map('fstats_change_array_value_null', unserialize($row));
                            //array_push($data, $row);
                            array_push($data, array_map('fstats_change_array_value_null', unserialize($row)));
                          }
                        }
                      }
                    }
                    closedir($hdir);
                  }
                }
                $h++;
              }
            }
            $d++;
          }
        }
        $m++;
      }
    }
    $y++;
  }
  //echo "
\n"; return $data; } add_event_handler('loc_begin_page_tail', 'fstats_remove_history_controls'); add_event_handler('get_history', 'fstats_get_history', EVENT_HANDLER_PRIORITY_NEUTRAL, 3); ?>