forked from friendica/friendica-addons
		
	Core Logger
implement log() function. more to squash Core Logger Class implement log() function
This commit is contained in:
		
					parent
					
						
							
								b53157370a
							
						
					
				
			
			
				commit
				
					
						49eff56e5d
					
				
			
		
					 46 changed files with 348 additions and 302 deletions
				
			
		| 
						 | 
				
			
			@ -46,6 +46,7 @@ use Friendica\Content\Text\Plaintext;
 | 
			
		|||
use Friendica\Core\Addon;
 | 
			
		||||
use Friendica\Core\Config;
 | 
			
		||||
use Friendica\Core\L10n;
 | 
			
		||||
use Friendica\Core\Logger;
 | 
			
		||||
use Friendica\Core\PConfig;
 | 
			
		||||
use Friendica\Core\Protocol;
 | 
			
		||||
use Friendica\Database\DBA;
 | 
			
		||||
| 
						 | 
				
			
			@ -70,7 +71,7 @@ function statusnet_install()
 | 
			
		|||
	Addon::registerHook('cron', 'addon/statusnet/statusnet.php', 'statusnet_cron');
 | 
			
		||||
	Addon::registerHook('prepare_body', 'addon/statusnet/statusnet.php', 'statusnet_prepare_body');
 | 
			
		||||
	Addon::registerHook('check_item_notification', 'addon/statusnet/statusnet.php', 'statusnet_check_item_notification');
 | 
			
		||||
	logger("installed GNU Social");
 | 
			
		||||
	Logger::log("installed GNU Social");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function statusnet_uninstall()
 | 
			
		||||
| 
						 | 
				
			
			@ -429,7 +430,7 @@ function statusnet_action(App $a, $uid, $pid, $action)
 | 
			
		|||
 | 
			
		||||
	$connection = new StatusNetOAuth($api, $ckey, $csecret, $otoken, $osecret);
 | 
			
		||||
 | 
			
		||||
	logger("statusnet_action '" . $action . "' ID: " . $pid, LOGGER_DATA);
 | 
			
		||||
	Logger::log("statusnet_action '" . $action . "' ID: " . $pid, LOGGER_DATA);
 | 
			
		||||
 | 
			
		||||
	switch ($action) {
 | 
			
		||||
		case "delete":
 | 
			
		||||
| 
						 | 
				
			
			@ -442,7 +443,7 @@ function statusnet_action(App $a, $uid, $pid, $action)
 | 
			
		|||
			$result = $connection->post("favorites/destroy/" . $pid);
 | 
			
		||||
			break;
 | 
			
		||||
	}
 | 
			
		||||
	logger("statusnet_action '" . $action . "' send, result: " . print_r($result, true), LOGGER_DEBUG);
 | 
			
		||||
	Logger::log("statusnet_action '" . $action . "' send, result: " . print_r($result, true), LOGGER_DEBUG);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function statusnet_post_hook(App $a, &$b)
 | 
			
		||||
