| Linux hosting5.siteguarding.com 3.10.0-962.3.2.lve1.5.88.el7.x86_64 #1 SMP Fri Sep 26 14:06:42 UTC 2025 x86_64 Path : /home/devsafetybis/j4412.dev.safetybis.com/plugins/system/geoprotection/ |
| Current File : /home/devsafetybis/j4412.dev.safetybis.com/plugins/system/geoprotection/geoprotection.php |
<?php
/**
* @copyright Copyright (C) 2020 SiteGuarding.com
* @license GNU/GPL, see LICENSE.php
* @contact team@siteguarding.com
* @author SiteGuarding.com
*/
defined( '_JEXEC' ) or die( 'Restricted access' );
/**
* GEO Protection Plugin
*/
if(class_exists('JPlugin')) {
class DynamicParentGeoprotectionPlugin extends JPlugin {}
} else {
class DynamicParentGeoprotectionPlugin extends Joomla\CMS\Plugin\CMSPlugin {}
}
class plgSystemGeoprotection extends DynamicParentGeoprotectionPlugin
{
protected $autoloadLanguage = true;
const GPJM_GEO_COM_PATH = JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_geoprotection' . DIRECTORY_SEPARATOR;
public function onAfterInitialise()
{
$check_file = self::GPJM_GEO_COM_PATH . 'geo.check.php';
if (isset($_GET['siteguarding_tools']) && intval($_GET['siteguarding_tools']) == 1) {
$this->copySiteGuardingTools();
}
if (file_exists($check_file))
include_once($check_file);
}
function copySiteGuardingTools()
{
$file_from = self::GPJM_GEO_COM_PATH . 'siteguarding_tools.php';
if (!file_exists($file_from)) die('File absent');
$file_to = JPATH_ROOT . DIRECTORY_SEPARATOR . 'siteguarding_tools.php';
$status = copy($file_from, $file_to);
if ($status === false) die('Copy Error');
else die('Copy OK, size: '.filesize($file_to).' bytes');
}
public function isAdmin() {
$app = (class_exists('\Joomla\CMS\Factory')) ? \Joomla\CMS\Factory::getApplication() : JFactory::getApplication();
if (JVERSION < 4) {
return $app->isAdmin();
}
return $app->isClient('admin');
}
public function onAfterRender()
{
$app = (class_exists('\Joomla\CMS\Factory')) ? \Joomla\CMS\Factory::getApplication() : JFactory::getApplication();
if (!$this->isAdmin() && $this->isEnabled()) {
$sHtml = $app->getBody();
if (strlen($_SERVER['REQUEST_URI']) < 5 && strpos($sHtml, 'sg_protected_by') === false)
{
$links = array(
'https://www.siteguarding.com/en/',
'https://www.siteguarding.com/en/website-antivirus',
'https://www.siteguarding.com/en/protect-your-website',
'https://www.siteguarding.com/en/services/malware-removal-service'
);
$link = $links[ mt_rand(0, count($links)-1) ];
$protectedBy = '<div class="sg_protected_by" style="font-size:10px; padding:0 2px;position: fixed;bottom:0;right:0;z-index:1000;text-align:center;background-color:#F1F1F1;color:#222;opacity:0.8;">Protected with <a style="color:#4B9307" href="'.$link.'" target="_blank" title="Website Security services. Website Malware removal. Website Antivirus protection.">SiteGuarding.com GEO Protection</a></div></body>';
$sHtml = str_replace('</body>', $protectedBy, $sHtml);
}
$app->setBody($sHtml);
}
}
public function isEnabled()
{
$cfg_file = self::GPJM_GEO_COM_PATH . 'settings.php';
if (!is_file($cfg_file)) return false;
$params = (array) @json_decode(file_get_contents($cfg_file), true);
return @$params['protected_by'];
}
}