EOT;
- Logger::log('blogger: data: ' . $xml, LOGGER_DATA);
+ Logger::log('blogger: data: ' . $xml, Logger::DATA);
if ($bl_blog !== 'test') {
$x = Network::post($bl_blog, $xml)->getBody();
}
- Logger::log('posted to blogger: ' . (($x) ? $x : ''), LOGGER_DEBUG);
+ Logger::log('posted to blogger: ' . (($x) ? $x : ''), Logger::DEBUG);
}
}
$profiles = $buffer->go('/profiles');
if (is_array($profiles)) {
- Logger::log("Will send these parameter ".print_r($b, true), LOGGER_DEBUG);
+ Logger::log("Will send these parameter ".print_r($b, true), Logger::DEBUG);
foreach ($profiles as $profile) {
if (!$profile->default)
}
$post = ItemContent::getPlaintextPost($item, $limit, $includedlinks, $htmlmode);
- Logger::log("buffer_send: converted message ".$b["id"]." result: ".print_r($post, true), LOGGER_DEBUG);
+ Logger::log("buffer_send: converted message ".$b["id"]." result: ".print_r($post, true), Logger::DEBUG);
// The image proxy is used as a sanitizer. Buffer seems to be really picky about pictures
if (isset($post["image"])) {
}
//print_r($message);
- Logger::log("buffer_send: data for message " . $b["id"] . ": " . print_r($message, true), LOGGER_DEBUG);
+ Logger::log("buffer_send: data for message " . $b["id"] . ": " . print_r($message, true), Logger::DEBUG);
$ret = $buffer->go('/updates/create', $message);
- Logger::log("buffer_send: send message " . $b["id"] . " result: " . print_r($ret, true), LOGGER_DEBUG);
+ Logger::log("buffer_send: send message " . $b["id"] . " result: " . print_r($ret, true), Logger::DEBUG);
}
}
}
$post = $z['post'];
- Logger::log('diaspora_queue: post: '.$post, LOGGER_DATA);
+ Logger::log('diaspora_queue: post: '.$post, Logger::DATA);
try {
- Logger::log('diaspora_queue: prepare', LOGGER_DEBUG);
+ Logger::log('diaspora_queue: prepare', Logger::DEBUG);
$conn = new Diaspora_Connection($handle, $password);
- Logger::log('diaspora_queue: try to log in '.$handle, LOGGER_DEBUG);
+ Logger::log('diaspora_queue: try to log in '.$handle, Logger::DEBUG);
$conn->logIn();
- Logger::log('diaspora_queue: try to send '.$body, LOGGER_DEBUG);
+ Logger::log('diaspora_queue: try to send '.$body, Logger::DEBUG);
$conn->provider = $hostname;
$conn->postStatusMessage($post, $aspect);
- Logger::log('diaspora_queue: send '.$userdata['uid'].' success', LOGGER_DEBUG);
+ Logger::log('diaspora_queue: send '.$userdata['uid'].' success', Logger::DEBUG);
$success = true;
Queue::removeItem($x['id']);
} catch (Exception $e) {
- Logger::log("diaspora_queue: Send ".$userdata['uid']." failed: ".$e->getMessage(), LOGGER_DEBUG);
+ Logger::log("diaspora_queue: Send ".$userdata['uid']." failed: ".$e->getMessage(), Logger::DEBUG);
}
} else {
- Logger::log('diaspora_queue: send '.$userdata['uid'].' missing username or password', LOGGER_DEBUG);
+ Logger::log('diaspora_queue: send '.$userdata['uid'].' missing username or password', Logger::DEBUG);
}
if (!$success) {
return;
}
- Logger::log('diaspora_send: prepare posting', LOGGER_DEBUG);
+ Logger::log('diaspora_send: prepare posting', Logger::DEBUG);
$handle = PConfig::get($b['uid'],'diaspora','handle');
$password = PConfig::get($b['uid'],'diaspora','password');
$aspect = PConfig::get($b['uid'],'diaspora','aspect');
if ($handle && $password) {
- Logger::log('diaspora_send: all values seem to be okay', LOGGER_DEBUG);
+ Logger::log('diaspora_send: all values seem to be okay', Logger::DEBUG);
$tag_arr = [];
$tags = '';
require_once "addon/diaspora/diasphp.php";
try {
- Logger::log('diaspora_send: prepare', LOGGER_DEBUG);
+ Logger::log('diaspora_send: prepare', Logger::DEBUG);
$conn = new Diaspora_Connection($handle, $password);
- Logger::log('diaspora_send: try to log in '.$handle, LOGGER_DEBUG);
+ Logger::log('diaspora_send: try to log in '.$handle, Logger::DEBUG);
$conn->logIn();
- Logger::log('diaspora_send: try to send '.$body, LOGGER_DEBUG);
+ Logger::log('diaspora_send: try to send '.$body, Logger::DEBUG);
$conn->provider = $hostname;
$conn->postStatusMessage($body, $aspect);
} catch (Exception $e) {
Logger::log("diaspora_send: Error submitting the post: " . $e->getMessage());
- Logger::log('diaspora_send: requeueing '.$b['uid'], LOGGER_DEBUG);
+ Logger::log('diaspora_send: requeueing '.$b['uid'], Logger::DEBUG);
$r = q("SELECT `id` FROM `contact` WHERE `uid` = %d AND `self`", $b['uid']);
if (count($r))
EOT;
- Logger::log('dwpost: data: ' . $xml, LOGGER_DATA);
+ Logger::log('dwpost: data: ' . $xml, Logger::DATA);
if ($dw_blog !== 'test') {
$x = Network::post($dw_blog, $xml, ["Content-Type: text/xml"])->getBody();
}
- Logger::log('posted to dreamwidth: ' . ($x) ? $x : '', LOGGER_DEBUG);
+ Logger::log('posted to dreamwidth: ' . ($x) ? $x : '', Logger::DEBUG);
}
}
$s = Network::fetchUrl("https://api.opencagedata.com/geocode/v1/json?q=".$coords[0].",".$coords[1]."&key=".$key."&language=".$language);
if (!$s) {
- Logger::log("API could not be queried", LOGGER_DEBUG);
+ Logger::log("API could not be queried", Logger::DEBUG);
return;
}
$data = json_decode($s);
if ($data->status->code != "200") {
- Logger::log("API returned error ".$data->status->code." ".$data->status->message, LOGGER_DEBUG);
+ Logger::log("API returned error ".$data->status->code." ".$data->status->message, Logger::DEBUG);
return;
}
if (($data->total_results == 0) || (count($data->results) == 0)) {
- Logger::log("No results found for coordinates ".$item["coord"], LOGGER_DEBUG);
+ Logger::log("No results found for coordinates ".$item["coord"], Logger::DEBUG);
return;
}
$item["location"] = $data->results[0]->formatted;
- Logger::log("Got location for coordinates ".$coords[0]."-".$coords[1].": ".$item["location"], LOGGER_DEBUG);
+ Logger::log("Got location for coordinates ".$coords[0]."-".$coords[1].": ".$item["location"], Logger::DEBUG);
if ($item["location"] != "")
Cache::set("geocoordinates:".$language.":".$coords[0]."-".$coords[1], $item["location"]);
$item['location'] = $xml->geoname->name . ', ' . $xml->geoname->countryName;
-// Logger::log('geonames : ' . print_r($xml,true), LOGGER_DATA);
+// Logger::log('geonames : ' . print_r($xml,true), Logger::DATA);
return;
}
$user = DBA::selectFirst('user', ['uid'], ['nickname' => $nickname]);
if (!DBA::isResult($user)) {
- Logger::log('User ' . $nickname . ' not found.', LOGGER_DEBUG);
+ Logger::log('User ' . $nickname . ' not found.', Logger::DEBUG);
return;
}
$uid = $user['uid'];
- Logger::log('Received a post for user ' . $uid . ' from ifttt ' . print_r($_REQUEST, true), LOGGER_DEBUG);
+ Logger::log('Received a post for user ' . $uid . ' from ifttt ' . print_r($_REQUEST, true), Logger::DEBUG);
if (!isset($_REQUEST['key'])) {
Logger::log('No key found.');
// Check the key
if ($key != PConfig::get($uid, 'ifttt', 'key')) {
- Logger::log('Invalid key for user ' . $uid, LOGGER_DEBUG);
+ Logger::log('Invalid key for user ' . $uid, Logger::DEBUG);
return;
}
}
if (!in_array($item['type'], ['status', 'link', 'photo'])) {
- Logger::log('Unknown item type ' . $item['type'], LOGGER_DEBUG);
+ Logger::log('Unknown item type ' . $item['type'], Logger::DEBUG);
return;
}
EOT;
- Logger::log('ijpost: data: ' . $xml, LOGGER_DATA);
+ Logger::log('ijpost: data: ' . $xml, Logger::DATA);
if ($ij_blog !== 'test') {
$x = Network::post($ij_blog, $xml, ["Content-Type: text/xml"])->getBody();
}
- Logger::log('posted to insanejournal: ' . $x ? $x : '', LOGGER_DEBUG);
+ Logger::log('posted to insanejournal: ' . $x ? $x : '', Logger::DEBUG);
}
}
$a->data['upload_jsonresponse'] = htmlspecialchars(json_encode($result), ENT_NOQUOTES);
if(isset($result['error'])) {
- Logger::log('mod/photos.php: photos_post(): error uploading photo: ' . $result['error'] , 'LOGGER_DEBUG');
+ Logger::log('mod/photos.php: photos_post(): error uploading photo: ' . $result['error'] , Logger::DEBUG);
echo json_encode($result);
killme();
}
EOT;
- Logger::log('ljpost: data: ' . $xml, LOGGER_DATA);
+ Logger::log('ljpost: data: ' . $xml, Logger::DATA);
if ($lj_blog !== 'test') {
$x = Network::post($lj_blog, $xml, ["Content-Type: text/xml"])->getBody();
}
- Logger::log('posted to livejournal: ' . ($x) ? $x : '', LOGGER_DEBUG);
+ Logger::log('posted to livejournal: ' . ($x) ? $x : '', Logger::DEBUG);
}
}
$host = $a->getHostName();
$resource = hash('md5', $uri);
$message_id = "<" . $resource . "@" . $host . ">";
- Logger::log('mailstream: Generated message ID ' . $message_id . ' for URI ' . $uri, LOGGER_DEBUG);
+ Logger::log('mailstream: Generated message ID ' . $message_id . ' for URI ' . $uri, Logger::DEBUG);
return $message_id;
}
intval($item['contact-id']), DBA::escape($item['uri']), DBA::escape($message_id));
$r = q('SELECT * FROM `mailstream_item` WHERE `uid` = %d AND `contact-id` = %d AND `uri` = "%s"', intval($item['uid']), intval($item['contact-id']), DBA::escape($item['uri']));
if (count($r) != 1) {
- Logger::log('mailstream_post_remote_hook: Unexpected number of items returned from mailstream_item', LOGGER_INFO);
+ Logger::log('mailstream_post_remote_hook: Unexpected number of items returned from mailstream_item', Logger::INFO);
return;
}
$ms_item = $r[0];
Logger::log('mailstream_post_remote_hook: created mailstream_item '
. $ms_item['id'] . ' for item ' . $item['uri'] . ' '
- . $item['uid'] . ' ' . $item['contact-id'], LOGGER_DATA);
+ . $item['uid'] . ' ' . $item['contact-id'], Logger::DATA);
$user = mailstream_get_user($item['uid']);
if (!$user) {
- Logger::log('mailstream_post_remote_hook: no user ' . $item['uid'], LOGGER_INFO);
+ Logger::log('mailstream_post_remote_hook: no user ' . $item['uid'], Logger::INFO);
return;
}
mailstream_send($a, $ms_item['message-id'], $item, $user);
function mailstream_get_user($uid) {
$r = q('SELECT * FROM `user` WHERE `uid` = %d', intval($uid));
if (count($r) != 1) {
- Logger::log('mailstream_post_remote_hook: Unexpected number of users returned', LOGGER_INFO);
+ Logger::log('mailstream_post_remote_hook: Unexpected number of users returned', Logger::INFO);
return;
}
return $r[0];
if (!$mail->Send()) {
throw new Exception($mail->ErrorInfo);
}
- Logger::log('mailstream_send sent message ' . $mail->MessageID . ' ' . $mail->Subject, LOGGER_DEBUG);
+ Logger::log('mailstream_send sent message ' . $mail->MessageID . ' ' . $mail->Subject, Logger::DEBUG);
} catch (phpmailerException $e) {
- Logger::log('mailstream_send PHPMailer exception sending message ' . $message_id . ': ' . $e->errorMessage(), LOGGER_INFO);
+ Logger::log('mailstream_send PHPMailer exception sending message ' . $message_id . ': ' . $e->errorMessage(), Logger::INFO);
} catch (Exception $e) {
- Logger::log('mailstream_send exception sending message ' . $message_id . ': ' . $e->getMessage(), LOGGER_INFO);
+ Logger::log('mailstream_send exception sending message ' . $message_id . ': ' . $e->getMessage(), Logger::INFO);
}
// In case of failure, still set the item to completed. Otherwise
// we'll just try to send it over and over again and it'll fail
// mailstream_post_remote_hook fails for some reason will this get
// used, and in that case it's worth holding off a bit anyway.
$ms_item_ids = q("SELECT `mailstream_item`.`message-id`, `mailstream_item`.`uri`, `item`.`id` FROM `mailstream_item` JOIN `item` ON (`mailstream_item`.`uid` = `item`.`uid` AND `mailstream_item`.`uri` = `item`.`uri` AND `mailstream_item`.`contact-id` = `item`.`contact-id`) WHERE `mailstream_item`.`completed` IS NULL AND `mailstream_item`.`created` < DATE_SUB(NOW(), INTERVAL 1 HOUR) AND `item`.`visible` = 1 ORDER BY `mailstream_item`.`created` LIMIT 100");
- Logger::log('mailstream_cron processing ' . count($ms_item_ids) . ' items', LOGGER_DEBUG);
+ Logger::log('mailstream_cron processing ' . count($ms_item_ids) . ' items', Logger::DEBUG);
foreach ($ms_item_ids as $ms_item_id) {
if (!$ms_item_id['message-id'] || !strlen($ms_item_id['message-id'])) {
- Logger::log('mailstream_cron: Item ' . $ms_item_id['id'] . ' URI ' . $ms_item_id['uri'] . ' has no message-id', LOGGER_INFO);
+ Logger::log('mailstream_cron: Item ' . $ms_item_id['id'] . ' URI ' . $ms_item_id['uri'] . ' has no message-id', Logger::INFO);
}
$item = Item::selectFirst([], ['id' => $ms_item_id['id']]);
$users = q("SELECT * FROM `user` WHERE `uid` = %d", intval($item['uid']));
mailstream_send($a, $ms_item_id['message-id'], $item, $user);
}
else {
- Logger::log('mailstream_cron: Unable to find item ' . $ms_item_id['id'], LOGGER_INFO);
+ Logger::log('mailstream_cron: Unable to find item ' . $ms_item_id['id'], Logger::INFO);
q("UPDATE `mailstream_item` SET `completed` = now() WHERE `message-id` = %d", intval($ms_item['message-id']));
}
}
foreach ($r as $rr) {
q('DELETE FROM mailstream_item WHERE id = %d', intval($rr['id']));
}
- Logger::log('mailstream_tidy: deleted ' . count($r) . ' old items', LOGGER_DEBUG);
+ Logger::log('mailstream_tidy: deleted ' . count($r) . ' old items', Logger::DEBUG);
}
$lat = $b['lat']; // round($b['lat'], 5);
$lon = $b['lon']; // round($b['lon'], 5);
- Logger::log('lat: ' . $lat, LOGGER_DATA);
- Logger::log('lon: ' . $lon, LOGGER_DATA);
+ Logger::log('lat: ' . $lat, Logger::DATA);
+ Logger::log('lon: ' . $lon, Logger::DATA);
$cardlink = '<a href="' . $tmsserver;
$b['html'] .= '<br/>' . $cardlink;
}
- Logger::log('generate_map: ' . $b['html'], LOGGER_DATA);
+ Logger::log('generate_map: ' . $b['html'], Logger::DATA);
}
function openstreetmap_addon_admin(&$a, &$o)
$params["logo_url"] = $a->getBaseURL()."/images/friendica-256.png";
$params["redirect_uris"] = $a->getBaseURL()."/pumpio/connect";
- Logger::log("pumpio_registerclient: ".$url." parameters ".print_r($params, true), LOGGER_DEBUG);
+ Logger::log("pumpio_registerclient: ".$url." parameters ".print_r($params, true), Logger::DEBUG);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HEADER, false);
if ($curl_info["http_code"] == "200") {
$values = json_decode($s);
- Logger::log("pumpio_registerclient: success ".print_r($values, true), LOGGER_DEBUG);
+ Logger::log("pumpio_registerclient: success ".print_r($values, true), Logger::DEBUG);
return $values;
}
- Logger::log("pumpio_registerclient: failed: ".print_r($curl_info, true), LOGGER_DEBUG);
+ Logger::log("pumpio_registerclient: failed: ".print_r($curl_info, true), Logger::DEBUG);
return false;
}
$consumer_key = PConfig::get(local_user(), 'pumpio', 'consumer_key');
$consumer_secret = PConfig::get(local_user(), 'pumpio', 'consumer_secret');
- Logger::log("pumpio_connect: ckey: ".$consumer_key." csecrect: ".$consumer_secret, LOGGER_DEBUG);
+ Logger::log("pumpio_connect: ckey: ".$consumer_key." csecrect: ".$consumer_secret, Logger::DEBUG);
}
if (($consumer_key == "") || ($consumer_secret == "")) {
if (($success = $client->Initialize())) {
if (($success = $client->Process())) {
if (strlen($client->access_token)) {
- Logger::log("pumpio_connect: otoken: ".$client->access_token." osecrect: ".$client->access_token_secret, LOGGER_DEBUG);
+ Logger::log("pumpio_connect: otoken: ".$client->access_token." osecrect: ".$client->access_token_secret, Logger::DEBUG);
PConfig::set(local_user(), "pumpio", "oauth_token", $client->access_token);
PConfig::set(local_user(), "pumpio", "oauth_token_secret", $client->access_token_secret);
}
return;
}
- Logger::log("pumpio_send: parameter ".print_r($b, true), LOGGER_DATA);
+ Logger::log("pumpio_send: parameter ".print_r($b, true), Logger::DATA);
if ($b['parent'] != $b['id']) {
// Looking if its a reply to a pumpio post
require_once('include/items.php');
if (empty($post->object->id)) {
- Logger::log('Got empty like: '.print_r($post, true), LOGGER_DEBUG);
+ Logger::log('Got empty like: '.print_r($post, true), Logger::DEBUG);
return;
}
$connection = new StatusNetOAuth($api, $ckey, $csecret, $otoken, $osecret);
- Logger::log("statusnet_action '" . $action . "' ID: " . $pid, LOGGER_DATA);
+ Logger::log("statusnet_action '" . $action . "' ID: " . $pid, Logger::DATA);
switch ($action) {
case "delete":
$result = $connection->post("favorites/destroy/" . $pid);
break;
}
- Logger::log("statusnet_action '" . $action . "' send, result: " . print_r($result, true), LOGGER_DEBUG);
+ Logger::log("statusnet_action '" . $action . "' send, result: " . print_r($result, true), Logger::DEBUG);
}
function statusnet_post_hook(App $a, &$b)
$hostname = preg_replace("=https?://([\w\.]*)/.*=ism", "$1", $api);
if ($b['parent'] != $b['id']) {
- Logger::log("statusnet_post_hook: parameter " . print_r($b, true), LOGGER_DATA);
+ Logger::log("statusnet_post_hook: parameter " . print_r($b, true), Logger::DATA);
// Looking if its a reply to a GNU Social post
$hostlength = strlen($hostname) + 2;
$nickname = "@[url=" . $orig_post["author-link"] . "]" . $nick . "[/url]";
$nicknameplain = "@" . $nick;
- Logger::log("statusnet_post_hook: comparing " . $nickname . " and " . $nicknameplain . " with " . $b["body"], LOGGER_DEBUG);
+ Logger::log("statusnet_post_hook: comparing " . $nickname . " and " . $nicknameplain . " with " . $b["body"], Logger::DEBUG);
if ((strpos($b["body"], $nickname) === false) && (strpos($b["body"], $nicknameplain) === false)) {
$b["body"] = $nickname . " " . $b["body"];
}
- Logger::log("statusnet_post_hook: parent found " . print_r($orig_post, true), LOGGER_DEBUG);
+ Logger::log("statusnet_post_hook: parent found " . print_r($orig_post, true), Logger::DEBUG);
} else {
$iscomment = false;
}
if ($b['verb'] == ACTIVITY_LIKE) {
- Logger::log("statusnet_post_hook: parameter 2 " . substr($b["thr-parent"], $hostlength), LOGGER_DEBUG);
+ Logger::log("statusnet_post_hook: parameter 2 " . substr($b["thr-parent"], $hostlength), Logger::DEBUG);
if ($b['deleted'])
statusnet_action($a, $b["uid"], substr($b["thr-parent"], $hostlength), "unlike");
else
if (strlen($msg)) {
if ($iscomment) {
$postdata["in_reply_to_status_id"] = substr($orig_post["uri"], $hostlength);
- Logger::log('statusnet_post send reply ' . print_r($postdata, true), LOGGER_DEBUG);
+ Logger::log('statusnet_post send reply ' . print_r($postdata, true), Logger::DEBUG);
}
// New code that is able to post pictures
$result = $cb->statuses_update($postdata);
//$result = $dent->post('statuses/update', $postdata);
Logger::log('statusnet_post send, result: ' . print_r($result, true) .
- "\nmessage: " . $msg . "\nOriginal post: " . print_r($b, true) . "\nPost Data: " . print_r($postdata, true), LOGGER_DEBUG);
+ "\nmessage: " . $msg . "\nOriginal post: " . print_r($b, true) . "\nPost Data: " . print_r($postdata, true), Logger::DEBUG);
if (!empty($result->source)) {
PConfig::set($b["uid"], "statusnet", "application_name", strip_tags($result->source));
}
if (DBA::isResult($r) && ($r[0]["readonly"] || $r[0]["blocked"])) {
- Logger::log("statusnet_fetch_contact: Contact '" . $r[0]["nick"] . "' is blocked or readonly.", LOGGER_DEBUG);
+ Logger::log("statusnet_fetch_contact: Contact '" . $r[0]["nick"] . "' is blocked or readonly.", Logger::DEBUG);
return -1;
}
// check that we have all the photos, this has been known to fail on occasion
if ((!$r[0]['photo']) || (!$r[0]['thumb']) || (!$r[0]['micro']) || ($update_photo)) {
- Logger::log("statusnet_fetch_contact: Updating contact " . $contact->screen_name, LOGGER_DEBUG);
+ Logger::log("statusnet_fetch_contact: Updating contact " . $contact->screen_name, Logger::DEBUG);
$photos = Photo::importProfilePhoto($contact->profile_image_url, $uid, $r[0]['id']);
function statusnet_createpost(App $a, $uid, $post, $self, $create_user, $only_existing_contact)
{
- Logger::log("statusnet_createpost: start", LOGGER_DEBUG);
+ Logger::log("statusnet_createpost: start", Logger::DEBUG);
$api = PConfig::get($uid, 'statusnet', 'baseapi');
$hostname = preg_replace("=https?://([\w\.]*)/.*=ism", "$1", $api);
$postarray["coord"] = $content->coordinates->coordinates[1] . " " . $content->coordinates->coordinates[0];
}
- Logger::log("statusnet_createpost: end", LOGGER_DEBUG);
+ Logger::log("statusnet_createpost: end", Logger::DEBUG);
return $postarray;
}
// "create_user" is deactivated, since currently you cannot add users manually by now
$create_user = true;
- Logger::log("statusnet_fetchhometimeline: Fetching for user " . $uid, LOGGER_DEBUG);
+ Logger::log("statusnet_fetchhometimeline: Fetching for user " . $uid, Logger::DEBUG);
require_once 'include/items.php';
if (DBA::isResult($r)) {
$nick = $r[0]["nick"];
} else {
- Logger::log("statusnet_fetchhometimeline: Own GNU Social contact not found for user " . $uid, LOGGER_DEBUG);
+ Logger::log("statusnet_fetchhometimeline: Own GNU Social contact not found for user " . $uid, Logger::DEBUG);
return;
}
if (DBA::isResult($r)) {
$self = $r[0];
} else {
- Logger::log("statusnet_fetchhometimeline: Own contact not found for user " . $uid, LOGGER_DEBUG);
+ Logger::log("statusnet_fetchhometimeline: Own contact not found for user " . $uid, Logger::DEBUG);
return;
}
$u = q("SELECT * FROM user WHERE uid = %d LIMIT 1",
intval($uid));
if (!DBA::isResult($u)) {
- Logger::log("statusnet_fetchhometimeline: Own user not found for user " . $uid, LOGGER_DEBUG);
+ Logger::log("statusnet_fetchhometimeline: Own user not found for user " . $uid, Logger::DEBUG);
return;
}
$errormsg = "Unknown error";
}
- Logger::log("statusnet_fetchhometimeline: Error fetching home timeline: " . $errormsg, LOGGER_DEBUG);
+ Logger::log("statusnet_fetchhometimeline: Error fetching home timeline: " . $errormsg, Logger::DEBUG);
return;
}
$posts = array_reverse($items);
- Logger::log("statusnet_fetchhometimeline: Fetching timeline for user " . $uid . " " . sizeof($posts) . " items", LOGGER_DEBUG);
+ Logger::log("statusnet_fetchhometimeline: Fetching timeline for user " . $uid . " " . sizeof($posts) . " items", Logger::DEBUG);
if (count($posts)) {
foreach ($posts as $post) {
$items = $connection->get('statuses/mentions_timeline', $parameters);
if (!is_array($items)) {
- Logger::log("statusnet_fetchhometimeline: Error fetching mentions: " . print_r($items, true), LOGGER_DEBUG);
+ Logger::log("statusnet_fetchhometimeline: Error fetching mentions: " . print_r($items, true), Logger::DEBUG);
return;
}
$posts = array_reverse($items);
- Logger::log("statusnet_fetchhometimeline: Fetching mentions for user " . $uid . " " . sizeof($posts) . " items", LOGGER_DEBUG);
+ Logger::log("statusnet_fetchhometimeline: Fetching mentions for user " . $uid . " " . sizeof($posts) . " items", Logger::DEBUG);
if (count($posts)) {
foreach ($posts as $post) {
foreach ($matches AS $match) {
$search = "[url=" . $match[1] . "]" . $match[2] . "[/url]";
- Logger::log("statusnet_convertmsg: expanding url " . $match[1], LOGGER_DEBUG);
+ Logger::log("statusnet_convertmsg: expanding url " . $match[1], Logger::DEBUG);
$expanded_url = Network::finalUrl($match[1]);
- Logger::log("statusnet_convertmsg: fetching data for " . $expanded_url, LOGGER_DEBUG);
+ Logger::log("statusnet_convertmsg: fetching data for " . $expanded_url, Logger::DEBUG);
$oembed_data = OEmbed::fetchURL($expanded_url, true);
- Logger::log("statusnet_convertmsg: fetching data: done", LOGGER_DEBUG);
+ Logger::log("statusnet_convertmsg: fetching data: done", Logger::DEBUG);
if ($type == "") {
$type = $oembed_data->type;
return false;
}
- Logger::log('statusnet_is_retweet: Retweeting id ' . $id . ' for user ' . $uid, LOGGER_DEBUG);
+ Logger::log('statusnet_is_retweet: Retweeting id ' . $id . ' for user ' . $uid, Logger::DEBUG);
$connection = new StatusNetOAuth($api, $ckey, $csecret, $otoken, $osecret);
$result = $connection->post('statuses/retweet/' . $id);
- Logger::log('statusnet_is_retweet: result ' . print_r($result, true), LOGGER_DEBUG);
+ Logger::log('statusnet_is_retweet: result ' . print_r($result, true), Logger::DEBUG);
return isset($result->id);
}
function twitter_follow(App $a, array &$contact)
{
- Logger::log("twitter_follow: Check if contact is twitter contact. " . $contact["url"], LOGGER_DEBUG);
+ Logger::log("twitter_follow: Check if contact is twitter contact. " . $contact["url"], Logger::DEBUG);
if (!strstr($contact["url"], "://twitter.com") && !strstr($contact["url"], "@twitter.com")) {
return;
$post = ['id' => $pid];
- Logger::log("twitter_action '" . $action . "' ID: " . $pid . " data: " . print_r($post, true), LOGGER_DATA);
+ Logger::log("twitter_action '" . $action . "' ID: " . $pid . " data: " . print_r($post, true), Logger::DATA);
switch ($action) {
case "delete":
$result = $connection->post('favorites/destroy', $post);
break;
default:
- Logger::log('Unhandled action ' . $action, LOGGER_DEBUG);
+ Logger::log('Unhandled action ' . $action, Logger::DEBUG);
$result = [];
}
- Logger::log("twitter_action '" . $action . "' send, result: " . print_r($result, true), LOGGER_DEBUG);
+ Logger::log("twitter_action '" . $action . "' send, result: " . print_r($result, true), Logger::DEBUG);
}
function twitter_post_hook(App $a, array &$b)
}
if ($b['parent'] != $b['id']) {
- Logger::log("twitter_post_hook: parameter " . print_r($b, true), LOGGER_DATA);
+ Logger::log("twitter_post_hook: parameter " . print_r($b, true), Logger::DATA);
// Looking if its a reply to a twitter post
if ((substr($b["parent-uri"], 0, 9) != "twitter::")
$nickname = "@[url=" . $orig_post["author-link"] . "]" . $nicknameplain . "[/url]";
$nicknameplain = "@" . $nicknameplain;
- Logger::log("twitter_post_hook: comparing " . $nickname . " and " . $nicknameplain . " with " . $b["body"], LOGGER_DEBUG);
+ Logger::log("twitter_post_hook: comparing " . $nickname . " and " . $nicknameplain . " with " . $b["body"], Logger::DEBUG);
if ((strpos($b["body"], $nickname) === false) && (strpos($b["body"], $nicknameplain) === false)) {
$b["body"] = $nickname . " " . $b["body"];
}
- Logger::log("twitter_post_hook: parent found " . print_r($orig_post, true), LOGGER_DATA);
+ Logger::log("twitter_post_hook: parent found " . print_r($orig_post, true), Logger::DATA);
} else {
$iscomment = false;
}
if ($b['verb'] == ACTIVITY_LIKE) {
- Logger::log("twitter_post_hook: parameter 2 " . substr($b["thr-parent"], 9), LOGGER_DEBUG);
+ Logger::log("twitter_post_hook: parameter 2 " . substr($b["thr-parent"], 9), Logger::DEBUG);
if ($b['deleted']) {
twitter_action($a, $b["uid"], substr($b["thr-parent"], 9), "unlike");
} else {
$osecret = PConfig::get($b['uid'], 'twitter', 'oauthsecret');
if ($ckey && $csecret && $otoken && $osecret) {
- Logger::log('twitter: we have customer key and oauth stuff, going to send.', LOGGER_DEBUG);
+ Logger::log('twitter: we have customer key and oauth stuff, going to send.', Logger::DEBUG);
// If it's a repeated message from twitter then do a native retweet and exit
if (twitter_is_retweet($a, $b['uid'], $b['body'])) {
$url = 'statuses/update';
$result = $connection->post($url, $post);
- Logger::log('twitter_post send, result: ' . print_r($result, true), LOGGER_DEBUG);
+ Logger::log('twitter_post send, result: ' . print_r($result, true), Logger::DEBUG);
if (!empty($result->source)) {
Config::set("twitter", "application_name", strip_tags($result->source));
}
if (!is_array($items)) {
- Logger::log('No items for user ' . $uid, LOGGER_INFO);
+ Logger::log('No items for user ' . $uid, Logger::INFO);
return;
}
$posts = array_reverse($items);
- Logger::log('Starting from ID ' . $lastid . ' for user ' . $uid, LOGGER_DEBUG);
+ Logger::log('Starting from ID ' . $lastid . ' for user ' . $uid, Logger::DEBUG);
if (count($posts)) {
foreach ($posts as $post) {
$_SESSION["authenticated"] = true;
$_SESSION["uid"] = $uid;
- Logger::log('Preparing Twitter ID ' . $post->id_str . ' for user ' . $uid, LOGGER_DEBUG);
+ Logger::log('Preparing Twitter ID ' . $post->id_str . ' for user ' . $uid, Logger::DEBUG);
$_REQUEST = twitter_do_mirrorpost($a, $uid, $post);
}
}
PConfig::set($uid, 'twitter', 'lastid', $lastid);
- Logger::log('Last ID for user ' . $uid . ' is now ' . $lastid, LOGGER_DEBUG);
+ Logger::log('Last ID for user ' . $uid . ' is now ' . $lastid, Logger::DEBUG);
}
function twitter_queue_hook(App $a)
$connection = new TwitterOAuth($ckey, $csecret, $otoken, $osecret);
$result = $connection->post($z['url'], $z['post']);
- Logger::log('twitter_queue: post result: ' . print_r($result, true), LOGGER_DEBUG);
+ Logger::log('twitter_queue: post result: ' . print_r($result, true), Logger::DEBUG);
if ($result->errors) {
Logger::log('twitter_queue: Send to Twitter failed: "' . print_r($result->errors, true) . '"');
Contact::updateAvatar($avatar, $uid, $contact_id);
} else {
if ($contact["readonly"] || $contact["blocked"]) {
- Logger::log("twitter_fetch_contact: Contact '" . $contact["nick"] . "' is blocked or readonly.", LOGGER_DEBUG);
+ Logger::log("twitter_fetch_contact: Contact '" . $contact["nick"] . "' is blocked or readonly.", Logger::DEBUG);
return -1;
}
// check that we have all the photos, this has been known to fail on occasion
if (empty($contact['photo']) || empty($contact['thumb']) || empty($contact['micro']) || $update_photo) {
- Logger::log("twitter_fetch_contact: Updating contact " . $data->screen_name, LOGGER_DEBUG);
+ Logger::log("twitter_fetch_contact: Updating contact " . $data->screen_name, Logger::DEBUG);
Contact::updateAvatar($avatar, $uid, $contact['id']);
// Don't import our own comments
if (Item::exists(['extid' => $postarray['uri'], 'uid' => $uid])) {
- Logger::log("Item with extid " . $postarray['uri'] . " found.", LOGGER_DEBUG);
+ Logger::log("Item with extid " . $postarray['uri'] . " found.", Logger::DEBUG);
return [];
}
$postarray['owner-link'] = $r[0]["url"];
$postarray['owner-avatar'] = $r[0]["photo"];
} else {
- Logger::log("No self contact for user " . $uid, LOGGER_DEBUG);
+ Logger::log("No self contact for user " . $uid, Logger::DEBUG);
return [];
}
}
if (($contactid == 0) && !$only_existing_contact) {
$contactid = $self['id'];
} elseif ($contactid <= 0) {
- Logger::log("Contact ID is zero or less than zero.", LOGGER_DEBUG);
+ Logger::log("Contact ID is zero or less than zero.", Logger::DEBUG);
return [];
}
function twitter_fetchparentposts(App $a, $uid, $post, TwitterOAuth $connection, array $self)
{
- Logger::log("twitter_fetchparentposts: Fetching for user " . $uid . " and post " . $post->id_str, LOGGER_DEBUG);
+ Logger::log("twitter_fetchparentposts: Fetching for user " . $uid . " and post " . $post->id_str, Logger::DEBUG);
$posts = [];
}
if (empty($post)) {
- Logger::log("twitter_fetchparentposts: Can't fetch post " . $parameters->id, LOGGER_DEBUG);
+ Logger::log("twitter_fetchparentposts: Can't fetch post " . $parameters->id, Logger::DEBUG);
break;
}
if (empty($post->id_str)) {
- Logger::log("twitter_fetchparentposts: This is not a post " . json_encode($post), LOGGER_DEBUG);
+ Logger::log("twitter_fetchparentposts: This is not a post " . json_encode($post), Logger::DEBUG);
break;
}
$posts[] = $post;
}
- Logger::log("twitter_fetchparentposts: Fetching " . count($posts) . " parents", LOGGER_DEBUG);
+ Logger::log("twitter_fetchparentposts: Fetching " . count($posts) . " parents", Logger::DEBUG);
$posts = array_reverse($posts);
$create_user = PConfig::get($uid, 'twitter', 'create_user');
$mirror_posts = PConfig::get($uid, 'twitter', 'mirror_posts');
- Logger::log("Fetching timeline for user " . $uid, LOGGER_DEBUG);
+ Logger::log("Fetching timeline for user " . $uid, Logger::DEBUG);
$application_name = Config::get('twitter', 'application_name');
}
if (empty($items)) {
- Logger::log('No new timeline content for user ' . $uid, LOGGER_INFO);
+ Logger::log('No new timeline content for user ' . $uid, Logger::INFO);
return;
}
$posts = array_reverse($items);
- Logger::log('Fetching timeline from ID ' . $lastid . ' for user ' . $uid . ' ' . sizeof($posts) . ' items', LOGGER_DEBUG);
+ Logger::log('Fetching timeline from ID ' . $lastid . ' for user ' . $uid . ' ' . sizeof($posts) . ' items', Logger::DEBUG);
if (count($posts)) {
foreach ($posts as $post) {
}
if (stristr($post->source, $application_name) && $post->user->screen_name == $own_id) {
- Logger::log("Skip previously sent post", LOGGER_DEBUG);
+ Logger::log("Skip previously sent post", Logger::DEBUG);
continue;
}
if ($mirror_posts && $post->user->screen_name == $own_id && $post->in_reply_to_status_id_str == "") {
- Logger::log("Skip post that will be mirrored", LOGGER_DEBUG);
+ Logger::log("Skip post that will be mirrored", Logger::DEBUG);
continue;
}
twitter_fetchparentposts($a, $uid, $post, $connection, $self);
}
- Logger::log('Preparing post ' . $post->id_str . ' for user ' . $uid, LOGGER_DEBUG);
+ Logger::log('Preparing post ' . $post->id_str . ' for user ' . $uid, Logger::DEBUG);
$postarray = twitter_createpost($a, $uid, $post, $self, $create_user, true, false);
if (empty($postarray['body']) || trim($postarray['body']) == "") {
- Logger::log('Empty body for post ' . $post->id_str . ' and user ' . $uid, LOGGER_DEBUG);
+ Logger::log('Empty body for post ' . $post->id_str . ' and user ' . $uid, Logger::DEBUG);
continue;
}
}
PConfig::set($uid, 'twitter', 'lasthometimelineid', $lastid);
- Logger::log('Last timeline ID for user ' . $uid . ' is now ' . $lastid, LOGGER_DEBUG);
+ Logger::log('Last timeline ID for user ' . $uid . ' is now ' . $lastid, Logger::DEBUG);
// Fetching mentions
$lastid = PConfig::get($uid, 'twitter', 'lastmentionid');
}
if (!is_array($items)) {
- Logger::log("Error fetching mentions: " . print_r($items, true), LOGGER_DEBUG);
+ Logger::log("Error fetching mentions: " . print_r($items, true), Logger::DEBUG);
return;
}
$posts = array_reverse($items);
- Logger::log("Fetching mentions for user " . $uid . " " . sizeof($posts) . " items", LOGGER_DEBUG);
+ Logger::log("Fetching mentions for user " . $uid . " " . sizeof($posts) . " items", Logger::DEBUG);
if (count($posts)) {
foreach ($posts as $post) {
PConfig::set($uid, 'twitter', 'lastmentionid', $lastid);
- Logger::log('Last mentions ID for user ' . $uid . ' is now ' . $lastid, LOGGER_DEBUG);
+ Logger::log('Last mentions ID for user ' . $uid . ' is now ' . $lastid, Logger::DEBUG);
}
function twitter_fetch_own_contact(App $a, $uid)
return false;
}
- Logger::log('twitter_is_retweet: Retweeting id ' . $id . ' for user ' . $uid, LOGGER_DEBUG);
+ Logger::log('twitter_is_retweet: Retweeting id ' . $id . ' for user ' . $uid, Logger::DEBUG);
$ckey = Config::get('twitter', 'consumerkey');
$csecret = Config::get('twitter', 'consumersecret');
$connection = new TwitterOAuth($ckey, $csecret, $otoken, $osecret);
$result = $connection->post('statuses/retweet/' . $id);
- Logger::log('twitter_is_retweet: result ' . print_r($result, true), LOGGER_DEBUG);
+ Logger::log('twitter_is_retweet: result ' . print_r($result, true), Logger::DEBUG);
return !isset($result->errors);
}
function windowsphonepush_login(App $a)
{
if (!isset($_SERVER['PHP_AUTH_USER'])) {
- Logger::log('API_login: ' . print_r($_SERVER, true), LOGGER_DEBUG);
+ Logger::log('API_login: ' . print_r($_SERVER, true), Logger::DEBUG);
header('WWW-Authenticate: Basic realm="Friendica"');
header('HTTP/1.0 401 Unauthorized');
die('This api requires login');
if ($user_id) {
$record = DBA::selectFirst('user', [], ['uid' => $user_id]);
} else {
- Logger::log('API_login failure: ' . print_r($_SERVER, true), LOGGER_DEBUG);
+ Logger::log('API_login failure: ' . print_r($_SERVER, true), Logger::DEBUG);
header('WWW-Authenticate: Basic realm="Friendica"');
header('HTTP/1.0 401 Unauthorized');
die('This api requires login');
EOT;
- Logger::log('wppost: data: ' . $xml, LOGGER_DATA);
+ Logger::log('wppost: data: ' . $xml, Logger::DATA);
if ($wp_blog !== 'test') {
$x = Network::post($wp_blog, $xml)->getBody();
}
- Logger::log('posted to wordpress: ' . (($x) ? $x : ''), LOGGER_DEBUG);
+ Logger::log('posted to wordpress: ' . (($x) ? $x : ''), Logger::DEBUG);
}
}