From d778e7bfb74ca04ac9e65effbe1e4d1de5b979ba Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Mon, 4 Jan 2016 01:00:19 +0100 Subject: [PATCH 001/138] API: Preparation for statuses/lookup support --- include/api.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/api.php b/include/api.php index 790894d3f..f1294c690 100644 --- a/include/api.php +++ b/include/api.php @@ -318,6 +318,7 @@ } } } + logger('API call not implemented: '.$a->query_string); throw new NotImplementedException(); } catch (HTTPException $e) { header("HTTP/1.1 {$e->httpcode} {$e->httpdesc}"); @@ -2576,6 +2577,7 @@ killme(); } } + api_register_func('api/gnusocial/version','api_statusnet_version',false); api_register_func('api/statusnet/version','api_statusnet_version',false); /** From 2a77e426f9a26a2584da78c90daf8ec1d49fcc00 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 27 Jan 2017 17:00:34 +0000 Subject: [PATCH 002/138] Split poco discovery in smaller function calls --- include/socgraph.php | 124 ++++++++++++++++++++++++------------------- 1 file changed, 70 insertions(+), 54 deletions(-) diff --git a/include/socgraph.php b/include/socgraph.php index 32c151c04..b787452b8 100644 --- a/include/socgraph.php +++ b/include/socgraph.php @@ -1260,6 +1260,71 @@ function poco_discover_federation() { set_config('poco','last_federation_discovery', time()); } +function poco_discover_single_server($id) { + $r = q("SELECT `poco`, `nurl`, `url`, `network` FROM `gserver` WHERE `id` = %d", intval($id)); + if (!dbm::is_result($r)) { + return false; + } + + $server = $r[0]; + + if (!poco_check_server($server["url"], $server["network"])) { + // The server is not reachable? Okay, then we will try it later + q("UPDATE `gserver` SET `last_poco_query` = '%s' WHERE `nurl` = '%s'", dbesc(datetime_convert()), dbesc($server["nurl"])); + return false; + } + + // Fetch all users from the other server + $url = $server["poco"]."/?fields=displayName,urls,photos,updated,network,aboutMe,currentLocation,tags,gender,contactType,generation"; + + logger("Fetch all users from the server ".$server["nurl"], LOGGER_DEBUG); + + $retdata = z_fetch_url($url); + if ($retdata["success"]) { + $data = json_decode($retdata["body"]); + + poco_discover_server($data, 2); + + if (get_config('system','poco_discovery') > 1) { + + $timeframe = get_config('system','poco_discovery_since'); + if ($timeframe == 0) { + $timeframe = 30; + } + + $updatedSince = date("Y-m-d H:i:s", time() - $timeframe * 86400); + + // Fetch all global contacts from the other server (Not working with Redmatrix and Friendica versions before 3.3) + $url = $server["poco"]."/@global?updatedSince=".$updatedSince."&fields=displayName,urls,photos,updated,network,aboutMe,currentLocation,tags,gender,contactType,generation"; + + $success = false; + + $retdata = z_fetch_url($url); + if ($retdata["success"]) { + logger("Fetch all global contacts from the server ".$server["nurl"], LOGGER_DEBUG); + $success = poco_discover_server(json_decode($retdata["body"])); + } + + if (!$success AND (get_config('system','poco_discovery') > 2)) { + logger("Fetch contacts from users of the server ".$server["nurl"], LOGGER_DEBUG); + poco_discover_server_users($data, $server); + } + } + + q("UPDATE `gserver` SET `last_poco_query` = '%s' WHERE `nurl` = '%s'", dbesc(datetime_convert()), dbesc($server["nurl"])); + + return true; + } else { + // If the server hadn't replied correctly, then force a sanity check + poco_check_server($server["url"], $server["network"], true); + + // If we couldn't reach the server, we will try it some time later + q("UPDATE `gserver` SET `last_poco_query` = '%s' WHERE `nurl` = '%s'", dbesc(datetime_convert()), dbesc($server["nurl"])); + + return false; + } +} + function poco_discover($complete = false) { // Update the server list @@ -1274,63 +1339,14 @@ function poco_discover($complete = false) { $last_update = date("c", time() - (60 * 60 * 24 * $requery_days)); - $r = q("SELECT `poco`, `nurl`, `url`, `network` FROM `gserver` WHERE `last_contact` >= `last_failure` AND `poco` != '' AND `last_poco_query` < '%s' ORDER BY RAND()", dbesc($last_update)); - if ($r) + $r = q("SELECT `id` FROM `gserver` WHERE `last_contact` >= `last_failure` AND `poco` != '' AND `last_poco_query` < '%s' ORDER BY RAND()", dbesc($last_update)); + if (dbm::is_result($r)) { foreach ($r AS $server) { - - if (!poco_check_server($server["url"], $server["network"])) { - // The server is not reachable? Okay, then we will try it later - q("UPDATE `gserver` SET `last_poco_query` = '%s' WHERE `nurl` = '%s'", dbesc(datetime_convert()), dbesc($server["nurl"])); - continue; - } - - // Fetch all users from the other server - $url = $server["poco"]."/?fields=displayName,urls,photos,updated,network,aboutMe,currentLocation,tags,gender,contactType,generation"; - - logger("Fetch all users from the server ".$server["nurl"], LOGGER_DEBUG); - - $retdata = z_fetch_url($url); - if ($retdata["success"]) { - $data = json_decode($retdata["body"]); - - poco_discover_server($data, 2); - - if (get_config('system','poco_discovery') > 1) { - - $timeframe = get_config('system','poco_discovery_since'); - if ($timeframe == 0) - $timeframe = 30; - - $updatedSince = date("Y-m-d H:i:s", time() - $timeframe * 86400); - - // Fetch all global contacts from the other server (Not working with Redmatrix and Friendica versions before 3.3) - $url = $server["poco"]."/@global?updatedSince=".$updatedSince."&fields=displayName,urls,photos,updated,network,aboutMe,currentLocation,tags,gender,contactType,generation"; - - $success = false; - - $retdata = z_fetch_url($url); - if ($retdata["success"]) { - logger("Fetch all global contacts from the server ".$server["nurl"], LOGGER_DEBUG); - $success = poco_discover_server(json_decode($retdata["body"])); - } - - if (!$success AND (get_config('system','poco_discovery') > 2)) { - logger("Fetch contacts from users of the server ".$server["nurl"], LOGGER_DEBUG); - poco_discover_server_users($data, $server); - } - } - - q("UPDATE `gserver` SET `last_poco_query` = '%s' WHERE `nurl` = '%s'", dbesc(datetime_convert()), dbesc($server["nurl"])); - if (!$complete AND (--$no_of_queries == 0)) - break; - } else { - // If the server hadn't replied correctly, then force a sanity check - poco_check_server($server["url"], $server["network"], true); - - // If we couldn't reach the server, we will try it some time later - q("UPDATE `gserver` SET `last_poco_query` = '%s' WHERE `nurl` = '%s'", dbesc(datetime_convert()), dbesc($server["nurl"])); + if (poco_discover_single_server($server['id']) AND !$complete AND (--$no_of_queries == 0)) { + break; } } + } } function poco_discover_server_users($data, $server) { From 71f00eaf5f4e2d76dd200e4965afa04dc1dead3f Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Fri, 3 Mar 2017 01:00:52 -0500 Subject: [PATCH 003/138] Turn action links into buttons - Turns into @@ -287,34 +287,23 @@ as the value of $top_child_total (this is done at the end of this file) {{* Buttons for like and dislike *}} {{if $item.vote}} {{if $item.vote.like}} -  {{$item.vote.like.1}} + {{/if}} - - {{if $item.vote.like AND $item.vote.dislike}} -  •  - {{/if}} - {{if $item.vote.dislike}} -  {{$item.vote.dislike.1}} + {{/if}} - {{if ($item.vote.like OR $item.vote.dislike) AND $item.comment}} -  •  - {{/if}} {{/if}} - {{* Butten to open the comment text field *}} + {{* Button to open the comment text field *}} {{if $item.comment}} -  {{$item.switchcomment}} + {{/if}} {{* Button for sharing the item *}} {{if $item.vote}} - {{if ($item.vote.like OR $item.vote.dislike OR $item.comment) AND $item.vote.share}} -  •  - {{/if}} {{if $item.vote.share}} -  {{$item.vote.share.1}} + + + {{/if}} From cb49bcdb04f819b6a0314941f4762c70b621a997 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Fri, 3 Mar 2017 01:19:49 -0500 Subject: [PATCH 004/138] Turn actions links into buttons (nav, search) - Mirrored the changes from wall_thread to search_item - Replaced a navbar link with a button with according CSS --- view/theme/frio/css/style.css | 5 +- view/theme/frio/templates/nav.tpl | 5 +- view/theme/frio/templates/search_item.tpl | 73 ++++++++++------------- 3 files changed, 35 insertions(+), 48 deletions(-) diff --git a/view/theme/frio/css/style.css b/view/theme/frio/css/style.css index 40e275ae0..4e189b11f 100644 --- a/view/theme/frio/css/style.css +++ b/view/theme/frio/css/style.css @@ -553,9 +553,8 @@ nav.navbar .nav>li>a:focus{ #topbar-first .dropdown-footer { margin: 10px 10px 5px } -#topbar-first a, -nav.navbar a { - /*color: #fff*/ +#topbar-first a, #topbar-first .btn-link, +nav.navbar a, nav.navbar .btn-link { color: $nav_icon_color; } #topbar-first .caret { diff --git a/view/theme/frio/templates/nav.tpl b/view/theme/frio/templates/nav.tpl index fc6640301..ef96249ea 100644 --- a/view/theme/frio/templates/nav.tpl +++ b/view/theme/frio/templates/nav.tpl @@ -119,7 +119,7 @@ {{* The user dropdown menu *}} {{if $nav.userinfo}}