From: Hypolite Petovan Date: Sun, 7 May 2017 16:58:11 +0000 (-0400) Subject: Merge branch 'develop' into improvement/move-app-to-src-2 X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=86cae070f2a048e553c545caec54be72c1c14da5;p=friendica.git Merge branch 'develop' into improvement/move-app-to-src-2 --- 86cae070f2a048e553c545caec54be72c1c14da5 diff --cc include/Probe.php index 8914529867,bed13fdf3d..85f64d29bc --- a/include/Probe.php +++ b/include/Probe.php @@@ -1219,4 -1223,42 +1224,41 @@@ class Probe return $data; } + + /** + * @brief Mix two paths together to possibly fix missing parts + * + * @param string $avatar Path to the avatar + * @param string $base Another path that is hopefully complete + * + * @return string fixed avatar path + */ + public static function fix_avatar($avatar, $base) { + $base_parts = parse_url($base); + + // Remove all parts that could create a problem + unset($base_parts['path']); + unset($base_parts['query']); + unset($base_parts['fragment']); + + $avatar_parts = parse_url($avatar); + + // Now we mix them + $parts = array_merge($base_parts, $avatar_parts); + + // And put them together again + $scheme = isset($parts['scheme']) ? $parts['scheme'] . '://' : ''; + $host = isset($parts['host']) ? $parts['host'] : ''; + $port = isset($parts['port']) ? ':' . $parts['port'] : ''; + $path = isset($parts['path']) ? $parts['path'] : ''; + $query = isset($parts['query']) ? '?' . $parts['query'] : ''; + $fragment = isset($parts['fragment']) ? '#' . $parts['fragment'] : ''; + + $fixed = $scheme.$host.$port.$path.$query.$fragment; + + logger('Base: '.$base.' - Avatar: '.$avatar.' - Fixed: '.$fixed, LOGGER_DATA); + + return $fixed; + } + } -?> diff --cc include/ostatus.php index 82595529d2,7644eacc09..c3bdadf55b --- a/include/ostatus.php +++ b/include/ostatus.php @@@ -3,7 -3,7 +3,8 @@@ * @file include/ostatus.php */ -use \Friendica\Core\Config; +use Friendica\App; ++use Friendica\Core\Config; require_once("include/Contact.php"); require_once("include/threads.php"); diff --cc mod/receive.php index abc91ce37e,15c9f1d412..9048642174 --- a/mod/receive.php +++ b/mod/receive.php @@@ -10,10 -9,10 +10,9 @@@ require_once('include/salmon.php') require_once('include/crypto.php'); require_once('include/diaspora.php'); - function receive_post(App $a) { - - $enabled = intval(get_config('system','diaspora_enabled')); - if(! $enabled) { + $enabled = intval(get_config('system', 'diaspora_enabled')); + if (!$enabled) { logger('mod-diaspora: disabled'); http_status_exit(500); }