uawdijnntqw1x1x1
IP : 216.73.216.155
Hostname : vm5018.vps.agava.net
Kernel : Linux vm5018.vps.agava.net 3.10.0-1127.8.2.vz7.151.14 #1 SMP Tue Jun 9 12:58:54 MSK 2020 x86_64
Disable Function : None :)
OS : Linux
PATH:
/
var
/
www
/
iplanru
/
data
/
.
/
mod-tmp
/
..
/
www
/
.
/
i-plan.ru
/
plugins
/
system
/
sitemap
/
sitemap.php
/
/
<?php // No direct access defined( '_JEXEC' ) or die; /** * * @package Joomla.Plugin * @subpackage System.Sitemap * @since 2.5+ * @author */ class plgSystemSitemap extends JPlugin { /** * Class Constructor * @param object $subject * @param array $config */ public function __construct( & $subject, $config ) { parent::__construct( $subject, $config ); $this->loadLanguage(); } function onAfterRender() { $db= JFactory::getDBO(); $app =JFactory::getApplication(); $doc = JFactory::getDocument(); $jinput = JFactory::getApplication()->input; //получение языка $lang=JFactory::getLanguage(); $lang=$lang->getTag(); $lang = substr($lang,0,2); if ($lang<>'ru') return false; // проверка, что мы не в административной панели if ($app->getName()!= 'site') { return true; } // получаем текст сформированной страницы $buffer = JResponse::getBody(); $server = "http://".$_SERVER['SERVER_NAME']; $thisurl = $_SERVER['REQUEST_URI']; $xml_path=$_SERVER['DOCUMENT_ROOT'].'/sitemap.xml'; $stop=array(); $stop=explode("\r\n",$this->params->get('stoplist')); //Удаление записей старше 1 года $db->setQuery( "DELETE FROM #__sitemap where date < DATE_SUB(CURRENT_DATE, INTERVAL 1 YEAR)" )->Execute(); $n=array(); preg_match_all("~".'href=\"'."(.*?)".'\"'."~is", $buffer, $n); $n=$n[1]; $n = array_unique($n); foreach($n as $link) { $status=2; $url=$link; $ulr=str_replace($server,"",$url); if (substr($url,0,7)<>"http://" and $url[0]<>'/') $url='/'.$url; $ulr=str_replace("index.php","",$url); if (stripos($url,"option=com_zoo")!==false and stripos($url,"Itemid=")==false) $status=1; foreach ($stop as $str) { if (stripos($url,$str)!==false) $status=1; } $url=str_replace(array("&","'",""",">","&;"),array("&","'",'"',">","<"),$url); $db->setQuery( "INSERT INTO #__sitemap (link,source,status,date) VALUES (\"{$url}\",\"{$thisurl}\",\"{$status}\", NOW()) ON DUPLICATE KEY UPDATE source=\"{$thisurl}\", status= \"{$status}\", date=NOW() ;" )->Execute(); } //обновление файла раз в неделю if (file_exists($xml_path)) { if (date("Y-m-d H:i:s",strtotime("+7 day", filemtime($xml_path))) > date("Y-m-d H:i:s")) return false; } $m=array(); $m[] = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; $m[] = "<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">"; $list = $db->setQuery("SELECT link, date FROM #__sitemap where status=2")->loadAssocList(); foreach ($list as $link) { $link['link']=str_replace(array("&","'",'"',">","<"),array("&","'",""",">","&;"),$link['link']); $m[] = "<url>"; $m[] = "\t<loc>{$server}{$link['link']}</loc>"; $m[] = "\t<lastmod>{$link['date']}</lastmod>"; $m[] = "\t<changefreq>weekly</changefreq>"; $m[] = "\t<priority>0.5</priority>"; $m[] = "</url>"; } $m[] = "</urlset>"; file_put_contents($xml_path, implode("\r\n",$m)); } }
/var/www/iplanru/data/./mod-tmp/../www/./i-plan.ru/plugins/system/sitemap/sitemap.php