mirror of
https://framagit.org/hubzilla/core.git
synced 2026-06-21 00:52:33 -04:00
curl_close() is deprected and noop since PHP version 8.0
This commit is contained in:
@@ -25,18 +25,18 @@ class Img_filesize {
|
||||
|
||||
|
||||
static function getLocalFileSize($url) {
|
||||
|
||||
|
||||
$fname = basename($url);
|
||||
$resolution = 0;
|
||||
|
||||
|
||||
if(strpos($fname,'.') !== false)
|
||||
$fname = substr($fname,0,strpos($fname,'.'));
|
||||
|
||||
|
||||
if(substr($fname,-2,1) == '-') {
|
||||
$resolution = intval(substr($fname,-1,1));
|
||||
$fname = substr($fname,0,-2);
|
||||
}
|
||||
|
||||
|
||||
$r = q("SELECT filesize FROM photo WHERE resource_id = '%s' AND imgscale = %d LIMIT 1",
|
||||
dbesc($fname),
|
||||
intval($resolution)
|
||||
@@ -116,7 +116,6 @@ function getRemoteFileSize($url)
|
||||
|
||||
curl_exec($ch);
|
||||
curl_getinfo($ch);
|
||||
curl_close($ch);
|
||||
|
||||
return $size;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,7 +187,6 @@ function z_fetch_url($url, $binary = false, $redirects = 0, $opts = array()) {
|
||||
$newurl = $url . $newurl;
|
||||
$url_parsed = @parse_url($newurl);
|
||||
if (isset($url_parsed)) {
|
||||
@curl_close($ch);
|
||||
return z_fetch_url($newurl,$binary,++$redirects,$opts);
|
||||
}
|
||||
}
|
||||
@@ -209,7 +208,6 @@ function z_fetch_url($url, $binary = false, $redirects = 0, $opts = array()) {
|
||||
$ret['debug'] = $curl_info;
|
||||
}
|
||||
|
||||
@curl_close($ch);
|
||||
return($ret);
|
||||
}
|
||||
|
||||
@@ -352,7 +350,6 @@ function z_post_url($url, $params, $redirects = 0, $opts = array()) {
|
||||
// would somebody take lighttpd and just shoot it?
|
||||
|
||||
if($http_code == 417) {
|
||||
curl_close($ch);
|
||||
if($opts) {
|
||||
if($opts['headers'])
|
||||
$opts['headers'][] = 'Expect:';
|
||||
@@ -377,7 +374,6 @@ function z_post_url($url, $params, $redirects = 0, $opts = array()) {
|
||||
|
||||
$url_parsed = @parse_url($newurl);
|
||||
if (isset($url_parsed)) {
|
||||
curl_close($ch);
|
||||
if($http_code == 303) {
|
||||
return z_fetch_url($newurl,false,++$redirects,$opts);
|
||||
} else {
|
||||
@@ -403,7 +399,6 @@ function z_post_url($url, $params, $redirects = 0, $opts = array()) {
|
||||
$ret['debug'] = $curl_info;
|
||||
}
|
||||
|
||||
curl_close($ch);
|
||||
return($ret);
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ if ((isset($title)) && (isset($text)) && (isset($url))) {
|
||||
}
|
||||
|
||||
if (isset($_POST['submit'])) {
|
||||
|
||||
|
||||
if (($_POST["friendika_acct_name"] != '') && ($_POST["friendika_password"] != '')) {
|
||||
$acctname = $_POST["friendika_acct_name"];
|
||||
$tmp_account_array = explode("@", $acctname);
|
||||
@@ -71,31 +71,30 @@ if (isset($_POST['submit'])) {
|
||||
|
||||
$url = "http://" . $hostname . '/api/statuses/update';
|
||||
$data = array('status' => $content);
|
||||
|
||||
|
||||
// echo "posting to: $url<br/>";
|
||||
|
||||
$c = curl_init();
|
||||
curl_setopt($c, CURLOPT_URL, $url);
|
||||
curl_setopt($c, CURLOPT_URL, $url);
|
||||
curl_setopt($c, CURLOPT_USERPWD, "$username:$password");
|
||||
curl_setopt($c, CURLOPT_POSTFIELDS, $data);
|
||||
curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($c, CURLOPT_POSTFIELDS, $data);
|
||||
curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($c, CURLOPT_FOLLOWLOCATION, true);
|
||||
$c_result = curl_exec($c);
|
||||
if(curl_errno($c)){
|
||||
$c_result = curl_exec($c);
|
||||
if(curl_errno($c)){
|
||||
$error = curl_error($c);
|
||||
showForm($error, $content);
|
||||
}
|
||||
|
||||
curl_close($c);
|
||||
|
||||
if (!isset($error)) {
|
||||
echo '<script language="javascript" type="text/javascript">window.close();</script>';
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
$error = "Missing account name and/or password...try again please";
|
||||
showForm($error, $content);
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
showForm(null, $content);
|
||||
}
|
||||
@@ -103,7 +102,7 @@ if (isset($_POST['submit'])) {
|
||||
function showForm($error, $content) {
|
||||
$username_cookie = $_COOKIE['username'];
|
||||
$password_cookie = $_COOKIE['password'];
|
||||
|
||||
|
||||
echo <<<EOF
|
||||
<div class='wrap1'>
|
||||
<h2><img class='logo' src='friendika-32.png' align='middle';/>
|
||||
@@ -121,9 +120,9 @@ function showForm($error, $content) {
|
||||
<p></p>
|
||||
</div>
|
||||
EOF;
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user