NexusLeads Webshell
NexusLeads


Server : LiteSpeed
System : Linux server 3.10.0-1160.90.1.el7.x86_64 #1 SMP Thu May 4 15:21:22 UTC 2023 x86_64
User : alsaif ( 1057)
PHP Version : 7.4.33
Disable Function : show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Directory :  /home/alsaif/domains/alsaif.group/public_html/plugins/system/nrframework/fields/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/alsaif/domains/alsaif.group/public_html/plugins/system/nrframework/fields/geodbchecker.php
<?php

/**
 * @author          Tassos Marinos <info@tassos.gr>
 * @link            https://www.tassos.gr
 * @copyright       Copyright © 2024 Tassos All Rights Reserved
 * @license         GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
*/

// No direct access to this file
defined('_JEXEC') or die;

use Joomla\CMS\Form\FormField;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;

class JFormFieldGeoDBChecker extends FormField
{
    /**
     * Whether TGeoIP is disabled or not.
     * 
     * @var  boolean
     */
    private $tgeoip_plugin_disabled = false;
    
    protected function getLabel()
    {
        return;
    }

	/**
	 * Renders the field.
	 *
	 * @param   array   $options
	 *
	 * @return  string
	 */
	public function renderField($options = [])
	{
        // Check if TGeoIP plugin is enabled
        if (!\NRFramework\Extension::pluginIsEnabled('tgeoip'))
        {
            $this->tgeoip_plugin_disabled = true;
            return parent::renderField($options);
        }
        
        // Do not render the field if the database is up-to-date
        if (!\NRFramework\Extension::geoPluginNeedsUpdate())
        {
            return;
        }

		return parent::renderField($options);
	}

    /**
     * Shows a warning message when the Geolocation plugin is disabled.
     * 
     * @return  string
     */
    private function disabledPluginWarning()
    {
        return '<div class="alert alert-warning geo-db-checker" style="margin-top: 0; margin-bottom: 0;">' .
            '<h3 style="margin-top:0;">' . Text::sprintf('NR_GEO_PLUGIN_DISABLED') . '</h3>' .
            '<p>' . Text::sprintf('NR_GEO_PLUGIN_DISABLED_DESC', '<a href="' . Route::_('index.php?option=com_plugins&view=plugins&filter' . (defined('nrJ4') ? '[search]' : '_search') . '=System - Tassos.gr GeoIP Plugin') . '" target="_blank">', '</a>') . '</p>' .
        '</div>';
    }

    /**
     * If the geolocation database is missing or its outdated, then display a helpful message
     * to the usser notifying them that they need to update.
     *
     * @return  string
     */
    protected function getInput()
    {
        if ($this->tgeoip_plugin_disabled)
        {
            return $this->disabledPluginWarning();
        }
        
        return '<div class="alert alert-info" style="margin: 0;">' .
            '<h3 style="margin-top:0;">' . Text::sprintf('NR_GEO_MAINTENANCE') . '</h3>' .
            '<p>' . Text::sprintf('NR_GEO_MAINTENANCE_DESC') . '</p>' .
            '<a class="btn btn-success" data-toggle="modal" data-bs-toggle="modal" href="#tf-geodbchecker-modal"><span class="icon-refresh"></span> Update Database</a>' .
        '</div>';
    }
}

NexusLeads