Commit ff80598c authored by Malcolm Blaney's avatar Malcolm Blaney

Use full url when replacing feed images for facebook and twitter.

parent 007037da
Pipeline #34768309 passed with stage
in 1 minute and 10 seconds
......@@ -567,9 +567,9 @@ class Reader extends Base {
$feed = new SimplePie();
$feed->enable_order_by_date(false);
$scheme = $this->user->config->Secure() ? 'https://' : 'http://';
$handler = $scheme . $this->user->config->ServerName() . '/php/image.php';
$server_name = $this->user->config->ServerName();
// The full image handler url is required for Microsub clients.
$feed->set_image_handler($handler);
$feed->set_image_handler($scheme . $server_name . '/php/image.php');
$feed->set_feed_url($us_xml_url);
$feed->force_feed($force);
// get_all_discoverd_feeds doesn't work if caching is used.
......@@ -644,21 +644,22 @@ class Reader extends Base {
$title = $mysqli->escape_string($feed->get_title());
$description = $mysqli->escape_string($feed->get_description());
$html_url = $mysqli->escape_string(trim($feed->get_link(), ' /'));
$language = $mysqli->escape_string($feed->get_language());
$image_url = $mysqli->escape_string($feed->get_image_url());
$image_title = $mysqli->escape_string($feed->get_image_title());
$image_link = $mysqli->escape_string($feed->get_image_link());
// These feeds change the html_url link so it's hard to identify their
// item groups, and we want to use the group info to know whether an
// item should be automatically syndicated to the silos they came from.
if (strpos($xml_url, 'https://facebook-atom.appspot.com') === 0) {
$html_url = 'https://facebook-atom.appspot.com';
$image_url = '/images/facebook.png';
$image_url = $scheme . $server_name . '/images/facebook.png';
}
else if (strpos($xml_url, 'https://twitter-atom.appspot.com') === 0) {
$html_url = 'https://twitter-atom.appspot.com';
$image_url = '/images/twitter.png';
$scheme = $this->user->config->Secure() ? 'https://' : 'http://';
$image_url = $scheme . $server_name . '/images/twitter.png';
}
$language = $mysqli->escape_string($feed->get_language());
$image_url = $mysqli->escape_string($feed->get_image_url());
$image_title = $mysqli->escape_string($feed->get_image_title());
$image_link = $mysqli->escape_string($feed->get_image_link());
$query = 'INSERT INTO reader_feeds VALUES ("' . $xml_url . '", ' .
'"' . $description . '", "' . $html_url . '", "' . $language . '", ' .
'"' . $title . '", "' . $image_url . '", "' . $image_title . '", ' .
......@@ -755,11 +756,15 @@ class Reader extends Base {
$image_link = $mysqli->escape_string($feed->get_image_link());
if (strpos($xml_url, 'https://facebook-atom.appspot.com') === 0) {
$html_url = 'https://facebook-atom.appspot.com';
$image_url = '/images/facebook.png';
$scheme = $this->user->config->Secure() ? 'https://' : 'http://';
$image_url = $scheme . $this->user->config->ServerName() .
'/images/facebook.png';
}
else if (strpos($xml_url, 'https://twitter-atom.appspot.com') === 0) {
$html_url = 'https://twitter-atom.appspot.com';
$image_url = '/images/twitter.png';
$scheme = $this->user->config->Secure() ? 'https://' : 'http://';
$image_url = $scheme . $this->user->config->ServerName() .
'/images/twitter.png';
}
if ($us_cloud = $feed->get_channel_tags('', 'cloud')) {
$this->SaveCloud($us_cloud, $us_xml_url);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment