5 * @brief tool to silence accounts on the global community page
7 * With this tool, you can silence an account on the global community page.
8 * Postings from silenced accounts will not be displayes on the community
9 * page. This silencing does only affect the display on the community page,
10 * accounts following the silenced accounts will still get their postings.
12 * Usage: pass the URL of the to be silenced account as only parameter
13 * at the command line when running this tool. E.g.
15 * $> util/global_community_silence.php http://example.com/profile/bob
17 * will silence bob@example.com so that his postings wont appear at
18 * the global community page.
20 * Author: Tobias Diekershoff
22 * License: AGPLv3 or later, same as Friendica
25 if ($argc!=2 || $argv[1]=="-h" || $argv[1]=="--help" || $argv[1]=="-?") {
26 echo "Usage: ".$argv[0]." [-h|profile_url]\r\n";
27 echo " -h, -?, --help ... show this help\r\n";
28 echo " profile_url ...... The URL of the profile you want to silence\r\n";
30 echo "Example: Silence bob@example.com\r\n";
31 echo "$> ".$argv[0]." https://exaple.com/profiles/bob\r\n";
36 use Friendica\Database\DBM;
37 require_once("boot.php");
38 require_once('include/dba.php');
39 require_once("include/text.php");
41 require_once ".htconfig.php";
43 dba::connect($db_host, $db_user, $db_pass, $db_data);
44 unset($db_host, $db_user, $db_pass, $db_data);
47 * 1. make nurl from last parameter
48 * 2. check DB (contact) if there is a contact with uid=0 and that nurl, get the ID
49 * 3. set the flag hidden=1 for the contact entry with the found ID
52 $nurl = normalise_link($argv[1]);
53 $r = dba::select("contact", array("id"), array("nurl" => $nurl, "uid" => 0), array("limit"=> 1));
54 if (DBM::is_result($r)) {
55 dba::update("contact", array("hidden"=>1), array("id"=>$r["id"]));
56 echo "NOTICE: The account should be silenced from the global community page\r\n";
58 echo "NOTICE: Could not find any entry for this URL (".$nurl.")\r\n";