Merge branch 'develop' of github.com:annando/friendica-addons into twitter-notice

pull/795/head
Michael 2018-11-07 18:27:55 +00:00
commit c3fdf45b6d
63 changed files with 537 additions and 448 deletions

View File

@ -39,6 +39,8 @@ use Friendica\Content\Text\Markdown;
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;
@ -64,7 +66,7 @@ function advancedcontentfilter_install()
DBStructure::update(false, true);
logger("installed advancedcontentfilter");
Logger::log("installed advancedcontentfilter");
}
function advancedcontentfilter_uninstall()
@ -206,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'),

View File

@ -52,6 +52,8 @@
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');
@ -84,7 +86,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);
}
}
@ -96,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<br />(YYYY-MM-DD hh:mm)", $mystart, "format is <em>YYYY</em> year, <em>MM</em> month, <em>DD</em> day, <em>hh</em> hour and <em>mm</em> minute"],

View File

@ -10,8 +10,10 @@ 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;
use Friendica\Util\XML;
function blogger_install()
{
@ -177,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::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 = '<title>' . (($b['title']) ? $b['title'] : L10n::t('Post from Friendica')) . '</title>';
$post = $title . BBCode::convert($b['body']);
$post = xmlify($post);
$post = XML::escape($post);
$xml = <<< EOT
<?xml version=\"1.0\" encoding=\"utf-8\"?>
@ -202,12 +204,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);
}
}

View File

@ -12,8 +12,10 @@ 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\Renderer;
use Friendica\Database\DBA;
use Friendica\Model\ItemContent;
use Friendica\Util\Proxy as ProxyUtils;
@ -69,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'), ''],
@ -112,7 +114,7 @@ function buffer_connect(App $a)
if (!$buffer->ok) {
$o .= '<a href="' . $buffer->get_login_url() . '">Connect to Buffer!</a>';
} else {
logger("buffer_connect: authenticated");
Logger::log("buffer_connect: authenticated");
$o .= L10n::t("You are now authenticated to buffer. ");
$o .= '<br /><a href="' . $a->getBaseURL() . '/settings/connectors">' . L10n::t("return to the connector page") . '</a>';
PConfig::set(local_user(), 'buffer','access_token', $buffer->access_token);
@ -298,7 +300,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 +359,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 +409,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);
}
}
}

View File

