From: Michael Vogel Date: Thu, 16 Jul 2015 08:09:59 +0000 (+0200) Subject: Show "Redmatrix" as network name. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=fca8aecc9b12a8aed3e11c176de0d0b4d24943e9;p=friendica.git Show "Redmatrix" as network name. --- diff --git a/include/api.php b/include/api.php index b5d8f9cf3d..1069835817 100644 --- a/include/api.php +++ b/include/api.php @@ -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 diff --git a/include/contact_selectors.php b/include/contact_selectors.php index c04b07fb64..f0ac87a09f 100644 --- a/include/contact_selectors.php +++ b/include/contact_selectors.php @@ -1,5 +1,5 @@ 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; } diff --git a/include/identity.php b/include/identity.php index bf5d969274..b584896d36 100644 --- a/include/identity.php +++ b/include/identity.php @@ -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'] = ''.network_to_name($profile['network']).""; + $profile['network_name'] = ''.network_to_name($profile['network'], $profile['url']).""; else $profile['network_name'] = network_to_name($profile['network']); } else diff --git a/include/items.php b/include/items.php index cba1ae236c..848c21df36 100644 --- a/include/items.php +++ b/include/items.php @@ -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); diff --git a/include/onepoll.php b/include/onepoll.php index d1f41d65f5..9723fadd51 100644 --- a/include/onepoll.php +++ b/include/onepoll.php @@ -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; } diff --git a/include/socgraph.php b/include/socgraph.php index 23db35cabd..1e1b6076f2 100644 --- a/include/socgraph.php +++ b/include/socgraph.php @@ -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); diff --git a/mod/contacts.php b/mod/contacts.php index 6ee9a4a92b..ffb9f1a461 100644 --- a/mod/contacts.php +++ b/mod/contacts.php @@ -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']), ); - -} \ No newline at end of file + +} diff --git a/mod/nogroup.php b/mod/nogroup.php index 24d99a59b6..adbcfcb515 100644 --- a/mod/nogroup.php +++ b/mod/nogroup.php @@ -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; } diff --git a/mod/viewcontacts.php b/mod/viewcontacts.php index 3a6c48a3b2..b84856701d 100644 --- a/mod/viewcontacts.php +++ b/mod/viewcontacts.php @@ -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']), ); } diff --git a/object/Item.php b/object/Item.php index 7f9762581c..8d364e6023 100644 --- a/object/Item.php +++ b/object/Item.php @@ -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);