diff options
-rw-r--r-- | boot.php | 1 | ||||
-rw-r--r-- | include/Contact.php | 3 | ||||
-rw-r--r-- | include/enotify.php | 18 | ||||
-rwxr-xr-x | include/items.php | 52 | ||||
-rwxr-xr-x | mod/poke.php | 24 | ||||
-rw-r--r-- | mod/settings.php | 3 | ||||
-rw-r--r-- | view/poke_content.tpl | 4 | ||||
-rw-r--r-- | view/settings.tpl | 1 | ||||
-rw-r--r-- | view/theme/duepuntozero/prv_message.tpl | 2 |
9 files changed, 103 insertions, 5 deletions
@@ -199,6 +199,7 @@ define ( 'NOTIFY_SUGGEST', 0x0020 ); define ( 'NOTIFY_PROFILE', 0x0040 ); define ( 'NOTIFY_TAGSELF', 0x0080 ); define ( 'NOTIFY_TAGSHARE', 0x0100 ); +define ( 'NOTIFY_POKE', 0x0200 ); define ( 'NOTIFY_SYSTEM', 0x8000 ); diff --git a/include/Contact.php b/include/Contact.php index 4e902be4f..9a6c64693 100644 --- a/include/Contact.php +++ b/include/Contact.php @@ -188,6 +188,7 @@ function contact_photo_menu($contact) { $status_link=""; $photos_link=""; $posts_link=""; + $poke_link=""; $sparkle = false; if($contact['network'] === NETWORK_DFRN) { @@ -207,10 +208,12 @@ function contact_photo_menu($contact) { $pm_url = $a->get_baseurl() . '/message/new/' . $contact['id']; } + $poke_link = $a->get_baseurl() . '/poke/?f=&c=' . $contact['id']; $contact_url = $a->get_baseurl() . '/contacts/' . $contact['id']; $posts_link = $a->get_baseurl() . '/network/?cid=' . $contact['id']; $menu = Array( + t("Poke") => $poke_link, t("View Status") => $status_link, t("View Profile") => $profile_link, t("View Photos") => $photos_link, diff --git a/include/enotify.php b/include/enotify.php index 814bd06a4..510991476 100644 --- a/include/enotify.php +++ b/include/enotify.php @@ -147,6 +147,24 @@ function notification($params) { $itemlink = $params['link']; } + if($params['type'] == NOTIFY_POKE) { + + $subject = sprintf( t('[Friendica:Notify] %1$s poked you') , $params['source_name']); + $preamble = sprintf( t('%1$s poked you at %2$s') , $params['source_name'], $sitename); + $epreamble = sprintf( t('%1$s [url=%2$s]poked you[/url].') , + '[url=' . $params['source_link'] . ']' . $params['source_name'] . '[/url]', + $params['link']); + + $subject = str_replace('poked', t($params['activity']), $subject); + $preamble = str_replace('poked', t($params['activity']), $preamble); + $epreamble = str_replace('poked', t($params['activity']), $epreamble); + + $sitelink = t('Please visit %s to view and/or reply to the conversation.'); + $tsitelink = sprintf( $sitelink, $siteurl ); + $hsitelink = sprintf( $sitelink, '<a href="' . $siteurl . '">' . $sitename . '</a>'); + $itemlink = $params['link']; + } + if($params['type'] == NOTIFY_TAGSHARE) { $subject = sprintf( t('[Friendica:Notify] %s tagged your post') , $params['source_name']); $preamble = sprintf( t('%1$s tagged your post at %2$s') , $params['source_name'], $sitename); diff --git a/include/items.php b/include/items.php index 21b7d9433..b11250f8b 100755 --- a/include/items.php +++ b/include/items.php @@ -2818,7 +2818,57 @@ function local_delivery($importer,$data) { $datarray['owner-avatar'] = $importer['thumb']; } - $r = item_store($datarray); + $posted_id = item_store($datarray); + + if(stristr($datarray['verb'],ACTIVITY_POKE)) { + $verb = urldecode(substr($datarray['verb'],strpos($datarray['verb'],'#')+1)); + if(! $verb) + continue; + $xo = parse_xml_string($datarray['object'],false); + + if(($xo->type == ACTIVITY_OBJ_PERSON) && ($xo->id)) { + + // somebody was poked/prodded. Was it me? + + $links = parse_xml_string("<links>".unxmlify($xo->link)."</links>",false); + + foreach($links->link as $l) { + $atts = $l->attributes(); + switch($atts['rel']) { + case "alternate": + $Blink = $atts['href']; + break; + default: + break; + } + } + if($Blink && link_compare($Blink,$a->get_baseurl() . '/profile/' . $importer['nickname'])) { + + // send a notification + require_once('include/enotify.php'); + + notification(array( + 'type' => NOTIFY_POKE, + 'notify_flags' => $importer['notify-flags'], + 'language' => $importer['language'], + 'to_name' => $importer['username'], + 'to_email' => $importer['email'], + 'uid' => $importer['importer_uid'], + 'item' => $datarray, + 'link' => $a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $posted_id, + 'source_name' => stripslashes($datarray['author-name']), + 'source_link' => $datarray['author-link'], + 'source_photo' => ((link_compare($datarray['author-link'],$importer['url'])) + ? $importer['thumb'] : $datarray['author-avatar']), + 'verb' => $datarray['verb'], + 'otype' => 'person', + 'activity' => $verb, + + )); + } + } + } + continue; } } diff --git a/mod/poke.php b/mod/poke.php index 8fe07b4cd..f4660e624 100755 --- a/mod/poke.php +++ b/mod/poke.php @@ -102,6 +102,26 @@ function poke_init(&$a) { function poke_content(&$a) { + if(! local_user()) { + notice( t('Permission denied.') . EOL); + return; + } + + $name = ''; + $id = ''; + + if(intval($_GET['c'])) { + $r = q("select id,name from contact where id = %d and uid = %d limit 1", + intval($_GET['c']), + intval(local_user()) + ); + if(count($r)) { + $name = $r[0]['name']; + $id = $r[0]['id']; + } + } + + $base = $a->get_baseurl(); $a->page['htmlhead'] .= '<script src="' . $a->get_baseurl(true) . '/library/jquery_ac/friendica.complete.js" ></script>'; @@ -141,7 +161,9 @@ EOT; '$clabel' => t('Recipient'), '$choice' => t('Choose what you wish to do to recipient'), '$verbs' => $shortlist, - '$submit' => t('Submit') + '$submit' => t('Submit'), + '$name' => $name, + '$id' => $id )); return $o; diff --git a/mod/settings.php b/mod/settings.php index ab63fa177..5e8c78ae7 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -373,6 +373,8 @@ function settings_post(&$a) { $notify += intval($_POST['notify6']); if(x($_POST,'notify7')) $notify += intval($_POST['notify7']); + if(x($_POST,'notify8')) + $notify += intval($_POST['notify8']); $email_changed = false; @@ -970,6 +972,7 @@ function settings_content(&$a) { '$notify5' => array('notify5', t('You receive a private message'), ($notify & NOTIFY_MAIL), NOTIFY_MAIL, ''), '$notify6' => array('notify6', t('You receive a friend suggestion'), ($notify & NOTIFY_SUGGEST), NOTIFY_SUGGEST, ''), '$notify7' => array('notify7', t('You are tagged in a post'), ($notify & NOTIFY_TAGSELF), NOTIFY_TAGSELF, ''), + '$notify8' => array('notify8', t('You are poked/prodded/etc. in a post'), ($notify & NOTIFY_POKE), NOTIFY_POKE, ''), '$h_advn' => t('Advanced Account/Page Type Settings'), diff --git a/view/poke_content.tpl b/view/poke_content.tpl index 09b3d8db4..f81d04c6c 100644 --- a/view/poke_content.tpl +++ b/view/poke_content.tpl @@ -8,8 +8,8 @@ <div id="poke-recip-label">$clabel</div> <br /> -<input id="recip" type="text" size="64" maxlength="255" value="" name="pokename" autocomplete="off"> -<input id="recip-complete" type="hidden" value="" name="cid"> +<input id="recip" type="text" size="64" maxlength="255" value="$name" name="pokename" autocomplete="off"> +<input id="recip-complete" type="hidden" value="$id" name="cid"> <br /> <br /> diff --git a/view/settings.tpl b/view/settings.tpl index 99ee9b51e..bebd0c12a 100644 --- a/view/settings.tpl +++ b/view/settings.tpl @@ -123,6 +123,7 @@ $group_select {{inc field_intcheckbox.tpl with $field=$notify5 }}{{endinc}} {{inc field_intcheckbox.tpl with $field=$notify6 }}{{endinc}} {{inc field_intcheckbox.tpl with $field=$notify7 }}{{endinc}} +{{inc field_intcheckbox.tpl with $field=$notify8 }}{{endinc}} </div> </div> diff --git a/view/theme/duepuntozero/prv_message.tpl b/view/theme/duepuntozero/prv_message.tpl index b5cda9c85..e103497e1 100644 --- a/view/theme/duepuntozero/prv_message.tpl +++ b/view/theme/duepuntozero/prv_message.tpl @@ -9,7 +9,7 @@ $parent <div id="prvmail-to-label">$to</div> {{ if $showinputs }} -<input type="text" id="recip" name="messageto" value="$prefill" maxlength="255" size="64" tabindex="10" /> +<input type="text" id="recip" name="messagerecip" value="$prefill" maxlength="255" size="64" tabindex="10" /> <input type="hidden" id="recip-complete" name="messageto" value="$preid"> {{ else }} $select |