%PDF- %PDF- 403WebShell
403Webshell
Server IP : 37.220.80.31  /  Your IP : 3.12.148.234
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux 3051455-guretool.twc1.net 5.15.0-107-generic #117-Ubuntu SMP Fri Apr 26 12:26:49 UTC 2024 x86_64
User : www-root ( 1010)
PHP Version : 7.4.33
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /var/www/www-root/data/www/dev.artlot24.ru/bitrix/modules/location/install/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/www-root/data/www/dev.artlot24.ru/bitrix/modules/location/install/index.php
<?php

use Bitrix\Main\Event;
use Bitrix\Main\EventResult;
use \Bitrix\Main\Localization\Loc;
use Bitrix\Main\ModuleManager;

Loc::loadMessages(__FILE__);

if(class_exists("location")) return;

Class location extends CModule
{
	var $MODULE_ID = "location";
	var $MODULE_VERSION;
	var $MODULE_VERSION_DATE;
	var $MODULE_NAME;
	var $MODULE_DESCRIPTION;
	var $errors = [];

	public function __construct()
	{
		$arModuleVersion = [];

		include(__DIR__.'/version.php');

		if (is_array($arModuleVersion) && array_key_exists("VERSION", $arModuleVersion))
		{
			$this->MODULE_VERSION = $arModuleVersion["VERSION"];
			$this->MODULE_VERSION_DATE = $arModuleVersion["VERSION_DATE"];
		}

		$this->MODULE_NAME = Loc::getMessage('LOCATION_MODULE_NAME');
		$this->MODULE_DESCRIPTION = Loc::getMessage('LOCATION_MODULE_DESCRIPTION');
	}

	public function DoInstall()
	{
		global $APPLICATION;

		$this->InstallFiles();
		$this->InstallDB();
		$this->InstallEvents();

		$GLOBALS["errors"] = $this->errors;
		$APPLICATION->IncludeAdminFile(Loc::getMessage("LOCATION_INSTALL_TITLE"), $_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/location/install/step1.php");
	}

	public function setDefaultFormatCode()
	{
		if(!\Bitrix\Main\Loader::includeModule('location'))
		{
			return;
		}

		$event = new Event("location", "onInitialFormatCodeSet");
		$event->send();
		$results = $event->getResults();
		$formatCode = Bitrix\Location\Infrastructure\FormatCode::getDefault();

		if (is_array($results) && !empty($results))
		{
			foreach ($results as $result)
			{
				if ($result->getType() !== EventResult::SUCCESS)
					continue;

				$params = $result->getParameters();

				if(isset($params["formatCode"]))
				{
					$formatCode = $params["formatCode"];
					break;
				}
			}
		}

		Bitrix\Location\Infrastructure\FormatCode::setCurrent($formatCode);
	}

	public function installSources()
	{
		global $DB;

		$DB->query(
			"
				INSERT INTO b_location_source (
					CODE,
					NAME,
					CONFIG
				) VALUES (
					 'GOOGLE',
					 'Google',
				     '" . $DB->forSql(serialize(
						[
							[
								'code' => 'API_KEY_FRONTEND',
								'type' => 'string',
								'sort' => 10,
								'value' => '',
							],
							[
								'code' => 'API_KEY_BACKEND',
								'type' => 'string',
								'sort' => 20,
								'value' => '',
							],
							[
								'code' => 'SHOW_PHOTOS_ON_MAP',
								'type' => 'bool',
								'sort' => 30,
								'value' => true,
							],
							[
								'code' => 'USE_GEOCODING_SERVICE',
								'type' => 'bool',
								'sort' => 40,
								'value' => true,
							],
						]
					)) . "'
				 );
			"
		);

		$DB->query("
			INSERT IGNORE INTO b_location_source (
				CODE,
				NAME,
				CONFIG
			)
			VALUES
			(
				'OSM',
				'OpenStreetMap',
				'" . $DB->ForSQL(serialize(
				[
					[
						'code' => 'SERVICE_URL',
						'type' => 'string',
						'sort' => 10,
						'value' => '',
						'is_visible' => true,
					],
					[
						'code' => 'TOKEN',
						'type' => 'string',
						'sort' => 20,
						'value' => null,
						'is_visible' => false,
					],
				]
			)) . "'
			)
		");
	}

	public function DoUninstall()
	{
		global $APPLICATION, $step;
		$step = intval($step);

		if($step < 2)
		{
			$APPLICATION->IncludeAdminFile(Loc::getMessage("LOCATION_UNINSTALL_TITLE"), $_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/location/install/unstep1.php");
		}
		elseif($step == 2)
		{
			$this->UnInstallDB(array(
				"savedata" => $_REQUEST["savedata"],
			));

			$this->UnInstallFiles();
			$this->UnInstallEvents();
			\CAgent::RemoveModuleAgents('location');

			$GLOBALS["errors"] = $this->errors;
			$APPLICATION->IncludeAdminFile(Loc::getMessage("LOCATION_UNINSTALL_TITLE"), $_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/location/install/unstep2.php");
		}

		return true;
	}

	public function InstallDB()
	{
		global $DB, $APPLICATION;
		$this->errors = false;

		if(!$DB->Query("SELECT 'x' FROM b_location", true))
		{
			$this->errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/location/install/db/mysql/install.sql");
		}

		if($this->errors !== false)
		{
			$APPLICATION->ThrowException(implode("", $this->errors));
			return false;
		}

		/*
		 * Reason: registerModule() could already be used in updaters
		 * bitrix24 20.5.100, bitrix24 20.5.200, location 20.5.1
		*/
		if(!\Bitrix\Main\ModuleManager::isModuleInstalled($this->MODULE_ID))
		{
			\Bitrix\Main\ModuleManager::registerModule($this->MODULE_ID);
		}

		$this->installSources();
		$this->setDefaultFormatCode();

		return true;
	}

	public function UnInstallDB($arParams = Array())
	{
		global $DB, $APPLICATION;
		$this->errors = false;

		if($DB->Query("SELECT 'x' FROM b_location", true))
		{
			$this->errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/location/install/db/mysql/uninstall.sql");
		}

		if($this->errors !== false)
		{
			$APPLICATION->ThrowException(implode("", $this->errors));
			return false;
		}

		\Bitrix\Main\ModuleManager::unRegisterModule($this->MODULE_ID);

		return true;
	}

	public function InstallFiles($arParams = array())
	{
		if($_ENV["COMPUTERNAME"] !== 'BX')
		{
			CopyDirFiles($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/location/install/js", $_SERVER["DOCUMENT_ROOT"]."/bitrix/js", true, true);
		}

		return true;
	}

	public function UnInstallFiles()
	{
		if($_ENV["COMPUTERNAME"] !== 'BX')
		{
			DeleteDirFilesEx("/bitrix/js/location/");
		}

		return true;
	}

	public function InstallEvents()
	{
		$eventManager = \Bitrix\Main\EventManager::getInstance();
		$eventManager->registerEventHandler("ui", "onUIFormInitialize", "location", "\\Bitrix\\Location\\Infrastructure\\EventHandler", "onUIFormInitialize");

		return true;
	}

	public function UnInstallEvents()
	{
		$eventManager = \Bitrix\Main\EventManager::getInstance();
		$eventManager->unRegisterEventHandler("ui", "onUIFormInitialize", "location", "\\Bitrix\\Location\\Infrastructure\\EventHandler", "onUIFormInitialize");

		return true;
	}
}
?>

Youez - 2016 - github.com/yon3zu
LinuXploit