From 49eff56e5d1969a10bcc37c4aa0d8ae74c9f939d Mon Sep 17 00:00:00 2001 From: Adam Magness Date: Mon, 29 Oct 2018 19:40:18 -0400 Subject: [PATCH 01/14] Core Logger implement log() function. more to squash Core Logger Class implement log() function --- .../advancedcontentfilter.php | 3 +- blackout/blackout.php | 3 +- blogger/blogger.php | 5 +- buffer/buffer.php | 11 +- catavatar/catavatar.php | 5 +- diaspora/diaspora.php | 39 ++--- dwpost/dwpost.php | 5 +- fromapp/fromapp.php | 5 +- fromgplus/fromgplus.php | 17 +- geocoordinates/geocoordinates.php | 9 +- geonames/geonames.php | 9 +- gnot/gnot.php | 5 +- googlemaps/googlemaps.php | 5 +- gravatar/gravatar.php | 5 +- group_text/group_text.php | 5 +- ifttt/ifttt.php | 11 +- ijpost/ijpost.php | 5 +- impressum/impressum.php | 5 +- jappixmini/jappixmini.php | 3 +- js_upload/js_upload.php | 5 +- krynn/krynn.php | 7 +- ldapauth/ldapauth.php | 21 +-- leistungsschutzrecht/leistungsschutzrecht.php | 3 +- libertree/libertree.php | 5 +- libravatar/libravatar.php | 5 +- ljpost/ljpost.php | 5 +- mailstream/mailstream.php | 25 +-- newmemberwidget/newmemberwidget.php | 3 +- notifyall/notifyall.php | 5 +- numfriends/numfriends.php | 5 +- openstreetmap/openstreetmap.php | 11 +- piwik/piwik.php | 5 +- planets/planets.php | 7 +- public_server/public_server.php | 5 +- pumpio/pumpio.php | 87 +++++------ pumpio/pumpio_sync.php | 3 +- randplace/randplace.php | 7 +- securemail/securemail.php | 5 +- smileybutton/smileybutton.php | 5 +- statusnet/statusnet.php | 83 +++++----- tumblr/tumblr.php | 7 +- twitter/twitter.php | 145 +++++++++--------- twitter/twitter_sync.php | 3 +- widgets/widgets.php | 3 +- windowsphonepush/windowsphonepush.php | 25 +-- wppost/wppost.php | 5 +- 46 files changed, 348 insertions(+), 302 deletions(-) diff --git a/advancedcontentfilter/advancedcontentfilter.php b/advancedcontentfilter/advancedcontentfilter.php index 3f036488..549698d3 100644 --- a/advancedcontentfilter/advancedcontentfilter.php +++ b/advancedcontentfilter/advancedcontentfilter.php @@ -39,6 +39,7 @@ use Friendica\Content\Text\Markdown; use Friendica\Core\Addon; use Friendica\Core\Cache; use Friendica\Core\L10n; +use Friendica\Core\Logger; use Friendica\Database\DBA; use Friendica\Database\DBStructure; use Friendica\Model\Item; @@ -64,7 +65,7 @@ function advancedcontentfilter_install() DBStructure::update(false, true); - logger("installed advancedcontentfilter"); + Logger::log("installed advancedcontentfilter"); } function advancedcontentfilter_uninstall() diff --git a/blackout/blackout.php b/blackout/blackout.php index 9b2d5b62..dc19edda 100644 --- a/blackout/blackout.php +++ b/blackout/blackout.php @@ -52,6 +52,7 @@ use Friendica\Core\Config; use Friendica\Core\Addon; use Friendica\Core\L10n; +use Friendica\Core\Logger; function blackout_install() { Addon::registerHook('page_header', 'addon/blackout/blackout.php', 'blackout_redirect'); @@ -84,7 +85,7 @@ function blackout_redirect ($a, $b) { $date2 = 0; } if (( $date1 <= $now ) && ( $now <= $date2 )) { - logger('redirecting user to blackout page'); + Logger::log('redirecting user to blackout page'); System::externalRedirect($myurl); } } diff --git a/blogger/blogger.php b/blogger/blogger.php index 00563c3a..4de65d55 100644 --- a/blogger/blogger.php +++ b/blogger/blogger.php @@ -10,6 +10,7 @@ use Friendica\App; use Friendica\Content\Text\BBCode; use Friendica\Core\Addon; use Friendica\Core\L10n; +use Friendica\Core\Logger; use Friendica\Core\PConfig; use Friendica\Util\Network; @@ -202,12 +203,12 @@ function blogger_send(App $a, array &$b) EOT; - logger('blogger: data: ' . $xml, LOGGER_DATA); + Logger::log('blogger: data: ' . $xml, LOGGER_DATA); if ($bl_blog !== 'test') { $x = Network::post($bl_blog, $xml)->getBody(); } - logger('posted to blogger: ' . (($x) ? $x : ''), LOGGER_DEBUG); + Logger::log('posted to blogger: ' . (($x) ? $x : ''), LOGGER_DEBUG); } } diff --git a/buffer/buffer.php b/buffer/buffer.php index 048a27da..b5c17e4a 100644 --- a/buffer/buffer.php +++ b/buffer/buffer.php @@ -12,6 +12,7 @@ use Friendica\Content\Text\Plaintext; use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; +use Friendica\Core\Logger; use Friendica\Core\PConfig; use Friendica\Core\Protocol; use Friendica\Database\DBA; @@ -112,7 +113,7 @@ function buffer_connect(App $a) if (!$buffer->ok) { $o .= 'Connect to Buffer!'; } else { - logger("buffer_connect: authenticated"); + Logger::log("buffer_connect: authenticated"); $o .= L10n::t("You are now authenticated to buffer. "); $o .= '
' . L10n::t("return to the connector page") . ''; PConfig::set(local_user(), 'buffer','access_token', $buffer->access_token); @@ -298,7 +299,7 @@ function buffer_send(App $a, array &$b) $profiles = $buffer->go('/profiles'); if (is_array($profiles)) { - logger("Will send these parameter ".print_r($b, true), LOGGER_DEBUG); + Logger::log("Will send these parameter ".print_r($b, true), LOGGER_DEBUG); foreach ($profiles as $profile) { if (!$profile->default) @@ -357,7 +358,7 @@ function buffer_send(App $a, array &$b) } $post = ItemContent::getPlaintextPost($item, $limit, $includedlinks, $htmlmode); - logger("buffer_send: converted message ".$b["id"]." result: ".print_r($post, true), LOGGER_DEBUG); + Logger::log("buffer_send: converted message ".$b["id"]." result: ".print_r($post, true), LOGGER_DEBUG); // The image proxy is used as a sanitizer. Buffer seems to be really picky about pictures if (isset($post["image"])) { @@ -407,9 +408,9 @@ function buffer_send(App $a, array &$b) } //print_r($message); - logger("buffer_send: data for message " . $b["id"] . ": " . print_r($message, true), LOGGER_DEBUG); + Logger::log("buffer_send: data for message " . $b["id"] . ": " . print_r($message, true), LOGGER_DEBUG); $ret = $buffer->go('/updates/create', $message); - logger("buffer_send: send message " . $b["id"] . " result: " . print_r($ret, true), LOGGER_DEBUG); + Logger::log("buffer_send: send message " . $b["id"] . " result: " . print_r($ret, true), LOGGER_DEBUG); } } } diff --git a/catavatar/catavatar.php b/catavatar/catavatar.php index b321ae33..07f21527 100644 --- a/catavatar/catavatar.php +++ b/catavatar/catavatar.php @@ -10,6 +10,7 @@ use Friendica\App; use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; +use Friendica\Core\Logger; use Friendica\Core\PConfig; use Friendica\Core\Worker; use Friendica\Database\DBA; @@ -28,7 +29,7 @@ function catavatar_install() Addon::registerHook('addon_settings', 'addon/catavatar/catavatar.php', 'catavatar_addon_settings'); Addon::registerHook('addon_settings_post', 'addon/catavatar/catavatar.php', 'catavatar_addon_settings_post'); - logger('registered catavatar'); + Logger::log('registered catavatar'); } /** @@ -40,7 +41,7 @@ function catavatar_uninstall() Addon::unregisterHook('addon_settings', 'addon/catavatar/catavatar.php', 'catavatar_addon_settings'); Addon::unregisterHook('addon_settings_post', 'addon/catavatar/catavatar.php', 'catavatar_addon_settings_post'); - logger('unregistered catavatar'); + Logger::log('unregistered catavatar'); } /** diff --git a/diaspora/diaspora.php b/diaspora/diaspora.php index 44bc1f74..508655fd 100644 --- a/diaspora/diaspora.php +++ b/diaspora/diaspora.php @@ -13,6 +13,7 @@ use Friendica\App; use Friendica\Content\Text\BBCode; use Friendica\Core\Addon; use Friendica\Core\L10n; +use Friendica\Core\Logger; use Friendica\Core\PConfig; use Friendica\Core\Protocol; use Friendica\Database\DBA; @@ -72,7 +73,7 @@ function diaspora_queue_hook(App $a, &$b) { continue; } - logger('diaspora_queue: run'); + Logger::log('diaspora_queue: run'); $r = q("SELECT `user`.* FROM `user` LEFT JOIN `contact` on `contact`.`uid` = `user`.`uid` WHERE `contact`.`self` = 1 AND `contact`.`id` = %d LIMIT 1", @@ -92,37 +93,37 @@ function diaspora_queue_hook(App $a, &$b) { $success = false; if ($handle && $password) { - logger('diaspora_queue: able to post for user '.$handle); + Logger::log('diaspora_queue: able to post for user '.$handle); $z = unserialize($x['content']); $post = $z['post']; - logger('diaspora_queue: post: '.$post, LOGGER_DATA); + Logger::log('diaspora_queue: post: '.$post, LOGGER_DATA); try { - logger('diaspora_queue: prepare', LOGGER_DEBUG); + Logger::log('diaspora_queue: prepare', LOGGER_DEBUG); $conn = new Diaspora_Connection($handle, $password); - logger('diaspora_queue: try to log in '.$handle, LOGGER_DEBUG); + Logger::log('diaspora_queue: try to log in '.$handle, LOGGER_DEBUG); $conn->logIn(); - logger('diaspora_queue: try to send '.$body, LOGGER_DEBUG); + Logger::log('diaspora_queue: try to send '.$body, LOGGER_DEBUG); $conn->provider = $hostname; $conn->postStatusMessage($post, $aspect); - logger('diaspora_queue: send '.$userdata['uid'].' success', LOGGER_DEBUG); + Logger::log('diaspora_queue: send '.$userdata['uid'].' success', LOGGER_DEBUG); $success = true; Queue::removeItem($x['id']); } catch (Exception $e) { - logger("diaspora_queue: Send ".$userdata['uid']." failed: ".$e->getMessage(), LOGGER_DEBUG); + Logger::log("diaspora_queue: Send ".$userdata['uid']." failed: ".$e->getMessage(), LOGGER_DEBUG); } } else { - logger('diaspora_queue: send '.$userdata['uid'].' missing username or password', LOGGER_DEBUG); + Logger::log('diaspora_queue: send '.$userdata['uid'].' missing username or password', LOGGER_DEBUG); } if (!$success) { - logger('diaspora_queue: delayed'); + Logger::log('diaspora_queue: delayed'); Queue::updateTime($x['id']); } } @@ -289,7 +290,7 @@ function diaspora_send(App $a, array &$b) { $hostname = $a->getHostName(); - logger('diaspora_send: invoked'); + Logger::log('diaspora_send: invoked'); if ($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited'])) { return; @@ -311,14 +312,14 @@ function diaspora_send(App $a, array &$b) return; } - logger('diaspora_send: prepare posting', LOGGER_DEBUG); + Logger::log('diaspora_send: prepare posting', LOGGER_DEBUG); $handle = PConfig::get($b['uid'],'diaspora','handle'); $password = PConfig::get($b['uid'],'diaspora','password'); $aspect = PConfig::get($b['uid'],'diaspora','aspect'); if ($handle && $password) { - logger('diaspora_send: all values seem to be okay', LOGGER_DEBUG); + Logger::log('diaspora_send: all values seem to be okay', LOGGER_DEBUG); $tag_arr = []; $tags = ''; @@ -363,20 +364,20 @@ function diaspora_send(App $a, array &$b) require_once "addon/diaspora/diasphp.php"; try { - logger('diaspora_send: prepare', LOGGER_DEBUG); + Logger::log('diaspora_send: prepare', LOGGER_DEBUG); $conn = new Diaspora_Connection($handle, $password); - logger('diaspora_send: try to log in '.$handle, LOGGER_DEBUG); + Logger::log('diaspora_send: try to log in '.$handle, LOGGER_DEBUG); $conn->logIn(); - logger('diaspora_send: try to send '.$body, LOGGER_DEBUG); + Logger::log('diaspora_send: try to send '.$body, LOGGER_DEBUG); $conn->provider = $hostname; $conn->postStatusMessage($body, $aspect); - logger('diaspora_send: success'); + Logger::log('diaspora_send: success'); } catch (Exception $e) { - logger("diaspora_send: Error submitting the post: " . $e->getMessage()); + Logger::log("diaspora_send: Error submitting the post: " . $e->getMessage()); - logger('diaspora_send: requeueing '.$b['uid'], LOGGER_DEBUG); + Logger::log('diaspora_send: requeueing '.$b['uid'], LOGGER_DEBUG); $r = q("SELECT `id` FROM `contact` WHERE `uid` = %d AND `self`", $b['uid']); if (count($r)) diff --git a/dwpost/dwpost.php b/dwpost/dwpost.php index bc8959fc..462aaf45 100644 --- a/dwpost/dwpost.php +++ b/dwpost/dwpost.php @@ -12,6 +12,7 @@ use Friendica\App; use Friendica\Content\Text\BBCode; use Friendica\Core\Addon; use Friendica\Core\L10n; +use Friendica\Core\Logger; use Friendica\Core\PConfig; use Friendica\Database\DBA; use Friendica\Util\DateTimeFormat; @@ -225,13 +226,13 @@ function dwpost_send(App $a, array &$b) EOT; - logger('dwpost: data: ' . $xml, LOGGER_DATA); + Logger::log('dwpost: data: ' . $xml, LOGGER_DATA); if ($dw_blog !== 'test') { $x = Network::post($dw_blog, $xml, ["Content-Type: text/xml"])->getBody(); } - logger('posted to dreamwidth: ' . ($x) ? $x : '', LOGGER_DEBUG); + Logger::log('posted to dreamwidth: ' . ($x) ? $x : '', LOGGER_DEBUG); } } diff --git a/fromapp/fromapp.php b/fromapp/fromapp.php index 6a33cd03..f2b0f1fc 100644 --- a/fromapp/fromapp.php +++ b/fromapp/fromapp.php @@ -8,6 +8,7 @@ */ use Friendica\Core\Addon; use Friendica\Core\L10n; +use Friendica\Core\Logger; use Friendica\Core\PConfig; function fromapp_install() @@ -15,7 +16,7 @@ function fromapp_install() Addon::registerHook('post_local', 'addon/fromapp/fromapp.php', 'fromapp_post_hook'); Addon::registerHook('addon_settings', 'addon/fromapp/fromapp.php', 'fromapp_settings'); Addon::registerHook('addon_settings_post', 'addon/fromapp/fromapp.php', 'fromapp_settings_post'); - logger("installed fromapp"); + Logger::log("installed fromapp"); } @@ -24,7 +25,7 @@ function fromapp_uninstall() Addon::unregisterHook('post_local', 'addon/fromapp/fromapp.php', 'fromapp_post_hook'); Addon::unregisterHook('addon_settings', 'addon/fromapp/fromapp.php', 'fromapp_settings'); Addon::unregisterHook('addon_settings_post', 'addon/fromapp/fromapp.php', 'fromapp_settings_post'); - logger("removed fromapp"); + Logger::log("removed fromapp"); } function fromapp_settings_post($a, $post) diff --git a/fromgplus/fromgplus.php b/fromgplus/fromgplus.php index 9dc48753..a964954a 100644 --- a/fromgplus/fromgplus.php +++ b/fromgplus/fromgplus.php @@ -12,6 +12,7 @@ define('FROMGPLUS_DEFAULT_POLL_INTERVAL', 30); // given in minutes use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; +use Friendica\Core\Logger; use Friendica\Core\PConfig; use Friendica\Core\Protocol; use Friendica\Object\Image; @@ -126,25 +127,25 @@ function fromgplus_cron($a,$b) { if($last) { $next = $last + ($poll_interval * 60); if($next > time()) { - logger('fromgplus: poll intervall not reached'); + Logger::log('fromgplus: poll intervall not reached'); return; } } - logger('fromgplus: cron_start'); + Logger::log('fromgplus: cron_start'); $r = q("SELECT * FROM `pconfig` WHERE `cat` = 'fromgplus' AND `k` = 'enable' AND `v` = '1' ORDER BY RAND() "); if(count($r)) { foreach($r as $rr) { $account = PConfig::get($rr['uid'],'fromgplus','account'); if ($account) { - logger('fromgplus: fetching for user '.$rr['uid']); + Logger::log('fromgplus: fetching for user '.$rr['uid']); fromgplus_fetch($a, $rr['uid']); } } } - logger('fromgplus: cron_end'); + Logger::log('fromgplus: cron_end'); Config::set('fromgplus','last_poll', time()); } @@ -190,15 +191,15 @@ function fromgplus_post($a, $uid, $source, $body, $location, $coord, $id) { $_REQUEST['coord'] = $coord; if (($_REQUEST['title'] == "") && ($_REQUEST['body'] == "")) { - logger('fromgplus: empty post for user '.$uid." ".print_r($_REQUEST, true)); + Logger::log('fromgplus: empty post for user '.$uid." ".print_r($_REQUEST, true)); return; } require_once('mod/item.php'); //print_r($_REQUEST); - logger('fromgplus: posting for user '.$uid." ".print_r($_REQUEST, true)); + Logger::log('fromgplus: posting for user '.$uid." ".print_r($_REQUEST, true)); item_post($a); - logger('fromgplus: done for user '.$uid); + Logger::log('fromgplus: done for user '.$uid); } function fromgplus_html2bbcode($html) { @@ -472,7 +473,7 @@ function fromgplus_fetch($a, $uid) { // Don't publish items that are too young if (strtotime($item->published) > (time() - 3*60)) { - logger('fromgplus_fetch: item too new '.$item->published); + Logger::log('fromgplus_fetch: item too new '.$item->published); continue; } diff --git a/geocoordinates/geocoordinates.php b/geocoordinates/geocoordinates.php index 89ccd883..7058e3ec 100644 --- a/geocoordinates/geocoordinates.php +++ b/geocoordinates/geocoordinates.php @@ -9,6 +9,7 @@ use Friendica\Core\Addon; use Friendica\Core\Cache; use Friendica\Core\Config; use Friendica\Core\L10n; +use Friendica\Core\Logger; use Friendica\Util\Network; function geocoordinates_install() @@ -54,25 +55,25 @@ function geocoordinates_resolve_item(&$item) $s = Network::fetchUrl("https://api.opencagedata.com/geocode/v1/json?q=".$coords[0].",".$coords[1]."&key=".$key."&language=".$language); if (!$s) { - logger("API could not be queried", LOGGER_DEBUG); + Logger::log("API could not be queried", LOGGER_DEBUG); return; } $data = json_decode($s); if ($data->status->code != "200") { - logger("API returned error ".$data->status->code." ".$data->status->message, LOGGER_DEBUG); + Logger::log("API returned error ".$data->status->code." ".$data->status->message, LOGGER_DEBUG); return; } if (($data->total_results == 0) || (count($data->results) == 0)) { - logger("No results found for coordinates ".$item["coord"], LOGGER_DEBUG); + Logger::log("No results found for coordinates ".$item["coord"], LOGGER_DEBUG); return; } $item["location"] = $data->results[0]->formatted; - logger("Got location for coordinates ".$coords[0]."-".$coords[1].": ".$item["location"], LOGGER_DEBUG); + Logger::log("Got location for coordinates ".$coords[0]."-".$coords[1].": ".$item["location"], LOGGER_DEBUG); if ($item["location"] != "") Cache::set("geocoordinates:".$language.":".$coords[0]."-".$coords[1], $item["location"]); diff --git a/geonames/geonames.php b/geonames/geonames.php index dc6e116b..9486d4e6 100644 --- a/geonames/geonames.php +++ b/geonames/geonames.php @@ -24,6 +24,7 @@ use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; +use Friendica\Core\Logger; use Friendica\Core\PConfig; use Friendica\Util\Network; use Friendica\Util\XML; @@ -52,7 +53,7 @@ function geonames_install() { Addon::registerHook('addon_settings', 'addon/geonames/geonames.php', 'geonames_addon_admin'); Addon::registerHook('addon_settings_post', 'addon/geonames/geonames.php', 'geonames_addon_admin_post'); - logger("installed geonames"); + Logger::log("installed geonames"); } @@ -72,7 +73,7 @@ function geonames_uninstall() { Addon::unregisterHook('addon_settings_post', 'addon/geonames/geonames.php', 'geonames_addon_admin_post'); - logger("removed geonames"); + Logger::log("removed geonames"); } function geonames_load_config(\Friendica\App $a) @@ -91,7 +92,7 @@ function geonames_post_hook($a, &$item) { * */ - logger('geonames invoked'); + Logger::log('geonames invoked'); if(! local_user()) /* non-zero if this is a logged in user of this system */ return; @@ -132,7 +133,7 @@ function geonames_post_hook($a, &$item) { $item['location'] = $xml->geoname->name . ', ' . $xml->geoname->countryName; -// logger('geonames : ' . print_r($xml,true), LOGGER_DATA); +// Logger::log('geonames : ' . print_r($xml,true), LOGGER_DATA); return; } diff --git a/gnot/gnot.php b/gnot/gnot.php index 2c4555ba..3cab8539 100644 --- a/gnot/gnot.php +++ b/gnot/gnot.php @@ -9,6 +9,7 @@ */ use Friendica\Core\Addon; use Friendica\Core\L10n; +use Friendica\Core\Logger; use Friendica\Core\PConfig; function gnot_install() { @@ -17,7 +18,7 @@ function gnot_install() { Addon::registerHook('addon_settings_post', 'addon/gnot/gnot.php', 'gnot_settings_post'); Addon::registerHook('enotify_mail', 'addon/gnot/gnot.php', 'gnot_enotify_mail'); - logger("installed gnot"); + Logger::log("installed gnot"); } @@ -28,7 +29,7 @@ function gnot_uninstall() { Addon::unregisterHook('enotify_mail', 'addon/gnot/gnot.php', 'gnot_enotify_mail'); - logger("removed gnot"); + Logger::log("removed gnot"); } diff --git a/googlemaps/googlemaps.php b/googlemaps/googlemaps.php index e294c8e0..7cccb650 100644 --- a/googlemaps/googlemaps.php +++ b/googlemaps/googlemaps.php @@ -8,19 +8,20 @@ */ use Friendica\Core\Addon; use Friendica\Core\Cache; +use Friendica\Core\Logger function googlemaps_install() { Addon::registerHook('render_location', 'addon/googlemaps/googlemaps.php', 'googlemaps_location'); - logger("installed googlemaps"); + Logger::log("installed googlemaps"); } function googlemaps_uninstall() { Addon::unregisterHook('render_location', 'addon/googlemaps/googlemaps.php', 'googlemaps_location'); - logger("removed googlemaps"); + Logger::log("removed googlemaps"); } function googlemaps_location($a, &$item) diff --git a/gravatar/gravatar.php b/gravatar/gravatar.php index 9a23edfe..e5a59b26 100644 --- a/gravatar/gravatar.php +++ b/gravatar/gravatar.php @@ -11,6 +11,7 @@ use Friendica\BaseModule; use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; +use Friendica\Core\Logger; use Friendica\Database\DBA; use Friendica\Util\Security; @@ -21,7 +22,7 @@ function gravatar_install() { Addon::registerHook('load_config', 'addon/gravatar/gravatar.php', 'gravatar_load_config'); Addon::registerHook('avatar_lookup', 'addon/gravatar/gravatar.php', 'gravatar_lookup'); - logger("registered gravatar in avatar_lookup hook"); + Logger::log("registered gravatar in avatar_lookup hook"); } /** @@ -31,7 +32,7 @@ function gravatar_uninstall() { Addon::unregisterHook('load_config', 'addon/gravatar/gravatar.php', 'gravatar_load_config'); Addon::unregisterHook('avatar_lookup', 'addon/gravatar/gravatar.php', 'gravatar_lookup'); - logger("unregistered gravatar in avatar_lookup hook"); + Logger::log("unregistered gravatar in avatar_lookup hook"); } function gravatar_load_config(App $a) diff --git a/group_text/group_text.php b/group_text/group_text.php index 3f91ff35..76bb03fd 100644 --- a/group_text/group_text.php +++ b/group_text/group_text.php @@ -7,6 +7,7 @@ */ use Friendica\Core\Addon; use Friendica\Core\L10n; +use Friendica\Core\Logger; use Friendica\Core\PConfig; function group_text_install() { @@ -14,7 +15,7 @@ function group_text_install() { Addon::registerHook('addon_settings', 'addon/group_text/group_text.php', 'group_text_settings'); Addon::registerHook('addon_settings_post', 'addon/group_text/group_text.php', 'group_text_settings_post'); - logger("installed group_text"); + Logger::log("installed group_text"); } @@ -24,7 +25,7 @@ function group_text_uninstall() { Addon::unregisterHook('addon_settings_post', 'addon/group_text/group_text.php', 'group_text_settings_post'); - logger("removed group_text"); + Logger::log("removed group_text"); } diff --git a/ifttt/ifttt.php b/ifttt/ifttt.php index 2e48319a..8ba7428c 100644 --- a/ifttt/ifttt.php +++ b/ifttt/ifttt.php @@ -13,6 +13,7 @@ require_once 'include/text.php'; use Friendica\App; use Friendica\Core\Addon; use Friendica\Core\L10n; +use Friendica\Core\Logger; use Friendica\Core\PConfig; use Friendica\Core\Protocol; use Friendica\Database\DBA; @@ -103,16 +104,16 @@ function ifttt_post(App $a) $user = DBA::selectFirst('user', ['uid'], ['nickname' => $nickname]); if (!DBA::isResult($user)) { - logger('User ' . $nickname . ' not found.', LOGGER_DEBUG); + Logger::log('User ' . $nickname . ' not found.', LOGGER_DEBUG); return; } $uid = $user['uid']; - logger('Received a post for user ' . $uid . ' from ifttt ' . print_r($_REQUEST, true), LOGGER_DEBUG); + Logger::log('Received a post for user ' . $uid . ' from ifttt ' . print_r($_REQUEST, true), LOGGER_DEBUG); if (!isset($_REQUEST['key'])) { - logger('No key found.'); + Logger::log('No key found.'); return; } @@ -120,7 +121,7 @@ function ifttt_post(App $a) // Check the key if ($key != PConfig::get($uid, 'ifttt', 'key')) { - logger('Invalid key for user ' . $uid, LOGGER_DEBUG); + Logger::log('Invalid key for user ' . $uid, LOGGER_DEBUG); return; } @@ -131,7 +132,7 @@ function ifttt_post(App $a) } if (!in_array($item['type'], ['status', 'link', 'photo'])) { - logger('Unknown item type ' . $item['type'], LOGGER_DEBUG); + Logger::log('Unknown item type ' . $item['type'], LOGGER_DEBUG); return; } diff --git a/ijpost/ijpost.php b/ijpost/ijpost.php index 3dcfb31f..13ede61f 100644 --- a/ijpost/ijpost.php +++ b/ijpost/ijpost.php @@ -11,6 +11,7 @@ use Friendica\Content\Text\BBCode; use Friendica\Core\Addon; use Friendica\Core\L10n; +use Friendica\Core\Logger; use Friendica\Core\PConfig; use Friendica\Util\DateTimeFormat; use Friendica\Util\Network; @@ -221,12 +222,12 @@ function ijpost_send(&$a, &$b) EOT; - logger('ijpost: data: ' . $xml, LOGGER_DATA); + Logger::log('ijpost: data: ' . $xml, LOGGER_DATA); if ($ij_blog !== 'test') { $x = Network::post($ij_blog, $xml, ["Content-Type: text/xml"])->getBody(); } - logger('posted to insanejournal: ' . $x ? $x : '', LOGGER_DEBUG); + Logger::log('posted to insanejournal: ' . $x ? $x : '', LOGGER_DEBUG); } } diff --git a/impressum/impressum.php b/impressum/impressum.php index 90775116..2cac33fa 100644 --- a/impressum/impressum.php +++ b/impressum/impressum.php @@ -11,20 +11,21 @@ use Friendica\Content\Text\BBCode; use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; +use Friendica\Core\Logger; use Friendica\Util\Proxy as ProxyUtils; function impressum_install() { Addon::registerHook('load_config', 'addon/impressum/impressum.php', 'impressum_load_config'); Addon::registerHook('about_hook', 'addon/impressum/impressum.php', 'impressum_show'); Addon::registerHook('page_end', 'addon/impressum/impressum.php', 'impressum_footer'); - logger("installed impressum Addon"); + Logger::log("installed impressum Addon"); } function impressum_uninstall() { Addon::unregisterHook('load_config', 'addon/impressum/impressum.php', 'impressum_load_config'); Addon::unregisterHook('about_hook', 'addon/impressum/impressum.php', 'impressum_show'); Addon::unregisterHook('page_end', 'addon/impressum/impressum.php', 'impressum_footer'); - logger("uninstalled impressum Addon"); + Logger::log("uninstalled impressum Addon"); } function impressum_module() { diff --git a/jappixmini/jappixmini.php b/jappixmini/jappixmini.php index 8111f9fd..e2ef01d2 100644 --- a/jappixmini/jappixmini.php +++ b/jappixmini/jappixmini.php @@ -66,6 +66,7 @@ use Friendica\App; use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; +use Friendica\Core\Logger; use Friendica\Core\PConfig; use Friendica\Core\Protocol; use Friendica\Database\DBA; @@ -584,7 +585,7 @@ function jappixmini_cron(App $a, $d) // go through list of users with jabber enabled $users = q("SELECT `uid` FROM `pconfig` WHERE `cat`='jappixmini' AND (`k`='autosubscribe' OR `k`='autoapprove') AND `v`='1'"); - logger("jappixmini: Update list of contacts' jabber accounts for " . count($users) . " users."); + Logger::log("jappixmini: Update list of contacts' jabber accounts for " . count($users) . " users."); if (!count($users)) { return; diff --git a/js_upload/js_upload.php b/js_upload/js_upload.php index adeba838..9762e899 100644 --- a/js_upload/js_upload.php +++ b/js_upload/js_upload.php @@ -17,6 +17,7 @@ use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; +use Friendica\Core\Logger; function js_upload_install() { Addon::registerHook('photo_upload_form', 'addon/js_upload/js_upload.php', 'js_upload_form'); @@ -159,7 +160,7 @@ function js_upload_post_init(&$a,&$b) { $a->data['upload_jsonresponse'] = htmlspecialchars(json_encode($result), ENT_NOQUOTES); if(isset($result['error'])) { - logger('mod/photos.php: photos_post(): error uploading photo: ' . $result['error'] , 'LOGGER_DEBUG'); + Logger::log('mod/photos.php: photos_post(): error uploading photo: ' . $result['error'] , 'LOGGER_DEBUG'); echo json_encode($result); killme(); } @@ -181,7 +182,7 @@ function js_upload_post_file(&$a,&$b) { function js_upload_post_end(&$a,&$b) { -logger('upload_post_end'); +Logger::log('upload_post_end'); if(x($a->data,'upload_jsonresponse')) { echo $a->data['upload_jsonresponse']; killme(); diff --git a/krynn/krynn.php b/krynn/krynn.php index 4b6e1f7f..97871c3a 100644 --- a/krynn/krynn.php +++ b/krynn/krynn.php @@ -11,6 +11,7 @@ */ use Friendica\Core\Addon; use Friendica\Core\L10n; +use Friendica\Core\Logger; use Friendica\Core\PConfig; function krynn_install() { @@ -35,7 +36,7 @@ function krynn_install() { Addon::registerHook('addon_settings', 'addon/krynn/krynn.php', 'krynn_settings'); Addon::registerHook('addon_settings_post', 'addon/krynn/krynn.php', 'krynn_settings_post'); - logger("installed krynn"); + Logger::log("installed krynn"); } @@ -54,7 +55,7 @@ function krynn_uninstall() { Addon::unregisterHook('addon_settings_post', 'addon/krynn/krynn.php', 'krynn_settings_post'); - logger("removed krynn"); + Logger::log("removed krynn"); } @@ -70,7 +71,7 @@ function krynn_post_hook($a, &$item) { * */ - logger('krynn invoked'); + Logger::log('krynn invoked'); if(! local_user()) /* non-zero if this is a logged in user of this system */ return; diff --git a/ldapauth/ldapauth.php b/ldapauth/ldapauth.php index 514fb1d1..eb8cafc4 100644 --- a/ldapauth/ldapauth.php +++ b/ldapauth/ldapauth.php @@ -55,6 +55,7 @@ */ use Friendica\Core\Addon; use Friendica\Core\Config; +use Friendica\Core\Logger; use Friendica\Model\User; function ldapauth_install() @@ -99,28 +100,28 @@ function ldapauth_authenticate($username, $password) $ldap_autocreateaccount_nameattribute = Config::get('ldapauth', 'ldap_autocreateaccount_nameattribute'); if (!(strlen($password) && function_exists('ldap_connect') && strlen($ldap_server))) { - logger("ldapauth: not configured or missing php-ldap module"); + Logger::log("ldapauth: not configured or missing php-ldap module"); return false; } $connect = @ldap_connect($ldap_server); if ($connect === false) { - logger("ldapauth: could not connect to $ldap_server"); + Logger::log("ldapauth: could not connect to $ldap_server"); return false; } @ldap_set_option($connect, LDAP_OPT_PROTOCOL_VERSION, 3); @ldap_set_option($connect, LDAP_OPT_REFERRALS, 0); if ((@ldap_bind($connect, $ldap_binddn, $ldap_bindpw)) === false) { - logger("ldapauth: could not bind $ldap_server as $ldap_binddn"); + Logger::log("ldapauth: could not bind $ldap_server as $ldap_binddn"); return false; } $res = @ldap_search($connect, $ldap_searchdn, $ldap_userattr . '=' . $username); if (!$res) { - logger("ldapauth: $ldap_userattr=$username,$ldap_searchdn not found"); + Logger::log("ldapauth: $ldap_userattr=$username,$ldap_searchdn not found"); return false; } @@ -161,13 +162,13 @@ function ldapauth_authenticate($username, $password) @ldap_close($connect); if ($eno === 32) { - logger("ldapauth: access control group Does Not Exist"); + Logger::log("ldapauth: access control group Does Not Exist"); return false; } elseif ($eno === 16) { - logger('ldapauth: membership attribute does not exist in access control group'); + Logger::log('ldapauth: membership attribute does not exist in access control group'); return false; } else { - logger('ldapauth: error: ' . $err); + Logger::log('ldapauth: error: ' . $err); return false; } } elseif ($r === false) { @@ -189,12 +190,12 @@ function ldap_autocreateaccount($ldap_autocreateaccount, $username, $password, $ try { User::create($arr); - logger("ldapauth: account " . $username . " created"); + Logger::log("ldapauth: account " . $username . " created"); } catch (Exception $ex) { - logger("ldapauth: account " . $username . " was not created ! : " . $ex->getMessage()); + Logger::log("ldapauth: account " . $username . " was not created ! : " . $ex->getMessage()); } } else { - logger("ldapauth: unable to create account, no email or nickname found"); + Logger::log("ldapauth: unable to create account, no email or nickname found"); } } } diff --git a/leistungsschutzrecht/leistungsschutzrecht.php b/leistungsschutzrecht/leistungsschutzrecht.php index c0625ccb..020c3af3 100644 --- a/leistungsschutzrecht/leistungsschutzrecht.php +++ b/leistungsschutzrecht/leistungsschutzrecht.php @@ -7,6 +7,7 @@ */ use Friendica\Core\Addon; use Friendica\Core\Config; +use Friendica\Core\Logger; use Friendica\Util\Network; function leistungsschutzrecht_install() { @@ -163,7 +164,7 @@ function leistungsschutzrecht_cron($a,$b) { if($last) { $next = $last + 86400; if($next > time()) { - logger('poll intervall not reached'); + Logger::log('poll intervall not reached'); return; } } diff --git a/libertree/libertree.php b/libertree/libertree.php index 19512bc5..0804476c 100644 --- a/libertree/libertree.php +++ b/libertree/libertree.php @@ -9,6 +9,7 @@ use Friendica\Content\Text\BBCode; use Friendica\Core\Addon; use Friendica\Core\L10n; +use Friendica\Core\Logger; use Friendica\Core\PConfig; use Friendica\Database\DBA; use Friendica\Util\Network; @@ -157,7 +158,7 @@ function libertree_post_local(&$a,&$b) { function libertree_send(&$a,&$b) { - logger('libertree_send: invoked'); + Logger::log('libertree_send: invoked'); if ($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited'])) { return; @@ -232,6 +233,6 @@ function libertree_send(&$a,&$b) { ]; $result = Network::post($ltree_blog, $params)->getBody(); - logger('libertree: ' . $result); + Logger::log('libertree: ' . $result); } } diff --git a/libravatar/libravatar.php b/libravatar/libravatar.php index bc671548..80c9e4c5 100644 --- a/libravatar/libravatar.php +++ b/libravatar/libravatar.php @@ -11,6 +11,7 @@ use Friendica\BaseModule; use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; +use Friendica\Core\Logger; use Friendica\Database\DBA; use Friendica\Util\Security; @@ -21,7 +22,7 @@ function libravatar_install() { Addon::registerHook('load_config', 'addon/libravatar/libravatar.php', 'libravatar_load_config'); Addon::registerHook('avatar_lookup', 'addon/libravatar/libravatar.php', 'libravatar_lookup'); - logger("registered libravatar in avatar_lookup hook"); + Logger::log("registered libravatar in avatar_lookup hook"); } /** @@ -31,7 +32,7 @@ function libravatar_uninstall() { Addon::unregisterHook('load_config', 'addon/libravatar/libravatar.php', 'libravatar_load_config'); Addon::unregisterHook('avatar_lookup', 'addon/libravatar/libravatar.php', 'libravatar_lookup'); - logger("unregistered libravatar in avatar_lookup hook"); + Logger::log("unregistered libravatar in avatar_lookup hook"); } function libravatar_load_config(App $a) diff --git a/ljpost/ljpost.php b/ljpost/ljpost.php index dfc1387b..2473e74f 100644 --- a/ljpost/ljpost.php +++ b/ljpost/ljpost.php @@ -11,6 +11,7 @@ use Friendica\Content\Text\BBCode; use Friendica\Core\Addon; use Friendica\Core\L10n; +use Friendica\Core\Logger; use Friendica\Core\PConfig; use Friendica\Util\DateTimeFormat; use Friendica\Util\Network; @@ -231,12 +232,12 @@ function ljpost_send(&$a,&$b) { EOT; - logger('ljpost: data: ' . $xml, LOGGER_DATA); + Logger::log('ljpost: data: ' . $xml, LOGGER_DATA); if ($lj_blog !== 'test') { $x = Network::post($lj_blog, $xml, ["Content-Type: text/xml"])->getBody(); } - logger('posted to livejournal: ' . ($x) ? $x : '', LOGGER_DEBUG); + Logger::log('posted to livejournal: ' . ($x) ? $x : '', LOGGER_DEBUG); } } diff --git a/mailstream/mailstream.php b/mailstream/mailstream.php index dc44b931..bac15342 100644 --- a/mailstream/mailstream.php +++ b/mailstream/mailstream.php @@ -10,6 +10,7 @@ use Friendica\Content\Text\BBCode; use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; +use Friendica\Core\Logger; use Friendica\Core\PConfig; use Friendica\Database\DBA; use Friendica\Util\Network; @@ -94,7 +95,7 @@ function mailstream_generate_id($a, $uri) { $host = $a->getHostName(); $resource = hash('md5', $uri); $message_id = "<" . $resource . "@" . $host . ">"; - logger('mailstream: Generated message ID ' . $message_id . ' for URI ' . $uri, LOGGER_DEBUG); + Logger::log('mailstream: Generated message ID ' . $message_id . ' for URI ' . $uri, LOGGER_DEBUG); return $message_id; } @@ -123,16 +124,16 @@ function mailstream_post_hook(&$a, &$item) { intval($item['contact-id']), DBA::escape($item['uri']), DBA::escape($message_id)); $r = q('SELECT * FROM `mailstream_item` WHERE `uid` = %d AND `contact-id` = %d AND `uri` = "%s"', intval($item['uid']), intval($item['contact-id']), DBA::escape($item['uri'])); if (count($r) != 1) { - logger('mailstream_post_remote_hook: Unexpected number of items returned from mailstream_item', LOGGER_INFO); + Logger::log('mailstream_post_remote_hook: Unexpected number of items returned from mailstream_item', LOGGER_INFO); return; } $ms_item = $r[0]; - logger('mailstream_post_remote_hook: created mailstream_item ' + Logger::log('mailstream_post_remote_hook: created mailstream_item ' . $ms_item['id'] . ' for item ' . $item['uri'] . ' ' . $item['uid'] . ' ' . $item['contact-id'], LOGGER_DATA); $user = mailstream_get_user($item['uid']); if (!$user) { - logger('mailstream_post_remote_hook: no user ' . $item['uid'], LOGGER_INFO); + Logger::log('mailstream_post_remote_hook: no user ' . $item['uid'], LOGGER_INFO); return; } mailstream_send($a, $ms_item['message-id'], $item, $user); @@ -141,7 +142,7 @@ function mailstream_post_hook(&$a, &$item) { function mailstream_get_user($uid) { $r = q('SELECT * FROM `user` WHERE `uid` = %d', intval($uid)); if (count($r) != 1) { - logger('mailstream_post_remote_hook: Unexpected number of users returned', LOGGER_INFO); + Logger::log('mailstream_post_remote_hook: Unexpected number of users returned', LOGGER_INFO); return; } return $r[0]; @@ -298,11 +299,11 @@ function mailstream_send($a, $message_id, $item, $user) { if (!$mail->Send()) { throw new Exception($mail->ErrorInfo); } - logger('mailstream_send sent message ' . $mail->MessageID . ' ' . $mail->Subject, LOGGER_DEBUG); + Logger::log('mailstream_send sent message ' . $mail->MessageID . ' ' . $mail->Subject, LOGGER_DEBUG); } catch (phpmailerException $e) { - logger('mailstream_send PHPMailer exception sending message ' . $message_id . ': ' . $e->errorMessage(), LOGGER_INFO); + Logger::log('mailstream_send PHPMailer exception sending message ' . $message_id . ': ' . $e->errorMessage(), LOGGER_INFO); } catch (Exception $e) { - logger('mailstream_send exception sending message ' . $message_id . ': ' . $e->getMessage(), LOGGER_INFO); + Logger::log('mailstream_send exception sending message ' . $message_id . ': ' . $e->getMessage(), LOGGER_INFO); } // In case of failure, still set the item to completed. Otherwise // we'll just try to send it over and over again and it'll fail @@ -331,10 +332,10 @@ function mailstream_cron($a, $b) { // mailstream_post_remote_hook fails for some reason will this get // used, and in that case it's worth holding off a bit anyway. $ms_item_ids = q("SELECT `mailstream_item`.`message-id`, `mailstream_item`.`uri`, `item`.`id` FROM `mailstream_item` JOIN `item` ON (`mailstream_item`.`uid` = `item`.`uid` AND `mailstream_item`.`uri` = `item`.`uri` AND `mailstream_item`.`contact-id` = `item`.`contact-id`) WHERE `mailstream_item`.`completed` IS NULL AND `mailstream_item`.`created` < DATE_SUB(NOW(), INTERVAL 1 HOUR) AND `item`.`visible` = 1 ORDER BY `mailstream_item`.`created` LIMIT 100"); - logger('mailstream_cron processing ' . count($ms_item_ids) . ' items', LOGGER_DEBUG); + Logger::log('mailstream_cron processing ' . count($ms_item_ids) . ' items', LOGGER_DEBUG); foreach ($ms_item_ids as $ms_item_id) { if (!$ms_item_id['message-id'] || !strlen($ms_item_id['message-id'])) { - logger('mailstream_cron: Item ' . $ms_item_id['id'] . ' URI ' . $ms_item_id['uri'] . ' has no message-id', LOGGER_INFO); + Logger::log('mailstream_cron: Item ' . $ms_item_id['id'] . ' URI ' . $ms_item_id['uri'] . ' has no message-id', LOGGER_INFO); } $item = Item::selectFirst([], ['id' => $ms_item_id['id']]); $users = q("SELECT * FROM `user` WHERE `uid` = %d", intval($item['uid'])); @@ -343,7 +344,7 @@ function mailstream_cron($a, $b) { mailstream_send($a, $ms_item_id['message-id'], $item, $user); } else { - logger('mailstream_cron: Unable to find item ' . $ms_item_id['id'], LOGGER_INFO); + Logger::log('mailstream_cron: Unable to find item ' . $ms_item_id['id'], LOGGER_INFO); q("UPDATE `mailstream_item` SET `completed` = now() WHERE `message-id` = %d", intval($ms_item['message-id'])); } } @@ -412,5 +413,5 @@ function mailstream_tidy() { foreach ($r as $rr) { q('DELETE FROM mailstream_item WHERE id = %d', intval($rr['id'])); } - logger('mailstream_tidy: deleted ' . count($r) . ' old items', LOGGER_DEBUG); + Logger::log('mailstream_tidy: deleted ' . count($r) . ' old items', LOGGER_DEBUG); } diff --git a/newmemberwidget/newmemberwidget.php b/newmemberwidget/newmemberwidget.php index d7f38068..f71f01b2 100644 --- a/newmemberwidget/newmemberwidget.php +++ b/newmemberwidget/newmemberwidget.php @@ -10,11 +10,12 @@ use Friendica\Content\Text\BBCode; use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; +use Friendica\Core\Logger; function newmemberwidget_install() { Addon::registerHook( 'network_mod_init', 'addon/newmemberwidget/newmemberwidget.php', 'newmemberwidget_network_mod_init'); - logger('newmemberwidget installed'); + Logger::log('newmemberwidget installed'); } function newmemberwidget_uninstall() diff --git a/notifyall/notifyall.php b/notifyall/notifyall.php index 852972c3..a2eb2a87 100644 --- a/notifyall/notifyall.php +++ b/notifyall/notifyall.php @@ -12,16 +12,17 @@ use Friendica\App; use Friendica\Content\Text\BBCode; use Friendica\Core\Config; use Friendica\Core\L10n; +use Friendica\Core\Logger; use Friendica\Util\Emailer; function notifyall_install() { - logger("installed notifyall"); + Logger::log("installed notifyall"); } function notifyall_uninstall() { - logger("removed notifyall"); + Logger::log("removed notifyall"); } function notifyall_module() {} diff --git a/numfriends/numfriends.php b/numfriends/numfriends.php index 0cfea736..9e22b0ea 100644 --- a/numfriends/numfriends.php +++ b/numfriends/numfriends.php @@ -7,6 +7,7 @@ */ use Friendica\Core\Addon; use Friendica\Core\L10n; +use Friendica\Core\Logger; use Friendica\Core\PConfig; function numfriends_install() { @@ -14,7 +15,7 @@ function numfriends_install() { Addon::registerHook('addon_settings', 'addon/numfriends/numfriends.php', 'numfriends_settings'); Addon::registerHook('addon_settings_post', 'addon/numfriends/numfriends.php', 'numfriends_settings_post'); - logger("installed numfriends"); + Logger::log("installed numfriends"); } @@ -24,7 +25,7 @@ function numfriends_uninstall() { Addon::unregisterHook('addon_settings_post', 'addon/numfriends/numfriends.php', 'numfriends_settings_post'); - logger("removed numfriends"); + Logger::log("removed numfriends"); } /** diff --git a/openstreetmap/openstreetmap.php b/openstreetmap/openstreetmap.php index c8eb43a9..bdecb5ca 100644 --- a/openstreetmap/openstreetmap.php +++ b/openstreetmap/openstreetmap.php @@ -12,6 +12,7 @@ use Friendica\Core\Addon; use Friendica\Core\Cache; use Friendica\Core\Config; use Friendica\Core\L10n; +use Friendica\Core\Logger; use Friendica\Core\System; use Friendica\Util\Network; @@ -29,7 +30,7 @@ function openstreetmap_install() Addon::registerHook('Map::getCoordinates', 'addon/openstreetmap/openstreetmap.php', 'openstreetmap_get_coordinates'); Addon::registerHook('page_header', 'addon/openstreetmap/openstreetmap.php', 'openstreetmap_alterheader'); - logger("installed openstreetmap"); + Logger::log("installed openstreetmap"); } function openstreetmap_uninstall() @@ -41,7 +42,7 @@ function openstreetmap_uninstall() Addon::unregisterHook('Map::getCoordinates', 'addon/openstreetmap/openstreetmap.php', 'openstreetmap_get_coordinates'); Addon::unregisterHook('page_header', 'addon/openstreetmap/openstreetmap.php', 'openstreetmap_alterheader'); - logger("removed openstreetmap"); + Logger::log("removed openstreetmap"); } function openstreetmap_load_config(\Friendica\App $a) @@ -165,8 +166,8 @@ function openstreetmap_generate_map(&$a, &$b) $lat = $b['lat']; // round($b['lat'], 5); $lon = $b['lon']; // round($b['lon'], 5); - logger('lat: ' . $lat, LOGGER_DATA); - logger('lon: ' . $lon, LOGGER_DATA); + Logger::log('lat: ' . $lat, LOGGER_DATA); + Logger::log('lon: ' . $lon, LOGGER_DATA); $cardlink = 'getBaseURL()."/images/friendica-256.png"; $params["redirect_uris"] = $a->getBaseURL()."/pumpio/connect"; - logger("pumpio_registerclient: ".$url." parameters ".print_r($params, true), LOGGER_DEBUG); + Logger::log("pumpio_registerclient: ".$url." parameters ".print_r($params, true), LOGGER_DEBUG); $ch = curl_init($url); curl_setopt($ch, CURLOPT_HEADER, false); @@ -128,10 +129,10 @@ function pumpio_registerclient(App $a, $host) if ($curl_info["http_code"] == "200") { $values = json_decode($s); - logger("pumpio_registerclient: success ".print_r($values, true), LOGGER_DEBUG); + Logger::log("pumpio_registerclient: success ".print_r($values, true), LOGGER_DEBUG); return $values; } - logger("pumpio_registerclient: failed: ".print_r($curl_info, true), LOGGER_DEBUG); + Logger::log("pumpio_registerclient: failed: ".print_r($curl_info, true), LOGGER_DEBUG); return false; } @@ -144,7 +145,7 @@ function pumpio_connect(App $a) $hostname = PConfig::get(local_user(), 'pumpio', 'host'); if ((($consumer_key == "") || ($consumer_secret == "")) && ($hostname != "")) { - logger("pumpio_connect: register client"); + Logger::log("pumpio_connect: register client"); $clientdata = pumpio_registerclient($a, $hostname); PConfig::set(local_user(), 'pumpio', 'consumer_key', $clientdata->client_id); PConfig::set(local_user(), 'pumpio', 'consumer_secret', $clientdata->client_secret); @@ -152,11 +153,11 @@ function pumpio_connect(App $a) $consumer_key = PConfig::get(local_user(), 'pumpio', 'consumer_key'); $consumer_secret = PConfig::get(local_user(), 'pumpio', 'consumer_secret'); - logger("pumpio_connect: ckey: ".$consumer_key." csecrect: ".$consumer_secret, LOGGER_DEBUG); + Logger::log("pumpio_connect: ckey: ".$consumer_key." csecrect: ".$consumer_secret, LOGGER_DEBUG); } if (($consumer_key == "") || ($consumer_secret == "")) { - logger("pumpio_connect: ".sprintf("Unable to register the client at the pump.io server '%s'.", $hostname)); + Logger::log("pumpio_connect: ".sprintf("Unable to register the client at the pump.io server '%s'.", $hostname)); $o .= L10n::t("Unable to register the client at the pump.io server '%s'.", $hostname); return $o; @@ -186,7 +187,7 @@ function pumpio_connect(App $a) if (($success = $client->Initialize())) { if (($success = $client->Process())) { if (strlen($client->access_token)) { - logger("pumpio_connect: otoken: ".$client->access_token." osecrect: ".$client->access_token_secret, LOGGER_DEBUG); + Logger::log("pumpio_connect: otoken: ".$client->access_token." osecrect: ".$client->access_token_secret, LOGGER_DEBUG); PConfig::set(local_user(), "pumpio", "oauth_token", $client->access_token); PConfig::set(local_user(), "pumpio", "oauth_token_secret", $client->access_token_secret); } @@ -198,11 +199,11 @@ function pumpio_connect(App $a) } if ($success) { - logger("pumpio_connect: authenticated"); + Logger::log("pumpio_connect: authenticated"); $o = L10n::t("You are now authenticated to pumpio."); $o .= '
'.L10n::t("return to the connector page").''; } else { - logger("pumpio_connect: could not connect"); + Logger::log("pumpio_connect: could not connect"); $o = 'Could not connect to pumpio. Refresh the page or try again later.'; } @@ -409,7 +410,7 @@ function pumpio_send(App $a, array &$b) return; } - logger("pumpio_send: parameter ".print_r($b, true), LOGGER_DATA); + Logger::log("pumpio_send: parameter ".print_r($b, true), LOGGER_DATA); if ($b['parent'] != $b['id']) { // Looking if its a reply to a pumpio post @@ -417,7 +418,7 @@ function pumpio_send(App $a, array &$b) $orig_post = Item::selectFirst([], $condition); if (!DBA::isResult($orig_post)) { - logger("pumpio_send: no pumpio post ".$b["parent"]); + Logger::log("pumpio_send: no pumpio post ".$b["parent"]); return; } else { $iscomment = true; @@ -427,7 +428,7 @@ function pumpio_send(App $a, array &$b) $receiver = pumpio_getreceiver($a, $b); - logger("pumpio_send: receiver ".print_r($receiver, true)); + Logger::log("pumpio_send: receiver ".print_r($receiver, true)); if (!count($receiver) && ($b['private'] || !strstr($b['postopts'], 'pumpio'))) { return; @@ -559,13 +560,13 @@ function pumpio_send(App $a, array &$b) } $post_id = $user->object->id; - logger('pumpio_send '.$username.': success '.$post_id); + Logger::log('pumpio_send '.$username.': success '.$post_id); if ($post_id && $iscomment) { - logger('pumpio_send '.$username.': Update extid '.$post_id." for post id ".$b['id']); + Logger::log('pumpio_send '.$username.': Update extid '.$post_id." for post id ".$b['id']); Item::update(['extid' => $post_id], ['id' => $b['id']]); } } else { - logger('pumpio_send '.$username.': '.$url.' general error: ' . print_r($user, true)); + Logger::log('pumpio_send '.$username.': '.$url.' general error: ' . print_r($user, true)); $r = q("SELECT `id` FROM `contact` WHERE `uid` = %d AND `self`", $b['uid']); if (DBA::isResult($r)) { @@ -640,9 +641,9 @@ function pumpio_action(App $a, $uid, $uri, $action, $content = "") } if ($success) { - logger('pumpio_action '.$username.' '.$action.': success '.$uri); + Logger::log('pumpio_action '.$username.' '.$action.': success '.$uri); } else { - logger('pumpio_action '.$username.' '.$action.': general error: '.$uri.' '.print_r($user, true)); + Logger::log('pumpio_action '.$username.' '.$action.': general error: '.$uri.' '.print_r($user, true)); $r = q("SELECT `id` FROM `contact` WHERE `uid` = %d AND `self`", $uid); if (DBA::isResult($r)) { @@ -671,16 +672,16 @@ function pumpio_sync(App $a) if ($last) { $next = $last + ($poll_interval * 60); if ($next > time()) { - logger('pumpio: poll intervall not reached'); + Logger::log('pumpio: poll intervall not reached'); return; } } - logger('pumpio: cron_start'); + Logger::log('pumpio: cron_start'); $r = q("SELECT * FROM `pconfig` WHERE `cat` = 'pumpio' AND `k` = 'mirror' AND `v` = '1' ORDER BY RAND() "); if (DBA::isResult($r)) { foreach ($r as $rr) { - logger('pumpio: mirroring user '.$rr['uid']); + Logger::log('pumpio: mirroring user '.$rr['uid']); pumpio_fetchtimeline($a, $rr['uid']); } } @@ -698,12 +699,12 @@ function pumpio_sync(App $a) if ($abandon_days != 0) { $user = q("SELECT `login_date` FROM `user` WHERE uid=%d AND `login_date` >= '%s'", $rr['uid'], $abandon_limit); if (!DBA::isResult($user)) { - logger('abandoned account: timeline from user '.$rr['uid'].' will not be imported'); + Logger::log('abandoned account: timeline from user '.$rr['uid'].' will not be imported'); continue; } } - logger('pumpio: importing timeline from user '.$rr['uid']); + Logger::log('pumpio: importing timeline from user '.$rr['uid']); pumpio_fetchinbox($a, $rr['uid']); // check for new contacts once a day @@ -721,7 +722,7 @@ function pumpio_sync(App $a) } } - logger('pumpio: cron_end'); + Logger::log('pumpio: cron_end'); Config::set('pumpio', 'last_poll', time()); } @@ -766,7 +767,7 @@ function pumpio_fetchtimeline(App $a, $uid) $url = 'https://'.$hostname.'/api/user/'.$username.'/feed/major'; - logger('pumpio: fetching for user '.$uid.' '.$url.' C:'.$client->client_id.' CS:'.$client->client_secret.' T:'.$client->access_token.' TS:'.$client->access_token_secret); + Logger::log('pumpio: fetching for user '.$uid.' '.$url.' C:'.$client->client_id.' CS:'.$client->client_secret.' T:'.$client->access_token.' TS:'.$client->access_token_secret); $useraddr = $username.'@'.$hostname; @@ -778,7 +779,7 @@ function pumpio_fetchtimeline(App $a, $uid) } if (!$success) { - logger('pumpio: error fetching posts for user '.$uid." ".$useraddr." ".print_r($user, true)); + Logger::log('pumpio: error fetching posts for user '.$uid." ".$useraddr." ".print_r($user, true)); return; } @@ -847,12 +848,12 @@ function pumpio_fetchtimeline(App $a, $uid) } } - logger('pumpio: posting for user '.$uid); + Logger::log('pumpio: posting for user '.$uid); require_once('mod/item.php'); item_post($a); - logger('pumpio: posting done - user '.$uid); + Logger::log('pumpio: posting done - user '.$uid); } } } @@ -896,9 +897,9 @@ function pumpio_dounlike(App $a, $uid, $self, $post, $own_id) Item::delete(['verb' => ACTIVITY_LIKE, 'uid' => $uid, 'contact-id' => $contactid, 'thr-parent' => $orig_post['uri']]); if (DBA::isResult($r)) { - logger("pumpio_dounlike: unliked existing like. User ".$own_id." ".$uid." Contact: ".$contactid." Url ".$orig_post['uri']); + Logger::log("pumpio_dounlike: unliked existing like. User ".$own_id." ".$uid." Contact: ".$contactid." Url ".$orig_post['uri']); } else { - logger("pumpio_dounlike: not found. User ".$own_id." ".$uid." Contact: ".$contactid." Url ".$orig_post['uri']); + Logger::log("pumpio_dounlike: not found. User ".$own_id." ".$uid." Contact: ".$contactid." Url ".$orig_post['uri']); } } @@ -907,7 +908,7 @@ function pumpio_dolike(App $a, $uid, $self, $post, $own_id, $threadcompletion = require_once('include/items.php'); if (empty($post->object->id)) { - logger('Got empty like: '.print_r($post, true), LOGGER_DEBUG); + Logger::log('Got empty like: '.print_r($post, true), LOGGER_DEBUG); return; } @@ -950,7 +951,7 @@ function pumpio_dolike(App $a, $uid, $self, $post, $own_id, $threadcompletion = $condition = ['verb' => ACTIVITY_LIKE, 'uid' => $uid, 'contact-id' => $contactid, 'thr-parent' => $orig_post['uri']]; if (Item::exists($condition)) { - logger("pumpio_dolike: found existing like. User ".$own_id." ".$uid." Contact: ".$contactid." Url ".$orig_post['uri']); + Logger::log("pumpio_dolike: found existing like. User ".$own_id." ".$uid." Contact: ".$contactid." Url ".$orig_post['uri']); return; } @@ -984,7 +985,7 @@ function pumpio_dolike(App $a, $uid, $self, $post, $own_id, $threadcompletion = $ret = Item::insert($likedata); - logger("pumpio_dolike: ".$ret." User ".$own_id." ".$uid." Contact: ".$contactid." Url ".$orig_post['uri']); + Logger::log("pumpio_dolike: ".$ret." User ".$own_id." ".$uid." Contact: ".$contactid." Url ".$orig_post['uri']); } function pumpio_get_contact($uid, $contact, $no_insert = false) @@ -1432,7 +1433,7 @@ function pumpio_queue_hook(App $a, array &$b) continue; } - logger('pumpio_queue: run'); + Logger::log('pumpio_queue: run'); $r = q("SELECT `user`.* FROM `user` LEFT JOIN `contact` ON `contact`.`uid` = `user`.`uid` WHERE `contact`.`self` = 1 AND `contact`.`id` = %d LIMIT 1", @@ -1444,7 +1445,7 @@ function pumpio_queue_hook(App $a, array &$b) $userdata = $r[0]; - //logger('pumpio_queue: fetching userdata '.print_r($userdata, true)); + //Logger::log('pumpio_queue: fetching userdata '.print_r($userdata, true)); $oauth_token = PConfig::get($userdata['uid'], "pumpio", "oauth_token"); $oauth_token_secret = PConfig::get($userdata['uid'], "pumpio", "oauth_token_secret"); @@ -1460,7 +1461,7 @@ function pumpio_queue_hook(App $a, array &$b) $consumer_key && $consumer_secret) { $username = $user.'@'.$host; - logger('pumpio_queue: able to post for user '.$username); + Logger::log('pumpio_queue: able to post for user '.$username); $z = unserialize($x['content']); @@ -1481,21 +1482,21 @@ function pumpio_queue_hook(App $a, array &$b) if ($success) { $post_id = $user->object->id; - logger('pumpio_queue: send '.$username.': success '.$post_id); + Logger::log('pumpio_queue: send '.$username.': success '.$post_id); if ($post_id && $iscomment) { - logger('pumpio_send '.$username.': Update extid '.$post_id." for post id ".$z['item']); + Logger::log('pumpio_send '.$username.': Update extid '.$post_id." for post id ".$z['item']); Item::update(['extid' => $post_id], ['id' => $z['item']]); } Queue::removeItem($x['id']); } else { - logger('pumpio_queue: send '.$username.': '.$z['url'].' general error: ' . print_r($user, true)); + Logger::log('pumpio_queue: send '.$username.': '.$z['url'].' general error: ' . print_r($user, true)); } } else { - logger("pumpio_queue: Error getting tokens for user ".$userdata['uid']); + Logger::log("pumpio_queue: Error getting tokens for user ".$userdata['uid']); } if (!$success) { - logger('pumpio_queue: delayed'); + Logger::log('pumpio_queue: delayed'); Queue::updateTime($x['id']); } } @@ -1595,7 +1596,7 @@ function pumpio_fetchallcomments(App $a, $uid, $id) $hostname = PConfig::get($uid, 'pumpio', 'host'); $username = PConfig::get($uid, "pumpio", "user"); - logger("pumpio_fetchallcomments: completing comment for user ".$uid." post id ".$id); + Logger::log("pumpio_fetchallcomments: completing comment for user ".$uid." post id ".$id); $own_id = "https://".$hostname."/".$username; @@ -1621,7 +1622,7 @@ function pumpio_fetchallcomments(App $a, $uid, $id) $client->access_token = $otoken; $client->access_token_secret = $osecret; - logger("pumpio_fetchallcomments: fetching comment for user ".$uid." url ".$url); + Logger::log("pumpio_fetchallcomments: fetching comment for user ".$uid." url ".$url); if (pumpio_reachable($url)) { $success = $client->CallAPI($url, 'GET', [], ['FailOnAccessError'=>true], $item); @@ -1684,7 +1685,7 @@ function pumpio_fetchallcomments(App $a, $uid, $id) $post->object = $item; - logger("pumpio_fetchallcomments: posting comment ".$post->object->id." ".print_r($post, true)); + Logger::log("pumpio_fetchallcomments: posting comment ".$post->object->id." ".print_r($post, true)); pumpio_dopost($a, $client, $uid, $self, $post, $own_id, false); } } diff --git a/pumpio/pumpio_sync.php b/pumpio/pumpio_sync.php index a8fa7b3c..de794ad6 100644 --- a/pumpio/pumpio_sync.php +++ b/pumpio/pumpio_sync.php @@ -1,5 +1,6 @@ Config::get('system', 'maxloadavg', 50)) { - logger('system: load ' . $load[0] . ' too high. Pumpio sync deferred to next scheduled run.'); + Logger::log('system: load ' . $load[0] . ' too high. Pumpio sync deferred to next scheduled run.'); return; } } diff --git a/randplace/randplace.php b/randplace/randplace.php index 019d6f76..7784d80b 100644 --- a/randplace/randplace.php +++ b/randplace/randplace.php @@ -20,6 +20,7 @@ */ use Friendica\Core\Addon; use Friendica\Core\L10n; +use Friendica\Core\Logger; use Friendica\Core\PConfig; function randplace_install() { @@ -44,7 +45,7 @@ function randplace_install() { Addon::registerHook('addon_settings', 'addon/randplace/randplace.php', 'randplace_settings'); Addon::registerHook('addon_settings_post', 'addon/randplace/randplace.php', 'randplace_settings_post'); - logger("installed randplace"); + Logger::log("installed randplace"); } @@ -63,7 +64,7 @@ function randplace_uninstall() { Addon::unregisterHook('addon_settings_post', 'addon/randplace/randplace.php', 'randplace_settings_post'); - logger("removed randplace"); + Logger::log("removed randplace"); } @@ -79,7 +80,7 @@ function randplace_post_hook($a, &$item) { * */ - logger('randplace invoked'); + Logger::log('randplace invoked'); if(! local_user()) /* non-zero if this is a logged in user of this system */ return; diff --git a/securemail/securemail.php b/securemail/securemail.php index d935160e..e39b88ef 100644 --- a/securemail/securemail.php +++ b/securemail/securemail.php @@ -10,6 +10,7 @@ use Friendica\App; use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; +use Friendica\Core\Logger; use Friendica\Core\PConfig; use Friendica\Util\Emailer; @@ -31,7 +32,7 @@ function securemail_install() { Addon::registerHook('emailer_send_prepare', 'addon/securemail/securemail.php', 'securemail_emailer_send_prepare'); - logger('installed securemail'); + Logger::log('installed securemail'); } function securemail_uninstall() { @@ -40,7 +41,7 @@ function securemail_uninstall() { Addon::unregisterHook('emailer_send_prepare', 'addon/securemail/securemail.php', 'securemail_emailer_send_prepare'); - logger('removed securemail'); + Logger::log('removed securemail'); } /** diff --git a/smileybutton/smileybutton.php b/smileybutton/smileybutton.php index e5aaef9c..f4db08d9 100644 --- a/smileybutton/smileybutton.php +++ b/smileybutton/smileybutton.php @@ -6,12 +6,13 @@ * Author: Johannes Schwab */ use Friendica\Core\Addon; +use Friendica\Core\Logger; function smileybutton_install() { //Register hooks Addon::registerHook('jot_tool', 'addon/smileybutton/smileybutton.php', 'show_button'); - logger("installed smileybutton"); + Logger::log("installed smileybutton"); } @@ -19,7 +20,7 @@ function smileybutton_uninstall() { //Delet registered hooks Addon::unregisterHook('jot_tool', 'addon/smileybutton/smileybutton.php', 'show_button'); - logger("removed smileybutton"); + Logger::log("removed smileybutton"); } diff --git a/statusnet/statusnet.php b/statusnet/statusnet.php index 6cdc2372..81cf7f35 100644 --- a/statusnet/statusnet.php +++ b/statusnet/statusnet.php @@ -46,6 +46,7 @@ use Friendica\Content\Text\Plaintext; use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; +use Friendica\Core\Logger; use Friendica\Core\PConfig; use Friendica\Core\Protocol; use Friendica\Database\DBA; @@ -70,7 +71,7 @@ function statusnet_install() Addon::registerHook('cron', 'addon/statusnet/statusnet.php', 'statusnet_cron'); Addon::registerHook('prepare_body', 'addon/statusnet/statusnet.php', 'statusnet_prepare_body'); Addon::registerHook('check_item_notification', 'addon/statusnet/statusnet.php', 'statusnet_check_item_notification'); - logger("installed GNU Social"); + Logger::log("installed GNU Social"); } function statusnet_uninstall() @@ -429,7 +430,7 @@ function statusnet_action(App $a, $uid, $pid, $action) $connection = new StatusNetOAuth($api, $ckey, $csecret, $otoken, $osecret); - logger("statusnet_action '" . $action . "' ID: " . $pid, LOGGER_DATA); + Logger::log("statusnet_action '" . $action . "' ID: " . $pid, LOGGER_DATA); switch ($action) { case "delete": @@ -442,7 +443,7 @@ function statusnet_action(App $a, $uid, $pid, $action) $result = $connection->post("favorites/destroy/" . $pid); break; } - logger("statusnet_action '" . $action . "' send, result: " . print_r($result, true), LOGGER_DEBUG); + Logger::log("statusnet_action '" . $action . "' send, result: " . print_r($result, true), LOGGER_DEBUG); } function statusnet_post_hook(App $a, &$b) @@ -459,19 +460,19 @@ function statusnet_post_hook(App $a, &$b) $hostname = preg_replace("=https?://([\w\.]*)/.*=ism", "$1", $api); if ($b['parent'] != $b['id']) { - logger("statusnet_post_hook: parameter " . print_r($b, true), LOGGER_DATA); + Logger::log("statusnet_post_hook: parameter " . print_r($b, true), LOGGER_DATA); // Looking if its a reply to a GNU Social post $hostlength = strlen($hostname) + 2; if ((substr($b["parent-uri"], 0, $hostlength) != $hostname . "::") && (substr($b["extid"], 0, $hostlength) != $hostname . "::") && (substr($b["thr-parent"], 0, $hostlength) != $hostname . "::")) { - logger("statusnet_post_hook: no GNU Social post " . $b["parent"]); + Logger::log("statusnet_post_hook: no GNU Social post " . $b["parent"]); return; } $condition = ['uri' => $b["thr-parent"], 'uid' => $b["uid"]]; $orig_post = Item::selectFirst(['author-link', 'uri'], $condition); if (!DBA::isResult($orig_post)) { - logger("statusnet_post_hook: no parent found " . $b["thr-parent"]); + Logger::log("statusnet_post_hook: no parent found " . $b["thr-parent"]); return; } else { $iscomment = true; @@ -482,12 +483,12 @@ function statusnet_post_hook(App $a, &$b) $nickname = "@[url=" . $orig_post["author-link"] . "]" . $nick . "[/url]"; $nicknameplain = "@" . $nick; - logger("statusnet_post_hook: comparing " . $nickname . " and " . $nicknameplain . " with " . $b["body"], LOGGER_DEBUG); + Logger::log("statusnet_post_hook: comparing " . $nickname . " and " . $nicknameplain . " with " . $b["body"], LOGGER_DEBUG); if ((strpos($b["body"], $nickname) === false) && (strpos($b["body"], $nicknameplain) === false)) { $b["body"] = $nickname . " " . $b["body"]; } - logger("statusnet_post_hook: parent found " . print_r($orig_post, true), LOGGER_DEBUG); + Logger::log("statusnet_post_hook: parent found " . print_r($orig_post, true), LOGGER_DEBUG); } else { $iscomment = false; @@ -508,7 +509,7 @@ function statusnet_post_hook(App $a, &$b) } if ($b['verb'] == ACTIVITY_LIKE) { - logger("statusnet_post_hook: parameter 2 " . substr($b["thr-parent"], $hostlength), LOGGER_DEBUG); + Logger::log("statusnet_post_hook: parameter 2 " . substr($b["thr-parent"], $hostlength), LOGGER_DEBUG); if ($b['deleted']) statusnet_action($a, $b["uid"], substr($b["thr-parent"], $hostlength), "unlike"); else @@ -529,7 +530,7 @@ function statusnet_post_hook(App $a, &$b) return; } - logger('GNU Socialpost invoked'); + Logger::log('GNU Socialpost invoked'); PConfig::load($b['uid'], 'statusnet'); @@ -578,7 +579,7 @@ function statusnet_post_hook(App $a, &$b) if (strlen($msg)) { if ($iscomment) { $postdata["in_reply_to_status_id"] = substr($orig_post["uri"], $hostlength); - logger('statusnet_post send reply ' . print_r($postdata, true), LOGGER_DEBUG); + Logger::log('statusnet_post send reply ' . print_r($postdata, true), LOGGER_DEBUG); } // New code that is able to post pictures @@ -589,7 +590,7 @@ function statusnet_post_hook(App $a, &$b) $cb->setToken($otoken, $osecret); $result = $cb->statuses_update($postdata); //$result = $dent->post('statuses/update', $postdata); - logger('statusnet_post send, result: ' . print_r($result, true) . + Logger::log('statusnet_post send, result: ' . print_r($result, true) . "\nmessage: " . $msg . "\nOriginal post: " . print_r($b, true) . "\nPost Data: " . print_r($postdata, true), LOGGER_DEBUG); if (!empty($result->source)) { @@ -597,9 +598,9 @@ function statusnet_post_hook(App $a, &$b) } if (!empty($result->error)) { - logger('Send to GNU Social failed: "' . $result->error . '"'); + Logger::log('Send to GNU Social failed: "' . $result->error . '"'); } elseif ($iscomment) { - logger('statusnet_post: Update extid ' . $result->id . " for post id " . $b['id']); + Logger::log('statusnet_post: Update extid ' . $result->id . " for post id " . $b['id']); Item::update(['extid' => $hostname . "::" . $result->id, 'body' => $result->text], ['id' => $b['id']]); } } @@ -729,16 +730,16 @@ function statusnet_cron(App $a, $b) if ($last) { $next = $last + ($poll_interval * 60); if ($next > time()) { - logger('statusnet: poll intervall not reached'); + Logger::log('statusnet: poll intervall not reached'); return; } } - logger('statusnet: cron_start'); + Logger::log('statusnet: cron_start'); $r = q("SELECT * FROM `pconfig` WHERE `cat` = 'statusnet' AND `k` = 'mirror_posts' AND `v` = '1' ORDER BY RAND() "); if (DBA::isResult($r)) { foreach ($r as $rr) { - logger('statusnet: fetching for user ' . $rr['uid']); + Logger::log('statusnet: fetching for user ' . $rr['uid']); statusnet_fetchtimeline($a, $rr['uid']); } } @@ -756,17 +757,17 @@ function statusnet_cron(App $a, $b) if ($abandon_days != 0) { $user = q("SELECT `login_date` FROM `user` WHERE uid=%d AND `login_date` >= '%s'", $rr['uid'], $abandon_limit); if (!DBA::isResult($user)) { - logger('abandoned account: timeline from user ' . $rr['uid'] . ' will not be imported'); + Logger::log('abandoned account: timeline from user ' . $rr['uid'] . ' will not be imported'); continue; } } - logger('statusnet: importing timeline from user ' . $rr['uid']); + Logger::log('statusnet: importing timeline from user ' . $rr['uid']); statusnet_fetchhometimeline($a, $rr["uid"], $rr["v"]); } } - logger('statusnet: cron_end'); + Logger::log('statusnet: cron_end'); Config::set('statusnet', 'last_poll', time()); } @@ -871,7 +872,7 @@ function statusnet_fetchtimeline(App $a, $uid) //print_r($_REQUEST); if ($_REQUEST["body"] != "") { - logger('statusnet: posting for user ' . $uid); + Logger::log('statusnet: posting for user ' . $uid); item_post($a); } @@ -912,7 +913,7 @@ function statusnet_fetch_contact($uid, $contact, $create_user) } if (DBA::isResult($r) && ($r[0]["readonly"] || $r[0]["blocked"])) { - logger("statusnet_fetch_contact: Contact '" . $r[0]["nick"] . "' is blocked or readonly.", LOGGER_DEBUG); + Logger::log("statusnet_fetch_contact: Contact '" . $r[0]["nick"] . "' is blocked or readonly.", LOGGER_DEBUG); return -1; } @@ -974,7 +975,7 @@ function statusnet_fetch_contact($uid, $contact, $create_user) // check that we have all the photos, this has been known to fail on occasion if ((!$r[0]['photo']) || (!$r[0]['thumb']) || (!$r[0]['micro']) || ($update_photo)) { - logger("statusnet_fetch_contact: Updating contact " . $contact->screen_name, LOGGER_DEBUG); + Logger::log("statusnet_fetch_contact: Updating contact " . $contact->screen_name, LOGGER_DEBUG); $photos = Photo::importProfilePhoto($contact->profile_image_url, $uid, $r[0]['id']); @@ -1060,7 +1061,7 @@ function statusnet_fetchuser(App $a, $uid, $screen_name = "", $user_id = "") function statusnet_createpost(App $a, $uid, $post, $self, $create_user, $only_existing_contact) { - logger("statusnet_createpost: start", LOGGER_DEBUG); + Logger::log("statusnet_createpost: start", LOGGER_DEBUG); $api = PConfig::get($uid, 'statusnet', 'baseapi'); $hostname = preg_replace("=https?://([\w\.]*)/.*=ism", "$1", $api); @@ -1187,7 +1188,7 @@ function statusnet_createpost(App $a, $uid, $post, $self, $create_user, $only_ex $postarray["coord"] = $content->coordinates->coordinates[1] . " " . $content->coordinates->coordinates[0]; } - logger("statusnet_createpost: end", LOGGER_DEBUG); + Logger::log("statusnet_createpost: end", LOGGER_DEBUG); return $postarray; } @@ -1206,7 +1207,7 @@ function statusnet_fetchhometimeline(App $a, $uid, $mode = 1) // "create_user" is deactivated, since currently you cannot add users manually by now $create_user = true; - logger("statusnet_fetchhometimeline: Fetching for user " . $uid, LOGGER_DEBUG); + Logger::log("statusnet_fetchhometimeline: Fetching for user " . $uid, LOGGER_DEBUG); require_once 'include/items.php'; @@ -1221,7 +1222,7 @@ function statusnet_fetchhometimeline(App $a, $uid, $mode = 1) if (DBA::isResult($r)) { $nick = $r[0]["nick"]; } else { - logger("statusnet_fetchhometimeline: Own GNU Social contact not found for user " . $uid, LOGGER_DEBUG); + Logger::log("statusnet_fetchhometimeline: Own GNU Social contact not found for user " . $uid, LOGGER_DEBUG); return; } @@ -1231,14 +1232,14 @@ function statusnet_fetchhometimeline(App $a, $uid, $mode = 1) if (DBA::isResult($r)) { $self = $r[0]; } else { - logger("statusnet_fetchhometimeline: Own contact not found for user " . $uid, LOGGER_DEBUG); + Logger::log("statusnet_fetchhometimeline: Own contact not found for user " . $uid, LOGGER_DEBUG); return; } $u = q("SELECT * FROM user WHERE uid = %d LIMIT 1", intval($uid)); if (!DBA::isResult($u)) { - logger("statusnet_fetchhometimeline: Own user not found for user " . $uid, LOGGER_DEBUG); + Logger::log("statusnet_fetchhometimeline: Own user not found for user " . $uid, LOGGER_DEBUG); return; } @@ -1269,13 +1270,13 @@ function statusnet_fetchhometimeline(App $a, $uid, $mode = 1) $errormsg = "Unknown error"; } - logger("statusnet_fetchhometimeline: Error fetching home timeline: " . $errormsg, LOGGER_DEBUG); + Logger::log("statusnet_fetchhometimeline: Error fetching home timeline: " . $errormsg, LOGGER_DEBUG); return; } $posts = array_reverse($items); - logger("statusnet_fetchhometimeline: Fetching timeline for user " . $uid . " " . sizeof($posts) . " items", LOGGER_DEBUG); + Logger::log("statusnet_fetchhometimeline: Fetching timeline for user " . $uid . " " . sizeof($posts) . " items", LOGGER_DEBUG); if (count($posts)) { foreach ($posts as $post) { @@ -1303,7 +1304,7 @@ function statusnet_fetchhometimeline(App $a, $uid, $mode = 1) $item = Item::insert($postarray); $postarray["id"] = $item; - logger('statusnet_fetchhometimeline: User ' . $self["nick"] . ' posted home timeline item ' . $item); + Logger::log('statusnet_fetchhometimeline: User ' . $self["nick"] . ' posted home timeline item ' . $item); } } } @@ -1321,13 +1322,13 @@ function statusnet_fetchhometimeline(App $a, $uid, $mode = 1) $items = $connection->get('statuses/mentions_timeline', $parameters); if (!is_array($items)) { - logger("statusnet_fetchhometimeline: Error fetching mentions: " . print_r($items, true), LOGGER_DEBUG); + Logger::log("statusnet_fetchhometimeline: Error fetching mentions: " . print_r($items, true), LOGGER_DEBUG); return; } $posts = array_reverse($items); - logger("statusnet_fetchhometimeline: Fetching mentions for user " . $uid . " " . sizeof($posts) . " items", LOGGER_DEBUG); + Logger::log("statusnet_fetchhometimeline: Fetching mentions for user " . $uid . " " . sizeof($posts) . " items", LOGGER_DEBUG); if (count($posts)) { foreach ($posts as $post) { @@ -1353,7 +1354,7 @@ function statusnet_fetchhometimeline(App $a, $uid, $mode = 1) $item = Item::insert($postarray); - logger('statusnet_fetchhometimeline: User ' . $self["nick"] . ' posted mention timeline item ' . $item); + Logger::log('statusnet_fetchhometimeline: User ' . $self["nick"] . ' posted mention timeline item ' . $item); } } } @@ -1388,7 +1389,7 @@ function statusnet_complete_conversation(App $a, $uid, $self, $create_user, $nic $item = Item::insert($postarray); $postarray["id"] = $item; - logger('statusnet_complete_conversation: User ' . $self["nick"] . ' posted home timeline item ' . $item); + Logger::log('statusnet_complete_conversation: User ' . $self["nick"] . ' posted home timeline item ' . $item); } } } @@ -1411,15 +1412,15 @@ function statusnet_convertmsg(App $a, $body, $no_tags = false) foreach ($matches AS $match) { $search = "[url=" . $match[1] . "]" . $match[2] . "[/url]"; - logger("statusnet_convertmsg: expanding url " . $match[1], LOGGER_DEBUG); + Logger::log("statusnet_convertmsg: expanding url " . $match[1], LOGGER_DEBUG); $expanded_url = Network::finalUrl($match[1]); - logger("statusnet_convertmsg: fetching data for " . $expanded_url, LOGGER_DEBUG); + Logger::log("statusnet_convertmsg: fetching data for " . $expanded_url, LOGGER_DEBUG); $oembed_data = OEmbed::fetchURL($expanded_url, true); - logger("statusnet_convertmsg: fetching data: done", LOGGER_DEBUG); + Logger::log("statusnet_convertmsg: fetching data: done", LOGGER_DEBUG); if ($type == "") { $type = $oembed_data->type; @@ -1581,13 +1582,13 @@ function statusnet_is_retweet(App $a, $uid, $body) return false; } - logger('statusnet_is_retweet: Retweeting id ' . $id . ' for user ' . $uid, LOGGER_DEBUG); + Logger::log('statusnet_is_retweet: Retweeting id ' . $id . ' for user ' . $uid, LOGGER_DEBUG); $connection = new StatusNetOAuth($api, $ckey, $csecret, $otoken, $osecret); $result = $connection->post('statuses/retweet/' . $id); - logger('statusnet_is_retweet: result ' . print_r($result, true), LOGGER_DEBUG); + Logger::log('statusnet_is_retweet: result ' . print_r($result, true), LOGGER_DEBUG); return isset($result->id); } diff --git a/tumblr/tumblr.php b/tumblr/tumblr.php index 5862958d..7d232a6a 100644 --- a/tumblr/tumblr.php +++ b/tumblr/tumblr.php @@ -14,6 +14,7 @@ use Friendica\Content\Text\BBCode; use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; +use Friendica\Core\Logger; use Friendica\Core\PConfig; use Friendica\Database\DBA; @@ -458,11 +459,11 @@ function tumblr_send(App $a, array &$b) { //print_r($params); if ($ret_code == 201) { - logger('tumblr_send: success'); + Logger::log('tumblr_send: success'); } elseif ($ret_code == 403) { - logger('tumblr_send: authentication failure'); + Logger::log('tumblr_send: authentication failure'); } else { - logger('tumblr_send: general error: ' . print_r($x,true)); + Logger::log('tumblr_send: general error: ' . print_r($x,true)); } } } diff --git a/twitter/twitter.php b/twitter/twitter.php index 597278ca..2a04da9f 100644 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -69,6 +69,7 @@ use Friendica\Content\Text\Plaintext; use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; +use Friendica\Core\Logger; use Friendica\Core\PConfig; use Friendica\Core\Protocol; use Friendica\Core\Worker; @@ -109,7 +110,7 @@ function twitter_install() Addon::registerHook('expire' , __FILE__, 'twitter_expire'); Addon::registerHook('prepare_body' , __FILE__, 'twitter_prepare_body'); Addon::registerHook('check_item_notification', __FILE__, 'twitter_check_item_notification'); - logger("installed twitter"); + Logger::log("installed twitter"); } function twitter_uninstall() @@ -154,7 +155,7 @@ function twitter_check_item_notification(App $a, array &$notification_data) function twitter_follow(App $a, array &$contact) { - logger("twitter_follow: Check if contact is twitter contact. " . $contact["url"], LOGGER_DEBUG); + Logger::log("twitter_follow: Check if contact is twitter contact. " . $contact["url"], LOGGER_DEBUG); if (!strstr($contact["url"], "://twitter.com") && !strstr($contact["url"], "@twitter.com")) { return; @@ -235,7 +236,7 @@ function twitter_settings_post(App $a) } else { if (isset($_POST['twitter-pin'])) { // if the user supplied us with a PIN from Twitter, let the magic of OAuth happen - logger('got a Twitter PIN'); + Logger::log('got a Twitter PIN'); $ckey = Config::get('twitter', 'consumerkey'); $csecret = Config::get('twitter', 'consumersecret'); // the token and secret for which the PIN was generated were hidden in the settings @@ -427,7 +428,7 @@ function twitter_action(App $a, $uid, $pid, $action) $post = ['id' => $pid]; - logger("twitter_action '" . $action . "' ID: " . $pid . " data: " . print_r($post, true), LOGGER_DATA); + Logger::log("twitter_action '" . $action . "' ID: " . $pid . " data: " . print_r($post, true), LOGGER_DATA); switch ($action) { case "delete": @@ -441,10 +442,10 @@ function twitter_action(App $a, $uid, $pid, $action) $result = $connection->post('favorites/destroy', $post); break; default: - logger('Unhandled action ' . $action, LOGGER_DEBUG); + Logger::log('Unhandled action ' . $action, LOGGER_DEBUG); $result = []; } - logger("twitter_action '" . $action . "' send, result: " . print_r($result, true), LOGGER_DEBUG); + Logger::log("twitter_action '" . $action . "' send, result: " . print_r($result, true), LOGGER_DEBUG); } function twitter_post_hook(App $a, array &$b) @@ -456,21 +457,21 @@ function twitter_post_hook(App $a, array &$b) } if ($b['parent'] != $b['id']) { - logger("twitter_post_hook: parameter " . print_r($b, true), LOGGER_DATA); + Logger::log("twitter_post_hook: parameter " . print_r($b, true), LOGGER_DATA); // Looking if its a reply to a twitter post if ((substr($b["parent-uri"], 0, 9) != "twitter::") && (substr($b["extid"], 0, 9) != "twitter::") && (substr($b["thr-parent"], 0, 9) != "twitter::")) { - logger("twitter_post_hook: no twitter post " . $b["parent"]); + Logger::log("twitter_post_hook: no twitter post " . $b["parent"]); return; } $condition = ['uri' => $b["thr-parent"], 'uid' => $b["uid"]]; $orig_post = Item::selectFirst([], $condition); if (!DBA::isResult($orig_post)) { - logger("twitter_post_hook: no parent found " . $b["thr-parent"]); + Logger::log("twitter_post_hook: no parent found " . $b["thr-parent"]); return; } else { $iscomment = true; @@ -481,12 +482,12 @@ function twitter_post_hook(App $a, array &$b) $nickname = "@[url=" . $orig_post["author-link"] . "]" . $nicknameplain . "[/url]"; $nicknameplain = "@" . $nicknameplain; - logger("twitter_post_hook: comparing " . $nickname . " and " . $nicknameplain . " with " . $b["body"], LOGGER_DEBUG); + Logger::log("twitter_post_hook: comparing " . $nickname . " and " . $nicknameplain . " with " . $b["body"], LOGGER_DEBUG); if ((strpos($b["body"], $nickname) === false) && (strpos($b["body"], $nicknameplain) === false)) { $b["body"] = $nickname . " " . $b["body"]; } - logger("twitter_post_hook: parent found " . print_r($orig_post, true), LOGGER_DATA); + Logger::log("twitter_post_hook: parent found " . print_r($orig_post, true), LOGGER_DATA); } else { $iscomment = false; @@ -507,7 +508,7 @@ function twitter_post_hook(App $a, array &$b) } if ($b['verb'] == ACTIVITY_LIKE) { - logger("twitter_post_hook: parameter 2 " . substr($b["thr-parent"], 9), LOGGER_DEBUG); + Logger::log("twitter_post_hook: parameter 2 " . substr($b["thr-parent"], 9), LOGGER_DEBUG); if ($b['deleted']) { twitter_action($a, $b["uid"], substr($b["thr-parent"], 9), "unlike"); } else { @@ -530,7 +531,7 @@ function twitter_post_hook(App $a, array &$b) return; } - logger('twitter post invoked'); + Logger::log('twitter post invoked'); PConfig::load($b['uid'], 'twitter'); @@ -540,7 +541,7 @@ function twitter_post_hook(App $a, array &$b) $osecret = PConfig::get($b['uid'], 'twitter', 'oauthsecret'); if ($ckey && $csecret && $otoken && $osecret) { - logger('twitter: we have customer key and oauth stuff, going to send.', LOGGER_DEBUG); + Logger::log('twitter: we have customer key and oauth stuff, going to send.', LOGGER_DEBUG); // If it's a repeated message from twitter then do a native retweet and exit if (twitter_is_retweet($a, $b['uid'], $b['body'])) { @@ -608,7 +609,7 @@ function twitter_post_hook(App $a, array &$b) throw new Exception('Failed upload of ' . $image); } } catch (Exception $e) { - logger('Exception when trying to send to Twitter: ' . $e->getMessage()); + Logger::log('Exception when trying to send to Twitter: ' . $e->getMessage()); // Workaround: Remove the picture link so that the post can be reposted without it // When there is another url already added, a second url would be superfluous. @@ -628,14 +629,14 @@ function twitter_post_hook(App $a, array &$b) $url = 'statuses/update'; $result = $connection->post($url, $post); - logger('twitter_post send, result: ' . print_r($result, true), LOGGER_DEBUG); + Logger::log('twitter_post send, result: ' . print_r($result, true), LOGGER_DEBUG); if (!empty($result->source)) { Config::set("twitter", "application_name", strip_tags($result->source)); } if (!empty($result->errors)) { - logger('Send to Twitter failed: "' . print_r($result->errors, true) . '"'); + Logger::log('Send to Twitter failed: "' . print_r($result->errors, true) . '"'); $r = q("SELECT `id` FROM `contact` WHERE `uid` = %d AND `self`", intval($b['uid'])); if (DBA::isResult($r)) { @@ -647,7 +648,7 @@ function twitter_post_hook(App $a, array &$b) Queue::add($a->contact, Protocol::TWITTER, $s); notice(L10n::t('Twitter post failed. Queued for retry.') . EOL); } elseif ($iscomment) { - logger('twitter_post: Update extid ' . $result->id_str . " for post id " . $b['id']); + Logger::log('twitter_post: Update extid ' . $result->id_str . " for post id " . $b['id']); Item::update(['extid' => "twitter::" . $result->id_str], ['id' => $b['id']]); } } @@ -686,16 +687,16 @@ function twitter_cron(App $a) if ($last) { $next = $last + ($poll_interval * 60); if ($next > time()) { - logger('twitter: poll intervall not reached'); + Logger::log('twitter: poll intervall not reached'); return; } } - logger('twitter: cron_start'); + Logger::log('twitter: cron_start'); $r = q("SELECT * FROM `pconfig` WHERE `cat` = 'twitter' AND `k` = 'mirror_posts' AND `v` = '1'"); if (DBA::isResult($r)) { foreach ($r as $rr) { - logger('twitter: fetching for user ' . $rr['uid']); + Logger::log('twitter: fetching for user ' . $rr['uid']); Worker::add(PRIORITY_MEDIUM, "addon/twitter/twitter_sync.php", 1, (int) $rr['uid']); } } @@ -713,12 +714,12 @@ function twitter_cron(App $a) if ($abandon_days != 0) { $user = q("SELECT `login_date` FROM `user` WHERE uid=%d AND `login_date` >= '%s'", $rr['uid'], $abandon_limit); if (!DBA::isResult($user)) { - logger('abandoned account: timeline from user ' . $rr['uid'] . ' will not be imported'); + Logger::log('abandoned account: timeline from user ' . $rr['uid'] . ' will not be imported'); continue; } } - logger('twitter: importing timeline from user ' . $rr['uid']); + Logger::log('twitter: importing timeline from user ' . $rr['uid']); Worker::add(PRIORITY_MEDIUM, "addon/twitter/twitter_sync.php", 2, (int) $rr['uid']); /* // To-Do @@ -737,7 +738,7 @@ function twitter_cron(App $a) } } - logger('twitter: cron_end'); + Logger::log('twitter: cron_end'); Config::set('twitter', 'last_poll', time()); } @@ -758,17 +759,17 @@ function twitter_expire(App $a) require_once "include/items.php"; - logger('twitter_expire: expire_start'); + Logger::log('twitter_expire: expire_start'); $r = q("SELECT * FROM `pconfig` WHERE `cat` = 'twitter' AND `k` = 'import' AND `v` = '1' ORDER BY RAND()"); if (DBA::isResult($r)) { foreach ($r as $rr) { - logger('twitter_expire: user ' . $rr['uid']); + Logger::log('twitter_expire: user ' . $rr['uid']); Item::expire($rr['uid'], $days, Protocol::TWITTER, true); } } - logger('twitter_expire: expire_end'); + Logger::log('twitter_expire: expire_end'); } function twitter_prepare_body(App $a, array &$b) @@ -903,18 +904,18 @@ function twitter_fetchtimeline(App $a, $uid) try { $items = $connection->get('statuses/user_timeline', $parameters); } catch (TwitterOAuthException $e) { - logger('Error fetching timeline for user ' . $uid . ': ' . $e->getMessage()); + Logger::log('Error fetching timeline for user ' . $uid . ': ' . $e->getMessage()); return; } if (!is_array($items)) { - logger('No items for user ' . $uid, LOGGER_INFO); + Logger::log('No items for user ' . $uid, LOGGER_INFO); return; } $posts = array_reverse($items); - logger('Starting from ID ' . $lastid . ' for user ' . $uid, LOGGER_DEBUG); + Logger::log('Starting from ID ' . $lastid . ' for user ' . $uid, LOGGER_DEBUG); if (count($posts)) { foreach ($posts as $post) { @@ -931,7 +932,7 @@ function twitter_fetchtimeline(App $a, $uid) $_SESSION["authenticated"] = true; $_SESSION["uid"] = $uid; - logger('Preparing Twitter ID ' . $post->id_str . ' for user ' . $uid, LOGGER_DEBUG); + Logger::log('Preparing Twitter ID ' . $post->id_str . ' for user ' . $uid, LOGGER_DEBUG); $_REQUEST = twitter_do_mirrorpost($a, $uid, $post); @@ -939,14 +940,14 @@ function twitter_fetchtimeline(App $a, $uid) continue; } - logger('Posting Twitter ID ' . $post->id_str . ' for user ' . $uid); + Logger::log('Posting Twitter ID ' . $post->id_str . ' for user ' . $uid); item_post($a); } } } PConfig::set($uid, 'twitter', 'lastid', $lastid); - logger('Last ID for user ' . $uid . ' is now ' . $lastid, LOGGER_DEBUG); + Logger::log('Last ID for user ' . $uid . ' is now ' . $lastid, LOGGER_DEBUG); } function twitter_queue_hook(App $a) @@ -963,7 +964,7 @@ function twitter_queue_hook(App $a) continue; } - logger('twitter_queue: run'); + Logger::log('twitter_queue: run'); $r = q("SELECT `user`.* FROM `user` LEFT JOIN `contact` on `contact`.`uid` = `user`.`uid` WHERE `contact`.`self` = 1 AND `contact`.`id` = %d LIMIT 1", @@ -983,27 +984,27 @@ function twitter_queue_hook(App $a) $success = false; if ($ckey && $csecret && $otoken && $osecret) { - logger('twitter_queue: able to post'); + Logger::log('twitter_queue: able to post'); $z = unserialize($x['content']); $connection = new TwitterOAuth($ckey, $csecret, $otoken, $osecret); $result = $connection->post($z['url'], $z['post']); - logger('twitter_queue: post result: ' . print_r($result, true), LOGGER_DEBUG); + Logger::log('twitter_queue: post result: ' . print_r($result, true), LOGGER_DEBUG); if ($result->errors) { - logger('twitter_queue: Send to Twitter failed: "' . print_r($result->errors, true) . '"'); + Logger::log('twitter_queue: Send to Twitter failed: "' . print_r($result->errors, true) . '"'); } else { $success = true; Queue::removeItem($x['id']); } } else { - logger("twitter_queue: Error getting tokens for user " . $user['uid']); + Logger::log("twitter_queue: Error getting tokens for user " . $user['uid']); } if (!$success) { - logger('twitter_queue: delayed'); + Logger::log('twitter_queue: delayed'); Queue::updateTime($x['id']); } } @@ -1077,7 +1078,7 @@ function twitter_fetch_contact($uid, $data, $create_user) Contact::updateAvatar($avatar, $uid, $contact_id); } else { if ($contact["readonly"] || $contact["blocked"]) { - logger("twitter_fetch_contact: Contact '" . $contact["nick"] . "' is blocked or readonly.", LOGGER_DEBUG); + Logger::log("twitter_fetch_contact: Contact '" . $contact["nick"] . "' is blocked or readonly.", LOGGER_DEBUG); return -1; } @@ -1088,7 +1089,7 @@ function twitter_fetch_contact($uid, $data, $create_user) // check that we have all the photos, this has been known to fail on occasion if (empty($contact['photo']) || empty($contact['thumb']) || empty($contact['micro']) || $update_photo) { - logger("twitter_fetch_contact: Updating contact " . $data->screen_name, LOGGER_DEBUG); + Logger::log("twitter_fetch_contact: Updating contact " . $data->screen_name, LOGGER_DEBUG); Contact::updateAvatar($avatar, $uid, $contact['id']); @@ -1133,7 +1134,7 @@ function twitter_fetchuser(App $a, $uid, $screen_name = "", $user_id = "") try { $user = $connection->get('users/show', $parameters); } catch (TwitterOAuthException $e) { - logger('twitter_fetchuser: Error fetching user ' . $uid . ': ' . $e->getMessage()); + Logger::log('twitter_fetchuser: Error fetching user ' . $uid . ': ' . $e->getMessage()); return; } @@ -1387,7 +1388,7 @@ function twitter_createpost(App $a, $uid, $post, array $self, $create_user, $onl // Don't import our own comments if (Item::exists(['extid' => $postarray['uri'], 'uid' => $uid])) { - logger("Item with extid " . $postarray['uri'] . " found.", LOGGER_DEBUG); + Logger::log("Item with extid " . $postarray['uri'] . " found.", LOGGER_DEBUG); return []; } @@ -1427,7 +1428,7 @@ function twitter_createpost(App $a, $uid, $post, array $self, $create_user, $onl $postarray['owner-link'] = $r[0]["url"]; $postarray['owner-avatar'] = $r[0]["photo"]; } else { - logger("No self contact for user " . $uid, LOGGER_DEBUG); + Logger::log("No self contact for user " . $uid, LOGGER_DEBUG); return []; } } @@ -1449,7 +1450,7 @@ function twitter_createpost(App $a, $uid, $post, array $self, $create_user, $onl if (($contactid == 0) && !$only_existing_contact) { $contactid = $self['id']; } elseif ($contactid <= 0) { - logger("Contact ID is zero or less than zero.", LOGGER_DEBUG); + Logger::log("Contact ID is zero or less than zero.", LOGGER_DEBUG); return []; } @@ -1546,7 +1547,7 @@ function twitter_createpost(App $a, $uid, $post, array $self, $create_user, $onl function twitter_fetchparentposts(App $a, $uid, $post, TwitterOAuth $connection, array $self) { - logger("twitter_fetchparentposts: Fetching for user " . $uid . " and post " . $post->id_str, LOGGER_DEBUG); + Logger::log("twitter_fetchparentposts: Fetching for user " . $uid . " and post " . $post->id_str, LOGGER_DEBUG); $posts = []; @@ -1556,17 +1557,17 @@ function twitter_fetchparentposts(App $a, $uid, $post, TwitterOAuth $connection, try { $post = $connection->get('statuses/show', $parameters); } catch (TwitterOAuthException $e) { - logger('twitter_fetchparentposts: Error fetching for user ' . $uid . ' and post ' . $post->id_str . ': ' . $e->getMessage()); + Logger::log('twitter_fetchparentposts: Error fetching for user ' . $uid . ' and post ' . $post->id_str . ': ' . $e->getMessage()); break; } if (empty($post)) { - logger("twitter_fetchparentposts: Can't fetch post " . $parameters->id, LOGGER_DEBUG); + Logger::log("twitter_fetchparentposts: Can't fetch post " . $parameters->id, LOGGER_DEBUG); break; } if (empty($post->id_str)) { - logger("twitter_fetchparentposts: This is not a post " . json_encode($post), LOGGER_DEBUG); + Logger::log("twitter_fetchparentposts: This is not a post " . json_encode($post), LOGGER_DEBUG); break; } @@ -1577,7 +1578,7 @@ function twitter_fetchparentposts(App $a, $uid, $post, TwitterOAuth $connection, $posts[] = $post; } - logger("twitter_fetchparentposts: Fetching " . count($posts) . " parents", LOGGER_DEBUG); + Logger::log("twitter_fetchparentposts: Fetching " . count($posts) . " parents", LOGGER_DEBUG); $posts = array_reverse($posts); @@ -1593,7 +1594,7 @@ function twitter_fetchparentposts(App $a, $uid, $post, TwitterOAuth $connection, $postarray["id"] = $item; - logger('twitter_fetchparentpost: User ' . $self["nick"] . ' posted parent timeline item ' . $item); + Logger::log('twitter_fetchparentpost: User ' . $self["nick"] . ' posted parent timeline item ' . $item); } } } @@ -1607,7 +1608,7 @@ function twitter_fetchhometimeline(App $a, $uid) $create_user = PConfig::get($uid, 'twitter', 'create_user'); $mirror_posts = PConfig::get($uid, 'twitter', 'mirror_posts'); - logger("Fetching timeline for user " . $uid, LOGGER_DEBUG); + Logger::log("Fetching timeline for user " . $uid, LOGGER_DEBUG); $application_name = Config::get('twitter', 'application_name'); @@ -1622,7 +1623,7 @@ function twitter_fetchhometimeline(App $a, $uid) try { $own_contact = twitter_fetch_own_contact($a, $uid); } catch (TwitterOAuthException $e) { - logger('Error fetching own contact for user ' . $uid . ': ' . $e->getMessage()); + Logger::log('Error fetching own contact for user ' . $uid . ': ' . $e->getMessage()); return; } @@ -1633,13 +1634,13 @@ function twitter_fetchhometimeline(App $a, $uid) if (DBA::isResult($r)) { $own_id = $r[0]["nick"]; } else { - logger("Own twitter contact not found for user " . $uid); + Logger::log("Own twitter contact not found for user " . $uid); return; } $self = User::getOwnerDataById($uid); if ($self === false) { - logger("Own contact not found for user " . $uid); + Logger::log("Own contact not found for user " . $uid); return; } @@ -1657,23 +1658,23 @@ function twitter_fetchhometimeline(App $a, $uid) try { $items = $connection->get('statuses/home_timeline', $parameters); } catch (TwitterOAuthException $e) { - logger('Error fetching home timeline for user ' . $uid . ': ' . $e->getMessage()); + Logger::log('Error fetching home timeline for user ' . $uid . ': ' . $e->getMessage()); return; } if (!is_array($items)) { - logger('No array while fetching home timeline for user ' . $uid . ': ' . print_r($items, true)); + Logger::log('No array while fetching home timeline for user ' . $uid . ': ' . print_r($items, true)); return; } if (empty($items)) { - logger('No new timeline content for user ' . $uid, LOGGER_INFO); + Logger::log('No new timeline content for user ' . $uid, LOGGER_INFO); return; } $posts = array_reverse($items); - logger('Fetching timeline from ID ' . $lastid . ' for user ' . $uid . ' ' . sizeof($posts) . ' items', LOGGER_DEBUG); + Logger::log('Fetching timeline from ID ' . $lastid . ' for user ' . $uid . ' ' . sizeof($posts) . ' items', LOGGER_DEBUG); if (count($posts)) { foreach ($posts as $post) { @@ -1687,12 +1688,12 @@ function twitter_fetchhometimeline(App $a, $uid) } if (stristr($post->source, $application_name) && $post->user->screen_name == $own_id) { - logger("Skip previously sent post", LOGGER_DEBUG); + Logger::log("Skip previously sent post", LOGGER_DEBUG); continue; } if ($mirror_posts && $post->user->screen_name == $own_id && $post->in_reply_to_status_id_str == "") { - logger("Skip post that will be mirrored", LOGGER_DEBUG); + Logger::log("Skip post that will be mirrored", LOGGER_DEBUG); continue; } @@ -1700,12 +1701,12 @@ function twitter_fetchhometimeline(App $a, $uid) twitter_fetchparentposts($a, $uid, $post, $connection, $self); } - logger('Preparing post ' . $post->id_str . ' for user ' . $uid, LOGGER_DEBUG); + Logger::log('Preparing post ' . $post->id_str . ' for user ' . $uid, LOGGER_DEBUG); $postarray = twitter_createpost($a, $uid, $post, $self, $create_user, true, false); if (empty($postarray['body']) || trim($postarray['body']) == "") { - logger('Empty body for post ' . $post->id_str . ' and user ' . $uid, LOGGER_DEBUG); + Logger::log('Empty body for post ' . $post->id_str . ' and user ' . $uid, LOGGER_DEBUG); continue; } @@ -1721,12 +1722,12 @@ function twitter_fetchhometimeline(App $a, $uid) $item = Item::insert($postarray, false, $notify); $postarray["id"] = $item; - logger('User ' . $uid . ' posted home timeline item ' . $item); + Logger::log('User ' . $uid . ' posted home timeline item ' . $item); } } PConfig::set($uid, 'twitter', 'lasthometimelineid', $lastid); - logger('Last timeline ID for user ' . $uid . ' is now ' . $lastid, LOGGER_DEBUG); + Logger::log('Last timeline ID for user ' . $uid . ' is now ' . $lastid, LOGGER_DEBUG); // Fetching mentions $lastid = PConfig::get($uid, 'twitter', 'lastmentionid'); @@ -1740,18 +1741,18 @@ function twitter_fetchhometimeline(App $a, $uid) try { $items = $connection->get('statuses/mentions_timeline', $parameters); } catch (TwitterOAuthException $e) { - logger('Error fetching mentions: ' . $e->getMessage()); + Logger::log('Error fetching mentions: ' . $e->getMessage()); return; } if (!is_array($items)) { - logger("Error fetching mentions: " . print_r($items, true), LOGGER_DEBUG); + Logger::log("Error fetching mentions: " . print_r($items, true), LOGGER_DEBUG); return; } $posts = array_reverse($items); - logger("Fetching mentions for user " . $uid . " " . sizeof($posts) . " items", LOGGER_DEBUG); + Logger::log("Fetching mentions for user " . $uid . " " . sizeof($posts) . " items", LOGGER_DEBUG); if (count($posts)) { foreach ($posts as $post) { @@ -1775,13 +1776,13 @@ function twitter_fetchhometimeline(App $a, $uid) $item = Item::insert($postarray); - logger('User ' . $uid . ' posted mention timeline item ' . $item); + Logger::log('User ' . $uid . ' posted mention timeline item ' . $item); } } PConfig::set($uid, 'twitter', 'lastmentionid', $lastid); - logger('Last mentions ID for user ' . $uid . ' is now ' . $lastid, LOGGER_DEBUG); + Logger::log('Last mentions ID for user ' . $uid . ' is now ' . $lastid, LOGGER_DEBUG); } function twitter_fetch_own_contact(App $a, $uid) @@ -1856,7 +1857,7 @@ function twitter_is_retweet(App $a, $uid, $body) return false; } - logger('twitter_is_retweet: Retweeting id ' . $id . ' for user ' . $uid, LOGGER_DEBUG); + Logger::log('twitter_is_retweet: Retweeting id ' . $id . ' for user ' . $uid, LOGGER_DEBUG); $ckey = Config::get('twitter', 'consumerkey'); $csecret = Config::get('twitter', 'consumersecret'); @@ -1866,7 +1867,7 @@ function twitter_is_retweet(App $a, $uid, $body) $connection = new TwitterOAuth($ckey, $csecret, $otoken, $osecret); $result = $connection->post('statuses/retweet/' . $id); - logger('twitter_is_retweet: result ' . print_r($result, true), LOGGER_DEBUG); + Logger::log('twitter_is_retweet: result ' . print_r($result, true), LOGGER_DEBUG); return !isset($result->errors); } diff --git a/twitter/twitter_sync.php b/twitter/twitter_sync.php index 60924acd..b2c655e7 100644 --- a/twitter/twitter_sync.php +++ b/twitter/twitter_sync.php @@ -1,6 +1,7 @@ Config::get('system', 'maxloadavg', 50)) { - logger('system: load ' . $load[0] . ' too high. Twitter sync deferred to next scheduled run.'); + Logger::log('system: load ' . $load[0] . ' too high. Twitter sync deferred to next scheduled run.'); return; } } diff --git a/widgets/widgets.php b/widgets/widgets.php index 5cb8a279..8d7cf3ae 100644 --- a/widgets/widgets.php +++ b/widgets/widgets.php @@ -9,13 +9,14 @@ use Friendica\Core\Addon; use Friendica\Core\L10n; +use Friendica\Core\Logger; use Friendica\Core\PConfig; use Friendica\Database\DBA; function widgets_install() { Addon::registerHook('addon_settings', 'addon/widgets/widgets.php', 'widgets_settings'); Addon::registerHook('addon_settings_post', 'addon/widgets/widgets.php', 'widgets_settings_post'); - logger("installed widgets"); + Logger::log("installed widgets"); } function widgets_uninstall() { diff --git a/windowsphonepush/windowsphonepush.php b/windowsphonepush/windowsphonepush.php index 38ab60b3..b6e455fb 100644 --- a/windowsphonepush/windowsphonepush.php +++ b/windowsphonepush/windowsphonepush.php @@ -32,6 +32,7 @@ use Friendica\Content\Text\HTML; use Friendica\Core\Addon; use Friendica\Core\Authentication; use Friendica\Core\L10n; +use Friendica\Core\Logger; use Friendica\Core\PConfig; use Friendica\Database\DBA; use Friendica\Model\Item; @@ -53,7 +54,7 @@ function windowsphonepush_install() Addon::registerHook('addon_settings', 'addon/windowsphonepush/windowsphonepush.php', 'windowsphonepush_settings'); Addon::registerHook('addon_settings_post', 'addon/windowsphonepush/windowsphonepush.php', 'windowsphonepush_settings_post'); - logger("installed windowsphonepush"); + Logger::log("installed windowsphonepush"); } function windowsphonepush_uninstall() @@ -65,7 +66,7 @@ function windowsphonepush_uninstall() Addon::unregisterHook('addon_settings', 'addon/windowsphonepush/windowsphonepush.php', 'windowsphonepush_settings'); Addon::unregisterHook('addon_settings_post', 'addon/windowsphonepush/windowsphonepush.php', 'windowsphonepush_settings_post'); - logger("removed windowsphonepush"); + Logger::log("removed windowsphonepush"); } /* declare the windowsphonepush function so that /windowsphonepush url requests will land here */ @@ -160,7 +161,7 @@ function windowsphonepush_cron() // by app if user has switched the server setting in app - sending blank not possible as this would return an update error) if (( $device_url == "" ) || ( $device_url == "NA" )) { // no Device-URL for the user availabe, but addon is enabled --> write info to Logger - logger("WARN: windowsphonepush is enable for user " . $rr['uid'] . ", but no Device-URL is specified for the user."); + Logger::log("WARN: windowsphonepush is enable for user " . $rr['uid'] . ", but no Device-URL is specified for the user."); } else { // retrieve the number of unseen items and the id of the latest one (if there are more than // one new entries since last poller run, only the latest one will be pushed) @@ -177,11 +178,11 @@ function windowsphonepush_cron() break; case "QueueFull": // maximum of 30 messages reached, server rejects any further push notification until device reconnects - logger("INFO: Device-URL '" . $device_url . "' returns a QueueFull."); + Logger::log("INFO: Device-URL '" . $device_url . "' returns a QueueFull."); break; case "Suppressed": // notification received and dropped as something in app was not enabled - logger("WARN. Device-URL '" . $device_url . "' returns a Suppressed. Unexpected error in Mobile App?"); + Logger::log("WARN. Device-URL '" . $device_url . "' returns a Suppressed. Unexpected error in Mobile App?"); break; case "Dropped": // mostly combines with Expired, in that case Device-URL will be deleted from pconfig (function send_push) @@ -189,7 +190,7 @@ function windowsphonepush_cron() default: // error, mostly called by "" which means that the url (not "" which has been checked) // didn't not received Microsoft Notification Server -> wrong url - logger("ERROR: specified Device-URL '" . $device_url . "' didn't produced any response."); + Logger::log("ERROR: specified Device-URL '" . $device_url . "' didn't produced any response."); } // additionally user receives the text of the newest item (function checks against last successfully pushed item) @@ -306,7 +307,7 @@ function send_push($device_url, $headers, $msg) $subscriptionStatus = get_header_value($output, 'X-SubscriptionStatus'); if ($subscriptionStatus == "Expired") { PConfig::set(local_user(), 'windowsphonepush', 'device_url', ""); - logger("ERROR: the stored Device-URL " . $device_url . "returned an 'Expired' error, it has been deleted now."); + Logger::log("ERROR: the stored Device-URL " . $device_url . "returned an 'Expired' error, it has been deleted now."); } // the notification status shall be returned to windowsphonepush_cron (will @@ -407,7 +408,7 @@ function windowsphonepush_updatesettings() // check if sent url is empty - don't save and send return code to app $device_url = $_POST['deviceurl']; if ($device_url == "") { - logger("ERROR: no valid Device-URL specified - client transferred '" . $device_url . "'"); + Logger::log("ERROR: no valid Device-URL specified - client transferred '" . $device_url . "'"); return "No valid Device-URL specified"; } @@ -422,13 +423,13 @@ function windowsphonepush_updatesettings() if (count($r)) { foreach ($r as $rr) { PConfig::set($rr['uid'], 'windowsphonepush', 'device_url', ''); - logger("WARN: the sent URL was already registered with user '" . $rr['uid'] . "'. Deleted for this user as we expect to be correct now for user '" . local_user() . "'."); + Logger::log("WARN: the sent URL was already registered with user '" . $rr['uid'] . "'. Deleted for this user as we expect to be correct now for user '" . local_user() . "'."); } } PConfig::set(local_user(), 'windowsphonepush', 'device_url', $device_url); // output the successfull update of the device URL to the logger for error analysis if necessary - logger("INFO: Device-URL for user '" . local_user() . "' has been updated with '" . $device_url . "'"); + Logger::log("INFO: Device-URL for user '" . local_user() . "' has been updated with '" . $device_url . "'"); return "Device-URL updated successfully!"; } @@ -455,7 +456,7 @@ function windowsphonepush_updatecounterunseen() function windowsphonepush_login(App $a) { if (!isset($_SERVER['PHP_AUTH_USER'])) { - logger('API_login: ' . print_r($_SERVER, true), LOGGER_DEBUG); + Logger::log('API_login: ' . print_r($_SERVER, true), LOGGER_DEBUG); header('WWW-Authenticate: Basic realm="Friendica"'); header('HTTP/1.0 401 Unauthorized'); die('This api requires login'); @@ -466,7 +467,7 @@ function windowsphonepush_login(App $a) if ($user_id) { $record = DBA::selectFirst('user', [], ['uid' => $user_id]); } else { - logger('API_login failure: ' . print_r($_SERVER, true), LOGGER_DEBUG); + Logger::log('API_login failure: ' . print_r($_SERVER, true), LOGGER_DEBUG); header('WWW-Authenticate: Basic realm="Friendica"'); header('HTTP/1.0 401 Unauthorized'); die('This api requires login'); diff --git a/wppost/wppost.php b/wppost/wppost.php index 76d928a2..dbad6f97 100644 --- a/wppost/wppost.php +++ b/wppost/wppost.php @@ -10,6 +10,7 @@ use Friendica\Content\Text\BBCode; use Friendica\Content\Text\HTML; use Friendica\Core\Addon; use Friendica\Core\L10n; +use Friendica\Core\Logger; use Friendica\Core\PConfig; use Friendica\Database\DBA; use Friendica\Util\Network; @@ -312,11 +313,11 @@ function wppost_send(&$a,&$b) { EOT; - logger('wppost: data: ' . $xml, LOGGER_DATA); + Logger::log('wppost: data: ' . $xml, LOGGER_DATA); if ($wp_blog !== 'test') { $x = Network::post($wp_blog, $xml)->getBody(); } - logger('posted to wordpress: ' . (($x) ? $x : ''), LOGGER_DEBUG); + Logger::log('posted to wordpress: ' . (($x) ? $x : ''), LOGGER_DEBUG); } } From c9a8974165c34bb70874d80a2639b46baf533ffc Mon Sep 17 00:00:00 2001 From: Adam Magness Date: Tue, 30 Oct 2018 09:48:09 -0400 Subject: [PATCH 02/14] Logger Levels update logger levels --- blogger/blogger.php | 4 +- buffer/buffer.php | 8 +-- diaspora/diaspora.php | 26 +++++----- dwpost/dwpost.php | 4 +- geocoordinates/geocoordinates.php | 8 +-- geonames/geonames.php | 2 +- ifttt/ifttt.php | 8 +-- ijpost/ijpost.php | 4 +- js_upload/js_upload.php | 2 +- ljpost/ljpost.php | 4 +- mailstream/mailstream.php | 24 ++++----- openstreetmap/openstreetmap.php | 6 +-- pumpio/pumpio.php | 14 ++--- statusnet/statusnet.php | 50 +++++++++--------- twitter/twitter.php | 74 +++++++++++++-------------- windowsphonepush/windowsphonepush.php | 4 +- wppost/wppost.php | 4 +- 17 files changed, 123 insertions(+), 123 deletions(-) diff --git a/blogger/blogger.php b/blogger/blogger.php index 4de65d55..bf4c7eac 100644 --- a/blogger/blogger.php +++ b/blogger/blogger.php @@ -203,12 +203,12 @@ function blogger_send(App $a, array &$b) EOT; - Logger::log('blogger: data: ' . $xml, LOGGER_DATA); + Logger::log('blogger: data: ' . $xml, Logger::DATA); if ($bl_blog !== 'test') { $x = Network::post($bl_blog, $xml)->getBody(); } - Logger::log('posted to blogger: ' . (($x) ? $x : ''), LOGGER_DEBUG); + Logger::log('posted to blogger: ' . (($x) ? $x : ''), Logger::DEBUG); } } diff --git a/buffer/buffer.php b/buffer/buffer.php index b5c17e4a..93e9432e 100644 --- a/buffer/buffer.php +++ b/buffer/buffer.php @@ -299,7 +299,7 @@ function buffer_send(App $a, array &$b) $profiles = $buffer->go('/profiles'); if (is_array($profiles)) { - Logger::log("Will send these parameter ".print_r($b, true), LOGGER_DEBUG); + Logger::log("Will send these parameter ".print_r($b, true), Logger::DEBUG); foreach ($profiles as $profile) { if (!$profile->default) @@ -358,7 +358,7 @@ function buffer_send(App $a, array &$b) } $post = ItemContent::getPlaintextPost($item, $limit, $includedlinks, $htmlmode); - Logger::log("buffer_send: converted message ".$b["id"]." result: ".print_r($post, true), LOGGER_DEBUG); + Logger::log("buffer_send: converted message ".$b["id"]." result: ".print_r($post, true), Logger::DEBUG); // The image proxy is used as a sanitizer. Buffer seems to be really picky about pictures if (isset($post["image"])) { @@ -408,9 +408,9 @@ function buffer_send(App $a, array &$b) } //print_r($message); - Logger::log("buffer_send: data for message " . $b["id"] . ": " . print_r($message, true), LOGGER_DEBUG); + Logger::log("buffer_send: data for message " . $b["id"] . ": " . print_r($message, true), Logger::DEBUG); $ret = $buffer->go('/updates/create', $message); - Logger::log("buffer_send: send message " . $b["id"] . " result: " . print_r($ret, true), LOGGER_DEBUG); + Logger::log("buffer_send: send message " . $b["id"] . " result: " . print_r($ret, true), Logger::DEBUG); } } } diff --git a/diaspora/diaspora.php b/diaspora/diaspora.php index 508655fd..03793310 100644 --- a/diaspora/diaspora.php +++ b/diaspora/diaspora.php @@ -99,27 +99,27 @@ function diaspora_queue_hook(App $a, &$b) { $post = $z['post']; - Logger::log('diaspora_queue: post: '.$post, LOGGER_DATA); + Logger::log('diaspora_queue: post: '.$post, Logger::DATA); try { - Logger::log('diaspora_queue: prepare', LOGGER_DEBUG); + Logger::log('diaspora_queue: prepare', Logger::DEBUG); $conn = new Diaspora_Connection($handle, $password); - Logger::log('diaspora_queue: try to log in '.$handle, LOGGER_DEBUG); + Logger::log('diaspora_queue: try to log in '.$handle, Logger::DEBUG); $conn->logIn(); - Logger::log('diaspora_queue: try to send '.$body, LOGGER_DEBUG); + Logger::log('diaspora_queue: try to send '.$body, Logger::DEBUG); $conn->provider = $hostname; $conn->postStatusMessage($post, $aspect); - Logger::log('diaspora_queue: send '.$userdata['uid'].' success', LOGGER_DEBUG); + Logger::log('diaspora_queue: send '.$userdata['uid'].' success', Logger::DEBUG); $success = true; Queue::removeItem($x['id']); } catch (Exception $e) { - Logger::log("diaspora_queue: Send ".$userdata['uid']." failed: ".$e->getMessage(), LOGGER_DEBUG); + Logger::log("diaspora_queue: Send ".$userdata['uid']." failed: ".$e->getMessage(), Logger::DEBUG); } } else { - Logger::log('diaspora_queue: send '.$userdata['uid'].' missing username or password', LOGGER_DEBUG); + Logger::log('diaspora_queue: send '.$userdata['uid'].' missing username or password', Logger::DEBUG); } if (!$success) { @@ -312,14 +312,14 @@ function diaspora_send(App $a, array &$b) return; } - Logger::log('diaspora_send: prepare posting', LOGGER_DEBUG); + Logger::log('diaspora_send: prepare posting', Logger::DEBUG); $handle = PConfig::get($b['uid'],'diaspora','handle'); $password = PConfig::get($b['uid'],'diaspora','password'); $aspect = PConfig::get($b['uid'],'diaspora','aspect'); if ($handle && $password) { - Logger::log('diaspora_send: all values seem to be okay', LOGGER_DEBUG); + Logger::log('diaspora_send: all values seem to be okay', Logger::DEBUG); $tag_arr = []; $tags = ''; @@ -364,11 +364,11 @@ function diaspora_send(App $a, array &$b) require_once "addon/diaspora/diasphp.php"; try { - Logger::log('diaspora_send: prepare', LOGGER_DEBUG); + Logger::log('diaspora_send: prepare', Logger::DEBUG); $conn = new Diaspora_Connection($handle, $password); - Logger::log('diaspora_send: try to log in '.$handle, LOGGER_DEBUG); + Logger::log('diaspora_send: try to log in '.$handle, Logger::DEBUG); $conn->logIn(); - Logger::log('diaspora_send: try to send '.$body, LOGGER_DEBUG); + Logger::log('diaspora_send: try to send '.$body, Logger::DEBUG); $conn->provider = $hostname; $conn->postStatusMessage($body, $aspect); @@ -377,7 +377,7 @@ function diaspora_send(App $a, array &$b) } catch (Exception $e) { Logger::log("diaspora_send: Error submitting the post: " . $e->getMessage()); - Logger::log('diaspora_send: requeueing '.$b['uid'], LOGGER_DEBUG); + Logger::log('diaspora_send: requeueing '.$b['uid'], Logger::DEBUG); $r = q("SELECT `id` FROM `contact` WHERE `uid` = %d AND `self`", $b['uid']); if (count($r)) diff --git a/dwpost/dwpost.php b/dwpost/dwpost.php index 462aaf45..a75fb878 100644 --- a/dwpost/dwpost.php +++ b/dwpost/dwpost.php @@ -226,13 +226,13 @@ function dwpost_send(App $a, array &$b) EOT; - Logger::log('dwpost: data: ' . $xml, LOGGER_DATA); + Logger::log('dwpost: data: ' . $xml, Logger::DATA); if ($dw_blog !== 'test') { $x = Network::post($dw_blog, $xml, ["Content-Type: text/xml"])->getBody(); } - Logger::log('posted to dreamwidth: ' . ($x) ? $x : '', LOGGER_DEBUG); + Logger::log('posted to dreamwidth: ' . ($x) ? $x : '', Logger::DEBUG); } } diff --git a/geocoordinates/geocoordinates.php b/geocoordinates/geocoordinates.php index 7058e3ec..6a3f535c 100644 --- a/geocoordinates/geocoordinates.php +++ b/geocoordinates/geocoordinates.php @@ -55,25 +55,25 @@ function geocoordinates_resolve_item(&$item) $s = Network::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); + Logger::log("API could not be queried", Logger::DEBUG); return; } $data = json_decode($s); if ($data->status->code != "200") { - Logger::log("API returned error ".$data->status->code." ".$data->status->message, LOGGER_DEBUG); + Logger::log("API returned error ".$data->status->code." ".$data->status->message, Logger::DEBUG); return; } if (($data->total_results == 0) || (count($data->results) == 0)) { - Logger::log("No results found for coordinates ".$item["coord"], LOGGER_DEBUG); + Logger::log("No results found for coordinates ".$item["coord"], Logger::DEBUG); return; } $item["location"] = $data->results[0]->formatted; - Logger::log("Got location for coordinates ".$coords[0]."-".$coords[1].": ".$item["location"], LOGGER_DEBUG); + Logger::log("Got location for coordinates ".$coords[0]."-".$coords[1].": ".$item["location"], Logger::DEBUG); if ($item["location"] != "") Cache::set("geocoordinates:".$language.":".$coords[0]."-".$coords[1], $item["location"]); diff --git a/geonames/geonames.php b/geonames/geonames.php index 9486d4e6..709e015b 100644 --- a/geonames/geonames.php +++ b/geonames/geonames.php @@ -133,7 +133,7 @@ function geonames_post_hook($a, &$item) { $item['location'] = $xml->geoname->name . ', ' . $xml->geoname->countryName; -// Logger::log('geonames : ' . print_r($xml,true), LOGGER_DATA); +// Logger::log('geonames : ' . print_r($xml,true), Logger::DATA); return; } diff --git a/ifttt/ifttt.php b/ifttt/ifttt.php index 8ba7428c..a5838c04 100644 --- a/ifttt/ifttt.php +++ b/ifttt/ifttt.php @@ -104,13 +104,13 @@ function ifttt_post(App $a) $user = DBA::selectFirst('user', ['uid'], ['nickname' => $nickname]); if (!DBA::isResult($user)) { - Logger::log('User ' . $nickname . ' not found.', LOGGER_DEBUG); + Logger::log('User ' . $nickname . ' not found.', Logger::DEBUG); return; } $uid = $user['uid']; - Logger::log('Received a post for user ' . $uid . ' from ifttt ' . print_r($_REQUEST, true), LOGGER_DEBUG); + Logger::log('Received a post for user ' . $uid . ' from ifttt ' . print_r($_REQUEST, true), Logger::DEBUG); if (!isset($_REQUEST['key'])) { Logger::log('No key found.'); @@ -121,7 +121,7 @@ function ifttt_post(App $a) // Check the key if ($key != PConfig::get($uid, 'ifttt', 'key')) { - Logger::log('Invalid key for user ' . $uid, LOGGER_DEBUG); + Logger::log('Invalid key for user ' . $uid, Logger::DEBUG); return; } @@ -132,7 +132,7 @@ function ifttt_post(App $a) } if (!in_array($item['type'], ['status', 'link', 'photo'])) { - Logger::log('Unknown item type ' . $item['type'], LOGGER_DEBUG); + Logger::log('Unknown item type ' . $item['type'], Logger::DEBUG); return; } diff --git a/ijpost/ijpost.php b/ijpost/ijpost.php index 13ede61f..a5f98f45 100644 --- a/ijpost/ijpost.php +++ b/ijpost/ijpost.php @@ -222,12 +222,12 @@ function ijpost_send(&$a, &$b) EOT; - Logger::log('ijpost: data: ' . $xml, LOGGER_DATA); + Logger::log('ijpost: data: ' . $xml, Logger::DATA); if ($ij_blog !== 'test') { $x = Network::post($ij_blog, $xml, ["Content-Type: text/xml"])->getBody(); } - Logger::log('posted to insanejournal: ' . $x ? $x : '', LOGGER_DEBUG); + Logger::log('posted to insanejournal: ' . $x ? $x : '', Logger::DEBUG); } } diff --git a/js_upload/js_upload.php b/js_upload/js_upload.php index 9762e899..d4f0ec1e 100644 --- a/js_upload/js_upload.php +++ b/js_upload/js_upload.php @@ -160,7 +160,7 @@ function js_upload_post_init(&$a,&$b) { $a->data['upload_jsonresponse'] = htmlspecialchars(json_encode($result), ENT_NOQUOTES); if(isset($result['error'])) { - Logger::log('mod/photos.php: photos_post(): error uploading photo: ' . $result['error'] , 'LOGGER_DEBUG'); + Logger::log('mod/photos.php: photos_post(): error uploading photo: ' . $result['error'] , Logger::DEBUG); echo json_encode($result); killme(); } diff --git a/ljpost/ljpost.php b/ljpost/ljpost.php index 2473e74f..c7857000 100644 --- a/ljpost/ljpost.php +++ b/ljpost/ljpost.php @@ -232,12 +232,12 @@ function ljpost_send(&$a,&$b) { EOT; - Logger::log('ljpost: data: ' . $xml, LOGGER_DATA); + Logger::log('ljpost: data: ' . $xml, Logger::DATA); if ($lj_blog !== 'test') { $x = Network::post($lj_blog, $xml, ["Content-Type: text/xml"])->getBody(); } - Logger::log('posted to livejournal: ' . ($x) ? $x : '', LOGGER_DEBUG); + Logger::log('posted to livejournal: ' . ($x) ? $x : '', Logger::DEBUG); } } diff --git a/mailstream/mailstream.php b/mailstream/mailstream.php index bac15342..c7842b78 100644 --- a/mailstream/mailstream.php +++ b/mailstream/mailstream.php @@ -95,7 +95,7 @@ function mailstream_generate_id($a, $uri) { $host = $a->getHostName(); $resource = hash('md5', $uri); $message_id = "<" . $resource . "@" . $host . ">"; - Logger::log('mailstream: Generated message ID ' . $message_id . ' for URI ' . $uri, LOGGER_DEBUG); + Logger::log('mailstream: Generated message ID ' . $message_id . ' for URI ' . $uri, Logger::DEBUG); return $message_id; } @@ -124,16 +124,16 @@ function mailstream_post_hook(&$a, &$item) { intval($item['contact-id']), DBA::escape($item['uri']), DBA::escape($message_id)); $r = q('SELECT * FROM `mailstream_item` WHERE `uid` = %d AND `contact-id` = %d AND `uri` = "%s"', intval($item['uid']), intval($item['contact-id']), DBA::escape($item['uri'])); if (count($r) != 1) { - Logger::log('mailstream_post_remote_hook: Unexpected number of items returned from mailstream_item', LOGGER_INFO); + Logger::log('mailstream_post_remote_hook: Unexpected number of items returned from mailstream_item', Logger::INFO); return; } $ms_item = $r[0]; Logger::log('mailstream_post_remote_hook: created mailstream_item ' . $ms_item['id'] . ' for item ' . $item['uri'] . ' ' - . $item['uid'] . ' ' . $item['contact-id'], LOGGER_DATA); + . $item['uid'] . ' ' . $item['contact-id'], Logger::DATA); $user = mailstream_get_user($item['uid']); if (!$user) { - Logger::log('mailstream_post_remote_hook: no user ' . $item['uid'], LOGGER_INFO); + Logger::log('mailstream_post_remote_hook: no user ' . $item['uid'], Logger::INFO); return; } mailstream_send($a, $ms_item['message-id'], $item, $user); @@ -142,7 +142,7 @@ function mailstream_post_hook(&$a, &$item) { function mailstream_get_user($uid) { $r = q('SELECT * FROM `user` WHERE `uid` = %d', intval($uid)); if (count($r) != 1) { - Logger::log('mailstream_post_remote_hook: Unexpected number of users returned', LOGGER_INFO); + Logger::log('mailstream_post_remote_hook: Unexpected number of users returned', Logger::INFO); return; } return $r[0]; @@ -299,11 +299,11 @@ function mailstream_send($a, $message_id, $item, $user) { if (!$mail->Send()) { throw new Exception($mail->ErrorInfo); } - Logger::log('mailstream_send sent message ' . $mail->MessageID . ' ' . $mail->Subject, LOGGER_DEBUG); + Logger::log('mailstream_send sent message ' . $mail->MessageID . ' ' . $mail->Subject, Logger::DEBUG); } catch (phpmailerException $e) { - Logger::log('mailstream_send PHPMailer exception sending message ' . $message_id . ': ' . $e->errorMessage(), LOGGER_INFO); + Logger::log('mailstream_send PHPMailer exception sending message ' . $message_id . ': ' . $e->errorMessage(), Logger::INFO); } catch (Exception $e) { - Logger::log('mailstream_send exception sending message ' . $message_id . ': ' . $e->getMessage(), LOGGER_INFO); + Logger::log('mailstream_send exception sending message ' . $message_id . ': ' . $e->getMessage(), Logger::INFO); } // In case of failure, still set the item to completed. Otherwise // we'll just try to send it over and over again and it'll fail @@ -332,10 +332,10 @@ function mailstream_cron($a, $b) { // mailstream_post_remote_hook fails for some reason will this get // used, and in that case it's worth holding off a bit anyway. $ms_item_ids = q("SELECT `mailstream_item`.`message-id`, `mailstream_item`.`uri`, `item`.`id` FROM `mailstream_item` JOIN `item` ON (`mailstream_item`.`uid` = `item`.`uid` AND `mailstream_item`.`uri` = `item`.`uri` AND `mailstream_item`.`contact-id` = `item`.`contact-id`) WHERE `mailstream_item`.`completed` IS NULL AND `mailstream_item`.`created` < DATE_SUB(NOW(), INTERVAL 1 HOUR) AND `item`.`visible` = 1 ORDER BY `mailstream_item`.`created` LIMIT 100"); - Logger::log('mailstream_cron processing ' . count($ms_item_ids) . ' items', LOGGER_DEBUG); + Logger::log('mailstream_cron processing ' . count($ms_item_ids) . ' items', Logger::DEBUG); foreach ($ms_item_ids as $ms_item_id) { if (!$ms_item_id['message-id'] || !strlen($ms_item_id['message-id'])) { - Logger::log('mailstream_cron: Item ' . $ms_item_id['id'] . ' URI ' . $ms_item_id['uri'] . ' has no message-id', LOGGER_INFO); + Logger::log('mailstream_cron: Item ' . $ms_item_id['id'] . ' URI ' . $ms_item_id['uri'] . ' has no message-id', Logger::INFO); } $item = Item::selectFirst([], ['id' => $ms_item_id['id']]); $users = q("SELECT * FROM `user` WHERE `uid` = %d", intval($item['uid'])); @@ -344,7 +344,7 @@ function mailstream_cron($a, $b) { mailstream_send($a, $ms_item_id['message-id'], $item, $user); } else { - Logger::log('mailstream_cron: Unable to find item ' . $ms_item_id['id'], LOGGER_INFO); + Logger::log('mailstream_cron: Unable to find item ' . $ms_item_id['id'], Logger::INFO); q("UPDATE `mailstream_item` SET `completed` = now() WHERE `message-id` = %d", intval($ms_item['message-id'])); } } @@ -413,5 +413,5 @@ function mailstream_tidy() { foreach ($r as $rr) { q('DELETE FROM mailstream_item WHERE id = %d', intval($rr['id'])); } - Logger::log('mailstream_tidy: deleted ' . count($r) . ' old items', LOGGER_DEBUG); + Logger::log('mailstream_tidy: deleted ' . count($r) . ' old items', Logger::DEBUG); } diff --git a/openstreetmap/openstreetmap.php b/openstreetmap/openstreetmap.php index bdecb5ca..61838b38 100644 --- a/openstreetmap/openstreetmap.php +++ b/openstreetmap/openstreetmap.php @@ -166,8 +166,8 @@ function openstreetmap_generate_map(&$a, &$b) $lat = $b['lat']; // round($b['lat'], 5); $lon = $b['lon']; // round($b['lon'], 5); - Logger::log('lat: ' . $lat, LOGGER_DATA); - Logger::log('lon: ' . $lon, LOGGER_DATA); + Logger::log('lat: ' . $lat, Logger::DATA); + Logger::log('lon: ' . $lon, Logger::DATA); $cardlink = 'getBaseURL()."/images/friendica-256.png"; $params["redirect_uris"] = $a->getBaseURL()."/pumpio/connect"; - Logger::log("pumpio_registerclient: ".$url." parameters ".print_r($params, true), LOGGER_DEBUG); + Logger::log("pumpio_registerclient: ".$url." parameters ".print_r($params, true), Logger::DEBUG); $ch = curl_init($url); curl_setopt($ch, CURLOPT_HEADER, false); @@ -129,10 +129,10 @@ function pumpio_registerclient(App $a, $host) if ($curl_info["http_code"] == "200") { $values = json_decode($s); - Logger::log("pumpio_registerclient: success ".print_r($values, true), LOGGER_DEBUG); + Logger::log("pumpio_registerclient: success ".print_r($values, true), Logger::DEBUG); return $values; } - Logger::log("pumpio_registerclient: failed: ".print_r($curl_info, true), LOGGER_DEBUG); + Logger::log("pumpio_registerclient: failed: ".print_r($curl_info, true), Logger::DEBUG); return false; } @@ -153,7 +153,7 @@ function pumpio_connect(App $a) $consumer_key = PConfig::get(local_user(), 'pumpio', 'consumer_key'); $consumer_secret = PConfig::get(local_user(), 'pumpio', 'consumer_secret'); - Logger::log("pumpio_connect: ckey: ".$consumer_key." csecrect: ".$consumer_secret, LOGGER_DEBUG); + Logger::log("pumpio_connect: ckey: ".$consumer_key." csecrect: ".$consumer_secret, Logger::DEBUG); } if (($consumer_key == "") || ($consumer_secret == "")) { @@ -187,7 +187,7 @@ function pumpio_connect(App $a) if (($success = $client->Initialize())) { if (($success = $client->Process())) { if (strlen($client->access_token)) { - Logger::log("pumpio_connect: otoken: ".$client->access_token." osecrect: ".$client->access_token_secret, LOGGER_DEBUG); + Logger::log("pumpio_connect: otoken: ".$client->access_token." osecrect: ".$client->access_token_secret, Logger::DEBUG); PConfig::set(local_user(), "pumpio", "oauth_token", $client->access_token); PConfig::set(local_user(), "pumpio", "oauth_token_secret", $client->access_token_secret); } @@ -410,7 +410,7 @@ function pumpio_send(App $a, array &$b) return; } - Logger::log("pumpio_send: parameter ".print_r($b, true), LOGGER_DATA); + Logger::log("pumpio_send: parameter ".print_r($b, true), Logger::DATA); if ($b['parent'] != $b['id']) { // Looking if its a reply to a pumpio post @@ -908,7 +908,7 @@ function pumpio_dolike(App $a, $uid, $self, $post, $own_id, $threadcompletion = require_once('include/items.php'); if (empty($post->object->id)) { - Logger::log('Got empty like: '.print_r($post, true), LOGGER_DEBUG); + Logger::log('Got empty like: '.print_r($post, true), Logger::DEBUG); return; } diff --git a/statusnet/statusnet.php b/statusnet/statusnet.php index 81cf7f35..0d64ccee 100644 --- a/statusnet/statusnet.php +++ b/statusnet/statusnet.php @@ -430,7 +430,7 @@ function statusnet_action(App $a, $uid, $pid, $action) $connection = new StatusNetOAuth($api, $ckey, $csecret, $otoken, $osecret); - Logger::log("statusnet_action '" . $action . "' ID: " . $pid, LOGGER_DATA); + Logger::log("statusnet_action '" . $action . "' ID: " . $pid, Logger::DATA); switch ($action) { case "delete": @@ -443,7 +443,7 @@ function statusnet_action(App $a, $uid, $pid, $action) $result = $connection->post("favorites/destroy/" . $pid); break; } - Logger::log("statusnet_action '" . $action . "' send, result: " . print_r($result, true), LOGGER_DEBUG); + Logger::log("statusnet_action '" . $action . "' send, result: " . print_r($result, true), Logger::DEBUG); } function statusnet_post_hook(App $a, &$b) @@ -460,7 +460,7 @@ function statusnet_post_hook(App $a, &$b) $hostname = preg_replace("=https?://([\w\.]*)/.*=ism", "$1", $api); if ($b['parent'] != $b['id']) { - Logger::log("statusnet_post_hook: parameter " . print_r($b, true), LOGGER_DATA); + Logger::log("statusnet_post_hook: parameter " . print_r($b, true), Logger::DATA); // Looking if its a reply to a GNU Social post $hostlength = strlen($hostname) + 2; @@ -483,12 +483,12 @@ function statusnet_post_hook(App $a, &$b) $nickname = "@[url=" . $orig_post["author-link"] . "]" . $nick . "[/url]"; $nicknameplain = "@" . $nick; - Logger::log("statusnet_post_hook: comparing " . $nickname . " and " . $nicknameplain . " with " . $b["body"], LOGGER_DEBUG); + Logger::log("statusnet_post_hook: comparing " . $nickname . " and " . $nicknameplain . " with " . $b["body"], Logger::DEBUG); if ((strpos($b["body"], $nickname) === false) && (strpos($b["body"], $nicknameplain) === false)) { $b["body"] = $nickname . " " . $b["body"]; } - Logger::log("statusnet_post_hook: parent found " . print_r($orig_post, true), LOGGER_DEBUG); + Logger::log("statusnet_post_hook: parent found " . print_r($orig_post, true), Logger::DEBUG); } else { $iscomment = false; @@ -509,7 +509,7 @@ function statusnet_post_hook(App $a, &$b) } if ($b['verb'] == ACTIVITY_LIKE) { - Logger::log("statusnet_post_hook: parameter 2 " . substr($b["thr-parent"], $hostlength), LOGGER_DEBUG); + Logger::log("statusnet_post_hook: parameter 2 " . substr($b["thr-parent"], $hostlength), Logger::DEBUG); if ($b['deleted']) statusnet_action($a, $b["uid"], substr($b["thr-parent"], $hostlength), "unlike"); else @@ -579,7 +579,7 @@ function statusnet_post_hook(App $a, &$b) if (strlen($msg)) { if ($iscomment) { $postdata["in_reply_to_status_id"] = substr($orig_post["uri"], $hostlength); - Logger::log('statusnet_post send reply ' . print_r($postdata, true), LOGGER_DEBUG); + Logger::log('statusnet_post send reply ' . print_r($postdata, true), Logger::DEBUG); } // New code that is able to post pictures @@ -591,7 +591,7 @@ function statusnet_post_hook(App $a, &$b) $result = $cb->statuses_update($postdata); //$result = $dent->post('statuses/update', $postdata); Logger::log('statusnet_post send, result: ' . print_r($result, true) . - "\nmessage: " . $msg . "\nOriginal post: " . print_r($b, true) . "\nPost Data: " . print_r($postdata, true), LOGGER_DEBUG); + "\nmessage: " . $msg . "\nOriginal post: " . print_r($b, true) . "\nPost Data: " . print_r($postdata, true), Logger::DEBUG); if (!empty($result->source)) { PConfig::set($b["uid"], "statusnet", "application_name", strip_tags($result->source)); @@ -913,7 +913,7 @@ function statusnet_fetch_contact($uid, $contact, $create_user) } if (DBA::isResult($r) && ($r[0]["readonly"] || $r[0]["blocked"])) { - Logger::log("statusnet_fetch_contact: Contact '" . $r[0]["nick"] . "' is blocked or readonly.", LOGGER_DEBUG); + Logger::log("statusnet_fetch_contact: Contact '" . $r[0]["nick"] . "' is blocked or readonly.", Logger::DEBUG); return -1; } @@ -975,7 +975,7 @@ function statusnet_fetch_contact($uid, $contact, $create_user) // check that we have all the photos, this has been known to fail on occasion if ((!$r[0]['photo']) || (!$r[0]['thumb']) || (!$r[0]['micro']) || ($update_photo)) { - Logger::log("statusnet_fetch_contact: Updating contact " . $contact->screen_name, LOGGER_DEBUG); + Logger::log("statusnet_fetch_contact: Updating contact " . $contact->screen_name, Logger::DEBUG); $photos = Photo::importProfilePhoto($contact->profile_image_url, $uid, $r[0]['id']); @@ -1061,7 +1061,7 @@ function statusnet_fetchuser(App $a, $uid, $screen_name = "", $user_id = "") function statusnet_createpost(App $a, $uid, $post, $self, $create_user, $only_existing_contact) { - Logger::log("statusnet_createpost: start", LOGGER_DEBUG); + Logger::log("statusnet_createpost: start", Logger::DEBUG); $api = PConfig::get($uid, 'statusnet', 'baseapi'); $hostname = preg_replace("=https?://([\w\.]*)/.*=ism", "$1", $api); @@ -1188,7 +1188,7 @@ function statusnet_createpost(App $a, $uid, $post, $self, $create_user, $only_ex $postarray["coord"] = $content->coordinates->coordinates[1] . " " . $content->coordinates->coordinates[0]; } - Logger::log("statusnet_createpost: end", LOGGER_DEBUG); + Logger::log("statusnet_createpost: end", Logger::DEBUG); return $postarray; } @@ -1207,7 +1207,7 @@ function statusnet_fetchhometimeline(App $a, $uid, $mode = 1) // "create_user" is deactivated, since currently you cannot add users manually by now $create_user = true; - Logger::log("statusnet_fetchhometimeline: Fetching for user " . $uid, LOGGER_DEBUG); + Logger::log("statusnet_fetchhometimeline: Fetching for user " . $uid, Logger::DEBUG); require_once 'include/items.php'; @@ -1222,7 +1222,7 @@ function statusnet_fetchhometimeline(App $a, $uid, $mode = 1) if (DBA::isResult($r)) { $nick = $r[0]["nick"]; } else { - Logger::log("statusnet_fetchhometimeline: Own GNU Social contact not found for user " . $uid, LOGGER_DEBUG); + Logger::log("statusnet_fetchhometimeline: Own GNU Social contact not found for user " . $uid, Logger::DEBUG); return; } @@ -1232,14 +1232,14 @@ function statusnet_fetchhometimeline(App $a, $uid, $mode = 1) if (DBA::isResult($r)) { $self = $r[0]; } else { - Logger::log("statusnet_fetchhometimeline: Own contact not found for user " . $uid, LOGGER_DEBUG); + Logger::log("statusnet_fetchhometimeline: Own contact not found for user " . $uid, Logger::DEBUG); return; } $u = q("SELECT * FROM user WHERE uid = %d LIMIT 1", intval($uid)); if (!DBA::isResult($u)) { - Logger::log("statusnet_fetchhometimeline: Own user not found for user " . $uid, LOGGER_DEBUG); + Logger::log("statusnet_fetchhometimeline: Own user not found for user " . $uid, Logger::DEBUG); return; } @@ -1270,13 +1270,13 @@ function statusnet_fetchhometimeline(App $a, $uid, $mode = 1) $errormsg = "Unknown error"; } - Logger::log("statusnet_fetchhometimeline: Error fetching home timeline: " . $errormsg, LOGGER_DEBUG); + Logger::log("statusnet_fetchhometimeline: Error fetching home timeline: " . $errormsg, Logger::DEBUG); return; } $posts = array_reverse($items); - Logger::log("statusnet_fetchhometimeline: Fetching timeline for user " . $uid . " " . sizeof($posts) . " items", LOGGER_DEBUG); + Logger::log("statusnet_fetchhometimeline: Fetching timeline for user " . $uid . " " . sizeof($posts) . " items", Logger::DEBUG); if (count($posts)) { foreach ($posts as $post) { @@ -1322,13 +1322,13 @@ function statusnet_fetchhometimeline(App $a, $uid, $mode = 1) $items = $connection->get('statuses/mentions_timeline', $parameters); if (!is_array($items)) { - Logger::log("statusnet_fetchhometimeline: Error fetching mentions: " . print_r($items, true), LOGGER_DEBUG); + Logger::log("statusnet_fetchhometimeline: Error fetching mentions: " . print_r($items, true), Logger::DEBUG); return; } $posts = array_reverse($items); - Logger::log("statusnet_fetchhometimeline: Fetching mentions for user " . $uid . " " . sizeof($posts) . " items", LOGGER_DEBUG); + Logger::log("statusnet_fetchhometimeline: Fetching mentions for user " . $uid . " " . sizeof($posts) . " items", Logger::DEBUG); if (count($posts)) { foreach ($posts as $post) { @@ -1412,15 +1412,15 @@ function statusnet_convertmsg(App $a, $body, $no_tags = false) foreach ($matches AS $match) { $search = "[url=" . $match[1] . "]" . $match[2] . "[/url]"; - Logger::log("statusnet_convertmsg: expanding url " . $match[1], LOGGER_DEBUG); + Logger::log("statusnet_convertmsg: expanding url " . $match[1], Logger::DEBUG); $expanded_url = Network::finalUrl($match[1]); - Logger::log("statusnet_convertmsg: fetching data for " . $expanded_url, LOGGER_DEBUG); + Logger::log("statusnet_convertmsg: fetching data for " . $expanded_url, Logger::DEBUG); $oembed_data = OEmbed::fetchURL($expanded_url, true); - Logger::log("statusnet_convertmsg: fetching data: done", LOGGER_DEBUG); + Logger::log("statusnet_convertmsg: fetching data: done", Logger::DEBUG); if ($type == "") { $type = $oembed_data->type; @@ -1582,13 +1582,13 @@ function statusnet_is_retweet(App $a, $uid, $body) return false; } - Logger::log('statusnet_is_retweet: Retweeting id ' . $id . ' for user ' . $uid, LOGGER_DEBUG); + Logger::log('statusnet_is_retweet: Retweeting id ' . $id . ' for user ' . $uid, Logger::DEBUG); $connection = new StatusNetOAuth($api, $ckey, $csecret, $otoken, $osecret); $result = $connection->post('statuses/retweet/' . $id); - Logger::log('statusnet_is_retweet: result ' . print_r($result, true), LOGGER_DEBUG); + Logger::log('statusnet_is_retweet: result ' . print_r($result, true), Logger::DEBUG); return isset($result->id); } diff --git a/twitter/twitter.php b/twitter/twitter.php index 2a04da9f..77a3a265 100644 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -155,7 +155,7 @@ function twitter_check_item_notification(App $a, array &$notification_data) function twitter_follow(App $a, array &$contact) { - Logger::log("twitter_follow: Check if contact is twitter contact. " . $contact["url"], LOGGER_DEBUG); + Logger::log("twitter_follow: Check if contact is twitter contact. " . $contact["url"], Logger::DEBUG); if (!strstr($contact["url"], "://twitter.com") && !strstr($contact["url"], "@twitter.com")) { return; @@ -428,7 +428,7 @@ function twitter_action(App $a, $uid, $pid, $action) $post = ['id' => $pid]; - Logger::log("twitter_action '" . $action . "' ID: " . $pid . " data: " . print_r($post, true), LOGGER_DATA); + Logger::log("twitter_action '" . $action . "' ID: " . $pid . " data: " . print_r($post, true), Logger::DATA); switch ($action) { case "delete": @@ -442,10 +442,10 @@ function twitter_action(App $a, $uid, $pid, $action) $result = $connection->post('favorites/destroy', $post); break; default: - Logger::log('Unhandled action ' . $action, LOGGER_DEBUG); + Logger::log('Unhandled action ' . $action, Logger::DEBUG); $result = []; } - Logger::log("twitter_action '" . $action . "' send, result: " . print_r($result, true), LOGGER_DEBUG); + Logger::log("twitter_action '" . $action . "' send, result: " . print_r($result, true), Logger::DEBUG); } function twitter_post_hook(App $a, array &$b) @@ -457,7 +457,7 @@ function twitter_post_hook(App $a, array &$b) } if ($b['parent'] != $b['id']) { - Logger::log("twitter_post_hook: parameter " . print_r($b, true), LOGGER_DATA); + Logger::log("twitter_post_hook: parameter " . print_r($b, true), Logger::DATA); // Looking if its a reply to a twitter post if ((substr($b["parent-uri"], 0, 9) != "twitter::") @@ -482,12 +482,12 @@ function twitter_post_hook(App $a, array &$b) $nickname = "@[url=" . $orig_post["author-link"] . "]" . $nicknameplain . "[/url]"; $nicknameplain = "@" . $nicknameplain; - Logger::log("twitter_post_hook: comparing " . $nickname . " and " . $nicknameplain . " with " . $b["body"], LOGGER_DEBUG); + Logger::log("twitter_post_hook: comparing " . $nickname . " and " . $nicknameplain . " with " . $b["body"], Logger::DEBUG); if ((strpos($b["body"], $nickname) === false) && (strpos($b["body"], $nicknameplain) === false)) { $b["body"] = $nickname . " " . $b["body"]; } - Logger::log("twitter_post_hook: parent found " . print_r($orig_post, true), LOGGER_DATA); + Logger::log("twitter_post_hook: parent found " . print_r($orig_post, true), Logger::DATA); } else { $iscomment = false; @@ -508,7 +508,7 @@ function twitter_post_hook(App $a, array &$b) } if ($b['verb'] == ACTIVITY_LIKE) { - Logger::log("twitter_post_hook: parameter 2 " . substr($b["thr-parent"], 9), LOGGER_DEBUG); + Logger::log("twitter_post_hook: parameter 2 " . substr($b["thr-parent"], 9), Logger::DEBUG); if ($b['deleted']) { twitter_action($a, $b["uid"], substr($b["thr-parent"], 9), "unlike"); } else { @@ -541,7 +541,7 @@ function twitter_post_hook(App $a, array &$b) $osecret = PConfig::get($b['uid'], 'twitter', 'oauthsecret'); if ($ckey && $csecret && $otoken && $osecret) { - Logger::log('twitter: we have customer key and oauth stuff, going to send.', LOGGER_DEBUG); + Logger::log('twitter: we have customer key and oauth stuff, going to send.', Logger::DEBUG); // If it's a repeated message from twitter then do a native retweet and exit if (twitter_is_retweet($a, $b['uid'], $b['body'])) { @@ -629,7 +629,7 @@ function twitter_post_hook(App $a, array &$b) $url = 'statuses/update'; $result = $connection->post($url, $post); - Logger::log('twitter_post send, result: ' . print_r($result, true), LOGGER_DEBUG); + Logger::log('twitter_post send, result: ' . print_r($result, true), Logger::DEBUG); if (!empty($result->source)) { Config::set("twitter", "application_name", strip_tags($result->source)); @@ -909,13 +909,13 @@ function twitter_fetchtimeline(App $a, $uid) } if (!is_array($items)) { - Logger::log('No items for user ' . $uid, LOGGER_INFO); + Logger::log('No items for user ' . $uid, Logger::INFO); return; } $posts = array_reverse($items); - Logger::log('Starting from ID ' . $lastid . ' for user ' . $uid, LOGGER_DEBUG); + Logger::log('Starting from ID ' . $lastid . ' for user ' . $uid, Logger::DEBUG); if (count($posts)) { foreach ($posts as $post) { @@ -932,7 +932,7 @@ function twitter_fetchtimeline(App $a, $uid) $_SESSION["authenticated"] = true; $_SESSION["uid"] = $uid; - Logger::log('Preparing Twitter ID ' . $post->id_str . ' for user ' . $uid, LOGGER_DEBUG); + Logger::log('Preparing Twitter ID ' . $post->id_str . ' for user ' . $uid, Logger::DEBUG); $_REQUEST = twitter_do_mirrorpost($a, $uid, $post); @@ -947,7 +947,7 @@ function twitter_fetchtimeline(App $a, $uid) } } PConfig::set($uid, 'twitter', 'lastid', $lastid); - Logger::log('Last ID for user ' . $uid . ' is now ' . $lastid, LOGGER_DEBUG); + Logger::log('Last ID for user ' . $uid . ' is now ' . $lastid, Logger::DEBUG); } function twitter_queue_hook(App $a) @@ -991,7 +991,7 @@ function twitter_queue_hook(App $a) $connection = new TwitterOAuth($ckey, $csecret, $otoken, $osecret); $result = $connection->post($z['url'], $z['post']); - Logger::log('twitter_queue: post result: ' . print_r($result, true), LOGGER_DEBUG); + Logger::log('twitter_queue: post result: ' . print_r($result, true), Logger::DEBUG); if ($result->errors) { Logger::log('twitter_queue: Send to Twitter failed: "' . print_r($result->errors, true) . '"'); @@ -1078,7 +1078,7 @@ function twitter_fetch_contact($uid, $data, $create_user) Contact::updateAvatar($avatar, $uid, $contact_id); } else { if ($contact["readonly"] || $contact["blocked"]) { - Logger::log("twitter_fetch_contact: Contact '" . $contact["nick"] . "' is blocked or readonly.", LOGGER_DEBUG); + Logger::log("twitter_fetch_contact: Contact '" . $contact["nick"] . "' is blocked or readonly.", Logger::DEBUG); return -1; } @@ -1089,7 +1089,7 @@ function twitter_fetch_contact($uid, $data, $create_user) // check that we have all the photos, this has been known to fail on occasion if (empty($contact['photo']) || empty($contact['thumb']) || empty($contact['micro']) || $update_photo) { - Logger::log("twitter_fetch_contact: Updating contact " . $data->screen_name, LOGGER_DEBUG); + Logger::log("twitter_fetch_contact: Updating contact " . $data->screen_name, Logger::DEBUG); Contact::updateAvatar($avatar, $uid, $contact['id']); @@ -1388,7 +1388,7 @@ function twitter_createpost(App $a, $uid, $post, array $self, $create_user, $onl // Don't import our own comments if (Item::exists(['extid' => $postarray['uri'], 'uid' => $uid])) { - Logger::log("Item with extid " . $postarray['uri'] . " found.", LOGGER_DEBUG); + Logger::log("Item with extid " . $postarray['uri'] . " found.", Logger::DEBUG); return []; } @@ -1428,7 +1428,7 @@ function twitter_createpost(App $a, $uid, $post, array $self, $create_user, $onl $postarray['owner-link'] = $r[0]["url"]; $postarray['owner-avatar'] = $r[0]["photo"]; } else { - Logger::log("No self contact for user " . $uid, LOGGER_DEBUG); + Logger::log("No self contact for user " . $uid, Logger::DEBUG); return []; } } @@ -1450,7 +1450,7 @@ function twitter_createpost(App $a, $uid, $post, array $self, $create_user, $onl if (($contactid == 0) && !$only_existing_contact) { $contactid = $self['id']; } elseif ($contactid <= 0) { - Logger::log("Contact ID is zero or less than zero.", LOGGER_DEBUG); + Logger::log("Contact ID is zero or less than zero.", Logger::DEBUG); return []; } @@ -1547,7 +1547,7 @@ function twitter_createpost(App $a, $uid, $post, array $self, $create_user, $onl function twitter_fetchparentposts(App $a, $uid, $post, TwitterOAuth $connection, array $self) { - Logger::log("twitter_fetchparentposts: Fetching for user " . $uid . " and post " . $post->id_str, LOGGER_DEBUG); + Logger::log("twitter_fetchparentposts: Fetching for user " . $uid . " and post " . $post->id_str, Logger::DEBUG); $posts = []; @@ -1562,12 +1562,12 @@ function twitter_fetchparentposts(App $a, $uid, $post, TwitterOAuth $connection, } if (empty($post)) { - Logger::log("twitter_fetchparentposts: Can't fetch post " . $parameters->id, LOGGER_DEBUG); + Logger::log("twitter_fetchparentposts: Can't fetch post " . $parameters->id, Logger::DEBUG); break; } if (empty($post->id_str)) { - Logger::log("twitter_fetchparentposts: This is not a post " . json_encode($post), LOGGER_DEBUG); + Logger::log("twitter_fetchparentposts: This is not a post " . json_encode($post), Logger::DEBUG); break; } @@ -1578,7 +1578,7 @@ function twitter_fetchparentposts(App $a, $uid, $post, TwitterOAuth $connection, $posts[] = $post; } - Logger::log("twitter_fetchparentposts: Fetching " . count($posts) . " parents", LOGGER_DEBUG); + Logger::log("twitter_fetchparentposts: Fetching " . count($posts) . " parents", Logger::DEBUG); $posts = array_reverse($posts); @@ -1608,7 +1608,7 @@ function twitter_fetchhometimeline(App $a, $uid) $create_user = PConfig::get($uid, 'twitter', 'create_user'); $mirror_posts = PConfig::get($uid, 'twitter', 'mirror_posts'); - Logger::log("Fetching timeline for user " . $uid, LOGGER_DEBUG); + Logger::log("Fetching timeline for user " . $uid, Logger::DEBUG); $application_name = Config::get('twitter', 'application_name'); @@ -1668,13 +1668,13 @@ function twitter_fetchhometimeline(App $a, $uid) } if (empty($items)) { - Logger::log('No new timeline content for user ' . $uid, LOGGER_INFO); + Logger::log('No new timeline content for user ' . $uid, Logger::INFO); return; } $posts = array_reverse($items); - Logger::log('Fetching timeline from ID ' . $lastid . ' for user ' . $uid . ' ' . sizeof($posts) . ' items', LOGGER_DEBUG); + Logger::log('Fetching timeline from ID ' . $lastid . ' for user ' . $uid . ' ' . sizeof($posts) . ' items', Logger::DEBUG); if (count($posts)) { foreach ($posts as $post) { @@ -1688,12 +1688,12 @@ function twitter_fetchhometimeline(App $a, $uid) } if (stristr($post->source, $application_name) && $post->user->screen_name == $own_id) { - Logger::log("Skip previously sent post", LOGGER_DEBUG); + Logger::log("Skip previously sent post", Logger::DEBUG); continue; } if ($mirror_posts && $post->user->screen_name == $own_id && $post->in_reply_to_status_id_str == "") { - Logger::log("Skip post that will be mirrored", LOGGER_DEBUG); + Logger::log("Skip post that will be mirrored", Logger::DEBUG); continue; } @@ -1701,12 +1701,12 @@ function twitter_fetchhometimeline(App $a, $uid) twitter_fetchparentposts($a, $uid, $post, $connection, $self); } - Logger::log('Preparing post ' . $post->id_str . ' for user ' . $uid, LOGGER_DEBUG); + Logger::log('Preparing post ' . $post->id_str . ' for user ' . $uid, Logger::DEBUG); $postarray = twitter_createpost($a, $uid, $post, $self, $create_user, true, false); if (empty($postarray['body']) || trim($postarray['body']) == "") { - Logger::log('Empty body for post ' . $post->id_str . ' and user ' . $uid, LOGGER_DEBUG); + Logger::log('Empty body for post ' . $post->id_str . ' and user ' . $uid, Logger::DEBUG); continue; } @@ -1727,7 +1727,7 @@ function twitter_fetchhometimeline(App $a, $uid) } PConfig::set($uid, 'twitter', 'lasthometimelineid', $lastid); - Logger::log('Last timeline ID for user ' . $uid . ' is now ' . $lastid, LOGGER_DEBUG); + Logger::log('Last timeline ID for user ' . $uid . ' is now ' . $lastid, Logger::DEBUG); // Fetching mentions $lastid = PConfig::get($uid, 'twitter', 'lastmentionid'); @@ -1746,13 +1746,13 @@ function twitter_fetchhometimeline(App $a, $uid) } if (!is_array($items)) { - Logger::log("Error fetching mentions: " . print_r($items, true), LOGGER_DEBUG); + Logger::log("Error fetching mentions: " . print_r($items, true), Logger::DEBUG); return; } $posts = array_reverse($items); - Logger::log("Fetching mentions for user " . $uid . " " . sizeof($posts) . " items", LOGGER_DEBUG); + Logger::log("Fetching mentions for user " . $uid . " " . sizeof($posts) . " items", Logger::DEBUG); if (count($posts)) { foreach ($posts as $post) { @@ -1782,7 +1782,7 @@ function twitter_fetchhometimeline(App $a, $uid) PConfig::set($uid, 'twitter', 'lastmentionid', $lastid); - Logger::log('Last mentions ID for user ' . $uid . ' is now ' . $lastid, LOGGER_DEBUG); + Logger::log('Last mentions ID for user ' . $uid . ' is now ' . $lastid, Logger::DEBUG); } function twitter_fetch_own_contact(App $a, $uid) @@ -1857,7 +1857,7 @@ function twitter_is_retweet(App $a, $uid, $body) return false; } - Logger::log('twitter_is_retweet: Retweeting id ' . $id . ' for user ' . $uid, LOGGER_DEBUG); + Logger::log('twitter_is_retweet: Retweeting id ' . $id . ' for user ' . $uid, Logger::DEBUG); $ckey = Config::get('twitter', 'consumerkey'); $csecret = Config::get('twitter', 'consumersecret'); @@ -1867,7 +1867,7 @@ function twitter_is_retweet(App $a, $uid, $body) $connection = new TwitterOAuth($ckey, $csecret, $otoken, $osecret); $result = $connection->post('statuses/retweet/' . $id); - Logger::log('twitter_is_retweet: result ' . print_r($result, true), LOGGER_DEBUG); + Logger::log('twitter_is_retweet: result ' . print_r($result, true), Logger::DEBUG); return !isset($result->errors); } diff --git a/windowsphonepush/windowsphonepush.php b/windowsphonepush/windowsphonepush.php index b6e455fb..5ae0c3f3 100644 --- a/windowsphonepush/windowsphonepush.php +++ b/windowsphonepush/windowsphonepush.php @@ -456,7 +456,7 @@ function windowsphonepush_updatecounterunseen() function windowsphonepush_login(App $a) { if (!isset($_SERVER['PHP_AUTH_USER'])) { - Logger::log('API_login: ' . print_r($_SERVER, true), LOGGER_DEBUG); + Logger::log('API_login: ' . print_r($_SERVER, true), Logger::DEBUG); header('WWW-Authenticate: Basic realm="Friendica"'); header('HTTP/1.0 401 Unauthorized'); die('This api requires login'); @@ -467,7 +467,7 @@ function windowsphonepush_login(App $a) if ($user_id) { $record = DBA::selectFirst('user', [], ['uid' => $user_id]); } else { - Logger::log('API_login failure: ' . print_r($_SERVER, true), LOGGER_DEBUG); + Logger::log('API_login failure: ' . print_r($_SERVER, true), Logger::DEBUG); header('WWW-Authenticate: Basic realm="Friendica"'); header('HTTP/1.0 401 Unauthorized'); die('This api requires login'); diff --git a/wppost/wppost.php b/wppost/wppost.php index dbad6f97..107d8c0c 100644 --- a/wppost/wppost.php +++ b/wppost/wppost.php @@ -313,11 +313,11 @@ function wppost_send(&$a,&$b) { EOT; - Logger::log('wppost: data: ' . $xml, LOGGER_DATA); + Logger::log('wppost: data: ' . $xml, Logger::DATA); if ($wp_blog !== 'test') { $x = Network::post($wp_blog, $xml)->getBody(); } - Logger::log('posted to wordpress: ' . (($x) ? $x : ''), LOGGER_DEBUG); + Logger::log('posted to wordpress: ' . (($x) ? $x : ''), Logger::DEBUG); } } From 341320e07e429bb5bece9ba229b06111878d6091 Mon Sep 17 00:00:00 2001 From: Adam Magness Date: Tue, 30 Oct 2018 13:18:47 -0400 Subject: [PATCH 03/14] Bug fix missing semi-colon --- googlemaps/googlemaps.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/googlemaps/googlemaps.php b/googlemaps/googlemaps.php index 7cccb650..f9aeefd8 100644 --- a/googlemaps/googlemaps.php +++ b/googlemaps/googlemaps.php @@ -8,7 +8,7 @@ */ use Friendica\Core\Addon; use Friendica\Core\Cache; -use Friendica\Core\Logger +use Friendica\Core\Logger; function googlemaps_install() { From 2ade584927ec1973df9d34345bd3eb8af8c43b76 Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Wed, 31 Oct 2018 09:39:04 +0100 Subject: [PATCH 04/14] DE translation statusnet addon THX vinz --- statusnet/lang/de/messages.po | 36 ++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/statusnet/lang/de/messages.po b/statusnet/lang/de/messages.po index 006e0756..fbf74fe9 100644 --- a/statusnet/lang/de/messages.po +++ b/statusnet/lang/de/messages.po @@ -4,16 +4,18 @@ # # # Translators: -# Abrax , 2014-2015 -# bavatar , 2015 +# Andreas H., 2014-2015 +# Tobias Diekershoff , 2015 +# Tobias Diekershoff , 2016 +# Vinzenz Vietzke , 2018 msgid "" msgstr "" "Project-Id-Version: friendica\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2015-07-27 07:21+0200\n" -"PO-Revision-Date: 2015-07-28 05:38+0000\n" -"Last-Translator: bavatar \n" -"Language-Team: German (http://www.transifex.com/projects/p/friendica/language/de/)\n" +"PO-Revision-Date: 2018-10-28 11:54+0000\n" +"Last-Translator: Vinzenz Vietzke \n" +"Language-Team: German (http://www.transifex.com/Friendica/friendica/language/de/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -22,7 +24,7 @@ msgstr "" #: statusnet.php:151 msgid "Post to GNU Social" -msgstr "Poste nach GNU Social" +msgstr "Auf GNU Social veröffentlichen" #: statusnet.php:196 msgid "" @@ -51,7 +53,7 @@ msgid "" "There are preconfigured OAuth key pairs for some GNU Social servers " "available. If you are using one of them, please use these credentials. If " "not feel free to connect to any other GNU Social instance (see below)." -msgstr "Für einige GNU social Server sind voreingestellte OAuth Schlüsselpaare verfügbar. Solltest du einen dieser Server benutzen, dann verwende bitte diese Schlüssel. Falls nicht, stelle stattdessen eine Verbindung zu irgend einem anderen StatusNet Server her (siehe unten)." +msgstr "Für einige GNU Social Server sind voreingestellte OAuth Schlüsselpaare verfügbar. Solltest du einen dieser Server benutzen, dann verwende bitte diese Schlüssel. Falls nicht, stelle stattdessen eine Verbindung zu irgendeinem anderen StatusNet Server her (siehe unten)." #: statusnet.php:320 statusnet.php:337 statusnet.php:364 statusnet.php:371 #: statusnet.php:416 statusnet.php:699 @@ -69,7 +71,7 @@ msgid "" "here and enter the API base root.
Before you register your own OAuth " "key pair ask the administrator if there is already a key pair for this " "Friendica installation at your favorited GNU Social installation." -msgstr "Kein Consumer-Schlüsselpaar für GNU social gefunden. Registriere deinen Friendica-Account als Desktop-Client, kopiere das Consumer-Schlüsselpaar hierher und gib die API-URL ein.
Bevor du dein eigenes Consumer-Schlüsselpaar registrierst, frage den Administrator dieses Friendica-Servers, ob schon ein Schlüsselpaar für diesen Friendica-Server auf diesem StatusNet-Server existiert." +msgstr "Kein Consumer-Schlüsselpaar für GNU Social gefunden. Registriere deinen Friendica-Account als Desktop-Client bei deinem GNU Social Account, kopiere das Consumer-Schlüsselpaar hierher und gib die API-URL ein.
Bevor du dein eigenes Consumer-Schlüsselpaar registrierst, frage den Administrator dieses Friendica-Servers, ob schon ein Schlüsselpaar für diesen Friendica-Server auf diesem GNU Social-Server existiert." #: statusnet.php:325 msgid "OAuth Consumer Key" @@ -89,11 +91,11 @@ msgid "" "security code from GNU Social which you have to copy into the input box " "below and submit the form. Only your public posts will be " "posted to GNU Social." -msgstr "Um dein Konto mit einem GNU social-Konto zu verknüpfen, klicke den Button an, um einen Sicherheitscode von GNU social zu erhalten, und kopiere diesen in das Eingabefeld weiter unten. Es werden ausschließlich deine öffentlichen Nachrichten an GNU social gesendet." +msgstr "Um dein Konto mit einem GNU Social-Konto zu verknüpfen, klicke den Button an, um einen Sicherheitscode von GNU Social zu erhalten, und kopiere diesen in das Eingabefeld weiter unten. Es werden ausschließlich deine öffentlichen Nachrichten an GNU Social gesendet." #: statusnet.php:357 msgid "Log in with GNU Social" -msgstr "Bei GNU social anmelden" +msgstr "Bei GNU Social anmelden" #: statusnet.php:359 msgid "Copy the security code from GNU Social here" @@ -105,11 +107,11 @@ msgstr "Verbindungsprozess abbrechen" #: statusnet.php:367 msgid "Current GNU Social API is" -msgstr "Derzeitige GNU social-API-URL lautet" +msgstr "Derzeitige GNU Social-API-URL lautet" #: statusnet.php:368 msgid "Cancel GNU Social Connection" -msgstr "Verbindung zum GNU social Server abbrechen" +msgstr "Verbindung zum GNU Social Server abbrechen" #: statusnet.php:379 msgid "Currently connected to: " @@ -120,7 +122,7 @@ msgid "" "If enabled all your public postings can be posted to the " "associated GNU Social account. You can choose to do so by default (here) or " "for every posting separately in the posting options when writing the entry." -msgstr "Wenn aktiviert, können all deine öffentlichen Einträge auf dem verbundenen GNU social-Konto veröffentlicht werden. Du kannst das (hier) als Standardverhalten einstellen oder beim Schreiben eines Beitrags in den Beitragsoptionen festlegen." +msgstr "Wenn aktiviert, können all deine öffentlichen Einträge auf dem verbundenen GNU Social-Konto veröffentlicht werden. Du kannst das (hier) als Standardverhalten einstellen oder beim Schreiben eines Beitrags in den Beitragsoptionen festlegen." #: statusnet.php:382 msgid "" @@ -128,20 +130,20 @@ msgid "" "details from unknown viewers?) the link potentially included in public " "postings relayed to GNU Social will lead the visitor to a blank page " "informing the visitor that the access to your profile has been restricted." -msgstr "Hinweis: Aufgrund deiner Privatsphären-Einstellungen (Profil-Details vor unbekannten Betrachtern verbergen?) wird der Link, der eventuell an deinen GNU social-Beitrag angehängt wird, um auf den Originalbeitrag zu verweisen, den Betrachter auf eine leere Seite führen, die ihn darüber informiert, dass der Zugriff eingeschränkt wurde." +msgstr "Hinweis: Aufgrund deiner Privatsphären-Einstellungen (Profil-Details vor unbekannten Betrachtern verbergen?) wird der Link, der eventuell an deinen GNU Social-Beitrag angehängt wird, um auf den Originalbeitrag zu verweisen, den Betrachter auf eine leere Seite führen, die ihn darüber informiert, dass der Zugriff eingeschränkt wurde." #: statusnet.php:385 msgid "Allow posting to GNU Social" -msgstr "Veröffentlichung bei GNU social erlauben" +msgstr "Veröffentlichung bei GNU Social erlauben" #: statusnet.php:388 msgid "Send public postings to GNU Social by default" -msgstr "Veröffentliche öffentliche Beiträge standardmäßig bei GNU social" +msgstr "Veröffentliche öffentliche Beiträge standardmäßig bei GNU Social" #: statusnet.php:392 msgid "" "Mirror all posts from GNU Social that are no replies or repeated messages" -msgstr "Spiegle alle Beiträge von GNU social die keine Antworten oder wiederholten Nachrichten sind" +msgstr "Spiegle alle Beiträge von GNU Social die keine Antworten oder wiederholten Nachrichten sind" #: statusnet.php:398 msgid "Import the remote timeline" From 50573ea5c8a1179bfc95651fcad711e742071503 Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Wed, 31 Oct 2018 09:39:45 +0100 Subject: [PATCH 05/14] DE translation statusnet addon THX vinz --- statusnet/lang/de/strings.php | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/statusnet/lang/de/strings.php b/statusnet/lang/de/strings.php index e6f497ab..2c2873fa 100644 --- a/statusnet/lang/de/strings.php +++ b/statusnet/lang/de/strings.php @@ -2,34 +2,35 @@ if(! function_exists("string_plural_select_de")) { function string_plural_select_de($n){ + $n = intval($n); return ($n != 1);; }} ; -$a->strings["Post to GNU Social"] = "Poste nach GNU Social"; +$a->strings["Post to GNU Social"] = "Auf GNU Social veröffentlichen"; $a->strings["Please contact your site administrator.
The provided API URL is not valid."] = "Bitte kontaktiere den Administrator der Seite.
Die gegebene API URL ist nicht gültig."; $a->strings["We could not contact the GNU Social API with the Path you entered."] = "Die GNU Social-API konnte mit dem angegebenen Pfad nicht erreicht werden."; $a->strings["GNU Social settings updated."] = "GNU Social Einstellungen aktualisiert."; $a->strings["GNU Social Import/Export/Mirror"] = "GNU Social Import/Export/Spiegeln"; $a->strings["Globally Available GNU Social OAuthKeys"] = "Verfügbare OAuth Schlüssel für GNU Social"; -$a->strings["There are preconfigured OAuth key pairs for some GNU Social servers available. If you are using one of them, please use these credentials. If not feel free to connect to any other GNU Social instance (see below)."] = "Für einige GNU social Server sind voreingestellte OAuth Schlüsselpaare verfügbar. Solltest du einen dieser Server benutzen, dann verwende bitte diese Schlüssel. Falls nicht, stelle stattdessen eine Verbindung zu irgend einem anderen StatusNet Server her (siehe unten)."; +$a->strings["There are preconfigured OAuth key pairs for some GNU Social servers available. If you are using one of them, please use these credentials. If not feel free to connect to any other GNU Social instance (see below)."] = "Für einige GNU Social Server sind voreingestellte OAuth Schlüsselpaare verfügbar. Solltest du einen dieser Server benutzen, dann verwende bitte diese Schlüssel. Falls nicht, stelle stattdessen eine Verbindung zu irgendeinem anderen StatusNet Server her (siehe unten)."; $a->strings["Save Settings"] = "Einstellungen speichern"; $a->strings["Provide your own OAuth Credentials"] = "Eigene OAuth Schlüssel eintragen"; -$a->strings["No consumer key pair for GNU Social found. Register your Friendica Account as an desktop client on your GNU Social account, copy the consumer key pair here and enter the API base root.
Before you register your own OAuth key pair ask the administrator if there is already a key pair for this Friendica installation at your favorited GNU Social installation."] = "Kein Consumer-Schlüsselpaar für GNU social gefunden. Registriere deinen Friendica-Account als Desktop-Client, kopiere das Consumer-Schlüsselpaar hierher und gib die API-URL ein.
Bevor du dein eigenes Consumer-Schlüsselpaar registrierst, frage den Administrator dieses Friendica-Servers, ob schon ein Schlüsselpaar für diesen Friendica-Server auf diesem StatusNet-Server existiert."; +$a->strings["No consumer key pair for GNU Social found. Register your Friendica Account as an desktop client on your GNU Social account, copy the consumer key pair here and enter the API base root.
Before you register your own OAuth key pair ask the administrator if there is already a key pair for this Friendica installation at your favorited GNU Social installation."] = "Kein Consumer-Schlüsselpaar für GNU Social gefunden. Registriere deinen Friendica-Account als Desktop-Client bei deinem GNU Social Account, kopiere das Consumer-Schlüsselpaar hierher und gib die API-URL ein.
Bevor du dein eigenes Consumer-Schlüsselpaar registrierst, frage den Administrator dieses Friendica-Servers, ob schon ein Schlüsselpaar für diesen Friendica-Server auf diesem GNU Social-Server existiert."; $a->strings["OAuth Consumer Key"] = "OAuth Consumer Key"; $a->strings["OAuth Consumer Secret"] = "OAuth Consumer Secret"; $a->strings["Base API Path (remember the trailing /)"] = "Basis-URL der StatusNet API (vergiss den abschließenden / nicht)"; -$a->strings["To connect to your GNU Social account click the button below to get a security code from GNU Social which you have to copy into the input box below and submit the form. Only your public posts will be posted to GNU Social."] = "Um dein Konto mit einem GNU social-Konto zu verknüpfen, klicke den Button an, um einen Sicherheitscode von GNU social zu erhalten, und kopiere diesen in das Eingabefeld weiter unten. Es werden ausschließlich deine öffentlichen Nachrichten an GNU social gesendet."; -$a->strings["Log in with GNU Social"] = "Bei GNU social anmelden"; +$a->strings["To connect to your GNU Social account click the button below to get a security code from GNU Social which you have to copy into the input box below and submit the form. Only your public posts will be posted to GNU Social."] = "Um dein Konto mit einem GNU Social-Konto zu verknüpfen, klicke den Button an, um einen Sicherheitscode von GNU Social zu erhalten, und kopiere diesen in das Eingabefeld weiter unten. Es werden ausschließlich deine öffentlichen Nachrichten an GNU Social gesendet."; +$a->strings["Log in with GNU Social"] = "Bei GNU Social anmelden"; $a->strings["Copy the security code from GNU Social here"] = "Kopiere den Sicherheitscode von GNU social hier hin"; $a->strings["Cancel Connection Process"] = "Verbindungsprozess abbrechen"; -$a->strings["Current GNU Social API is"] = "Derzeitige GNU social-API-URL lautet"; -$a->strings["Cancel GNU Social Connection"] = "Verbindung zum GNU social Server abbrechen"; +$a->strings["Current GNU Social API is"] = "Derzeitige GNU Social-API-URL lautet"; +$a->strings["Cancel GNU Social Connection"] = "Verbindung zum GNU Social Server abbrechen"; $a->strings["Currently connected to: "] = "Momentan verbunden mit: "; -$a->strings["If enabled all your public postings can be posted to the associated GNU Social account. You can choose to do so by default (here) or for every posting separately in the posting options when writing the entry."] = "Wenn aktiviert, können all deine öffentlichen Einträge auf dem verbundenen GNU social-Konto veröffentlicht werden. Du kannst das (hier) als Standardverhalten einstellen oder beim Schreiben eines Beitrags in den Beitragsoptionen festlegen."; -$a->strings["Note: Due your privacy settings (Hide your profile details from unknown viewers?) the link potentially included in public postings relayed to GNU Social will lead the visitor to a blank page informing the visitor that the access to your profile has been restricted."] = "Hinweis: Aufgrund deiner Privatsphären-Einstellungen (Profil-Details vor unbekannten Betrachtern verbergen?) wird der Link, der eventuell an deinen GNU social-Beitrag angehängt wird, um auf den Originalbeitrag zu verweisen, den Betrachter auf eine leere Seite führen, die ihn darüber informiert, dass der Zugriff eingeschränkt wurde."; -$a->strings["Allow posting to GNU Social"] = "Veröffentlichung bei GNU social erlauben"; -$a->strings["Send public postings to GNU Social by default"] = "Veröffentliche öffentliche Beiträge standardmäßig bei GNU social"; -$a->strings["Mirror all posts from GNU Social that are no replies or repeated messages"] = "Spiegle alle Beiträge von GNU social die keine Antworten oder wiederholten Nachrichten sind"; +$a->strings["If enabled all your public postings can be posted to the associated GNU Social account. You can choose to do so by default (here) or for every posting separately in the posting options when writing the entry."] = "Wenn aktiviert, können all deine öffentlichen Einträge auf dem verbundenen GNU Social-Konto veröffentlicht werden. Du kannst das (hier) als Standardverhalten einstellen oder beim Schreiben eines Beitrags in den Beitragsoptionen festlegen."; +$a->strings["Note: Due your privacy settings (Hide your profile details from unknown viewers?) the link potentially included in public postings relayed to GNU Social will lead the visitor to a blank page informing the visitor that the access to your profile has been restricted."] = "Hinweis: Aufgrund deiner Privatsphären-Einstellungen (Profil-Details vor unbekannten Betrachtern verbergen?) wird der Link, der eventuell an deinen GNU Social-Beitrag angehängt wird, um auf den Originalbeitrag zu verweisen, den Betrachter auf eine leere Seite führen, die ihn darüber informiert, dass der Zugriff eingeschränkt wurde."; +$a->strings["Allow posting to GNU Social"] = "Veröffentlichung bei GNU Social erlauben"; +$a->strings["Send public postings to GNU Social by default"] = "Veröffentliche öffentliche Beiträge standardmäßig bei GNU Social"; +$a->strings["Mirror all posts from GNU Social that are no replies or repeated messages"] = "Spiegle alle Beiträge von GNU Social die keine Antworten oder wiederholten Nachrichten sind"; $a->strings["Import the remote timeline"] = "Importiere die entfernte Zeitleiste"; $a->strings["Disabled"] = "Deaktiviert"; $a->strings["Full Timeline"] = "Komplette Timeline"; From 9079480d4a531fa0d44376a8c8e9a5c7a20833b1 Mon Sep 17 00:00:00 2001 From: Adam Magness Date: Wed, 31 Oct 2018 10:55:15 -0400 Subject: [PATCH 06/14] move to Renderer class update functions calls for new Renderer class. --- advancedcontentfilter/advancedcontentfilter.php | 5 +++-- blackout/blackout.php | 5 +++-- buffer/buffer.php | 5 +++-- catavatar/catavatar.php | 3 ++- curweather/curweather.php | 11 ++++++----- forumdirectory/forumdirectory.php | 9 +++++---- fromgplus/fromgplus.php | 5 +++-- geocoordinates/geocoordinates.php | 5 +++-- gravatar/gravatar.php | 5 +++-- impressum/impressum.php | 5 +++-- irc/irc.php | 9 +++++---- langfilter/langfilter.php | 5 +++-- libravatar/libravatar.php | 5 +++-- mailstream/mailstream.php | 13 +++++++------ mathjax/mathjax.php | 5 +++-- newmemberwidget/newmemberwidget.php | 5 +++-- notifyall/notifyall.php | 3 ++- openstreetmap/openstreetmap.php | 5 +++-- pageheader/pageheader.php | 5 +++-- piwik/piwik.php | 5 +++-- public_server/public_server.php | 5 +++-- remote_permissions/remote_permissions.php | 9 +++++---- securemail/securemail.php | 5 +++-- statusnet/statusnet.php | 5 +++-- tumblr/tumblr.php | 5 +++-- twitter/twitter.php | 17 +++++++++-------- webrtc/webrtc.php | 5 +++-- widgets/widget_like.php | 5 +++-- widgets/widgets.php | 7 ++++--- xmpp/xmpp.php | 5 +++-- 30 files changed, 108 insertions(+), 78 deletions(-) diff --git a/advancedcontentfilter/advancedcontentfilter.php b/advancedcontentfilter/advancedcontentfilter.php index 549698d3..a00f2f07 100644 --- a/advancedcontentfilter/advancedcontentfilter.php +++ b/advancedcontentfilter/advancedcontentfilter.php @@ -40,6 +40,7 @@ use Friendica\Core\Addon; use Friendica\Core\Cache; use Friendica\Core\L10n; use Friendica\Core\Logger; +use Friendica\Core\Renderer; use Friendica\Database\DBA; use Friendica\Database\DBStructure; use Friendica\Model\Item; @@ -207,8 +208,8 @@ function advancedcontentfilter_content(App $a) return $html; } else { - $t = get_markup_template('settings.tpl', 'addon/advancedcontentfilter/'); - return replace_macros($t, [ + $t = Renderer::getMarkupTemplate('settings.tpl', 'addon/advancedcontentfilter/'); + return Renderer::replaceMacros($t, [ '$messages' => [ 'backtosettings' => L10n::t('Back to Addon Settings'), 'title' => L10n::t('Advanced Content Filter'), diff --git a/blackout/blackout.php b/blackout/blackout.php index dc19edda..c0e0dc59 100644 --- a/blackout/blackout.php +++ b/blackout/blackout.php @@ -53,6 +53,7 @@ use Friendica\Core\Config; use Friendica\Core\Addon; use Friendica\Core\L10n; use Friendica\Core\Logger; +use Friendica\Core\Renderer; function blackout_install() { Addon::registerHook('page_header', 'addon/blackout/blackout.php', 'blackout_redirect'); @@ -97,9 +98,9 @@ function blackout_addon_admin(&$a, &$o) { if (! is_string($myend)) { $myend = "YYYY-MM-DD:hhmm"; } $myurl = Config::get('blackout','url'); if (! is_string($myurl)) { $myurl = "http://www.example.com"; } - $t = get_markup_template( "admin.tpl", "addon/blackout/" ); + $t = Renderer::getMarkupTemplate( "admin.tpl", "addon/blackout/" ); - $o = replace_macros($t, [ + $o = Renderer::replaceMacros($t, [ '$submit' => L10n::t('Save Settings'), '$rurl' => ["rurl", "Redirect URL", $myurl, "all your visitors from the web will be redirected to this URL"], '$startdate' => ["startdate", "Begin of the Blackout
(YYYY-MM-DD hh:mm)", $mystart, "format is YYYY year, MM month, DD day, hh hour and mm minute"], diff --git a/buffer/buffer.php b/buffer/buffer.php index 93e9432e..bb9af8ab 100644 --- a/buffer/buffer.php +++ b/buffer/buffer.php @@ -15,6 +15,7 @@ use Friendica\Core\L10n; use Friendica\Core\Logger; use Friendica\Core\PConfig; use Friendica\Core\Protocol; +use Friendica\Core\Renderer; use Friendica\Database\DBA; use Friendica\Model\ItemContent; use Friendica\Util\Proxy as ProxyUtils; @@ -70,9 +71,9 @@ function buffer_content(App $a) function buffer_addon_admin(App $a, &$o) { - $t = get_markup_template("admin.tpl", "addon/buffer/"); + $t = Renderer::getMarkupTemplate("admin.tpl", "addon/buffer/"); - $o = replace_macros($t, [ + $o = Renderer::replaceMacros($t, [ '$submit' => L10n::t('Save Settings'), // name, label, value, help, [extra values] '$client_id' => ['client_id', L10n::t('Client ID'), Config::get('buffer', 'client_id'), ''], diff --git a/catavatar/catavatar.php b/catavatar/catavatar.php index 07f21527..66780e1f 100644 --- a/catavatar/catavatar.php +++ b/catavatar/catavatar.php @@ -12,6 +12,7 @@ use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\Logger; use Friendica\Core\PConfig; +use Friendica\Core\Renderer; use Friendica\Core\Worker; use Friendica\Database\DBA; use Friendica\Model\Contact; @@ -53,7 +54,7 @@ function catavatar_addon_settings(App $a, &$s) return; } - $t = get_markup_template('settings.tpl', 'addon/catavatar/'); + $t = Renderer::getMarkupTemplate('settings.tpl', 'addon/catavatar/'); $s .= replace_macros ($t, [ '$postpost' => !empty($_POST['catavatar-morecat']) || !empty($_POST['catavatar-emailcat']), '$uncache' => time(), diff --git a/curweather/curweather.php b/curweather/curweather.php index db244c7d..3382e731 100644 --- a/curweather/curweather.php +++ b/curweather/curweather.php @@ -17,6 +17,7 @@ use Friendica\Core\Cache; use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\PConfig; +use Friendica\Core\Renderer; use Friendica\Util\Network; use Friendica\Util\Proxy as ProxyUtils; @@ -135,7 +136,7 @@ function curweather_network_mod_init(App $a, &$b) } if ($ok) { - $t = get_markup_template("widget.tpl", "addon/curweather/" ); + $t = Renderer::getMarkupTemplate("widget.tpl", "addon/curweather/" ); $curweather = replace_macros ($t, [ '$title' => L10n::t("Current Weather"), '$icon' => ProxyUtils::proxifyUrl('http://openweathermap.org/img/w/'.$res['icon'].'.png'), @@ -152,8 +153,8 @@ function curweather_network_mod_init(App $a, &$b) '$showonmap' => L10n::t('Show on map') ]); } else { - $t = get_markup_template('widget-error.tpl', 'addon/curweather/'); - $curweather = replace_macros( $t, [ + $t = Renderer::getMarkupTemplate('widget-error.tpl', 'addon/curweather/'); + $curweather = Renderer::replaceMacros( $t, [ '$problem' => L10n::t('There was a problem accessing the weather data. But have a look'), '$rpt' => $rpt, '$atOWM' => L10n::t('at OpenWeatherMap') @@ -197,7 +198,7 @@ function curweather_addon_settings(App $a, &$s) $enable_checked = (($enable) ? ' checked="checked" ' : ''); // load template and replace the macros - $t = get_markup_template("settings.tpl", "addon/curweather/" ); + $t = Renderer::getMarkupTemplate("settings.tpl", "addon/curweather/" ); $s = replace_macros ($t, [ '$submit' => L10n::t('Save Settings'), @@ -237,7 +238,7 @@ function curweather_addon_admin(App $a, &$o) $appid = Config::get('curweather', 'appid'); $cachetime = Config::get('curweather', 'cachetime'); - $t = get_markup_template("admin.tpl", "addon/curweather/" ); + $t = Renderer::getMarkupTemplate("admin.tpl", "addon/curweather/" ); $o = replace_macros ($t, [ '$submit' => L10n::t('Save Settings'), diff --git a/forumdirectory/forumdirectory.php b/forumdirectory/forumdirectory.php index 54818cdb..1c88dfaf 100644 --- a/forumdirectory/forumdirectory.php +++ b/forumdirectory/forumdirectory.php @@ -13,6 +13,7 @@ use Friendica\Content\Widget; use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; +use Friendica\Core\Renderer; use Friendica\Database\DBA; use Friendica\Model\Contact; use Friendica\Model\Profile; @@ -76,7 +77,7 @@ function forumdirectory_content(App $a) $search = ((!empty($_GET['search'])) ? notags(trim(rawurldecode($_GET['search']))) : ''); } - $tpl = get_markup_template('directory_header.tpl'); + $tpl = Renderer::getMarkupTemplate('directory_header.tpl'); $globaldir = ''; $gdirpath = Config::get('system', 'directory'); @@ -87,7 +88,7 @@ function forumdirectory_content(App $a) $admin = ''; - $o .= replace_macros($tpl, [ + $o .= Renderer::replaceMacros($tpl, [ '$search' => $search, '$globaldir' => $globaldir, '$desc' => L10n::t('Find on this site'), @@ -187,9 +188,9 @@ function forumdirectory_content(App $a) $homepage = !empty($profile['homepage']) ? L10n::t('Homepage:') : false; $about = !empty($profile['about']) ? L10n::t('About:') : false; - $tpl = get_markup_template('forumdirectory_item.tpl', 'addon/forumdirectory/'); + $tpl = Renderer::getMarkupTemplate('forumdirectory_item.tpl', 'addon/forumdirectory/'); - $entry = replace_macros($tpl, [ + $entry = Renderer::replaceMacros($tpl, [ '$id' => $rr['id'], '$profile_link' => $profile_link, '$photo' => $rr[$photo], diff --git a/fromgplus/fromgplus.php b/fromgplus/fromgplus.php index a964954a..860438d8 100644 --- a/fromgplus/fromgplus.php +++ b/fromgplus/fromgplus.php @@ -15,6 +15,7 @@ use Friendica\Core\L10n; use Friendica\Core\Logger; use Friendica\Core\PConfig; use Friendica\Core\Protocol; +use Friendica\Core\Renderer; use Friendica\Object\Image; use Friendica\Util\DateTimeFormat; use Friendica\Util\Network; @@ -102,9 +103,9 @@ function fromgplus_addon_settings_post(&$a,&$b) { function fromgplus_addon_admin(&$a, &$o) { - $t = get_markup_template("admin.tpl", "addon/fromgplus/"); + $t = Renderer::getMarkupTemplate("admin.tpl", "addon/fromgplus/"); - $o = replace_macros($t, [ + $o = Renderer::replaceMacros($t, [ '$submit' => L10n::t('Save Settings'), '$key' => ['key', L10n::t('Key'), trim(Config::get('fromgplus', 'key')), ''], ]); diff --git a/geocoordinates/geocoordinates.php b/geocoordinates/geocoordinates.php index 6a3f535c..1a0b9daa 100644 --- a/geocoordinates/geocoordinates.php +++ b/geocoordinates/geocoordinates.php @@ -10,6 +10,7 @@ use Friendica\Core\Cache; use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\Logger; +use Friendica\Core\Renderer; use Friendica\Util\Network; function geocoordinates_install() @@ -87,9 +88,9 @@ function geocoordinates_post_hook($a, &$item) function geocoordinates_addon_admin(&$a, &$o) { - $t = get_markup_template("admin.tpl", "addon/geocoordinates/"); + $t = Renderer::getMarkupTemplate("admin.tpl", "addon/geocoordinates/"); - $o = replace_macros($t, [ + $o = Renderer::replaceMacros($t, [ '$submit' => L10n::t('Save Settings'), '$api_key' => ['api_key', L10n::t('API Key'), Config::get('geocoordinates', 'api_key'), ''], '$language' => ['language', L10n::t('Language code (IETF format)'), Config::get('geocoordinates', 'language'), ''], diff --git a/gravatar/gravatar.php b/gravatar/gravatar.php index e5a59b26..d0d54689 100644 --- a/gravatar/gravatar.php +++ b/gravatar/gravatar.php @@ -12,6 +12,7 @@ use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\Logger; +use Friendica\Core\Renderer; use Friendica\Database\DBA; use Friendica\Util\Security; @@ -71,7 +72,7 @@ function gravatar_lookup($a, &$b) { * Display admin settings for this addon */ function gravatar_addon_admin (&$a, &$o) { - $t = get_markup_template( "admin.tpl", "addon/gravatar/" ); + $t = Renderer::getMarkupTemplate( "admin.tpl", "addon/gravatar/" ); $default_avatar = Config::get('gravatar', 'default_avatar'); $rating = Config::get('gravatar', 'rating'); @@ -107,7 +108,7 @@ function gravatar_addon_admin (&$a, &$o) { // output Gravatar settings $o .= ''; - $o .= replace_macros( $t, [ + $o .= Renderer::replaceMacros( $t, [ '$submit' => L10n::t('Save Settings'), '$default_avatar' => ['avatar', L10n::t('Default avatar image'), $default_avatar, L10n::t('Select default avatar image if none was found at Gravatar. See README'), $default_avatars], '$rating' => ['rating', L10n::t('Rating of images'), $rating, L10n::t('Select the appropriate avatar rating for your site. See README'), $ratings], diff --git a/impressum/impressum.php b/impressum/impressum.php index 2cac33fa..0efe5c3c 100644 --- a/impressum/impressum.php +++ b/impressum/impressum.php @@ -12,6 +12,7 @@ use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\Logger; +use Friendica\Core\Renderer; use Friendica\Util\Proxy as ProxyUtils; function impressum_install() { @@ -100,8 +101,8 @@ function impressum_addon_admin_post (&$a) { info(L10n::t('Settings updated.'). EOL ); } function impressum_addon_admin (&$a, &$o) { - $t = get_markup_template( "admin.tpl", "addon/impressum/" ); - $o = replace_macros($t, [ + $t = Renderer::getMarkupTemplate( "admin.tpl", "addon/impressum/" ); + $o = Renderer::replaceMacros($t, [ '$submit' => L10n::t('Save Settings'), '$owner' => ['owner', L10n::t('Site Owner'), Config::get('impressum','owner'), L10n::t('The page operators name.')], '$ownerprofile' => ['ownerprofile', L10n::t('Site Owners Profile'), Config::get('impressum','ownerprofile'), L10n::t('Profile address of the operator.')], diff --git a/irc/irc.php b/irc/irc.php index 38ce5f24..4804fb6f 100644 --- a/irc/irc.php +++ b/irc/irc.php @@ -10,6 +10,7 @@ use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\PConfig; +use Friendica\Core\Renderer; function irc_install() { Addon::registerHook('app_menu', 'addon/irc/irc.php', 'irc_app_menu'); @@ -36,8 +37,8 @@ function irc_addon_settings(&$a,&$s) { $sitechats = PConfig::get( local_user(), 'irc','sitechats'); /* popular channels */ $autochans = PConfig::get( local_user(), 'irc','autochans'); /* auto connect chans */ - $t = get_markup_template( "settings.tpl", "addon/irc/" ); - $s .= replace_macros($t, [ + $t = Renderer::getMarkupTemplate( "settings.tpl", "addon/irc/" ); + $s .= Renderer::replaceMacros($t, [ '$header' => L10n::t('IRC Settings'), '$info' => L10n::t('Here you can change the system wide settings for the channels to automatically join and access via the side bar. Note the changes you do here, only effect the channel selection if you are logged in.'), '$submit' => L10n::t('Save Settings'), @@ -135,8 +136,8 @@ function irc_addon_admin_post (&$a) { function irc_addon_admin (&$a, &$o) { $sitechats = Config::get('irc','sitechats'); /* popular channels */ $autochans = Config::get('irc','autochans'); /* auto connect chans */ - $t = get_markup_template( "admin.tpl", "addon/irc/" ); - $o = replace_macros($t, [ + $t = Renderer::getMarkupTemplate( "admin.tpl", "addon/irc/" ); + $o = Renderer::replaceMacros($t, [ '$submit' => L10n::t('Save Settings'), '$autochans' => [ 'autochans', L10n::t('Channel(s) to auto connect (comma separated)'), $autochans, L10n::t('List of channels that shall automatically connected to when the app is launched.')], '$sitechats' => [ 'sitechats', L10n::t('Popular Channels (comma separated)'), $sitechats, L10n::t('List of popular channels, will be displayed at the side and hotlinked for easy joining.') ] diff --git a/langfilter/langfilter.php b/langfilter/langfilter.php index 6922ac82..8cc8f697 100644 --- a/langfilter/langfilter.php +++ b/langfilter/langfilter.php @@ -12,6 +12,7 @@ use Friendica\Content\Text\BBCode; use Friendica\Core\Addon; use Friendica\Core\L10n; use Friendica\Core\PConfig; +use Friendica\Core\Renderer; /* Define the hooks we want to use * that is, we have settings, we need to save the settings and we want @@ -50,8 +51,8 @@ function langfilter_addon_settings(App $a, &$s) $minconfidence = PConfig::get(local_user(), 'langfilter', 'minconfidence') * 100; $minlength = PConfig::get(local_user(), 'langfilter', 'minlength'); - $t = get_markup_template("settings.tpl", "addon/langfilter/"); - $s .= replace_macros($t, [ + $t = Renderer::getMarkupTemplate("settings.tpl", "addon/langfilter/"); + $s .= Renderer::replaceMacros($t, [ '$title' => L10n::t("Language Filter"), '$intro' => L10n::t('This addon tries to identify the language posts are writen in. If it does not match any language specifed below, posts will be hidden by collapsing them.'), '$enabled' => ['langfilter_enable', L10n::t('Use the language filter'), $enable_checked, ''], diff --git a/libravatar/libravatar.php b/libravatar/libravatar.php index 80c9e4c5..39f77a56 100644 --- a/libravatar/libravatar.php +++ b/libravatar/libravatar.php @@ -12,6 +12,7 @@ use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\Logger; +use Friendica\Core\Renderer; use Friendica\Database\DBA; use Friendica\Util\Security; @@ -74,7 +75,7 @@ function libravatar_lookup($a, &$b) */ function libravatar_addon_admin(&$a, &$o) { - $t = get_markup_template("admin.tpl", "addon/libravatar"); + $t = Renderer::getMarkupTemplate("admin.tpl", "addon/libravatar"); $default_avatar = Config::get('libravatar', 'default_avatar'); @@ -110,7 +111,7 @@ function libravatar_addon_admin(&$a, &$o) // output Libravatar settings $o .= ''; - $o .= replace_macros( $t, [ + $o .= Renderer::replaceMacros( $t, [ '$submit' => L10n::t('Save Settings'), '$default_avatar' => ['avatar', L10n::t('Default avatar image'), $default_avatar, L10n::t('Select default avatar image if none was found. See README'), $default_avatars], ]); diff --git a/mailstream/mailstream.php b/mailstream/mailstream.php index c7842b78..1d2a4917 100644 --- a/mailstream/mailstream.php +++ b/mailstream/mailstream.php @@ -12,6 +12,7 @@ use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\Logger; use Friendica\Core\PConfig; +use Friendica\Core\Renderer; use Friendica\Database\DBA; use Friendica\Util\Network; use Friendica\Model\Item; @@ -74,12 +75,12 @@ function mailstream_module() {} function mailstream_addon_admin(&$a,&$o) { $frommail = Config::get('mailstream', 'frommail'); - $template = get_markup_template('admin.tpl', 'addon/mailstream/'); + $template = Renderer::getMarkupTemplate('admin.tpl', 'addon/mailstream/'); $config = ['frommail', L10n::t('From Address'), $frommail, L10n::t('Email address that stream items will appear to be from.')]; - $o .= replace_macros($template, [ + $o .= Renderer::replaceMacros($template, [ '$frommail' => $config, '$submit' => L10n::t('Save Settings')]); } @@ -288,10 +289,10 @@ function mailstream_send($a, $message_id, $item, $user) { } $mail->IsHTML(true); $mail->CharSet = 'utf-8'; - $template = get_markup_template('mail.tpl', 'addon/mailstream/'); + $template = Renderer::getMarkupTemplate('mail.tpl', 'addon/mailstream/'); $item['body'] = BBCode::convert($item['body']); $item['url'] = $a->getBaseURL() . '/display/' . $user['nickname'] . '/' . $item['id']; - $mail->Body = replace_macros($template, [ + $mail->Body = Renderer::replaceMacros($template, [ '$upstream' => L10n::t('Upstream'), '$local' => L10n::t('Local'), '$item' => $item]); @@ -356,8 +357,8 @@ function mailstream_addon_settings(&$a,&$s) { $address = PConfig::get(local_user(), 'mailstream', 'address'); $nolikes = PConfig::get(local_user(), 'mailstream', 'nolikes'); $attachimg= PConfig::get(local_user(), 'mailstream', 'attachimg'); - $template = get_markup_template('settings.tpl', 'addon/mailstream/'); - $s .= replace_macros($template, [ + $template = Renderer::getMarkupTemplate('settings.tpl', 'addon/mailstream/'); + $s .= Renderer::replaceMacros($template, [ '$enabled' => [ 'mailstream_enabled', L10n::t('Enabled'), diff --git a/mathjax/mathjax.php b/mathjax/mathjax.php index 9aa07027..ca073e53 100644 --- a/mathjax/mathjax.php +++ b/mathjax/mathjax.php @@ -12,6 +12,7 @@ use Friendica\App; use Friendica\Core\Addon; use Friendica\Core\L10n; use Friendica\Core\PConfig; +use Friendica\Core\Renderer; function mathjax_install() { @@ -49,8 +50,8 @@ function mathjax_settings(App $a, &$s) $use = PConfig::get(local_user(), 'mathjax', 'use', false); - $tpl = get_markup_template('settings.tpl', __DIR__); - $s .= replace_macros($tpl, [ + $tpl = Renderer::getMarkupTemplate('settings.tpl', __DIR__); + $s .= Renderer::replaceMacros($tpl, [ '$title' => 'MathJax', '$description' => L10n::t('The MathJax addon renders mathematical formulae written using the LaTeX syntax surrounded by the usual $$ or an eqnarray block in the postings of your wall,network tab and private mail.'), '$mathjax_use' => ['mathjax_use', L10n::t('Use the MathJax renderer'), $use, ''], diff --git a/newmemberwidget/newmemberwidget.php b/newmemberwidget/newmemberwidget.php index f71f01b2..73ae176c 100644 --- a/newmemberwidget/newmemberwidget.php +++ b/newmemberwidget/newmemberwidget.php @@ -11,6 +11,7 @@ use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\Logger; +use Friendica\Core\Renderer; function newmemberwidget_install() { @@ -64,8 +65,8 @@ function newmemberwidget_addon_admin_post(&$a) function newmemberwidget_addon_admin(&$a, &$o) { - $t = get_markup_template('admin.tpl', 'addon/newmemberwidget'); - $o = replace_macros($t, [ + $t = Renderer::getMarkupTemplate('admin.tpl', 'addon/newmemberwidget'); + $o = Renderer::replaceMacros($t, [ '$submit' => L10n::t('Save Settings'), '$freetext' => [ "freetext", L10n::t("Message"), Config::get("newmemberwidget", "freetext"), L10n::t("Your message for new members. You can use bbcode here.")], '$linkglobalsupport' => [ "linkglobalsupport", L10n::t('Add a link to global support forum'), Config::get('newmemberwidget', 'linkglobalsupport'), L10n::t('Should a link to the global support forum be displayed?')." (
@helpers)"], diff --git a/notifyall/notifyall.php b/notifyall/notifyall.php index a2eb2a87..ea6712f1 100644 --- a/notifyall/notifyall.php +++ b/notifyall/notifyall.php @@ -13,6 +13,7 @@ use Friendica\Content\Text\BBCode; use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\Logger; +use Friendica\Core\Renderer; use Friendica\Util\Emailer; function notifyall_install() @@ -105,7 +106,7 @@ function notifyall_content(&$a) $title = L10n::t('Send email to all members of this Friendica instance.'); - $o = replace_macros(get_markup_template('notifyall_form.tpl', 'addon/notifyall/'), [ + $o = Renderer::replaceMacros(Renderer::getMarkupTemplate('notifyall_form.tpl', 'addon/notifyall/'), [ '$title' => $title, '$text' => htmlspecialchars(defaults($_REQUEST, 'text', '')), '$subject' => ['subject', L10n::t('Message subject'), defaults($_REQUEST, 'subject', ''),''], diff --git a/openstreetmap/openstreetmap.php b/openstreetmap/openstreetmap.php index 61838b38..68edf8bf 100644 --- a/openstreetmap/openstreetmap.php +++ b/openstreetmap/openstreetmap.php @@ -13,6 +13,7 @@ use Friendica\Core\Cache; use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\Logger; +use Friendica\Core\Renderer; use Friendica\Core\System; use Friendica\Util\Network; @@ -190,7 +191,7 @@ function openstreetmap_generate_map(&$a, &$b) function openstreetmap_addon_admin(&$a, &$o) { - $t = get_markup_template("admin.tpl", "addon/openstreetmap/"); + $t = Renderer::getMarkupTemplate("admin.tpl", "addon/openstreetmap/"); $tmsserver = Config::get('openstreetmap', 'tmsserver', OSM_TMS); $nomserver = Config::get('openstreetmap', 'nomserver', OSM_NOM); $zoom = Config::get('openstreetmap', 'zoom', OSM_ZOOM); @@ -201,7 +202,7 @@ function openstreetmap_addon_admin(&$a, &$o) $nomserver = OSM_NOM; } - $o = replace_macros($t, [ + $o = Renderer::replaceMacros($t, [ '$submit' => L10n::t('Submit'), '$tmsserver' => ['tmsserver', L10n::t('Tile Server URL'), $tmsserver, L10n::t('A list of public tile servers')], '$nomserver' => ['nomserver', L10n::t('Nominatim (reverse geocoding) Server URL'), $nomserver, L10n::t('A list of Nominatim servers')], diff --git a/pageheader/pageheader.php b/pageheader/pageheader.php index ce0d6e2b..5b59064a 100644 --- a/pageheader/pageheader.php +++ b/pageheader/pageheader.php @@ -10,6 +10,7 @@ use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; +use Friendica\Core\Renderer; function pageheader_install() { Addon::registerHook('page_content_top', 'addon/pageheader/pageheader.php', 'pageheader_fetch'); @@ -48,8 +49,8 @@ function pageheader_addon_settings(&$a,&$s) { if(! $words) $words = ''; - $t = get_markup_template("settings.tpl", "addon/pageheader/"); - $s .= replace_macros($t, [ + $t = Renderer::getMarkupTemplate("settings.tpl", "addon/pageheader/"); + $s .= Renderer::replaceMacros($t, [ '$title' => L10n::t('"pageheader" Settings'), '$phwords' => ['pageheader-words', L10n::t('Message'), $words, L10n::t('Message to display on every page on this server (or put a pageheader.html file in your docroot)')], '$submit' => L10n::t('Save Settings') diff --git a/piwik/piwik.php b/piwik/piwik.php index 638c1339..77755236 100644 --- a/piwik/piwik.php +++ b/piwik/piwik.php @@ -34,6 +34,7 @@ use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\Logger; +use Friendica\Core\Renderer; function piwik_install() { Addon::registerHook('load_config', 'addon/piwik/piwik.php', 'piwik_load_config'); @@ -96,8 +97,8 @@ function piwik_analytics($a,&$b) { } } function piwik_addon_admin (&$a, &$o) { - $t = get_markup_template( "admin.tpl", "addon/piwik/" ); - $o = replace_macros( $t, [ + $t = Renderer::getMarkupTemplate( "admin.tpl", "addon/piwik/" ); + $o = Renderer::replaceMacros( $t, [ '$submit' => L10n::t('Save Settings'), '$piwikbaseurl' => ['baseurl', L10n::t('Piwik Base URL'), Config::get('piwik','baseurl' ), L10n::t('Absolute path to your Piwik installation. (without protocol (http/s), with trailing slash)')], '$siteid' => ['siteid', L10n::t('Site ID'), Config::get('piwik','siteid' ), ''], diff --git a/public_server/public_server.php b/public_server/public_server.php index 31502d77..3421dcc1 100644 --- a/public_server/public_server.php +++ b/public_server/public_server.php @@ -12,6 +12,7 @@ use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\Logger; +use Friendica\Core\Renderer; use Friendica\Database\DBA; use Friendica\Util\DateTimeFormat; @@ -164,8 +165,8 @@ function public_server_addon_admin_post(&$a) function public_server_addon_admin(&$a, &$o) { $token = BaseModule::getFormSecurityToken("publicserver"); - $t = get_markup_template("admin.tpl", "addon/public_server"); - $o = replace_macros($t, [ + $t = Renderer::getMarkupTemplate("admin.tpl", "addon/public_server"); + $o = Renderer::replaceMacros($t, [ '$submit' => L10n::t('Save Settings'), '$form_security_token' => $token, '$infotext' => L10n::t('Set any of these options to 0 to deactivate it.'), diff --git a/remote_permissions/remote_permissions.php b/remote_permissions/remote_permissions.php index c883c5b8..91c2b4ce 100644 --- a/remote_permissions/remote_permissions.php +++ b/remote_permissions/remote_permissions.php @@ -11,6 +11,7 @@ use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\PConfig; +use Friendica\Core\Renderer; use Friendica\Database\DBA; function remote_permissions_install() { @@ -45,8 +46,8 @@ function remote_permissions_settings(&$a,&$o) { /* Add some HTML to the existing form */ // $t = file_get_contents("addon/remote_permissions/settings.tpl" ); - $t = get_markup_template("settings.tpl", "addon/remote_permissions/" ); - $o .= replace_macros($t, [ + $t = Renderer::getMarkupTemplate("settings.tpl", "addon/remote_permissions/" ); + $o .= Renderer::replaceMacros($t, [ '$remote_perms_title' => L10n::t('Remote Permissions Settings'), '$remote_perms_label' => L10n::t('Allow recipients of your private posts to see the other recipients of the posts'), '$checked' => (($remote_perms == 1) ? 'checked="checked"' : ''), @@ -196,8 +197,8 @@ function remote_permissions_content($a, $item_copy) { } function remote_permissions_addon_admin(&$a, &$o){ - $t = get_markup_template( "admin.tpl", "addon/remote_permissions/" ); - $o = replace_macros($t, [ + $t = Renderer::getMarkupTemplate( "admin.tpl", "addon/remote_permissions/" ); + $o = Renderer::replaceMacros($t, [ '$submit' => L10n::t('Save Settings'), '$global' => ['remotepermschoice', L10n::t('Global'), 1, L10n::t('The posts of every user on this server show the post recipients'), Config::get('remote_perms', 'global') == 1], '$individual' => ['remotepermschoice', L10n::t('Individual'), 2, L10n::t('Each user chooses whether his/her posts show the post recipients'), Config::get('remote_perms', 'global') == 0] diff --git a/securemail/securemail.php b/securemail/securemail.php index e39b88ef..90251788 100644 --- a/securemail/securemail.php +++ b/securemail/securemail.php @@ -12,6 +12,7 @@ use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\Logger; use Friendica\Core\PConfig; +use Friendica\Core\Renderer; use Friendica\Util\Emailer; /* because the fraking openpgp-php is in composer, require libs in composer @@ -62,9 +63,9 @@ function securemail_settings(App &$a, &$s){ $enable = intval(PConfig::get(local_user(), 'securemail', 'enable')); $publickey = PConfig::get(local_user(), 'securemail', 'pkey'); - $t = get_markup_template('admin.tpl', 'addon/securemail/'); + $t = Renderer::getMarkupTemplate('admin.tpl', 'addon/securemail/'); - $s .= replace_macros($t, [ + $s .= Renderer::replaceMacros($t, [ '$title' => L10n::t('"Secure Mail" Settings'), '$submit' => L10n::t('Save Settings'), '$test' => L10n::t('Save and send test'), //NOTE: update also in 'post' diff --git a/statusnet/statusnet.php b/statusnet/statusnet.php index 0d64ccee..e07a6e73 100644 --- a/statusnet/statusnet.php +++ b/statusnet/statusnet.php @@ -49,6 +49,7 @@ use Friendica\Core\L10n; use Friendica\Core\Logger; use Friendica\Core\PConfig; use Friendica\Core\Protocol; +use Friendica\Core\Renderer; use Friendica\Database\DBA; use Friendica\Model\Contact; use Friendica\Model\GContact; @@ -668,8 +669,8 @@ function statusnet_addon_admin(App $a, &$o) //'applicationname' => Array("applicationname[$id]", L10n::t("Application name"), "", ""), ]; - $t = get_markup_template("admin.tpl", "addon/statusnet/"); - $o = replace_macros($t, [ + $t = Renderer::getMarkupTemplate("admin.tpl", "addon/statusnet/"); + $o = Renderer::replaceMacros($t, [ '$submit' => L10n::t('Save Settings'), '$sites' => $sitesform, ]); diff --git a/tumblr/tumblr.php b/tumblr/tumblr.php index 7d232a6a..bac11634 100644 --- a/tumblr/tumblr.php +++ b/tumblr/tumblr.php @@ -16,6 +16,7 @@ use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\Logger; use Friendica\Core\PConfig; +use Friendica\Core\Renderer; use Friendica\Database\DBA; function tumblr_install() @@ -70,9 +71,9 @@ function tumblr_content(App $a) function tumblr_addon_admin(App $a, &$o) { - $t = get_markup_template( "admin.tpl", "addon/tumblr/" ); + $t = Renderer::getMarkupTemplate( "admin.tpl", "addon/tumblr/" ); - $o = replace_macros($t, [ + $o = Renderer::replaceMacros($t, [ '$submit' => L10n::t('Save Settings'), // name, label, value, help, [extra values] '$consumer_key' => ['consumer_key', L10n::t('Consumer Key'), Config::get('tumblr', 'consumer_key' ), ''], diff --git a/twitter/twitter.php b/twitter/twitter.php index 77a3a265..e556e402 100644 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -72,6 +72,7 @@ use Friendica\Core\L10n; use Friendica\Core\Logger; use Friendica\Core\PConfig; use Friendica\Core\Protocol; +use Friendica\Core\Renderer; use Friendica\Core\Worker; use Friendica\Database\DBA; use Friendica\Model\Contact; @@ -347,7 +348,7 @@ function twitter_settings(App $a, &$s) try { $details = $connection->get('account/verify_credentials'); - $field_checkbox = get_markup_template('field_checkbox.tpl'); + $field_checkbox = Renderer::getMarkupTemplate('field_checkbox.tpl'); $s .= '

