Replace the legacy function

This commit is contained in:
Michael 2021-10-11 04:33:10 +00:00
parent ee2b249d00
commit 41dc6cea2b
4 changed files with 22 additions and 126 deletions

View file

@ -92,11 +92,13 @@ class Widget
/**
* Return unavailable networks as array
*
* @return array Unsupported networks
*/
public static function unavailableNetworksAsArray()
public static function unavailableNetworks()
{
// Always hide content from these networks
$networks = [Protocol::PHANTOM, Protocol::FACEBOOK, Protocol::APPNET];
$networks = [Protocol::PHANTOM, Protocol::FACEBOOK, Protocol::APPNET, Protocol::ZOT];
if (!Addon::isEnabled("discourse")) {
$networks[] = Protocol::DISCOURSE;
@ -128,24 +130,6 @@ class Widget
return $networks;
}
/**
* Return unavailable networks
*/
public static function unavailableNetworks()
{
$networks = self::unavailableNetworksAsArray();
if (!sizeof($networks)) {
return "";
}
$network_filter = implode("','", $networks);
$network_filter = "AND `network` NOT IN ('$network_filter')";
return $network_filter;
}
/**
* Display a generic filter widget based on a list of options
*
@ -274,10 +258,12 @@ class Widget
return '';
}
$extra_sql = self::unavailableNetworks();
$networks = self::unavailableNetworks();
$extra_sql = " AND NOT `network` IN (" . substr(str_repeat("?, ", count($networks)), 0, -2) . ")";
$sql_values = array_merge([local_user()], $networks);
$r = DBA::p("SELECT `network` FROM `contact` WHERE `uid` = ? AND NOT `deleted` AND `network` != '' $extra_sql GROUP BY `network` ORDER BY `network`",
local_user()
$sql_values
);
$nets = array();
@ -525,7 +511,7 @@ class Widget
/**
* Display the account types sidebar
* The account type value is added as a parameter to the url
*
*
* @param string $base Basepath
* @param int $accounttype Acount type
* @return string