3 require_once('include/message.php');
5 function wallmessage_post(App $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",
25 if (! dbm::is_result($r)) {
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 $ret = send_wallmessage($user, $body, $subject, $replyto);
50 notice( t('No recipient selected.') . EOL );
53 notice( t('Unable to check your home location.') . EOL );
56 notice( t('Message could not be sent.') . EOL );
59 notice( t('Message collection failure.') . EOL );
62 info( t('Message sent.') . EOL );
65 goaway('profile/'.$user['nickname']);
70 function wallmessage_content(App $a) {
73 notice( t('Permission denied.') . EOL);
77 $recipient = (($a->argc > 1) ? $a->argv[1] : '');
80 notice( t('No recipient.') . EOL);
84 $r = q("select * from user where nickname = '%s' limit 1",
88 if (! dbm::is_result($r)) {
89 notice( t('No recipient.') . EOL);
90 logger('wallmessage: no recipient');
96 if(! intval($user['unkmail'])) {
97 notice( t('Permission denied.') . EOL);
101 $r = q("select count(*) as total from mail where uid = %d and created > UTC_TIMESTAMP() - INTERVAL 1 day and unknown = 1",
105 if($r[0]['total'] > $user['cntunkmail']) {
106 notice( sprintf( t('Number of daily wall messages for %s exceeded. Message failed.', $user['username'])));
110 $tpl = get_markup_template('wallmsg-header.tpl');
111 $a->page['htmlhead'] .= replace_macros($tpl, array(
112 '$baseurl' => $a->get_baseurl(true),
113 '$nickname' => $user['nickname'],
114 '$linkurl' => t('Please enter a link URL:')
117 $tpl = get_markup_template('wallmsg-end.tpl');
118 $a->page['end'] .= replace_macros($tpl, array(
119 '$baseurl' => $a->get_baseurl(true),
120 '$nickname' => $user['nickname'],
121 '$linkurl' => t('Please enter a link URL:')
124 $tpl = get_markup_template('wallmessage.tpl');
125 $o .= replace_macros($tpl,array(
126 '$header' => t('Send Private Message'),
127 '$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']),
129 '$subject' => t('Subject:'),
130 '$recipname' => $user['username'],
131 '$nickname' => $user['nickname'],
132 '$subjtxt' => ((x($_REQUEST,'subject')) ? strip_tags($_REQUEST['subject']) : ''),
133 '$text' => ((x($_REQUEST,'body')) ? escape_tags(htmlspecialchars($_REQUEST['body'])) : ''),
135 '$yourmessage' => t('Your message:'),
136 '$select' => $select,
138 '$upload' => t('Upload photo'),
139 '$insert' => t('Insert web link'),
140 '$wait' => t('Please wait')