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;
+ }
+
}
-?>
* @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");
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);
}