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/rospirotorg.ru/bitrix/modules/wbs24.ozonexport/lib/ |
Upload File : |
<?php namespace Wbs24\Ozonexport; use Bitrix\Main\SystemException; class BasicAuth { protected $param; public function __construct($param) { $this->param = $param; } public function getAuthConditionCode($fullPathExportNewLinkedFile) { $code = ''; $basicCode = 'require("'.$fullPathExportNewLinkedFile.'");'; if ($this->isNeedAuth()) { $code = '<?php header("Cache-Control: no-cache, must-revalidate, max-age=0");' .'$isEmptyCredentialsFilled = (empty($_SERVER["PHP_AUTH_USER"]) && empty($_SERVER["PHP_AUTH_PW"]));' .'$isNotPassedValidation = (' .'$isEmptyCredentialsFilled' .'|| md5($_SERVER["PHP_AUTH_USER"]) != "' . md5($this->param['feedLogin']) . '"' .'|| md5($_SERVER["PHP_AUTH_PW"]) != "' . md5($this->param['feedPass']) . '"' .');' .'if ($isNotPassedValidation) {' .'header("HTTP/1.1 401 Authorization Required");' .'header("WWW-Authenticate: Basic realm=\"Access denied\"");' .'exit;' .'}' . $basicCode ; } else { $code = '<?php ' . $basicCode; } return $code; } protected function isNeedAuth() { $needAuth = false; if ( $this->param['feedProtectedFlag'] && $this->param['feedLogin'] && $this->param['feedPass'] ) { $needAuth = true; } return $needAuth; } }