@ -10,7 +10,9 @@ 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\Renderer;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
@ -28,7 +30,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 +42,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');
}
/**
@ -52,8 +54,8 @@ function catavatar_addon_settings(App $a, &$s)
return;
}
$t = get_markup_template('settings.tpl', 'addon/catavatar/');
$s .= replace_macros ($t, [
$t = Renderer::getMarkupTemplate('settings.tpl', 'addon/catavatar/');
$s .= Renderer::replaceMacros($t, [
'$postpost' => !empty($_POST['catavatar-morecat']) || !empty($_POST['catavatar-emailcat']),
'$uncache' => time(),
'$uid' => local_user(),

View File

@ -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,8 +136,8 @@ function curweather_network_mod_init(App $a, &$b)
}
if ($ok) {
$t = get_markup_template("widget.tpl", "addon/curweather/" );
$curweather = replace_macros ($t, [
$t = Renderer::getMarkupTemplate("widget.tpl", "addon/curweather/" );
$curweather = Renderer::replaceMacros($t, [
'$title' => L10n::t("Current Weather"),
'$icon' => ProxyUtils::proxifyUrl('http://openweathermap.org/img/w/'.$res['icon'].'.png'),
'$city' => $res['city'],
@ -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,9 +198,9 @@ 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, [
$s = Renderer::replaceMacros($t, [
'$submit' => L10n::t('Save Settings'),
'$header' => L10n::t('Current Weather').' '.L10n::t('Settings'),
'$noappidtext' => $noappidtext,
@ -237,9 +238,9 @@ 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, [
$o = Renderer::replaceMacros($t, [
'$submit' => L10n::t('Save Settings'),
'$cachetime' => [
'cachetime',

View File

@ -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))

View File

@ -12,10 +12,12 @@ 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;
use Friendica\Util\Network;
use Friendica\Util\XML;
function dwpost_install()
{
@ -188,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::escape($post);
$tags = dwpost_get_tags($b['tag']);
$date = DateTimeFormat::convert($b['created'], $tz);
@ -225,13 +227,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);
}
}

View File

@ -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],

View File

@ -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)

View File

@ -12,8 +12,10 @@ 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\Core\Renderer;
use Friendica\Object\Image;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Network;
@ -101,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')), ''],
]);
@ -126,25 +128,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 +192,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 +474,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;
}

View File

@ -9,6 +9,8 @@ use Friendica\Core\Addon;
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()
@ -54,25 +56,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"]);
@ -86,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'), ''],

View File

@ -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;
}

View File

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

View File

@ -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)

View File

@ -11,6 +11,8 @@ use Friendica\BaseModule;
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;
@ -21,7 +23,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 +33,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)
@ -70,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');
@ -106,7 +108,7 @@ function gravatar_addon_admin (&$a, &$o) {
// output Gravatar settings
$o .= '<input type="hidden" name="form_security_token" value="' . BaseModule::getFormSecurityToken("gravatarsave") .'">';
$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],

View File

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

View File

@ -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;
}

View File

@ -11,9 +11,11 @@
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;
use Friendica\Util\XML;
function ijpost_install()
{
@ -184,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::escape($post);
$tags = ijpost_get_tags($b['tag']);
$date = DateTimeFormat::convert($b['created'], $tz);
@ -221,12 +223,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);
}
}

View File

@ -11,20 +11,22 @@ use Friendica\Content\Text\BBCode;
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() {
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() {
@ -99,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.')],

View File

@ -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.') ]

View File

@ -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;

View File

@ -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();

View File

@ -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;

View File

@ -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, ''],

View File

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

View File

@ -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;
}
}

View File

@ -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);
}
}

View File

@ -11,6 +11,8 @@ use Friendica\BaseModule;
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;
@ -21,7 +23,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 +33,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)
@ -73,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');
@ -109,7 +111,7 @@ function libravatar_addon_admin(&$a, &$o)
// output Libravatar settings
$o .= '<input type="hidden" name="form_security_token" value="' . BaseModule::getFormSecurityToken("libravatarsave") .'">';
$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],
]);

View File

@ -11,9 +11,11 @@
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;
use Friendica\Util\XML;
function ljpost_install() {
Addon::registerHook('post_local', 'addon/ljpost/ljpost.php', 'ljpost_post_local');
@ -168,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::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 = 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 = 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 = xmlify($b['title']);
$title = XML::escape($b['title']);
$post = BBCode::convert($b['body']);
$post = xmlify($post);
$post = XML::escape($post);
$tags = ljpost_get_tags($b['tag']);
$date = DateTimeFormat::convert($b['created'], $tz);
@ -231,12 +233,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);
}
}

View File

@ -10,7 +10,9 @@ 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\Core\Renderer;
use Friendica\Database\DBA;
use Friendica\Util\Network;
use Friendica\Model\Item;
@ -73,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')]);
}
@ -94,7 +96,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 +125,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);
. $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 +143,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];
@ -287,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]);
@ -298,11 +300,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 +333,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 +345,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']));
}
}
@ -355,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'),
@ -412,5 +414,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);
}

View File

@ -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, ''],

View File

@ -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 <tobias.diekershoff@gmx.net>, 2018\n"
"Last-Translator: Vinzenz Vietzke <vinz@vinzv.de>, 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"

View File

@ -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";

View File

@ -10,11 +10,13 @@ use Friendica\Content\Text\BBCode;
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\Renderer;
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()
@ -63,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?')." (<a href='https://forum.friendi.ca/profile/helpers'>@helpers</a>)"],

View File

@ -12,16 +12,18 @@ use Friendica\App;
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()
{
logger("installed notifyall");
Logger::log("installed notifyall");
}
function notifyall_uninstall()
{
logger("removed notifyall");
Logger::log("removed notifyall");
}
function notifyall_module() {}
@ -104,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', ''),''],

View File

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

View File

@ -12,6 +12,8 @@ use Friendica\Core\Addon;
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;
@ -29,7 +31,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 +43,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 +167,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 = '<a href="' . $tmsserver;
@ -184,12 +186,12 @@ function openstreetmap_generate_map(&$a, &$b)
$b['html'] .= '<br/>' . $cardlink;
}
logger('generate_map: ' . $b['html'], LOGGER_DATA);
Logger::log('generate_map: ' . $b['html'], Logger::DATA);
}
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);
@ -200,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 <a href="http://wiki.openstreetmap.org/wiki/TMS" target="_blank">public tile servers</a>')],
'$nomserver' => ['nomserver', L10n::t('Nominatim (reverse geocoding) Server URL'), $nomserver, L10n::t('A list of <a href="http://wiki.openstreetmap.org/wiki/Nominatim" target="_blank">Nominatim servers</a>')],

View File

@ -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')

View File

@ -33,19 +33,21 @@
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');
Addon::registerHook('page_end', 'addon/piwik/piwik.php', 'piwik_analytics');
logger("installed piwik addon");
Logger::log("installed piwik addon");
}
function piwik_uninstall() {
Addon::unregisterHook('load_config', 'addon/piwik/piwik.php', 'piwik_load_config');
Addon::unregisterHook('page_end', 'addon/piwik/piwik.php', 'piwik_analytics');
logger("uninstalled piwik addon");
Logger::log("uninstalled piwik addon");
}
function piwik_load_config(\Friendica\App $a)
@ -95,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' ), ''],

View File

@ -8,6 +8,7 @@
*/
use Friendica\Core\Addon;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\PConfig;
function planets_install() {
@ -32,7 +33,7 @@ function planets_install() {
Addon::registerHook('addon_settings', 'addon/planets/planets.php', 'planets_settings');
Addon::registerHook('addon_settings_post', 'addon/planets/planets.php', 'planets_settings_post');
logger("installed planets");
Logger::log("installed planets");
}
@ -51,7 +52,7 @@ function planets_uninstall() {
Addon::unregisterHook('addon_settings_post', 'addon/planets/planets.php', 'planets_settings_post');
logger("removed planets");
Logger::log("removed planets");
}
@ -67,7 +68,7 @@ function planets_post_hook($a, &$item) {
*
*/
logger('planets invoked');
Logger::log('planets invoked');
if(! local_user()) /* non-zero if this is a logged in user of this system */
return;

View File

@ -11,6 +11,8 @@ use Friendica\BaseModule;
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;
@ -53,7 +55,7 @@ function public_server_register_account($a, $b)
function public_server_cron($a, $b)
{
logger("public_server: cron start");
Logger::log("public_server: cron start");
require_once('include/enotify.php');
$r = q("SELECT * FROM `user` WHERE `account_expires_on` < UTC_TIMESTAMP() + INTERVAL 5 DAY AND
@ -116,7 +118,7 @@ function public_server_cron($a, $b)
}
}
logger("public_server: cron end");
Logger::log("public_server: cron end");
}
function public_server_enotify(&$a, &$b)
@ -163,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.'),

View File

@ -12,6 +12,7 @@ use Friendica\Content\Text\HTML;
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;
@ -24,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';
@ -114,7 +116,7 @@ function pumpio_registerclient(App $a, $host)
$params["logo_url"] = $a->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 +130,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 +146,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 +154,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 +188,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 +200,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 .= '<br /><a href="'.$a->getBaseURL().'/settings/connectors">'.L10n::t("return to the connector page").'</a>';
} 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 +411,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 +419,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 +429,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 +561,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 +642,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 +673,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 +700,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 +723,7 @@ function pumpio_sync(App $a)
}
}
logger('pumpio: cron_end');
Logger::log('pumpio: cron_end');
Config::set('pumpio', 'last_poll', time());
}
@ -766,7 +768,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 +780,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 +849,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 +898,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 +909,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 +952,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;
}
@ -980,11 +982,11 @@ 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'] = '<object><type>' . ACTIVITY_OBJ_NOTE . '</type><local>1</local>' .
'<id>' . $orig_post['uri'] . '</id><link>' . xmlify('<link rel="alternate" type="text/html" href="' . xmlify($orig_post['plink']) . '" />') . '</link><title>' . $orig_post['title'] . '</title><content>' . $orig_post['body'] . '</content></object>';
'<id>' . $orig_post['uri'] . '</id><link>' . XML::escape('<link rel="alternate" type="text/html" href="' . XML::escape($orig_post['plink']) . '" />') . '</link><title>' . $orig_post['title'] . '</title><content>' . $orig_post['body'] . '</content></object>';
$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 +1434,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 +1446,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 +1462,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 +1483,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 +1597,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 +1623,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 +1686,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);
}
}

