Your IP : 216.73.217.101


Current Path : /home/antonen/poznajlitwe.lt/administrator/components/com_aimysitemap/views/crawl/
Upload File :
Current File : /home/antonen/poznajlitwe.lt/administrator/components/com_aimysitemap/views/crawl/view.html.php

<?php
/*
 * Copyright (c) 2017-2019 Aimy Extensions, Netzum Sorglos Software GmbH
 * Copyright (c) 2014-2017 Aimy Extensions, Lingua-Systems Software GmbH
 *
 * https://www.aimy-extensions.com/
 *
 * License: GNU GPLv2, see LICENSE.txt within distribution and/or
 *          https://www.aimy-extensions.com/software-license.html
 */
 defined( '_JEXEC' ) or die(); require_once( JPATH_COMPONENT . '/helpers/rights.php' ); require_once( JPATH_COMPONENT . '/helpers/message.php' ); class AimySitemapViewCrawl extends JViewLegacy { protected $allow_crawl = false; protected $allow_config = false; public function display( $tpl = null ) { $errors = $this->get( 'Errors' ); if ( is_array( $errors ) && count( $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 ) { $jdoc = JFactory::getDocument(); $jdoc->addScript( JUri::root( true ) . '/media/com_aimysitemap/crawl.js' . '?r=24.3' ); } else { $msg = new AimySitemapMessageHelper(); $msg->error( JText::_( 'JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN' ) ); } parent::display( $tpl ); } protected function addToolbar() { $bar = JToolBar::getInstance( 'toolbar' ); JToolBarHelper::title( JText::_( 'AIMY_SM_CRAWL' ), '' ); if ( $this->allow_crawl ) { JToolBarHelper::custom( 'crawl.crawl', 'tree-2', JText::_( 'AIMY_SM_CRAWL_START_DSC' ), JText::_( 'AIMY_SM_CRAWL_START_LBL' ), false ); JToolBarHelper::custom( 'crawl.abort', 'unpublish', JText::_( 'AIMY_SM_CRAWL_ABORT_DSC' ), JText::_( 'AIMY_SM_CRAWL_ABORT_LBL' ), false ); } if ( $this->allow_config ) { JToolBarHelper::preferences( 'com_aimysitemap' ); } } private function get_config( &$app, $key, $dflt = null ) { if ( version_compare( JVERSION, '3.3.0', '<' ) ) { return $app->getCfg( $key, $dflt ); } else { return $app->get( $key, $dflt ); } } }