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/tools/wbs24.fixpath/ |
Upload File : |
<?php class Wbs24FixPath { protected $fixDomain = 'ilovecveti.ru'; protected $wrongDomain = 'cvetochnyidvorik.ru'; protected $rightPath = '/home/bitrix/ext_www/ilovecveti.ru'; public function init() { if ($this->isWrongPath()) { $this->fixServerData(); $this->connectRightIndexFile(); } } protected function isWrongPath() { return ( strpos($_SERVER['SERVER_NAME'], $this->fixDomain) !== false && strpos($_SERVER['DOCUMENT_ROOT'], $this->wrongDomain) !== false ); } protected function fixServerData() { $_SERVER['DOCUMENT_ROOT'] = $this->rightPath; $_SERVER['CONTEXT_DOCUMENT_ROOT'] = $this->rightPath; $_SERVER['SCRIPT_FILENAME'] = str_replace($this->wrongDomain, $this->fixDomain, $_SERVER['SCRIPT_FILENAME']); } protected function connectRightIndexFile() { //print_r($_SERVER); $script = $_SERVER['REAL_FILE_PATH'] ?? $_SERVER['PHP_SELF']; //echo $this->rightPath.$script; require_once($this->rightPath.$script); exit; } } if (empty($wbs24FixPathObj)) { $wbs24FixPathObj = new Wbs24FixPath(); $wbs24FixPathObj->init(); }