View File

@ -1,5 +1,6 @@
<?php
use Friendica\Core\Config;
use Friendica\Core\Logger;
function pumpio_sync_run(&$argv, &$argc) {
$a = Friendica\BaseObject::getApp();
@ -9,7 +10,7 @@ function pumpio_sync_run(&$argv, &$argc) {
if (function_exists('sys_getloadavg')) {
$load = sys_getloadavg();
if (intval($load[0]) > 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;
}
}

View File

@ -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 .= '<div id="qcomment-wrapper">';
$s .= '<div id="qcomment-desc">' . L10n::t("Quick comments are found near comment boxes, sometimes hidden. Click them to provide simple replies.") . '</div>';
$s .= '<label id="qcomment-label" for="qcomment-words">' . L10n::t('Enter quick comments, one per line') . ' </label>';
$s .= '<textarea id="qcomment-words" type="text" name="qcomment-words" >' . htmlspecialchars(unxmlify($words)) . '</textarea>';
$s .= '<textarea id="qcomment-words" type="text" name="qcomment-words" >' . htmlspecialchars(XML::unescape($words)) . '</textarea>';
$s .= '</div><div class="clear"></div>';
$s .= '<div class="settings-submit-wrapper" ><input type="submit" id="qcomment-submit" name="qcomment-submit" class="settings-submit" value="' . L10n::t('Save Settings') . '" /></div>';
@ -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']));
PConfig::set(local_user(), 'qcomment', 'words', XML::escape($_POST['qcomment-words']));
info(L10n::t('Quick Comment settings saved.') . EOL);
}
}

