/** * Add the page title and toolbar. */ protected function addToolbar() { JFactory::getApplication()->input->set('hidemainmenu', true); $user = JFactory::getUser(); $isNew = $this->item->id == 0; if (isset($this->item->checked_out)) { $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id')); } else { $checkedOut = false; } $canDo = JhackguardHelper::getActions(); JToolBarHelper::title(JText::_('COM_JHACKGUARD_TITLE_BOTSCOUT'), 'botscout.png'); // If not checked out, can save the item. if (!$checkedOut && ($canDo->get('core.edit') || $canDo->get('core.create'))) { JToolBarHelper::apply('botscout.apply', 'JTOOLBAR_APPLY'); JToolBarHelper::save('botscout.save', 'JTOOLBAR_SAVE'); } if (!$checkedOut && $canDo->get('core.create')) { JToolBarHelper::custom('botscout.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); } // If an existing item, can save to a copy. if (!$isNew && $canDo->get('core.create')) { JToolBarHelper::custom('botscout.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); } if (empty($this->item->id)) { JToolBarHelper::cancel('botscout.cancel', 'JTOOLBAR_CANCEL'); } else { JToolBarHelper::cancel('botscout.cancel', 'JTOOLBAR_CLOSE'); } }
/** * Configure the Linkbar. */ public static function addSubmenu($vName = '') { //Process notifications. Adding this here, as it is only rendered when there is data to be rendered //i.e avoids ajax and redirect requests, which we do not want to have such notifications added to. if (file_exists(JPATH_ADMINISTRATOR . '/components/com_jhackguard/data/.rules_need_update')) { JFactory::getApplication()->enqueueMessage(JText::_('COM_JHACKGUARD_PLUGIN_RULES_CACHE_REBUILD_NEEDED') . ' <a href="' . JURI::current() . '?option=com_jhackguard&view=filtermaintenance">' . JText::_('COM_JHACKGUARD_TITLE_FILTERMAINTENANCE') . '</a>', 'warning'); } //Try to determine if an update was performed in the past 24 hours. if (file_exists(JPATH_ADMINISTRATOR . '/components/com_jhackguard/data/.rules_updated_timestamp')) { $rut = unserialize(file_get_contents(JPATH_ADMINISTRATOR . '/components/com_jhackguard/data/.rules_updated_timestamp')); if (is_array($rut) and $rut['expires'] < time()) { $rut = JhackguardHelper::checkForFilterUpdates(); } } else { $rut = JhackguardHelper::checkForFilterUpdates(); } //Determine if we shuold display an update message. if (is_array($rut)) { if ($rut['success']) { if ($rut['insert'] > 0 or $rut['update'] > 0) { JFactory::getApplication()->enqueueMessage('An update to your filters is required. The following items are available: ' . $rut['insert'] . ' new and ' . $rut['update'] . ' updates. Please navigate to <a href="' . JURI::current() . '?option=com_jhackguard&view=filtermaintenance">Filter Maintenance</a> page and click on the \'Update Rules\' button, in order to fetch the latest security filters for your Joomla.', 'warning'); } } else { JFactory::getApplication()->enqueueMessage($rut['msg'], 'error'); } } JHtmlSidebar::addEntry(JText::_('COM_JHACKGUARD_TITLE_IPFILTERS'), 'index.php?option=com_jhackguard&view=ipfilters', $vName == 'ipfilters'); JHtmlSidebar::addEntry(JText::_('COM_JHACKGUARD_TITLE_INPUTFILTERS'), 'index.php?option=com_jhackguard&view=inputfilters', $vName == 'inputfilters'); JHtmlSidebar::addEntry(JText::_('COM_JHACKGUARD_TITLE_OUTPUTFILTERS'), 'index.php?option=com_jhackguard&view=outputfilters', $vName == 'outputfilters'); JHtmlSidebar::addEntry(JText::_('COM_JHACKGUARD_TITLE_FILTERMAINTENANCE'), 'index.php?option=com_jhackguard&view=filtermaintenance', $vName == 'filtermaintenance'); JHtmlSidebar::addEntry(JText::_('COM_JHACKGUARD_TITLE_LOGS'), 'index.php?option=com_jhackguard&view=logs', $vName == 'logs'); }
/** * Add the page title and toolbar. * * @since 1.6 */ protected function addToolbar() { require_once JPATH_COMPONENT . '/helpers/jhackguard.php'; $state = $this->get('State'); $canDo = JhackguardHelper::getActions($state->get('filter.category_id')); JToolBarHelper::title(JText::_('COM_JHACKGUARD_TITLE_OUTPUTFILTERS'), 'outputfilters.png'); //Check if the form exists before showing the add/edit buttons $formPath = JPATH_COMPONENT_ADMINISTRATOR . '/views/outputfilter'; if (file_exists($formPath)) { if ($canDo->get('core.create')) { JToolBarHelper::addNew('outputfilter.add', 'JTOOLBAR_NEW'); } if ($canDo->get('core.edit') && isset($this->items[0])) { JToolBarHelper::editList('outputfilter.edit', 'JTOOLBAR_EDIT'); } } if ($canDo->get('core.edit.state')) { if (isset($this->items[0]->state)) { JToolBarHelper::divider(); JToolBarHelper::custom('outputfilters.publish', 'publish.png', 'publish_f2.png', 'JTOOLBAR_PUBLISH', true); JToolBarHelper::custom('outputfilters.unpublish', 'unpublish.png', 'unpublish_f2.png', 'JTOOLBAR_UNPUBLISH', true); } else { if (isset($this->items[0])) { //If this component does not use state then show a direct delete button as we can not trash JToolBarHelper::deleteList('', 'outputfilters.delete', 'JTOOLBAR_DELETE'); } } if (isset($this->items[0]->state)) { JToolBarHelper::divider(); JToolBarHelper::archiveList('outputfilters.archive', 'JTOOLBAR_ARCHIVE'); } if (isset($this->items[0]->checked_out)) { JToolBarHelper::custom('outputfilters.checkin', 'checkin.png', 'checkin_f2.png', 'JTOOLBAR_CHECKIN', true); } } //Show trash and delete for components that uses the state field if (isset($this->items[0]->state)) { if ($state->get('filter.state') == -2 && $canDo->get('core.delete')) { JToolBarHelper::deleteList('', 'outputfilters.delete', 'JTOOLBAR_EMPTY_TRASH'); JToolBarHelper::divider(); } else { if ($canDo->get('core.edit.state')) { JToolBarHelper::trash('outputfilters.trash', 'JTOOLBAR_TRASH'); JToolBarHelper::divider(); } } } if ($canDo->get('core.admin')) { JToolBarHelper::preferences('com_jhackguard'); } //Set sidebar action - New in 3.0 JHtmlSidebar::setAction('index.php?option=com_jhackguard&view=outputfilters'); $this->extra_sidebar = ''; JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_published', JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), "value", "text", $this->state->get('filter.state'), true)); }
public function display($tpl = null) { $this->state = $this->get('State'); // Check for errors. if (count($errors = $this->get('Errors'))) { throw new Exception(implode("\n", $errors)); } JhackguardHelper::addSubmenu('filtermaintenance'); $this->addToolbar(); $this->sidebar = JHtmlSidebar::render(); parent::display($tpl); }
/** * Add the page title and toolbar. * * @since 1.6 */ protected function addToolbar() { require_once JPATH_COMPONENT . '/helpers/jhackguard.php'; $state = $this->get('State'); $canDo = JhackguardHelper::getActions($state->get('filter.category_id')); JToolBarHelper::title(JText::_('COM_JHACKGUARD_TITLE_BOTSCOUTRECORDS'), 'botscoutrecords.png'); //Check if the form exists before showing the add/edit buttons $formPath = JPATH_COMPONENT_ADMINISTRATOR . '/views/botscout'; if (file_exists($formPath)) { if ($canDo->get('core.create')) { JToolBarHelper::addNew('botscout.add', 'JTOOLBAR_NEW'); } if ($canDo->get('core.edit') && isset($this->items[0])) { JToolBarHelper::editList('botscout.edit', 'JTOOLBAR_EDIT'); } } if ($canDo->get('core.edit.state')) { if (isset($this->items[0]->state)) { JToolBarHelper::divider(); JToolBarHelper::custom('botscoutrecords.publish', 'publish.png', 'publish_f2.png', 'JTOOLBAR_PUBLISH', true); JToolBarHelper::custom('botscoutrecords.unpublish', 'unpublish.png', 'unpublish_f2.png', 'JTOOLBAR_UNPUBLISH', true); } else { if (isset($this->items[0])) { //If this component does not use state then show a direct delete button as we can not trash JToolBarHelper::deleteList('', 'botscoutrecords.delete', 'JTOOLBAR_DELETE'); } } if (isset($this->items[0]->state)) { JToolBarHelper::divider(); JToolBarHelper::archiveList('botscoutrecords.archive', 'JTOOLBAR_ARCHIVE'); } if (isset($this->items[0]->checked_out)) { JToolBarHelper::custom('botscoutrecords.checkin', 'checkin.png', 'checkin_f2.png', 'JTOOLBAR_CHECKIN', true); } } //Show trash and delete for components that uses the state field if (isset($this->items[0]->state)) { if ($state->get('filter.state') == -2 && $canDo->get('core.delete')) { JToolBarHelper::deleteList('', 'botscoutrecords.delete', 'JTOOLBAR_EMPTY_TRASH'); JToolBarHelper::divider(); } else { if ($canDo->get('core.edit.state')) { JToolBarHelper::trash('botscoutrecords.trash', 'JTOOLBAR_TRASH'); JToolBarHelper::divider(); } } } if ($canDo->get('core.admin')) { JToolBarHelper::preferences('com_jhackguard'); } //Set sidebar action - New in 3.0 JHtmlSidebar::setAction('index.php?option=com_jhackguard&view=botscoutrecords'); $this->extra_sidebar = ''; JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_published', JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), "value", "text", $this->state->get('filter.state'), true)); //Filter for the field expires /* $this->extra_sidebar .= '<small><label for="filter_from_expires">From Expires</label></small>'; $this->extra_sidebar .= JHtml::_('calendar', $this->state->get('filter.expires.from'), 'filter_from_expires', 'filter_from_expires', '%Y-%m-%d', 'style="width:142px;" onchange="this.form.submit();"'); $this->extra_sidebar .= '<small><label for="filter_to_expires">To Expires</label></small>'; $this->extra_sidebar .= JHtml::_('calendar', $this->state->get('filter.expires.to'), 'filter_to_expires', 'filter_to_expires', '%Y-%m-%d', 'style="width:142px;" onchange="this.form.submit();"'); $this->extra_sidebar .= '<hr class="hr-condensed">'; */ }