public function display($tpl = null) { if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } $app = JFactory::getApplication(); if ($app->isSSLConnection()) { $msg = new AimySitemapMessageHelper(); $msg->notice(JText::_('AIMY_SM_CRAWL_HINT_SSL_ONLY')); } if ($this->get_config($app, 'offline')) { $msg = new AimySitemapMessageHelper(); $msg->error(JText::_('AIMY_SM_ERR_SITE_OFFLINE')); $this->addToolbar(); return false; } if (defined('JDEBUG') && JDEBUG) { $msg = new AimySitemapMessageHelper(); $msg->notice(JText::sprintf('AIMY_SM_MSG_CRAWL_DEBUG_ENABLED', AimySitemapLogger::get_path())); } $rights = AimySitemapRightsHelper::getRights(); $this->allow_crawl = $rights->get('aimysitemap.crawl'); $this->allow_config = $rights->get('core.admin'); $this->addToolbar(); if ($this->allow_crawl) { JFactory::getDocument()->addScript(JUri::root() . 'administrator/components/' . 'com_aimysitemap/helpers/crawl.js' . '?r=3.16.0'); } else { $msg = new AimySitemapMessageHelper(); $msg->error(JText::_('JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN')); } parent::display($tpl); }
return false; } else if ( task == 'crawl.abort' ) { g_aimysitemap_abort = true; jQuery( '#toolbar-unpublish button' ).prop( 'disabled', true ); jQuery( '#toolbar-tree-2 button' ).prop( 'disabled', false ); return false; } } <?php if (defined('JDEBUG') && JDEBUG && !is_readable(AimySitemapLogger::get_path())) { ?> jQuery( '#dl_btn_cnt' ).hide(); <?php } ?> }); </script> <?php } ?> <?php
public function get_log() { JSession::checkToken('get') or jexit(JText::_('INVALID TOKEN')); $rights = AimySitemapRightsHelper::getRights(); if (!$rights->get('aimysitemap.crawl')) { jexit(JText::_('JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN')); } if (!defined('JDEBUG') or !JDEBUG) { jexit('This functionality is available in debugging mode only'); } $path = AimySitemapLogger::get_path(); if (!is_readable($path)) { throw new Exception('File not found', 404); } $fn = basename($path) . '.txt'; header('Content-Type: text/plain'); header('Content-Disposition: attachment; filename=' . $fn); readfile($path); JFactory::getApplication()->close(); }