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); }
public function ping() { JSession::checkToken() or jexit(JText::_('INVALID TOKEN')); $rights = AimySitemapRightsHelper::getRights(); if (!$rights->get('aimysitemap.notify')) { $this->setError(JText::_('JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN')); $this->setMessage($this->getError(), 'error'); $this->setRedirect(JRoute::_('index.php?option=com_aimysitemap&view=urls', false)); return false; } return true; }
public function display($tpl = null) { if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } $rights = AimySitemapRightsHelper::getRights(); $this->allow_save = $rights->get('aimysitemap.write'); $this->allow_config = $rights->get('core.admin'); $this->read_robots_txt_default(JPATH_COMPONENT . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'default-robots.txt'); $this->read_robots_txt(JPATH_ROOT . DIRECTORY_SEPARATOR . 'robots.txt'); $this->addToolbar(); parent::display($tpl); }
public function save() { JSession::checkToken() or jexit(JText::_('INVALID TOKEN')); $rights = AimySitemapRightsHelper::getRights(); if (!$rights->get('aimysitemap.write')) { jexit(JText::_('JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN')); } require_once JPATH_COMPONENT . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'message.php'; $msg = new AimySitemapMessageHelper(); $app = JFactory::getApplication(); $txt = $app->input->getString('robotstxt', ''); $path = JPATH_ROOT . DIRECTORY_SEPARATOR . 'robots.txt'; if (JFile::write($path, $txt) === false) { $msg->error(JText::_('AIMY_SM_ROBOTSTXT_FAILED_TO_WRITE')); } else { $msg->message(JText::_('AIMY_SM_ROBOTSTXT_WRITTEN')); } $this->setRedirect(JRoute::_('index.php?option=com_aimysitemap&view=robotstxt', false)); }
public function display($tpl = null) { $this->items = $this->get('Items'); $this->state = $this->get('State'); $this->pagination = $this->get('Pagination'); if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } $rights = AimySitemapRightsHelper::getRights(); $this->allow_config = $rights->get('core.admin'); $this->allow_edit = $rights->get('core.edit'); $this->allow_write = $rights->get('aimysitemap.write'); $this->ajax_edit = AimySitemapConfigHelper::get_once('ajax_edit', true); if ($this->ajax_edit && $this->allow_edit) { JFactory::getDocument()->addScript(JURI::root() . 'administrator/components/' . 'com_aimysitemap/helpers/urls-ajax-edit.js' . '?r=3.16.0'); } $this->add_toolbar(); parent::display($tpl); }
public function display($tpl = null) { if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } $rights = AimySitemapRightsHelper::getRights(); $this->allow_notify = $rights->get('aimysitemap.notify'); $this->allow_config = $rights->get('core.admin'); if ($this->allow_notify) { JFactory::getDocument()->addScript(JUri::root() . 'administrator/components/' . 'com_aimysitemap/helpers/ping.js' . '?r=3.16.0'); $this->set_ping_cfg(); } else { require_once JPATH_COMPONENT . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'message.php'; $msg = new AimySitemapMessageHelper(); $msg->error(JText::_('JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN')); } $this->addToolbar(); parent::display($tpl); }
private function _set_bool_by_input_and_redirect($field, $state, $msg_on, $msg_off) { JSession::checkToken() or jexit(JText::_('INVALID TOKEN')); $rights = AimySitemapRightsHelper::getRights(); if (!$rights->get('core.edit')) { $this->setError(JText::_('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED')); $this->setMessage($this->getError(), 'error'); $this->setRedirect(JRoute::_('index.php?option=com_aimysitemap&view=urls', false)); return false; } require_once JPATH_COMPONENT . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'message.php'; $msg = new AimySitemapMessageHelper(); $jin = JFactory::getApplication()->input; $ids = $jin->get('cid', array(), 'ARRAY'); JArrayHelper::toInteger($ids); $model = $this->getModel('Url', 'AimySitemapModel'); $method = "set_{$field}"; if (!method_exists($model, $method)) { $this->setError(JText::_('JERROR_AN_ERROR_HAS_OCCURRED')); $this->setMessage($this->getError(), 'error'); $this->setRedirect(JRoute::_('index.php?option=com_aimysitemap&view=urls', false)); return false; } $n = 0; foreach ($ids as $id) { if ($id <= 0) { $msg->error(JText::_('JERROR_AN_ERROR_HAS_OCCURRED')); continue; } $model->{$method}($id, $state); $n++; } if ($n) { $msg->queue(sprintf($state == 1 ? $msg_on : $msg_off, count($ids))); } $this->setRedirect(JRoute::_('index.php?option=com_aimysitemap&view=urls', false)); return true; }
public function toggle_state_ajax() { JSession::checkToken() or jexit(JText::_('INVALID TOKEN')); $rights = AimySitemapRightsHelper::getRights(); if (!$rights->get('core.edit') || !AimySitemapConfigHelper::get_once('ajax_edit', true)) { jexit(JText::_('JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN')); } header('Content-Type: application/json; charset=UTF-8'); $jinput = JFactory::getApplication()->input; $id = $jinput->get('id', null, 'uint'); if (!is_null($id) && $id !== 0) { if ($this->getModel()->toggle_state($id)) { echo json_encode(array('ok' => 1)); } } JFactory::getApplication()->close(); }
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(); }