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/components/bitrix/catalog.import.1c/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/cvetdv.ru/bitrix/components/bitrix/catalog.import.1c/class.php
<?
if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true) die();

class CBitrixCatalogImport1C extends CBitrixComponent
{
	const XML_TREE_TABLE_NAME = 'b_xml_tree_import_1c';

	public function checkDatabaseServerTime($secondsDrift = 600)
	{
		global $DB;

		CTimeZone::Disable();
		$sql = "select ".$DB->DateFormatToDB("YYYY-MM-DD HH:MI:SS", $DB->GetNowFunction())." DB_TIME from b_user";
		$query = $DB->Query($DB->TopSql($sql, 1));
		$record = $query->Fetch();
		CTimeZone::Enable();

		$dbTime = $record? MakeTimeStamp($record["DB_TIME"], "YYYY-MM-DD HH:MI:SS"): 0;
		$webTime = time();

		if ($dbTime)
		{
			if ($dbTime > ($webTime + $secondsDrift))
				return false;
			elseif ($dbTime < ($webTime - $secondsDrift))
				return false;
			else
				return true;
		}

		return true;
	}

	public function cleanUpDirectory($directoryName)
	{
		//Cleanup previous import files
		$directory = new \Bitrix\Main\IO\Directory($directoryName);
		if ($directory->isExists())
		{
			if (defined("BX_CATALOG_IMPORT_1C_PRESERVE"))
			{
				$i = 0;
				while (\Bitrix\Main\IO\Directory::isDirectoryExists($directory->getPath().$i))
				{
					$i++;
				}
				$directory->rename($directory->getPath().$i);
			}
			else
			{
				foreach ($directory->getChildren() as $directoryEntry)
				{
					$match = array();
					if ($directoryEntry->isDirectory() && $directoryEntry->getName() === "Reports")
					{
						$emptyDirectory = true;
						$reportsDirectory = new \Bitrix\Main\IO\Directory($directoryEntry->getPath());
						foreach ($reportsDirectory->getChildren() as $reportsEntry)
						{
							$match = array();
							if (preg_match("/(\\d\\d\\d\\d-\\d\\d-\\d\\d)\\./", $reportsEntry->getName(), $match))
							{
								if (
									$match[1] >= date("Y-m-d", time()-5*24*3600) //no more than 5 days old
									&& $match[1] < date("Y-m-d") //not today or future
								)
								{
									//Preserve the file
									$emptyDirectory = false;
								}
								else
								{
									$reportsEntry->delete();
								}
							}
							else
							{
								$reportsEntry->delete();
							}
						}

						if ($emptyDirectory)
						{
							$directoryEntry->delete();
						}
					}
					else
					{
						$directoryEntry->delete();
					}
				}
			}
		}
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit