/**
  * Returns array with tabular data. 
  */
 function getTables()
 {
     $actual = $this->read($this->_logRecord);
     $current = $this->readCurrentState($this->_filesystemState);
     $keys = array_keys($actual);
     $data = array();
     foreach ($keys as $k) {
         $row = array();
         $row[] = '<b>' . $this->_decorateWord($k) . '</b>';
         if ($k == 'size') {
             if (!empty($actual[$k])) {
                 $actual[$k] = JD_Log_Helper::formatSize($actual[$k]);
             }
             if (!empty($current[$k])) {
                 $current[$k] = JD_Log_Helper::formatSize($current[$k]);
             }
         } elseif (in_array($k, array('ctime', 'mtime'))) {
             if (!empty($actual[$k])) {
                 $actual[$k] = JD_Log_Helper::formatDate($actual[$k]);
             }
             if (!empty($current[$k])) {
                 $current[$k] = JD_Log_Helper::formatDate($current[$k]);
             }
         }
         if (empty($actual[$k])) {
             $row[] = '&nbsp;';
         } else {
             $row[] = $actual[$k];
         }
         if (empty($current[$k])) {
             if ($current) {
                 $row[] = '&nbsp;';
             }
         } else {
             $row[] = $current[$k];
         }
         $data[] = $row;
     }
     if (count($data)) {
         $toAdd = array('&nbsp;', '<b>' . JText::_('Current') . '</b>');
         if (!empty($this->_filesystemState)) {
             $toAdd[] = '<b>' . JText::_('Last Scan') . '</b>';
         }
         array_unshift($data, $toAdd);
     }
     unset($this->_logRecord->url);
     //		unset($this->_logRecord->status);
     return array($data);
 }
Exemplo n.º 2
0
 function showLogGroups()
 {
     global $mainframe, $option;
     JToolBarHelper::title(JText::_('The log'), 'log');
     JToolBarHelper::editList('showLog', JText::_('Show log'));
     JToolBarHelper::deleteList(JText::_('Are you sure?'), 'removeGroup');
     $filter_order = $mainframe->getUserStateFromRequest($option . '.log_group.filter_order', 'filter_order', 'type');
     $filter_order_Dir = $mainframe->getUserStateFromRequest($option . '.log_group.filter_order_Dir', 'filter_order_Dir', '');
     $lists['order_Dir'] = $filter_order_Dir;
     $lists['order'] = $filter_order;
     $model =& $this->getModel();
     $logGroups =& $model->getLogGroups();
     $logTotalGroups = $model->getTotalLogGroups();
     $uri =& JURI::getInstance();
     $url = $uri->toString();
     if (!$logTotalGroups) {
         JError::raiseNotice(123, JText::_('Logs are empty'));
     }
     // Preformat the log groups
     for ($i = 0, $c = count($logGroups); $i < $c; $i++) {
         // The controls for log groups
         $logGroups[$i]->id = $logGroups[$i]->type;
         $logGroups[$i]->editLink = JRoute::_('index.php?option=com_jdefender&controller=log&task=showLog&cid[]=' . $logGroups[$i]->type);
         $this->_decorateLogGroup($logGroups[$i]);
         $logGroups[$i]->ctime = JD_Log_Helper::formatDate($logGroups[$i]->ctime);
     }
     JHTML::_('behavior.modal');
     JHTML::_('behavior.tooltip');
     JD_Admin_Menu_Helper::decorate();
     $this->assignRef('items', $logGroups);
     $this->assignRef('total', $logTotalGroups);
     $this->assignRef('lists', $lists);
     parent::display();
 }