summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorcsarven <csarven@controlyourself.ca>2008-11-15 21:27:35 -0500
committercsarven <csarven@controlyourself.ca>2008-11-15 21:27:35 -0500
commitf3572aec7f159231ca2b63be1d2c5466a3ff7208 (patch)
treebe568695ec260c8af1e0499f2823dbcb294bb888 /lib
parent44602ae0ffb1dc3468d43381249f9a1618d88d1c (diff)
Nudge feature
darcs-hash:20081116022735-eefa4-366f6deb85942f859ebd532e477b57737bcafbf8.gz
Diffstat (limited to 'lib')
-rw-r--r--lib/mail.php23
-rw-r--r--lib/util.php21
2 files changed, 44 insertions, 0 deletions
diff --git a/lib/mail.php b/lib/mail.php
index b96bc7161..a4764bfb5 100644
--- a/lib/mail.php
+++ b/lib/mail.php
@@ -232,6 +232,29 @@ function mail_confirm_sms($code, $nickname, $address) {
mail_send($recipients, $headers, $body);
}
+
+function mail_notify_nudge($from, $to) {
+
+ $subject = sprintf(_('You\'ve been nudged by %s'), $from->nickname);
+
+ $from_profile = $from->getProfile();
+
+ $body = sprintf(_("%1\$s (%2\$s) is wondering what you are up to these days and is inviting you to post some news.\n\n".
+ "You can reply to their message here:\n\n".
+ "%3\$s\n\n".
+ "Don't reply to this email; it won't get to them.\n\n".
+ "With kind regards,\n".
+ "%4\$s\n"),
+ $from_profile->getBestName(),
+ $from->nickname,
+ common_local_url('newmessage', array('to' => $from->id)),
+ common_config('site', 'name'));
+
+ return mail_to_user($to, $subject, $body);
+}
+
+
+
function mail_notify_message($message, $from=NULL, $to=NULL) {
if (is_null($from)) {
diff --git a/lib/util.php b/lib/util.php
index e958a87ba..43e565fbf 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -978,6 +978,8 @@ function common_fancy_url($action, $args=NULL) {
} else {
return common_path('main/remote');
}
+ case 'nudge':
+ return common_path($args['nickname'].'/nudge');
case 'openidlogin':
return common_path('main/openid');
case 'profilesettings':
@@ -1861,6 +1863,25 @@ function common_favor_form($notice) {
common_element_end('form');
}
+function common_nudge_form($profile) {
+ common_element_start('form', array('id' => 'nudge', 'method' => 'post',
+ 'action' => common_local_url('nudge', array('nickname' => $profile->nickname))));
+ common_hidden('token', common_session_token()); //Is this necessary?
+// common_element('input', array('id' => 'nudge_nickname',
+// 'name' => 'nudge_nickname',
+// 'type' => 'hidden',
+// 'value' => $profile->nickname));
+ common_element('input', array('type' => 'submit',
+ 'class' => 'submit',
+ 'value' => _('Send a nudge')));
+ common_element_end('form');
+}
+
+function common_nudge_response() {
+ common_element('p', array('id' => 'nudge_response'), _('Nudge sent!'));
+}
+
+
function common_cache_key($extra) {
return 'laconica:' . common_keyize(common_config('site', 'name')) . ':' . $extra;
}