From b5f14cb5594962700a5d77940168e02f3d566629 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Tue, 14 Jul 2020 10:17:17 -0400 Subject: [PATCH 01/46] [various] Replace *_page_info function calls with Content\PageInfo equivalent --- ifttt/ifttt.php | 5 +++-- statusnet/statusnet.php | 5 +++-- twitter/twitter.php | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/ifttt/ifttt.php b/ifttt/ifttt.php index 45ba2bf9a..6ecfc160a 100644 --- a/ifttt/ifttt.php +++ b/ifttt/ifttt.php @@ -8,6 +8,7 @@ */ require_once 'mod/item.php'; use Friendica\App; +use Friendica\Content\PageInfo; use Friendica\Core\Hook; use Friendica\Core\Logger; use Friendica\Core\Protocol; @@ -185,7 +186,7 @@ function ifttt_message($uid, $item) } if ($item['type'] == 'link') { - $data = query_page_info($item['link']); + $data = PageInfo::queryUrl($item['link']); if (isset($item['title']) && (trim($item['title']) != '')) { $data['title'] = $item['title']; @@ -195,7 +196,7 @@ function ifttt_message($uid, $item) $data['text'] = $item['description']; } - $_REQUEST['body'] .= add_page_info_data($data); + $_REQUEST['body'] .= "\n" . PageInfo::getFooterFromData($data); } elseif (($item['type'] == 'photo') && ($item['image'] != '')) { $_REQUEST['body'] .= "\n\n[img]" . $item['image'] . "[/img]\n"; } diff --git a/statusnet/statusnet.php b/statusnet/statusnet.php index f75d23460..f5bb7f42a 100644 --- a/statusnet/statusnet.php +++ b/statusnet/statusnet.php @@ -40,6 +40,7 @@ use CodebirdSN\CodebirdSN; use Friendica\App; use Friendica\Content\OEmbed; +use Friendica\Content\PageInfo; use Friendica\Content\Text\HTML; use Friendica\Content\Text\Plaintext; use Friendica\Core\Hook; @@ -896,7 +897,7 @@ function statusnet_fetchtimeline(App $a, $uid) $_REQUEST["title"] = ""; - $_REQUEST["body"] = add_page_info_to_body($post->text, true); + $_REQUEST["body"] = PageInfo::appendToBody($post->text, true); if (is_string($post->place->name)) { $_REQUEST["location"] = $post->place->name; } @@ -1494,7 +1495,7 @@ function statusnet_convertmsg(App $a, $body) } if ($footerurl != "") { - $footer = add_page_info($footerurl); + $footer = "\n" . PageInfo::getFooterFromUrl($footerurl); } if (($footerlink != "") && (trim($footer) != "")) { diff --git a/twitter/twitter.php b/twitter/twitter.php index 4c9701d84..4139bdb93 100644 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -67,6 +67,7 @@ use Codebird\Codebird; use Friendica\App; use Friendica\Content\OEmbed; +use Friendica\Content\PageInfo; use Friendica\Content\Text\BBCode; use Friendica\Content\Text\Plaintext; use Friendica\Core\Hook; @@ -1356,7 +1357,7 @@ function twitter_expand_entities($body, stdClass $status, $picture) if (empty($status->quoted_status)) { $footer = ''; if ($attachmentUrl) { - $footer = add_page_info($attachmentUrl, false, $picture); + $footer = "\n" . PageInfo::getFooterFromUrl($attachmentUrl, false, $picture); } if (trim($footer)) { @@ -1364,7 +1365,7 @@ function twitter_expand_entities($body, stdClass $status, $picture) } elseif ($picture) { $body .= "\n\n[img]" . $picture . "[/img]\n"; } else { - $body = add_page_info_to_body($body); + $body = PageInfo::appendToBody($body); } } From 5a3620513956fe7732af47ec71b7b0a7f6c29b99 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Tue, 14 Jul 2020 10:22:01 -0400 Subject: [PATCH 02/46] [pumpio] Remove references to include/items.php --- pumpio/pumpio.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/pumpio/pumpio.php b/pumpio/pumpio.php index 87e3344d0..567f64c8d 100644 --- a/pumpio/pumpio.php +++ b/pumpio/pumpio.php @@ -925,8 +925,6 @@ function pumpio_dounlike(App $a, $uid, $self, $post, $own_id) function pumpio_dolike(App $a, $uid, $self, $post, $own_id, $threadcompletion = true) { - require_once('include/items.php'); - if (empty($post->object->id)) { Logger::log('Got empty like: '.print_r($post, true), Logger::DEBUG); return; @@ -1096,8 +1094,6 @@ function pumpio_dodelete(App $a, $uid, $self, $post, $own_id) function pumpio_dopost(App $a, $client, $uid, $self, $post, $own_id, $threadcompletion = true) { - require_once('include/items.php'); - if (($post->verb == "like") || ($post->verb == "favorite")) { return pumpio_dolike($a, $uid, $self, $post, $own_id); } From f7cb9b3b81b59f2e22d9fa52101055f180ba8577 Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 16 Jul 2020 15:44:32 +0000 Subject: [PATCH 03/46] Changed default value for "getIDForURL" --- discourse/discourse.php | 4 ++-- twitter/twitter.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/discourse/discourse.php b/discourse/discourse.php index f684425a9..f42cb04c1 100644 --- a/discourse/discourse.php +++ b/discourse/discourse.php @@ -198,7 +198,7 @@ function discourse_get_user($post, $hostaddr) $contact['nurl'] = Strings::normaliseLink($contact['url']); $contact['baseurl'] = $hostaddr; Logger::info('Contact', $contact); - $contact['id'] = Contact::getIdForURL($contact['url'], 0, true, $contact); + $contact['id'] = Contact::getIdForURL($contact['url'], 0, false, $contact); if (!empty($contact['id'])) { $avatar = $contact['photo']; unset($contact['photo']); @@ -268,7 +268,7 @@ function discourse_get_html($message) $profile = discourse_get_profile($xpath); if (!empty($profile['url'])) { Logger::info('Found profile', $profile); - $message['item']['author-id'] = Contact::getIdForURL($profile['url'], 0, true, $profile); + $message['item']['author-id'] = Contact::getIdForURL($profile['url'], 0, false, $profile); $message['item']['author-link'] = $profile['url']; $message['item']['author-name'] = $profile['name']; $message['item']['author-avatar'] = $profile['photo']; diff --git a/twitter/twitter.php b/twitter/twitter.php index 4139bdb93..d374f1c35 100644 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -1127,7 +1127,7 @@ function twitter_fetch_contact($uid, $data, $create_user) if (DBA::isResult($pcontact)) { $cid = $pcontact['id']; } else { - $cid = Contact::getIdForURL($fields['url'], 0, true, $fields); + $cid = Contact::getIdForURL($fields['url'], 0, false, $fields); } if (!empty($cid)) { From a80e9154c522c609f2989ecfa55f709f3db08fbc Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sat, 18 Jul 2020 11:38:11 -0400 Subject: [PATCH 04/46] [various] Rename PageInfo::appendToBody to searchAndAppendToBody --- statusnet/statusnet.php | 2 +- twitter/twitter.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/statusnet/statusnet.php b/statusnet/statusnet.php index f5bb7f42a..0fd1fd79f 100644 --- a/statusnet/statusnet.php +++ b/statusnet/statusnet.php @@ -897,7 +897,7 @@ function statusnet_fetchtimeline(App $a, $uid) $_REQUEST["title"] = ""; - $_REQUEST["body"] = PageInfo::appendToBody($post->text, true); + $_REQUEST["body"] = PageInfo::searchAndAppendToBody($post->text, true); if (is_string($post->place->name)) { $_REQUEST["location"] = $post->place->name; } diff --git a/twitter/twitter.php b/twitter/twitter.php index d374f1c35..948bb6be6 100644 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -1365,11 +1365,11 @@ function twitter_expand_entities($body, stdClass $status, $picture) } elseif ($picture) { $body .= "\n\n[img]" . $picture . "[/img]\n"; } else { - $body = PageInfo::appendToBody($body); + $body = PageInfo::searchAndAppendToBody($body); } } - return ['body' => $body, 'plain' => $plain, 'taglist' => $taglist]; + return ['body' => $body, 'plain' => trim($plain), 'taglist' => $taglist]; } /** From 9640142a720dfc7683e7bbf60d6f4f8799b918e9 Mon Sep 17 00:00:00 2001 From: nupplaPhil Date: Wed, 4 Mar 2020 22:07:04 +0100 Subject: [PATCH 05/46] Move post/curl/fetchUrl/fetchUrlFull to own class "Network\HTTPRequest" --- blogger/blogger.php | 4 ++-- curweather/curweather.php | 4 ++-- discourse/discourse.php | 13 +++++++------ dwpost/dwpost.php | 4 ++-- geocoordinates/geocoordinates.php | 5 +++-- geonames/geonames.php | 4 ++-- ijpost/ijpost.php | 4 ++-- jappixmini/jappixmini.php | 4 ++-- leistungsschutzrecht/leistungsschutzrecht.php | 5 +++-- libertree/libertree.php | 4 ++-- ljpost/ljpost.php | 4 ++-- mailstream/mailstream.php | 6 +++--- mastodoncustomemojis/mastodoncustomemojis.php | 4 ++-- openstreetmap/openstreetmap.php | 6 +++--- pumpio/pumpio.php | 4 ++-- statusnet/statusnet.php | 11 ++++++----- twitter/twitter.php | 5 +++-- wppost/wppost.php | 4 ++-- 18 files changed, 50 insertions(+), 45 deletions(-) diff --git a/blogger/blogger.php b/blogger/blogger.php index e0b5f5352..f17f1b1e9 100644 --- a/blogger/blogger.php +++ b/blogger/blogger.php @@ -11,7 +11,7 @@ use Friendica\Core\Hook; use Friendica\Core\Logger; use Friendica\DI; -use Friendica\Util\Network; +use Friendica\Network\HTTPRequest; use Friendica\Util\XML; function blogger_install() @@ -225,7 +225,7 @@ function blogger_send(App $a, array &$b) Logger::log('blogger: data: ' . $xml, Logger::DATA); if ($bl_blog !== 'test') { - $x = Network::post($bl_blog, $xml)->getBody(); + $x = HTTPRequest::post($bl_blog, $xml)->getBody(); } Logger::log('posted to blogger: ' . (($x) ? $x : ''), Logger::DEBUG); diff --git a/curweather/curweather.php b/curweather/curweather.php index e4b6119f9..017a67fa9 100644 --- a/curweather/curweather.php +++ b/curweather/curweather.php @@ -15,7 +15,7 @@ use Friendica\Core\Renderer; use Friendica\Core\Session; use Friendica\DI; -use Friendica\Util\Network; +use Friendica\Network\HTTPRequest; use Friendica\Util\Proxy as ProxyUtils; function curweather_install() @@ -49,7 +49,7 @@ function getWeather($loc, $units = 'metric', $lang = 'en', $appid = '', $cacheti } try { - $res = new SimpleXMLElement(Network::fetchUrl($url)); + $res = new SimpleXMLElement(HTTPRequest::fetchUrl($url)); } catch (Exception $e) { if (empty($_SESSION['curweather_notice_shown'])) { info(DI::l10n()->t('Error fetching weather data. Error was: '.$e->getMessage())); diff --git a/discourse/discourse.php b/discourse/discourse.php index f42cb04c1..06b866776 100644 --- a/discourse/discourse.php +++ b/discourse/discourse.php @@ -7,18 +7,19 @@ * Author: Michael Vogel * */ + use Friendica\App; +use Friendica\Content\Text\Markdown; use Friendica\Core\Hook; use Friendica\Core\Logger; -use Friendica\Core\Renderer; use Friendica\Core\Protocol; +use Friendica\Core\Renderer; use Friendica\Database\DBA; use Friendica\DI; use Friendica\Model\Contact; -use Friendica\Content\Text\Markdown; -use Friendica\Util\Network; +use Friendica\Network\HTTPRequest; +use Friendica\Util\DateTimeFormat; use Friendica\Util\Strings; -Use Friendica\Util\DateTimeFormat; /* Todo: * - Obtaining API tokens to be able to read non public posts as well @@ -114,7 +115,7 @@ function discourse_email_getmessage(App $a, &$message) function discourse_fetch_post($host, $topic, $pid) { $url = $host . '/t/' . $topic . '/' . $pid . '.json'; - $curlResult = Network::curl($url); + $curlResult = HTTPRequest::curl($url); if (!$curlResult->isSuccess()) { Logger::info('No success', ['url' => $url]); return false; @@ -151,7 +152,7 @@ function discourse_fetch_post_from_api(&$message, $post, $host) { $hostaddr = 'https://' . $host; $url = $hostaddr . '/posts/' . $post . '.json'; - $curlResult = Network::curl($url); + $curlResult = HTTPRequest::curl($url); if (!$curlResult->isSuccess()) { return false; } diff --git a/dwpost/dwpost.php b/dwpost/dwpost.php index 3d4b42ad8..bb45dd14e 100644 --- a/dwpost/dwpost.php +++ b/dwpost/dwpost.php @@ -15,8 +15,8 @@ use Friendica\Database\DBA; use Friendica\DI; use Friendica\Model\Tag; +use Friendica\Network\HTTPRequest; use Friendica\Util\DateTimeFormat; -use Friendica\Util\Network; use Friendica\Util\XML; function dwpost_install() @@ -231,7 +231,7 @@ function dwpost_send(App $a, array &$b) Logger::log('dwpost: data: ' . $xml, Logger::DATA); if ($dw_blog !== 'test') { - $x = Network::post($dw_blog, $xml, ["Content-Type: text/xml"])->getBody(); + $x = HTTPRequest::post($dw_blog, $xml, ["Content-Type: text/xml"])->getBody(); } Logger::log('posted to dreamwidth: ' . ($x) ? $x : '', Logger::DEBUG); diff --git a/geocoordinates/geocoordinates.php b/geocoordinates/geocoordinates.php index 7a7a6d9ad..a36cc1149 100644 --- a/geocoordinates/geocoordinates.php +++ b/geocoordinates/geocoordinates.php @@ -5,11 +5,12 @@ * Version: 0.1 * Author: Michael Vogel */ + use Friendica\Core\Hook; use Friendica\Core\Logger; use Friendica\Core\Renderer; use Friendica\DI; -use Friendica\Util\Network; +use Friendica\Network\HTTPRequest; use Friendica\Util\Strings; function geocoordinates_install() @@ -52,7 +53,7 @@ function geocoordinates_resolve_item(&$item) return; } - $s = Network::fetchUrl("https://api.opencagedata.com/geocode/v1/json?q=".$coords[0].",".$coords[1]."&key=".$key."&language=".$language); + $s = HTTPRequest::fetchUrl("https://api.opencagedata.com/geocode/v1/json?q=" . $coords[0] . "," . $coords[1] . "&key=" . $key . "&language=" . $language); if (!$s) { Logger::log("API could not be queried", Logger::DEBUG); diff --git a/geonames/geonames.php b/geonames/geonames.php index e6962d764..9a01980e7 100644 --- a/geonames/geonames.php +++ b/geonames/geonames.php @@ -11,8 +11,8 @@ use Friendica\Core\Logger; use Friendica\Core\Renderer; use Friendica\DI; +use Friendica\Network\HTTPRequest; use Friendica\Util\ConfigFileLoader; -use Friendica\Util\Network; use Friendica\Util\XML; function geonames_install() @@ -78,7 +78,7 @@ function geonames_post_hook(App $a, array &$item) /* OK, we're allowed to do our stuff. */ - $s = Network::fetchUrl('http://api.geonames.org/findNearbyPlaceName?lat=' . $coords[0] . '&lng=' . $coords[1] . '&username=' . $geo_account); + $s = HTTPRequest::fetchUrl('http://api.geonames.org/findNearbyPlaceName?lat=' . $coords[0] . '&lng=' . $coords[1] . '&username=' . $geo_account); if (!$s) { return; diff --git a/ijpost/ijpost.php b/ijpost/ijpost.php index 00479e3e0..1c6b9509f 100644 --- a/ijpost/ijpost.php +++ b/ijpost/ijpost.php @@ -13,8 +13,8 @@ use Friendica\Core\Logger; use Friendica\DI; use Friendica\Model\Tag; +use Friendica\Network\HTTPRequest; use Friendica\Util\DateTimeFormat; -use Friendica\Util\Network; use Friendica\Util\XML; function ijpost_install() @@ -229,7 +229,7 @@ function ijpost_send(&$a, &$b) Logger::log('ijpost: data: ' . $xml, Logger::DATA); if ($ij_blog !== 'test') { - $x = Network::post($ij_blog, $xml, ["Content-Type: text/xml"])->getBody(); + $x = HTTPRequest::post($ij_blog, $xml, ["Content-Type: text/xml"])->getBody(); } Logger::log('posted to insanejournal: ' . $x ? $x : '', Logger::DEBUG); } diff --git a/jappixmini/jappixmini.php b/jappixmini/jappixmini.php index ad4d49014..908870bb0 100644 --- a/jappixmini/jappixmini.php +++ b/jappixmini/jappixmini.php @@ -69,7 +69,7 @@ use Friendica\Database\DBA; use Friendica\DI; use Friendica\Model\User; -use Friendica\Util\Network; +use Friendica\Network\HTTPRequest; function jappixmini_install() { @@ -660,7 +660,7 @@ function jappixmini_cron(App $a, $d) try { // send request - $answer_json = Network::fetchUrl($url); + $answer_json = HTTPRequest::fetchUrl($url); // parse answer $answer = json_decode($answer_json); diff --git a/leistungsschutzrecht/leistungsschutzrecht.php b/leistungsschutzrecht/leistungsschutzrecht.php index 8bb6f526b..142661a69 100644 --- a/leistungsschutzrecht/leistungsschutzrecht.php +++ b/leistungsschutzrecht/leistungsschutzrecht.php @@ -5,10 +5,11 @@ * Version: 0.1 * Author: Michael Vogel */ + use Friendica\Core\Hook; use Friendica\Core\Logger; use Friendica\DI; -use Friendica\Util\Network; +use Friendica\Network\HTTPRequest; function leistungsschutzrecht_install() { Hook::register('cron', 'addon/leistungsschutzrecht/leistungsschutzrecht.php', 'leistungsschutzrecht_cron'); @@ -79,7 +80,7 @@ function leistungsschutzrecht_fetchsites() { // This list works - but question is how current it is $url = "http://leistungsschutzrecht-stoppen.d-64.org/blacklist.txt"; - $sitelist = Network::fetchUrl($url); + $sitelist = HTTPRequest::fetchUrl($url); $siteurls = explode(',', $sitelist); $whitelist = ['tagesschau.de', 'heute.de', 'wdr.de']; diff --git a/libertree/libertree.php b/libertree/libertree.php index 01a9d9420..23442da20 100644 --- a/libertree/libertree.php +++ b/libertree/libertree.php @@ -12,7 +12,7 @@ use Friendica\Core\Logger; use Friendica\Database\DBA; use Friendica\DI; -use Friendica\Util\Network; +use Friendica\Network\HTTPRequest; function libertree_install() { @@ -243,7 +243,7 @@ function libertree_send(&$a,&$b) { // 'token' => $ltree_api_token ]; - $result = Network::post($ltree_blog, $params)->getBody(); + $result = HTTPRequest::post($ltree_blog, $params)->getBody(); Logger::log('libertree: ' . $result); } } diff --git a/ljpost/ljpost.php b/ljpost/ljpost.php index 5120612d0..4420775a8 100644 --- a/ljpost/ljpost.php +++ b/ljpost/ljpost.php @@ -13,8 +13,8 @@ use Friendica\Core\Logger; use Friendica\DI; use Friendica\Model\Tag; +use Friendica\Network\HTTPRequest; use Friendica\Util\DateTimeFormat; -use Friendica\Util\Network; use Friendica\Util\XML; function ljpost_install() { @@ -241,7 +241,7 @@ function ljpost_send(&$a,&$b) { Logger::log('ljpost: data: ' . $xml, Logger::DATA); if ($lj_blog !== 'test') { - $x = Network::post($lj_blog, $xml, ["Content-Type: text/xml"])->getBody(); + $x = HTTPRequest::post($lj_blog, $xml, ["Content-Type: text/xml"])->getBody(); } Logger::log('posted to livejournal: ' . ($x) ? $x : '', Logger::DEBUG); } diff --git a/mailstream/mailstream.php b/mailstream/mailstream.php index 89e6cc014..dbc9c4f08 100644 --- a/mailstream/mailstream.php +++ b/mailstream/mailstream.php @@ -12,9 +12,9 @@ use Friendica\Core\Renderer; use Friendica\Database\DBA; use Friendica\DI; -use Friendica\Protocol\Activity; -use Friendica\Util\Network; use Friendica\Model\Item; +use Friendica\Network\HTTPRequest; +use Friendica\Protocol\Activity; function mailstream_install() { Hook::register('addon_settings', 'addon/mailstream/mailstream.php', 'mailstream_addon_settings'); @@ -169,7 +169,7 @@ function mailstream_do_images($a, &$item, &$attachments) { continue; } $cookiejar = tempnam(get_temppath(), 'cookiejar-mailstream-'); - $curlResult = Network::fetchUrlFull($url, true, 0, '', $cookiejar); + $curlResult = HTTPRequest::fetchUrlFull($url, true, 0, '', $cookiejar); $attachments[$url] = [ 'data' => $curlResult->getBody(), 'guid' => hash("crc32", $url), diff --git a/mastodoncustomemojis/mastodoncustomemojis.php b/mastodoncustomemojis/mastodoncustomemojis.php index a6c95d340..a0c06b97c 100644 --- a/mastodoncustomemojis/mastodoncustomemojis.php +++ b/mastodoncustomemojis/mastodoncustomemojis.php @@ -15,7 +15,7 @@ use Friendica\Core\Hook; use Friendica\Core\Protocol; use Friendica\DI; -use Friendica\Util\Network; +use Friendica\Network\HTTPRequest; use Friendica\Util\Proxy as ProxyUtils; function mastodoncustomemojis_install() @@ -90,7 +90,7 @@ function mastodoncustomemojis_fetch_custom_emojis_for_url($api_base_url) $api_url = $api_base_url . '/api/v1/custom_emojis'; - $fetchResult = Network::fetchUrlFull($api_url); + $fetchResult = HTTPRequest::fetchUrlFull($api_url); if ($fetchResult->isSuccess()) { $emojis_array = json_decode($fetchResult->getBody(), true); diff --git a/openstreetmap/openstreetmap.php b/openstreetmap/openstreetmap.php index 5df1c7d7d..370eb9104 100644 --- a/openstreetmap/openstreetmap.php +++ b/openstreetmap/openstreetmap.php @@ -9,13 +9,13 @@ * */ -use Friendica\DI; use Friendica\Core\Cache\Duration; use Friendica\Core\Hook; use Friendica\Core\Logger; use Friendica\Core\Renderer; +use Friendica\DI; +use Friendica\Network\HTTPRequest; use Friendica\Util\ConfigFileLoader; -use Friendica\Util\Network; use Friendica\Util\Strings; const OSM_TMS = 'https://www.openstreetmap.org'; @@ -132,7 +132,7 @@ function openstreetmap_get_coordinates($a, &$b) $j = DI::cache()->get($cachekey); if (is_null($j)) { - $curlResult = Network::curl($nomserver . $args); + $curlResult = HTTPRequest::curl($nomserver . $args); if ($curlResult->isSuccess()) { $j = json_decode($curlResult->getBody(), true); DI::cache()->set($cachekey, $j, Duration::MONTH); diff --git a/pumpio/pumpio.php b/pumpio/pumpio.php index 567f64c8d..c58667b2e 100644 --- a/pumpio/pumpio.php +++ b/pumpio/pumpio.php @@ -19,11 +19,11 @@ use Friendica\Model\Group; use Friendica\Model\Item; use Friendica\Model\User; +use Friendica\Network\HTTPRequest; use Friendica\Protocol\Activity; use Friendica\Protocol\ActivityNamespace; use Friendica\Util\ConfigFileLoader; use Friendica\Util\DateTimeFormat; -use Friendica\Util\Network; use Friendica\Util\Strings; use Friendica\Util\XML; @@ -1605,7 +1605,7 @@ function pumpio_fetchallcomments(App $a, $uid, $id) function pumpio_reachable($url) { - return Network::curl($url, false, ['timeout' => 10])->isSuccess(); + return HTTPRequest::curl($url, false, ['timeout' => 10])->isSuccess(); } /* diff --git a/statusnet/statusnet.php b/statusnet/statusnet.php index 0fd1fd79f..49ba2e452 100644 --- a/statusnet/statusnet.php +++ b/statusnet/statusnet.php @@ -55,6 +55,7 @@ use Friendica\Model\ItemContent; use Friendica\Model\Photo; use Friendica\Model\User; +use Friendica\Network\HTTPRequest; use Friendica\Protocol\Activity; use Friendica\Util\DateTimeFormat; use Friendica\Util\Network; @@ -155,7 +156,7 @@ function statusnet_settings_post(App $a, $post) foreach ($globalsn as $asn) { if ($asn['apiurl'] == $_POST['statusnet-preconf-apiurl']) { $apibase = $asn['apiurl']; - $c = Network::fetchUrl($apibase . 'statusnet/version.xml'); + $c = HTTPRequest::fetchUrl($apibase . 'statusnet/version.xml'); if (strlen($c) > 0) { DI::pConfig()->set(local_user(), 'statusnet', 'consumerkey', $asn['consumerkey']); DI::pConfig()->set(local_user(), 'statusnet', 'consumersecret', $asn['consumersecret']); @@ -173,7 +174,7 @@ function statusnet_settings_post(App $a, $post) // we'll check the API Version for that, if we don't get one we'll try to fix the path but will // resign quickly after this one try to fix the path ;-) $apibase = $_POST['statusnet-baseapi']; - $c = Network::fetchUrl($apibase . 'statusnet/version.xml'); + $c = HTTPRequest::fetchUrl($apibase . 'statusnet/version.xml'); if (strlen($c) > 0) { // ok the API path is correct, let's save the settings DI::pConfig()->set(local_user(), 'statusnet', 'consumerkey', $_POST['statusnet-consumerkey']); @@ -183,7 +184,7 @@ function statusnet_settings_post(App $a, $post) } else { // the API path is not correct, maybe missing trailing / ? $apibase = $apibase . '/'; - $c = Network::fetchUrl($apibase . 'statusnet/version.xml'); + $c = HTTPRequest::fetchUrl($apibase . 'statusnet/version.xml'); if (strlen($c) > 0) { // ok the API path is now correct, let's save the settings DI::pConfig()->set(local_user(), 'statusnet', 'consumerkey', $_POST['statusnet-consumerkey']); @@ -613,7 +614,7 @@ function statusnet_post_hook(App $a, &$b) } if ($image != "") { - $img_str = Network::fetchUrl($image); + $img_str = HTTPRequest::fetchUrl($image); $tempfile = tempnam(get_temppath(), "cache"); file_put_contents($tempfile, $img_str); $postdata = ["status" => $msg, "media[]" => $tempfile]; @@ -1474,7 +1475,7 @@ function statusnet_convertmsg(App $a, $body) } elseif ($oembed_data->type != "link") { $body = str_replace($search, "[url=" . $expanded_url . "]" . $expanded_url . "[/url]", $body); } else { - $img_str = Network::fetchUrl($expanded_url, true, 4); + $img_str = HTTPRequest::fetchUrl($expanded_url, true, 4); $tempfile = tempnam(get_temppath(), "cache"); file_put_contents($tempfile, $img_str); diff --git a/twitter/twitter.php b/twitter/twitter.php index 948bb6be6..85647dea6 100644 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -85,6 +85,7 @@ use Friendica\Model\ItemURI; use Friendica\Model\Tag; use Friendica\Model\User; +use Friendica\Network\HTTPRequest; use Friendica\Protocol\Activity; use Friendica\Util\ConfigFileLoader; use Friendica\Util\DateTimeFormat; @@ -674,7 +675,7 @@ function (array $attributes, array $author_contact, $content, $is_quote_share) { continue; } - $img_str = Network::fetchUrl($image['url']); + $img_str = HTTPRequest::fetchUrl($image['url']); $tempfile = tempnam(get_temppath(), 'cache'); file_put_contents($tempfile, $img_str); @@ -1318,7 +1319,7 @@ function twitter_expand_entities($body, stdClass $status, $picture) } elseif ($oembed_data->type != 'link') { $replace = '[url=' . $expanded_url . ']' . $url->display_url . '[/url]'; } else { - $img_str = Network::fetchUrl($final_url, true, 4); + $img_str = HTTPRequest::fetchUrl($final_url, true, 4); $tempfile = tempnam(get_temppath(), 'cache'); file_put_contents($tempfile, $img_str); diff --git a/wppost/wppost.php b/wppost/wppost.php index 4d32c7904..0d860ef57 100644 --- a/wppost/wppost.php +++ b/wppost/wppost.php @@ -12,7 +12,7 @@ use Friendica\Core\Logger; use Friendica\Database\DBA; use Friendica\DI; -use Friendica\Util\Network; +use Friendica\Network\HTTPRequest; use Friendica\Util\Strings; use Friendica\Util\XML; @@ -338,7 +338,7 @@ function wppost_send(&$a, &$b) Logger::log('wppost: data: ' . $xml, Logger::DATA); if ($wp_blog !== 'test') { - $x = Network::post($wp_blog, $xml)->getBody(); + $x = HTTPRequest::post($wp_blog, $xml)->getBody(); } Logger::log('posted to wordpress: ' . (($x) ? $x : ''), Logger::DEBUG); } From 688c556739ce4b55fac78c574a0b16154411049c Mon Sep 17 00:00:00 2001 From: nupplaPhil Date: Wed, 4 Mar 2020 22:15:45 +0100 Subject: [PATCH 06/46] Make "HTTPRequest::curl" dynamic --- discourse/discourse.php | 5 ++--- openstreetmap/openstreetmap.php | 3 +-- pumpio/pumpio.php | 3 +-- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/discourse/discourse.php b/discourse/discourse.php index 06b866776..5e64c173e 100644 --- a/discourse/discourse.php +++ b/discourse/discourse.php @@ -17,7 +17,6 @@ use Friendica\Database\DBA; use Friendica\DI; use Friendica\Model\Contact; -use Friendica\Network\HTTPRequest; use Friendica\Util\DateTimeFormat; use Friendica\Util\Strings; @@ -115,7 +114,7 @@ function discourse_email_getmessage(App $a, &$message) function discourse_fetch_post($host, $topic, $pid) { $url = $host . '/t/' . $topic . '/' . $pid . '.json'; - $curlResult = HTTPRequest::curl($url); + $curlResult = DI::httpRequest()->curl($url); if (!$curlResult->isSuccess()) { Logger::info('No success', ['url' => $url]); return false; @@ -152,7 +151,7 @@ function discourse_fetch_post_from_api(&$message, $post, $host) { $hostaddr = 'https://' . $host; $url = $hostaddr . '/posts/' . $post . '.json'; - $curlResult = HTTPRequest::curl($url); + $curlResult = DI::httpRequest()->curl($url); if (!$curlResult->isSuccess()) { return false; } diff --git a/openstreetmap/openstreetmap.php b/openstreetmap/openstreetmap.php index 370eb9104..ede71ccd4 100644 --- a/openstreetmap/openstreetmap.php +++ b/openstreetmap/openstreetmap.php @@ -14,7 +14,6 @@ use Friendica\Core\Logger; use Friendica\Core\Renderer; use Friendica\DI; -use Friendica\Network\HTTPRequest; use Friendica\Util\ConfigFileLoader; use Friendica\Util\Strings; @@ -132,7 +131,7 @@ function openstreetmap_get_coordinates($a, &$b) $j = DI::cache()->get($cachekey); if (is_null($j)) { - $curlResult = HTTPRequest::curl($nomserver . $args); + $curlResult = DI::httpRequest()->curl($nomserver . $args); if ($curlResult->isSuccess()) { $j = json_decode($curlResult->getBody(), true); DI::cache()->set($cachekey, $j, Duration::MONTH); diff --git a/pumpio/pumpio.php b/pumpio/pumpio.php index c58667b2e..d85902841 100644 --- a/pumpio/pumpio.php +++ b/pumpio/pumpio.php @@ -19,7 +19,6 @@ use Friendica\Model\Group; use Friendica\Model\Item; use Friendica\Model\User; -use Friendica\Network\HTTPRequest; use Friendica\Protocol\Activity; use Friendica\Protocol\ActivityNamespace; use Friendica\Util\ConfigFileLoader; @@ -1605,7 +1604,7 @@ function pumpio_fetchallcomments(App $a, $uid, $id) function pumpio_reachable($url) { - return HTTPRequest::curl($url, false, ['timeout' => 10])->isSuccess(); + return DI::httpRequest()->curl($url, false, ['timeout' => 10])->isSuccess(); } /* From 20056dc79567248394381a16cc8dd886054d4fc0 Mon Sep 17 00:00:00 2001 From: nupplaPhil Date: Wed, 4 Mar 2020 22:18:27 +0100 Subject: [PATCH 07/46] Make "HTTPRequest::post" dynamic --- blogger/blogger.php | 3 +-- dwpost/dwpost.php | 3 +-- ijpost/ijpost.php | 3 +-- libertree/libertree.php | 3 +-- ljpost/ljpost.php | 3 +-- wppost/wppost.php | 3 +-- 6 files changed, 6 insertions(+), 12 deletions(-) diff --git a/blogger/blogger.php b/blogger/blogger.php index f17f1b1e9..0d201305f 100644 --- a/blogger/blogger.php +++ b/blogger/blogger.php @@ -11,7 +11,6 @@ use Friendica\Core\Hook; use Friendica\Core\Logger; use Friendica\DI; -use Friendica\Network\HTTPRequest; use Friendica\Util\XML; function blogger_install() @@ -225,7 +224,7 @@ function blogger_send(App $a, array &$b) Logger::log('blogger: data: ' . $xml, Logger::DATA); if ($bl_blog !== 'test') { - $x = HTTPRequest::post($bl_blog, $xml)->getBody(); + $x = DI::httpRequest()->post($bl_blog, $xml)->getBody(); } Logger::log('posted to blogger: ' . (($x) ? $x : ''), Logger::DEBUG); diff --git a/dwpost/dwpost.php b/dwpost/dwpost.php index bb45dd14e..9a973b672 100644 --- a/dwpost/dwpost.php +++ b/dwpost/dwpost.php @@ -15,7 +15,6 @@ use Friendica\Database\DBA; use Friendica\DI; use Friendica\Model\Tag; -use Friendica\Network\HTTPRequest; use Friendica\Util\DateTimeFormat; use Friendica\Util\XML; @@ -231,7 +230,7 @@ function dwpost_send(App $a, array &$b) Logger::log('dwpost: data: ' . $xml, Logger::DATA); if ($dw_blog !== 'test') { - $x = HTTPRequest::post($dw_blog, $xml, ["Content-Type: text/xml"])->getBody(); + $x = DI::httpRequest()->post($dw_blog, $xml, ["Content-Type: text/xml"])->getBody(); } Logger::log('posted to dreamwidth: ' . ($x) ? $x : '', Logger::DEBUG); diff --git a/ijpost/ijpost.php b/ijpost/ijpost.php index 1c6b9509f..0619c288a 100644 --- a/ijpost/ijpost.php +++ b/ijpost/ijpost.php @@ -13,7 +13,6 @@ use Friendica\Core\Logger; use Friendica\DI; use Friendica\Model\Tag; -use Friendica\Network\HTTPRequest; use Friendica\Util\DateTimeFormat; use Friendica\Util\XML; @@ -229,7 +228,7 @@ function ijpost_send(&$a, &$b) Logger::log('ijpost: data: ' . $xml, Logger::DATA); if ($ij_blog !== 'test') { - $x = HTTPRequest::post($ij_blog, $xml, ["Content-Type: text/xml"])->getBody(); + $x = DI::httpRequest()->post($ij_blog, $xml, ["Content-Type: text/xml"])->getBody(); } Logger::log('posted to insanejournal: ' . $x ? $x : '', Logger::DEBUG); } diff --git a/libertree/libertree.php b/libertree/libertree.php index 23442da20..dfa492235 100644 --- a/libertree/libertree.php +++ b/libertree/libertree.php @@ -12,7 +12,6 @@ use Friendica\Core\Logger; use Friendica\Database\DBA; use Friendica\DI; -use Friendica\Network\HTTPRequest; function libertree_install() { @@ -243,7 +242,7 @@ function libertree_send(&$a,&$b) { // 'token' => $ltree_api_token ]; - $result = HTTPRequest::post($ltree_blog, $params)->getBody(); + $result = DI::httpRequest()->post($ltree_blog, $params)->getBody(); Logger::log('libertree: ' . $result); } } diff --git a/ljpost/ljpost.php b/ljpost/ljpost.php index 4420775a8..a98087c2d 100644 --- a/ljpost/ljpost.php +++ b/ljpost/ljpost.php @@ -13,7 +13,6 @@ use Friendica\Core\Logger; use Friendica\DI; use Friendica\Model\Tag; -use Friendica\Network\HTTPRequest; use Friendica\Util\DateTimeFormat; use Friendica\Util\XML; @@ -241,7 +240,7 @@ function ljpost_send(&$a,&$b) { Logger::log('ljpost: data: ' . $xml, Logger::DATA); if ($lj_blog !== 'test') { - $x = HTTPRequest::post($lj_blog, $xml, ["Content-Type: text/xml"])->getBody(); + $x = DI::httpRequest()->post($lj_blog, $xml, ["Content-Type: text/xml"])->getBody(); } Logger::log('posted to livejournal: ' . ($x) ? $x : '', Logger::DEBUG); } diff --git a/wppost/wppost.php b/wppost/wppost.php index 0d860ef57..8cd134109 100644 --- a/wppost/wppost.php +++ b/wppost/wppost.php @@ -12,7 +12,6 @@ use Friendica\Core\Logger; use Friendica\Database\DBA; use Friendica\DI; -use Friendica\Network\HTTPRequest; use Friendica\Util\Strings; use Friendica\Util\XML; @@ -338,7 +337,7 @@ function wppost_send(&$a, &$b) Logger::log('wppost: data: ' . $xml, Logger::DATA); if ($wp_blog !== 'test') { - $x = HTTPRequest::post($wp_blog, $xml)->getBody(); + $x = DI::httpRequest()->post($wp_blog, $xml)->getBody(); } Logger::log('posted to wordpress: ' . (($x) ? $x : ''), Logger::DEBUG); } From fed6e3cde19ae2f864bb378fd484b96fac56ca05 Mon Sep 17 00:00:00 2001 From: nupplaPhil Date: Wed, 4 Mar 2020 22:19:59 +0100 Subject: [PATCH 08/46] Make "HTTPRequest::fetchUrlFull" dynamic --- mailstream/mailstream.php | 2 +- mastodoncustomemojis/mastodoncustomemojis.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mailstream/mailstream.php b/mailstream/mailstream.php index dbc9c4f08..4eaa5704c 100644 --- a/mailstream/mailstream.php +++ b/mailstream/mailstream.php @@ -169,7 +169,7 @@ function mailstream_do_images($a, &$item, &$attachments) { continue; } $cookiejar = tempnam(get_temppath(), 'cookiejar-mailstream-'); - $curlResult = HTTPRequest::fetchUrlFull($url, true, 0, '', $cookiejar); + $curlResult = DI::httpRequest()->fetchUrlFull($url, true, 0, '', $cookiejar); $attachments[$url] = [ 'data' => $curlResult->getBody(), 'guid' => hash("crc32", $url), diff --git a/mastodoncustomemojis/mastodoncustomemojis.php b/mastodoncustomemojis/mastodoncustomemojis.php index a0c06b97c..537cf46e3 100644 --- a/mastodoncustomemojis/mastodoncustomemojis.php +++ b/mastodoncustomemojis/mastodoncustomemojis.php @@ -90,7 +90,7 @@ function mastodoncustomemojis_fetch_custom_emojis_for_url($api_base_url) $api_url = $api_base_url . '/api/v1/custom_emojis'; - $fetchResult = HTTPRequest::fetchUrlFull($api_url); + $fetchResult = DI::httpRequest()->fetchUrlFull($api_url); if ($fetchResult->isSuccess()) { $emojis_array = json_decode($fetchResult->getBody(), true); From 40ff1d7fda9bde44420e4145bbca370664a97bbc Mon Sep 17 00:00:00 2001 From: nupplaPhil Date: Wed, 4 Mar 2020 22:20:27 +0100 Subject: [PATCH 09/46] Make "HTTPRequest::fetchUrl" dynamic --- curweather/curweather.php | 3 +-- geocoordinates/geocoordinates.php | 3 +-- geonames/geonames.php | 3 +-- jappixmini/jappixmini.php | 3 +-- leistungsschutzrecht/leistungsschutzrecht.php | 3 +-- statusnet/statusnet.php | 11 +++++------ twitter/twitter.php | 5 ++--- 7 files changed, 12 insertions(+), 19 deletions(-) diff --git a/curweather/curweather.php b/curweather/curweather.php index 017a67fa9..7757dba7e 100644 --- a/curweather/curweather.php +++ b/curweather/curweather.php @@ -15,7 +15,6 @@ use Friendica\Core\Renderer; use Friendica\Core\Session; use Friendica\DI; -use Friendica\Network\HTTPRequest; use Friendica\Util\Proxy as ProxyUtils; function curweather_install() @@ -49,7 +48,7 @@ function getWeather($loc, $units = 'metric', $lang = 'en', $appid = '', $cacheti } try { - $res = new SimpleXMLElement(HTTPRequest::fetchUrl($url)); + $res = new SimpleXMLElement(DI::httpRequest()->fetchUrl($url)); } catch (Exception $e) { if (empty($_SESSION['curweather_notice_shown'])) { info(DI::l10n()->t('Error fetching weather data. Error was: '.$e->getMessage())); diff --git a/geocoordinates/geocoordinates.php b/geocoordinates/geocoordinates.php index a36cc1149..8641d2236 100644 --- a/geocoordinates/geocoordinates.php +++ b/geocoordinates/geocoordinates.php @@ -10,7 +10,6 @@ use Friendica\Core\Logger; use Friendica\Core\Renderer; use Friendica\DI; -use Friendica\Network\HTTPRequest; use Friendica\Util\Strings; function geocoordinates_install() @@ -53,7 +52,7 @@ function geocoordinates_resolve_item(&$item) return; } - $s = HTTPRequest::fetchUrl("https://api.opencagedata.com/geocode/v1/json?q=" . $coords[0] . "," . $coords[1] . "&key=" . $key . "&language=" . $language); + $s = DI::httpRequest()->fetchUrl("https://api.opencagedata.com/geocode/v1/json?q=" . $coords[0] . "," . $coords[1] . "&key=" . $key . "&language=" . $language); if (!$s) { Logger::log("API could not be queried", Logger::DEBUG); diff --git a/geonames/geonames.php b/geonames/geonames.php index 9a01980e7..28d716b5e 100644 --- a/geonames/geonames.php +++ b/geonames/geonames.php @@ -11,7 +11,6 @@ use Friendica\Core\Logger; use Friendica\Core\Renderer; use Friendica\DI; -use Friendica\Network\HTTPRequest; use Friendica\Util\ConfigFileLoader; use Friendica\Util\XML; @@ -78,7 +77,7 @@ function geonames_post_hook(App $a, array &$item) /* OK, we're allowed to do our stuff. */ - $s = HTTPRequest::fetchUrl('http://api.geonames.org/findNearbyPlaceName?lat=' . $coords[0] . '&lng=' . $coords[1] . '&username=' . $geo_account); + $s = DI::httpRequest()->fetchUrl('http://api.geonames.org/findNearbyPlaceName?lat=' . $coords[0] . '&lng=' . $coords[1] . '&username=' . $geo_account); if (!$s) { return; diff --git a/jappixmini/jappixmini.php b/jappixmini/jappixmini.php index 908870bb0..52ae56d07 100644 --- a/jappixmini/jappixmini.php +++ b/jappixmini/jappixmini.php @@ -69,7 +69,6 @@ use Friendica\Database\DBA; use Friendica\DI; use Friendica\Model\User; -use Friendica\Network\HTTPRequest; function jappixmini_install() { @@ -660,7 +659,7 @@ function jappixmini_cron(App $a, $d) try { // send request - $answer_json = HTTPRequest::fetchUrl($url); + $answer_json = DI::httpRequest()->fetchUrl($url); // parse answer $answer = json_decode($answer_json); diff --git a/leistungsschutzrecht/leistungsschutzrecht.php b/leistungsschutzrecht/leistungsschutzrecht.php index 142661a69..9bd1a68d0 100644 --- a/leistungsschutzrecht/leistungsschutzrecht.php +++ b/leistungsschutzrecht/leistungsschutzrecht.php @@ -9,7 +9,6 @@ use Friendica\Core\Hook; use Friendica\Core\Logger; use Friendica\DI; -use Friendica\Network\HTTPRequest; function leistungsschutzrecht_install() { Hook::register('cron', 'addon/leistungsschutzrecht/leistungsschutzrecht.php', 'leistungsschutzrecht_cron'); @@ -80,7 +79,7 @@ function leistungsschutzrecht_fetchsites() { // This list works - but question is how current it is $url = "http://leistungsschutzrecht-stoppen.d-64.org/blacklist.txt"; - $sitelist = HTTPRequest::fetchUrl($url); + $sitelist = DI::httpRequest()->fetchUrl($url); $siteurls = explode(',', $sitelist); $whitelist = ['tagesschau.de', 'heute.de', 'wdr.de']; diff --git a/statusnet/statusnet.php b/statusnet/statusnet.php index 49ba2e452..a204f3e31 100644 --- a/statusnet/statusnet.php +++ b/statusnet/statusnet.php @@ -55,7 +55,6 @@ use Friendica\Model\ItemContent; use Friendica\Model\Photo; use Friendica\Model\User; -use Friendica\Network\HTTPRequest; use Friendica\Protocol\Activity; use Friendica\Util\DateTimeFormat; use Friendica\Util\Network; @@ -156,7 +155,7 @@ function statusnet_settings_post(App $a, $post) foreach ($globalsn as $asn) { if ($asn['apiurl'] == $_POST['statusnet-preconf-apiurl']) { $apibase = $asn['apiurl']; - $c = HTTPRequest::fetchUrl($apibase . 'statusnet/version.xml'); + $c = DI::httpRequest()->fetchUrl($apibase . 'statusnet/version.xml'); if (strlen($c) > 0) { DI::pConfig()->set(local_user(), 'statusnet', 'consumerkey', $asn['consumerkey']); DI::pConfig()->set(local_user(), 'statusnet', 'consumersecret', $asn['consumersecret']); @@ -174,7 +173,7 @@ function statusnet_settings_post(App $a, $post) // we'll check the API Version for that, if we don't get one we'll try to fix the path but will // resign quickly after this one try to fix the path ;-) $apibase = $_POST['statusnet-baseapi']; - $c = HTTPRequest::fetchUrl($apibase . 'statusnet/version.xml'); + $c = DI::httpRequest()->fetchUrl($apibase . 'statusnet/version.xml'); if (strlen($c) > 0) { // ok the API path is correct, let's save the settings DI::pConfig()->set(local_user(), 'statusnet', 'consumerkey', $_POST['statusnet-consumerkey']); @@ -184,7 +183,7 @@ function statusnet_settings_post(App $a, $post) } else { // the API path is not correct, maybe missing trailing / ? $apibase = $apibase . '/'; - $c = HTTPRequest::fetchUrl($apibase . 'statusnet/version.xml'); + $c = DI::httpRequest()->fetchUrl($apibase . 'statusnet/version.xml'); if (strlen($c) > 0) { // ok the API path is now correct, let's save the settings DI::pConfig()->set(local_user(), 'statusnet', 'consumerkey', $_POST['statusnet-consumerkey']); @@ -614,7 +613,7 @@ function statusnet_post_hook(App $a, &$b) } if ($image != "") { - $img_str = HTTPRequest::fetchUrl($image); + $img_str = DI::httpRequest()->fetchUrl($image); $tempfile = tempnam(get_temppath(), "cache"); file_put_contents($tempfile, $img_str); $postdata = ["status" => $msg, "media[]" => $tempfile]; @@ -1475,7 +1474,7 @@ function statusnet_convertmsg(App $a, $body) } elseif ($oembed_data->type != "link") { $body = str_replace($search, "[url=" . $expanded_url . "]" . $expanded_url . "[/url]", $body); } else { - $img_str = HTTPRequest::fetchUrl($expanded_url, true, 4); + $img_str = DI::httpRequest()->fetchUrl($expanded_url, true, 4); $tempfile = tempnam(get_temppath(), "cache"); file_put_contents($tempfile, $img_str); diff --git a/twitter/twitter.php b/twitter/twitter.php index 85647dea6..f93b12b44 100644 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -85,7 +85,6 @@ use Friendica\Model\ItemURI; use Friendica\Model\Tag; use Friendica\Model\User; -use Friendica\Network\HTTPRequest; use Friendica\Protocol\Activity; use Friendica\Util\ConfigFileLoader; use Friendica\Util\DateTimeFormat; @@ -675,7 +674,7 @@ function (array $attributes, array $author_contact, $content, $is_quote_share) { continue; } - $img_str = HTTPRequest::fetchUrl($image['url']); + $img_str = DI::httpRequest()->fetchUrl($image['url']); $tempfile = tempnam(get_temppath(), 'cache'); file_put_contents($tempfile, $img_str); @@ -1319,7 +1318,7 @@ function twitter_expand_entities($body, stdClass $status, $picture) } elseif ($oembed_data->type != 'link') { $replace = '[url=' . $expanded_url . ']' . $url->display_url . '[/url]'; } else { - $img_str = HTTPRequest::fetchUrl($final_url, true, 4); + $img_str = DI::httpRequest()->fetchUrl($final_url, true, 4); $tempfile = tempnam(get_temppath(), 'cache'); file_put_contents($tempfile, $img_str); From f36ca4fcf44ccc756061eefebf43116713b7c66e Mon Sep 17 00:00:00 2001 From: nupplaPhil Date: Wed, 4 Mar 2020 22:30:24 +0100 Subject: [PATCH 10/46] Move "Network::finalUrl" to "HTTPRequest" class --- statusnet/statusnet.php | 3 +-- twitter/twitter.php | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/statusnet/statusnet.php b/statusnet/statusnet.php index a204f3e31..24030ce6a 100644 --- a/statusnet/statusnet.php +++ b/statusnet/statusnet.php @@ -57,7 +57,6 @@ use Friendica\Model\User; use Friendica\Protocol\Activity; use Friendica\Util\DateTimeFormat; -use Friendica\Util\Network; use Friendica\Util\Strings; function statusnet_install() @@ -1450,7 +1449,7 @@ function statusnet_convertmsg(App $a, $body) Logger::log("statusnet_convertmsg: expanding url " . $match[1], Logger::DEBUG); - $expanded_url = Network::finalUrl($match[1]); + $expanded_url = HTTPRequest::finalUrl($match[1]); Logger::log("statusnet_convertmsg: fetching data for " . $expanded_url, Logger::DEBUG); diff --git a/twitter/twitter.php b/twitter/twitter.php index f93b12b44..cea398421 100644 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -89,7 +89,6 @@ use Friendica\Util\ConfigFileLoader; use Friendica\Util\DateTimeFormat; use Friendica\Util\Images; -use Friendica\Util\Network; use Friendica\Util\Strings; require_once __DIR__ . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php'; @@ -1297,7 +1296,7 @@ function twitter_expand_entities($body, stdClass $status, $picture) $expanded_url = $url->expanded_url; - $final_url = Network::finalUrl($url->expanded_url); + $final_url = HTTPRequest::finalUrl($url->expanded_url); $oembed_data = OEmbed::fetchURL($final_url); From 90193bd02bff26759406c349bcd367bafa81fc6f Mon Sep 17 00:00:00 2001 From: nupplaPhil Date: Wed, 4 Mar 2020 22:33:31 +0100 Subject: [PATCH 11/46] Move "HTTPRequest::finalUrl" dynamic --- statusnet/statusnet.php | 2 +- twitter/twitter.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/statusnet/statusnet.php b/statusnet/statusnet.php index 24030ce6a..7ec3a2d5d 100644 --- a/statusnet/statusnet.php +++ b/statusnet/statusnet.php @@ -1449,7 +1449,7 @@ function statusnet_convertmsg(App $a, $body) Logger::log("statusnet_convertmsg: expanding url " . $match[1], Logger::DEBUG); - $expanded_url = HTTPRequest::finalUrl($match[1]); + $expanded_url = DI::httpRequest()->finalUrl($match[1]); Logger::log("statusnet_convertmsg: fetching data for " . $expanded_url, Logger::DEBUG); diff --git a/twitter/twitter.php b/twitter/twitter.php index cea398421..30195427d 100644 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -1296,7 +1296,7 @@ function twitter_expand_entities($body, stdClass $status, $picture) $expanded_url = $url->expanded_url; - $final_url = HTTPRequest::finalUrl($url->expanded_url); + $final_url = DI::httpRequest()->finalUrl($url->expanded_url); $oembed_data = OEmbed::fetchURL($final_url); From 72c24efe5b1805c95d99ccfd891742d9178e87ae Mon Sep 17 00:00:00 2001 From: nupplaPhil Date: Wed, 4 Mar 2020 22:35:08 +0100 Subject: [PATCH 12/46] Rename "HTTPRequest::curl()" to HTTPRequest::get() --- discourse/discourse.php | 4 ++-- openstreetmap/openstreetmap.php | 2 +- pumpio/pumpio.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/discourse/discourse.php b/discourse/discourse.php index 5e64c173e..b3f95bbb4 100644 --- a/discourse/discourse.php +++ b/discourse/discourse.php @@ -114,7 +114,7 @@ function discourse_email_getmessage(App $a, &$message) function discourse_fetch_post($host, $topic, $pid) { $url = $host . '/t/' . $topic . '/' . $pid . '.json'; - $curlResult = DI::httpRequest()->curl($url); + $curlResult = DI::httpRequest()->get($url); if (!$curlResult->isSuccess()) { Logger::info('No success', ['url' => $url]); return false; @@ -151,7 +151,7 @@ function discourse_fetch_post_from_api(&$message, $post, $host) { $hostaddr = 'https://' . $host; $url = $hostaddr . '/posts/' . $post . '.json'; - $curlResult = DI::httpRequest()->curl($url); + $curlResult = DI::httpRequest()->get($url); if (!$curlResult->isSuccess()) { return false; } diff --git a/openstreetmap/openstreetmap.php b/openstreetmap/openstreetmap.php index ede71ccd4..efd0745ee 100644 --- a/openstreetmap/openstreetmap.php +++ b/openstreetmap/openstreetmap.php @@ -131,7 +131,7 @@ function openstreetmap_get_coordinates($a, &$b) $j = DI::cache()->get($cachekey); if (is_null($j)) { - $curlResult = DI::httpRequest()->curl($nomserver . $args); + $curlResult = DI::httpRequest()->get($nomserver . $args); if ($curlResult->isSuccess()) { $j = json_decode($curlResult->getBody(), true); DI::cache()->set($cachekey, $j, Duration::MONTH); diff --git a/pumpio/pumpio.php b/pumpio/pumpio.php index d85902841..2144257db 100644 --- a/pumpio/pumpio.php +++ b/pumpio/pumpio.php @@ -1604,7 +1604,7 @@ function pumpio_fetchallcomments(App $a, $uid, $id) function pumpio_reachable($url) { - return DI::httpRequest()->curl($url, false, ['timeout' => 10])->isSuccess(); + return DI::httpRequest()->get($url, false, ['timeout' => 10])->isSuccess(); } /* From 19b2c8d83315ba7bc024ec2b29ea87762bc1ffa6 Mon Sep 17 00:00:00 2001 From: nupplaPhil Date: Wed, 4 Mar 2020 22:35:39 +0100 Subject: [PATCH 13/46] Rename "fetchUrl" and "fetchUrlFull" to "fetch" and "fetchFull" --- curweather/curweather.php | 2 +- geocoordinates/geocoordinates.php | 2 +- geonames/geonames.php | 2 +- jappixmini/jappixmini.php | 2 +- leistungsschutzrecht/leistungsschutzrecht.php | 2 +- mailstream/mailstream.php | 3 +-- mastodoncustomemojis/mastodoncustomemojis.php | 3 +-- statusnet/statusnet.php | 10 +++++----- twitter/twitter.php | 4 ++-- 9 files changed, 14 insertions(+), 16 deletions(-) diff --git a/curweather/curweather.php b/curweather/curweather.php index 7757dba7e..575c5503a 100644 --- a/curweather/curweather.php +++ b/curweather/curweather.php @@ -48,7 +48,7 @@ function getWeather($loc, $units = 'metric', $lang = 'en', $appid = '', $cacheti } try { - $res = new SimpleXMLElement(DI::httpRequest()->fetchUrl($url)); + $res = new SimpleXMLElement(DI::httpRequest()->fetch($url)); } catch (Exception $e) { if (empty($_SESSION['curweather_notice_shown'])) { info(DI::l10n()->t('Error fetching weather data. Error was: '.$e->getMessage())); diff --git a/geocoordinates/geocoordinates.php b/geocoordinates/geocoordinates.php index 8641d2236..2bde405ca 100644 --- a/geocoordinates/geocoordinates.php +++ b/geocoordinates/geocoordinates.php @@ -52,7 +52,7 @@ function geocoordinates_resolve_item(&$item) return; } - $s = DI::httpRequest()->fetchUrl("https://api.opencagedata.com/geocode/v1/json?q=" . $coords[0] . "," . $coords[1] . "&key=" . $key . "&language=" . $language); + $s = DI::httpRequest()->fetch("https://api.opencagedata.com/geocode/v1/json?q=" . $coords[0] . "," . $coords[1] . "&key=" . $key . "&language=" . $language); if (!$s) { Logger::log("API could not be queried", Logger::DEBUG); diff --git a/geonames/geonames.php b/geonames/geonames.php index 28d716b5e..6536f9efa 100644 --- a/geonames/geonames.php +++ b/geonames/geonames.php @@ -77,7 +77,7 @@ function geonames_post_hook(App $a, array &$item) /* OK, we're allowed to do our stuff. */ - $s = DI::httpRequest()->fetchUrl('http://api.geonames.org/findNearbyPlaceName?lat=' . $coords[0] . '&lng=' . $coords[1] . '&username=' . $geo_account); + $s = DI::httpRequest()->fetch('http://api.geonames.org/findNearbyPlaceName?lat=' . $coords[0] . '&lng=' . $coords[1] . '&username=' . $geo_account); if (!$s) { return; diff --git a/jappixmini/jappixmini.php b/jappixmini/jappixmini.php index 52ae56d07..384b7798c 100644 --- a/jappixmini/jappixmini.php +++ b/jappixmini/jappixmini.php @@ -659,7 +659,7 @@ function jappixmini_cron(App $a, $d) try { // send request - $answer_json = DI::httpRequest()->fetchUrl($url); + $answer_json = DI::httpRequest()->fetch($url); // parse answer $answer = json_decode($answer_json); diff --git a/leistungsschutzrecht/leistungsschutzrecht.php b/leistungsschutzrecht/leistungsschutzrecht.php index 9bd1a68d0..eb25f550b 100644 --- a/leistungsschutzrecht/leistungsschutzrecht.php +++ b/leistungsschutzrecht/leistungsschutzrecht.php @@ -79,7 +79,7 @@ function leistungsschutzrecht_fetchsites() { // This list works - but question is how current it is $url = "http://leistungsschutzrecht-stoppen.d-64.org/blacklist.txt"; - $sitelist = DI::httpRequest()->fetchUrl($url); + $sitelist = DI::httpRequest()->fetch($url); $siteurls = explode(',', $sitelist); $whitelist = ['tagesschau.de', 'heute.de', 'wdr.de']; diff --git a/mailstream/mailstream.php b/mailstream/mailstream.php index 4eaa5704c..d09f913a1 100644 --- a/mailstream/mailstream.php +++ b/mailstream/mailstream.php @@ -13,7 +13,6 @@ use Friendica\Database\DBA; use Friendica\DI; use Friendica\Model\Item; -use Friendica\Network\HTTPRequest; use Friendica\Protocol\Activity; function mailstream_install() { @@ -169,7 +168,7 @@ function mailstream_do_images($a, &$item, &$attachments) { continue; } $cookiejar = tempnam(get_temppath(), 'cookiejar-mailstream-'); - $curlResult = DI::httpRequest()->fetchUrlFull($url, true, 0, '', $cookiejar); + $curlResult = DI::httpRequest()->fetchFull($url, true, 0, '', $cookiejar); $attachments[$url] = [ 'data' => $curlResult->getBody(), 'guid' => hash("crc32", $url), diff --git a/mastodoncustomemojis/mastodoncustomemojis.php b/mastodoncustomemojis/mastodoncustomemojis.php index 537cf46e3..a3cd0b97a 100644 --- a/mastodoncustomemojis/mastodoncustomemojis.php +++ b/mastodoncustomemojis/mastodoncustomemojis.php @@ -15,7 +15,6 @@ use Friendica\Core\Hook; use Friendica\Core\Protocol; use Friendica\DI; -use Friendica\Network\HTTPRequest; use Friendica\Util\Proxy as ProxyUtils; function mastodoncustomemojis_install() @@ -90,7 +89,7 @@ function mastodoncustomemojis_fetch_custom_emojis_for_url($api_base_url) $api_url = $api_base_url . '/api/v1/custom_emojis'; - $fetchResult = DI::httpRequest()->fetchUrlFull($api_url); + $fetchResult = DI::httpRequest()->fetchFull($api_url); if ($fetchResult->isSuccess()) { $emojis_array = json_decode($fetchResult->getBody(), true); diff --git a/statusnet/statusnet.php b/statusnet/statusnet.php index 7ec3a2d5d..c213a4c37 100644 --- a/statusnet/statusnet.php +++ b/statusnet/statusnet.php @@ -154,7 +154,7 @@ function statusnet_settings_post(App $a, $post) foreach ($globalsn as $asn) { if ($asn['apiurl'] == $_POST['statusnet-preconf-apiurl']) { $apibase = $asn['apiurl']; - $c = DI::httpRequest()->fetchUrl($apibase . 'statusnet/version.xml'); + $c = DI::httpRequest()->fetch($apibase . 'statusnet/version.xml'); if (strlen($c) > 0) { DI::pConfig()->set(local_user(), 'statusnet', 'consumerkey', $asn['consumerkey']); DI::pConfig()->set(local_user(), 'statusnet', 'consumersecret', $asn['consumersecret']); @@ -172,7 +172,7 @@ function statusnet_settings_post(App $a, $post) // we'll check the API Version for that, if we don't get one we'll try to fix the path but will // resign quickly after this one try to fix the path ;-) $apibase = $_POST['statusnet-baseapi']; - $c = DI::httpRequest()->fetchUrl($apibase . 'statusnet/version.xml'); + $c = DI::httpRequest()->fetch($apibase . 'statusnet/version.xml'); if (strlen($c) > 0) { // ok the API path is correct, let's save the settings DI::pConfig()->set(local_user(), 'statusnet', 'consumerkey', $_POST['statusnet-consumerkey']); @@ -182,7 +182,7 @@ function statusnet_settings_post(App $a, $post) } else { // the API path is not correct, maybe missing trailing / ? $apibase = $apibase . '/'; - $c = DI::httpRequest()->fetchUrl($apibase . 'statusnet/version.xml'); + $c = DI::httpRequest()->fetch($apibase . 'statusnet/version.xml'); if (strlen($c) > 0) { // ok the API path is now correct, let's save the settings DI::pConfig()->set(local_user(), 'statusnet', 'consumerkey', $_POST['statusnet-consumerkey']); @@ -612,7 +612,7 @@ function statusnet_post_hook(App $a, &$b) } if ($image != "") { - $img_str = DI::httpRequest()->fetchUrl($image); + $img_str = DI::httpRequest()->fetch($image); $tempfile = tempnam(get_temppath(), "cache"); file_put_contents($tempfile, $img_str); $postdata = ["status" => $msg, "media[]" => $tempfile]; @@ -1473,7 +1473,7 @@ function statusnet_convertmsg(App $a, $body) } elseif ($oembed_data->type != "link") { $body = str_replace($search, "[url=" . $expanded_url . "]" . $expanded_url . "[/url]", $body); } else { - $img_str = DI::httpRequest()->fetchUrl($expanded_url, true, 4); + $img_str = DI::httpRequest()->fetch($expanded_url, true, 4); $tempfile = tempnam(get_temppath(), "cache"); file_put_contents($tempfile, $img_str); diff --git a/twitter/twitter.php b/twitter/twitter.php index 30195427d..7d9cbfda2 100644 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -673,7 +673,7 @@ function (array $attributes, array $author_contact, $content, $is_quote_share) { continue; } - $img_str = DI::httpRequest()->fetchUrl($image['url']); + $img_str = DI::httpRequest()->fetch($image['url']); $tempfile = tempnam(get_temppath(), 'cache'); file_put_contents($tempfile, $img_str); @@ -1317,7 +1317,7 @@ function twitter_expand_entities($body, stdClass $status, $picture) } elseif ($oembed_data->type != 'link') { $replace = '[url=' . $expanded_url . ']' . $url->display_url . '[/url]'; } else { - $img_str = DI::httpRequest()->fetchUrl($final_url, true, 4); + $img_str = DI::httpRequest()->fetch($final_url, true, 4); $tempfile = tempnam(get_temppath(), 'cache'); file_put_contents($tempfile, $img_str); From 3f84caeec5071a88af90f229ec4f93449ea86e2d Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 23 Jul 2020 03:48:52 +0000 Subject: [PATCH 14/46] Unneeded "info" messages removed --- blockbot/blockbot.php | 1 - blockem/blockem.php | 2 -- buffer/buffer.php | 2 -- cookienotice/cookienotice.php | 1 - curweather/curweather.php | 6 +----- diaspora/diaspora.php | 2 -- forumdirectory/forumdirectory.php | 2 +- fromapp/fromapp.php | 2 -- geocoordinates/geocoordinates.php | 1 - geonames/geonames.php | 2 -- gnot/gnot.php | 1 - gravatar/gravatar.php | 1 - group_text/group_text.php | 2 -- impressum/impressum.php | 1 - irc/irc.php | 3 --- jappixmini/jappixmini.php | 4 +--- langfilter/langfilter.php | 2 -- libravatar/libravatar.php | 1 - notifyall/notifyall.php | 2 +- notimeline/notimeline.php | 1 - nsfw/nsfw.php | 1 - numfriends/numfriends.php | 1 - openstreetmap/openstreetmap.php | 2 -- pageheader/pageheader.php | 1 - piwik/piwik.php | 1 - public_server/public_server.php | 1 - qcomment/qcomment.php | 1 - remote_permissions/remote_permissions.php | 2 -- securemail/securemail.php | 1 - showmore/showmore.php | 1 - statusnet/statusnet.php | 2 -- superblock/superblock.php | 2 -- tumblr/tumblr.php | 2 -- twitter/twitter.php | 7 ++----- webrtc/webrtc.php | 1 - windowsphonepush/windowsphonepush.php | 2 -- xmpp/xmpp.php | 4 ---- 37 files changed, 6 insertions(+), 65 deletions(-) diff --git a/blockbot/blockbot.php b/blockbot/blockbot.php index 6bf709708..61715b289 100644 --- a/blockbot/blockbot.php +++ b/blockbot/blockbot.php @@ -42,7 +42,6 @@ function blockbot_addon_admin_post(&$a) { DI::config()->set('blockbot', 'good_crawlers', $_POST['good_crawlers'] ?? false); DI::config()->set('blockbot', 'block_gab', $_POST['block_gab'] ?? false); DI::config()->set('blockbot', 'training', $_POST['training'] ?? false); - info(DI::l10n()->t('Settings updated.'). EOL); } function blockbot_init_1(App $a) { diff --git a/blockem/blockem.php b/blockem/blockem.php index 3a32aa2d4..1a3172841 100644 --- a/blockem/blockem.php +++ b/blockem/blockem.php @@ -78,7 +78,6 @@ function blockem_addon_settings_post(App $a, array &$b) if (!empty($_POST['blockem-submit'])) { DI::pConfig()->set(local_user(), 'blockem', 'words', trim($_POST['blockem-words'])); - info(DI::l10n()->t('BLOCKEM Settings saved.') . EOL); } } @@ -242,6 +241,5 @@ function blockem_init(App $a) } DI::pConfig()->set(local_user(), 'blockem', 'words', $words); - info(DI::l10n()->t('blockem settings updated') . EOL); exit(); } diff --git a/buffer/buffer.php b/buffer/buffer.php index b008b52f9..2a7004c82 100644 --- a/buffer/buffer.php +++ b/buffer/buffer.php @@ -89,8 +89,6 @@ function buffer_addon_admin_post(App $a) DI::config()->set('buffer', 'client_id' , $client_id); DI::config()->set('buffer', 'client_secret', $client_secret); - - info(DI::l10n()->t('Settings updated.'). EOL); } function buffer_connect(App $a) diff --git a/cookienotice/cookienotice.php b/cookienotice/cookienotice.php index a5df0d2d6..4ca862800 100644 --- a/cookienotice/cookienotice.php +++ b/cookienotice/cookienotice.php @@ -70,7 +70,6 @@ function cookienotice_addon_admin_post(App $a) if ($_POST['cookienotice-submit']) { DI::config()->set('cookienotice', 'text', trim(strip_tags($_POST['cookienotice-text']))); DI::config()->set('cookienotice', 'oktext', trim(strip_tags($_POST['cookienotice-oktext']))); - info(DI::l10n()->t('cookienotice Settings saved.')); } } diff --git a/curweather/curweather.php b/curweather/curweather.php index e4b6119f9..d9a1d2029 100644 --- a/curweather/curweather.php +++ b/curweather/curweather.php @@ -52,7 +52,7 @@ function getWeather($loc, $units = 'metric', $lang = 'en', $appid = '', $cacheti $res = new SimpleXMLElement(Network::fetchUrl($url)); } catch (Exception $e) { if (empty($_SESSION['curweather_notice_shown'])) { - info(DI::l10n()->t('Error fetching weather data. Error was: '.$e->getMessage())); + notice(DI::l10n()->t('Error fetching weather data. Error was: '.$e->getMessage())); $_SESSION['curweather_notice_shown'] = true; } @@ -170,8 +170,6 @@ function curweather_addon_settings_post(App $a, $post) DI::pConfig()->set(local_user(), 'curweather', 'curweather_loc' , trim($_POST['curweather_loc'])); DI::pConfig()->set(local_user(), 'curweather', 'curweather_enable', intval($_POST['curweather_enable'])); DI::pConfig()->set(local_user(), 'curweather', 'curweather_units' , trim($_POST['curweather_units'])); - - info(DI::l10n()->t('Current Weather settings updated.') . EOL); } function curweather_addon_settings(App $a, &$s) @@ -221,8 +219,6 @@ function curweather_addon_admin_post(App $a) if (!empty($_POST['curweather-submit'])) { DI::config()->set('curweather', 'appid', trim($_POST['appid'])); DI::config()->set('curweather', 'cachetime', trim($_POST['cachetime'])); - - info(DI::l10n()->t('Curweather settings saved.' . PHP_EOL)); } } diff --git a/diaspora/diaspora.php b/diaspora/diaspora.php index edf6922dc..0a43462c6 100644 --- a/diaspora/diaspora.php +++ b/diaspora/diaspora.php @@ -135,10 +135,8 @@ function diaspora_settings_post(App $a, &$b) DI::pConfig()->set(local_user(),'diaspora', 'aspect' , trim($_POST['aspect'])); DI::pConfig()->set(local_user(),'diaspora', 'post_by_default', intval($_POST['post_by_default'])); } - notice(DI::l10n()->t('Diaspora settings updated.')); } else { DI::pConfig()->delete(local_user(), 'diaspora', 'password'); - notice(DI::l10n()->t('Diaspora connector disabled.')); } } } diff --git a/forumdirectory/forumdirectory.php b/forumdirectory/forumdirectory.php index 8c260fd71..566e32a35 100644 --- a/forumdirectory/forumdirectory.php +++ b/forumdirectory/forumdirectory.php @@ -127,7 +127,7 @@ function forumdirectory_content(App $a) } DBA::close($r); } else { - info(DI::l10n()->t("No entries \x28some entries may be hidden\x29.") . EOL); + notice(DI::l10n()->t("No entries \x28some entries may be hidden\x29.") . EOL); } $tpl = Renderer::getMarkupTemplate('directory_header.tpl'); diff --git a/fromapp/fromapp.php b/fromapp/fromapp.php index 8f787cab1..6c8e4717a 100644 --- a/fromapp/fromapp.php +++ b/fromapp/fromapp.php @@ -35,8 +35,6 @@ function fromapp_settings_post($a, $post) DI::pConfig()->set(local_user(), 'fromapp', 'app', $_POST['fromapp-input']); DI::pConfig()->set(local_user(), 'fromapp', 'force', intval($_POST['fromapp-force'])); - - info(DI::l10n()->t('Fromapp settings updated.') . EOL); } function fromapp_settings(&$a, &$s) diff --git a/geocoordinates/geocoordinates.php b/geocoordinates/geocoordinates.php index 7a7a6d9ad..fc0d17dbb 100644 --- a/geocoordinates/geocoordinates.php +++ b/geocoordinates/geocoordinates.php @@ -103,5 +103,4 @@ function geocoordinates_addon_admin_post(&$a) $language = (!empty($_POST['language']) ? Strings::escapeTags(trim($_POST['language'])) : ''); DI::config()->set('geocoordinates', 'language', $language); - info(DI::l10n()->t('Settings updated.') . EOL); } diff --git a/geonames/geonames.php b/geonames/geonames.php index e6962d764..add12b270 100644 --- a/geonames/geonames.php +++ b/geonames/geonames.php @@ -108,8 +108,6 @@ function geonames_addon_settings_post(App $a, array $post) } DI::pConfig()->set(local_user(), 'geonames', 'enable', intval($_POST['geonames-enable'])); - - info(DI::l10n()->t('Geonames settings updated.')); } /** diff --git a/gnot/gnot.php b/gnot/gnot.php index 26012c441..f24db4a1b 100644 --- a/gnot/gnot.php +++ b/gnot/gnot.php @@ -49,7 +49,6 @@ function gnot_settings_post($a,$post) { return; DI::pConfig()->set(local_user(),'gnot','enable',intval($_POST['gnot'])); - info(DI::l10n()->t('Gnot settings updated.') . EOL); } diff --git a/gravatar/gravatar.php b/gravatar/gravatar.php index 5ba9dcff0..febb12938 100644 --- a/gravatar/gravatar.php +++ b/gravatar/gravatar.php @@ -125,5 +125,4 @@ function gravatar_addon_admin_post (&$a) { $rating = (!empty($_POST['rating']) ? Strings::escapeTags(trim($_POST['rating'])) : 'g'); DI::config()->set('gravatar', 'default_avatar', $default_avatar); DI::config()->set('gravatar', 'rating', $rating); - info(DI::l10n()->t('Gravatar settings updated.') .EOL); } diff --git a/group_text/group_text.php b/group_text/group_text.php index b8a1d21fd..06b3f6151 100644 --- a/group_text/group_text.php +++ b/group_text/group_text.php @@ -42,8 +42,6 @@ function group_text_settings_post($a,$post) { if(! local_user() || empty($_POST['group_text-submit'])) return; DI::pConfig()->set(local_user(),'system','groupedit_image_limit',intval($_POST['group_text'])); - - info(DI::l10n()->t('Group Text settings updated.') . EOL); } diff --git a/impressum/impressum.php b/impressum/impressum.php index 9f7917281..0152189ef 100644 --- a/impressum/impressum.php +++ b/impressum/impressum.php @@ -98,7 +98,6 @@ function impressum_addon_admin_post (&$a) { DI::config()->set('impressum','email',strip_tags($email)); DI::config()->set('impressum','notes',strip_tags($notes)); DI::config()->set('impressum','footer_text',strip_tags($footer_text)); - info(DI::l10n()->t('Settings updated.'). EOL ); } function impressum_addon_admin (&$a, &$o) { $t = Renderer::getMarkupTemplate( "admin.tpl", "addon/impressum/" ); diff --git a/irc/irc.php b/irc/irc.php index 2c969d4be..6dccd4846 100644 --- a/irc/irc.php +++ b/irc/irc.php @@ -62,7 +62,6 @@ function irc_addon_settings_post(&$a, &$b) { DI::pConfig()->set(local_user(), 'irc', 'sitechats', trim($_POST['sitechats'])); } /* upid pop-up thing */ - info(DI::l10n()->t('IRC settings saved.') . EOL); } } @@ -132,8 +131,6 @@ function irc_addon_admin_post (&$a) { if($_POST['irc-submit']) { DI::config()->set('irc','autochans',trim($_POST['autochans'])); DI::config()->set('irc','sitechats',trim($_POST['sitechats'])); - /* stupid pop-up thing */ - info(DI::l10n()->t('IRC settings saved.') . EOL); } } function irc_addon_admin (&$a, &$o) { diff --git a/jappixmini/jappixmini.php b/jappixmini/jappixmini.php index ad4d49014..39065df8a 100644 --- a/jappixmini/jappixmini.php +++ b/jappixmini/jappixmini.php @@ -434,7 +434,7 @@ function jappixmini_settings_post(App $a, &$b) // check that Jabber password was encrypted with correct Friendica password $friendica_password = trim($b['jappixmini-friendica-password']); if (!User::authenticate((int) $uid, $friendica_password)) { - info("Wrong friendica password!"); + notice("Wrong friendica password!"); return; } } @@ -462,11 +462,9 @@ function jappixmini_settings_post(App $a, &$b) DI::pConfig()->set($uid, 'jappixmini', 'activate' , intval($b['jappixmini-activate'])); DI::pConfig()->set($uid, 'jappixmini', 'dontinsertchat', intval($b['jappixmini-dont-insertchat'])); DI::pConfig()->set($uid, 'jappixmini', 'encrypt' , $encrypt); - info('Jappix Mini settings saved.'); if ($purge) { q("DELETE FROM `pconfig` WHERE `uid`=$uid AND `cat`='jappixmini' AND `k` LIKE 'id:%%'"); - info('List of addresses purged.'); } } } diff --git a/langfilter/langfilter.php b/langfilter/langfilter.php index 42eff1452..f4884d19f 100644 --- a/langfilter/langfilter.php +++ b/langfilter/langfilter.php @@ -92,8 +92,6 @@ function langfilter_addon_settings_post(App $a, &$b) DI::pConfig()->set(local_user(), 'langfilter', 'languages' , $languages); DI::pConfig()->set(local_user(), 'langfilter', 'minconfidence', $minconfidence); DI::pConfig()->set(local_user(), 'langfilter', 'minlength' , $minlength); - - info(DI::l10n()->t('Language Filter Settings saved.')); } } diff --git a/libravatar/libravatar.php b/libravatar/libravatar.php index c49ac5c59..1c4f0e903 100644 --- a/libravatar/libravatar.php +++ b/libravatar/libravatar.php @@ -126,5 +126,4 @@ function libravatar_addon_admin_post(&$a) $default_avatar = (!empty($_POST['avatar']) ? Strings::escapeTags(trim($_POST['avatar'])) : 'identicon'); DI::config()->set('libravatar', 'default_avatar', $default_avatar); - info(DI::l10n()->t('Libravatar settings updated.') .EOL); } diff --git a/notifyall/notifyall.php b/notifyall/notifyall.php index 6d1793804..7b2325538 100644 --- a/notifyall/notifyall.php +++ b/notifyall/notifyall.php @@ -66,7 +66,7 @@ function notifyall_post(App $a) DI::emailer()->send($notifyEmail->withRecipient($recipient['email'])); } - notice(DI::l10n()->t('Emails sent')); + info(DI::l10n()->t('Emails sent')); DI::baseUrl()->redirect('admin'); } diff --git a/notimeline/notimeline.php b/notimeline/notimeline.php index a0765b962..e5ff8918d 100644 --- a/notimeline/notimeline.php +++ b/notimeline/notimeline.php @@ -29,7 +29,6 @@ function notimeline_settings_post($a, $post) } DI::pConfig()->set(local_user(), 'system', 'no_wall_archive_widget', intval($_POST['notimeline'])); - info(DI::l10n()->t('No Timeline settings updated.') . EOL); } function notimeline_settings(&$a, &$s) diff --git a/nsfw/nsfw.php b/nsfw/nsfw.php index 85260c7f7..65b26f596 100644 --- a/nsfw/nsfw.php +++ b/nsfw/nsfw.php @@ -105,7 +105,6 @@ function nsfw_addon_settings_post(&$a, &$b) $enable = (!empty($_POST['nsfw-enable']) ? intval($_POST['nsfw-enable']) : 0); $disable = 1 - $enable; DI::pConfig()->set(local_user(), 'nsfw', 'disable', $disable); - info(DI::l10n()->t('NSFW Settings saved.') . EOL); } } diff --git a/numfriends/numfriends.php b/numfriends/numfriends.php index 9143fb494..6ee3956ba 100644 --- a/numfriends/numfriends.php +++ b/numfriends/numfriends.php @@ -40,7 +40,6 @@ function numfriends_settings_post($a,$post) { return; DI::pConfig()->set(local_user(),'system','display_friend_count',intval($_POST['numfriends'])); - info( DI::l10n()->t('Numfriends settings updated.') . EOL); } diff --git a/openstreetmap/openstreetmap.php b/openstreetmap/openstreetmap.php index 5df1c7d7d..715e70885 100644 --- a/openstreetmap/openstreetmap.php +++ b/openstreetmap/openstreetmap.php @@ -223,6 +223,4 @@ function openstreetmap_addon_admin_post(&$a) DI::config()->set('openstreetmap', 'nomserver', $urlnom); DI::config()->set('openstreetmap', 'zoom', $zoom); DI::config()->set('openstreetmap', 'marker', $marker); - - info(DI::l10n()->t('Settings updated.') . EOL); } diff --git a/pageheader/pageheader.php b/pageheader/pageheader.php index 201df3221..f0d75400e 100644 --- a/pageheader/pageheader.php +++ b/pageheader/pageheader.php @@ -51,7 +51,6 @@ function pageheader_addon_admin_post(App $a) if (isset($_POST['pageheader-words'])) { DI::config()->set('pageheader', 'text', trim(strip_tags($_POST['pageheader-words']))); } - info(DI::l10n()->t('pageheader Settings saved.')); } } diff --git a/piwik/piwik.php b/piwik/piwik.php index 6dba45a34..94f78bb46 100644 --- a/piwik/piwik.php +++ b/piwik/piwik.php @@ -117,5 +117,4 @@ function piwik_addon_admin_post (&$a) { DI::config()->set('piwik', 'siteid', $id); DI::config()->set('piwik', 'optout', $optout); DI::config()->set('piwik', 'async', $async); - info(DI::l10n()->t('Settings updated.'). EOL); } diff --git a/public_server/public_server.php b/public_server/public_server.php index 41c628325..f52703dfe 100644 --- a/public_server/public_server.php +++ b/public_server/public_server.php @@ -160,7 +160,6 @@ function public_server_addon_admin_post(&$a) DI::config()->set('public_server', 'flagusers', $flagusers); DI::config()->set('public_server', 'flagposts', $flagposts); DI::config()->set('public_server', 'flagpostsexpire', $flagpostsexpire); - info(DI::l10n()->t('Settings saved').EOL); } function public_server_addon_admin(&$a, &$o) diff --git a/qcomment/qcomment.php b/qcomment/qcomment.php index 1ce092053..45f9d972a 100644 --- a/qcomment/qcomment.php +++ b/qcomment/qcomment.php @@ -67,6 +67,5 @@ function qcomment_addon_settings_post(&$a, &$b) if ($_POST['qcomment-submit']) { DI::pConfig()->set(local_user(), 'qcomment', 'words', XML::escape($_POST['qcomment-words'])); - info(DI::l10n()->t('Quick Comment settings saved.') . EOL); } } diff --git a/remote_permissions/remote_permissions.php b/remote_permissions/remote_permissions.php index 268171828..159e3cf94 100644 --- a/remote_permissions/remote_permissions.php +++ b/remote_permissions/remote_permissions.php @@ -60,7 +60,6 @@ function remote_permissions_settings_post($a,$post) { return; DI::pConfig()->set(local_user(),'remote_perms','show',intval($_POST['remote-perms'])); - info(DI::l10n()->t('Remote Permissions settings updated.') . EOL); } function remote_permissions_content($a, $item_copy) { @@ -209,5 +208,4 @@ function remote_permissions_addon_admin(&$a, &$o){ function remote_permissions_addon_admin_post(&$a){ $choice = (!empty($_POST['remotepermschoice']) ? Strings::escapeTags(trim($_POST['remotepermschoice'])) : ''); DI::config()->set('remote_perms','global',($choice == 1 ? 1 : 0)); - info(DI::l10n()->t('Settings updated.'). EOL); } diff --git a/securemail/securemail.php b/securemail/securemail.php index 115ba4729..e0780614a 100644 --- a/securemail/securemail.php +++ b/securemail/securemail.php @@ -86,7 +86,6 @@ function securemail_settings_post(App &$a, array &$b) DI::pConfig()->set(local_user(), 'securemail', 'pkey', trim($_POST['securemail-pkey'])); $enable = (!empty($_POST['securemail-enable']) ? 1 : 0); DI::pConfig()->set(local_user(), 'securemail', 'enable', $enable); - info(DI::l10n()->t('Secure Mail Settings saved.') . EOL); if ($_POST['securemail-submit'] == DI::l10n()->t('Save and send test')) { diff --git a/showmore/showmore.php b/showmore/showmore.php index 277c29ced..d8eccfddf 100644 --- a/showmore/showmore.php +++ b/showmore/showmore.php @@ -73,7 +73,6 @@ function showmore_addon_settings_post(&$a, &$b) $enable = (!empty($_POST['showmore-enable']) ? intval($_POST['showmore-enable']) : 0); $disable = 1-$enable; DI::pConfig()->set(local_user(), 'showmore', 'disable', $disable); - info(DI::l10n()->t('Show More Settings saved.') . EOL); } } diff --git a/statusnet/statusnet.php b/statusnet/statusnet.php index 0fd1fd79f..de2fad9c6 100644 --- a/statusnet/statusnet.php +++ b/statusnet/statusnet.php @@ -224,8 +224,6 @@ function statusnet_settings_post(App $a, $post) if (!intval($_POST['statusnet-mirror'])) DI::pConfig()->delete(local_user(), 'statusnet', 'lastid'); - - info(DI::l10n()->t('GNU Social settings updated.') . EOL); } } } diff --git a/superblock/superblock.php b/superblock/superblock.php index e0b3ff83e..9ba9c6d24 100644 --- a/superblock/superblock.php +++ b/superblock/superblock.php @@ -68,7 +68,6 @@ function superblock_addon_settings_post(&$a, &$b) if (!empty($_POST['superblock-submit'])) { DI::pConfig()->set(local_user(), 'system', 'blocked',trim($_POST['superblock-words'])); - info(DI::l10n()->t('SUPERBLOCK Settings saved.') . EOL); } } @@ -163,6 +162,5 @@ function superblock_init(&$a) } DI::pConfig()->set(local_user(), 'system', 'blocked', $words); - info(DI::l10n()->t('superblock settings updated') . EOL ); exit(); } diff --git a/tumblr/tumblr.php b/tumblr/tumblr.php index e42e97aaf..23127980e 100644 --- a/tumblr/tumblr.php +++ b/tumblr/tumblr.php @@ -90,8 +90,6 @@ function tumblr_addon_admin_post(App $a) DI::config()->set('tumblr', 'consumer_key',$consumer_key); DI::config()->set('tumblr', 'consumer_secret',$consumer_secret); - - info(DI::l10n()->t('Settings updated.'). EOL); } function tumblr_connect(App $a) diff --git a/twitter/twitter.php b/twitter/twitter.php index 948bb6be6..4391dffba 100644 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -241,9 +241,9 @@ function twitter_settings_post(App $a) DI::pConfig()->set(local_user(), 'twitter', 'oauthsecret', $token['oauth_token_secret']); DI::pConfig()->set(local_user(), 'twitter', 'post', 1); } catch(Exception $e) { - info($e->getMessage()); + notice($e->getMessage()); } catch(TwitterOAuthException $e) { - info($e->getMessage()); + notice($e->getMessage()); } // reload the Addon Settings page, if we don't do it see Bug #42 DI::baseUrl()->redirect('settings/connectors'); @@ -259,8 +259,6 @@ function twitter_settings_post(App $a) if (!intval($_POST['twitter-mirror'])) { DI::pConfig()->delete(local_user(), 'twitter', 'lastid'); } - - info(DI::l10n()->t('Twitter settings updated.') . EOL); } } } @@ -737,7 +735,6 @@ function twitter_addon_admin_post(App $a) $consumersecret = !empty($_POST['consumersecret']) ? Strings::escapeTags(trim($_POST['consumersecret'])) : ''; DI::config()->set('twitter', 'consumerkey', $consumerkey); DI::config()->set('twitter', 'consumersecret', $consumersecret); - info(DI::l10n()->t('Settings updated.') . EOL); } function twitter_addon_admin(App $a, &$o) diff --git a/webrtc/webrtc.php b/webrtc/webrtc.php index 0399eddef..f2facf68b 100644 --- a/webrtc/webrtc.php +++ b/webrtc/webrtc.php @@ -34,7 +34,6 @@ function webrtc_addon_admin (&$a, &$o) { function webrtc_addon_admin_post (&$a) { $url = (!empty($_POST['webrtcurl']) ? Strings::escapeTags(trim($_POST['webrtcurl'])) : ''); DI::config()->set('webrtc', 'webrtcurl', $url); - info(DI::l10n()->t('Settings updated.'). EOL); } function webrtc_module() { diff --git a/windowsphonepush/windowsphonepush.php b/windowsphonepush/windowsphonepush.php index e24a9b208..3c91a46d5 100644 --- a/windowsphonepush/windowsphonepush.php +++ b/windowsphonepush/windowsphonepush.php @@ -91,8 +91,6 @@ function windowsphonepush_settings_post($a, $post) } DI::pConfig()->set(local_user(), 'windowsphonepush', 'senditemtext', intval($_POST['windowsphonepush-senditemtext'])); - - info(DI::l10n()->t('WindowsPhonePush settings updated.') . EOL); } /* Called from the Addon Setting form. diff --git a/xmpp/xmpp.php b/xmpp/xmpp.php index 33da97155..67ce1e005 100644 --- a/xmpp/xmpp.php +++ b/xmpp/xmpp.php @@ -38,8 +38,6 @@ function xmpp_addon_settings_post() DI::pConfig()->set(local_user(), 'xmpp', 'enabled', $_POST['xmpp_enabled'] ?? false); DI::pConfig()->set(local_user(), 'xmpp', 'individual', $_POST['xmpp_individual'] ?? false); DI::pConfig()->set(local_user(), 'xmpp', 'bosh_proxy', $_POST['xmpp_bosh_proxy'] ?? ''); - - info(DI::l10n()->t('XMPP settings updated.') . EOL); } function xmpp_addon_settings(App $a, &$s) @@ -121,8 +119,6 @@ function xmpp_addon_admin_post() DI::config()->set('xmpp', 'bosh_proxy', $bosh_proxy); DI::config()->set('xmpp', 'central_userbase', $central_userbase); - - info(DI::l10n()->t('Settings updated.') . EOL); } function xmpp_script(App $a) From 8fbf514e3d6fd36e4b18bfc173ed0a5b3656532a Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 23 Jul 2020 06:07:17 +0000 Subject: [PATCH 15/46] Standards --- curweather/curweather.php | 2 +- forumdirectory/forumdirectory.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/curweather/curweather.php b/curweather/curweather.php index d9a1d2029..93141f233 100644 --- a/curweather/curweather.php +++ b/curweather/curweather.php @@ -52,7 +52,7 @@ function getWeather($loc, $units = 'metric', $lang = 'en', $appid = '', $cacheti $res = new SimpleXMLElement(Network::fetchUrl($url)); } catch (Exception $e) { if (empty($_SESSION['curweather_notice_shown'])) { - notice(DI::l10n()->t('Error fetching weather data. Error was: '.$e->getMessage())); + notice(DI::l10n()->t('Error fetching weather data. Error was: ' . $e->getMessage())); $_SESSION['curweather_notice_shown'] = true; } diff --git a/forumdirectory/forumdirectory.php b/forumdirectory/forumdirectory.php index 566e32a35..2b12bf51e 100644 --- a/forumdirectory/forumdirectory.php +++ b/forumdirectory/forumdirectory.php @@ -127,7 +127,7 @@ function forumdirectory_content(App $a) } DBA::close($r); } else { - notice(DI::l10n()->t("No entries \x28some entries may be hidden\x29.") . EOL); + notice(DI::l10n()->t("No entries \x28some entries may be hidden\x29.")); } $tpl = Renderer::getMarkupTemplate('directory_header.tpl'); From cc7a1b181c4b6d43294d0e73d87e5028600f1eb9 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 25 Jul 2020 11:49:44 +0000 Subject: [PATCH 16/46] Rearranged order for the "updateAvatar" function --- discourse/discourse.php | 2 +- pumpio/pumpio.php | 2 +- twitter/twitter.php | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/discourse/discourse.php b/discourse/discourse.php index b3f95bbb4..3ee980ceb 100644 --- a/discourse/discourse.php +++ b/discourse/discourse.php @@ -203,7 +203,7 @@ function discourse_get_user($post, $hostaddr) $avatar = $contact['photo']; unset($contact['photo']); DBA::update('contact', $contact, ['id' => $contact['id']]); - Contact::updateAvatar($avatar, 0, $contact['id']); + Contact::updateAvatar($contact['id'], $avatar); $contact['photo'] = $avatar; } diff --git a/pumpio/pumpio.php b/pumpio/pumpio.php index 2144257db..6b61a5946 100644 --- a/pumpio/pumpio.php +++ b/pumpio/pumpio.php @@ -1068,7 +1068,7 @@ function pumpio_get_contact($uid, $contact, $no_insert = false) } if (!empty($contact->image->url)) { - Contact::updateAvatar($contact->image->url, $uid, $contact_id); + Contact::updateAvatar($contact_id, $contact->image->url); } return $contact_id; diff --git a/twitter/twitter.php b/twitter/twitter.php index a44bb05ed..375e264cd 100644 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -1128,7 +1128,7 @@ function twitter_fetch_contact($uid, $data, $create_user) if (!empty($cid)) { DBA::update('contact', $fields, ['id' => $cid]); - Contact::updateAvatar($avatar, 0, $cid); + Contact::updateAvatar($cid, $avatar); } $contact = DBA::selectFirst('contact', [], ['uid' => $uid, 'alias' => "twitter::" . $data->id_str]); @@ -1160,7 +1160,7 @@ function twitter_fetch_contact($uid, $data, $create_user) Group::addMember(User::getDefaultGroup($uid), $contact_id); - Contact::updateAvatar($avatar, $uid, $contact_id); + Contact::updateAvatar($contact_id, $avatar); } else { if ($contact["readonly"] || $contact["blocked"]) { Logger::log("twitter_fetch_contact: Contact '" . $contact["nick"] . "' is blocked or readonly.", Logger::DEBUG); @@ -1176,7 +1176,7 @@ function twitter_fetch_contact($uid, $data, $create_user) $update = true; } - Contact::updateAvatar($avatar, $uid, $contact['id']); + Contact::updateAvatar($contact['id'], $avatar); if ($contact['name'] != $data->name) { $fields['name-date'] = $fields['uri-date'] = DateTimeFormat::utcNow(); From 203672cf27fc45e264dd0d6dd507ffc4da837e4d Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Mon, 27 Jul 2020 08:30:41 -0400 Subject: [PATCH 17/46] [various] Remove redundant uninstall functions - All hooks (current and obsolete) are removed automatically during addon uninstall --- .../advancedcontentfilter.php | 7 - blackout/blackout.php | 3 - blockbot/blockbot.php | 5 - blockem/blockem.php | 12 - blogger/blogger.php | 16 - buffer/buffer.php | 10 - buglink/buglink.php | 5 - calc/calc.php | 5 - catavatar/catavatar.php | 12 - convert/convert.php | 454 +++++++++--------- curweather/curweather.php | 7 - diaspora/diaspora.php | 10 - dwpost/dwpost.php | 9 - forumdirectory/forumdirectory.php | 5 - fromapp/fromapp.php | 9 - geocoordinates/geocoordinates.php | 7 - gnot/gnot.php | 13 - googlemaps/googlemaps.php | 7 - gravatar/gravatar.php | 10 - group_text/group_text.php | 12 - highlightjs/highlightjs.php | 6 - ifttt/ifttt.php | 6 - ijpost/ijpost.php | 9 - impressum/impressum.php | 7 - .../infiniteimprobabilitydrive.php | 5 - irc/irc.php | 7 - jappixmini/jappixmini.php | 13 - krynn/krynn.php | 25 +- langfilter/langfilter.php | 8 - ldapauth/ldapauth.php | 6 - leistungsschutzrecht/leistungsschutzrecht.php | 7 - libertree/libertree.php | 10 - libravatar/libravatar.php | 10 - ljpost/ljpost.php | 9 - mahjongg/mahjongg.php | 5 - mailstream/mailstream.php | 13 - mastodoncustomemojis/mastodoncustomemojis.php | 10 - mathjax/mathjax.php | 12 - membersince/membersince.php | 5 - morechoice/morechoice.php | 12 - morepokes/morepokes.php | 5 - namethingy/namethingy.php | 5 - newmemberwidget/newmemberwidget.php | 5 - notifyall/notifyall.php | 10 - notimeline/notimeline.php | 6 - nsfw/nsfw.php | 8 - numfriends/numfriends.php | 10 - openstreetmap/openstreetmap.php | 12 - piwik/piwik.php | 7 - planets/planets.php | 21 - public_server/public_server.php | 9 - pumpio/pumpio.php | 13 - qcomment/qcomment.php | 6 - randplace/randplace.php | 11 +- remote_permissions/remote_permissions.php | 6 - rendertime/rendertime.php | 6 - securemail/securemail.php | 10 - showmore/showmore.php | 7 - .../lang/smiley_pack_es/smiley_pack_es.php | 6 - .../lang/smiley_pack_fr/smiley_pack_fr.php | 6 - smiley_pack/smiley_pack.php | 6 - smileybutton/smileybutton.php | 10 - smilies_adult/smilies_adult.php | 6 - sniper/sniper.php | 5 - startpage/startpage.php | 7 - statusnet/statusnet.php | 18 - superblock/superblock.php | 9 - testdrive/testdrive.php | 11 - tictac/tictac.php | 5 - tumblr/tumblr.php | 10 - unicode_smilies/unicode_smilies.php | 4 - viewsrc/viewsrc.php | 7 - webrtc/webrtc.php | 5 - widgets/widgets.php | 5 - windowsphonepush/windowsphonepush.php | 12 - wppost/wppost.php | 16 - xmpp/xmpp.php | 8 - 77 files changed, 229 insertions(+), 887 deletions(-) diff --git a/advancedcontentfilter/advancedcontentfilter.php b/advancedcontentfilter/advancedcontentfilter.php index 866b0b11f..c539075bb 100644 --- a/advancedcontentfilter/advancedcontentfilter.php +++ b/advancedcontentfilter/advancedcontentfilter.php @@ -65,13 +65,6 @@ function advancedcontentfilter_install(App $a) Logger::log("installed advancedcontentfilter"); } -function advancedcontentfilter_uninstall() -{ - Hook::unregister('dbstructure_definition' , __FILE__, 'advancedcontentfilter_dbstructure_definition'); - Hook::unregister('prepare_body_content_filter', __FILE__, 'advancedcontentfilter_prepare_body_content_filter'); - Hook::unregister('addon_settings' , __FILE__, 'advancedcontentfilter_addon_settings'); -} - /* * Hooks */ diff --git a/blackout/blackout.php b/blackout/blackout.php index 19f99f1e8..83b2dbc1a 100644 --- a/blackout/blackout.php +++ b/blackout/blackout.php @@ -54,9 +54,6 @@ function blackout_install() { Hook::register('page_header', 'addon/blackout/blackout.php', 'blackout_redirect'); } -function blackout_uninstall() { - Hook::unregister('page_header', 'addon/blackout/blackout.php', 'blackout_redirect'); -} function blackout_redirect ($a, $b) { // if we have a logged in user, don't throw her out if (local_user()) { diff --git a/blockbot/blockbot.php b/blockbot/blockbot.php index 61715b289..eee222df2 100644 --- a/blockbot/blockbot.php +++ b/blockbot/blockbot.php @@ -22,11 +22,6 @@ function blockbot_install() { Hook::register('init_1', __FILE__, 'blockbot_init_1'); } - -function blockbot_uninstall() { - Hook::unregister('init_1', __FILE__, 'blockbot_init_1'); -} - function blockbot_addon_admin(&$a, &$o) { $t = Renderer::getMarkupTemplate("admin.tpl", "addon/blockbot/"); diff --git a/blockem/blockem.php b/blockem/blockem.php index 1a3172841..1880b9be4 100644 --- a/blockem/blockem.php +++ b/blockem/blockem.php @@ -23,18 +23,6 @@ function blockem_install() Hook::register('enotify_store' , 'addon/blockem/blockem.php', 'blockem_enotify_store'); } -function blockem_uninstall() -{ - Hook::unregister('prepare_body_content_filter', 'addon/blockem/blockem.php', 'blockem_prepare_body_content_filter'); - Hook::unregister('prepare_body' , 'addon/blockem/blockem.php', 'blockem_prepare_body'); - Hook::unregister('display_item' , 'addon/blockem/blockem.php', 'blockem_display_item'); - Hook::unregister('addon_settings' , 'addon/blockem/blockem.php', 'blockem_addon_settings'); - Hook::unregister('addon_settings_post' , 'addon/blockem/blockem.php', 'blockem_addon_settings_post'); - Hook::unregister('conversation_start' , 'addon/blockem/blockem.php', 'blockem_conversation_start'); - Hook::unregister('item_photo_menu' , 'addon/blockem/blockem.php', 'blockem_item_photo_menu'); - Hook::unregister('enotify_store' , 'addon/blockem/blockem.php', 'blockem_enotify_store'); -} - function blockem_addon_settings (App $a, &$s) { if (!local_user()) { diff --git a/blogger/blogger.php b/blogger/blogger.php index 0d201305f..5cf0d27b3 100644 --- a/blogger/blogger.php +++ b/blogger/blogger.php @@ -23,22 +23,6 @@ function blogger_install() Hook::register('connector_settings_post', 'addon/blogger/blogger.php', 'blogger_settings_post'); } -function blogger_uninstall() -{ - Hook::unregister('hook_fork', 'addon/blogger/blogger.php', 'blogger_hook_fork'); - Hook::unregister('post_local', 'addon/blogger/blogger.php', 'blogger_post_local'); - Hook::unregister('notifier_normal', 'addon/blogger/blogger.php', 'blogger_send'); - Hook::unregister('jot_networks', 'addon/blogger/blogger.php', 'blogger_jot_nets'); - Hook::unregister('connector_settings', 'addon/blogger/blogger.php', 'blogger_settings'); - Hook::unregister('connector_settings_post', 'addon/blogger/blogger.php', 'blogger_settings_post'); - - // obsolete - remove - Hook::unregister('post_local_end', 'addon/blogger/blogger.php', 'blogger_send'); - Hook::unregister('addon_settings', 'addon/blogger/blogger.php', 'blogger_settings'); - Hook::unregister('addon_settings_post', 'addon/blogger/blogger.php', 'blogger_settings_post'); -} - - function blogger_jot_nets(App $a, array &$jotnets_fields) { if (!local_user()) { diff --git a/buffer/buffer.php b/buffer/buffer.php index 2a7004c82..9bbdf21e5 100644 --- a/buffer/buffer.php +++ b/buffer/buffer.php @@ -29,16 +29,6 @@ function buffer_install() Hook::register('connector_settings_post', 'addon/buffer/buffer.php', 'buffer_settings_post'); } -function buffer_uninstall() -{ - Hook::unregister('hook_fork', 'addon/buffer/buffer.php', 'buffer_hook_fork'); - Hook::unregister('post_local', 'addon/buffer/buffer.php', 'buffer_post_local'); - Hook::unregister('notifier_normal', 'addon/buffer/buffer.php', 'buffer_send'); - Hook::unregister('jot_networks', 'addon/buffer/buffer.php', 'buffer_jot_nets'); - Hook::unregister('connector_settings', 'addon/buffer/buffer.php', 'buffer_settings'); - Hook::unregister('connector_settings_post', 'addon/buffer/buffer.php', 'buffer_settings_post'); -} - function buffer_module() { } diff --git a/buglink/buglink.php b/buglink/buglink.php index 2414a3a32..9ea20b56e 100644 --- a/buglink/buglink.php +++ b/buglink/buglink.php @@ -15,11 +15,6 @@ function buglink_install() Hook::register('page_end', 'addon/buglink/buglink.php', 'buglink_active'); } -function buglink_uninstall() -{ - Hook::unregister('page_end', 'addon/buglink/buglink.php', 'buglink_active'); -} - function buglink_active(App $a, &$b) { $b .= ''; diff --git a/calc/calc.php b/calc/calc.php index 61e9c5db8..7019a80f0 100644 --- a/calc/calc.php +++ b/calc/calc.php @@ -12,11 +12,6 @@ function calc_install() { Hook::register('app_menu', 'addon/calc/calc.php', 'calc_app_menu'); } -function calc_uninstall() { - Hook::unregister('app_menu', 'addon/calc/calc.php', 'calc_app_menu'); - -} - function calc_app_menu($a,&$b) { $b['app_menu'][] = ''; } diff --git a/catavatar/catavatar.php b/catavatar/catavatar.php index db67a3554..e0daa6cd7 100644 --- a/catavatar/catavatar.php +++ b/catavatar/catavatar.php @@ -31,18 +31,6 @@ function catavatar_install() Logger::log('registered catavatar'); } -/** - * Removes the addon hook - */ -function catavatar_uninstall() -{ - Hook::unregister('avatar_lookup', 'addon/catavatar/catavatar.php', 'catavatar_lookup'); - Hook::unregister('addon_settings', 'addon/catavatar/catavatar.php', 'catavatar_addon_settings'); - Hook::unregister('addon_settings_post', 'addon/catavatar/catavatar.php', 'catavatar_addon_settings_post'); - - Logger::log('unregistered catavatar'); -} - /** * Cat avatar user settings page */ diff --git a/convert/convert.php b/convert/convert.php index e95637418..5449cc14b 100644 --- a/convert/convert.php +++ b/convert/convert.php @@ -1,229 +1,225 @@ - - */ -use Friendica\Core\Hook; - -function convert_install() { - Hook::register('app_menu', 'addon/convert/convert.php', 'convert_app_menu'); -} - -function convert_uninstall() { - Hook::unregister('app_menu', 'addon/convert/convert.php', 'convert_app_menu'); -} - -function convert_app_menu($a,&$b) { - $b['app_menu'][] = ''; -} - - -function convert_module() {} - - - - - - - -function convert_content($app) { - -include("UnitConvertor.php"); - - class TP_Converter extends UnitConvertor { - function TP_Converter($lang = "en") - { - if ($lang != 'en' ) { - $dec_point = '.'; $thousand_sep = "'"; - } else { - $dec_point = '.'; $thousand_sep = ","; - } - - $this->UnitConvertor($dec_point , $thousand_sep ); - - } // end func UnitConvertor - - function find_base_unit($from,$to) { - while (list($skey,$sval) = each($this->bases)) { - if ($skey == $from || $to == $skey || in_array($to,$sval) || in_array($from,$sval)) { - return $skey; - } - } - return false; - } - - function getTable($value, $from_unit, $to_unit, $precision) { - - if ($base_unit = $this->find_base_unit($from_unit,$to_unit)) { - - // A baseunit was found now lets convert from -> $base_unit - - $cell ['value'] = $this->convert($value, $from_unit, $base_unit, $precision)." ".$base_unit; - $cell ['class'] = ($base_unit == $from_unit || $base_unit == $to_unit) ? "framedred": ""; - $cells[] = $cell; - // We now have the base unit and value now lets produce the table; - while (list($key,$val) = each($this->bases[$base_unit])) { - $cell ['value'] = $this->convert($value, $from_unit, $val, $precision)." ".$val; - $cell ['class'] = ($val == $from_unit || $val == $to_unit) ? "framedred": ""; - $cells[] = $cell; - } - - $cc = count($cells); - $string = ""; - $string .= ""; - $i=0; - foreach ($cells as $cell) { - if ($i==0) { - $string .= ""; - $i++; - } else { - $string .= ""; - } - } - $string .= "
$value $from_unit".$cell['value']."
".$cell['value']."
"; - return $string; - } - - } -} - - -$conv = new TP_Converter('en'); - - -$conversions = [ - 'Temperature'=>['base' =>'Celsius', - 'conv'=>[ - 'Fahrenheit'=>['ratio'=>1.8, 'offset'=>32], - 'Kelvin'=>['ratio'=>1, 'offset'=>273], - 'Reaumur'=>0.8 - ] - ], - 'Weight' => ['base' =>'kg', - 'conv'=>[ - 'g'=>1000, - 'mg'=>1000000, - 't'=>0.001, - 'grain'=>15432, - 'oz'=>35.274, - 'lb'=>2.2046, - 'cwt(UK)' => 0.019684, - 'cwt(US)' => 0.022046, - 'ton (US)' => 0.0011023, - 'ton (UK)' => 0.0009842 - ] - ], - 'Distance' => ['base' =>'km', - 'conv'=>[ - 'm'=>1000, - 'dm'=>10000, - 'cm'=>100000, - 'mm'=>1000000, - 'mile'=>0.62137, - 'naut.mile'=>0.53996, - 'inch(es)'=>39370, - 'ft'=>3280.8, - 'yd'=>1093.6, - 'furlong'=>4.970969537898672, - 'fathom'=>546.8066491688539 - ] - ], - 'Area' => ['base' =>'km 2', - 'conv'=>[ - 'ha'=>100, - 'acre'=>247.105, - 'm 2'=>pow(1000,2), - 'dm 2'=>pow(10000,2), - 'cm 2'=>pow(100000,2), - 'mm 2'=>pow(1000000,2), - 'mile 2'=>pow(0.62137,2), - 'naut.miles 2'=>pow(0.53996,2), - 'in 2'=>pow(39370,2), - 'ft 2'=>pow(3280.8,2), - 'yd 2'=>pow(1093.6,2), - ] - ], - 'Volume' => ['base' =>'m 3', - 'conv'=>[ - 'in 3'=>61023.6, - 'ft 3'=>35.315, - 'cm 3'=>pow(10,6), - 'dm 3'=>1000, - 'litre'=>1000, - 'hl'=>10, - 'yd 3'=>1.30795, - 'gal(US)'=>264.172, - 'gal(UK)'=>219.969, - 'pint' => 2113.376, - 'quart' => 1056.688, - 'cup' => 4266.753, - 'fl oz' => 33814.02, - 'tablespoon' => 67628.04, - 'teaspoon' => 202884.1, - 'pt (UK)'=>1000/0.56826, - 'barrel petroleum'=>1000/158.99, - 'Register Tons'=>2.832, - 'Ocean Tons'=>1.1327 - ] - ], - 'Speed' =>['base' =>'kmph', - 'conv'=>[ - 'mps'=>0.0001726031, - 'milesph'=>0.62137, - 'knots'=>0.53996, - 'mach STP'=>0.0008380431, - 'c (warp)'=>9.265669e-10 - ] - ] -]; - - -while (list($key,$val) = each($conversions)) { - $conv->addConversion($val['base'], $val['conv']); - $list[$key][] = $val['base']; - while (list($ukey,$uval) = each($val['conv'])) { - $list[$key][] = $ukey; - } -} - - $o .= '

Unit Conversions

'; - - - if (isset($_POST['from_unit']) && isset($_POST['value'])) { - $_POST['value'] = $_POST['value'] + 0; - - - $o .= ($conv->getTable($_POST['value'], $_POST['from_unit'], $_POST['to_unit'], 5))."

"; - } else { - $o .= "

Select:

"; - } - - if(isset($_POST['value'])) - $value = $_POST['value']; - else - $value = ''; - - $o .= '
'; - $o .= ''; - $o .= ''; - - $o .= '
'; - - return $o; -} + + */ +use Friendica\Core\Hook; + +function convert_install() { + Hook::register('app_menu', 'addon/convert/convert.php', 'convert_app_menu'); +} + +function convert_app_menu($a,&$b) { + $b['app_menu'][] = ''; +} + + +function convert_module() {} + + + + + + + +function convert_content($app) { + +include("UnitConvertor.php"); + + class TP_Converter extends UnitConvertor { + function TP_Converter($lang = "en") + { + if ($lang != 'en' ) { + $dec_point = '.'; $thousand_sep = "'"; + } else { + $dec_point = '.'; $thousand_sep = ","; + } + + $this->UnitConvertor($dec_point , $thousand_sep ); + + } // end func UnitConvertor + + function find_base_unit($from,$to) { + while (list($skey,$sval) = each($this->bases)) { + if ($skey == $from || $to == $skey || in_array($to,$sval) || in_array($from,$sval)) { + return $skey; + } + } + return false; + } + + function getTable($value, $from_unit, $to_unit, $precision) { + + if ($base_unit = $this->find_base_unit($from_unit,$to_unit)) { + + // A baseunit was found now lets convert from -> $base_unit + + $cell ['value'] = $this->convert($value, $from_unit, $base_unit, $precision)." ".$base_unit; + $cell ['class'] = ($base_unit == $from_unit || $base_unit == $to_unit) ? "framedred": ""; + $cells[] = $cell; + // We now have the base unit and value now lets produce the table; + while (list($key,$val) = each($this->bases[$base_unit])) { + $cell ['value'] = $this->convert($value, $from_unit, $val, $precision)." ".$val; + $cell ['class'] = ($val == $from_unit || $val == $to_unit) ? "framedred": ""; + $cells[] = $cell; + } + + $cc = count($cells); + $string = ""; + $string .= ""; + $i=0; + foreach ($cells as $cell) { + if ($i==0) { + $string .= ""; + $i++; + } else { + $string .= ""; + } + } + $string .= "
$value $from_unit".$cell['value']."
".$cell['value']."
"; + return $string; + } + + } +} + + +$conv = new TP_Converter('en'); + + +$conversions = [ + 'Temperature'=>['base' =>'Celsius', + 'conv'=>[ + 'Fahrenheit'=>['ratio'=>1.8, 'offset'=>32], + 'Kelvin'=>['ratio'=>1, 'offset'=>273], + 'Reaumur'=>0.8 + ] + ], + 'Weight' => ['base' =>'kg', + 'conv'=>[ + 'g'=>1000, + 'mg'=>1000000, + 't'=>0.001, + 'grain'=>15432, + 'oz'=>35.274, + 'lb'=>2.2046, + 'cwt(UK)' => 0.019684, + 'cwt(US)' => 0.022046, + 'ton (US)' => 0.0011023, + 'ton (UK)' => 0.0009842 + ] + ], + 'Distance' => ['base' =>'km', + 'conv'=>[ + 'm'=>1000, + 'dm'=>10000, + 'cm'=>100000, + 'mm'=>1000000, + 'mile'=>0.62137, + 'naut.mile'=>0.53996, + 'inch(es)'=>39370, + 'ft'=>3280.8, + 'yd'=>1093.6, + 'furlong'=>4.970969537898672, + 'fathom'=>546.8066491688539 + ] + ], + 'Area' => ['base' =>'km 2', + 'conv'=>[ + 'ha'=>100, + 'acre'=>247.105, + 'm 2'=>pow(1000,2), + 'dm 2'=>pow(10000,2), + 'cm 2'=>pow(100000,2), + 'mm 2'=>pow(1000000,2), + 'mile 2'=>pow(0.62137,2), + 'naut.miles 2'=>pow(0.53996,2), + 'in 2'=>pow(39370,2), + 'ft 2'=>pow(3280.8,2), + 'yd 2'=>pow(1093.6,2), + ] + ], + 'Volume' => ['base' =>'m 3', + 'conv'=>[ + 'in 3'=>61023.6, + 'ft 3'=>35.315, + 'cm 3'=>pow(10,6), + 'dm 3'=>1000, + 'litre'=>1000, + 'hl'=>10, + 'yd 3'=>1.30795, + 'gal(US)'=>264.172, + 'gal(UK)'=>219.969, + 'pint' => 2113.376, + 'quart' => 1056.688, + 'cup' => 4266.753, + 'fl oz' => 33814.02, + 'tablespoon' => 67628.04, + 'teaspoon' => 202884.1, + 'pt (UK)'=>1000/0.56826, + 'barrel petroleum'=>1000/158.99, + 'Register Tons'=>2.832, + 'Ocean Tons'=>1.1327 + ] + ], + 'Speed' =>['base' =>'kmph', + 'conv'=>[ + 'mps'=>0.0001726031, + 'milesph'=>0.62137, + 'knots'=>0.53996, + 'mach STP'=>0.0008380431, + 'c (warp)'=>9.265669e-10 + ] + ] +]; + + +while (list($key,$val) = each($conversions)) { + $conv->addConversion($val['base'], $val['conv']); + $list[$key][] = $val['base']; + while (list($ukey,$uval) = each($val['conv'])) { + $list[$key][] = $ukey; + } +} + + $o .= '

Unit Conversions

'; + + + if (isset($_POST['from_unit']) && isset($_POST['value'])) { + $_POST['value'] = $_POST['value'] + 0; + + + $o .= ($conv->getTable($_POST['value'], $_POST['from_unit'], $_POST['to_unit'], 5))."

"; + } else { + $o .= "

Select:

"; + } + + if(isset($_POST['value'])) + $value = $_POST['value']; + else + $value = ''; + + $o .= '
'; + $o .= ''; + $o .= ''; + + $o .= '
'; + + return $o; +} diff --git a/curweather/curweather.php b/curweather/curweather.php index 2ee55b264..2b8682d15 100644 --- a/curweather/curweather.php +++ b/curweather/curweather.php @@ -24,13 +24,6 @@ function curweather_install() Hook::register('addon_settings_post', 'addon/curweather/curweather.php', 'curweather_addon_settings_post'); } -function curweather_uninstall() -{ - Hook::unregister('network_mod_init' , 'addon/curweather/curweather.php', 'curweather_network_mod_init'); - Hook::unregister('addon_settings' , 'addon/curweather/curweather.php', 'curweather_addon_settings'); - Hook::unregister('addon_settings_post', 'addon/curweather/curweather.php', 'curweather_addon_settings_post'); -} - // get the weather data from OpenWeatherMap function getWeather($loc, $units = 'metric', $lang = 'en', $appid = '', $cachetime = 0) { diff --git a/diaspora/diaspora.php b/diaspora/diaspora.php index 0a43462c6..77aef3af0 100644 --- a/diaspora/diaspora.php +++ b/diaspora/diaspora.php @@ -29,16 +29,6 @@ function diaspora_install() Hook::register('connector_settings_post', 'addon/diaspora/diaspora.php', 'diaspora_settings_post'); } -function diaspora_uninstall() -{ - Hook::unregister('hook_fork', 'addon/diaspora/diaspora.php', 'diaspora_hook_fork'); - Hook::unregister('post_local', 'addon/diaspora/diaspora.php', 'diaspora_post_local'); - Hook::unregister('notifier_normal', 'addon/diaspora/diaspora.php', 'diaspora_send'); - Hook::unregister('jot_networks', 'addon/diaspora/diaspora.php', 'diaspora_jot_nets'); - Hook::unregister('connector_settings', 'addon/diaspora/diaspora.php', 'diaspora_settings'); - Hook::unregister('connector_settings_post', 'addon/diaspora/diaspora.php', 'diaspora_settings_post'); -} - function diaspora_jot_nets(App $a, array &$jotnets_fields) { if (!local_user()) { diff --git a/dwpost/dwpost.php b/dwpost/dwpost.php index 9a973b672..da35aa0fd 100644 --- a/dwpost/dwpost.php +++ b/dwpost/dwpost.php @@ -27,15 +27,6 @@ function dwpost_install() Hook::register('connector_settings_post', 'addon/dwpost/dwpost.php', 'dwpost_settings_post'); } -function dwpost_uninstall() -{ - Hook::unregister('post_local', 'addon/dwpost/dwpost.php', 'dwpost_post_local'); - Hook::unregister('notifier_normal', 'addon/dwpost/dwpost.php', 'dwpost_send'); - Hook::unregister('jot_networks', 'addon/dwpost/dwpost.php', 'dwpost_jot_nets'); - Hook::unregister('connector_settings', 'addon/dwpost/dwpost.php', 'dwpost_settings'); - Hook::unregister('connector_settings_post', 'addon/dwpost/dwpost.php', 'dwpost_settings_post'); -} - function dwpost_jot_nets(App $a, array &$jotnets_fields) { if (!local_user()) { diff --git a/forumdirectory/forumdirectory.php b/forumdirectory/forumdirectory.php index 2b12bf51e..ce37e8e55 100644 --- a/forumdirectory/forumdirectory.php +++ b/forumdirectory/forumdirectory.php @@ -23,11 +23,6 @@ function forumdirectory_install() Hook::register('app_menu', 'addon/forumdirectory/forumdirectory.php', 'forumdirectory_app_menu'); } -function forumdirectory_uninstall() -{ - Hook::unregister('app_menu', 'addon/forumdirectory/forumdirectory.php', 'forumdirectory_app_menu'); -} - function forumdirectory_module() { return; diff --git a/fromapp/fromapp.php b/fromapp/fromapp.php index 6c8e4717a..073b632c7 100644 --- a/fromapp/fromapp.php +++ b/fromapp/fromapp.php @@ -18,15 +18,6 @@ function fromapp_install() Logger::log("installed fromapp"); } - -function fromapp_uninstall() -{ - Hook::unregister('post_local', 'addon/fromapp/fromapp.php', 'fromapp_post_hook'); - Hook::unregister('addon_settings', 'addon/fromapp/fromapp.php', 'fromapp_settings'); - Hook::unregister('addon_settings_post', 'addon/fromapp/fromapp.php', 'fromapp_settings_post'); - Logger::log("removed fromapp"); -} - function fromapp_settings_post($a, $post) { if (!local_user() || empty($_POST['fromapp-submit'])) { diff --git a/geocoordinates/geocoordinates.php b/geocoordinates/geocoordinates.php index ef96ecb86..937e2f8c1 100644 --- a/geocoordinates/geocoordinates.php +++ b/geocoordinates/geocoordinates.php @@ -18,13 +18,6 @@ function geocoordinates_install() Hook::register('post_remote', 'addon/geocoordinates/geocoordinates.php', 'geocoordinates_post_hook'); } - -function geocoordinates_uninstall() -{ - Hook::unregister('post_local', 'addon/geocoordinates/geocoordinates.php', 'geocoordinates_post_hook'); - Hook::unregister('post_remote', 'addon/geocoordinates/geocoordinates.php', 'geocoordinates_post_hook'); -} - function geocoordinates_resolve_item(&$item) { if((!$item["coord"]) || ($item["location"])) diff --git a/gnot/gnot.php b/gnot/gnot.php index f24db4a1b..8420ffe49 100644 --- a/gnot/gnot.php +++ b/gnot/gnot.php @@ -22,19 +22,6 @@ function gnot_install() { Logger::log("installed gnot"); } - -function gnot_uninstall() { - - Hook::unregister('addon_settings', 'addon/gnot/gnot.php', 'gnot_settings'); - Hook::unregister('addon_settings_post', 'addon/gnot/gnot.php', 'gnot_settings_post'); - Hook::unregister('enotify_mail', 'addon/gnot/gnot.php', 'gnot_enotify_mail'); - - - Logger::log("removed gnot"); -} - - - /** * * Callback from the settings post function. diff --git a/googlemaps/googlemaps.php b/googlemaps/googlemaps.php index 09a566e8b..5555ec5ac 100644 --- a/googlemaps/googlemaps.php +++ b/googlemaps/googlemaps.php @@ -16,13 +16,6 @@ function googlemaps_install() Logger::log("installed googlemaps"); } -function googlemaps_uninstall() -{ - Hook::unregister('render_location', 'addon/googlemaps/googlemaps.php', 'googlemaps_location'); - - Logger::log("removed googlemaps"); -} - function googlemaps_location($a, &$item) { diff --git a/gravatar/gravatar.php b/gravatar/gravatar.php index febb12938..894abda6d 100644 --- a/gravatar/gravatar.php +++ b/gravatar/gravatar.php @@ -26,16 +26,6 @@ function gravatar_install() { Logger::log("registered gravatar in avatar_lookup hook"); } -/** - * Removes the addon hook - */ -function gravatar_uninstall() { - Hook::unregister('load_config', 'addon/gravatar/gravatar.php', 'gravatar_load_config'); - Hook::unregister('avatar_lookup', 'addon/gravatar/gravatar.php', 'gravatar_lookup'); - - Logger::log("unregistered gravatar in avatar_lookup hook"); -} - function gravatar_load_config(App $a, ConfigFileLoader $loader) { $a->getConfigCache()->load($loader->loadAddonConfig('gravatar')); diff --git a/group_text/group_text.php b/group_text/group_text.php index 06b3f6151..e0e61ee54 100644 --- a/group_text/group_text.php +++ b/group_text/group_text.php @@ -17,18 +17,6 @@ function group_text_install() { Logger::log("installed group_text"); } - -function group_text_uninstall() { - - Hook::unregister('addon_settings', 'addon/group_text/group_text.php', 'group_text_settings'); - Hook::unregister('addon_settings_post', 'addon/group_text/group_text.php', 'group_text_settings_post'); - - - Logger::log("removed group_text"); -} - - - /** * * Callback from the settings post function. diff --git a/highlightjs/highlightjs.php b/highlightjs/highlightjs.php index 823541bb4..c46c26aed 100644 --- a/highlightjs/highlightjs.php +++ b/highlightjs/highlightjs.php @@ -16,12 +16,6 @@ function highlightjs_install() Hook::register('footer', __FILE__, 'highlightjs_footer'); } -function highlightjs_uninstall() -{ - Hook::unregister('head' , __FILE__, 'highlightjs_head'); - Hook::unregister('footer', __FILE__, 'highlightjs_footer'); -} - function highlightjs_head(App $a, &$b) { if ($a->getCurrentTheme() == 'frio') { diff --git a/ifttt/ifttt.php b/ifttt/ifttt.php index 6ecfc160a..5021a63ed 100644 --- a/ifttt/ifttt.php +++ b/ifttt/ifttt.php @@ -23,12 +23,6 @@ function ifttt_install() Hook::register('connector_settings_post', 'addon/ifttt/ifttt.php', 'ifttt_settings_post'); } -function ifttt_uninstall() -{ - Hook::unregister('connector_settings', 'addon/ifttt/ifttt.php', 'ifttt_settings'); - Hook::unregister('connector_settings_post', 'addon/ifttt/ifttt.php', 'ifttt_settings_post'); -} - function ifttt_module() { diff --git a/ijpost/ijpost.php b/ijpost/ijpost.php index 0619c288a..15f2b41e6 100644 --- a/ijpost/ijpost.php +++ b/ijpost/ijpost.php @@ -25,15 +25,6 @@ function ijpost_install() Hook::register('connector_settings_post', 'addon/ijpost/ijpost.php', 'ijpost_settings_post'); } -function ijpost_uninstall() -{ - Hook::unregister('post_local', 'addon/ijpost/ijpost.php', 'ijpost_post_local'); - Hook::unregister('notifier_normal', 'addon/ijpost/ijpost.php', 'ijpost_send'); - Hook::unregister('jot_networks', 'addon/ijpost/ijpost.php', 'ijpost_jot_nets'); - Hook::unregister('connector_settings', 'addon/ijpost/ijpost.php', 'ijpost_settings'); - Hook::unregister('connector_settings_post', 'addon/ijpost/ijpost.php', 'ijpost_settings_post'); -} - function ijpost_jot_nets(\Friendica\App &$a, array &$jotnets_fields) { if (!local_user()) { diff --git a/impressum/impressum.php b/impressum/impressum.php index 0152189ef..4bbb419ba 100644 --- a/impressum/impressum.php +++ b/impressum/impressum.php @@ -23,13 +23,6 @@ function impressum_install() { Logger::log("installed impressum Addon"); } -function impressum_uninstall() { - Hook::unregister('load_config', 'addon/impressum/impressum.php', 'impressum_load_config'); - Hook::unregister('about_hook', 'addon/impressum/impressum.php', 'impressum_show'); - Hook::unregister('page_end', 'addon/impressum/impressum.php', 'impressum_footer'); - Logger::log("uninstalled impressum Addon"); -} - function impressum_module() { } function impressum_content() { diff --git a/infiniteimprobabilitydrive/infiniteimprobabilitydrive.php b/infiniteimprobabilitydrive/infiniteimprobabilitydrive.php index 126ea832d..a49982645 100644 --- a/infiniteimprobabilitydrive/infiniteimprobabilitydrive.php +++ b/infiniteimprobabilitydrive/infiniteimprobabilitydrive.php @@ -13,11 +13,6 @@ function infiniteimprobabilitydrive_install() Hook::register('app_menu', 'addon/infiniteimprobabilitydrive/infiniteimprobabilitydrive.php', 'infiniteimprobabilitydrive_app_menu'); } -function infiniteimprobabilitydrive_uninstall() -{ - Hook::unregister('app_menu', 'addon/infiniteimprobabilitydrive/infiniteimprobabilitydrive.php', 'infiniteimprobabilitydrive_app_menu'); -} - function infiniteimprobabilitydrive_app_menu($a, &$b) { $b['app_menu'][] = ''; diff --git a/irc/irc.php b/irc/irc.php index 6dccd4846..b5ba5172d 100644 --- a/irc/irc.php +++ b/irc/irc.php @@ -17,13 +17,6 @@ function irc_install() { Hook::register('addon_settings_post', 'addon/irc/irc.php', 'irc_addon_settings_post'); } -function irc_uninstall() { - Hook::unregister('app_menu', 'addon/irc/irc.php', 'irc_app_menu'); - Hook::unregister('addon_settings', 'addon/irc/irc.php', 'irc_addon_settings'); - -} - - function irc_addon_settings(&$a,&$s) { if(! local_user()) return; diff --git a/jappixmini/jappixmini.php b/jappixmini/jappixmini.php index 077e2b956..0333d8ecf 100644 --- a/jappixmini/jappixmini.php +++ b/jappixmini/jappixmini.php @@ -104,19 +104,6 @@ function jappixmini_install() } } -function jappixmini_uninstall() -{ - Hook::unregister('addon_settings', 'addon/jappixmini/jappixmini.php', 'jappixmini_settings'); - Hook::unregister('addon_settings_post', 'addon/jappixmini/jappixmini.php', 'jappixmini_settings_post'); - - Hook::unregister('page_end', 'addon/jappixmini/jappixmini.php', 'jappixmini_script'); - Hook::unregister('authenticate', 'addon/jappixmini/jappixmini.php', 'jappixmini_login'); - - Hook::unregister('cron', 'addon/jappixmini/jappixmini.php', 'jappixmini_cron'); - - Hook::unregister('about_hook', 'addon/jappixmini/jappixmini.php', 'jappixmini_download_source'); -} - function jappixmini_addon_admin(App $a, &$o) { // display instructions and warnings on addon settings page for admin diff --git a/krynn/krynn.php b/krynn/krynn.php index fe25fdf75..88aa84ea2 100644 --- a/krynn/krynn.php +++ b/krynn/krynn.php @@ -1,7 +1,7 @@ * Planets Author: Tony Baldwin @@ -38,27 +38,6 @@ function krynn_install() { Logger::log("installed krynn"); } - -function krynn_uninstall() { - - /** - * - * uninstall unregisters any hooks created with register_hook - * during install. It may also delete configuration settings - * and any other cleanup. - * - */ - - Hook::unregister('post_local', 'addon/krynn/krynn.php', 'krynn_post_hook'); - Hook::unregister('addon_settings', 'addon/krynn/krynn.php', 'krynn_settings'); - Hook::unregister('addon_settings_post', 'addon/krynn/krynn.php', 'krynn_settings_post'); - - - Logger::log("removed krynn"); -} - - - function krynn_post_hook($a, &$item) { /** @@ -70,8 +49,6 @@ function krynn_post_hook($a, &$item) { * */ - Logger::log('krynn invoked'); - if(! local_user()) /* non-zero if this is a logged in user of this system */ return; diff --git a/langfilter/langfilter.php b/langfilter/langfilter.php index f4884d19f..954884219 100644 --- a/langfilter/langfilter.php +++ b/langfilter/langfilter.php @@ -25,14 +25,6 @@ function langfilter_install() Hook::register('addon_settings_post', 'addon/langfilter/langfilter.php', 'langfilter_addon_settings_post'); } -function langfilter_uninstall() -{ - Hook::unregister('prepare_body_content_filter', 'addon/langfilter/langfilter.php', 'langfilter_prepare_body_content_filter'); - Hook::unregister('prepare_body', 'addon/langfilter/langfilter.php', 'langfilter_prepare_body'); - Hook::unregister('addon_settings', 'addon/langfilter/langfilter.php', 'langfilter_addon_settings'); - Hook::unregister('addon_settings_post', 'addon/langfilter/langfilter.php', 'langfilter_addon_settings_post'); -} - /* The settings * 1st check if somebody logged in is calling * 2nd get the current settings diff --git a/ldapauth/ldapauth.php b/ldapauth/ldapauth.php index 611079965..f99f6eeee 100644 --- a/ldapauth/ldapauth.php +++ b/ldapauth/ldapauth.php @@ -66,12 +66,6 @@ function ldapauth_install() Hook::register('authenticate', 'addon/ldapauth/ldapauth.php', 'ldapauth_hook_authenticate'); } -function ldapauth_uninstall() -{ - Hook::unregister('load_config', 'addon/ldapauth/ldapauth.php', 'ldapauth_load_config'); - Hook::unregister('authenticate', 'addon/ldapauth/ldapauth.php', 'ldapauth_hook_authenticate'); -} - function ldapauth_load_config(\Friendica\App $a, ConfigFileLoader $loader) { $a->getConfigCache()->load($loader->loadAddonConfig('ldapauth')); diff --git a/leistungsschutzrecht/leistungsschutzrecht.php b/leistungsschutzrecht/leistungsschutzrecht.php index eb25f550b..04bbd4741 100644 --- a/leistungsschutzrecht/leistungsschutzrecht.php +++ b/leistungsschutzrecht/leistungsschutzrecht.php @@ -16,13 +16,6 @@ function leistungsschutzrecht_install() { Hook::register('page_info_data', 'addon/leistungsschutzrecht/leistungsschutzrecht.php', 'leistungsschutzrecht_getsiteinfo'); } - -function leistungsschutzrecht_uninstall() { - Hook::unregister('cron', 'addon/leistungsschutzrecht/leistungsschutzrecht.php', 'leistungsschutzrecht_cron'); - Hook::unregister('getsiteinfo', 'addon/leistungsschutzrecht/leistungsschutzrecht.php', 'leistungsschutzrecht_getsiteinfo'); - Hook::unregister('page_info_data', 'addon/leistungsschutzrecht/leistungsschutzrecht.php', 'leistungsschutzrecht_getsiteinfo'); -} - function leistungsschutzrecht_getsiteinfo($a, &$siteinfo) { if (!isset($siteinfo["url"]) || empty($siteinfo['type'])) { return; diff --git a/libertree/libertree.php b/libertree/libertree.php index dfa492235..1062ab5a1 100644 --- a/libertree/libertree.php +++ b/libertree/libertree.php @@ -23,16 +23,6 @@ function libertree_install() Hook::register('connector_settings_post', 'addon/libertree/libertree.php', 'libertree_settings_post'); } -function libertree_uninstall() -{ - Hook::unregister('hook_fork', 'addon/libertree/libertree.php', 'libertree_hook_fork'); - Hook::unregister('post_local', 'addon/libertree/libertree.php', 'libertree_post_local'); - Hook::unregister('notifier_normal', 'addon/libertree/libertree.php', 'libertree_send'); - Hook::unregister('jot_networks', 'addon/libertree/libertree.php', 'libertree_jot_nets'); - Hook::unregister('connector_settings', 'addon/libertree/libertree.php', 'libertree_settings'); - Hook::unregister('connector_settings_post', 'addon/libertree/libertree.php', 'libertree_settings_post'); -} - function libertree_jot_nets(App &$a, array &$jotnets_fields) { if(! local_user()) { diff --git a/libravatar/libravatar.php b/libravatar/libravatar.php index 1c4f0e903..9a0c9db6f 100644 --- a/libravatar/libravatar.php +++ b/libravatar/libravatar.php @@ -26,16 +26,6 @@ function libravatar_install() Logger::log("registered libravatar in avatar_lookup hook"); } -/** - * Removes the addon hook - */ -function libravatar_uninstall() -{ - Hook::unregister('load_config', 'addon/libravatar/libravatar.php', 'libravatar_load_config'); - Hook::unregister('avatar_lookup', 'addon/libravatar/libravatar.php', 'libravatar_lookup'); - Logger::log("unregistered libravatar in avatar_lookup hook"); -} - function libravatar_load_config(App $a, ConfigFileLoader $loader) { $a->getConfigCache()->load($loader->loadAddonConfig('libravatar')); diff --git a/ljpost/ljpost.php b/ljpost/ljpost.php index a98087c2d..0d0610086 100644 --- a/ljpost/ljpost.php +++ b/ljpost/ljpost.php @@ -24,15 +24,6 @@ function ljpost_install() { Hook::register('connector_settings_post', 'addon/ljpost/ljpost.php', 'ljpost_settings_post'); } -function ljpost_uninstall() { - Hook::unregister('post_local', 'addon/ljpost/ljpost.php', 'ljpost_post_local'); - Hook::unregister('notifier_normal', 'addon/ljpost/ljpost.php', 'ljpost_send'); - Hook::unregister('jot_networks', 'addon/ljpost/ljpost.php', 'ljpost_jot_nets'); - Hook::unregister('connector_settings', 'addon/ljpost/ljpost.php', 'ljpost_settings'); - Hook::unregister('connector_settings_post', 'addon/ljpost/ljpost.php', 'ljpost_settings_post'); - -} - function ljpost_jot_nets(\Friendica\App &$a, array &$jotnets_fields) { diff --git a/mahjongg/mahjongg.php b/mahjongg/mahjongg.php index 502c92d98..7bc0adc98 100644 --- a/mahjongg/mahjongg.php +++ b/mahjongg/mahjongg.php @@ -12,11 +12,6 @@ function mahjongg_install() { Hook::register('app_menu', 'addon/mahjongg/mahjongg.php', 'mahjongg_app_menu'); } -function mahjongg_uninstall() { - Hook::unregister('app_menu', 'addon/mahjongg/mahjongg.php', 'mahjongg_app_menu'); - -} - function mahjongg_app_menu($a,&$b) { $b['app_menu'][] = ''; } diff --git a/mailstream/mailstream.php b/mailstream/mailstream.php index d09f913a1..23aed60f9 100644 --- a/mailstream/mailstream.php +++ b/mailstream/mailstream.php @@ -56,19 +56,6 @@ function mailstream_install() { } } -function mailstream_uninstall() { - Hook::unregister('addon_settings', 'addon/mailstream/mailstream.php', 'mailstream_addon_settings'); - Hook::unregister('addon_settings_post', 'addon/mailstream/mailstream.php', 'mailstream_addon_settings_post'); - Hook::unregister('post_local', 'addon/mailstream/mailstream.php', 'mailstream_post_local_hook'); - Hook::unregister('post_remote', 'addon/mailstream/mailstream.php', 'mailstream_post_remote_hook'); - Hook::unregister('post_local_end', 'addon/mailstream/mailstream.php', 'mailstream_post_local_hook'); - Hook::unregister('post_remote_end', 'addon/mailstream/mailstream.php', 'mailstream_post_remote_hook'); - Hook::unregister('post_local_end', 'addon/mailstream/mailstream.php', 'mailstream_post_hook'); - Hook::unregister('post_remote_end', 'addon/mailstream/mailstream.php', 'mailstream_post_hook'); - Hook::unregister('cron', 'addon/mailstream/mailstream.php', 'mailstream_cron'); - Hook::unregister('incoming_mail', 'addon/mailstream/mailstream.php', 'mailstream_incoming_mail'); -} - function mailstream_module() {} function mailstream_addon_admin(&$a,&$o) { diff --git a/mastodoncustomemojis/mastodoncustomemojis.php b/mastodoncustomemojis/mastodoncustomemojis.php index a3cd0b97a..eeada8625 100644 --- a/mastodoncustomemojis/mastodoncustomemojis.php +++ b/mastodoncustomemojis/mastodoncustomemojis.php @@ -27,16 +27,6 @@ function mastodoncustomemojis_install() Hook::register('contacts_mod_init', __FILE__, 'mastodoncustomemojis_css_hook'); } -function mastodoncustomemojis_uninstall() -{ - Hook::unregister('put_item_in_cache', __FILE__, 'mastodoncustomemojis_put_item_in_cache'); - Hook::unregister('network_mod_init', __FILE__, 'mastodoncustomemojis_css_hook'); - Hook::unregister('display_mod_init', __FILE__, 'mastodoncustomemojis_css_hook'); - Hook::unregister('search_mod_init', __FILE__, 'mastodoncustomemojis_css_hook'); - Hook::unregister('community_mod_init', __FILE__, 'mastodoncustomemojis_css_hook'); - Hook::unregister('contacts_mod_init', __FILE__, 'mastodoncustomemojis_css_hook'); -} - function mastodoncustomemojis_css_hook(App $a) { DI::page()['htmlhead'] .= <<getCurrentTheme() == 'frio') { diff --git a/morechoice/morechoice.php b/morechoice/morechoice.php index 1505176e4..2491aa806 100644 --- a/morechoice/morechoice.php +++ b/morechoice/morechoice.php @@ -18,18 +18,6 @@ function morechoice_install() { Hook::register('marital_selector', 'addon/morechoice/morechoice.php', 'morechoice_marital_selector'); } - -function morechoice_uninstall() { - - Hook::unregister('gender_selector', 'addon/morechoice/morechoice.php', 'morechoice_gender_selector'); - Hook::unregister('sexpref_selector', 'addon/morechoice/morechoice.php', 'morechoice_sexpref_selector'); - Hook::unregister('marital_selector', 'addon/morechoice/morechoice.php', 'morechoice_marital_selector'); - -// We need to leave this here for a while, because we now have a situation where people can end up with an orphaned hook. - Hook::unregister('poke_verbs', 'addon/morechoice/morechoice.php', 'morechoice_poke_verbs'); - -} - function morechoice_gender_selector($a,&$b) { $b['Androgyne'] = DI::l10n()->t('Androgyne'); $b['Bear'] = DI::l10n()->t('Bear'); diff --git a/morepokes/morepokes.php b/morepokes/morepokes.php index f943a8f47..4e7e7cfe9 100644 --- a/morepokes/morepokes.php +++ b/morepokes/morepokes.php @@ -14,11 +14,6 @@ function morepokes_install() Hook::register('poke_verbs', 'addon/morepokes/morepokes.php', 'morepokes_poke_verbs'); } -function morepokes_uninstall() -{ - Hook::unregister('poke_verbs', 'addon/morepokes/morepokes.php', 'morepokes_poke_verbs'); -} - function morepokes_poke_verbs($a, &$b) { $b['bitchslap'] = ['bitchslapped', DI::l10n()->t('bitchslap'), DI::l10n()->t('bitchslapped')]; diff --git a/namethingy/namethingy.php b/namethingy/namethingy.php index 7e314e891..52a48c5f9 100644 --- a/namethingy/namethingy.php +++ b/namethingy/namethingy.php @@ -14,11 +14,6 @@ function namethingy_install() { Hook::register('app_menu', 'addon/namethingy/namethingy.php', 'namethingy_app_menu'); } -function namethingy_uninstall() { - Hook::unregister('app_menu', 'addon/namethingy/namethingy.php', 'namethingy_app_menu'); - -} - function namethingy_app_menu($a,&$b) { $b['app_menu'][] = ''; } diff --git a/newmemberwidget/newmemberwidget.php b/newmemberwidget/newmemberwidget.php index 585568135..d748816e0 100644 --- a/newmemberwidget/newmemberwidget.php +++ b/newmemberwidget/newmemberwidget.php @@ -19,11 +19,6 @@ function newmemberwidget_install() Logger::log('newmemberwidget installed'); } -function newmemberwidget_uninstall() -{ - Hook::unregister( 'network_mod_init', 'addon/newmemberwidget/newmemberwidget.php', 'newmemberwidget_network_mod_init'); -} - function newmemberwidget_network_mod_init ($a, $b) { if (empty($_SESSION['new_member'])) { diff --git a/notifyall/notifyall.php b/notifyall/notifyall.php index 7b2325538..e5e94c7ec 100644 --- a/notifyall/notifyall.php +++ b/notifyall/notifyall.php @@ -15,16 +15,6 @@ use Friendica\Core\Renderer; use Friendica\DI; -function notifyall_install() -{ - Logger::log("installed notifyall"); -} - -function notifyall_uninstall() -{ - Logger::log("removed notifyall"); -} - function notifyall_module() {} function notifyall_addon_admin(App $a, &$o) diff --git a/notimeline/notimeline.php b/notimeline/notimeline.php index e5ff8918d..b99501c3a 100644 --- a/notimeline/notimeline.php +++ b/notimeline/notimeline.php @@ -16,12 +16,6 @@ function notimeline_install() Hook::register('addon_settings_post', 'addon/notimeline/notimeline.php', 'notimeline_settings_post'); } -function notimeline_uninstall() -{ - Hook::unregister('addon_settings', 'addon/notimeline/notimeline.php', 'notimeline_settings'); - Hook::unregister('addon_settings_post', 'addon/notimeline/notimeline.php', 'notimeline_settings_post'); -} - function notimeline_settings_post($a, $post) { if (!local_user() || empty($_POST['notimeline-submit'])) { diff --git a/nsfw/nsfw.php b/nsfw/nsfw.php index 65b26f596..9f81b29d8 100644 --- a/nsfw/nsfw.php +++ b/nsfw/nsfw.php @@ -17,14 +17,6 @@ function nsfw_install() Hook::register('addon_settings_post', 'addon/nsfw/nsfw.php', 'nsfw_addon_settings_post'); } -function nsfw_uninstall() -{ - Hook::unregister('prepare_body_content_filter', 'addon/nsfw/nsfw.php', 'nsfw_prepare_body_content_filter'); - Hook::unregister('prepare_body', 'addon/nsfw/nsfw.php', 'nsfw_prepare_body'); - Hook::unregister('addon_settings', 'addon/nsfw/nsfw.php', 'nsfw_addon_settings'); - Hook::unregister('addon_settings_post', 'addon/nsfw/nsfw.php', 'nsfw_addon_settings_post'); -} - // This function isn't perfect and isn't trying to preserve the html structure - it's just a // quick and dirty filter to pull out embedded photo blobs because 'nsfw' seems to come up // inside them quite often. We don't need anything fancy, just pull out the data blob so we can diff --git a/numfriends/numfriends.php b/numfriends/numfriends.php index 6ee3956ba..f12badeb4 100644 --- a/numfriends/numfriends.php +++ b/numfriends/numfriends.php @@ -17,16 +17,6 @@ function numfriends_install() { Logger::log("installed numfriends"); } - -function numfriends_uninstall() { - - Hook::unregister('addon_settings', 'addon/numfriends/numfriends.php', 'numfriends_settings'); - Hook::unregister('addon_settings_post', 'addon/numfriends/numfriends.php', 'numfriends_settings_post'); - - - Logger::log("removed numfriends"); -} - /** * * Callback from the settings post function. diff --git a/openstreetmap/openstreetmap.php b/openstreetmap/openstreetmap.php index 05a284e68..168d3d2ff 100644 --- a/openstreetmap/openstreetmap.php +++ b/openstreetmap/openstreetmap.php @@ -34,18 +34,6 @@ function openstreetmap_install() Logger::log("installed openstreetmap"); } -function openstreetmap_uninstall() -{ - Hook::unregister('load_config', 'addon/openstreetmap/openstreetmap.php', 'openstreetmap_load_config'); - Hook::unregister('render_location', 'addon/openstreetmap/openstreetmap.php', 'openstreetmap_location'); - Hook::unregister('generate_map', 'addon/openstreetmap/openstreetmap.php', 'openstreetmap_generate_map'); - Hook::unregister('generate_named_map', 'addon/openstreetmap/openstreetmap.php', 'openstreetmap_generate_named_map'); - Hook::unregister('Map::getCoordinates', 'addon/openstreetmap/openstreetmap.php', 'openstreetmap_get_coordinates'); - Hook::unregister('page_header', 'addon/openstreetmap/openstreetmap.php', 'openstreetmap_alterheader'); - - Logger::log("removed openstreetmap"); -} - function openstreetmap_load_config(\Friendica\App $a, ConfigFileLoader $loader) { $a->getConfigCache()->load($loader->loadAddonConfig('openstreetmap')); diff --git a/piwik/piwik.php b/piwik/piwik.php index 94f78bb46..d461cfd4f 100644 --- a/piwik/piwik.php +++ b/piwik/piwik.php @@ -45,13 +45,6 @@ function piwik_install() { Logger::log("installed piwik addon"); } -function piwik_uninstall() { - Hook::unregister('load_config', 'addon/piwik/piwik.php', 'piwik_load_config'); - Hook::unregister('page_end', 'addon/piwik/piwik.php', 'piwik_analytics'); - - Logger::log("uninstalled piwik addon"); -} - function piwik_load_config(\Friendica\App $a, ConfigFileLoader $loader) { $a->getConfigCache()->load($loader->loadAddonConfig('piwik')); diff --git a/planets/planets.php b/planets/planets.php index ea543f409..9fed41862 100644 --- a/planets/planets.php +++ b/planets/planets.php @@ -35,27 +35,6 @@ function planets_install() { Logger::log("installed planets"); } - -function planets_uninstall() { - - /** - * - * uninstall unregisters any hooks created with register_hook - * during install. It may also delete configuration settings - * and any other cleanup. - * - */ - - Hook::unregister('post_local', 'addon/planets/planets.php', 'planets_post_hook'); - Hook::unregister('addon_settings', 'addon/planets/planets.php', 'planets_settings'); - Hook::unregister('addon_settings_post', 'addon/planets/planets.php', 'planets_settings_post'); - - - Logger::log("removed planets"); -} - - - function planets_post_hook($a, &$item) { /** diff --git a/public_server/public_server.php b/public_server/public_server.php index f52703dfe..549020bd2 100644 --- a/public_server/public_server.php +++ b/public_server/public_server.php @@ -27,15 +27,6 @@ function public_server_install() Hook::register('logged_in', 'addon/public_server/public_server.php', 'public_server_login'); } -function public_server_uninstall() -{ - Hook::unregister('load_config', 'addon/public_server/public_server.php', 'public_server_load_config'); - Hook::unregister('register_account', 'addon/public_server/public_server.php', 'public_server_register_account'); - Hook::unregister('cron', 'addon/public_server/public_server.php', 'public_server_cron'); - Hook::unregister('enotify', 'addon/public_server/public_server.php', 'public_server_enotify'); - Hook::unregister('logged_in', 'addon/public_server/public_server.php', 'public_server_login'); -} - function public_server_load_config(App $a, ConfigFileLoader $loader) { $a->getConfigCache()->load($loader->loadAddonConfig('public_server')); diff --git a/pumpio/pumpio.php b/pumpio/pumpio.php index 6b61a5946..2e2ca98cb 100644 --- a/pumpio/pumpio.php +++ b/pumpio/pumpio.php @@ -45,19 +45,6 @@ function pumpio_install() Hook::register('check_item_notification', 'addon/pumpio/pumpio.php', 'pumpio_check_item_notification'); } -function pumpio_uninstall() -{ - Hook::unregister('load_config', 'addon/pumpio/pumpio.php', 'pumpio_load_config'); - Hook::unregister('hook_fork', 'addon/pumpio/pumpio.php', 'pumpio_hook_fork'); - Hook::unregister('post_local', 'addon/pumpio/pumpio.php', 'pumpio_post_local'); - Hook::unregister('notifier_normal', 'addon/pumpio/pumpio.php', 'pumpio_send'); - Hook::unregister('jot_networks', 'addon/pumpio/pumpio.php', 'pumpio_jot_nets'); - Hook::unregister('connector_settings', 'addon/pumpio/pumpio.php', 'pumpio_settings'); - Hook::unregister('connector_settings_post', 'addon/pumpio/pumpio.php', 'pumpio_settings_post'); - Hook::unregister('cron', 'addon/pumpio/pumpio.php', 'pumpio_cron'); - Hook::unregister('check_item_notification', 'addon/pumpio/pumpio.php', 'pumpio_check_item_notification'); -} - function pumpio_module() {} function pumpio_content(App $a) diff --git a/qcomment/qcomment.php b/qcomment/qcomment.php index 45f9d972a..4c78b8224 100644 --- a/qcomment/qcomment.php +++ b/qcomment/qcomment.php @@ -27,12 +27,6 @@ function qcomment_install() { } -function qcomment_uninstall() { - Hook::unregister('addon_settings', 'addon/qcomment/qcomment.php', 'qcomment_addon_settings'); - Hook::unregister('addon_settings_post', 'addon/qcomment/qcomment.php', 'qcomment_addon_settings_post'); - -} - function qcomment_addon_settings(&$a, &$s) { if (! local_user()) { diff --git a/randplace/randplace.php b/randplace/randplace.php index 886d79d12..3576fef85 100644 --- a/randplace/randplace.php +++ b/randplace/randplace.php @@ -52,17 +52,12 @@ function randplace_uninstall() { /** * - * uninstall unregisters any hooks created with register_hook - * during install. It may also delete configuration settings - * and any other cleanup. + * This function should undo anything that was done in name_install() + * + * Except hooks, they are all unregistered automatically and don't need to be unregistered manually. * */ - Hook::unregister('post_local', 'addon/randplace/randplace.php', 'randplace_post_hook'); - Hook::unregister('addon_settings', 'addon/randplace/randplace.php', 'randplace_settings'); - Hook::unregister('addon_settings_post', 'addon/randplace/randplace.php', 'randplace_settings_post'); - - Logger::log("removed randplace"); } diff --git a/remote_permissions/remote_permissions.php b/remote_permissions/remote_permissions.php index 159e3cf94..6fe75f169 100644 --- a/remote_permissions/remote_permissions.php +++ b/remote_permissions/remote_permissions.php @@ -19,12 +19,6 @@ function remote_permissions_install() { Hook::register('addon_settings_post', 'addon/remote_permissions/remote_permissions.php', 'remote_permissions_settings_post'); } -function remote_permissions_uninstall() { - Hook::unregister('lockview_content', 'addon/remote_permissions/remote_permissions.php', 'remote_permissions_content'); - Hook::unregister('addon_settings', 'addon/remote_permissions/remote_permissions.php', 'remote_permissions_settings'); - Hook::unregister('addon_settings_post', 'addon/remote_permissions/remote_permissions.php', 'remote_permissions_settings_post'); -} - function remote_permissions_settings(&$a,&$o) { if(! local_user()) diff --git a/rendertime/rendertime.php b/rendertime/rendertime.php index c44d0a305..acc6521a5 100644 --- a/rendertime/rendertime.php +++ b/rendertime/rendertime.php @@ -14,12 +14,6 @@ function rendertime_install() { Hook::register('page_end', 'addon/rendertime/rendertime.php', 'rendertime_page_end'); } - -function rendertime_uninstall() { - Hook::unregister('init_1', 'addon/rendertime/rendertime.php', 'rendertime_init_1'); - Hook::unregister('page_end', 'addon/rendertime/rendertime.php', 'rendertime_page_end'); -} - function rendertime_init_1(&$a) { } diff --git a/securemail/securemail.php b/securemail/securemail.php index e0780614a..fb801a4ce 100644 --- a/securemail/securemail.php +++ b/securemail/securemail.php @@ -26,16 +26,6 @@ function securemail_install() Logger::log('installed securemail'); } -function securemail_uninstall() -{ - Hook::unregister('addon_settings', 'addon/securemail/securemail.php', 'securemail_settings'); - Hook::unregister('addon_settings_post', 'addon/securemail/securemail.php', 'securemail_settings_post'); - - Hook::unregister('emailer_send_prepare', 'addon/securemail/securemail.php', 'securemail_emailer_send_prepare'); - - Logger::log('removed securemail'); -} - /** * @brief Build user settings form * diff --git a/showmore/showmore.php b/showmore/showmore.php index d8eccfddf..7583fd33d 100644 --- a/showmore/showmore.php +++ b/showmore/showmore.php @@ -18,13 +18,6 @@ function showmore_install() Hook::register('addon_settings_post', 'addon/showmore/showmore.php', 'showmore_addon_settings_post'); } -function showmore_uninstall() -{ - Hook::unregister('prepare_body', 'addon/showmore/showmore.php', 'showmore_prepare_body'); - Hook::unregister('addon_settings', 'addon/showmore/showmore.php', 'showmore_addon_settings'); - Hook::unregister('addon_settings_post', 'addon/showmore/showmore.php', 'showmore_addon_settings_post'); -} - function showmore_addon_settings(&$a, &$s) { if (!local_user()) { diff --git a/smiley_pack/lang/smiley_pack_es/smiley_pack_es.php b/smiley_pack/lang/smiley_pack_es/smiley_pack_es.php index 892b4a70b..329b7282a 100644 --- a/smiley_pack/lang/smiley_pack_es/smiley_pack_es.php +++ b/smiley_pack/lang/smiley_pack_es/smiley_pack_es.php @@ -13,12 +13,6 @@ function smiley_pack_es_install() { Hook::register('smilie', 'addon/smiley_pack_es/smiley_pack_es.php', 'smiley_pack_smilies_es'); } -function smiley_pack_es_uninstall() { - Hook::unregister('smilie', 'addon/smiley_pack_es/smiley_pack_es.php', 'smiley_pack_smilies'); -} - - - function smiley_pack_smilies_es(&$a,&$b) { #Smileys are split into various directories by the intended range of emotions. This is in case we get too big and need to modularise things. We can then cut and paste the right lines, move the right directory, and just change the name of the addon to happy_smilies or whatever. diff --git a/smiley_pack/lang/smiley_pack_fr/smiley_pack_fr.php b/smiley_pack/lang/smiley_pack_fr/smiley_pack_fr.php index 7472bd1cb..bcefa7c3f 100644 --- a/smiley_pack/lang/smiley_pack_fr/smiley_pack_fr.php +++ b/smiley_pack/lang/smiley_pack_fr/smiley_pack_fr.php @@ -15,12 +15,6 @@ function smiley_pack_fr_install() { Hook::register('smilie', 'addon/smiley_pack_fr/smiley_pack_fr.php', 'smiley_pack_fr_smilies'); } -function smiley_pack_fr_uninstall() { - Hook::unregister('smilie', 'addon/smiley_pack_fr/smiley_pack_fr.php', 'smiley_pack_fr_smilies'); -} - - - function smiley_pack_fr_smilies(&$a,&$b) { #Smileys are split into various directories by the intended range of emotions. This is in case we get too big and need to modularise things. We can then cut and paste the right lines, move the right directory, and just change the name of the addon to happy_smilies or whatever. diff --git a/smiley_pack/smiley_pack.php b/smiley_pack/smiley_pack.php index a80ab717c..6562e29bf 100644 --- a/smiley_pack/smiley_pack.php +++ b/smiley_pack/smiley_pack.php @@ -14,12 +14,6 @@ function smiley_pack_install() { Hook::register('smilie', 'addon/smiley_pack/smiley_pack.php', 'smiley_pack_smilies'); } -function smiley_pack_uninstall() { - Hook::unregister('smilie', 'addon/smiley_pack/smiley_pack.php', 'smiley_pack_smilies'); -} - - - function smiley_pack_smilies(&$a,&$b) { #Smileys are split into various directories by the intended range of emotions. This is in case we get too big and need to modularise things. We can then cut and paste the right lines, move the right directory, and just change the name of the addon to happy_smilies or whatever. diff --git a/smileybutton/smileybutton.php b/smileybutton/smileybutton.php index 9d4916372..fc4207736 100644 --- a/smileybutton/smileybutton.php +++ b/smileybutton/smileybutton.php @@ -16,16 +16,6 @@ function smileybutton_install() { Logger::log("installed smileybutton"); } - -function smileybutton_uninstall() { - //Delet registered hooks - Hook::unregister('jot_tool', 'addon/smileybutton/smileybutton.php', 'show_button'); - - Logger::log("removed smileybutton"); -} - - - function show_button(Friendica\App $a, &$b) { // Disable if theme is quattro // TODO add style for quattro diff --git a/smilies_adult/smilies_adult.php b/smilies_adult/smilies_adult.php index 84bb24cf5..b55a0a2fe 100644 --- a/smilies_adult/smilies_adult.php +++ b/smilies_adult/smilies_adult.php @@ -15,12 +15,6 @@ function smilies_adult_install() { Hook::register('smilie', 'addon/smilies_adult/smilies_adult.php', 'smilies_adult_smilies'); } -function smilies_adult_uninstall() { - Hook::unregister('smilie', 'addon/smilies_adult/smilies_adult.php', 'smilies_adult_smilies'); -} - - - function smilies_adult_smilies(&$a,&$b) { $b['texts'][] = '(o)(o)'; diff --git a/sniper/sniper.php b/sniper/sniper.php index 97d26b7b9..31c97a843 100644 --- a/sniper/sniper.php +++ b/sniper/sniper.php @@ -16,11 +16,6 @@ function sniper_install() { Hook::register('app_menu', 'addon/sniper/sniper.php', 'sniper_app_menu'); } -function sniper_uninstall() { - Hook::unregister('app_menu', 'addon/sniper/sniper.php', 'sniper_app_menu'); - -} - function sniper_app_menu($a,&$b) { $b['app_menu'][] = ''; } diff --git a/startpage/startpage.php b/startpage/startpage.php index 9192b5a8e..8cdf444f1 100644 --- a/startpage/startpage.php +++ b/startpage/startpage.php @@ -15,13 +15,6 @@ function startpage_install() { Hook::register('addon_settings_post', 'addon/startpage/startpage.php', 'startpage_settings_post'); } -function startpage_uninstall() -{ - Hook::unregister('home_init', 'addon/startpage/startpage.php', 'startpage_home_init'); - Hook::unregister('addon_settings', 'addon/startpage/startpage.php', 'startpage_settings'); - Hook::unregister('addon_settings_post', 'addon/startpage/startpage.php', 'startpage_settings_post'); -} - function startpage_home_init($a, $b) { if (!local_user()) { diff --git a/statusnet/statusnet.php b/statusnet/statusnet.php index 7708e3f4e..0ab711cad 100644 --- a/statusnet/statusnet.php +++ b/statusnet/statusnet.php @@ -74,24 +74,6 @@ function statusnet_install() Logger::log("installed GNU Social"); } -function statusnet_uninstall() -{ - Hook::unregister('connector_settings', 'addon/statusnet/statusnet.php', 'statusnet_settings'); - Hook::unregister('connector_settings_post', 'addon/statusnet/statusnet.php', 'statusnet_settings_post'); - Hook::unregister('notifier_normal', 'addon/statusnet/statusnet.php', 'statusnet_post_hook'); - Hook::unregister('hook_fork', 'addon/statusnet/statusnet.php', 'statusnet_hook_fork'); - Hook::unregister('post_local', 'addon/statusnet/statusnet.php', 'statusnet_post_local'); - Hook::unregister('jot_networks', 'addon/statusnet/statusnet.php', 'statusnet_jot_nets'); - Hook::unregister('cron', 'addon/statusnet/statusnet.php', 'statusnet_cron'); - Hook::unregister('prepare_body', 'addon/statusnet/statusnet.php', 'statusnet_prepare_body'); - Hook::unregister('check_item_notification', 'addon/statusnet/statusnet.php', 'statusnet_check_item_notification'); - - // old setting - remove only - Hook::unregister('post_local_end', 'addon/statusnet/statusnet.php', 'statusnet_post_hook'); - Hook::unregister('addon_settings', 'addon/statusnet/statusnet.php', 'statusnet_settings'); - Hook::unregister('addon_settings_post', 'addon/statusnet/statusnet.php', 'statusnet_settings_post'); -} - function statusnet_check_item_notification(App $a, &$notification_data) { if (DI::pConfig()->get($notification_data["uid"], 'statusnet', 'post')) { diff --git a/superblock/superblock.php b/superblock/superblock.php index 9ba9c6d24..ad2e8c14e 100644 --- a/superblock/superblock.php +++ b/superblock/superblock.php @@ -19,15 +19,6 @@ function superblock_install() Hook::register('enotify_store', 'addon/superblock/superblock.php', 'superblock_enotify_store'); } -function superblock_uninstall() -{ - Hook::unregister('addon_settings', 'addon/superblock/superblock.php', 'superblock_addon_settings'); - Hook::unregister('addon_settings_post', 'addon/superblock/superblock.php', 'superblock_addon_settings_post'); - Hook::unregister('conversation_start', 'addon/superblock/superblock.php', 'superblock_conversation_start'); - Hook::unregister('item_photo_menu', 'addon/superblock/superblock.php', 'superblock_item_photo_menu'); - Hook::unregister('enotify_store', 'addon/superblock/superblock.php', 'superblock_enotify_store'); -} - function superblock_addon_settings(&$a, &$s) { if (!local_user()) { diff --git a/testdrive/testdrive.php b/testdrive/testdrive.php index cb95babfc..1806ea2cc 100644 --- a/testdrive/testdrive.php +++ b/testdrive/testdrive.php @@ -26,17 +26,6 @@ function testdrive_install() { } - -function testdrive_uninstall() { - - Hook::unregister('load_config', 'addon/testdrive/testdrive.php', 'testdrive_load_config'); - Hook::unregister('register_account', 'addon/testdrive/testdrive.php', 'testdrive_register_account'); - Hook::unregister('cron', 'addon/testdrive/testdrive.php', 'testdrive_cron'); - Hook::unregister('enotify','addon/testdrive/testdrive.php', 'testdrive_enotify'); - Hook::unregister('globaldir_update','addon/testdrive/testdrive.php', 'testdrive_globaldir_update'); - -} - function testdrive_load_config(App $a, ConfigFileLoader $loader) { $a->getConfigCache()->load($loader->loadAddonConfig('testdrive')); diff --git a/tictac/tictac.php b/tictac/tictac.php index 08a8c09c7..47c9e806e 100644 --- a/tictac/tictac.php +++ b/tictac/tictac.php @@ -12,11 +12,6 @@ function tictac_install() { Hook::register('app_menu', 'addon/tictac/tictac.php', 'tictac_app_menu'); } -function tictac_uninstall() { - Hook::unregister('app_menu', 'addon/tictac/tictac.php', 'tictac_app_menu'); - -} - function tictac_app_menu($a,&$b) { $b['app_menu'][] = ''; } diff --git a/tumblr/tumblr.php b/tumblr/tumblr.php index 23127980e..4504534cb 100644 --- a/tumblr/tumblr.php +++ b/tumblr/tumblr.php @@ -29,16 +29,6 @@ function tumblr_install() Hook::register('connector_settings_post', 'addon/tumblr/tumblr.php', 'tumblr_settings_post'); } -function tumblr_uninstall() -{ - Hook::unregister('hook_fork', 'addon/tumblr/tumblr.php', 'tumblr_hook_fork'); - Hook::unregister('post_local', 'addon/tumblr/tumblr.php', 'tumblr_post_local'); - Hook::unregister('notifier_normal', 'addon/tumblr/tumblr.php', 'tumblr_send'); - Hook::unregister('jot_networks', 'addon/tumblr/tumblr.php', 'tumblr_jot_nets'); - Hook::unregister('connector_settings', 'addon/tumblr/tumblr.php', 'tumblr_settings'); - Hook::unregister('connector_settings_post', 'addon/tumblr/tumblr.php', 'tumblr_settings_post'); -} - function tumblr_module() { } diff --git a/unicode_smilies/unicode_smilies.php b/unicode_smilies/unicode_smilies.php index af286276e..ef7bb6150 100644 --- a/unicode_smilies/unicode_smilies.php +++ b/unicode_smilies/unicode_smilies.php @@ -13,10 +13,6 @@ function unicode_smilies_install() { Hook::register('smilie', 'addon/unicode_smilies/unicode_smilies.php', 'unicode_smilies_smilies'); } -function unicode_smilies_uninstall() { - Hook::unregister('smilie', 'addon/unicode_smilies/unicode_smilies.php', 'unicode_smilies_smilies'); -} - function unicode_smilies_smilies(&$a,&$b) { Smilies::add($b, ':-)', '😀'); Smilies::add($b, ':)', '😀'); diff --git a/viewsrc/viewsrc.php b/viewsrc/viewsrc.php index 10f883593..cbdf54617 100644 --- a/viewsrc/viewsrc.php +++ b/viewsrc/viewsrc.php @@ -16,13 +16,6 @@ function viewsrc_install() { Hook::register('page_end', 'addon/viewsrc/viewsrc.php', 'viewsrc_page_end'); } - -function viewsrc_uninstall() { - Hook::unregister('item_photo_menu', 'addon/viewsrc/viewsrc.php', 'viewsrc_item_photo_menu'); - Hook::unregister('page_end', 'addon/viewsrc/viewsrc.php', 'viewsrc_page_end'); - -} - function viewsrc_page_end(&$a, &$o){ DI::page()['htmlhead'] .= <<< EOS