3 require_once('include/message.php');
5 function wallmessage_post(&$a) {
7 $replyto = get_my_url();
9 notice( t('Permission denied.') . EOL);
13 $subject = ((x($_REQUEST,'subject')) ? notags(trim($_REQUEST['subject'])) : '');
14 $body = ((x($_REQUEST,'body')) ? escape_tags(trim($_REQUEST['body'])) : '');
16 $recipient = (($a->argc > 1) ? notags($a->argv[1]) : '');
17 if((! $recipient) || (! $body)) {
21 $r = q("select * from user where nickname = '%s' limit 1",
26 logger('wallmessage: no recipient');
32 if(! intval($user['unkmail'])) {
33 notice( t('Permission denied.') . EOL);
37 $r = q("select count(*) as total from mail where uid = %d and created > UTC_TIMESTAMP() - INTERVAL 1 day and unknown = 1",
41 if($r[0]['total'] > $user['cntunkmail']) {
42 notice( sprintf( t('Number of daily wall messages for %s exceeded. Message failed.', $user['username'])));
46 // Work around doubled linefeeds in Tinymce 3.5b2
48 $body = str_replace("\r\n","\n",$body);
49 $body = str_replace("\n\n","\n",$body);
52 $ret = send_wallmessage($user, $body, $subject, $replyto);
56 notice( t('No recipient selected.') . EOL );
59 notice( t('Unable to check your home location.') . EOL );
62 notice( t('Message could not be sent.') . EOL );
65 notice( t('Message collection failure.') . EOL );
68 info( t('Message sent.') . EOL );
71 // goaway($a->get_baseurl() . '/profile/' . $user['nickname']);
76 function wallmessage_content(&$a) {
79 notice( t('Permission denied.') . EOL);
83 $recipient = (($a->argc > 1) ? $a->argv[1] : '');
86 notice( t('No recipient.') . EOL);
90 $r = q("select * from user where nickname = '%s' limit 1",
95 notice( t('No recipient.') . EOL);
96 logger('wallmessage: no recipient');
102 if(! intval($user['unkmail'])) {
103 notice( t('Permission denied.') . EOL);
107 $r = q("select count(*) as total from mail where uid = %d and created > UTC_TIMESTAMP() - INTERVAL 1 day and unknown = 1",
111 if($r[0]['total'] > $user['cntunkmail']) {
112 notice( sprintf( t('Number of daily wall messages for %s exceeded. Message failed.', $user['username'])));
118 $tpl = get_markup_template('wallmsg-header.tpl');
119 $a->page['htmlhead'] .= replace_macros($tpl, array(
120 '$baseurl' => $a->get_baseurl(true),
121 '$editselect' => '/(profile-jot-text|prvmail-text)/',
122 '$nickname' => $user['nickname'],
123 '$linkurl' => t('Please enter a link URL:')
126 $tpl = get_markup_template('wallmsg-end.tpl');
127 $a->page['end'] .= replace_macros($tpl, array(
128 '$baseurl' => $a->get_baseurl(true),
129 '$editselect' => '/(profile-jot-text|prvmail-text)/',
130 '$nickname' => $user['nickname'],
131 '$linkurl' => t('Please enter a link URL:')
136 $tpl = get_markup_template('wallmessage.tpl');
137 $o .= replace_macros($tpl,array(
138 '$header' => t('Send Private Message'),
139 '$subheader' => sprintf( t('If you wish for %s to respond, please check that the privacy settings on your site allow private mail from unknown senders.'), $user['username']),
141 '$subject' => t('Subject:'),
142 '$recipname' => $user['username'],
143 '$nickname' => $user['nickname'],
144 '$subjtxt' => ((x($_REQUEST,'subject')) ? strip_tags($_REQUEST['subject']) : ''),
145 '$text' => ((x($_REQUEST,'body')) ? escape_tags(htmlspecialchars($_REQUEST['body'])) : ''),
147 '$yourmessage' => t('Your message:'),
148 '$select' => $select,
150 '$upload' => t('Upload photo'),
151 '$insert' => t('Insert web link'),
152 '$wait' => t('Please wait')