СХ
Size: a a a
СХ
СХ
DE
СХ
СХ
DE
СХ
СХ
СХ
DE
СХ
СХ
СХ
СХ
DE
DE
DE
<?php
class WebserverController
{
public function setup()
{
$webserver = $_POST['group1'];
if (PHP_OS == 'WINNT' or PHP_OS == 'WIN32' or PHP_OS == 'Windows') {
$destination = str_replace('frontend\web', '', getcwd());
} else {
$destination = str_replace('frontend/web', '', getcwd());
}
$result = false;
try {
switch ($webserver)
{
case ('apache'):
copy(getcwd() . '/install/confs/.htaccess', "{$destination}.htaccess");
if (file_exists("{$destination}.htaccess")) {
$result = true;
$url = "{$_SERVER['HTTP_ORIGIN']}/user/sign-in/login";
}
break;
case ('iis'):
copy(getcwd() . '/install/confs/web.config', "{$destination}web.config");
if (file_exists("{$destination}web.config")) {
$result = true;
if ($_SERVER['SERVER_PROTOCOL'] = 'HTTP/1.1') {
$url = "http://{$_SERVER['HTTP_HOST']}/user/sign-in/login";
} else {
$url = "https://{$_SERVER['HTTP_HOST']}/user/sign-in/login";
}
}
break;
default:$result = true;
}
}
catch (Exception $ex)
{
error_log($ex);
http_response_code(400);
header('Content-Type: text/plain');
echo false;
}
$response = @get_headers($url);
if (!$response || $response[0] == "{$_SERVER['SERVER_PROTOCOL']} 404 Not Found") {
$response = false;
} else {
$response = true;
}
if ($result && $response !== false) {
http_response_code(200);
header('Content-Type: text/plain');
echo true;
} else {
if ($response === false) {
if ($webserver == 'apache') {
http_response_code(401);
}
elseif ($webserver == 'iis') {
http_response_code(402);
} else {
http_response_code(400);
}
}
if ($result === false) {
http_response_code(400);
}
header('Content-Type: text/plain');
echo false;
}
}
}
СХ
S
<?php
class WebserverController
{
public function setup()
{
$webserver = $_POST['group1'];
if (PHP_OS == 'WINNT' or PHP_OS == 'WIN32' or PHP_OS == 'Windows') {
$destination = str_replace('frontend\web', '', getcwd());
} else {
$destination = str_replace('frontend/web', '', getcwd());
}
$result = false;
try {
switch ($webserver)
{
case ('apache'):
copy(getcwd() . '/install/confs/.htaccess', "{$destination}.htaccess");
if (file_exists("{$destination}.htaccess")) {
$result = true;
$url = "{$_SERVER['HTTP_ORIGIN']}/user/sign-in/login";
}
break;
case ('iis'):
copy(getcwd() . '/install/confs/web.config', "{$destination}web.config");
if (file_exists("{$destination}web.config")) {
$result = true;
if ($_SERVER['SERVER_PROTOCOL'] = 'HTTP/1.1') {
$url = "http://{$_SERVER['HTTP_HOST']}/user/sign-in/login";
} else {
$url = "https://{$_SERVER['HTTP_HOST']}/user/sign-in/login";
}
}
break;
default:$result = true;
}
}
catch (Exception $ex)
{
error_log($ex);
http_response_code(400);
header('Content-Type: text/plain');
echo false;
}
$response = @get_headers($url);
if (!$response || $response[0] == "{$_SERVER['SERVER_PROTOCOL']} 404 Not Found") {
$response = false;
} else {
$response = true;
}
if ($result && $response !== false) {
http_response_code(200);
header('Content-Type: text/plain');
echo true;
} else {
if ($response === false) {
if ($webserver == 'apache') {
http_response_code(401);
}
elseif ($webserver == 'iis') {
http_response_code(402);
} else {
http_response_code(400);
}
}
if ($result === false) {
http_response_code(400);
}
header('Content-Type: text/plain');
echo false;
}
}
}
DE