Skip to content

Commit

Permalink
Merge pull request #1059 from ai91/alpha
Browse files Browse the repository at this point in the history
Отказоустойчивость для систем без модуля CONNECT
  • Loading branch information
sergejey authored Nov 18, 2022
2 parents 9244a16 + ab9e41a commit 5276214
Showing 1 changed file with 20 additions and 16 deletions.
36 changes: 20 additions & 16 deletions modules/market/market.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -633,14 +633,16 @@ function marketRequest($details = '', $cache_timeout = 0)

$username = '';
$password = '';
include_once(DIR_MODULES . 'connect/connect.class.php');
$connect = new connect();
$connect->getConfig();
$connect_username = strtolower($connect->config['CONNECT_USERNAME']);
$connect_password = $connect->config['CONNECT_PASSWORD'];
if ($connect_username != '' && $connect_password != '') {
$username = $connect_username;
$password = $connect_password;
@include_once(DIR_MODULES . 'connect/connect.class.php');
if (class_exists('connect')) {
$connect = new connect();
$connect->getConfig();
$connect_username = strtolower($connect->config['CONNECT_USERNAME']);
$connect_password = $connect->config['CONNECT_PASSWORD'];
if ($connect_username != '' && $connect_password != '') {
$username = $connect_username;
$password = $connect_password;
}
}
return getURL($data_url, $cache_timeout, $username, $password);
}
Expand Down Expand Up @@ -967,14 +969,16 @@ function getLatest(&$out, $url, $name, $version, $frame = 0)
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_FILE, $f);

include_once(DIR_MODULES . 'connect/connect.class.php');
$connect = new connect();
$connect->getConfig();
$connect_username = strtolower($connect->config['CONNECT_USERNAME']);
$connect_password = $connect->config['CONNECT_PASSWORD'];
if ($connect_username != '' && $connect_password != '') {
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, $connect_username . ":" . $connect_password);
@include_once(DIR_MODULES . 'connect/connect.class.php');
if (class_exists('connect')) {
$connect = new connect();
$connect->getConfig();
$connect_username = strtolower($connect->config['CONNECT_USERNAME']);
$connect_password = $connect->config['CONNECT_PASSWORD'];
if ($connect_username != '' && $connect_password != '') {
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, $connect_username . ":" . $connect_password);
}
}

$incoming = curl_exec($ch);
Expand Down

0 comments on commit 5276214

Please sign in to comment.