* us by hosting providers.
*/
+/*
+ * The notifier is typically called with:
+ *
+ * proc_run('php', "include/notifier.php", COMMAND, ITEM_ID);
+ *
+ * where COMMAND is one of the following:
+ *
+ * activity (in diaspora.php, dfrn_confirm.php, profiles.php)
+ * comment-import (in diaspora.php, items.php)
+ * comment-new (in item.php)
+ * drop (in diaspora.php, items.php, photos.php)
+ * edit_post (in item.php)
+ * event (in events.php)
+ * expire (in items.php)
+ * like (in like.php, poke.php)
+ * mail (in message.php)
+ * suggest (in fsuggest.php)
+ * tag (in photos.php, poke.php, tagger.php)
+ * tgroup (in items.php)
+ * wall-new (in photos.php, item.php)
+ *
+ * and ITEM_ID is the id of the item in the database that needs to be sent to others.
+ */
+
+
function notifier_run($argv, $argc){
global $a, $db;
$recipients[] = $suggest[0]['cid'];
$item = $suggest[0];
}
+ elseif($cmd === 'removeme') {
+ $r = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1", intval($item_id));
+ if (! $r)
+ return;
+ $user = $r[0];
+ $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 1 LIMIT 1", intval($item_id));
+ if (! $r)
+ return;
+ $self = $r[0];
+ $r = q("SELECT * FROM `contact` WHERE `self` = 0 AND `uid` = %d", intval($item_id));
+ if(! $r)
+ return;
+ require_once('include/Contact.php');
+ foreach($r as $contact) {
+ terminate_friendship($user, $self, $contact);
+ }
+ return;
+ }
else {
// find ancestors
// a delivery fork. private groups (forum_mode == 2) do not uplink
if((intval($parent['forum_mode']) == 1) && (! $top_level) && ($cmd !== 'uplink')) {
- proc_run('php','include/notifier','uplink',$item_id);
+ proc_run('php','include/notifier.php','uplink',$item_id);
}
$conversants = array();
// private emails may be in included in public conversations. Filter them.
- if(($public_message) && $item['private'])
+ if(($public_message) && $item['private'] == 1)
continue;
AND `contact`.`pending` = 0
AND `contact`.`network` = '%s' AND `user`.`nickname` = '%s'
$sql_extra
- AND `user`.`account_expired` = 0 LIMIT 1",
+ AND `user`.`account_expired` = 0 AND `user`.`account_removed` = 0 LIMIT 1",
dbesc(NETWORK_DFRN),
dbesc($nickname)
);
- if(count($x)) {
-
- if($owner['page-flags'] == PAGE_COMMUNITY && ! $x[0]['writable']) {
+ if($x && count($x)) {
+ $write_flag = ((($x[0]['rel']) && ($x[0]['rel'] != CONTACT_IS_SHARING)) ? true : false);
+ if((($owner['page-flags'] == PAGE_COMMUNITY) || ($write_flag)) && (! $x[0]['writable'])) {
q("update contact set writable = 1 where id = %d limit 1",
intval($x[0]['id'])
);