| 
						 | 
				
			
			@ -459,19 +460,19 @@ function statusnet_post_hook(App $a, &$b)
 | 
			
		|||
	$hostname = preg_replace("=https?://([\w\.]*)/.*=ism", "$1", $api);
 | 
			
		||||
 | 
			
		||||
	if ($b['parent'] != $b['id']) {
 | 
			
		||||
		logger("statusnet_post_hook: parameter " . print_r($b, true), LOGGER_DATA);
 | 
			
		||||
		Logger::log("statusnet_post_hook: parameter " . print_r($b, true), LOGGER_DATA);
 | 
			
		||||
 | 
			
		||||
		// Looking if its a reply to a GNU Social post
 | 
			
		||||
		$hostlength = strlen($hostname) + 2;
 | 
			
		||||
		if ((substr($b["parent-uri"], 0, $hostlength) != $hostname . "::") && (substr($b["extid"], 0, $hostlength) != $hostname . "::") && (substr($b["thr-parent"], 0, $hostlength) != $hostname . "::")) {
 | 
			
		||||
			logger("statusnet_post_hook: no GNU Social post " . $b["parent"]);
 | 
			
		||||
			Logger::log("statusnet_post_hook: no GNU Social post " . $b["parent"]);
 | 
			
		||||
			return;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		$condition = ['uri' => $b["thr-parent"], 'uid' => $b["uid"]];
 | 
			
		||||
		$orig_post = Item::selectFirst(['author-link', 'uri'], $condition);
 | 
			
		||||
		if (!DBA::isResult($orig_post)) {
 | 
			
		||||
			logger("statusnet_post_hook: no parent found " . $b["thr-parent"]);
 | 
			
		||||
			Logger::log("statusnet_post_hook: no parent found " . $b["thr-parent"]);
 | 
			
		||||
			return;
 | 
			
		||||
		} else {
 | 
			
		||||
			$iscomment = true;
 | 
			
		||||
| 
						 | 
				
			
			@ -482,12 +483,12 @@ function statusnet_post_hook(App $a, &$b)
 | 
			
		|||
		$nickname = "@[url=" . $orig_post["author-link"] . "]" . $nick . "[/url]";
 | 
			
		||||
		$nicknameplain = "@" . $nick;
 | 
			
		||||
 | 
			
		||||
		logger("statusnet_post_hook: comparing " . $nickname . " and " . $nicknameplain . " with " . $b["body"], LOGGER_DEBUG);
 | 
			
		||||
		Logger::log("statusnet_post_hook: comparing " . $nickname . " and " . $nicknameplain . " with " . $b["body"], LOGGER_DEBUG);
 | 
			
		||||
		if ((strpos($b["body"], $nickname) === false) && (strpos($b["body"], $nicknameplain) === false)) {
 | 
			
		||||
			$b["body"] = $nickname . " " . $b["body"];
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		logger("statusnet_post_hook: parent found " . print_r($orig_post, true), LOGGER_DEBUG);
 | 
			
		||||
		Logger::log("statusnet_post_hook: parent found " . print_r($orig_post, true), LOGGER_DEBUG);
 | 
			
		||||
	} else {
 | 
			
		||||
		$iscomment = false;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -508,7 +509,7 @@ function statusnet_post_hook(App $a, &$b)
 | 
			
		|||
	}
 | 
			
		||||
 | 
			
		||||
	if ($b['verb'] == ACTIVITY_LIKE) {
 | 
			
		||||
		logger("statusnet_post_hook: parameter 2 " . substr($b["thr-parent"], $hostlength), LOGGER_DEBUG);
 | 
			
		||||
		Logger::log("statusnet_post_hook: parameter 2 " . substr($b["thr-parent"], $hostlength), LOGGER_DEBUG);
 | 
			
		||||
		if ($b['deleted'])
 | 
			
		||||
			statusnet_action($a, $b["uid"], substr($b["thr-parent"], $hostlength), "unlike");
 | 
			
		||||
		else
 | 
			
		||||
| 
						 | 
				
			
			@ -529,7 +530,7 @@ function statusnet_post_hook(App $a, &$b)
 | 
			
		|||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	logger('GNU Socialpost invoked');
 | 
			
		||||
	Logger::log('GNU Socialpost invoked');
 | 
			
		||||
 | 
			
		||||
	PConfig::load($b['uid'], 'statusnet');
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -578,7 +579,7 @@ function statusnet_post_hook(App $a, &$b)
 | 
			
		|||
		if (strlen($msg)) {
 | 
			
		||||
			if ($iscomment) {
 | 
			
		||||
				$postdata["in_reply_to_status_id"] = substr($orig_post["uri"], $hostlength);
 | 
			
		||||
				logger('statusnet_post send reply ' . print_r($postdata, true), LOGGER_DEBUG);
 | 
			
		||||
				Logger::log('statusnet_post send reply ' . print_r($postdata, true), LOGGER_DEBUG);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			// New code that is able to post pictures
 | 
			
		||||
| 
						 | 
				
			
			@ -589,7 +590,7 @@ function statusnet_post_hook(App $a, &$b)
 | 
			
		|||
			$cb->setToken($otoken, $osecret);
 | 
			
		||||
			$result = $cb->statuses_update($postdata);
 | 
			
		||||
			//$result = $dent->post('statuses/update', $postdata);
 | 
			
		||||
			logger('statusnet_post send, result: ' . print_r($result, true) .
 | 
			
		||||
			Logger::log('statusnet_post send, result: ' . print_r($result, true) .
 | 
			
		||||
				"\nmessage: " . $msg . "\nOriginal post: " . print_r($b, true) . "\nPost Data: " . print_r($postdata, true), LOGGER_DEBUG);
 | 
			
		||||
 | 
			
		||||
			if (!empty($result->source)) {
 | 
			
		||||
| 
						 | 
				
			
			@ -597,9 +598,9 @@ function statusnet_post_hook(App $a, &$b)
 | 
			
		|||
			}
 | 
			
		||||
 | 
			
		||||
			if (!empty($result->error)) {
 | 
			
		||||
				logger('Send to GNU Social failed: "' . $result->error . '"');
 | 
			
		||||
				Logger::log('Send to GNU Social failed: "' . $result->error . '"');
 | 
			
		||||
			} elseif ($iscomment) {
 | 
			
		||||
				logger('statusnet_post: Update extid ' . $result->id . " for post id " . $b['id']);
 | 
			
		||||
				Logger::log('statusnet_post: Update extid ' . $result->id . " for post id " . $b['id']);
 | 
			
		||||
				Item::update(['extid' => $hostname . "::" . $result->id, 'body' => $result->text], ['id' => $b['id']]);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
| 
						 | 
				
			
			@ -729,16 +730,16 @@ function statusnet_cron(App $a, $b)
 | 
			
		|||
	if ($last) {
 | 
			
		||||
		$next = $last + ($poll_interval * 60);
 | 
			
		||||
		if ($next > time()) {
 | 
			
		||||
			logger('statusnet: poll intervall not reached');
 | 
			
		||||
			Logger::log('statusnet: poll intervall not reached');
 | 
			
		||||
			return;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	logger('statusnet: cron_start');
 | 
			
		||||
	Logger::log('statusnet: cron_start');
 | 
			
		||||
 | 
			
		||||
	$r = q("SELECT * FROM `pconfig` WHERE `cat` = 'statusnet' AND `k` = 'mirror_posts' AND `v` = '1' ORDER BY RAND() ");
 | 
			
		||||
	if (DBA::isResult($r)) {
 | 
			
		||||
		foreach ($r as $rr) {
 | 
			
		||||
			logger('statusnet: fetching for user ' . $rr['uid']);
 | 
			
		||||
			Logger::log('statusnet: fetching for user ' . $rr['uid']);
 | 
			
		||||
			statusnet_fetchtimeline($a, $rr['uid']);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			@ -756,17 +757,17 @@ function statusnet_cron(App $a, $b)
 | 
			
		|||
			if ($abandon_days != 0) {
 | 
			
		||||
				$user = q("SELECT `login_date` FROM `user` WHERE uid=%d AND `login_date` >= '%s'", $rr['uid'], $abandon_limit);
 | 
			
		||||
				if (!DBA::isResult($user)) {
 | 
			
		||||
					logger('abandoned account: timeline from user ' . $rr['uid'] . ' will not be imported');
 | 
			
		||||
					Logger::log('abandoned account: timeline from user ' . $rr['uid'] . ' will not be imported');
 | 
			
		||||
					continue;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			logger('statusnet: importing timeline from user ' . $rr['uid']);
 | 
			
		||||
			Logger::log('statusnet: importing timeline from user ' . $rr['uid']);
 | 
			
		||||
			statusnet_fetchhometimeline($a, $rr["uid"], $rr["v"]);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	logger('statusnet: cron_end');
 | 
			
		||||
	Logger::log('statusnet: cron_end');
 | 
			
		||||
 | 
			
		||||
	Config::set('statusnet', 'last_poll', time());
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -871,7 +872,7 @@ function statusnet_fetchtimeline(App $a, $uid)
 | 
			
		|||
 | 
			
		||||
				//print_r($_REQUEST);
 | 
			
		||||
				if ($_REQUEST["body"] != "") {
 | 
			
		||||
					logger('statusnet: posting for user ' . $uid);
 | 
			
		||||
					Logger::log('statusnet: posting for user ' . $uid);
 | 
			
		||||
 | 
			
		||||
					item_post($a);
 | 
			
		||||
				}
 | 
			
		||||
| 
						 | 
				
			
			@ -912,7 +913,7 @@ function statusnet_fetch_contact($uid, $contact, $create_user)
 | 
			
		|||
	}
 | 
			
		||||
 | 
			
		||||
	if (DBA::isResult($r) && ($r[0]["readonly"] || $r[0]["blocked"])) {
 | 
			
		||||
		logger("statusnet_fetch_contact: Contact '" . $r[0]["nick"] . "' is blocked or readonly.", LOGGER_DEBUG);
 | 
			
		||||
		Logger::log("statusnet_fetch_contact: Contact '" . $r[0]["nick"] . "' is blocked or readonly.", LOGGER_DEBUG);
 | 
			
		||||
		return -1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -974,7 +975,7 @@ function statusnet_fetch_contact($uid, $contact, $create_user)
 | 
			
		|||
 | 
			
		||||
		// check that we have all the photos, this has been known to fail on occasion
 | 
			
		||||
		if ((!$r[0]['photo']) || (!$r[0]['thumb']) || (!$r[0]['micro']) || ($update_photo)) {
 | 
			
		||||
			logger("statusnet_fetch_contact: Updating contact " . $contact->screen_name, LOGGER_DEBUG);
 | 
			
		||||
			Logger::log("statusnet_fetch_contact: Updating contact " . $contact->screen_name, LOGGER_DEBUG);
 | 
			
		||||
 | 
			
		||||
			$photos = Photo::importProfilePhoto($contact->profile_image_url, $uid, $r[0]['id']);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1060,7 +1061,7 @@ function statusnet_fetchuser(App $a, $uid, $screen_name = "", $user_id = "")
 | 
			
		|||
 | 
			
		||||
function statusnet_createpost(App $a, $uid, $post, $self, $create_user, $only_existing_contact)
 | 
			
		||||
{
 | 
			
		||||
	logger("statusnet_createpost: start", LOGGER_DEBUG);
 | 
			
		||||
	Logger::log("statusnet_createpost: start", LOGGER_DEBUG);
 | 
			
		||||
 | 
			
		||||
	$api = PConfig::get($uid, 'statusnet', 'baseapi');
 | 
			
		||||
	$hostname = preg_replace("=https?://([\w\.]*)/.*=ism", "$1", $api);
 | 
			
		||||
| 
						 | 
				
			
			@ -1187,7 +1188,7 @@ function statusnet_createpost(App $a, $uid, $post, $self, $create_user, $only_ex
 | 
			
		|||
		$postarray["coord"] = $content->coordinates->coordinates[1] . " " . $content->coordinates->coordinates[0];
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	logger("statusnet_createpost: end", LOGGER_DEBUG);
 | 
			
		||||
	Logger::log("statusnet_createpost: end", LOGGER_DEBUG);
 | 
			
		||||
 | 
			
		||||
	return $postarray;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1206,7 +1207,7 @@ function statusnet_fetchhometimeline(App $a, $uid, $mode = 1)
 | 
			
		|||
	// "create_user" is deactivated, since currently you cannot add users manually by now
 | 
			
		||||
	$create_user = true;
 | 
			
		||||
 | 
			
		||||
	logger("statusnet_fetchhometimeline: Fetching for user " . $uid, LOGGER_DEBUG);
 | 
			
		||||
	Logger::log("statusnet_fetchhometimeline: Fetching for user " . $uid, LOGGER_DEBUG);
 | 
			
		||||
 | 
			
		||||
	require_once 'include/items.php';
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1221,7 +1222,7 @@ function statusnet_fetchhometimeline(App $a, $uid, $mode = 1)
 | 
			
		|||
	if (DBA::isResult($r)) {
 | 
			
		||||
		$nick = $r[0]["nick"];
 | 
			
		||||
	} else {
 | 
			
		||||
		logger("statusnet_fetchhometimeline: Own GNU Social contact not found for user " . $uid, LOGGER_DEBUG);
 | 
			
		||||
		Logger::log("statusnet_fetchhometimeline: Own GNU Social contact not found for user " . $uid, LOGGER_DEBUG);
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1231,14 +1232,14 @@ function statusnet_fetchhometimeline(App $a, $uid, $mode = 1)
 | 
			
		|||
	if (DBA::isResult($r)) {
 | 
			
		||||
		$self = $r[0];
 | 
			
		||||
	} else {
 | 
			
		||||
		logger("statusnet_fetchhometimeline: Own contact not found for user " . $uid, LOGGER_DEBUG);
 | 
			
		||||
		Logger::log("statusnet_fetchhometimeline: Own contact not found for user " . $uid, LOGGER_DEBUG);
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	$u = q("SELECT * FROM user WHERE uid = %d LIMIT 1",
 | 
			
		||||
		intval($uid));
 | 
			
		||||
	if (!DBA::isResult($u)) {
 | 
			
		||||
		logger("statusnet_fetchhometimeline: Own user not found for user " . $uid, LOGGER_DEBUG);
 | 
			
		||||
		Logger::log("statusnet_fetchhometimeline: Own user not found for user " . $uid, LOGGER_DEBUG);
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1269,13 +1270,13 @@ function statusnet_fetchhometimeline(App $a, $uid, $mode = 1)
 | 
			
		|||
				$errormsg = "Unknown error";
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			logger("statusnet_fetchhometimeline: Error fetching home timeline: " . $errormsg, LOGGER_DEBUG);
 | 
			
		||||
			Logger::log("statusnet_fetchhometimeline: Error fetching home timeline: " . $errormsg, LOGGER_DEBUG);
 | 
			
		||||
			return;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		$posts = array_reverse($items);
 | 
			
		||||
 | 
			
		||||
		logger("statusnet_fetchhometimeline: Fetching timeline for user " . $uid . " " . sizeof($posts) . " items", LOGGER_DEBUG);
 | 
			
		||||
		Logger::log("statusnet_fetchhometimeline: Fetching timeline for user " . $uid . " " . sizeof($posts) . " items", LOGGER_DEBUG);
 | 
			
		||||
 | 
			
		||||
		if (count($posts)) {
 | 
			
		||||
			foreach ($posts as $post) {
 | 
			
		||||
| 
						 | 
				
			
			@ -1303,7 +1304,7 @@ function statusnet_fetchhometimeline(App $a, $uid, $mode = 1)
 | 
			
		|||
					$item = Item::insert($postarray);
 | 
			
		||||
					$postarray["id"] = $item;
 | 
			
		||||
 | 
			
		||||
					logger('statusnet_fetchhometimeline: User ' . $self["nick"] . ' posted home timeline item ' . $item);
 | 
			
		||||
					Logger::log('statusnet_fetchhometimeline: User ' . $self["nick"] . ' posted home timeline item ' . $item);
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
| 
						 | 
				
			
			@ -1321,13 +1322,13 @@ function statusnet_fetchhometimeline(App $a, $uid, $mode = 1)
 | 
			
		|||
	$items = $connection->get('statuses/mentions_timeline', $parameters);
 | 
			
		||||
 | 
			
		||||
	if (!is_array($items)) {
 | 
			
		||||
		logger("statusnet_fetchhometimeline: Error fetching mentions: " . print_r($items, true), LOGGER_DEBUG);
 | 
			
		||||
		Logger::log("statusnet_fetchhometimeline: Error fetching mentions: " . print_r($items, true), LOGGER_DEBUG);
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	$posts = array_reverse($items);
 | 
			
		||||
 | 
			
		||||
	logger("statusnet_fetchhometimeline: Fetching mentions for user " . $uid . " " . sizeof($posts) . " items", LOGGER_DEBUG);
 | 
			
		||||
	Logger::log("statusnet_fetchhometimeline: Fetching mentions for user " . $uid . " " . sizeof($posts) . " items", LOGGER_DEBUG);
 | 
			
		||||
 | 
			
		||||
	if (count($posts)) {
 | 
			
		||||
		foreach ($posts as $post) {
 | 
			
		||||
| 
						 | 
				
			
			@ -1353,7 +1354,7 @@ function statusnet_fetchhometimeline(App $a, $uid, $mode = 1)
 | 
			
		|||
 | 
			
		||||
				$item = Item::insert($postarray);
 | 
			
		||||
 | 
			
		||||
				logger('statusnet_fetchhometimeline: User ' . $self["nick"] . ' posted mention timeline item ' . $item);
 | 
			
		||||
				Logger::log('statusnet_fetchhometimeline: User ' . $self["nick"] . ' posted mention timeline item ' . $item);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			@ -1388,7 +1389,7 @@ function statusnet_complete_conversation(App $a, $uid, $self, $create_user, $nic
 | 
			
		|||
			$item = Item::insert($postarray);
 | 
			
		||||
			$postarray["id"] = $item;
 | 
			
		||||
 | 
			
		||||
			logger('statusnet_complete_conversation: User ' . $self["nick"] . ' posted home timeline item ' . $item);
 | 
			
		||||
			Logger::log('statusnet_complete_conversation: User ' . $self["nick"] . ' posted home timeline item ' . $item);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1411,15 +1412,15 @@ function statusnet_convertmsg(App $a, $body, $no_tags = false)
 | 
			
		|||
		foreach ($matches AS $match) {
 | 
			
		||||
			$search = "[url=" . $match[1] . "]" . $match[2] . "[/url]";
 | 
			
		||||
 | 
			
		||||
			logger("statusnet_convertmsg: expanding url " . $match[1], LOGGER_DEBUG);
 | 
			
		||||
			Logger::log("statusnet_convertmsg: expanding url " . $match[1], LOGGER_DEBUG);
 | 
			
		||||
 | 
			
		||||
			$expanded_url = Network::finalUrl($match[1]);
 | 
			
		||||
 | 
			
		||||
			logger("statusnet_convertmsg: fetching data for " . $expanded_url, LOGGER_DEBUG);
 | 
			
		||||
			Logger::log("statusnet_convertmsg: fetching data for " . $expanded_url, LOGGER_DEBUG);
 | 
			
		||||
 | 
			
		||||
			$oembed_data = OEmbed::fetchURL($expanded_url, true);
 | 
			
		||||
 | 
			
		||||
			logger("statusnet_convertmsg: fetching data: done", LOGGER_DEBUG);
 | 
			
		||||
			Logger::log("statusnet_convertmsg: fetching data: done", LOGGER_DEBUG);
 | 
			
		||||
 | 
			
		||||
			if ($type == "") {
 | 
			
		||||
				$type = $oembed_data->type;
 | 
			
		||||
| 
						 | 
				
			
			@ -1581,13 +1582,13 @@ function statusnet_is_retweet(App $a, $uid, $body)
 | 
			
		|||
		return false;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	logger('statusnet_is_retweet: Retweeting id ' . $id . ' for user ' . $uid, LOGGER_DEBUG);
 | 
			
		||||
	Logger::log('statusnet_is_retweet: Retweeting id ' . $id . ' for user ' . $uid, LOGGER_DEBUG);
 | 
			
		||||
 | 
			
		||||
	$connection = new StatusNetOAuth($api, $ckey, $csecret, $otoken, $osecret);
 | 
			
		||||
 | 
			
		||||
	$result = $connection->post('statuses/retweet/' . $id);
 | 
			
		||||
 | 
			
		||||
	logger('statusnet_is_retweet: result ' . print_r($result, true), LOGGER_DEBUG);
 | 
			
		||||
	Logger::log('statusnet_is_retweet: result ' . print_r($result, true), LOGGER_DEBUG);
 | 
			
		||||
 | 
			
		||||
	return isset($result->id);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue