line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Labyrinth::Plugin::Survey::Announce; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
5204
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
61
|
|
4
|
2
|
|
|
2
|
|
8
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
54
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
7
|
use vars qw($VERSION); |
|
2
|
|
|
|
|
1
|
|
|
2
|
|
|
|
|
104
|
|
7
|
|
|
|
|
|
|
$VERSION = '0.08'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 NAME |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Labyrinth::Plugin::Survey::Announce - YAPC Surveys' announcements plugin for Labyrinth framework |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 DESCRIPTION |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Provides all the announcement handling functionality for YAPC Surveys. |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=cut |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# ------------------------------------- |
20
|
|
|
|
|
|
|
# Library Modules |
21
|
|
|
|
|
|
|
|
22
|
2
|
|
|
2
|
|
8
|
use base qw(Labyrinth::Plugin::Base); |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
763
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
use Labyrinth::Audit; |
25
|
|
|
|
|
|
|
use Labyrinth::DBUtils; |
26
|
|
|
|
|
|
|
use Labyrinth::DTUtils; |
27
|
|
|
|
|
|
|
use Labyrinth::Mailer; |
28
|
|
|
|
|
|
|
use Labyrinth::MLUtils; |
29
|
|
|
|
|
|
|
use Labyrinth::Support; |
30
|
|
|
|
|
|
|
use Labyrinth::Users; |
31
|
|
|
|
|
|
|
use Labyrinth::Variables; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
use Encode qw/encode decode/; |
34
|
|
|
|
|
|
|
use HTML::Entities; |
35
|
|
|
|
|
|
|
use Time::Piece; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# ------------------------------------- |
38
|
|
|
|
|
|
|
# Variables |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
# type: 0 = optional, 1 = mandatory |
41
|
|
|
|
|
|
|
# html: 0 = none, 1 = text, 2 = textarea, 3 = full legal html |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
my %fields = ( |
44
|
|
|
|
|
|
|
announceid => { type => 0, html => 0 }, |
45
|
|
|
|
|
|
|
hFrom => { type => 1, html => 2 }, # can contain "" which looks like a HTML tag |
46
|
|
|
|
|
|
|
hSubject => { type => 1, html => 1 }, |
47
|
|
|
|
|
|
|
body => { type => 1, html => 2 }, |
48
|
|
|
|
|
|
|
publish => { type => 1, html => 0 }, |
49
|
|
|
|
|
|
|
); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
my (@mandatory,@allfields); |
52
|
|
|
|
|
|
|
for(keys %fields) { |
53
|
|
|
|
|
|
|
push @mandatory, $_ if($fields{$_}->{type}); |
54
|
|
|
|
|
|
|
push @allfields, $_; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
my @savefields = qw(hFrom hSubject body publish); |
58
|
|
|
|
|
|
|
my $INDEXKEY = 'announceid'; |
59
|
|
|
|
|
|
|
my $ALLSQL = 'GetAnnounces'; |
60
|
|
|
|
|
|
|
my $SAVESQL = 'SaveAnnounce'; |
61
|
|
|
|
|
|
|
my $ADDSQL = 'AddAnnounce'; |
62
|
|
|
|
|
|
|
my $GETSQL = 'GetAnnounceByID'; |
63
|
|
|
|
|
|
|
my $DELETESQL = 'DeleteAnnounce'; |
64
|
|
|
|
|
|
|
my $LEVEL = ADMIN; |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
my %adddata = ( |
67
|
|
|
|
|
|
|
announceid => 0, |
68
|
|
|
|
|
|
|
hFrom => '', |
69
|
|
|
|
|
|
|
hTo => '', |
70
|
|
|
|
|
|
|
hSubject => '', |
71
|
|
|
|
|
|
|
body => '', |
72
|
|
|
|
|
|
|
); |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
# ------------------------------------- |
75
|
|
|
|
|
|
|
# The Subs |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 PUBLIC INTERFACE METHODS |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head2 General Management Methods |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=over 4 |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=item Admin |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Lists active announcements. |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=item Add |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
Add an announcement. |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=item Edit |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Edit an announcement. |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=item Save |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
Save an announcement. |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=item Delete |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Delete one or more announcements. |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=back |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=cut |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
sub Admin { |
108
|
|
|
|
|
|
|
return unless(AccessUser($LEVEL)); |
109
|
|
|
|
|
|
|
if($cgiparams{doaction}) { |
110
|
|
|
|
|
|
|
if($cgiparams{doaction} eq 'Delete' ) { Delete(); } |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
my @rows = $dbi->GetQuery('hash',$ALLSQL); |
113
|
|
|
|
|
|
|
$tvars{data} = \@rows if(@rows); |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
sub Add { |
117
|
|
|
|
|
|
|
return unless AccessUser($LEVEL); |
118
|
|
|
|
|
|
|
$tvars{data}{ddpublish} = PublishSelect(undef,1); |
119
|
|
|
|
|
|
|
} |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
sub Edit { |
122
|
|
|
|
|
|
|
return unless AccessUser($LEVEL); |
123
|
|
|
|
|
|
|
return unless AuthorCheck($GETSQL,$INDEXKEY,$LEVEL); |
124
|
|
|
|
|
|
|
$tvars{data}{ddpublish} = PublishSelect($tvars{data}{publish},1); |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
my @user = $dbi->GetQuery('array','CountConfirmedUsers'); |
127
|
|
|
|
|
|
|
my @sent = $dbi->GetQuery('array','AnnounceSent',$cgiparams{$INDEXKEY}); |
128
|
|
|
|
|
|
|
my @wait = $dbi->GetQuery('array','AnnounceNotSent',$cgiparams{$INDEXKEY}); |
129
|
|
|
|
|
|
|
my @done = $dbi->GetQuery('hash','AdminSurveys'); |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
if(@user) { |
132
|
|
|
|
|
|
|
if(@sent) { |
133
|
|
|
|
|
|
|
$tvars{data}{sent} = $sent[0]->[0]; |
134
|
|
|
|
|
|
|
$tvars{data}{unsent} = $wait[0]->[0]; |
135
|
|
|
|
|
|
|
} else { |
136
|
|
|
|
|
|
|
$tvars{data}{sent} = 0; |
137
|
|
|
|
|
|
|
$tvars{data}{unsent} = $user[0]->[0]; |
138
|
|
|
|
|
|
|
} |
139
|
|
|
|
|
|
|
if(@done) { |
140
|
|
|
|
|
|
|
$tvars{data}{done} = scalar(@done); |
141
|
|
|
|
|
|
|
$tvars{data}{undone} = $user[0]->[0] - scalar(@done); |
142
|
|
|
|
|
|
|
} else { |
143
|
|
|
|
|
|
|
$tvars{data}{done} = 0; |
144
|
|
|
|
|
|
|
$tvars{data}{undone} = $user[0]->[0]; |
145
|
|
|
|
|
|
|
} |
146
|
|
|
|
|
|
|
} else { |
147
|
|
|
|
|
|
|
$tvars{data}{sent} = 0; |
148
|
|
|
|
|
|
|
$tvars{data}{unsent} = 0; |
149
|
|
|
|
|
|
|
$tvars{data}{done} = 0; |
150
|
|
|
|
|
|
|
$tvars{data}{undone} = 0; |
151
|
|
|
|
|
|
|
} |
152
|
|
|
|
|
|
|
} |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
sub Save { |
155
|
|
|
|
|
|
|
return unless AccessUser($LEVEL); |
156
|
|
|
|
|
|
|
return unless AuthorCheck($GETSQL,$INDEXKEY,$LEVEL); |
157
|
|
|
|
|
|
|
for(keys %fields) { |
158
|
|
|
|
|
|
|
if($fields{$_}->{html} == 1) { $cgiparams{$_} = CleanHTML($cgiparams{$_}) } |
159
|
|
|
|
|
|
|
elsif($fields{$_}->{html} == 2) { $cgiparams{$_} = CleanTags($cgiparams{$_}) } |
160
|
|
|
|
|
|
|
elsif($fields{$_}->{html} == 3) { $cgiparams{$_} = CleanLink($cgiparams{$_}) } |
161
|
|
|
|
|
|
|
} |
162
|
|
|
|
|
|
|
return if FieldCheck(\@allfields,\@mandatory); |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
my @fields = map {$tvars{data}->{$_}} @savefields; |
165
|
|
|
|
|
|
|
if($cgiparams{$INDEXKEY}) { |
166
|
|
|
|
|
|
|
$dbi->DoQuery($SAVESQL,@fields,$cgiparams{$INDEXKEY}); |
167
|
|
|
|
|
|
|
} else { |
168
|
|
|
|
|
|
|
$cgiparams{$INDEXKEY} = $dbi->IDQuery($ADDSQL,@fields); |
169
|
|
|
|
|
|
|
} |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
$tvars{thanks} = 1; |
172
|
|
|
|
|
|
|
} |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
sub Delete { |
175
|
|
|
|
|
|
|
return unless AccessUser($LEVEL); |
176
|
|
|
|
|
|
|
my @ids = CGIArray('LISTED'); |
177
|
|
|
|
|
|
|
return unless @ids; |
178
|
|
|
|
|
|
|
$dbi->DoQuery($DELETESQL,{ids=>join(",",@ids)}); |
179
|
|
|
|
|
|
|
} |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=head2 Mail Management Methods |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=over 4 |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
=item Resend |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
List users who have previously been sent the selected announcement. |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
=item Unsent |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
List users who have never previously been sent the selected announcement. |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
=item Done |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
List users who have submitted the main conference survey |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
=item Undone |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
List users who have not submitted the main conference survey |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
=item SendOne |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
Send announcement to selected users. |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
=item SendAll |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
Resend announcement to all users. |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
=item SendNew |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
Send announcement to users who have not previously been sent it. |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
=item SendNot |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
Send announcement to users who have not taken the main conference survey. |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
=back |
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
=cut |
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
sub Resend { |
222
|
|
|
|
|
|
|
return unless AccessUser($LEVEL); |
223
|
|
|
|
|
|
|
return unless AuthorCheck($GETSQL,$INDEXKEY,$LEVEL); |
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
$cgiparams{sortname} ||= 'realname'; |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
my $sort = "ORDER BY u.$cgiparams{sortname} "; |
228
|
|
|
|
|
|
|
$sort .= $cgiparams{sorttype} ? 'ASC' : 'DESC'; |
229
|
|
|
|
|
|
|
$tvars{sorttype} = $cgiparams{sorttype} ? 0 : 1; |
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
my @users = $dbi->GetQuery('hash','ListAnnounceSent',{'sort' => $sort},$cgiparams{$INDEXKEY}); |
232
|
|
|
|
|
|
|
$tvars{users} = \@users if(@users) |
233
|
|
|
|
|
|
|
} |
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
sub Unsent { |
236
|
|
|
|
|
|
|
return unless AccessUser($LEVEL); |
237
|
|
|
|
|
|
|
return unless AuthorCheck($GETSQL,$INDEXKEY,$LEVEL); |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
$cgiparams{sortname} ||= 'realname'; |
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
my $sort = "ORDER BY u.$cgiparams{sortname} "; |
242
|
|
|
|
|
|
|
$sort .= $cgiparams{sorttype} ? 'ASC' : 'DESC'; |
243
|
|
|
|
|
|
|
$tvars{sorttype} = $cgiparams{sorttype} ? 0 : 1; |
244
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
my @users = $dbi->GetQuery('hash','ListAnnounceUnsent',{'sort' => $sort},$cgiparams{$INDEXKEY}); |
246
|
|
|
|
|
|
|
$tvars{users} = \@users if(@users); |
247
|
|
|
|
|
|
|
$tvars{sorttype} ||= 0; |
248
|
|
|
|
|
|
|
} |
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
sub Done { |
251
|
|
|
|
|
|
|
return unless AccessUser($LEVEL); |
252
|
|
|
|
|
|
|
return unless AuthorCheck($GETSQL,$INDEXKEY,$LEVEL); |
253
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
$cgiparams{sortname} ||= 'realname'; |
255
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
my $sort = "ORDER BY u.$cgiparams{sortname} "; |
257
|
|
|
|
|
|
|
$sort .= $cgiparams{sorttype} ? 'ASC' : 'DESC'; |
258
|
|
|
|
|
|
|
$tvars{sorttype} = $cgiparams{sorttype} ? 0 : 1; |
259
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
my @users = $dbi->GetQuery('hash','AdminSurveys',{'sort' => $sort}); |
261
|
|
|
|
|
|
|
$tvars{users} = \@users if(@users) |
262
|
|
|
|
|
|
|
} |
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
sub Undone { |
265
|
|
|
|
|
|
|
return unless AccessUser($LEVEL); |
266
|
|
|
|
|
|
|
return unless AuthorCheck($GETSQL,$INDEXKEY,$LEVEL); |
267
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
$cgiparams{sortname} ||= 'realname'; |
269
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
my $sort = "ORDER BY u.$cgiparams{sortname} "; |
271
|
|
|
|
|
|
|
$sort .= $cgiparams{sorttype} ? 'ASC' : 'DESC'; |
272
|
|
|
|
|
|
|
$tvars{sorttype} = $cgiparams{sorttype} ? 0 : 1; |
273
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
my @users = $dbi->GetQuery('hash','AdminSurveyNot',{'sort' => $sort}); |
275
|
|
|
|
|
|
|
$tvars{users} = \@users if(@users) |
276
|
|
|
|
|
|
|
} |
277
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
sub SendOne { |
279
|
|
|
|
|
|
|
return unless AccessUser($LEVEL); |
280
|
|
|
|
|
|
|
my @ids = CGIArray('LISTED'); |
281
|
|
|
|
|
|
|
next unless(@ids); |
282
|
|
|
|
|
|
|
my @users = $dbi->GetQuery('hash','ListSelectedUsers',{ids=>join(",",@ids)}); |
283
|
|
|
|
|
|
|
_send_announcement($cgiparams{$INDEXKEY},\@users); |
284
|
|
|
|
|
|
|
} |
285
|
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
sub SendAll { |
287
|
|
|
|
|
|
|
return unless AccessUser($LEVEL); |
288
|
|
|
|
|
|
|
my @users = $dbi->GetQuery('hash','ListConfirmedUsers'); |
289
|
|
|
|
|
|
|
_send_announcement($cgiparams{$INDEXKEY},\@users); |
290
|
|
|
|
|
|
|
} |
291
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
sub SendNew { |
293
|
|
|
|
|
|
|
return unless AccessUser($LEVEL); |
294
|
|
|
|
|
|
|
my @users = $dbi->GetQuery('hash','ListAnnounceUnsent',$cgiparams{$INDEXKEY}); |
295
|
|
|
|
|
|
|
_send_announcement($cgiparams{$INDEXKEY},\@users); |
296
|
|
|
|
|
|
|
} |
297
|
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
sub SendNot { |
299
|
|
|
|
|
|
|
return unless AccessUser($LEVEL); |
300
|
|
|
|
|
|
|
my @users = $dbi->GetQuery('hash','AdminSurveyNot'); |
301
|
|
|
|
|
|
|
_send_announcement($cgiparams{$INDEXKEY},\@users); |
302
|
|
|
|
|
|
|
} |
303
|
|
|
|
|
|
|
|
304
|
|
|
|
|
|
|
# ------------------------------------- |
305
|
|
|
|
|
|
|
# Private Subs |
306
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
sub _send_announcement { |
308
|
|
|
|
|
|
|
my $id = shift; |
309
|
|
|
|
|
|
|
my $users = shift; |
310
|
|
|
|
|
|
|
|
311
|
|
|
|
|
|
|
my %opts = ( |
312
|
|
|
|
|
|
|
template => 'mailer/announce.eml', |
313
|
|
|
|
|
|
|
nowrap => 1 |
314
|
|
|
|
|
|
|
); |
315
|
|
|
|
|
|
|
|
316
|
|
|
|
|
|
|
$tvars{gotusers} = scalar(@$users); |
317
|
|
|
|
|
|
|
|
318
|
|
|
|
|
|
|
# get announcement details |
319
|
|
|
|
|
|
|
return unless AuthorCheck($GETSQL,$INDEXKEY,$LEVEL); |
320
|
|
|
|
|
|
|
|
321
|
|
|
|
|
|
|
$tvars{mailsent} = 0; |
322
|
|
|
|
|
|
|
for(qw( yapc_name yapc_host yapc_city yapc_mail yapc_http yapc_surv |
323
|
|
|
|
|
|
|
talks_open survey_open survey_close)) { |
324
|
|
|
|
|
|
|
$settings{$_} =~ s/\s*$//; |
325
|
|
|
|
|
|
|
} |
326
|
|
|
|
|
|
|
|
327
|
|
|
|
|
|
|
for my $user (@$users) { |
328
|
|
|
|
|
|
|
$opts{from} = $tvars{data}{hFrom}; |
329
|
|
|
|
|
|
|
$opts{subj} = $tvars{data}{hSubject}; |
330
|
|
|
|
|
|
|
$opts{body} = $tvars{data}{body}; |
331
|
|
|
|
|
|
|
|
332
|
|
|
|
|
|
|
$user->{realname} = decode_entities($user->{realname} ); |
333
|
|
|
|
|
|
|
|
334
|
|
|
|
|
|
|
my $t = localtime; |
335
|
|
|
|
|
|
|
$opts{edate} = formatDate(16); |
336
|
|
|
|
|
|
|
$opts{email} = $user->{email} or next; |
337
|
|
|
|
|
|
|
$opts{recipient_email} = $user->{email} or next; |
338
|
|
|
|
|
|
|
$opts{ename} = $user->{realname} || ''; |
339
|
|
|
|
|
|
|
$opts{mname} = encode('MIME-Q', decode('MIME-Header', $opts{ename})); |
340
|
|
|
|
|
|
|
|
341
|
|
|
|
|
|
|
for my $key (qw(from subj body)) { |
342
|
|
|
|
|
|
|
$opts{$key} =~ s/ENAME/$user->{realname}/g; |
343
|
|
|
|
|
|
|
$opts{$key} =~ s/EMAIL/$user->{email}/g; |
344
|
|
|
|
|
|
|
$opts{$key} =~ s!ECODE!$user->{code}/$user->{userid}!g; |
345
|
|
|
|
|
|
|
|
346
|
|
|
|
|
|
|
$opts{$key} =~ s/YAPC_CONF/$settings{yapc_name}/g; |
347
|
|
|
|
|
|
|
$opts{$key} =~ s/YAPC_HOST/$settings{yapc_host}/g; |
348
|
|
|
|
|
|
|
$opts{$key} =~ s/YAPC_CITY/$settings{yapc_city}/g; |
349
|
|
|
|
|
|
|
$opts{$key} =~ s/YAPC_MAIL/$settings{yapc_mail}/g; |
350
|
|
|
|
|
|
|
$opts{$key} =~ s/YAPC_HTTP/$settings{yapc_http}/g; |
351
|
|
|
|
|
|
|
$opts{$key} =~ s/YAPC_SURV/$settings{yapc_surv}/g; |
352
|
|
|
|
|
|
|
$opts{$key} =~ s/TALK_OPEN/$settings{talks_open}/g; |
353
|
|
|
|
|
|
|
$opts{$key} =~ s/YAPC_OPEN/$settings{survey_open}/g; |
354
|
|
|
|
|
|
|
$opts{$key} =~ s/YAPC_CLOSE/$settings{survey_close}/g; |
355
|
|
|
|
|
|
|
|
356
|
|
|
|
|
|
|
$opts{$key} =~ s/\r/ /g; # a bodge |
357
|
|
|
|
|
|
|
} |
358
|
|
|
|
|
|
|
|
359
|
|
|
|
|
|
|
#use Data::Dumper; |
360
|
|
|
|
|
|
|
#LogDebug("opts=".Dumper(\%opts)); |
361
|
|
|
|
|
|
|
MailSend(%opts); |
362
|
|
|
|
|
|
|
$dbi->DoQuery('InsertAnnounceIndex',$cgiparams{$INDEXKEY},$user->{userid},time()); |
363
|
|
|
|
|
|
|
|
364
|
|
|
|
|
|
|
# if sent update index |
365
|
|
|
|
|
|
|
$tvars{mailsent}++ if(MailSent()); |
366
|
|
|
|
|
|
|
} |
367
|
|
|
|
|
|
|
|
368
|
|
|
|
|
|
|
$tvars{thanks} = $tvars{mailsent} ? 2 : 3; |
369
|
|
|
|
|
|
|
} |
370
|
|
|
|
|
|
|
|
371
|
|
|
|
|
|
|
1; |
372
|
|
|
|
|
|
|
|
373
|
|
|
|
|
|
|
__END__ |