403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /home/bitrix/ext_www/cvetdv.ru/bitrix/modules/zverushki.seofilter/lib/sitemap/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/cvetdv.ru/bitrix/modules/zverushki.seofilter/lib/sitemap/xml.php
<?
namespace Zverushki\Seofilter\Sitemap;

use Zverushki\Seofilter\configuration;
/**
 *
 */
class Xml extends Generate
{
	private $xml = '';

	public function getFile()
	{
		$this->xml = '';
		if($this->get()){
			$arr = array(
				"maintag" => "urlset",
				"inctag" => "url",
				"keys" => "_files",
				"list" => $this->arSettings
			);
			$this->xml = $this->getXml($arr);
		}


		return $this->xml;
	}

	private function getXml($arr){
		$xml = '<?xml version="1.0" encoding="UTF-8"?><'.$arr["maintag"].' xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
			foreach ($arr["list"] as $val):
				$urls = explode("?", $val["URL_CPU"]);
				$xml .= '<'.$arr["inctag"].'>
							    <loc>'.$this->serverName.$urls[0].'</loc>
							    <lastmod>'.date("c", $val["LASTMOD"]->getTimestamp()).'</lastmod>
							  </'.$arr["inctag"].'>';
			endforeach;
		$xml .= '</'.$arr["maintag"].'>';

		return $xml;
	}
	public function save($nameXml){
		if(empty($this->siteId))
			return;

		$nameXml = str_replace('//', '/', $nameXml);
		$file = fopen($this->documentRoot.$nameXml, "w+");
		$echo = fwrite($file, $this->xml);
		fclose($file);


		return array("DETAIL_PAGE_URL" => $nameXml, "LASTMOD" => time());
	}

	public function changeMain($urlXml){
		$notIntegrate = configuration::getOption('integrate_notactive', $this->siteId) == 'Y';
		if($notIntegrate)
			return;

		$filename = trim($this->documentRoot.$this->siteMapUrl);
		$xml = simplexml_load_file($filename);
		$array = json_decode(json_encode($xml), true);

		if($array && empty($array['sitemap'][0])){
			$tmp = $array['sitemap'];
			unset($array['sitemap']);
			$array['sitemap'][] = $tmp;
		}

		$infile = false;
		foreach ($array['sitemap'] as $key => &$sitemap) {
			if($sitemap['loc'] == $this->serverName.$urlXml['DETAIL_PAGE_URL']){
				$sitemap['lastmod'] = date("c", $urlXml['LASTMOD']);
				$infile = true;
				break;
			}
		}
		if(!$infile)
			$array['sitemap'][] = array('loc' => $this->serverName.$urlXml['DETAIL_PAGE_URL'], 'lastmod' => date("c", $urlXml['LASTMOD']));


		$xml = '<?xml version="1.0" encoding="UTF-8"?><sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
			foreach ($array['sitemap'] as $smap):
				$xml .= '<sitemap><loc>'.$smap['loc'].'</loc>'.($smap['lastmod'] ? '<lastmod>'.$smap['lastmod'].'</lastmod>' : '').'</sitemap>';
			endforeach;
		$xml .= '</sitemapindex>';

		$file = fopen($filename, "w+");
		if(!$file)
			return;
		$echo = fwrite($file, $xml);
		fclose($file);
	}

}
?>

Youez - 2016 - github.com/yon3zu
LinuXploit