Merge branch 'dev' of /home/macgirvin/roadhouse into dev

This commit is contained in:
nobody 2021-04-07 19:13:26 -07:00
commit 943b510ad3
5 changed files with 24 additions and 10 deletions

View file

@ -113,7 +113,7 @@ class Linkinfo extends Controller {
killme(); killme();
} }
$result = z_fetch_url($url,false,0,array('novalidate' => true, 'nobody' => true)); $result = z_fetch_url($url, false, 0, [ 'novalidate' => true, 'nobody' => true ] );
if ($result['success']) { if ($result['success']) {
$hdrs=[]; $hdrs=[];
$h = explode("\n",$result['header']); $h = explode("\n",$result['header']);

View file

@ -16,7 +16,7 @@ use Zotlabs\Daemon\Run;
* @brief This file defines some global constants and includes the central App class. * @brief This file defines some global constants and includes the central App class.
*/ */
define ( 'STD_VERSION', '21.04.06' ); define ( 'STD_VERSION', '21.04.08' );
define ( 'ZOT_REVISION', '10.0' ); define ( 'ZOT_REVISION', '10.0' );
define ( 'DB_UPDATE_VERSION', 1247 ); define ( 'DB_UPDATE_VERSION', 1247 );

View file

@ -2829,13 +2829,18 @@ function tgroup_check($uid, $item) {
} }
} }
$u = channelx_by_n($uid);
if (! $u) {
return false;
}
// post to group via DM // post to group via DM
if ($is_group) { if ($is_group) {
if (intval($item['item_private']) === 2 && $item['mid'] === $item['parent_mid']) { if (intval($item['item_private']) === 2 && $item['mid'] === $item['parent_mid']) {
return true; return true;
} }
if (get_pconfig($uid,'system','post_via_mentions',in_array($role, ['forum','forum_moderated']))) { if (get_pconfig($uid,'system','post_via_mentions',in_array($role, ['forum','forum_moderated'])) && i_am_mentioned($u,$item)) {
return true; return true;
} }
} }
@ -2851,10 +2856,6 @@ function tgroup_check($uid, $item) {
return true; return true;
} }
$u = channelx_by_n($uid);
if (! $u) {
return false;
}
if (($is_collection) && (perm_is_allowed($uid,$item['author_xchan'],'write_collection') || $item['author_xchan'] === $u['channel_parent'])) { if (($is_collection) && (perm_is_allowed($uid,$item['author_xchan'],'write_collection') || $item['author_xchan'] === $u['channel_parent'])) {
return true; return true;

View file

@ -74,7 +74,6 @@ function z_fetch_url($url, $binary = false, $redirects = 0, $opts = []) {
@curl_setopt($ch, CURLOPT_CAINFO, get_capath()); @curl_setopt($ch, CURLOPT_CAINFO, get_capath());
@curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); @curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
@curl_setopt($ch, CURLOPT_RETURNTRANSFER,true); @curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
@curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; zot)");
@curl_setopt($ch, CURLOPT_ENCODING, ''); @curl_setopt($ch, CURLOPT_ENCODING, '');
$ciphers = @get_config('system','curl_ssl_ciphers'); $ciphers = @get_config('system','curl_ssl_ciphers');
@ -88,6 +87,13 @@ function z_fetch_url($url, $binary = false, $redirects = 0, $opts = []) {
$passthru = true; $passthru = true;
} }
if (x($opts['useragent'])) {
@curl_setopt($ch, CURLOPT_USERAGENT, $opts['useragent']);
}
else {
@curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; zot)");
}
if(x($opts,'upload')) if(x($opts,'upload'))
@curl_setopt($ch, CURLOPT_UPLOAD, $opts['upload']); @curl_setopt($ch, CURLOPT_UPLOAD, $opts['upload']);
@ -296,7 +302,6 @@ function z_post_url($url, $params, $redirects = 0, $opts = []) {
@curl_setopt($ch, CURLOPT_RETURNTRANSFER,true); @curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
@curl_setopt($ch, CURLOPT_POST,1); @curl_setopt($ch, CURLOPT_POST,1);
@curl_setopt($ch, CURLOPT_POSTFIELDS,$params); @curl_setopt($ch, CURLOPT_POSTFIELDS,$params);
@curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; zot)");
@curl_setopt($ch, CURLOPT_ENCODING, ''); @curl_setopt($ch, CURLOPT_ENCODING, '');
$ciphers = @get_config('system','curl_ssl_ciphers'); $ciphers = @get_config('system','curl_ssl_ciphers');
@ -308,6 +313,14 @@ function z_post_url($url, $params, $redirects = 0, $opts = []) {
@curl_setopt($ch, CURLOPT_HEADER, false); @curl_setopt($ch, CURLOPT_HEADER, false);
} }
if (x($opts['useragent'])) {
@curl_setopt($ch, CURLOPT_USERAGENT, $opts['useragent']);
}
else {
@curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; zot)");
}
$instance_headers = ((array_key_exists('headers',$opts) && is_array($opts['headers'])) ? $opts['headers'] : []); $instance_headers = ((array_key_exists('headers',$opts) && is_array($opts['headers'])) ? $opts['headers'] : []);
if(x($opts,'session')) { if(x($opts,'session')) {

View file

@ -371,7 +371,7 @@ function import_remote_xchan_photo($photo, $xchan, $thing = false) {
@file_put_contents('cache/' . $hash, $result['body']); @file_put_contents('cache/' . $hash, $result['body']);
$info = getimagesize('cache/' . $hash); $info = getimagesize('cache/' . $hash);
@unlink('cache/' . $hash); @unlink('cache/' . $hash);
if (isset($info) && array_key_exists('mime',$info)) { if (isset($info) && is_array($info) && array_key_exists('mime',$info)) {
$type = $info['mime']; $type = $info['mime'];
} }
} }