mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
remove curl_close as it has no effect since php8.0 (https://www.php.net/manual/en/function.curl-close.php)
This commit is contained in:
@@ -303,7 +303,6 @@ class Curl {
|
||||
$this->error_code = curl_errno($this->session);
|
||||
$this->error_string = curl_error($this->session);
|
||||
|
||||
curl_close($this->session);
|
||||
$this->set_defaults();
|
||||
|
||||
return FALSE;
|
||||
@@ -312,7 +311,6 @@ class Curl {
|
||||
// Request successful
|
||||
else
|
||||
{
|
||||
curl_close($this->session);
|
||||
$response = $this->response;
|
||||
$this->set_defaults();
|
||||
return $response;
|
||||
|
||||
@@ -213,7 +213,6 @@ class EqslBulkDownloader {
|
||||
}
|
||||
|
||||
curl_multi_remove_handle($mh, $ch);
|
||||
curl_close($ch);
|
||||
}
|
||||
|
||||
curl_multi_close($mh);
|
||||
@@ -319,7 +318,6 @@ class EqslBulkDownloader {
|
||||
}
|
||||
|
||||
curl_multi_remove_handle($mh, $ch);
|
||||
curl_close($ch);
|
||||
}
|
||||
|
||||
curl_multi_close($mh);
|
||||
@@ -403,7 +401,6 @@ class EqslBulkDownloader {
|
||||
curl_setopt($ch, CURLOPT_USERAGENT, 'Wavelog-eQSL/1.0');
|
||||
$content = curl_exec($ch);
|
||||
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
curl_close($ch);
|
||||
|
||||
if ($content === false || $httpCode != 200) {
|
||||
log_message('error', 'Failed to download image from: ' . $url);
|
||||
|
||||
@@ -85,53 +85,48 @@ class EqslImporter
|
||||
// Let's use cURL instead of file_get_contents
|
||||
// begin script
|
||||
$ch = curl_init();
|
||||
try {
|
||||
// basic curl options for all requests
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_HEADER, 1);
|
||||
// basic curl options for all requests
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_HEADER, 1);
|
||||
|
||||
// use the URL and params we built
|
||||
curl_setopt($ch, CURLOPT_URL, $eqsl_url);
|
||||
curl_setopt($ch, CURLOPT_POST, 1);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $eqsl_params);
|
||||
// use the URL and params we built
|
||||
curl_setopt($ch, CURLOPT_URL, $eqsl_url);
|
||||
curl_setopt($ch, CURLOPT_POST, 1);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $eqsl_params);
|
||||
|
||||
$input = curl_exec($ch);
|
||||
$chi = curl_getinfo($ch);
|
||||
$input = curl_exec($ch);
|
||||
$chi = curl_getinfo($ch);
|
||||
|
||||
// "You have no log entries" -> Nothing else to do here
|
||||
// "Your ADIF log file has been built" -> We've got an ADIF file we need to grab.
|
||||
// "You have no log entries" -> Nothing else to do here
|
||||
// "Your ADIF log file has been built" -> We've got an ADIF file we need to grab.
|
||||
|
||||
if ($chi['http_code'] == "200") {
|
||||
if (stristr($input, "You have no log entries")) {
|
||||
return $this->result('There are no QSLs waiting for download at eQSL.cc.'); // success
|
||||
} else if (stristr($input, "Error: No such Username/Password found")) {
|
||||
return $this->result('No such Username/Password found This could mean the wrong callsign or the wrong password, or the user does not exist.'); // warning
|
||||
} else {
|
||||
if (stristr($input, "Your ADIF log file has been built")) {
|
||||
// Get all the links on the page and grab the URL for the ADI file.
|
||||
$regexp = "<a\s[^>]*href=(\"??)([^\" >]*?)\\1[^>]*>(.*)<\/a>";
|
||||
if (preg_match_all("/$regexp/siU", $input, $matches)) {
|
||||
foreach ($matches[2] as $match) {
|
||||
// Look for the link that has the .adi file, and download it to $file
|
||||
if (substr($match, -4, 4) == ".adi") {
|
||||
file_put_contents($this->adif_file, file_get_contents("https://eqsl.cc/qslcard/" . $match));
|
||||
return $this->import();
|
||||
}
|
||||
if ($chi['http_code'] == "200") {
|
||||
if (stristr($input, "You have no log entries")) {
|
||||
return $this->result('There are no QSLs waiting for download at eQSL.cc.'); // success
|
||||
} else if (stristr($input, "Error: No such Username/Password found")) {
|
||||
return $this->result('No such Username/Password found This could mean the wrong callsign or the wrong password, or the user does not exist.'); // warning
|
||||
} else {
|
||||
if (stristr($input, "Your ADIF log file has been built")) {
|
||||
// Get all the links on the page and grab the URL for the ADI file.
|
||||
$regexp = "<a\s[^>]*href=(\"??)([^\" >]*?)\\1[^>]*>(.*)<\/a>";
|
||||
if (preg_match_all("/$regexp/siU", $input, $matches)) {
|
||||
foreach ($matches[2] as $match) {
|
||||
// Look for the link that has the .adi file, and download it to $file
|
||||
if (substr($match, -4, 4) == ".adi") {
|
||||
file_put_contents($this->adif_file, file_get_contents("https://eqsl.cc/qslcard/" . $match));
|
||||
return $this->import();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($chi['http_code'] == "500") {
|
||||
return $this->result('eQSL.cc is experiencing issues. Please try importing QSOs later.'); // warning
|
||||
}
|
||||
}
|
||||
|
||||
return $this->result('It seems that the eQSL site has changed. Please open up an issue on GitHub.');
|
||||
} finally {
|
||||
// Close cURL handle
|
||||
curl_close($ch);
|
||||
} else {
|
||||
if ($chi['http_code'] == "500") {
|
||||
return $this->result('eQSL.cc is experiencing issues. Please try importing QSOs later.'); // warning
|
||||
}
|
||||
}
|
||||
|
||||
return $this->result('It seems that the eQSL site has changed. Please open up an issue on GitHub.');
|
||||
}
|
||||
|
||||
// Read the ADIF file and set QSO confirmation status according to the settings
|
||||
|
||||
@@ -20,7 +20,6 @@ class Hamqth {
|
||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
|
||||
$xml = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
if(curl_errno($ch)) {
|
||||
log_message('error', 'Hamqth query failed: '.curl_strerror(curl_errno($ch))." (".curl_errno($ch).")");
|
||||
return false;
|
||||
@@ -49,7 +48,6 @@ class Hamqth {
|
||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
|
||||
$xml = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
|
||||
// Create XML object
|
||||
$xml = simplexml_load_string($xml);
|
||||
@@ -76,7 +74,6 @@ class Hamqth {
|
||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
|
||||
$xml = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
|
||||
// Create XML object
|
||||
$xml = simplexml_load_string($xml);
|
||||
|
||||
@@ -58,9 +58,6 @@ class Pota
|
||||
|
||||
$summit_info = curl_exec($ch);
|
||||
|
||||
// Close cURL handle
|
||||
curl_close($ch);
|
||||
|
||||
return $summit_info;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ class Qrz {
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
|
||||
curl_setopt($ch, CURLOPT_USERAGENT, 'Wavelog/'.$ci->optionslib->get_option('version'));
|
||||
$xml = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
|
||||
// Create XML object
|
||||
$xml = simplexml_load_string($xml);
|
||||
@@ -48,7 +47,6 @@ class Qrz {
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
|
||||
curl_setopt($ch, CURLOPT_USERAGENT, 'Wavelog/'.$ci->optionslib->get_option('version'));
|
||||
$xml = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
|
||||
// Create XML object
|
||||
$xml = simplexml_load_string($xml);
|
||||
@@ -81,10 +79,8 @@ class Qrz {
|
||||
if ($httpcode != 200) {
|
||||
$message = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);
|
||||
log_message('debug', 'QRZ.com search for callsign: ' . $callsign . ' returned message: ' . $message . ' HTTP code: ' . $httpcode);
|
||||
curl_close($ch);
|
||||
return $data['error'] = 'Problems with qrz.com communication'; // Exit function if no 200. If request fails, 0 is returned
|
||||
}
|
||||
curl_close($ch);
|
||||
// Create XML object
|
||||
$xml = simplexml_load_string($xml);
|
||||
if (!empty($xml->Session->Error)) {
|
||||
|
||||
@@ -22,7 +22,6 @@ class Qrzcq {
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
|
||||
curl_setopt($ch, CURLOPT_USERAGENT, 'Wavelog/'.$ci->optionslib->get_option('version'));
|
||||
$xml = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
|
||||
// Create XML object
|
||||
$xml = simplexml_load_string($xml);
|
||||
@@ -55,7 +54,6 @@ class Qrzcq {
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
|
||||
curl_setopt($ch, CURLOPT_USERAGENT, 'Wavelog/'.$ci->optionslib->get_option('version'));
|
||||
$xml = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
|
||||
// Create XML object
|
||||
$xml = simplexml_load_string($xml);
|
||||
@@ -85,7 +83,6 @@ class Qrzcq {
|
||||
curl_setopt($ch, CURLOPT_USERAGENT, 'Wavelog/'.$ci->optionslib->get_option('version'));
|
||||
$xml = curl_exec($ch);
|
||||
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
curl_close($ch);
|
||||
if ($httpcode != 200) return $data['error'] = 'Problems with qrzcq.com communication'; // Exit function if no 200. If request fails, 0 is returned
|
||||
|
||||
// Create XML object
|
||||
|
||||
@@ -22,7 +22,6 @@ class Qrzru {
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
|
||||
curl_setopt($ch, CURLOPT_USERAGENT, 'Wavelog/'.$ci->optionslib->get_option('version'));
|
||||
$xml = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
|
||||
// Create XML object
|
||||
$xml = simplexml_load_string($xml);
|
||||
@@ -48,7 +47,6 @@ class Qrzru {
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
|
||||
curl_setopt($ch, CURLOPT_USERAGENT, 'Wavelog/'.$ci->optionslib->get_option('version'));
|
||||
$xml = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
|
||||
// Create XML object
|
||||
$xml = simplexml_load_string($xml);
|
||||
@@ -78,7 +76,6 @@ class Qrzru {
|
||||
curl_setopt($ch, CURLOPT_USERAGENT, 'Wavelog/'.$ci->optionslib->get_option('version'));
|
||||
$xml = curl_exec($ch);
|
||||
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
curl_close($ch);
|
||||
|
||||
// Create XML object
|
||||
$xml = simplexml_load_string($xml);
|
||||
|
||||
@@ -58,9 +58,6 @@ class Sota
|
||||
|
||||
$summit_info = curl_exec($ch);
|
||||
|
||||
// Close cURL handle
|
||||
curl_close($ch);
|
||||
|
||||
return $summit_info;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,9 +58,6 @@ class Wwff
|
||||
|
||||
$summit_info = curl_exec($ch);
|
||||
|
||||
// Close cURL handle
|
||||
curl_close($ch);
|
||||
|
||||
return $summit_info;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user