Merge pull request #1765 from annando/1507-redmatrix-network-name

Show "Redmatrix" as contact network
This commit is contained in:
Tobias Diekershoff 2015-07-16 14:34:54 +02:00
commit 5b96c7b3e3
10 changed files with 36 additions and 30 deletions

View file

@ -505,7 +505,7 @@
}
require_once('include/contact_selectors.php');
$network_name = network_to_name($uinfo[0]['network']);
$network_name = network_to_name($uinfo[0]['network'], $uinfo[0]['url']);
$ret = Array(
'id' => intval($r[0]['id']),
@ -996,9 +996,9 @@
$status_info["entities"] = $converted["entities"];
if (($lastwall['item_network'] != "") AND ($status["source"] == 'web'))
$status_info["source"] = network_to_name($lastwall['item_network']);
elseif (($lastwall['item_network'] != "") AND (network_to_name($lastwall['item_network']) != $status_info["source"]))
$status_info["source"] = trim($status_info["source"].' ('.network_to_name($lastwall['item_network']).')');
$status_info["source"] = network_to_name($lastwall['item_network'], $user_info['url']);
elseif (($lastwall['item_network'] != "") AND (network_to_name($lastwall['item_network'], $user_info['url']) != $status_info["source"]))
$status_info["source"] = trim($status_info["source"].' ('.network_to_name($lastwall['item_network'], $user_info['url']).')');
// "uid" and "self" are only needed for some internal stuff, so remove it from here
unset($status_info["user"]["uid"]);
@ -1095,9 +1095,9 @@
$user_info["status"]["entities"] = $converted["entities"];
if (($lastwall['item_network'] != "") AND ($user_info["status"]["source"] == 'web'))
$user_info["status"]["source"] = network_to_name($lastwall['item_network']);
if (($lastwall['item_network'] != "") AND (network_to_name($lastwall['item_network']) != $user_info["status"]["source"]))
$user_info["status"]["source"] = trim($user_info["status"]["source"].' ('.network_to_name($lastwall['item_network']).')');
$user_info["status"]["source"] = network_to_name($lastwall['item_network'], $user_info['url']);
if (($lastwall['item_network'] != "") AND (network_to_name($lastwall['item_network'], $user_info['url']) != $user_info["status"]["source"]))
$user_info["status"]["source"] = trim($user_info["status"]["source"].' ('.network_to_name($lastwall['item_network'], $user_info['url']).')');
}
@ -2214,9 +2214,9 @@
$status["entities"] = $converted["entities"];
if (($item['item_network'] != "") AND ($status["source"] == 'web'))
$status["source"] = network_to_name($item['item_network']);
else if (($item['item_network'] != "") AND (network_to_name($item['item_network']) != $status["source"]))
$status["source"] = trim($status["source"].' ('.network_to_name($item['item_network']).')');
$status["source"] = network_to_name($item['item_network'], $user_info['url']);
else if (($item['item_network'] != "") AND (network_to_name($item['item_network'], $user_info['url']) != $status["source"]))
$status["source"] = trim($status["source"].' ('.network_to_name($item['item_network'], $user_info['url']).')');
// Retweets are only valid for top postings

View file