' . L10n::t('Currently connected to: ') . '' . $details->screen_name . ' @@ -360,22 +361,22 @@ function twitter_settings(App $a, &$s)

'; $s .= '
'; - $s .= replace_macros($field_checkbox, [ + $s .= Renderer::replaceMacros($field_checkbox, [ '$field' => ['twitter-enable', L10n::t('Allow posting to Twitter'), $enabled, L10n::t('If enabled all your public postings can be posted to the associated Twitter account. You can choose to do so by default (here) or for every posting separately in the posting options when writing the entry.')] ]); if ($a->user['hidewall']) { $s .= '

' . L10n::t('Note: Due to your privacy settings (Hide your profile details from unknown viewers?) the link potentially included in public postings relayed to Twitter will lead the visitor to a blank page informing the visitor that the access to your profile has been restricted.') . '

'; } - $s .= replace_macros($field_checkbox, [ + $s .= Renderer::replaceMacros($field_checkbox, [ '$field' => ['twitter-default', L10n::t('Send public postings to Twitter by default'), $defenabled, ''] ]); - $s .= replace_macros($field_checkbox, [ + $s .= Renderer::replaceMacros($field_checkbox, [ '$field' => ['twitter-mirror', L10n::t('Mirror all posts from twitter that are no replies'), $mirrorenabled, ''] ]); - $s .= replace_macros($field_checkbox, [ + $s .= Renderer::replaceMacros($field_checkbox, [ '$field' => ['twitter-import', L10n::t('Import the remote timeline'), $importenabled, ''] ]); - $s .= replace_macros($field_checkbox, [ + $s .= Renderer::replaceMacros($field_checkbox, [ '$field' => ['twitter-create_user', L10n::t('Automatically create contacts'), $create_userenabled, L10n::t('This will automatically create a contact in Friendica as soon as you receive a message from an existing contact via the Twitter network. If you do not enable this, you need to manually add those Twitter contacts in Friendica from whom you would like to see posts here. However if enabled, you cannot merely remove a twitter contact from the Friendica contact list, as it will recreate this contact when they post again.')] ]); $s .= '
'; @@ -665,9 +666,9 @@ function twitter_addon_admin_post(App $a) function twitter_addon_admin(App $a, &$o) { - $t = get_markup_template("admin.tpl", "addon/twitter/"); + $t = Renderer::getMarkupTemplate("admin.tpl", "addon/twitter/"); - $o = replace_macros($t, [ + $o = Renderer::replaceMacros($t, [ '$submit' => L10n::t('Save Settings'), // name, label, value, help, [extra values] '$consumerkey' => ['consumerkey', L10n::t('Consumer key'), Config::get('twitter', 'consumerkey'), ''], diff --git a/webrtc/webrtc.php b/webrtc/webrtc.php index 47cd734c..d8c7d8a2 100644 --- a/webrtc/webrtc.php +++ b/webrtc/webrtc.php @@ -9,6 +9,7 @@ use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; +use Friendica\Core\Renderer; function webrtc_install() { Addon::registerHook('app_menu', 'addon/webrtc/webrtc.php', 'webrtc_app_menu'); @@ -24,8 +25,8 @@ function webrtc_app_menu($a,&$b) { } function webrtc_addon_admin (&$a, &$o) { - $t = get_markup_template( "admin.tpl", "addon/webrtc/" ); - $o = replace_macros( $t, [ + $t = Renderer::getMarkupTemplate( "admin.tpl", "addon/webrtc/" ); + $o = Renderer::replaceMacros( $t, [ '$submit' => L10n::t('Save Settings'), '$webrtcurl' => ['webrtcurl', L10n::t('WebRTC Base URL'), Config::get('webrtc','webrtcurl' ), L10n::t('Page your users will create a WebRTC chat room on. For example you could use https://live.mayfirst.org .')], ]); diff --git a/widgets/widget_like.php b/widgets/widget_like.php index 238d15ad..9693d254 100644 --- a/widgets/widget_like.php +++ b/widgets/widget_like.php @@ -1,6 +1,7 @@ $likes, '$strlike' => L10n::tt("%d person likes this", "%d people like this", $likes), diff --git a/widgets/widgets.php b/widgets/widgets.php index 8d7cf3ae..927d6746 100644 --- a/widgets/widgets.php +++ b/widgets/widgets.php @@ -11,6 +11,7 @@ use Friendica\Core\Addon; use Friendica\Core\L10n; use Friendica\Core\Logger; use Friendica\Core\PConfig; +use Friendica\Core\Renderer; use Friendica\Database\DBA; function widgets_install() { @@ -58,8 +59,8 @@ function widgets_settings(&$a,&$o) { # $t = file_get_contents( dirname(__file__). "/settings.tpl" ); - $t = get_markup_template("settings.tpl", "addon/widgets/"); - $o .= replace_macros($t, [ + $t = Renderer::getMarkupTemplate("settings.tpl", "addon/widgets/"); + $o .= Renderer::replaceMacros($t, [ '$submit' => L10n::t('Generate new key'), '$baseurl' => $a->getBaseURL(), '$title' => "Widgets", @@ -142,7 +143,7 @@ function widgets_content(&$a) { $widget_size = call_user_func($a->argv[1].'_widget_size'); $script = file_get_contents(dirname(__file__)."/widgets.js"); - $o .= replace_macros($script, [ + $o .= Renderer::replaceMacros($script, [ '$entrypoint' => $a->getBaseURL()."/widgets/".$a->argv[1]."/cb/", '$key' => $conf['key'], '$widget_id' => 'f9a_'.$a->argv[1]."_"._randomAlphaNum(6), diff --git a/xmpp/xmpp.php b/xmpp/xmpp.php index e45bd72e..d80abb64 100644 --- a/xmpp/xmpp.php +++ b/xmpp/xmpp.php @@ -11,6 +11,7 @@ use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\PConfig; +use Friendica\Core\Renderer; function xmpp_install() { @@ -104,9 +105,9 @@ function xmpp_login() function xmpp_addon_admin(App $a, &$o) { - $t = get_markup_template('admin.tpl', 'addon/xmpp/'); + $t = Renderer::getMarkupTemplate('admin.tpl', 'addon/xmpp/'); - $o = replace_macros($t, [ + $o = Renderer::replaceMacros($t, [ '$submit' => L10n::t('Save Settings'), '$bosh_proxy' => ['bosh_proxy', L10n::t('Jabber BOSH host'), Config::get('xmpp', 'bosh_proxy'), ''], '$central_userbase' => ['central_userbase', L10n::t('Use central userbase'), Config::get('xmpp', 'central_userbase'), L10n::t('If enabled, users will automatically login to an ejabberd server that has to be installed on this machine with synchronized credentials via the "auth_ejabberd.php" script.')], From 07fcb9c62b643a780e84ab66f2103b664856ff12 Mon Sep 17 00:00:00 2001 From: Adam Magness Date: Wed, 31 Oct 2018 11:06:15 -0400 Subject: [PATCH 07/14] A few missed a few missed function calls. --- catavatar/catavatar.php | 2 +- curweather/curweather.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/catavatar/catavatar.php b/catavatar/catavatar.php index 66780e1f..77dd1812 100644 --- a/catavatar/catavatar.php +++ b/catavatar/catavatar.php @@ -55,7 +55,7 @@ function catavatar_addon_settings(App $a, &$s) } $t = Renderer::getMarkupTemplate('settings.tpl', 'addon/catavatar/'); - $s .= replace_macros ($t, [ + $s .= Renderer::replaceMacros($t, [ '$postpost' => !empty($_POST['catavatar-morecat']) || !empty($_POST['catavatar-emailcat']), '$uncache' => time(), '$uid' => local_user(), diff --git a/curweather/curweather.php b/curweather/curweather.php index 3382e731..85fd4a60 100644 --- a/curweather/curweather.php +++ b/curweather/curweather.php @@ -137,7 +137,7 @@ function curweather_network_mod_init(App $a, &$b) if ($ok) { $t = Renderer::getMarkupTemplate("widget.tpl", "addon/curweather/" ); - $curweather = replace_macros ($t, [ + $curweather = Renderer::replaceMacros($t, [ '$title' => L10n::t("Current Weather"), '$icon' => ProxyUtils::proxifyUrl('http://openweathermap.org/img/w/'.$res['icon'].'.png'), '$city' => $res['city'], @@ -200,7 +200,7 @@ function curweather_addon_settings(App $a, &$s) // load template and replace the macros $t = Renderer::getMarkupTemplate("settings.tpl", "addon/curweather/" ); - $s = replace_macros ($t, [ + $s = Renderer::replaceMacros($t, [ '$submit' => L10n::t('Save Settings'), '$header' => L10n::t('Current Weather').' '.L10n::t('Settings'), '$noappidtext' => $noappidtext, @@ -240,7 +240,7 @@ function curweather_addon_admin(App $a, &$o) $t = Renderer::getMarkupTemplate("admin.tpl", "addon/curweather/" ); - $o = replace_macros ($t, [ + $o = Renderer::replaceMacros($t, [ '$submit' => L10n::t('Save Settings'), '$cachetime' => [ 'cachetime', From 37ebd7d2a8d7e6a45b102099af85d1ace12eb66c Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Thu, 1 Nov 2018 08:06:45 +0100 Subject: [PATCH 08/14] DE morechoice translation update THX vinz --- morechoice/lang/de/messages.po | 10 +++++----- morechoice/lang/de/strings.php | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/morechoice/lang/de/messages.po b/morechoice/lang/de/messages.po index b4d20ca3..4f1bc2d4 100644 --- a/morechoice/lang/de/messages.po +++ b/morechoice/lang/de/messages.po @@ -10,7 +10,7 @@ msgstr "" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-08-07 15:04+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: Tobias Diekershoff , 2018\n" +"Last-Translator: Vinzenz Vietzke , 2018\n" "Language-Team: German (https://www.transifex.com/Friendica/teams/12172/de/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -120,7 +120,7 @@ msgstr "Millionäre" #: morechoice.php:62 msgid "Guys with big schlongs" -msgstr "" +msgstr "Typen mit großen Schwänzen" #: morechoice.php:63 msgid "Easy women" @@ -236,7 +236,7 @@ msgstr "Muttermilch" #: morechoice.php:91 msgid "Immersing genitals in liquids" -msgstr "" +msgstr "Eintauchen von Genitalien in Flüssigkeiten" #: morechoice.php:92 msgid "Giants" @@ -292,11 +292,11 @@ msgstr "Schlafende Personen" #: morechoice.php:105 msgid "Urination" -msgstr "" +msgstr "Urinieren" #: morechoice.php:106 msgid "Eating people" -msgstr "" +msgstr "Essende Menschen" #: morechoice.php:107 msgid "Being eaten" diff --git a/morechoice/lang/de/strings.php b/morechoice/lang/de/strings.php index 682d2ba1..c1ea3ba6 100644 --- a/morechoice/lang/de/strings.php +++ b/morechoice/lang/de/strings.php @@ -31,7 +31,7 @@ $a->strings["Can't remember"] = "Kann mich nicht erinnern"; $a->strings["Hard to tell these days"] = "Schwer zu sagen dieser Tage"; $a->strings["Girls with big tits"] = "Mädels mit großen Brüsten"; $a->strings["Millionaires"] = "Millionäre"; -$a->strings["Guys with big schlongs"] = ""; +$a->strings["Guys with big schlongs"] = "Typen mit großen Schwänzen"; $a->strings["Easy women"] = "Leichte Frauen"; $a->strings["People with impaired mobility"] = "Menschen mit eingeschränkter Mobilität"; $a->strings["Amputees"] = "Amputierte"; @@ -60,7 +60,7 @@ $a->strings["Transgender people"] = "Transgender Personen"; $a->strings["Criminals"] = "Kriminelle"; $a->strings["Stealing"] = "Stehlen"; $a->strings["Breast milk"] = "Muttermilch"; -$a->strings["Immersing genitals in liquids"] = ""; +$a->strings["Immersing genitals in liquids"] = "Eintauchen von Genitalien in Flüssigkeiten"; $a->strings["Giants"] = "Riesen"; $a->strings["Masochism"] = "Masochismus"; $a->strings["Cars"] = "Autos"; @@ -74,8 +74,8 @@ $a->strings["Smells"] = "Gerüche"; $a->strings["Buttocks"] = "Hintern"; $a->strings["Nonliving objects"] = "Leblose Objekte"; $a->strings["Sleeping people"] = "Schlafende Personen"; -$a->strings["Urination"] = ""; -$a->strings["Eating people"] = ""; +$a->strings["Urination"] = "Urinieren"; +$a->strings["Eating people"] = "Essende Menschen"; $a->strings["Being eaten"] = "Verspeist zu werden"; $a->strings["Animals"] = "Tiere"; $a->strings["I'd rather just have some chocolate"] = "Ich bevorzuge eine Tafel Schokolade"; From 1a2b0b25655c85c3d4fad4b4f768d56d466d4282 Mon Sep 17 00:00:00 2001 From: Adam Magness Date: Sat, 3 Nov 2018 13:16:21 -0400 Subject: [PATCH 09/14] Implement xml functions implement functions moved to xml class --- blogger/blogger.php | 7 ++++--- dwpost/dwpost.php | 3 ++- ijpost/ijpost.php | 3 ++- ljpost/ljpost.php | 15 ++++++++------- pumpio/pumpio.php | 3 ++- qcomment/qcomment.php | 14 ++++++++------ wppost/wppost.php | 7 ++++--- 7 files changed, 30 insertions(+), 22 deletions(-) diff --git a/blogger/blogger.php b/blogger/blogger.php index bf4c7eac..ee79032f 100644 --- a/blogger/blogger.php +++ b/blogger/blogger.php @@ -13,6 +13,7 @@ use Friendica\Core\L10n; use Friendica\Core\Logger; use Friendica\Core\PConfig; use Friendica\Util\Network; +use Friendica\Util\XML; function blogger_install() { @@ -178,14 +179,14 @@ function blogger_send(App $a, array &$b) return; } - $bl_username = xmlify(PConfig::get($b['uid'], 'blogger', 'bl_username')); - $bl_password = xmlify(PConfig::get($b['uid'], 'blogger', 'bl_password')); + $bl_username = XML::xmlify(PConfig::get($b['uid'], 'blogger', 'bl_username')); + $bl_password = XML::xmlify(PConfig::get($b['uid'], 'blogger', 'bl_password')); $bl_blog = PConfig::get($b['uid'], 'blogger', 'bl_blog'); if ($bl_username && $bl_password && $bl_blog) { $title = '' . (($b['title']) ? $b['title'] : L10n::t('Post from Friendica')) . ''; $post = $title . BBCode::convert($b['body']); - $post = xmlify($post); + $post = XML::xmlify($post); $xml = <<< EOT diff --git a/dwpost/dwpost.php b/dwpost/dwpost.php index a75fb878..eec1ea78 100644 --- a/dwpost/dwpost.php +++ b/dwpost/dwpost.php @@ -17,6 +17,7 @@ use Friendica\Core\PConfig; use Friendica\Database\DBA; use Friendica\Util\DateTimeFormat; use Friendica\Util\Network; +use Friendica\Util\XML; function dwpost_install() { @@ -189,7 +190,7 @@ function dwpost_send(App $a, array &$b) if ($dw_username && $dw_password && $dw_blog) { $title = $b['title']; $post = BBCode::convert($b['body']); - $post = xmlify($post); + $post = XML::xmlify($post); $tags = dwpost_get_tags($b['tag']); $date = DateTimeFormat::convert($b['created'], $tz); diff --git a/ijpost/ijpost.php b/ijpost/ijpost.php index a5f98f45..f9242a18 100644 --- a/ijpost/ijpost.php +++ b/ijpost/ijpost.php @@ -15,6 +15,7 @@ use Friendica\Core\Logger; use Friendica\Core\PConfig; use Friendica\Util\DateTimeFormat; use Friendica\Util\Network; +use Friendica\Util\XML; function ijpost_install() { @@ -185,7 +186,7 @@ function ijpost_send(&$a, &$b) if ($ij_username && $ij_password && $ij_blog) { $title = $b['title']; $post = BBCode::convert($b['body']); - $post = xmlify($post); + $post = XML::xmlify($post); $tags = ijpost_get_tags($b['tag']); $date = DateTimeFormat::convert($b['created'], $tz); diff --git a/ljpost/ljpost.php b/ljpost/ljpost.php index c7857000..47eab5dc 100644 --- a/ljpost/ljpost.php +++ b/ljpost/ljpost.php @@ -15,6 +15,7 @@ use Friendica\Core\Logger; use Friendica\Core\PConfig; use Friendica\Util\DateTimeFormat; use Friendica\Util\Network; +use Friendica\Util\XML; function ljpost_install() { Addon::registerHook('post_local', 'addon/ljpost/ljpost.php', 'ljpost_post_local'); @@ -169,20 +170,20 @@ function ljpost_send(&$a,&$b) { if($x && strlen($x[0]['timezone'])) $tz = $x[0]['timezone']; - $lj_username = xmlify(PConfig::get($b['uid'],'ljpost','lj_username')); - $lj_password = xmlify(PConfig::get($b['uid'],'ljpost','lj_password')); - $lj_journal = xmlify(PConfig::get($b['uid'],'ljpost','lj_journal')); + $lj_username = XML::xmlify(PConfig::get($b['uid'],'ljpost','lj_username')); + $lj_password = XML::xmlify(PConfig::get($b['uid'],'ljpost','lj_password')); + $lj_journal = XML::xmlify(PConfig::get($b['uid'],'ljpost','lj_journal')); // if(! $lj_journal) // $lj_journal = $lj_username; - $lj_blog = xmlify(PConfig::get($b['uid'],'ljpost','lj_blog')); + $lj_blog = XML::xmlify(PConfig::get($b['uid'],'ljpost','lj_blog')); if(! strlen($lj_blog)) - $lj_blog = xmlify('http://www.livejournal.com/interface/xmlrpc'); + $lj_blog = XML::xmlify('http://www.livejournal.com/interface/xmlrpc'); if($lj_username && $lj_password && $lj_blog) { - $title = xmlify($b['title']); + $title = XML::xmlify($b['title']); $post = BBCode::convert($b['body']); - $post = xmlify($post); + $post = XML::xmlify($post); $tags = ljpost_get_tags($b['tag']); $date = DateTimeFormat::convert($b['created'], $tz); diff --git a/pumpio/pumpio.php b/pumpio/pumpio.php index 0b7b7fac..383ed0b6 100644 --- a/pumpio/pumpio.php +++ b/pumpio/pumpio.php @@ -25,6 +25,7 @@ use Friendica\Model\Queue; use Friendica\Model\User; use Friendica\Util\DateTimeFormat; use Friendica\Util\Network; +use Friendica\Util\XML; require 'addon/pumpio/oauth/http.php'; require 'addon/pumpio/oauth/oauth_client.php'; @@ -981,7 +982,7 @@ function pumpio_dolike(App $a, $uid, $self, $post, $own_id, $threadcompletion = $likedata['body'] = L10n::t('%1$s likes %2$s\'s %3$s', $author, $objauthor, $plink); $likedata['object'] = '' . ACTIVITY_OBJ_NOTE . '1' . - '' . $orig_post['uri'] . '' . xmlify('') . '' . $orig_post['title'] . '' . $orig_post['body'] . ''; + '' . $orig_post['uri'] . '' . XML::xmlify('') . '' . $orig_post['title'] . '' . $orig_post['body'] . ''; $ret = Item::insert($likedata); diff --git a/qcomment/qcomment.php b/qcomment/qcomment.php index 2ce81d99..f1a23266 100644 --- a/qcomment/qcomment.php +++ b/qcomment/qcomment.php @@ -20,6 +20,7 @@ use Friendica\Core\Addon; use Friendica\Core\L10n; use Friendica\Core\PConfig; +use Friendica\Util\XML; function qcomment_install() { Addon::registerHook('addon_settings', 'addon/qcomment/qcomment.php', 'qcomment_addon_settings'); @@ -50,7 +51,7 @@ function qcomment_addon_settings(&$a, &$s) $s .= '
'; $s .= '
' . L10n::t("Quick comments are found near comment boxes, sometimes hidden. Click them to provide simple replies.") . '
'; $s .= ''; - $s .= ''; + $s .= ''; $s .= '
'; $s .= '
'; @@ -59,13 +60,14 @@ function qcomment_addon_settings(&$a, &$s) return; } -function qcomment_addon_settings_post(&$a,&$b) { - - if(! local_user()) +function qcomment_addon_settings_post(&$a, &$b) +{ + if (! local_user()) { return; + } - if($_POST['qcomment-submit']) { - PConfig::set(local_user(),'qcomment','words',xmlify($_POST['qcomment-words'])); + if ($_POST['qcomment-submit']) { + PConfig::set(local_user(), 'qcomment', 'words', XML::xmlify($_POST['qcomment-words'])); info(L10n::t('Quick Comment settings saved.') . EOL); } } diff --git a/wppost/wppost.php b/wppost/wppost.php index 107d8c0c..27061978 100644 --- a/wppost/wppost.php +++ b/wppost/wppost.php @@ -14,6 +14,7 @@ use Friendica\Core\Logger; use Friendica\Core\PConfig; use Friendica\Database\DBA; use Friendica\Util\Network; +use Friendica\Util\XML; function wppost_install() { Addon::registerHook('post_local', 'addon/wppost/wppost.php', 'wppost_post_local'); @@ -216,8 +217,8 @@ function wppost_send(&$a,&$b) { return; } - $wp_username = xmlify(PConfig::get($b['uid'],'wppost','wp_username')); - $wp_password = xmlify(PConfig::get($b['uid'],'wppost','wp_password')); + $wp_username = XML::(PConfig::get($b['uid'], 'wppost', 'wp_username')); + $wp_password = XML::xmlify(PConfig::get($b['uid'], 'wppost',' wp_password')); $wp_blog = PConfig::get($b['uid'],'wppost','wp_blog'); $wp_backlink_text = PConfig::get($b['uid'],'wppost','wp_backlink_text'); if ($wp_backlink_text == '') { @@ -294,7 +295,7 @@ function wppost_send(&$a,&$b) { . $wp_backlink_text . '' . EOL . EOL; } - $post = xmlify($post); + $post = XML::xmlify($post); $xml = <<< EOT From 7f1fda43aea76a01dfaffba565af94cd2eb28ead Mon Sep 17 00:00:00 2001 From: Adam Magness Date: Sun, 4 Nov 2018 08:24:49 -0500 Subject: [PATCH 10/14] Update function calls update function calls to new names --- blogger/blogger.php | 6 +++--- dwpost/dwpost.php | 2 +- ijpost/ijpost.php | 2 +- ljpost/ljpost.php | 14 +++++++------- pumpio/pumpio.php | 2 +- qcomment/qcomment.php | 4 ++-- wppost/wppost.php | 4 ++-- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/blogger/blogger.php b/blogger/blogger.php index ee79032f..496a47c8 100644 --- a/blogger/blogger.php +++ b/blogger/blogger.php @@ -179,14 +179,14 @@ function blogger_send(App $a, array &$b) return; } - $bl_username = XML::xmlify(PConfig::get($b['uid'], 'blogger', 'bl_username')); - $bl_password = XML::xmlify(PConfig::get($b['uid'], 'blogger', 'bl_password')); + $bl_username = XML::escape(PConfig::get($b['uid'], 'blogger', 'bl_username')); + $bl_password = XML::escape(PConfig::get($b['uid'], 'blogger', 'bl_password')); $bl_blog = PConfig::get($b['uid'], 'blogger', 'bl_blog'); if ($bl_username && $bl_password && $bl_blog) { $title = '' . (($b['title']) ? $b['title'] : L10n::t('Post from Friendica')) . ''; $post = $title . BBCode::convert($b['body']); - $post = XML::xmlify($post); + $post = XML::escape($post); $xml = <<< EOT diff --git a/dwpost/dwpost.php b/dwpost/dwpost.php index eec1ea78..28ae2d97 100644 --- a/dwpost/dwpost.php +++ b/dwpost/dwpost.php @@ -190,7 +190,7 @@ function dwpost_send(App $a, array &$b) if ($dw_username && $dw_password && $dw_blog) { $title = $b['title']; $post = BBCode::convert($b['body']); - $post = XML::xmlify($post); + $post = XML::escape($post); $tags = dwpost_get_tags($b['tag']); $date = DateTimeFormat::convert($b['created'], $tz); diff --git a/ijpost/ijpost.php b/ijpost/ijpost.php index f9242a18..d2a3071e 100644 --- a/ijpost/ijpost.php +++ b/ijpost/ijpost.php @@ -186,7 +186,7 @@ function ijpost_send(&$a, &$b) if ($ij_username && $ij_password && $ij_blog) { $title = $b['title']; $post = BBCode::convert($b['body']); - $post = XML::xmlify($post); + $post = XML::escape($post); $tags = ijpost_get_tags($b['tag']); $date = DateTimeFormat::convert($b['created'], $tz); diff --git a/ljpost/ljpost.php b/ljpost/ljpost.php index 47eab5dc..c60af03c 100644 --- a/ljpost/ljpost.php +++ b/ljpost/ljpost.php @@ -170,20 +170,20 @@ function ljpost_send(&$a,&$b) { if($x && strlen($x[0]['timezone'])) $tz = $x[0]['timezone']; - $lj_username = XML::xmlify(PConfig::get($b['uid'],'ljpost','lj_username')); - $lj_password = XML::xmlify(PConfig::get($b['uid'],'ljpost','lj_password')); - $lj_journal = XML::xmlify(PConfig::get($b['uid'],'ljpost','lj_journal')); + $lj_username = XML::escape(PConfig::get($b['uid'],'ljpost','lj_username')); + $lj_password = XML::escape(PConfig::get($b['uid'],'ljpost','lj_password')); + $lj_journal = XML::escape(PConfig::get($b['uid'],'ljpost','lj_journal')); // if(! $lj_journal) // $lj_journal = $lj_username; - $lj_blog = XML::xmlify(PConfig::get($b['uid'],'ljpost','lj_blog')); + $lj_blog = XML::escape(PConfig::get($b['uid'],'ljpost','lj_blog')); if(! strlen($lj_blog)) - $lj_blog = XML::xmlify('http://www.livejournal.com/interface/xmlrpc'); + $lj_blog = XML::escape('http://www.livejournal.com/interface/xmlrpc'); if($lj_username && $lj_password && $lj_blog) { - $title = XML::xmlify($b['title']); + $title = XML::escape($b['title']); $post = BBCode::convert($b['body']); - $post = XML::xmlify($post); + $post = XML::escape($post); $tags = ljpost_get_tags($b['tag']); $date = DateTimeFormat::convert($b['created'], $tz); diff --git a/pumpio/pumpio.php b/pumpio/pumpio.php index 383ed0b6..6d3fe62d 100644 --- a/pumpio/pumpio.php +++ b/pumpio/pumpio.php @@ -982,7 +982,7 @@ function pumpio_dolike(App $a, $uid, $self, $post, $own_id, $threadcompletion = $likedata['body'] = L10n::t('%1$s likes %2$s\'s %3$s', $author, $objauthor, $plink); $likedata['object'] = '' . ACTIVITY_OBJ_NOTE . '1' . - '' . $orig_post['uri'] . '' . XML::xmlify('') . '' . $orig_post['title'] . '' . $orig_post['body'] . ''; + '' . $orig_post['uri'] . '' . XML::escape('') . '' . $orig_post['title'] . '' . $orig_post['body'] . ''; $ret = Item::insert($likedata); diff --git a/qcomment/qcomment.php b/qcomment/qcomment.php index f1a23266..16c5a44c 100644 --- a/qcomment/qcomment.php +++ b/qcomment/qcomment.php @@ -51,7 +51,7 @@ function qcomment_addon_settings(&$a, &$s) $s .= '
'; $s .= '
' . L10n::t("Quick comments are found near comment boxes, sometimes hidden. Click them to provide simple replies.") . '
'; $s .= ''; - $s .= ''; + $s .= ''; $s .= '
'; $s .= '
'; @@ -67,7 +67,7 @@ function qcomment_addon_settings_post(&$a, &$b) } if ($_POST['qcomment-submit']) { - PConfig::set(local_user(), 'qcomment', 'words', XML::xmlify($_POST['qcomment-words'])); + PConfig::set(local_user(), 'qcomment', 'words', XML::escape($_POST['qcomment-words'])); info(L10n::t('Quick Comment settings saved.') . EOL); } } diff --git a/wppost/wppost.php b/wppost/wppost.php index 27061978..47c30a59 100644 --- a/wppost/wppost.php +++ b/wppost/wppost.php @@ -218,7 +218,7 @@ function wppost_send(&$a,&$b) { } $wp_username = XML::(PConfig::get($b['uid'], 'wppost', 'wp_username')); - $wp_password = XML::xmlify(PConfig::get($b['uid'], 'wppost',' wp_password')); + $wp_password = XML::escape(PConfig::get($b['uid'], 'wppost',' wp_password')); $wp_blog = PConfig::get($b['uid'],'wppost','wp_blog'); $wp_backlink_text = PConfig::get($b['uid'],'wppost','wp_backlink_text'); if ($wp_backlink_text == '') { @@ -295,7 +295,7 @@ function wppost_send(&$a,&$b) { . $wp_backlink_text . '' . EOL . EOL; } - $post = XML::xmlify($post); + $post = XML::escape($post); $xml = <<< EOT From b8df74beca283afbdba2da9d8ef7fa1f10e8e4dd Mon Sep 17 00:00:00 2001 From: Adam Magness Date: Mon, 5 Nov 2018 07:47:04 -0500 Subject: [PATCH 11/14] update function calls update function calls to new class --- blogger/blogger.php | 8 ++++---- dwpost/dwpost.php | 4 ++-- ijpost/ijpost.php | 4 ++-- ljpost/ljpost.php | 16 ++++++++-------- pumpio/pumpio.php | 4 ++-- qcomment/qcomment.php | 6 +++--- wppost/wppost.php | 8 ++++---- 7 files changed, 25 insertions(+), 25 deletions(-) diff --git a/blogger/blogger.php b/blogger/blogger.php index 496a47c8..8d8051b0 100644 --- a/blogger/blogger.php +++ b/blogger/blogger.php @@ -13,7 +13,7 @@ use Friendica\Core\L10n; use Friendica\Core\Logger; use Friendica\Core\PConfig; use Friendica\Util\Network; -use Friendica\Util\XML; +use Friendica\Util\Strings; function blogger_install() { @@ -179,14 +179,14 @@ function blogger_send(App $a, array &$b) return; } - $bl_username = XML::escape(PConfig::get($b['uid'], 'blogger', 'bl_username')); - $bl_password = XML::escape(PConfig::get($b['uid'], 'blogger', 'bl_password')); + $bl_username = Strings::escape(PConfig::get($b['uid'], 'blogger', 'bl_username')); + $bl_password = Strings::escape(PConfig::get($b['uid'], 'blogger', 'bl_password')); $bl_blog = PConfig::get($b['uid'], 'blogger', 'bl_blog'); if ($bl_username && $bl_password && $bl_blog) { $title = '' . (($b['title']) ? $b['title'] : L10n::t('Post from Friendica')) . ''; $post = $title . BBCode::convert($b['body']); - $post = XML::escape($post); + $post = Strings::escape($post); $xml = <<< EOT diff --git a/dwpost/dwpost.php b/dwpost/dwpost.php index 28ae2d97..b0bb7264 100644 --- a/dwpost/dwpost.php +++ b/dwpost/dwpost.php @@ -17,7 +17,7 @@ use Friendica\Core\PConfig; use Friendica\Database\DBA; use Friendica\Util\DateTimeFormat; use Friendica\Util\Network; -use Friendica\Util\XML; +use Friendica\Util\Strings; function dwpost_install() { @@ -190,7 +190,7 @@ function dwpost_send(App $a, array &$b) if ($dw_username && $dw_password && $dw_blog) { $title = $b['title']; $post = BBCode::convert($b['body']); - $post = XML::escape($post); + $post = Strings::escape($post); $tags = dwpost_get_tags($b['tag']); $date = DateTimeFormat::convert($b['created'], $tz); diff --git a/ijpost/ijpost.php b/ijpost/ijpost.php index d2a3071e..1203d2f4 100644 --- a/ijpost/ijpost.php +++ b/ijpost/ijpost.php @@ -15,7 +15,7 @@ use Friendica\Core\Logger; use Friendica\Core\PConfig; use Friendica\Util\DateTimeFormat; use Friendica\Util\Network; -use Friendica\Util\XML; +use Friendica\Util\Strings; function ijpost_install() { @@ -186,7 +186,7 @@ function ijpost_send(&$a, &$b) if ($ij_username && $ij_password && $ij_blog) { $title = $b['title']; $post = BBCode::convert($b['body']); - $post = XML::escape($post); + $post = Strings::escape($post); $tags = ijpost_get_tags($b['tag']); $date = DateTimeFormat::convert($b['created'], $tz); diff --git a/ljpost/ljpost.php b/ljpost/ljpost.php index c60af03c..5c30e09d 100644 --- a/ljpost/ljpost.php +++ b/ljpost/ljpost.php @@ -15,7 +15,7 @@ use Friendica\Core\Logger; use Friendica\Core\PConfig; use Friendica\Util\DateTimeFormat; use Friendica\Util\Network; -use Friendica\Util\XML; +use Friendica\Util\Strings; function ljpost_install() { Addon::registerHook('post_local', 'addon/ljpost/ljpost.php', 'ljpost_post_local'); @@ -170,20 +170,20 @@ function ljpost_send(&$a,&$b) { if($x && strlen($x[0]['timezone'])) $tz = $x[0]['timezone']; - $lj_username = XML::escape(PConfig::get($b['uid'],'ljpost','lj_username')); - $lj_password = XML::escape(PConfig::get($b['uid'],'ljpost','lj_password')); - $lj_journal = XML::escape(PConfig::get($b['uid'],'ljpost','lj_journal')); + $lj_username = Strings::escape(PConfig::get($b['uid'],'ljpost','lj_username')); + $lj_password = Strings::escape(PConfig::get($b['uid'],'ljpost','lj_password')); + $lj_journal = Strings::escape(PConfig::get($b['uid'],'ljpost','lj_journal')); // if(! $lj_journal) // $lj_journal = $lj_username; - $lj_blog = XML::escape(PConfig::get($b['uid'],'ljpost','lj_blog')); + $lj_blog = Strings::escape(PConfig::get($b['uid'],'ljpost','lj_blog')); if(! strlen($lj_blog)) - $lj_blog = XML::escape('http://www.livejournal.com/interface/xmlrpc'); + $lj_blog = Strings::escape('http://www.livejournal.com/interface/xmlrpc'); if($lj_username && $lj_password && $lj_blog) { - $title = XML::escape($b['title']); + $title = Strings::escape($b['title']); $post = BBCode::convert($b['body']); - $post = XML::escape($post); + $post = Strings::escape($post); $tags = ljpost_get_tags($b['tag']); $date = DateTimeFormat::convert($b['created'], $tz); diff --git a/pumpio/pumpio.php b/pumpio/pumpio.php index 6d3fe62d..7aa094c9 100644 --- a/pumpio/pumpio.php +++ b/pumpio/pumpio.php @@ -25,7 +25,7 @@ use Friendica\Model\Queue; use Friendica\Model\User; use Friendica\Util\DateTimeFormat; use Friendica\Util\Network; -use Friendica\Util\XML; +use Friendica\Util\Strings; require 'addon/pumpio/oauth/http.php'; require 'addon/pumpio/oauth/oauth_client.php'; @@ -982,7 +982,7 @@ function pumpio_dolike(App $a, $uid, $self, $post, $own_id, $threadcompletion = $likedata['body'] = L10n::t('%1$s likes %2$s\'s %3$s', $author, $objauthor, $plink); $likedata['object'] = '' . ACTIVITY_OBJ_NOTE . '1' . - '' . $orig_post['uri'] . '' . XML::escape('') . '' . $orig_post['title'] . '' . $orig_post['body'] . ''; + '' . $orig_post['uri'] . '' . Strings::escape('') . '' . $orig_post['title'] . '' . $orig_post['body'] . ''; $ret = Item::insert($likedata); diff --git a/qcomment/qcomment.php b/qcomment/qcomment.php index 16c5a44c..5089c27d 100644 --- a/qcomment/qcomment.php +++ b/qcomment/qcomment.php @@ -20,7 +20,7 @@ use Friendica\Core\Addon; use Friendica\Core\L10n; use Friendica\Core\PConfig; -use Friendica\Util\XML; +use Friendica\Util\Strings; function qcomment_install() { Addon::registerHook('addon_settings', 'addon/qcomment/qcomment.php', 'qcomment_addon_settings'); @@ -51,7 +51,7 @@ function qcomment_addon_settings(&$a, &$s) $s .= '
'; $s .= '
' . L10n::t("Quick comments are found near comment boxes, sometimes hidden. Click them to provide simple replies.") . '
'; $s .= ''; - $s .= ''; + $s .= ''; $s .= '
'; $s .= '
'; @@ -67,7 +67,7 @@ function qcomment_addon_settings_post(&$a, &$b) } if ($_POST['qcomment-submit']) { - PConfig::set(local_user(), 'qcomment', 'words', XML::escape($_POST['qcomment-words'])); + PConfig::set(local_user(), 'qcomment', 'words', Strings::escape($_POST['qcomment-words'])); info(L10n::t('Quick Comment settings saved.') . EOL); } } diff --git a/wppost/wppost.php b/wppost/wppost.php index 47c30a59..44a06016 100644 --- a/wppost/wppost.php +++ b/wppost/wppost.php @@ -14,7 +14,7 @@ use Friendica\Core\Logger; use Friendica\Core\PConfig; use Friendica\Database\DBA; use Friendica\Util\Network; -use Friendica\Util\XML; +use Friendica\Util\Strings; function wppost_install() { Addon::registerHook('post_local', 'addon/wppost/wppost.php', 'wppost_post_local'); @@ -217,8 +217,8 @@ function wppost_send(&$a,&$b) { return; } - $wp_username = XML::(PConfig::get($b['uid'], 'wppost', 'wp_username')); - $wp_password = XML::escape(PConfig::get($b['uid'], 'wppost',' wp_password')); + $wp_username = Strings::escape(PConfig::get($b['uid'], 'wppost', 'wp_username')); + $wp_password = Strings::escape(PConfig::get($b['uid'], 'wppost',' wp_password')); $wp_blog = PConfig::get($b['uid'],'wppost','wp_blog'); $wp_backlink_text = PConfig::get($b['uid'],'wppost','wp_backlink_text'); if ($wp_backlink_text == '') { @@ -295,7 +295,7 @@ function wppost_send(&$a,&$b) { . $wp_backlink_text . '' . EOL . EOL; } - $post = XML::escape($post); + $post = Strings::escape($post); $xml = <<< EOT From 1af505701b5e341dcb57fd2e8b3c41461e84d9c5 Mon Sep 17 00:00:00 2001 From: Adam Magness Date: Mon, 5 Nov 2018 07:47:04 -0500 Subject: [PATCH 12/14] Revert "update function calls" This reverts commit b8df74beca283afbdba2da9d8ef7fa1f10e8e4dd. --- blogger/blogger.php | 8 ++++---- dwpost/dwpost.php | 4 ++-- ijpost/ijpost.php | 4 ++-- ljpost/ljpost.php | 16 ++++++++-------- pumpio/pumpio.php | 4 ++-- qcomment/qcomment.php | 6 +++--- wppost/wppost.php | 8 ++++---- 7 files changed, 25 insertions(+), 25 deletions(-) diff --git a/blogger/blogger.php b/blogger/blogger.php index 8d8051b0..496a47c8 100644 --- a/blogger/blogger.php +++ b/blogger/blogger.php @@ -13,7 +13,7 @@ use Friendica\Core\L10n; use Friendica\Core\Logger; use Friendica\Core\PConfig; use Friendica\Util\Network; -use Friendica\Util\Strings; +use Friendica\Util\XML; function blogger_install() { @@ -179,14 +179,14 @@ function blogger_send(App $a, array &$b) return; } - $bl_username = Strings::escape(PConfig::get($b['uid'], 'blogger', 'bl_username')); - $bl_password = Strings::escape(PConfig::get($b['uid'], 'blogger', 'bl_password')); + $bl_username = XML::escape(PConfig::get($b['uid'], 'blogger', 'bl_username')); + $bl_password = XML::escape(PConfig::get($b['uid'], 'blogger', 'bl_password')); $bl_blog = PConfig::get($b['uid'], 'blogger', 'bl_blog'); if ($bl_username && $bl_password && $bl_blog) { $title = '' . (($b['title']) ? $b['title'] : L10n::t('Post from Friendica')) . ''; $post = $title . BBCode::convert($b['body']); - $post = Strings::escape($post); + $post = XML::escape($post); $xml = <<< EOT diff --git a/dwpost/dwpost.php b/dwpost/dwpost.php index b0bb7264..28ae2d97 100644 --- a/dwpost/dwpost.php +++ b/dwpost/dwpost.php @@ -17,7 +17,7 @@ use Friendica\Core\PConfig; use Friendica\Database\DBA; use Friendica\Util\DateTimeFormat; use Friendica\Util\Network; -use Friendica\Util\Strings; +use Friendica\Util\XML; function dwpost_install() { @@ -190,7 +190,7 @@ function dwpost_send(App $a, array &$b) if ($dw_username && $dw_password && $dw_blog) { $title = $b['title']; $post = BBCode::convert($b['body']); - $post = Strings::escape($post); + $post = XML::escape($post); $tags = dwpost_get_tags($b['tag']); $date = DateTimeFormat::convert($b['created'], $tz); diff --git a/ijpost/ijpost.php b/ijpost/ijpost.php index 1203d2f4..d2a3071e 100644 --- a/ijpost/ijpost.php +++ b/ijpost/ijpost.php @@ -15,7 +15,7 @@ use Friendica\Core\Logger; use Friendica\Core\PConfig; use Friendica\Util\DateTimeFormat; use Friendica\Util\Network; -use Friendica\Util\Strings; +use Friendica\Util\XML; function ijpost_install() { @@ -186,7 +186,7 @@ function ijpost_send(&$a, &$b) if ($ij_username && $ij_password && $ij_blog) { $title = $b['title']; $post = BBCode::convert($b['body']); - $post = Strings::escape($post); + $post = XML::escape($post); $tags = ijpost_get_tags($b['tag']); $date = DateTimeFormat::convert($b['created'], $tz); diff --git a/ljpost/ljpost.php b/ljpost/ljpost.php index 5c30e09d..c60af03c 100644 --- a/ljpost/ljpost.php +++ b/ljpost/ljpost.php @@ -15,7 +15,7 @@ use Friendica\Core\Logger; use Friendica\Core\PConfig; use Friendica\Util\DateTimeFormat; use Friendica\Util\Network; -use Friendica\Util\Strings; +use Friendica\Util\XML; function ljpost_install() { Addon::registerHook('post_local', 'addon/ljpost/ljpost.php', 'ljpost_post_local'); @@ -170,20 +170,20 @@ function ljpost_send(&$a,&$b) { if($x && strlen($x[0]['timezone'])) $tz = $x[0]['timezone']; - $lj_username = Strings::escape(PConfig::get($b['uid'],'ljpost','lj_username')); - $lj_password = Strings::escape(PConfig::get($b['uid'],'ljpost','lj_password')); - $lj_journal = Strings::escape(PConfig::get($b['uid'],'ljpost','lj_journal')); + $lj_username = XML::escape(PConfig::get($b['uid'],'ljpost','lj_username')); + $lj_password = XML::escape(PConfig::get($b['uid'],'ljpost','lj_password')); + $lj_journal = XML::escape(PConfig::get($b['uid'],'ljpost','lj_journal')); // if(! $lj_journal) // $lj_journal = $lj_username; - $lj_blog = Strings::escape(PConfig::get($b['uid'],'ljpost','lj_blog')); + $lj_blog = XML::escape(PConfig::get($b['uid'],'ljpost','lj_blog')); if(! strlen($lj_blog)) - $lj_blog = Strings::escape('http://www.livejournal.com/interface/xmlrpc'); + $lj_blog = XML::escape('http://www.livejournal.com/interface/xmlrpc'); if($lj_username && $lj_password && $lj_blog) { - $title = Strings::escape($b['title']); + $title = XML::escape($b['title']); $post = BBCode::convert($b['body']); - $post = Strings::escape($post); + $post = XML::escape($post); $tags = ljpost_get_tags($b['tag']); $date = DateTimeFormat::convert($b['created'], $tz); diff --git a/pumpio/pumpio.php b/pumpio/pumpio.php index 7aa094c9..6d3fe62d 100644 --- a/pumpio/pumpio.php +++ b/pumpio/pumpio.php @@ -25,7 +25,7 @@ use Friendica\Model\Queue; use Friendica\Model\User; use Friendica\Util\DateTimeFormat; use Friendica\Util\Network; -use Friendica\Util\Strings; +use Friendica\Util\XML; require 'addon/pumpio/oauth/http.php'; require 'addon/pumpio/oauth/oauth_client.php'; @@ -982,7 +982,7 @@ function pumpio_dolike(App $a, $uid, $self, $post, $own_id, $threadcompletion = $likedata['body'] = L10n::t('%1$s likes %2$s\'s %3$s', $author, $objauthor, $plink); $likedata['object'] = '' . ACTIVITY_OBJ_NOTE . '1' . - '' . $orig_post['uri'] . '' . Strings::escape('') . '' . $orig_post['title'] . '' . $orig_post['body'] . ''; + '' . $orig_post['uri'] . '' . XML::escape('') . '' . $orig_post['title'] . '' . $orig_post['body'] . ''; $ret = Item::insert($likedata); diff --git a/qcomment/qcomment.php b/qcomment/qcomment.php index 5089c27d..16c5a44c 100644 --- a/qcomment/qcomment.php +++ b/qcomment/qcomment.php @@ -20,7 +20,7 @@ use Friendica\Core\Addon; use Friendica\Core\L10n; use Friendica\Core\PConfig; -use Friendica\Util\Strings; +use Friendica\Util\XML; function qcomment_install() { Addon::registerHook('addon_settings', 'addon/qcomment/qcomment.php', 'qcomment_addon_settings'); @@ -51,7 +51,7 @@ function qcomment_addon_settings(&$a, &$s) $s .= '
'; $s .= '
' . L10n::t("Quick comments are found near comment boxes, sometimes hidden. Click them to provide simple replies.") . '
'; $s .= ''; - $s .= ''; + $s .= ''; $s .= '
'; $s .= '
'; @@ -67,7 +67,7 @@ function qcomment_addon_settings_post(&$a, &$b) } if ($_POST['qcomment-submit']) { - PConfig::set(local_user(), 'qcomment', 'words', Strings::escape($_POST['qcomment-words'])); + PConfig::set(local_user(), 'qcomment', 'words', XML::escape($_POST['qcomment-words'])); info(L10n::t('Quick Comment settings saved.') . EOL); } } diff --git a/wppost/wppost.php b/wppost/wppost.php index 44a06016..47c30a59 100644 --- a/wppost/wppost.php +++ b/wppost/wppost.php @@ -14,7 +14,7 @@ use Friendica\Core\Logger; use Friendica\Core\PConfig; use Friendica\Database\DBA; use Friendica\Util\Network; -use Friendica\Util\Strings; +use Friendica\Util\XML; function wppost_install() { Addon::registerHook('post_local', 'addon/wppost/wppost.php', 'wppost_post_local'); @@ -217,8 +217,8 @@ function wppost_send(&$a,&$b) { return; } - $wp_username = Strings::escape(PConfig::get($b['uid'], 'wppost', 'wp_username')); - $wp_password = Strings::escape(PConfig::get($b['uid'], 'wppost',' wp_password')); + $wp_username = XML::(PConfig::get($b['uid'], 'wppost', 'wp_username')); + $wp_password = XML::escape(PConfig::get($b['uid'], 'wppost',' wp_password')); $wp_blog = PConfig::get($b['uid'],'wppost','wp_blog'); $wp_backlink_text = PConfig::get($b['uid'],'wppost','wp_backlink_text'); if ($wp_backlink_text == '') { @@ -295,7 +295,7 @@ function wppost_send(&$a,&$b) { . $wp_backlink_text . '' . EOL . EOL; } - $post = Strings::escape($post); + $post = XML::escape($post); $xml = <<< EOT From 6632ce40ebd5239dc3029b15a2e5e411687fc6cd Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 5 Nov 2018 19:05:31 +0000 Subject: [PATCH 13/14] Fix PR 770 --- wppost/wppost.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wppost/wppost.php b/wppost/wppost.php index 47c30a59..41aa240f 100644 --- a/wppost/wppost.php +++ b/wppost/wppost.php @@ -217,7 +217,7 @@ function wppost_send(&$a,&$b) { return; } - $wp_username = XML::(PConfig::get($b['uid'], 'wppost', 'wp_username')); + $wp_username = XML::escape(PConfig::get($b['uid'], 'wppost', 'wp_username')); $wp_password = XML::escape(PConfig::get($b['uid'], 'wppost',' wp_password')); $wp_blog = PConfig::get($b['uid'],'wppost','wp_blog'); $wp_backlink_text = PConfig::get($b['uid'],'wppost','wp_backlink_text'); From 90b1ef56f7415a71f22feaa34377802a4a9d0fbb Mon Sep 17 00:00:00 2001 From: Adam Magness Date: Mon, 5 Nov 2018 21:08:06 -0500 Subject: [PATCH 14/14] Functions moved to HTML update function calls to new class --- widgets/widget_friendheader.php | 3 ++- widgets/widget_friends.php | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/widgets/widget_friendheader.php b/widgets/widget_friendheader.php index df03419f..7df1ff7c 100644 --- a/widgets/widget_friendheader.php +++ b/widgets/widget_friendheader.php @@ -1,5 +1,6 @@ "; - $o .= _abs_url(contact_block()); + $o .= _abs_url(HTML::contactBlock()); $o .= "profile['nickname']."' target=new>". L10n::t('Get added to this list!') .""; return $o; diff --git a/widgets/widget_friends.php b/widgets/widget_friends.php index 36212713..f661a4f0 100644 --- a/widgets/widget_friends.php +++ b/widgets/widget_friends.php @@ -1,5 +1,6 @@ "; - $o .= _abs_url(contact_block()); + $o .= _abs_url(HTML::contactBlock()); $o .= "profile['nickname']."'>". L10n::t('Connect on Friendica!') .""; return $o; }