Merge pull request #673 from Quix0r/global/mod-proxy-to-class

[global]: Proxy class has been introduced, need to fix these as well.
This commit is contained in:
Michael Vogel 2018-07-31 07:33:33 +02:00 committed by GitHub
commit 53a3c85d4f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 12 deletions

View file

@ -15,6 +15,7 @@ use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\Model\ItemContent; use Friendica\Model\ItemContent;
use Friendica\Util\Proxy as ProxyUtils;
function buffer_install() function buffer_install()
{ {
@ -363,14 +364,12 @@ function buffer_send(App $a, array &$b)
logger("buffer_send: converted message ".$b["id"]." result: ".print_r($post, true), LOGGER_DEBUG); logger("buffer_send: converted message ".$b["id"]." result: ".print_r($post, true), LOGGER_DEBUG);
// The image proxy is used as a sanitizer. Buffer seems to be really picky about pictures // The image proxy is used as a sanitizer. Buffer seems to be really picky about pictures
require_once "mod/proxy.php";
if (isset($post["image"])) { if (isset($post["image"])) {
$post["image"] = proxy_url($post["image"]); $post["image"] = ProxyUtils::proxifyUrl($post["image"]);
} }
if (isset($post["preview"])) { if (isset($post["preview"])) {
$post["preview"] = proxy_url($post["preview"]); $post["preview"] = ProxyUtils::proxifyUrl($post["preview"]);
} }
// Seems like a bug to me // Seems like a bug to me

View file

@ -9,7 +9,6 @@
* *
*/ */
require_once 'mod/proxy.php';
require_once 'include/text.php'; require_once 'include/text.php';
use Friendica\App; use Friendica\App;
@ -19,6 +18,7 @@ use Friendica\Core\Config;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Util\Network; use Friendica\Util\Network;
use Friendica\Util\Proxy as ProxyUtils;
function curweather_install() function curweather_install()
{ {
@ -138,7 +138,7 @@ function curweather_network_mod_init(App $a, &$b)
$t = get_markup_template("widget.tpl", "addon/curweather/" ); $t = get_markup_template("widget.tpl", "addon/curweather/" );
$curweather = replace_macros ($t, [ $curweather = replace_macros ($t, [
'$title' => L10n::t("Current Weather"), '$title' => L10n::t("Current Weather"),
'$icon' => proxy_url('http://openweathermap.org/img/w/'.$res['icon'].'.png'), '$icon' => ProxyUtils::proxifyUrl('http://openweathermap.org/img/w/'.$res['icon'].'.png'),
'$city' => $res['city'], '$city' => $res['city'],
'$lon' => $res['lon'], '$lon' => $res['lon'],
'$lat' => $res['lat'], '$lat' => $res['lat'],

View file

@ -7,12 +7,11 @@
* License: 3-clause BSD license * License: 3-clause BSD license
*/ */
require_once 'mod/proxy.php';
use Friendica\Content\Text\BBCode; use Friendica\Content\Text\BBCode;
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Util\Proxy as ProxyUtils;
function impressum_install() { function impressum_install() {
Addon::registerHook('load_config', 'addon/impressum/impressum.php', 'impressum_load_config'); Addon::registerHook('load_config', 'addon/impressum/impressum.php', 'impressum_load_config');
@ -41,7 +40,8 @@ function obfuscate_email ($s) {
return $s; return $s;
} }
function impressum_footer($a, &$b) { function impressum_footer($a, &$b) {
$text = proxy_parse_html(BBCode::convert(Config::get('impressum','footer_text'))); $text = ProxyUtils::proxifyHtml(BBCode::convert(Config::get('impressum','footer_text')));
if (! $text == '') { if (! $text == '') {
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="'.$a->get_baseurl().'/addon/impressum/impressum.css" media="all" />'; $a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="'.$a->get_baseurl().'/addon/impressum/impressum.css" media="all" />';
$b .= '<div class="clear"></div>'; $b .= '<div class="clear"></div>';
@ -58,8 +58,8 @@ function impressum_show($a,&$b) {
$b .= '<h3>'.L10n::t('Impressum').'</h3>'; $b .= '<h3>'.L10n::t('Impressum').'</h3>';
$owner = Config::get('impressum', 'owner'); $owner = Config::get('impressum', 'owner');
$owner_profile = Config::get('impressum','ownerprofile'); $owner_profile = Config::get('impressum','ownerprofile');
$postal = proxy_parse_html(BBCode::convert(Config::get('impressum', 'postal'))); $postal = ProxyUtils::proxifyHtml(BBCode::convert(Config::get('impressum', 'postal')));
$notes = proxy_parse_html(BBCode::convert(Config::get('impressum', 'notes'))); $notes = ProxyUtils::proxifyHtml(BBCode::convert(Config::get('impressum', 'notes')));
$email = obfuscate_email( Config::get('impressum','email') ); $email = obfuscate_email( Config::get('impressum','email') );
if (strlen($owner)) { if (strlen($owner)) {
if (strlen($owner_profile)) { if (strlen($owner_profile)) {

View file

@ -15,6 +15,7 @@ use Friendica\Core\Cache;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\Protocol; use Friendica\Core\Protocol;
use Friendica\Util\Network; use Friendica\Util\Network;
use Friendica\Util\Proxy as ProxyUtils;
function mastodoncustomemojis_install() function mastodoncustomemojis_install()
{ {
@ -88,7 +89,7 @@ function mastodoncustomemojis_get_custom_emojis_for_author($author_link)
if (is_array($emojis_array)) { if (is_array($emojis_array)) {
foreach ($emojis_array as $emoji) { foreach ($emojis_array as $emoji) {
$emojis['texts'][] = ':' . $emoji['shortcode'] . ':'; $emojis['texts'][] = ':' . $emoji['shortcode'] . ':';
$emojis['icons'][] = '<img class="emoji mastodon" src="' . proxy_url($emoji['static_url']) . '" alt=":' . $emoji['shortcode'] . ':" title=":' . $emoji['shortcode'] . ':"/>'; $emojis['icons'][] = '<img class="emoji mastodon" src="' . ProxyUtils::proxifyUrl($emoji['static_url']) . '" alt=":' . $emoji['shortcode'] . ':" title=":' . $emoji['shortcode'] . ':"/>';
} }
} }