View File

@ -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;

View File

@ -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]

View File

@ -10,7 +10,9 @@ 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\Renderer;
use Friendica\Util\Emailer;
/* because the fraking openpgp-php is in composer, require libs in composer
@ -31,7 +33,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 +42,7 @@ function securemail_uninstall() {
Addon::unregisterHook('emailer_send_prepare', 'addon/securemail/securemail.php', 'securemail_emailer_send_prepare');
logger('removed securemail');
Logger::log('removed securemail');
}
/**
@ -61,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'

View File

@ -6,12 +6,13 @@
* Author: Johannes Schwab <https://friendica.jschwab.org/profile/ddorian>
*/
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");
}

View File

@ -4,16 +4,18 @@
#
#
# Translators:
# Abrax <webmaster@a-zwenkau.de>, 2014-2015
# bavatar <tobias.diekershoff@gmx.net>, 2015
# Andreas H., 2014-2015
# Tobias Diekershoff <tobias.diekershoff@gmx.net>, 2015
# Tobias Diekershoff <tobias.diekershoff@gmx.net>, 2016
# Vinzenz Vietzke <vinz@vinzv.de>, 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 <tobias.diekershoff@gmx.net>\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 <vinz@vinzv.de>\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.<br />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.<br />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.<br />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 <strong>public</strong> 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 <strong>öffentlichen</strong> 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 <strong>öffentlichen</strong> 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 <strong>public</strong> 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 <strong>öffentlichen</strong> 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 <strong>öffentlichen</strong> 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?</em>) 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 "<strong>Hinweis</strong>: Aufgrund deiner Privatsphären-Einstellungen (<em>Profil-Details vor unbekannten Betrachtern verbergen?</em>) 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 "<strong>Hinweis</strong>: Aufgrund deiner Privatsphären-Einstellungen (<em>Profil-Details vor unbekannten Betrachtern verbergen?</em>) 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"

