From ea18d1829ff3439cc1cea0aeb88c22b59a0d5c79 Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 24 Jan 2017 06:45:46 +0000 Subject: [PATCH] Reformatted stuff, improved query --- include/contact_widgets.php | 2 +- mod/network.php | 16 +++++++--------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/include/contact_widgets.php b/include/contact_widgets.php index fee569e94d..1e35db2c78 100644 --- a/include/contact_widgets.php +++ b/include/contact_widgets.php @@ -90,7 +90,7 @@ function networks_widget($baseurl,$selected = '') { $extra_sql = unavailable_networks(); - $r = q("SELECT DISTINCT(`network`) FROM `contact` WHERE `uid` = %d AND NOT `self` $extra_sql ORDER BY `network`", + $r = q("SELECT DISTINCT(`network`) FROM `contact` WHERE `uid` = %d AND `network` != '' $extra_sql ORDER BY `network`", intval(local_user()) ); diff --git a/mod/network.php b/mod/network.php index 12223494a7..ad0347ba0c 100644 --- a/mod/network.php +++ b/mod/network.php @@ -773,14 +773,12 @@ function network_content(App $a, $update = 0) { intval(local_user()) ); } - } else { - if ($update_unseen) { + } elseif ($update_unseen) { - $unseen = q("SELECT `id` FROM `item` ".$update_unseen. " LIMIT 1"); + $unseen = q("SELECT `id` FROM `item` ".$update_unseen. " LIMIT 1"); - if (dbm::is_result($unseen)) { - $r = q("UPDATE `item` SET `unseen` = 0 $update_unseen"); - } + if (dbm::is_result($unseen)) { + $r = q("UPDATE `item` SET `unseen` = 0 $update_unseen"); } } @@ -791,10 +789,10 @@ function network_content(App $a, $update = 0) { $o .= conversation($a,$items,$mode,$update); - if(!$update) { - if(get_pconfig(local_user(),'system','infinite_scroll')) { + if (!$update) { + if (get_pconfig(local_user(),'system','infinite_scroll')) { $o .= scroll_loader(); - } elseif(!get_config('system', 'old_pager')) { + } elseif (!get_config('system', 'old_pager')) { $o .= alt_pager($a,count($items)); } else { $o .= paginate($a);