4 * @brief tool to block an account from the node
6 * With this tool, you can block an account in such a way, that no postings
7 * or comments this account writes are accepted to the node.
9 * Usage: pass the URL of the to be blocked account as only parameter
10 * at the command line when running this tool. E.g.
12 * $> util/global_community_block.php http://example.com/profile/bob
14 * will block bob@example.com.
16 * Author: Tobias Diekershoff
18 * License: AGPLv3 or later, same as Friendica
20 if ($argc != 2 || $argv[1] == "-h" || $argv[1] == "--help" || $argv[1] == "-?") {
21 echo "Usage: " . $argv[0] . " [-h|profile_url]\r\n";
22 echo " -h, -?, --help ... show this help\r\n";
23 echo " profile_url ...... The URL of the profile you want to silence\r\n";
25 echo "Example: block bob@example.com\r\n";
26 echo "$> " . $argv[0] . " https://example.com/profiles/bob\r\n";
31 use Friendica\BaseObject;
32 use Friendica\Object\Contact;
34 require_once 'boot.php';
35 require_once 'include/dba.php';
36 require_once 'include/text.php';
39 BaseObject::setApp($a);
41 require_once '.htconfig.php';
42 dba::connect($db_host, $db_user, $db_pass, $db_data);
43 unset($db_host, $db_user, $db_pass, $db_data);
45 $contact_id = Contact::getIdForURL($argv[1], 0);
47 echo t('Could not find any contact entry for this URL (%s)', $nurl);
51 Contact::block($contact_id);
52 echo t('The contact has been blocked from the node');