View File

@ -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.<br />The provided API URL is not valid."] = "Bitte kontaktiere den Administrator der Seite.<br />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.<br />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.<br />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.<br />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.<br />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 <strong>public</strong> 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 <strong>öffentlichen</strong> 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 <strong>public</strong> 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 <strong>öffentlichen</strong> 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 <strong>public</strong> 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 <strong>öffentlichen</strong> 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["<strong>Note</strong>: Due your privacy settings (<em>Hide your profile details from unknown viewers?</em>) 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."] = "<strong>Hinweis</strong>: Aufgrund deiner Privatsphären-Einstellungen (<em>Profil-Details vor unbekannten Betrachtern verbergen?</em>) 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 <strong>public</strong> 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 <strong>öffentlichen</strong> 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["<strong>Note</strong>: Due your privacy settings (<em>Hide your profile details from unknown viewers?</em>) 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."] = "<strong>Hinweis</strong>: Aufgrund deiner Privatsphären-Einstellungen (<em>Profil-Details vor unbekannten Betrachtern verbergen?</em>) 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";

View File

@ -46,8 +46,10 @@ 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\Renderer;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
use Friendica\Model\GContact;
@ -70,7 +72,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 +431,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 +444,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 +461,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 +484,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 +510,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 +531,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 +580,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,17 +591,17 @@ 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) .
"\nmessage: " . $msg . "\nOriginal post: " . print_r($b, true) . "\nPost Data: " . print_r($postdata, true), LOGGER_DEBUG);
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)) {
PConfig::set($b["uid"], "statusnet", "application_name", strip_tags($result->source));
}
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']]);
}
}
@ -667,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,
]);
@ -729,16 +731,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 +758,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 +873,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 +914,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 +976,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 +1062,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 +1189,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 +1208,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 +1223,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 +1233,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 +1271,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 +1305,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 +1323,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 +1355,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 +1390,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 +1413,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 +1583,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);
}

View File

@ -14,7 +14,9 @@ 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\Core\Renderer;
use Friendica\Database\DBA;
function tumblr_install()
@ -69,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' ), ''],
@ -458,11 +460,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));
}
}
}

View File

@ -69,8 +69,10 @@ 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\Renderer;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
@ -109,7 +111,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 +156,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 +237,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
@ -346,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 .= '<div id="twitter-info" >
<p>' . L10n::t('Currently connected to: ') . '<a href="https://twitter.com/' . $details->screen_name . '" target="_twitter">' . $details->screen_name . '</a>
@ -359,22 +361,22 @@ function twitter_settings(App $a, &$s)
</div>';
$s .= '<div class="clear"></div>';
$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 <strong>public</strong> 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 .= '<p>' . L10n::t('<strong>Note</strong>: Due to your privacy settings (<em>Hide your profile details from unknown viewers?</em>) 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.') . '</p>';
}
$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 .= '<div class="clear"></div>';
@ -427,7 +429,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 +443,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 +458,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 +483,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 +509,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 +532,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 +542,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 +610,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 +630,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 +649,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']]);
}
}
@ -664,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'), ''],
@ -686,16 +688,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 +715,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 +739,7 @@ function twitter_cron(App $a)
}
}
logger('twitter: cron_end');
Logger::log('twitter: cron_end');
Config::set('twitter', 'last_poll', time());
}
@ -758,17 +760,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 +905,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 +933,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 +941,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 +965,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 +985,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 +1079,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 +1090,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 +1135,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 +1389,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 +1429,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 +1451,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 +1548,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 +1558,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 +1579,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 +1595,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 +1609,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 +1624,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 +1635,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 +1659,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 +1689,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 +1702,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 +1723,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 +1742,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 +1777,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)
@ -1859,7 +1861,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');
@ -1869,7 +1871,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);
}

View File

@ -1,6 +1,7 @@
<?php
use Friendica\Core\Config;
use Friendica\Core\Logger;
function twitter_sync_run($argv, $argc)
{
@ -11,7 +12,7 @@ function twitter_sync_run($argv, $argc)
if (function_exists('sys_getloadavg')) {
$load = sys_getloadavg();
if (intval($load[0]) > 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;
}
}

View File

@ -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 .')],
]);

View File

@ -1,5 +1,6 @@
<?php
use Friendica\Content\Text\HTML;
use Friendica\Core\L10n;
function friendheader_widget_name()
@ -45,7 +46,7 @@ function friendheader_widget_content(&$a, $conf)
.contact-block-div { display: block !important; float: left!important; width: 50px!important; height: 50px!important; margin: 2px!important;}
</style>";
$o .= _abs_url(contact_block());
$o .= _abs_url(HTML::contactBlock());
$o .= "<a href='".$a->getBaseURL().'/profile/'.$a->profile['nickname']."' target=new>". L10n::t('Get added to this list!') ."</a>";
return $o;

View File

@ -1,5 +1,6 @@
<?php
use Friendica\Content\Text\HTML;
use Friendica\Core\L10n;
function friends_widget_name()
@ -47,7 +48,7 @@ function friends_widget_content(&$a, $conf)
.contact-block-div { display: block !important; float: left!important; width: 50px!important; height: 50px!important; margin: 2px!important;}
</style>";
$o .= _abs_url(contact_block());
$o .= _abs_url(HTML::contactBlock());
$o .= "<a href='".$a->getBaseURL().'/profile/'.$a->profile['nickname']."'>". L10n::t('Connect on Friendica!') ."</a>";
return $o;
}

View File

@ -1,6 +1,7 @@
<?php
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
use Friendica\Database\DBA;
function like_widget_name() {
@ -56,8 +57,8 @@ function like_widget_content(&$a, $conf){
$o = "";
# $t = file_get_contents( dirname(__file__). "/widget_like.tpl" );
$t = get_markup_template("widget_like.tpl", "addon/widgets/");
$o .= replace_macros($t, [
$t = Renderer::getMarkupTemplate("widget_like.tpl", "addon/widgets/");
$o .= Renderer::replaceMacros($t, [
'$like' => $likes,
'$strlike' => L10n::tt("%d person likes this", "%d people like this", $likes),

View File

@ -9,13 +9,15 @@
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() {
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() {
@ -57,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",
@ -141,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),

View File

@ -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');

View File

@ -10,9 +10,11 @@ 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;
use Friendica\Util\XML;
function wppost_install() {
Addon::registerHook('post_local', 'addon/wppost/wppost.php', 'wppost_post_local');
@ -215,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::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');
if ($wp_backlink_text == '') {
@ -293,7 +295,7 @@ function wppost_send(&$a,&$b) {
. $wp_backlink_text . '</a>' . EOL . EOL;
}
$post = xmlify($post);
$post = XML::escape($post);
$xml = <<< EOT
@ -312,11 +314,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);
}
}

View File

@ -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.')],