Send notifications for each new post of a contact, option for creating a summary for a feed post

This commit is contained in:
Michael Vogel 2014-01-05 16:10:02 +01:00
commit 28df35052a
8 changed files with 155 additions and 32 deletions

View file

@ -68,7 +68,7 @@ function contacts_init(&$a) {
}
function contacts_post(&$a) {
if(! local_user())
return;
@ -103,6 +103,10 @@ function contacts_post(&$a) {
$hidden = intval($_POST['hidden']);
$notify = intval($_POST['notify']);
$fetch_further_information = intval($_POST['fetch_further_information']);
$priority = intval($_POST['poll']);
if($priority > 5 || $priority < 0)
$priority = 0;
@ -110,11 +114,13 @@ function contacts_post(&$a) {
$info = fix_mce_lf(escape_tags(trim($_POST['info'])));
$r = q("UPDATE `contact` SET `profile-id` = %d, `priority` = %d , `info` = '%s',
`hidden` = %d WHERE `id` = %d AND `uid` = %d LIMIT 1",
`hidden` = %d, `notify_new_posts` = %d, `fetch_further_information` = %d WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($profile_id),
intval($priority),
dbesc($info),
intval($hidden),
intval($notify),
intval($fetch_further_information),
intval($contact_id),
intval(local_user())
);
@ -417,6 +423,8 @@ function contacts_content(&$a) {
'$ignored' => (($contact['readonly']) ? t('Currently ignored') : ''),
'$archived' => (($contact['archive']) ? t('Currently archived') : ''),
'$hidden' => array('hidden', t('Hide this contact from others'), ($contact['hidden'] == 1), t('Replies/likes to your public posts <strong>may</strong> still be visible')),
'$notify' => array('notify', t('Notification for new posts'), ($contact['notify_new_posts'] == 1), t('Send a notification of every new post of this contact')),
'$fetch_further_information' => array('fetch_further_information', t('Fetch further information for feeds'), ($contact['fetch_further_information'] == 1), t('Fetch further information for feeds')),
'$photo' => $contact['photo'],
'$name' => $contact['name'],
'$dir_icon' => $dir_icon,

View file

@ -28,7 +28,7 @@ function crepair_init(&$a) {
$o .= '</div>';
$a->page['aside'] .= $o;
}
}
}
@ -59,8 +59,9 @@ function crepair_post(&$a) {
$poll = ((x($_POST,'poll')) ? $_POST['poll'] : '');
$attag = ((x($_POST,'attag')) ? $_POST['attag'] : '');
$photo = ((x($_POST,'photo')) ? $_POST['photo'] : '');
$remote_self = ((x($_POST,'remote_self')) ? $_POST['remote_self'] : false);
$r = q("UPDATE `contact` SET `name` = '%s', `nick` = '%s', `url` = '%s', `request` = '%s', `confirm` = '%s', `notify` = '%s', `poll` = '%s', `attag` = '%s'
$r = q("UPDATE `contact` SET `name` = '%s', `nick` = '%s', `url` = '%s', `request` = '%s', `confirm` = '%s', `notify` = '%s', `poll` = '%s', `attag` = '%s' , `remote_self` = %d
WHERE `id` = %d AND `uid` = %d LIMIT 1",
dbesc($name),
dbesc($nick),
@ -70,6 +71,7 @@ function crepair_post(&$a) {
dbesc($notify),
dbesc($poll),
dbesc($attag),
intval($remote_self),
intval($contact['id']),
local_user()
);
@ -154,6 +156,7 @@ function crepair_content(&$a) {
'$label_notify' => t('Notification Endpoint URL'),
'$label_poll' => t('Poll/Feed URL'),
'$label_photo' => t('New photo from this URL'),
'$label_self' => t('Mirror all posts to the wall?'),
'$contact_name' => $contact['name'],
'$contact_nick' => $contact['nick'],
'$contact_id' => $contact['id'],
@ -163,6 +166,8 @@ function crepair_content(&$a) {
'$notify' => $contact['notify'],
'$poll' => $contact['poll'],
'$contact_attag' => $contact['attag'],
'$contact_self' => array('remote_self', t('Mirror all posts to the wall?'), $contact['remote_self'],
t('Shall all posts from this contact posted like your own posts?')),
'$lbl_submit' => t('Submit')
));