@ -1,5 +1,5 @@
<?php
require_once('include/diaspora.php');
function contact_profile_assign($current,$foreign_net) {
@ -70,7 +70,7 @@ function contact_poll_interval($current, $disabled = false) {
}
function network_to_name($s) {
function network_to_name($s, $profile = "") {
$nets = array(
NETWORK_DFRN => t('Friendica'),
@ -97,6 +97,10 @@ function network_to_name($s) {
$search = array_keys($nets);
$replace = array_values($nets);
return str_replace($search,$replace,$s);
$networkname = str_replace($search,$replace,$s);
if (($s == NETWORK_DIASPORA) AND ($profile != "") AND diaspora_is_redmatrix($profile))
$networkname = t("Redmatrix");
return $networkname;
}

View file

@ -175,7 +175,7 @@ if(! function_exists('profile_sidebar')) {
if (($profile['network'] != "") AND ($profile['network'] != NETWORK_DFRN)) {
require_once('include/contact_selectors.php');
if ($profile['url'] != "")
$profile['network_name'] = '<a href="'.$profile['url'].'">'.network_to_name($profile['network'])."</a>";
$profile['network_name'] = '<a href="'.$profile['url'].'">'.network_to_name($profile['network'], $profile['url'])."</a>";
else
$profile['network_name'] = network_to_name($profile['network']);
} else

View file

@ -2977,9 +2977,6 @@ function item_is_remote_self($contact, &$datarray) {
$datarray['private'] = 0;
}
//if (!isset($datarray["app"]) OR ($datarray["app"] == ""))
// $datarray["app"] = network_to_name($contact['network']);
if ($contact['network'] != NETWORK_FEED) {
// Store the original post
$r = item_store($datarray2, false, false);

View file

@ -92,6 +92,10 @@ function onepoll_run(&$argv, &$argc){
);
if(! count($contacts)) {
// Maybe it is a Redmatrix account. Then we can fetch their contacts via poco
$contacts = q("SELECT `id`, `poco` FROM `contact` WHERE `id` = %d AND `poco` != ''", intval($contact_id));
if ($contacts)
poco_load($contacts[0]['id'],$importer_uid,0,$contacts[0]['poco']);
return;
}

View file

@ -124,8 +124,9 @@ function poco_load($cid,$uid = 0,$zcid = 0,$url = null) {
$keywords = implode(", ", $tag);
// If you query a Friendica server for its profiles, the network has to be Friendica
if ($uid == 0)
$network = NETWORK_DFRN;
// To-Do: It could also be a Redmatrix server
//if ($uid == 0)
// $network = NETWORK_DFRN;
poco_check($profile_url, $name, $network, $profile_photo, $about, $location, $gender, $keywords, $connect_url, $updated, $generation, $cid, $uid, $zcid);

View file

@ -505,7 +505,7 @@ function contacts_content(&$a) {
$poll_enabled = in_array($contact['network'], array(NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_FEED, NETWORK_MAIL, NETWORK_MAIL2));
$nettype = sprintf( t('Network type: %s'),network_to_name($contact['network']));
$nettype = sprintf( t('Network type: %s'),network_to_name($contact['network'], $contact["url"]));
$common = count_common_friends(local_user(),$contact['id']);
$common_text = (($common) ? sprintf( tt('%d contact in common','%d contacts in common', $common),$common) : '');
@ -806,7 +806,7 @@ function _contact_detail_for_template($rr){
'sparkle' => $sparkle,
'itemurl' => $rr['url'],
'url' => $url,
'network' => network_to_name($rr['network']),
'network' => network_to_name($rr['network'], $rr['url']),
);
}
}

View file

@ -43,13 +43,13 @@ function nogroup_content(&$a) {
'id' => $rr['id'],
'alt_text' => $alt_text,
'dir_icon' => $dir_icon,
'thumb' => $rr['thumb'],
'thumb' => $rr['thumb'],
'name' => $rr['name'],
'username' => $rr['name'],
'sparkle' => $sparkle,
'itemurl' => $rr['url'],
'url' => $url,
'network' => network_to_name($rr['network']),
'network' => network_to_name($rr['network'], $url),
);
}
}
@ -59,8 +59,8 @@ function nogroup_content(&$a) {
'$header' => t('Contacts who are not members of a group'),
'$contacts' => $contacts,
'$paginate' => paginate($a),
));
));
return $o;
}

View file

@ -68,7 +68,7 @@ function viewcontacts_content(&$a) {
'url' => $url,
'sparkle' => '',
'itemurl' => $rr['url'],
'network' => network_to_name($rr['network']),
'network' => network_to_name($rr['network'], $rr['url']),
);
}

View file

@ -4,6 +4,7 @@ if(class_exists('Item'))
require_once('object/BaseObject.php');
require_once('include/text.php');
require_once('include/diaspora.php');
require_once('boot.php');
/**
@ -82,7 +83,6 @@ class Item extends BaseObject {
*/
public function get_template_data($alike, $dlike, $thread_level=1) {
require_once("mod/proxy.php");
require_once("include/diaspora.php");
$result = array();
@ -368,7 +368,7 @@ class Item extends BaseObject {
'postopts' => $langstr,
'edited' => $edited,
'network' => $item["item_network"],
'network_name' => network_to_name($item['item_network']),
'network_name' => network_to_name($item['item_network'], $profile_link),
);
$arr = array('item' => $item, 'output' => $tmp_item);