From e98c299cd2b3f2f855c31c8fca4fd5659f53cced Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Mon, 6 Apr 2015 14:04:40 +0200 Subject: [PATCH] Support for new "share_header" function --- fromgplus/fromgplus.php | 17 +++++++++++++---- pumpio/pumpio.php | 6 +++++- twitter/twitter.php | 21 ++++++++++++++++----- 3 files changed, 34 insertions(+), 10 deletions(-) diff --git a/fromgplus/fromgplus.php b/fromgplus/fromgplus.php index e0725a46d..933567ce7 100644 --- a/fromgplus/fromgplus.php +++ b/fromgplus/fromgplus.php @@ -9,6 +9,8 @@ define('FROMGPLUS_DEFAULT_POLL_INTERVAL', 30); // given in minutes +require_once('mod/share.php'); + function fromgplus_install() { register_hook('connector_settings', 'addon/fromgplus/fromgplus.php', 'fromgplus_addon_settings'); register_hook('connector_settings_post', 'addon/fromgplus/fromgplus.php', 'fromgplus_addon_settings_post'); @@ -461,10 +463,17 @@ function fromgplus_fetch($a, $uid) { $post = fromgplus_html2bbcode($item->annotation)."\n"; if (!intval(get_config('system','old_share'))) { - $post .= "[share author='".str_replace("'", "'",$item->object->actor->displayName). - "' profile='".$item->object->actor->url. - "' avatar='".$item->object->actor->image->url. - "' link='".$item->object->url."']"; + + if (function_exists("share_header")) + $post .= share_header($item->object->actor->displayName, $item->object->actor->url, + $item->object->actor->image->url, "", + datetime_convert('UTC','UTC',$item->object->published),$item->object->url); + else + $post .= "[share author='".str_replace("'", "'",$item->object->actor->displayName). + "' profile='".$item->object->actor->url. + "' avatar='".$item->object->actor->image->url. + "' posted='".datetime_convert('UTC','UTC',$item->object->published). + "' link='".$item->object->url."']"; $post .= fromgplus_html2bbcode($item->object->content); diff --git a/pumpio/pumpio.php b/pumpio/pumpio.php index b413f59e5..2b8cc6d8b 100644 --- a/pumpio/pumpio.php +++ b/pumpio/pumpio.php @@ -68,8 +68,10 @@ function pumpio_registerclient(&$a, $host) { if ($application_name == "") $application_name = $a->get_hostname(); + $adminlist = explode(",", str_replace(" ", "", $a->config['admin_email'])); + $params["type"] = "client_associate"; - $params["contacts"] = $a->config['admin_email']; + $params["contacts"] = $adminlist[0]; $params["application_type"] = "native"; $params["application_name"] = $application_name; $params["logo_url"] = $a->get_baseurl()."/images/friendica-256.png"; @@ -302,6 +304,7 @@ function pumpio_settings_post(&$a,&$b) { set_pconfig(local_user(),'pumpio','mirror',false); set_pconfig(local_user(),'pumpio','post_by_default',false); set_pconfig(local_user(),'pumpio','lastdate', 0); + set_pconfig(local_user(),'pumpio','last_id', ''); } else { // filtering the username if it is filled wrong $user = $_POST['pumpio_user']; @@ -1233,6 +1236,7 @@ function pumpio_dopost(&$a, $client, $uid, $self, $post, $own_id, $threadcomplet $postarray['body'] = "[share author='".$post->object->author->displayName. "' profile='".$post->object->author->url. "' avatar='".$post->object->author->image->url. + "' posted='".datetime_convert('UTC','UTC',$post->object->created). "' link='".$post->links->self->href."']".$postarray['body']."[/share]"; } else { // Let shares look like wall-to-wall posts diff --git a/twitter/twitter.php b/twitter/twitter.php index 8d7e21fbb..d7a5eec50 100644 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -733,6 +733,7 @@ function twitter_fetchtimeline($a, $uid) { require_once('mod/item.php'); require_once('include/items.php'); + require_once('mod/share.php'); require_once('library/twitteroauth.php'); $connection = new TwitterOAuth($ckey,$csecret,$otoken,$osecret); @@ -798,11 +799,20 @@ function twitter_fetchtimeline($a, $uid) { $converted = twitter_expand_entities($a, $_REQUEST['body'], $post->retweeted_status, true, $picture); $_REQUEST['body'] = $converted["body"]; - $_REQUEST['body'] = "[share author='".$post->retweeted_status->user->name. - "' profile='https://twitter.com/".$post->retweeted_status->user->screen_name. - "' avatar='".$post->retweeted_status->user->profile_image_url_https. - "' link='https://twitter.com/".$post->retweeted_status->user->screen_name."/status/".$post->retweeted_status->id_str."']". - $_REQUEST['body']; + if (function_exists("share_header")) + $_REQUEST['body'] = share_header($post->retweeted_status->user->name, "https://twitter.com/".$post->retweeted_status->user->screen_name, + $post->retweeted_status->user->profile_image_url_https, "", + datetime_convert('UTC','UTC',$post->retweeted_status->created_at), + "https://twitter.com/".$post->retweeted_status->user->screen_name."/status/".$post->retweeted_status->id_str). + $_REQUEST['body']; + else + $_REQUEST['body'] = "[share author='".$post->retweeted_status->user->name. + "' profile='https://twitter.com/".$post->retweeted_status->user->screen_name. + "' avatar='".$post->retweeted_status->user->profile_image_url_https. + "' posted='".datetime_convert('UTC','UTC',$post->retweeted_status->created_at). + "' link='https://twitter.com/".$post->retweeted_status->user->screen_name."/status/".$post->retweeted_status->id_str."']". + $_REQUEST['body']; + $_REQUEST['body'] .= "[/share]"; } else { $_REQUEST["body"] = $post->text; @@ -1446,6 +1456,7 @@ function twitter_createpost($a, $uid, $post, $self, $create_user, $only_existing $postarray['body'] = "[share author='".$post->retweeted_status->user->name. "' profile='https://twitter.com/".$post->retweeted_status->user->screen_name. "' avatar='".$post->retweeted_status->user->profile_image_url_https. + "' posted='".datetime_convert('UTC','UTC',$post->retweeted_status->created_at). "' link='https://twitter.com/".$post->retweeted_status->user->screen_name."/status/".$post->retweeted_status->id_str."']". $postarray['body']; $postarray['body'] .= "[/share]";