implement log() function.
more to squash
Core Logger Class
implement log() function
use Friendica\Core\Addon;
use Friendica\Core\Cache;
use Friendica\Core\L10n;
+use Friendica\Core\Logger;
use Friendica\Database\DBA;
use Friendica\Database\DBStructure;
use Friendica\Model\Item;
DBStructure::update(false, true);
- logger("installed advancedcontentfilter");
+ Logger::log("installed advancedcontentfilter");
}
function advancedcontentfilter_uninstall()
use Friendica\Core\Config;
use Friendica\Core\Addon;
use Friendica\Core\L10n;
+use Friendica\Core\Logger;
function blackout_install() {
Addon::registerHook('page_header', 'addon/blackout/blackout.php', 'blackout_redirect');
$date2 = 0;
}
if (( $date1 <= $now ) && ( $now <= $date2 )) {
- logger('redirecting user to blackout page');
+ Logger::log('redirecting user to blackout page');
System::externalRedirect($myurl);
}
}
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;
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);
}
}
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;
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);
$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)
}
$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"])) {
}
//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);
}
}
}
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\L10n;
+use Friendica\Core\Logger;
use Friendica\Core\PConfig;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
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');
}
/**
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');
}
/**
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;
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",
$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']);
}
}
{
$hostname = $a->getHostName();
- logger('diaspora_send: invoked');
+ Logger::log('diaspora_send: invoked');
if ($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited'])) {
return;
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 = '';
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))
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;
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);
}
}
*/
use Friendica\Core\Addon;
use Friendica\Core\L10n;
+use Friendica\Core\Logger;
use Friendica\Core\PConfig;
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");
}
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)
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\L10n;
+use Friendica\Core\Logger;
use Friendica\Core\PConfig;
use Friendica\Core\Protocol;
use Friendica\Object\Image;
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());
}
$_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) {
// 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;
}
use Friendica\Core\Cache;
use Friendica\Core\Config;
use Friendica\Core\L10n;
+use Friendica\Core\Logger;
use Friendica\Util\Network;
function geocoordinates_install()
$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"]);
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;
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");
}
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)
*
*/
- logger('geonames invoked');
+ Logger::log('geonames invoked');
if(! local_user()) /* non-zero if this is a logged in user of this system */
return;
$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;
}
*/
use Friendica\Core\Addon;
use Friendica\Core\L10n;
+use Friendica\Core\Logger;
use Friendica\Core\PConfig;
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");
}
Addon::unregisterHook('enotify_mail', 'addon/gnot/gnot.php', 'gnot_enotify_mail');
- logger("removed gnot");
+ Logger::log("removed gnot");
}
*/
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)
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\L10n;
+use Friendica\Core\Logger;
use Friendica\Database\DBA;
use Friendica\Util\Security;
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");
}
/**
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)
*/
use Friendica\Core\Addon;
use Friendica\Core\L10n;
+use Friendica\Core\Logger;
use Friendica\Core\PConfig;
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");
}
Addon::unregisterHook('addon_settings_post', 'addon/group_text/group_text.php', 'group_text_settings_post');
- logger("removed group_text");
+ Logger::log("removed group_text");
}
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;
$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;
}
// 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;
}
}
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;
}
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;
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);
}
}
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\L10n;
+use Friendica\Core\Logger;
use Friendica\Util\Proxy as ProxyUtils;
function impressum_install() {
Addon::registerHook('load_config', 'addon/impressum/impressum.php', 'impressum_load_config');
Addon::registerHook('about_hook', 'addon/impressum/impressum.php', 'impressum_show');
Addon::registerHook('page_end', 'addon/impressum/impressum.php', 'impressum_footer');
- logger("installed impressum Addon");
+ Logger::log("installed impressum Addon");
}
function impressum_uninstall() {
Addon::unregisterHook('load_config', 'addon/impressum/impressum.php', 'impressum_load_config');
Addon::unregisterHook('about_hook', 'addon/impressum/impressum.php', 'impressum_show');
Addon::unregisterHook('page_end', 'addon/impressum/impressum.php', 'impressum_footer');
- logger("uninstalled impressum Addon");
+ Logger::log("uninstalled impressum Addon");
}
function impressum_module() {
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;
// 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;
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');
$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();
}
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();
*/
use Friendica\Core\Addon;
use Friendica\Core\L10n;
+use Friendica\Core\Logger;
use Friendica\Core\PConfig;
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");
}
Addon::unregisterHook('addon_settings_post', 'addon/krynn/krynn.php', 'krynn_settings_post');
- logger("removed krynn");
+ Logger::log("removed krynn");
}
*
*/
- logger('krynn invoked');
+ Logger::log('krynn invoked');
if(! local_user()) /* non-zero if this is a logged in user of this system */
return;
*/
use Friendica\Core\Addon;
use Friendica\Core\Config;
+use Friendica\Core\Logger;
use Friendica\Model\User;
function ldapauth_install()
$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;
}
@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) {
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");
}
}
}
*/
use Friendica\Core\Addon;
use Friendica\Core\Config;
+use Friendica\Core\Logger;
use Friendica\Util\Network;
function leistungsschutzrecht_install() {
if($last) {
$next = $last + 86400;
if($next > time()) {
- logger('poll intervall not reached');
+ Logger::log('poll intervall not reached');
return;
}
}
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;
function libertree_send(&$a,&$b) {
- logger('libertree_send: invoked');
+ Logger::log('libertree_send: invoked');
if ($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited'])) {
return;
];
$result = Network::post($ltree_blog, $params)->getBody();
- logger('libertree: ' . $result);
+ Logger::log('libertree: ' . $result);
}
}
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\L10n;
+use Friendica\Core\Logger;
use Friendica\Database\DBA;
use Friendica\Util\Security;
{
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");
}
/**
{
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)
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;
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);
}
}
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\L10n;
+use Friendica\Core\Logger;
use Friendica\Core\PConfig;
use Friendica\Database\DBA;
use Friendica\Util\Network;
$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;
}
intval($item['contact-id']), DBA::escape($item['uri']), DBA::escape($message_id));
$r = q('SELECT * FROM `mailstream_item` WHERE `uid` = %d AND `contact-id` = %d AND `uri` = "%s"', intval($item['uid']), intval($item['contact-id']), DBA::escape($item['uri']));
if (count($r) != 1) {
- logger('mailstream_post_remote_hook: Unexpected number of items returned from mailstream_item', LOGGER_INFO);
+ Logger::log('mailstream_post_remote_hook: Unexpected number of items returned from mailstream_item', LOGGER_INFO);
return;
}
$ms_item = $r[0];
- logger('mailstream_post_remote_hook: created mailstream_item '
+ Logger::log('mailstream_post_remote_hook: created mailstream_item '
. $ms_item['id'] . ' for item ' . $item['uri'] . ' '
. $item['uid'] . ' ' . $item['contact-id'], LOGGER_DATA);
$user = mailstream_get_user($item['uid']);
if (!$user) {
- logger('mailstream_post_remote_hook: no user ' . $item['uid'], LOGGER_INFO);
+ Logger::log('mailstream_post_remote_hook: no user ' . $item['uid'], LOGGER_INFO);
return;
}
mailstream_send($a, $ms_item['message-id'], $item, $user);
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];
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
// 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']));
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']));
}
}
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);
}
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\L10n;
+use Friendica\Core\Logger;
function newmemberwidget_install()
{
Addon::registerHook( 'network_mod_init', 'addon/newmemberwidget/newmemberwidget.php', 'newmemberwidget_network_mod_init');
- logger('newmemberwidget installed');
+ Logger::log('newmemberwidget installed');
}
function newmemberwidget_uninstall()
use Friendica\Content\Text\BBCode;
use Friendica\Core\Config;
use Friendica\Core\L10n;
+use Friendica\Core\Logger;
use Friendica\Util\Emailer;
function notifyall_install()
{
- logger("installed notifyall");
+ Logger::log("installed notifyall");
}
function notifyall_uninstall()
{
- logger("removed notifyall");
+ Logger::log("removed notifyall");
}
function notifyall_module() {}
*/
use Friendica\Core\Addon;
use Friendica\Core\L10n;
+use Friendica\Core\Logger;
use Friendica\Core\PConfig;
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");
}
Addon::unregisterHook('addon_settings_post', 'addon/numfriends/numfriends.php', 'numfriends_settings_post');
- logger("removed numfriends");
+ Logger::log("removed numfriends");
}
/**
use Friendica\Core\Cache;
use Friendica\Core\Config;
use Friendica\Core\L10n;
+use Friendica\Core\Logger;
use Friendica\Core\System;
use Friendica\Util\Network;
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()
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)
$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;
$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)
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\L10n;
+use Friendica\Core\Logger;
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)
*/
use Friendica\Core\Addon;
use Friendica\Core\L10n;
+use Friendica\Core\Logger;
use Friendica\Core\PConfig;
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");
}
Addon::unregisterHook('addon_settings_post', 'addon/planets/planets.php', 'planets_settings_post');
- logger("removed planets");
+ Logger::log("removed planets");
}
*
*/
- logger('planets invoked');
+ Logger::log('planets invoked');
if(! local_user()) /* non-zero if this is a logged in user of this system */
return;
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\L10n;
+use Friendica\Core\Logger;
use Friendica\Database\DBA;
use Friendica\Util\DateTimeFormat;
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
}
}
- logger("public_server: cron end");
+ Logger::log("public_server: cron end");
}
function public_server_enotify(&$a, &$b)
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;
$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);
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;
}
$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);
$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;
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);
}
}
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.';
}
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
$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;
$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;
}
$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)) {
}
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)) {
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']);
}
}
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
}
}
- logger('pumpio: cron_end');
+ Logger::log('pumpio: cron_end');
Config::set('pumpio', 'last_poll', time());
}
$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;
}
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;
}
}
}
- 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);
}
}
}
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']);
}
}
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;
}
$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;
}
$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)
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",
$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");
$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']);
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']);
}
}
$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;
$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);
$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);
}
}
<?php
use Friendica\Core\Config;
+use Friendica\Core\Logger;
function pumpio_sync_run(&$argv, &$argc) {
$a = Friendica\BaseObject::getApp();
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;
}
}
*/
use Friendica\Core\Addon;
use Friendica\Core\L10n;
+use Friendica\Core\Logger;
use Friendica\Core\PConfig;
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");
}
Addon::unregisterHook('addon_settings_post', 'addon/randplace/randplace.php', 'randplace_settings_post');
- logger("removed randplace");
+ Logger::log("removed randplace");
}
*
*/
- logger('randplace invoked');
+ Logger::log('randplace invoked');
if(! local_user()) /* non-zero if this is a logged in user of this system */
return;
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\L10n;
+use Friendica\Core\Logger;
use Friendica\Core\PConfig;
use Friendica\Util\Emailer;
Addon::registerHook('emailer_send_prepare', 'addon/securemail/securemail.php', 'securemail_emailer_send_prepare');
- logger('installed securemail');
+ Logger::log('installed securemail');
}
function securemail_uninstall() {
Addon::unregisterHook('emailer_send_prepare', 'addon/securemail/securemail.php', 'securemail_emailer_send_prepare');
- logger('removed securemail');
+ Logger::log('removed securemail');
}
/**
* 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");
}
//Delet registered hooks
Addon::unregisterHook('jot_tool', 'addon/smileybutton/smileybutton.php', 'show_button');
- logger("removed smileybutton");
+ Logger::log("removed smileybutton");
}
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;
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()
$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":
$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)
$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;
$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;
}
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
return;
}
- logger('GNU Socialpost invoked');
+ Logger::log('GNU Socialpost invoked');
PConfig::load($b['uid'], 'statusnet');
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
$cb->setToken($otoken, $osecret);
$result = $cb->statuses_update($postdata);
//$result = $dent->post('statuses/update', $postdata);
- logger('statusnet_post send, result: ' . print_r($result, true) .
+ Logger::log('statusnet_post send, result: ' . print_r($result, true) .
"\nmessage: " . $msg . "\nOriginal post: " . print_r($b, true) . "\nPost Data: " . print_r($postdata, true), LOGGER_DEBUG);
if (!empty($result->source)) {
}
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']]);
}
}
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']);
}
}
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());
}
//print_r($_REQUEST);
if ($_REQUEST["body"] != "") {
- logger('statusnet: posting for user ' . $uid);
+ Logger::log('statusnet: posting for user ' . $uid);
item_post($a);
}
}
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;
}
// 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']);
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);
$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;
}
// "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';
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;
}
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;
}
$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) {
$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);
}
}
}
$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) {
$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);
}
}
}
$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);
}
}
}
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;
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);
}
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\L10n;
+use Friendica\Core\Logger;
use Friendica\Core\PConfig;
use Friendica\Database\DBA;
//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));
}
}
}
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;
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()
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;
} 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
$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":
$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)
}
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;
$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;
}
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 {
return;
}
- logger('twitter post invoked');
+ Logger::log('twitter post invoked');
PConfig::load($b['uid'], 'twitter');
$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'])) {
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.
$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)) {
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']]);
}
}
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']);
}
}
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
}
}
- logger('twitter: cron_end');
+ Logger::log('twitter: cron_end');
Config::set('twitter', 'last_poll', time());
}
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)
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) {
$_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);
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)
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",
$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']);
}
}
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;
}
// 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']);
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;
}
// 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 [];
}
$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 [];
}
}
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 [];
}
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 = [];
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;
}
$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);
$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);
}
}
}
$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');
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;
}
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;
}
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) {
}
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;
}
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;
}
$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');
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) {
$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)
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');
$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);
}
<?php
use Friendica\Core\Config;
+use Friendica\Core\Logger;
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;
}
}
use Friendica\Core\Addon;
use Friendica\Core\L10n;
+use Friendica\Core\Logger;
use Friendica\Core\PConfig;
use Friendica\Database\DBA;
function widgets_install() {
Addon::registerHook('addon_settings', 'addon/widgets/widgets.php', 'widgets_settings');
Addon::registerHook('addon_settings_post', 'addon/widgets/widgets.php', 'widgets_settings_post');
- logger("installed widgets");
+ Logger::log("installed widgets");
}
function widgets_uninstall() {
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;
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()
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 */
// 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)
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)
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)
$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
// 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";
}
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!";
}
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');
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');
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;
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);
}
}