From 05a5e1792d27184d29e0c78fd9c61334232a507e Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Mon, 10 Apr 2017 22:09:49 -0400 Subject: [PATCH 01/37] Left trim at sign from nicks in ACL --- include/acl_selectors.php | 12 ++++++------ mod/acl.php | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/acl_selectors.php b/include/acl_selectors.php index f4b644d68f..8404c8f4b6 100644 --- a/include/acl_selectors.php +++ b/include/acl_selectors.php @@ -627,14 +627,14 @@ function acl_lookup(App $a, $out_type = 'json') { dbesc($search), implode("','", $known_contacts) ); - if (dbm::is_result($r)){ + if (dbm::is_result($r)) { foreach ($r as $row) { - // nickname.. $up = parse_url($row['author-link']); - $nick = explode("/",$up['path']); - $nick = $nick[count($nick)-1]; - $nick .= "@".$up['host']; - // /nickname + $nick = explode('/', $up['path']); + // Fix for Mastodon URLs with format https://domain.tld/@nick + $nick = ltrim($nick[count($nick) - 1], '@'); + $nick .= '@' . $up['host']; + $unknow_contacts[] = array( 'type' => 'c', 'photo' => proxy_url($row['author-avatar'], false, PROXY_SIZE_MICRO), diff --git a/mod/acl.php b/mod/acl.php index 04aa9f50a6..9220bc77a9 100644 --- a/mod/acl.php +++ b/mod/acl.php @@ -1,7 +1,7 @@ Date: Mon, 10 Apr 2017 22:10:05 -0400 Subject: [PATCH 02/37] Add network for unknown contacts in ACL --- include/acl_selectors.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/acl_selectors.php b/include/acl_selectors.php index 8404c8f4b6..2a435c8e74 100644 --- a/include/acl_selectors.php +++ b/include/acl_selectors.php @@ -615,7 +615,7 @@ function acl_lookup(App $a, $out_type = 'json') { function _contact_link($i){ return dbesc($i['link']); } $known_contacts = array_map(_contact_link, $contacts); $unknow_contacts=array(); - $r = q("SELECT `author-avatar`,`author-name`,`author-link` + $r = q("SELECT `author-avatar`,`author-name`,`author-link`, `network` FROM `item` WHERE `parent` = %d AND (`author-name` LIKE '%%%s%%' OR `author-link` LIKE '%%%s%%') AND `author-link` NOT IN ('%s') @@ -640,7 +640,7 @@ function acl_lookup(App $a, $out_type = 'json') { 'photo' => proxy_url($row['author-avatar'], false, PROXY_SIZE_MICRO), 'name' => htmlentities($row['author-name']), 'id' => '', - 'network' => 'unknown', + 'network' => $row['network'], 'link' => $row['author-link'], 'nick' => htmlentities($nick), 'forum' => false From 762e8eda7a7d314ce74180831a3f3bfe7b2dbe96 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Tue, 11 Apr 2017 02:41:19 -0400 Subject: [PATCH 03/37] Use get_contact_details_by_url for unknown contacts - Fix typo - Fix comment - Fix closure --- include/acl_selectors.php | 46 ++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/include/acl_selectors.php b/include/acl_selectors.php index 2a435c8e74..4036886c49 100644 --- a/include/acl_selectors.php +++ b/include/acl_selectors.php @@ -610,12 +610,18 @@ function acl_lookup(App $a, $out_type = 'json') { $items = array_merge($groups, $contacts); if ($conv_id) { - /* if $conv_id is set, get unknow contacts in thread */ - /* but first get know contacts url to filter them out */ - function _contact_link($i){ return dbesc($i['link']); } - $known_contacts = array_map(_contact_link, $contacts); - $unknow_contacts=array(); - $r = q("SELECT `author-avatar`,`author-name`,`author-link`, `network` + /* + * if $conv_id is set, get unknown contacts in thread + * but first get known contacts url to filter them out + */ + $known_contacts = array_map( + function ($i) { + return dbesc($i['link']); + } + , $contacts); + + $unknown_contacts = array(); + $r = q("SELECT `author-link` FROM `item` WHERE `parent` = %d AND (`author-name` LIKE '%%%s%%' OR `author-link` LIKE '%%%s%%') AND `author-link` NOT IN ('%s') @@ -625,31 +631,27 @@ function acl_lookup(App $a, $out_type = 'json') { intval($conv_id), dbesc($search), dbesc($search), - implode("','", $known_contacts) + implode("', '", $known_contacts) ); if (dbm::is_result($r)) { foreach ($r as $row) { - $up = parse_url($row['author-link']); - $nick = explode('/', $up['path']); - // Fix for Mastodon URLs with format https://domain.tld/@nick - $nick = ltrim($nick[count($nick) - 1], '@'); - $nick .= '@' . $up['host']; + $contact = get_contact_details_by_url($row['author-link'], 0); - $unknow_contacts[] = array( - 'type' => 'c', - 'photo' => proxy_url($row['author-avatar'], false, PROXY_SIZE_MICRO), - 'name' => htmlentities($row['author-name']), - 'id' => '', - 'network' => $row['network'], - 'link' => $row['author-link'], - 'nick' => htmlentities($nick), + $unknown_contacts[] = array( + 'type' => 'cu', + 'photo' => proxy_url($contact['micro'], false, PROXY_SIZE_MICRO), + 'name' => htmlentities($contact['name']), + 'id' => intval($contact['id']), + 'network' => $contact['network'], + 'link' => $contact['url'], + 'nick' => $contact['nick'], 'forum' => false ); } } - $items = array_merge($items, $unknow_contacts); - $tot += count($unknow_contacts); + $items = array_merge($items, $unknown_contacts); + $tot += count($unknown_contacts); } $results = array( From dbbe6efd27cde052402e1d9995f77feb95d1c265 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Wed, 12 Apr 2017 00:19:05 +0200 Subject: [PATCH 04/37] Fix ostatus bug related to only_full_group_by https://github.com/friendica/friendica/issues/3322 --- include/ostatus.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/ostatus.php b/include/ostatus.php index e0b33a1a47..ee405397cc 100644 --- a/include/ostatus.php +++ b/include/ostatus.php @@ -720,7 +720,7 @@ class ostatus { $conversations = q("SELECT `term`.`oid`, `term`.`url`, `term`.`uid` FROM `term` STRAIGHT_JOIN `thread` ON `thread`.`iid` = `term`.`oid` AND `thread`.`uid` = `term`.`uid` WHERE `term`.`type` = 7 AND `term`.`term` > '%s' AND `thread`.`mention` - GROUP BY `term`.`url`, `term`.`uid` ORDER BY `term`.`term` DESC", dbesc($start)); + GROUP BY `term`.`url`, `term`.`uid`, `term`.`oid`, `term`.`term` ORDER BY `term`.`term` DESC", dbesc($start)); } else { $conversations = q("SELECT `oid`, `url`, `uid` FROM `term` WHERE `type` = 7 AND `term` > '%s' From 15a44d945b9219a75e519e6cb4b0563b6ea378f7 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Wed, 12 Apr 2017 01:06:08 +0200 Subject: [PATCH 05/37] Another GROUP BY fix for MySQL https://github.com/friendica/friendica/issues/3322 --- include/ostatus.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/ostatus.php b/include/ostatus.php index ee405397cc..e0ed1df19a 100644 --- a/include/ostatus.php +++ b/include/ostatus.php @@ -724,7 +724,7 @@ class ostatus { } else { $conversations = q("SELECT `oid`, `url`, `uid` FROM `term` WHERE `type` = 7 AND `term` > '%s' - GROUP BY `url`, `uid` ORDER BY `term` DESC", dbesc($start)); + GROUP BY `url`, `uid`, `oid`, `term` ORDER BY `term` DESC", dbesc($start)); } foreach ($conversations AS $conversation) { From 6b8ad57399e46eef6db713861f74a6fbddf587e8 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Tue, 11 Apr 2017 21:18:34 -0400 Subject: [PATCH 06/37] Add error handling for missing contacts --- include/acl_selectors.php | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/include/acl_selectors.php b/include/acl_selectors.php index 4036886c49..0e30ee06e8 100644 --- a/include/acl_selectors.php +++ b/include/acl_selectors.php @@ -637,16 +637,18 @@ function acl_lookup(App $a, $out_type = 'json') { foreach ($r as $row) { $contact = get_contact_details_by_url($row['author-link'], 0); - $unknown_contacts[] = array( - 'type' => 'cu', - 'photo' => proxy_url($contact['micro'], false, PROXY_SIZE_MICRO), - 'name' => htmlentities($contact['name']), - 'id' => intval($contact['id']), - 'network' => $contact['network'], - 'link' => $contact['url'], - 'nick' => $contact['nick'], - 'forum' => false - ); + if (count($contact) > 0) { + $unknown_contacts[] = array( + 'type' => 'cu', + 'photo' => proxy_url($contact['micro'], false, PROXY_SIZE_MICRO), + 'name' => htmlentities($contact['name']), + 'id' => intval($contact['id']), + 'network' => $contact['network'], + 'link' => $contact['url'], + 'nick' => $contact['nick'], + 'forum' => false + ); + } } } From c3e933642e6ad761c91888006b45efa69915d691 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Wed, 12 Apr 2017 14:17:16 +0200 Subject: [PATCH 07/37] Fix missing SQL group by in ping https://github.com/friendica/friendica/issues/3322 --- mod/ping.php | 1 + 1 file changed, 1 insertion(+) diff --git a/mod/ping.php b/mod/ping.php index b5330c7b33..0b82e71d39 100644 --- a/mod/ping.php +++ b/mod/ping.php @@ -201,6 +201,7 @@ function ping_init(App $a) if (is_null($ev)) { $ev = qu("SELECT count(`event`.`id`) AS total, type, start, adjust FROM `event` WHERE `event`.`uid` = %d AND `start` < '%s' AND `finish` > '%s' and `ignore` = 0 + GROUP BY type, start, adjust ORDER BY `start` ASC ", intval(local_user()), dbesc(datetime_convert('UTC', 'UTC', 'now + 7 days')), From 74b6d09e89bbe87e94ebb458d8a76415e324d1d3 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Wed, 12 Apr 2017 15:11:50 +0200 Subject: [PATCH 08/37] Fix GROUP BY in acl_selector, api, notifier, photos, messages https://github.com/friendica/friendica/issues/3322 --- include/acl_selectors.php | 4 ++-- include/api.php | 8 +++++--- include/notifier.php | 2 +- include/photos.php | 4 ++-- mod/message.php | 4 ++-- mod/photos.php | 2 +- mod/videos.php | 2 +- 7 files changed, 14 insertions(+), 12 deletions(-) diff --git a/include/acl_selectors.php b/include/acl_selectors.php index f4b644d68f..87230a1409 100644 --- a/include/acl_selectors.php +++ b/include/acl_selectors.php @@ -502,7 +502,7 @@ function acl_lookup(App $a, $out_type = 'json') { INNER JOIN `group_member` ON `group_member`.`gid`=`group`.`id` AND `group_member`.`uid` = `group`.`uid` WHERE NOT `group`.`deleted` AND `group`.`uid` = %d $sql_extra - GROUP BY `group`.`name` + GROUP BY `group`.`name`, `group`.`id` ORDER BY `group`.`name` LIMIT %d,%d", intval(local_user()), @@ -619,7 +619,7 @@ function acl_lookup(App $a, $out_type = 'json') { FROM `item` WHERE `parent` = %d AND (`author-name` LIKE '%%%s%%' OR `author-link` LIKE '%%%s%%') AND `author-link` NOT IN ('%s') - GROUP BY `author-link` + GROUP BY `author-link`, `author-avatar`, `author-name` ORDER BY `author-name` ASC ", intval($conv_id), diff --git a/include/api.php b/include/api.php index 9fc853340a..477eb94b4e 100644 --- a/include/api.php +++ b/include/api.php @@ -3064,7 +3064,7 @@ use \Friendica\Core\Config; function api_fr_photos_list($type) { if (api_user()===false) throw new ForbiddenException(); $r = q("select `resource-id`, max(scale) as scale, album, filename, type from photo - where uid = %d and album != 'Contact Photos' group by `resource-id`", + where uid = %d and album != 'Contact Photos' group by `resource-id`, album, filename, type", intval(local_user()) ); $typetoext = array( @@ -3102,8 +3102,10 @@ use \Friendica\Core\Config; $data_sql = ($scale === false ? "" : "data, "); $r = q("select %s `resource-id`, `created`, `edited`, `title`, `desc`, `album`, `filename`, - `type`, `height`, `width`, `datasize`, `profile`, min(`scale`) as minscale, max(`scale`) as maxscale - from photo where `uid` = %d and `resource-id` = '%s' %s group by `resource-id`", + `type`, `height`, `width`, `datasize`, `profile`, min(`scale`) as minscale, max(`scale`) as maxscale + from photo where `uid` = %d and `resource-id` = '%s' %s + group by `resource-id`, `created`, `edited`, `title`, `desc`, `album`, `filename`, + `type`, `height`, `width`, `datasize`, `profile`", $data_sql, intval(local_user()), dbesc($_REQUEST['photo_id']), diff --git a/include/notifier.php b/include/notifier.php index e3d7d10d6b..ed34288e8f 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -517,7 +517,7 @@ function notifier_run(&$argv, &$argc){ } $r1 = q("SELECT DISTINCT(`batch`), `id`, `name`,`network` FROM `contact` WHERE `network` = '%s' - AND `uid` = %d AND `rel` != %d AND NOT `blocked` AND NOT `pending` AND NOT `archive` GROUP BY `batch` ORDER BY rand()", + AND `uid` = %d AND `rel` != %d AND NOT `blocked` AND NOT `pending` AND NOT `archive` GROUP BY `batch`, `id` ORDER BY rand()", dbesc(NETWORK_DIASPORA), intval($owner['uid']), intval(CONTACT_IS_SHARING) diff --git a/include/photos.php b/include/photos.php index 9d8d3309c2..02d1b17403 100644 --- a/include/photos.php +++ b/include/photos.php @@ -51,7 +51,7 @@ function photo_albums($uid, $update = false) { $albums = qu("SELECT COUNT(DISTINCT `resource-id`) AS `total`, `album` FROM `photo` WHERE `uid` = %d AND `album` != '%s' AND `album` != '%s' $sql_extra - GROUP BY `album` ORDER BY `created` DESC", + GROUP BY `album`, `created` ORDER BY `created` DESC", intval($uid), dbesc('Contact Photos'), dbesc(t('Contact Photos')) @@ -61,7 +61,7 @@ function photo_albums($uid, $update = false) { $albums = qu("SELECT DISTINCT(`album`), '' AS `total` FROM `photo` WHERE `uid` = %d AND `album` != '%s' AND `album` != '%s' $sql_extra - GROUP BY `album` ORDER BY `created` DESC", + GROUP BY `album`, `created` ORDER BY `created` DESC", intval($uid), dbesc('Contact Photos'), dbesc(t('Contact Photos')) diff --git a/mod/message.php b/mod/message.php index 9e96691466..05a8d36f68 100644 --- a/mod/message.php +++ b/mod/message.php @@ -350,7 +350,7 @@ function message_content(App $a) { $o .= $header; $r = q("SELECT count(*) AS `total` FROM `mail` - WHERE `mail`.`uid` = %d GROUP BY `parent-uri` ORDER BY `created` DESC", + WHERE `mail`.`uid` = %d GROUP BY `parent-uri`, `created` ORDER BY `created` DESC", intval(local_user()) ); @@ -533,7 +533,7 @@ function get_messages($user, $lstart, $lend) { `mail`.* , `contact`.`name`, `contact`.`url`, `contact`.`thumb` , `contact`.`network`, count( * ) as count FROM `mail` LEFT JOIN `contact` ON `mail`.`contact-id` = `contact`.`id` - WHERE `mail`.`uid` = %d GROUP BY `parent-uri` ORDER BY `mailcreated` DESC LIMIT %d , %d ", + WHERE `mail`.`uid` = %d GROUP BY `parent-uri`, `mail`.id ORDER BY `mailcreated` DESC LIMIT %d , %d ", intval($user), intval($lstart), intval($lend) ); } diff --git a/mod/photos.php b/mod/photos.php index 3acd39b2af..a24cee2559 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -1241,7 +1241,7 @@ function photos_content(App $a) { } $r = q("SELECT `resource-id`, `id`, `filename`, type, max(`scale`) AS `scale`, `desc` FROM `photo` WHERE `uid` = %d AND `album` = '%s' - AND `scale` <= 4 $sql_extra GROUP BY `resource-id` ORDER BY `created` $order LIMIT %d , %d", + AND `scale` <= 4 $sql_extra GROUP BY `resource-id`, `id` ORDER BY `created` $order LIMIT %d , %d", intval($owner_uid), dbesc($album), intval($a->pager['start']), diff --git a/mod/videos.php b/mod/videos.php index 3828b8f1fe..ea2e0d4a24 100644 --- a/mod/videos.php +++ b/mod/videos.php @@ -358,7 +358,7 @@ function videos_content(App $a) { $r = q("SELECT hash, `id`, `filename`, filetype FROM `attach` WHERE `uid` = %d AND filetype LIKE '%%video%%' - $sql_extra GROUP BY hash ORDER BY `created` DESC LIMIT %d , %d", + $sql_extra GROUP BY hash, `id` ORDER BY `created` DESC LIMIT %d , %d", intval($a->data['user']['uid']), intval($a->pager['start']), intval($a->pager['itemspage']) From 9fb4ba2b733d59b8a704cb8df846c3b43769503d Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Wed, 12 Apr 2017 18:49:29 +0200 Subject: [PATCH 09/37] Fix profile wrong DISTINCT + ORDER BY Fix: ERROR 3065 (HY000) Expression #1 of ORDER BY clause is not in SELECT list, references column 'friendica.item.created' which is not in SELECT list; this is incompatible with DISTINCT --- mod/profile.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mod/profile.php b/mod/profile.php index fbce509d29..a83cb076f2 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -210,7 +210,7 @@ function profile_content(App $a, $update = 0) { if ($update) { - $r = q("SELECT distinct(parent) AS `item_id`, `item`.`network` AS `item_network` + $r = q("SELECT distinct(parent) AS `item_id`, `item`.`network` AS `item_network`, `item`.`created` FROM `item` INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id` AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND From 534ea6aefcc480bcd01cfd478cc7f75d2f4373d2 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Wed, 12 Apr 2017 18:54:54 +0200 Subject: [PATCH 10/37] Fix ping_init SQL According to review https://github.com/friendica/friendica/pull/3323#pullrequestreview-32401628 --- mod/ping.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/mod/ping.php b/mod/ping.php index 0b82e71d39..ba496a70bd 100644 --- a/mod/ping.php +++ b/mod/ping.php @@ -199,9 +199,8 @@ function ping_init(App $a) $cachekey = "ping_init:".local_user(); $ev = Cache::get($cachekey); if (is_null($ev)) { - $ev = qu("SELECT count(`event`.`id`) AS total, type, start, adjust FROM `event` + $ev = qu("SELECT type, start, adjust FROM `event` WHERE `event`.`uid` = %d AND `start` < '%s' AND `finish` > '%s' and `ignore` = 0 - GROUP BY type, start, adjust ORDER BY `start` ASC ", intval(local_user()), dbesc(datetime_convert('UTC', 'UTC', 'now + 7 days')), @@ -213,7 +212,7 @@ function ping_init(App $a) } if (dbm::is_result($ev)) { - $all_events = intval($ev[0]['total']); + $all_events = count($ev); if ($all_events) { $str_now = datetime_convert('UTC', $a->timezone, 'now', 'Y-m-d'); From 38e7a0f7933461702275a846a85e9dc3ae5dd97e Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Wed, 12 Apr 2017 22:55:02 +0200 Subject: [PATCH 11/37] Fix GROUP BY for search https://github.com/friendica/friendica/issues/3322 Fix MySQL ERROR 1055 (42000): Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'friendica.item.author-id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by --- mod/search.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mod/search.php b/mod/search.php index 7d588aa4d1..f274b2a879 100644 --- a/mod/search.php +++ b/mod/search.php @@ -214,7 +214,7 @@ function search_content(App $a) { FROM `item` %s WHERE %s AND (`item`.`uid` = 0 OR (`item`.`uid` = %s AND NOT `item`.`global`)) $sql_extra - GROUP BY `item`.`uri` ORDER BY `item`.`id` DESC LIMIT %d , %d", + GROUP BY `item`.`uri`, `item`.`id` ORDER BY `item`.`id` DESC LIMIT %d , %d", item_fieldlists(), item_joins(), item_condition(), intval(local_user()), intval($a->pager['start']), intval($a->pager['itemspage'])); From b8e4094e7b475dd5ab980134ea463902c718a4aa Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Wed, 12 Apr 2017 23:09:22 +0200 Subject: [PATCH 12/37] Allow negative contact.contat-type https://github.com/friendica/friendica/issues/3328 --- database.sql | 2 +- include/dbstructure.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/database.sql b/database.sql index 7ed19f439c..9d56957100 100644 --- a/database.sql +++ b/database.sql @@ -159,7 +159,7 @@ CREATE TABLE IF NOT EXISTS `contact` ( `writable` tinyint(1) NOT NULL DEFAULT 0, `forum` tinyint(1) NOT NULL DEFAULT 0, `prv` tinyint(1) NOT NULL DEFAULT 0, - `contact-type` int(11) unsigned NOT NULL DEFAULT 0, + `contact-type` int(11) NOT NULL DEFAULT 0, `hidden` tinyint(1) NOT NULL DEFAULT 0, `archive` tinyint(1) NOT NULL DEFAULT 0, `pending` tinyint(1) NOT NULL DEFAULT 1, diff --git a/include/dbstructure.php b/include/dbstructure.php index 48cc02d2d1..9828230a12 100644 --- a/include/dbstructure.php +++ b/include/dbstructure.php @@ -5,7 +5,7 @@ use \Friendica\Core\Config; require_once("boot.php"); require_once("include/text.php"); -define('NEW_UPDATE_ROUTINE_VERSION', 1170); +define('NEW_UPDATE_ROUTINE_VERSION', 1171); /* * send the email and do what is needed to do on update fails @@ -671,7 +671,7 @@ function db_definition($charset) { "writable" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"), "forum" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"), "prv" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"), - "contact-type" => array("type" => "int(11) unsigned", "not null" => "1", "default" => "0"), + "contact-type" => array("type" => "int(11)", "not null" => "1", "default" => "0"), "hidden" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"), "archive" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"), "pending" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"), From 325d3afe183a397ea6688480c1b2df8e1be99dc1 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Wed, 12 Apr 2017 23:14:33 +0200 Subject: [PATCH 13/37] Bump DB version --- boot.php | 2 +- include/dbstructure.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/boot.php b/boot.php index 070dcf7266..ed4fe10a3a 100644 --- a/boot.php +++ b/boot.php @@ -38,7 +38,7 @@ define ( 'FRIENDICA_PLATFORM', 'Friendica'); define ( 'FRIENDICA_CODENAME', 'Asparagus'); define ( 'FRIENDICA_VERSION', '3.5.2-dev' ); define ( 'DFRN_PROTOCOL_VERSION', '2.23' ); -define ( 'DB_UPDATE_VERSION', 1216 ); +define ( 'DB_UPDATE_VERSION', 1217 ); /** * @brief Constant with a HTML line break. diff --git a/include/dbstructure.php b/include/dbstructure.php index 9828230a12..406ad6c93d 100644 --- a/include/dbstructure.php +++ b/include/dbstructure.php @@ -5,7 +5,7 @@ use \Friendica\Core\Config; require_once("boot.php"); require_once("include/text.php"); -define('NEW_UPDATE_ROUTINE_VERSION', 1171); +define('NEW_UPDATE_ROUTINE_VERSION', 1170); /* * send the email and do what is needed to do on update fails From 92361a0209da085e1bed4de56ce46f755175142a Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Wed, 12 Apr 2017 23:20:10 +0200 Subject: [PATCH 14/37] Bump update version --- update.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/update.php b/update.php index 8404f5bf26..4e945d2091 100644 --- a/update.php +++ b/update.php @@ -1,6 +1,6 @@ Date: Wed, 12 Apr 2017 21:32:06 -0400 Subject: [PATCH 15/37] Fiddling with the unknown contact array values --- include/acl_selectors.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/acl_selectors.php b/include/acl_selectors.php index 0e30ee06e8..4cc810fb5c 100644 --- a/include/acl_selectors.php +++ b/include/acl_selectors.php @@ -635,18 +635,18 @@ function acl_lookup(App $a, $out_type = 'json') { ); if (dbm::is_result($r)) { foreach ($r as $row) { - $contact = get_contact_details_by_url($row['author-link'], 0); + $contact = get_contact_details_by_url($row['author-link']); if (count($contact) > 0) { $unknown_contacts[] = array( 'type' => 'cu', 'photo' => proxy_url($contact['micro'], false, PROXY_SIZE_MICRO), 'name' => htmlentities($contact['name']), - 'id' => intval($contact['id']), + 'id' => intval($contact['cid']), 'network' => $contact['network'], 'link' => $contact['url'], - 'nick' => $contact['nick'], - 'forum' => false + 'nick' => $contact['nick'] ? : $contact['addr'], + 'forum' => $contact['forum'] ); } } From d82684219a861ad25ade416cf95f85c2cc8a8217 Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 13 Apr 2017 04:51:16 +0000 Subject: [PATCH 16/37] Issue 3331: Removed unneeded table "deliverq" --- mod/admin.php | 5 +---- view/templates/admin_summary.tpl | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/mod/admin.php b/mod/admin.php index e86bb90ddd..2652b33c12 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -474,9 +474,6 @@ function admin_page_summary(App $a) { $r = qu("SELECT COUNT(`id`) AS `count` FROM `register`"); $pending = $r[0]['count']; - $r = qu("SELECT COUNT(*) AS `total` FROM `deliverq` WHERE 1"); - $deliverq = (($r) ? $r[0]['total'] : 0); - $r = qu("SELECT COUNT(*) AS `total` FROM `queue` WHERE 1"); $queue = (($r) ? $r[0]['total'] : 0); @@ -485,7 +482,7 @@ function admin_page_summary(App $a) { // We can do better, but this is a quick queue status - $queues = array('label' => t('Message queues'), 'deliverq' => $deliverq, 'queue' => $queue, 'workerq' => $workerqueue); + $queues = array('label' => t('Message queues'), 'queue' => $queue, 'workerq' => $workerqueue); $t = get_markup_template("admin_summary.tpl"); diff --git a/view/templates/admin_summary.tpl b/view/templates/admin_summary.tpl index a8243b6149..e650144134 100644 --- a/view/templates/admin_summary.tpl +++ b/view/templates/admin_summary.tpl @@ -11,7 +11,7 @@
{{$queues.label}}
-
{{$queues.deliverq}} - {{$queues.queue}} - {{$queues.workerq}}
+
{{$queues.queue}} - {{$queues.workerq}}
{{$pending.0}}
From f399a1914f5e349dc2ae38f8a9b66b4135f4be3d Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 13 Apr 2017 05:08:12 +0000 Subject: [PATCH 17/37] Removed documentation --- doc/database/db_deliverq.md | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 doc/database/db_deliverq.md diff --git a/doc/database/db_deliverq.md b/doc/database/db_deliverq.md deleted file mode 100644 index 5335899571..0000000000 --- a/doc/database/db_deliverq.md +++ /dev/null @@ -1,12 +0,0 @@ -Table deliverq -============== - -| Field | Description | Type | Null | Key | Default | Extra | -|---------|------------------|------------------|------|-----|---------|----------------| -| id | sequential ID | int(10) unsigned | NO | PRI | NULL | auto_increment | -| cmd | | varchar(32) | NO | | | | -| item | | int(11) | NO | | 0 | | -| contact | | int(11) | NO | | 0 | | - - -Return to [database documentation](help/database) From 2b3a12948051c6171226b20614c9e762a07a1eeb Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 13 Apr 2017 05:08:42 +0000 Subject: [PATCH 18/37] Removed it here as well --- doc/database.md | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/database.md b/doc/database.md index f48404c17d..4c61505202 100644 --- a/doc/database.md +++ b/doc/database.md @@ -14,7 +14,6 @@ Database Tables | [config](help/database/db_config) | main configuration storage | | [contact](help/database/db_contact) | contact table | | [conv](help/database/db_conv) | private messages | -| [deliverq](help/database/db_deliverq) | | | [event](help/database/db_event) | Events | | [fcontact](help/database/db_fcontact) | friend suggestion stuff | | [ffinder](help/database/db_ffinder) | friend suggestion stuff | From 31f9b418ba3d37ae32f3c0ccda53563e08b21a5d Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Wed, 12 Apr 2017 23:16:44 +0200 Subject: [PATCH 19/37] Scroll to next/previous thread when pressing j/k (fixes #3327) --- js/main.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/js/main.js b/js/main.js index 556e4ed8cf..98c219d78c 100644 --- a/js/main.js +++ b/js/main.js @@ -322,6 +322,29 @@ } }); + $(document).keydown(function (event) { + var threads = $('.thread_level_1'); + if ((event.keyCode === 74 || event.keyCode === 75) && !$(event.target).is('textarea, input')) { + var scrollTop = $(window).scrollTop(); + if (event.keyCode === 75) { + threads = $(threads.get().reverse()); + } + threads.each(function(key, item) { + var comparison; + var top = $(item).offset().top - 100; + if (event.keyCode === 74) { + comparison = top > scrollTop + 1; + } else if (event.keyCode === 75) { + comparison = top < scrollTop - 1; + } + if (comparison) { + $('html, body').animate({ scrollTop: top }, 200); + return false; + } + }); + } + }); + // Set an event listener for infinite scroll if(typeof infinite_scroll !== 'undefined') { $(window).scroll(function(e){ From ead9cbe534d3c520957d72b543004c0fcce70c87 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Thu, 13 Apr 2017 02:24:27 +0200 Subject: [PATCH 20/37] Web app manifest (fixes #3317) --- mod/manifest.php | 26 ++++++++++++++++++++++++++ view/templates/head.tpl | 1 + view/templates/manifest.tpl | 9 +++++++++ view/theme/frio/templates/head.tpl | 1 + 4 files changed, 37 insertions(+) create mode 100644 mod/manifest.php create mode 100644 view/templates/manifest.tpl diff --git a/mod/manifest.php b/mod/manifest.php new file mode 100644 index 0000000000..6dc0d10a21 --- /dev/null +++ b/mod/manifest.php @@ -0,0 +1,26 @@ + App::get_baseurl(), + '$touch_icon' => $touch_icon, + '$title' => Config::get('config', 'sitename', 'Friendica'), + )); + + echo $o; + + killme(); + + } +?> diff --git a/view/templates/head.tpl b/view/templates/head.tpl index bfc5728ed2..e7df8a18cd 100644 --- a/view/templates/head.tpl +++ b/view/templates/head.tpl @@ -19,6 +19,7 @@ +