Labyrinth/Plugin/CPAN/Tester.pm

filter: Statementstmt 14.6% 64 / 438 Branchbran 1.3% 3 / 218 Conditioncond 0.0% 0 / 113 MC/DCmcdc 0.0% 0 / 73 Subroutinesub 35.4% 17 / 48 Podpod 100% 30 / 30 totaltotal 12.3% 114 / 920 CC 164 SCAR 45.9
CC
164
Cov
9%
Assign
380.0
Merge
210.0
Reports
182.0
CRAP 98.7
↑ Summary Labyrinth/Plugin/CPAN/Author.pm »
1 package Labyrinth::Plugin::CPAN::Tester;
2  
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 $VERSION = '0.15';
8  
9 =head1 NAME
10  
11 Labyrinth::Plugin::CPAN::Tester - Tester Plugin for CPAN Testers Admin website.
12  
13 =cut
14  
15 #----------------------------------------------------------------------------
16 # Libraries
17  
18 2 ▶use base qw(Labyrinth::Plugin::Base);
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 2 ▶use Labyrinth::Audit;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 2 ▶use Labyrinth::DBUtils;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 2 ▶use Labyrinth::DTUtils;
Subroutine BEGIN: called CC=1 SCAR=0.0
23 2 ▶use Labyrinth::Mailer;
Subroutine BEGIN: called CC=1 SCAR=0.0
24 2 ▶use Labyrinth::MLUtils;
Subroutine BEGIN: called CC=1 SCAR=0.0
25 2 ▶use Labyrinth::Session;
Subroutine BEGIN: called CC=1 SCAR=0.0
26 2 ▶use Labyrinth::Support;
Subroutine BEGIN: called CC=1 SCAR=0.0
27 2 ▶use Labyrinth::Users;
Subroutine BEGIN: called CC=1 SCAR=0.0
28 2 ▶use Labyrinth::Variables;
Subroutine BEGIN: called CC=1 SCAR=0.0
29  
30 2 ▶use Labyrinth::Plugin::CPAN;
Subroutine BEGIN: called CC=1 SCAR=0.0
31  
32 2 ▶use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
33 2 ▶use Digest::SHA qw(sha1_hex);
Subroutine BEGIN: called CC=1 SCAR=0.0
34 2 ▶use Time::Local;
Subroutine BEGIN: called CC=1 SCAR=0.0
35  
36 #----------------------------------------------------------------------------
37 # Variables
38  
39 2 my %date_fields = (
40 y => { type => 1, html => 1 },
41 m => { type => 1, html => 1 },
42 d => { type => 1, html => 1 },
43 );
44  
45 2 my (@date_man,@date_all);
46 2 for(keys %date_fields) {
47 6 ▶ push @date_man, $_ if($date_fields{$_}->{type});
Branch: 1 branch
BranchTrueFalseTotal
if $date_fields{$_}{"type"} 6 0 6
48 6 push @date_all, $_;
49 }
50  
51 2 my %months = (
52 1 => 'January',
53 2 => 'February',
54 3 => 'March',
55 4 => 'April',
56 5 => 'May',
57 6 => 'June',
58 7 => 'July',
59 8 => 'August',
60 9 => 'September',
61 10 => 'October',
62 11 => 'November',
63 12 => 'December',
64 );
65  
66 # type: 0 = optional, 1 = mandatory
67 # html: 0 = none, 1 = text, 2 = textarea
68  
69 2 my %fields = (
70 nickname => { type => 0, html => 1 },
71 realname => { type => 1, html => 1 },
72 email => { type => 1, html => 1 },
73 );
74  
75 2 my (@mandatory,@allfields);
76 2 for(keys %fields) {
77 6 ▶ push @mandatory, $_ if($fields{$_}->{type});
Branch: 1 branch
BranchTrueFalseTotal
if $fields{$_}{"type"} 4 2 6
78 6 push @allfields, $_;
79 }
80  
81 #----------------------------------------------------------------------------
82 # Public Interface Functions
83  
84 =head1 METHODS
85  
86 =over 4
87  
88 =item Browse
89  
90 List dates for which tester
91  
92 =item Reports
93  
94 List reports for given day
95  
96 =item Find
97  
98 Find a report by ID.
99  
100 =item List
101  
102 List marked reports
103  
104 =item Mark
105  
106 Request report removal
107  
108 =item Unmark
109  
110 Remove request report removal
111  
112 =item Delete
113  
114 Remove marked reports from the cpanstats reports listings.
115  
116 Note that reports are not truly deleted, they are merely filtered out of any
117 cpanstats reports processing.
118  
119 =item Dist
120  
121 List reports that the tester has submitted reports for.
122  
123 =back
124  
125 =cut
126  
127 0 ▶sub Browse {
Subroutine Browse: not called CC=8 SCAR=42.8
Pod documented
128 0 ▶ return unless RealmCheck('tester','admin');
Branch: 1 branch
BranchTrueFalseTotal
unless RealmCheck("tester", "admin") 0 0 0
129  
130 0 my $userid = $tvars{'loginid'};
131 0 ▶ $userid = $tvars{user}{tester} if($tvars{realm} eq 'admin' && $tvars{user}{tester});
Branch: 1 branch
BranchTrueFalseTotal
if $Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" and $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"} 0 0 0
Condition0%0/3
$Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" and $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"}
!ll&&!rl&&r
000
MC/DC0%0/2
$Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" and $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"}
$Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"}
Truth table0%0/3
A and B
A= $Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin"B= $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"}
ABresult
0X0
100
111
132 #my @addrs = $dbi->GetQuery('hash','GetTesterAddressIndex',$userid);
133 #return unless(@addrs);
134  
135 #my $addrs = join('|', map {$_->{email}} @addrs);
136 #my $ids = join(',', map {$_->{id}} @addrs);
137  
138 0 my %dates;
139 0 my $cpan = Labyrinth::Plugin::CPAN->new();
140 0 my $dbx = $cpan->DBX('cpanstats');
141  
142 #my $dates = $dbx->Iterator('hash','XGetReportDates',{ids => $ids});
143 0 my $next = $dbx->Iterator('hash','GetReportDates',$userid);
144 0 ▶ while(my $row = $next->()) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $row = &$next()) 0 0 0
145 0 my ($y,$m,$d) = $row->{fulldate} =~ /(\d{4,4})(\d{2,2})(\d{2,2})/;
146 #$m = int($m);
147 0 $dates{$y}{year} = $y;
148 0 $dates{$y}{months}->{$m}{month} = $months{int($m)};
149 0 $dates{$y}{months}->{$m}{days}->{$d}{day} = int($d);
150 }
151  
152 0 LogDebug(Dumper(\%dates));
153  
154 0 my @y;
155 0 for my $y (sort {$b <=> $a } keys %dates) {
156 0 my @m;
157 0 for my $m ( sort {$b <=> $a } keys %{$dates{$y}{months}} ) {
158 0 my @d = sort {$a <=> $b } keys %{$dates{$y}{months}{$m}{days}};
159 0 push @m, {days => \@d, month => $months{int($m)}, mon => $m};
160 }
161 0 push @y, {months => \@m, year => $y};
162 }
163  
164 0 ▶ $tvars{data}{dates} = \@y if(@y);
Branch: 1 branch
BranchTrueFalseTotal
if @y 0 0 0
165 #$tvars{data}{dates} = \%dates if(keys %dates);
166 }
167  
168 0 ▶sub Reports {
Subroutine Reports: not called CC=13 SCAR=52.0
Pod documented
169 0 ▶ return unless RealmCheck('tester','admin');
Branch: 1 branch
BranchTrueFalseTotal
unless RealmCheck("tester", "admin") 0 0 0
170  
171 0 for(keys %date_fields) {
172 0 ▶ if($date_fields{$_}->{html} == 1) { $cgiparams{$_} = CleanHTML($cgiparams{$_}); }
Branch: 2 branches
BranchTrueFalseTotal
if ($date_fields{$_}{'html'} == 1) { } 0 0 0
elsif ($date_fields{$_}{'html'} == 2) { } 0 0 0
173 0 elsif($date_fields{$_}->{html} == 2) { $cgiparams{$_} = SafeHTML($cgiparams{$_}); }
174 }
175  
176 0 ▶ return if FieldCheck(\@date_all,\@date_man);
Branch: 1 branch
BranchTrueFalseTotal
if FieldCheck(\@date_all, \@date_man) 0 0 0
177  
178 0 my $userid = $tvars{'loginid'};
179 0 ▶ $userid = $tvars{user}{tester} if($tvars{realm} eq 'admin' && $tvars{user}{tester});
Branch: 1 branch
BranchTrueFalseTotal
if $Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" and $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"} 0 0 0
Condition0%0/3
$Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" and $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"}
!ll&&!rl&&r
000
MC/DC0%0/2
$Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" and $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"}
$Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"}
Truth table0%0/3
A and B
A= $Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin"B= $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"}
ABresult
0X0
100
111
180 # my @addrs = $dbi->GetQuery('hash','GetTesterAddress',$userid);
181 # return unless(@addrs);
182  
183 # my $addrs = join('|', map {$_->{email}} @addrs);
184  
185 0 my $cpan = Labyrinth::Plugin::CPAN->new();
186 0 my $dbx = $cpan->DBX('cpanstats');
187 0 my $date = sprintf "%04d%02d%02d\%", $tvars{data}{y},$tvars{data}{m},$tvars{data}{d};
188 # my @rows = $dbx->GetQuery('hash','GetReportList',{addrs => $addrs},$date);
189 0 my @rows = $dbx->GetQuery('hash','GetReportList',$userid,$date);
190 0 for my $row (@rows) {
191 0 my @report = $dbx->GetQuery('hash','GetReport',$row->{id});
192 0 $row->{$_} = $report[0]->{$_} for(keys %{$report[0]});
193 0 my @author = $dbx->GetQuery('hash','GetAuthor',$report[0]->{dist},$report[0]->{version});
194 0 $row->{$_} = $author[0]->{$_} for(keys %{$author[0]});
195  
196 0 ▶ next unless($row->{fulldate});
Branch: 1 branch
BranchTrueFalseTotal
unless $row->{"fulldate"} 0 0 0
197 0 $row->{fulldate} = _parse_date($row->{fulldate});
198 }
199 0 ▶ $tvars{data}{reports} = \@rows if(@rows);
Branch: 1 branch
BranchTrueFalseTotal
if @rows 0 0 0
200  
201 0 $date = timelocal(0,0,12,$tvars{data}{d},$tvars{data}{m}-1,$tvars{data}{y});
202 0 $tvars{data}{date} = formatDate(10,$date);
203 }
204  
205 0 ▶sub Find {
Subroutine Find: not called CC=3 SCAR=24.8
Pod documented
206 0 ▶ return unless RealmCheck('tester','admin');
Branch: 1 branch
BranchTrueFalseTotal
unless RealmCheck("tester", "admin") 0 0 0
207 0 $tvars{searched} = 1;
208  
209 0 my $cpan = Labyrinth::Plugin::CPAN->new();
210 0 my $dbx = $cpan->DBX('cpanstats');
211 0 my @rows = $dbx->GetQuery('hash','FindReport',$cgiparams{guid});
212 0 ▶ if(@rows) {
Branch: 1 branch
BranchTrueFalseTotal
if (@rows) 0 0 0
213 0 $tvars{data}{reports} = \@rows;
214 0 SetCommand('tester-report');
215 }
216 }
217  
218 0 ▶sub List {
Subroutine List: not called CC=9 SCAR=45.0
Pod documented
219 0 ▶ return unless RealmCheck('tester','admin');
Branch: 1 branch
BranchTrueFalseTotal
unless RealmCheck("tester", "admin") 0 0 0
220 0 my $cpan = Labyrinth::Plugin::CPAN->new();
221 0 my $dbx = $cpan->DBX('cpanstats');
222 0 my @rows;
223  
224 0 ▶ if($tvars{realm} eq 'admin' && !$tvars{user}{tester}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($Labyrinth::Plugin::CPAN::Tester::tvars{'realm'} eq 'admin' and not $Labyrinth::Plugin::CPAN::Tester::tvars{'user'}{'tester'}) { } 0 0 0
Condition0%0/3
$Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" and not $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"}
!ll&&!rl&&r
000
MC/DC0%0/2
$Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" and not $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"}
$Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" not $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"}
Truth table0%0/3
A and not(B)
A= $Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin"B= not $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"}
ABresult
0X0
100
111
225 0 @rows = $dbi->GetQuery('hash','ListAllMarkedReports');
226 } else {
227 0 my $userid = $tvars{'loginid'};
228 0 ▶ $userid = $tvars{user}{tester} if($tvars{realm} eq 'admin' && $tvars{user}{tester});
Branch: 1 branch
BranchTrueFalseTotal
if $Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" and $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"} 0 0 0
Condition0%0/3
$Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" and $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"}
!ll&&!rl&&r
000
MC/DC0%0/2
$Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" and $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"}
$Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"}
Truth table0%0/3
A and B
A= $Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin"B= $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"}
ABresult
0X0
100
111
229 0 @rows = $dbi->GetQuery('hash','ListMarkedReports',$userid);
230 }
231  
232 0 for my $row (@rows) {
233 0 ▶ next unless($row->{fulldate});
Branch: 1 branch
BranchTrueFalseTotal
unless $row->{"fulldate"} 0 0 0
234 0 $row->{fulldate} = _parse_date($row->{fulldate});
235 0 $row->{profile} = $cpan->GetTesterProfile($row->{guid},$row->{tester});
236 }
237  
238 0 ▶ $tvars{data}{reports} = \@rows if(@rows);
Branch: 1 branch
BranchTrueFalseTotal
if @rows 0 0 0
239 }
240  
241 0 ▶sub Mark {
Subroutine Mark: not called CC=3 SCAR=24.8
Pod documented
242 0 ▶ return unless RealmCheck('tester','admin');
Branch: 1 branch
BranchTrueFalseTotal
unless RealmCheck("tester", "admin") 0 0 0
243  
244 0 my @data;
245  
246 0 $tvars{body}{success} = 0;
247 0 $tvars{body}{result} = 'failed';
248  
249 0 my $cpan = Labyrinth::Plugin::CPAN->new();
250 0 my $dbx = $cpan->DBX('cpanstats');
251 0 my @rows = $dbx->GetQuery('hash','GetReports',{ids => join(',',CGIArray('DELETE'))});
252 0 for my $row (@rows) {
253 # now mark the report
254 0 $dbi->DoQuery('MarkReport',$row->{id},$row->{addressid},$row->{tester},$row->{author},time());
255 0 push @data, $row->{id};
256 }
257  
258 0 $tvars{body}{success} = 1;
259 0 $tvars{body}{result} = 'marked';
260 0 $tvars{body}{data} = join(',',@data);
261 0 $tvars{realm} = 'json';
262 }
263  
264 0 ▶sub Unmark {
Subroutine Unmark: not called CC=7 SCAR=40.3
Pod documented
265 0 ▶ return unless RealmCheck('tester','admin');
Branch: 1 branch
BranchTrueFalseTotal
unless RealmCheck("tester", "admin") 0 0 0
266  
267 0 $tvars{body}{success} = 0;
268 0 $tvars{body}{result} = 'failed';
269  
270 0 my @ids = CGIArray('DELETE');
271 0 my $userid = $tvars{'loginid'};
272 0 ▶ $userid = $tvars{user}{tester} if($tvars{realm} eq 'admin' && $tvars{user}{tester});
Branch: 1 branch
BranchTrueFalseTotal
if $Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" and $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"} 0 0 0
Condition0%0/3
$Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" and $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"}
!ll&&!rl&&r
000
MC/DC0%0/2
$Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" and $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"}
$Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"}
Truth table0%0/3
A and B
A= $Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin"B= $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"}
ABresult
0X0
100
111
273  
274 0 my $cpan = Labyrinth::Plugin::CPAN->new();
275 0 my $dbx = $cpan->DBX('cpanstats');
276 0 my @rows = $dbx->GetQuery('hash','GetReports',{ids => join(',',@ids)});
277  
278 0 my @data;
279 0 ▶ if($tvars{realm} eq 'admin' && !$tvars{user}{tester}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($Labyrinth::Plugin::CPAN::Tester::tvars{'realm'} eq 'admin' and not $Labyrinth::Plugin::CPAN::Tester::tvars{'user'}{'tester'}) { } 0 0 0
Condition0%0/3
$Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" and not $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"}
!ll&&!rl&&r
000
MC/DC0%0/2
$Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" and not $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"}
$Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" not $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"}
Truth table0%0/3
A and not(B)
A= $Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin"B= not $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"}
ABresult
0X0
100
111
280 0 @data = @ids;
281 } else {
282 0 ▶ @data = grep {$_} map { my (undef,undef,$uid) = $cpan->FindTester($_->{tester}); $uid = $userid ? $_->{id} : 0 } @rows;
Branch: 1 branch
BranchTrueFalseTotal
$userid ? : 0 0 0
283 }
284  
285 # unmark the reports
286 0 $dbi->DoQuery('UnmarkTesterReports',{ids => join(',',@data)});
287  
288 0 $tvars{body}{success} = 1;
289 0 $tvars{body}{result} = 'unmarked';
290 0 $tvars{body}{data} = join(',',@data);
291 0 $tvars{realm} = 'json';
292  
293 # LogDebug("body=".Dumper($tvars{body}));
294 }
295  
296 0 ▶sub Delete {
Subroutine Delete: not called CC=9 SCAR=45.0
Pod documented
297 0 ▶ return unless RealmCheck('tester','admin');
Branch: 1 branch
BranchTrueFalseTotal
unless RealmCheck("tester", "admin") 0 0 0
298  
299 0 my @ids = CGIArray('DELETE');
300 0 my $userid = $tvars{'loginid'};
301 0 ▶ $userid = $tvars{user}{tester} if($tvars{realm} eq 'admin' && $tvars{user}{tester});
Branch: 1 branch
BranchTrueFalseTotal
if $Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" and $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"} 0 0 0
Condition0%0/3
$Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" and $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"}
!ll&&!rl&&r
000
MC/DC0%0/2
$Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" and $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"}
$Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"}
Truth table0%0/3
A and B
A= $Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin"B= $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"}
ABresult
0X0
100
111
302  
303 0 my $cpan = Labyrinth::Plugin::CPAN->new();
304 0 my $dbx = $cpan->DBX('cpanstats');
305 0 my @rows = $dbx->GetQuery('hash','GetReports',{ids => join(',',@ids)});
306  
307 0 my @data;
308 0 ▶ if($tvars{realm} eq 'admin' && !$tvars{user}{tester}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($Labyrinth::Plugin::CPAN::Tester::tvars{'realm'} eq 'admin' and not $Labyrinth::Plugin::CPAN::Tester::tvars{'user'}{'tester'}) { } 0 0 0
Condition0%0/3
$Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" and not $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"}
!ll&&!rl&&r
000
MC/DC0%0/2
$Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" and not $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"}
$Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" not $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"}
Truth table0%0/3
A and not(B)
A= $Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin"B= not $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"}
ABresult
0X0
100
111
309 0 @data = @ids;
310 } else {
311 0 ▶ @data = grep {$_} map { my (undef,undef,$uid) = $cpan->FindTester($_->{tester}); $uid = $userid ? $_->{id} : 0 } @rows;
Branch: 1 branch
BranchTrueFalseTotal
$userid ? : 0 0 0
312 }
313  
314 0 for my $row (@rows) {
315 0 ▶ next if($row->{type} == 3);
Branch: 1 branch
BranchTrueFalseTotal
if $row->{"type"} == 3 0 0 0
316 0 $dbx->DoQuery('UpdateGrade',3,$row->{id});
317  
318 # for the reports builder
319 0 $dbx->DoQuery('PageRequest','rmdist',$row->{dist},$row->{id});
320 0 $dbx->DoQuery('PageRequest','rmauth',$row->{dist},$row->{id});
321  
322 # for the statistics scripts
323 0 $dbx->DoQuery('DeleteReportHistory',$row->{id},$row->{state},$row->{postdate},$row->{dist},$row->{version},$row->{type},3);
324 }
325  
326 # remove marked reports
327 0 $dbi->DoQuery('UnmarkTesterReports',{ids => join(',',@data)});
328  
329 0 $tvars{body}{success} = 1;
330 0 $tvars{body}{result} = 'deleted';
331 0 $tvars{body}{data} = join(',',@data);
332 0 $tvars{realm} = 'json';
333 }
334  
335 0 ▶sub Dist {
Subroutine Dist: not called CC=9 SCAR=45.0
Pod documented
336 0 ▶ return unless RealmCheck('tester','admin');
Branch: 1 branch
BranchTrueFalseTotal
unless RealmCheck("tester", "admin") 0 0 0
337  
338 0 SetTester();
339  
340 0 $cgiparams{dist} =~ s/::/-/g;
341  
342 0 my $cpan = Labyrinth::Plugin::CPAN->new();
343 0 my $dbx = $cpan->DBX('cpanstats');
344 0 my @rows = $dbx->GetQuery('hash','FindDistro',$cgiparams{dist});
345 0 ▶ unless(@rows) {
Branch: 1 branch
BranchTrueFalseTotal
unless (@rows) 0 0 0
346 0 SetCommand('tester-distro');
347 0 $tvars{errmess} = 'Sorry, no such distribution found. Please try again.';
348 0 return;
349 }
350  
351 0 my ($prev,$next,$order) = ('','','DESC');
352 0 @rows = $dbx->GetQuery('hash','ListReports2',{'prev'=>$prev,'next'=>$next,'order'=>$order},$cgiparams{userid},$cgiparams{dist});
353 0 ▶ if(@rows) {
Branch: 1 branch
BranchTrueFalseTotal
if (@rows) 0 0 0
354 0 for(@rows) {
355 0 my ($y,$m,$d) = $_->{fulldate} =~ /^(\d{4})(\d{2})(\d{2})/;
356 0 $_->{showdate} = sprintf "%04d-%02d-%02d", $y, $m, $d;
357 }
358 0 $tvars{data}{reports} = \@rows;
359  
360 0 my @prev = $dbx->GetQuery('hash','CountReports2',{'prev'=>"AND x.guid > '$rows[0]->{guid}'"},$cgiparams{userid},$cgiparams{dist});
361 0 my @next = $dbx->GetQuery('hash','CountReports2',{'next'=>"AND x.guid < '$rows[-1]->{guid}'"},$cgiparams{userid},$cgiparams{dist});
362  
363 0 ▶ $tvars{pager}{prev} = $rows[0]->{guid} if(@prev && $prev[0]->{count} > 0);
Branch: 1 branch
BranchTrueFalseTotal
if @prev and $prev[0]{"count"} > 0 0 0 0
Condition0%0/3
@prev and $prev[0]{"count"} > 0
!ll&&!rl&&r
000
MC/DC0%0/2
@prev and $prev[0]{"count"} > 0
@prev $prev[0]{"count"} > 0
Truth table0%0/3
A and B
A= @prevB= $prev[0]{"count"} > 0
ABresult
0X0
100
111
364 0 ▶ $tvars{pager}{next} = $rows[-1]->{guid} if(@next && $next[-1]->{count} > 0);
Branch: 1 branch
BranchTrueFalseTotal
if @next and $next[-1]{"count"} > 0 0 0 0
Condition0%0/3
@next and $next[-1]{"count"} > 0
!ll&&!rl&&r
000
MC/DC0%0/2
@next and $next[-1]{"count"} > 0
@next $next[-1]{"count"} > 0
Truth table0%0/3
A and B
A= @nextB= $next[-1]{"count"} > 0
ABresult
0X0
100
111
365 }
366 }
367  
368 =head2 Tester Email Interface Methods
369  
370 =over 4
371  
372 =item CheckLock
373  
374 Checks whether the specified user account is currently locked.
375  
376 =item Lock
377  
378 Tester has just registered on the site, lock the user profile until email is
379 confirmed.
380  
381 =item UnLock
382  
383 Tester has clicked registration confirmation link, and logged in successfully,
384 unlock the user profile.
385  
386 =item Submit
387  
388 Tester has submitted an email address used to submit a test report. Save as
389 unconfirmed and send email confirmation.
390  
391 =item Email
392  
393 Send email to tester to confirm email address.
394  
395 =item Remove
396  
397 Remove registered email from this user profile.
398  
399 =item Confirm
400  
401 Tester has clicked the confirmation link, provide login to finalise
402 confirmation.
403  
404 =item Confirmed
405  
406 Tester has confirmed login, mark email as confirmed, and map email to
407 addressid.
408  
409 =item Verify
410  
411 Allow admin to verify and confirm a tester's email address.
412  
413 =item Verified
414  
415 List verified email addresses for specified tester.
416  
417 =back
418  
419 =cut
420  
421 0 ▶sub CheckLock {
Subroutine CheckLock: not called CC=3 SCAR=24.8
Pod documented
422 0 my $userid = $tvars{'loginid'};
423 0 my @row = $dbi->GetQuery('hash','GetUserByID',$userid);
424 0 ▶ return if(@row && !$row[0]->{locked});
Branch: 1 branch
BranchTrueFalseTotal
if @row and not $row[0]{"locked"} 0 0 0
Condition0%0/3
@row and not $row[0]{"locked"}
!ll&&!rl&&r
000
MC/DC0%0/2
@row and not $row[0]{"locked"}
@row not $row[0]{"locked"}
Truth table0%0/3
A and not(B)
A= @rowB= not $row[0]{"locked"}
ABresult
0X0
100
111
425  
426 0 Labyrinth::Session::Logout();
427  
428 0 $tvars{redirect} = '';
429 0 SetCommand('tester-locked');
430 }
431  
432 0 ▶sub Lock {
Subroutine Lock: not called CC=4 SCAR=30.0
Pod documented
433 0 ▶ return unless RealmCheck('public','tester','admin');
Branch: 1 branch
BranchTrueFalseTotal
unless RealmCheck("public", "tester", "admin") 0 0 0
434 0 my $userid = $cgiparams{'userid'};
435 0 ▶ $userid = $tvars{user}{tester} if($tvars{realm} eq 'admin' && $tvars{user}{tester});
Branch: 1 branch
BranchTrueFalseTotal
if $Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" and $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"} 0 0 0
Condition0%0/3
$Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" and $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"}
!ll&&!rl&&r
000
MC/DC0%0/2
$Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" and $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"}
$Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"}
Truth table0%0/3
A and B
A= $Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin"B= $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"}
ABresult
0X0
100
111
436 0 $dbi->DoQuery('LockUser',$userid);
437 0 $dbi->DoQuery('SetRealm','tester',$userid);
438  
439 0 my $user = GetUser($userid);
440  
441 0 $tvars{data}{realname} = $user->{realname};
442 0 $tvars{data}{email} = $user->{email};
443 0 $tvars{data}{template} = 'mailer/user-confirm.eml';
444 }
445  
446 0 ▶sub UnLock {
Subroutine UnLock: not called CC=6 SCAR=37.4
Pod documented
447 0 ▶ return unless RealmCheck('tester','admin','public');
Branch: 1 branch
BranchTrueFalseTotal
unless RealmCheck("tester", "admin", "public") 0 0 0
448
449 0 my $email;
450 0 my ($code,$userid) = split('/',$cgiparams{code});
451  
452 0 ▶ if($tvars{realm} eq 'admin' && $tvars{user}{tester}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($Labyrinth::Plugin::CPAN::Tester::tvars{'realm'} eq 'admin' and $Labyrinth::Plugin::CPAN::Tester::tvars{'user'}{'tester'}) { } 0 0 0
Condition0%0/3
$Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" and $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"}
!ll&&!rl&&r
000
MC/DC0%0/2
$Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" and $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"}
$Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"}
Truth table0%0/3
A and B
A= $Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin"B= $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"}
ABresult
0X0
100
111
453 0 $userid = $tvars{user}{tester};
454 0 $email = $cgiparams{confirm};
455 } else {
456 0 my @confirm = $dbi->GetQuery('hash','CheckConfirmedCode',$code);
457 0 ▶ return unless(@confirm && $confirm[0]->{userid} == $userid);
Branch: 1 branch
BranchTrueFalseTotal
unless @confirm and $confirm[0]{"userid"} == $userid 0 0 0
Condition0%0/3
@confirm and $confirm[0]{"userid"} == $userid
!ll&&!rl&&r
000
MC/DC0%0/2
@confirm and $confirm[0]{"userid"} == $userid
@confirm $confirm[0]{"userid"} == $userid
Truth table0%0/3
A and B
A= @confirmB= $confirm[0]{"userid"} == $userid
ABresult
0X0
100
111
458 0 $email = $confirm[0]->{email};
459 }
460  
461 0 $dbi->DoQuery('UnLockUser',$userid);
462 0 $dbi->DoQuery('ConfirmedEmail',$userid,$email,$code);
463 }
464  
465 0 ▶sub Submit {
Subroutine Submit: not called CC=4 SCAR=30.0
Pod documented
466 0 ▶ return unless RealmCheck('tester','admin');
Branch: 1 branch
BranchTrueFalseTotal
unless RealmCheck("tester", "admin") 0 0 0
467 0 my $userid = $tvars{'loginid'};
468 0 ▶ $userid = $tvars{user}{tester} if($tvars{realm} eq 'admin' && $tvars{user}{tester});
Branch: 1 branch
BranchTrueFalseTotal
if $Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" and $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"} 0 0 0
Condition0%0/3
$Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" and $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"}
!ll&&!rl&&r
000
MC/DC0%0/2
$Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" and $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"}
$Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"}
Truth table0%0/3
A and B
A= $Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin"B= $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"}
ABresult
0X0
100
111
469  
470 0 $cgiparams{'userid'} = $userid;
471  
472 0 $tvars{data}{realname} = UserName($userid);
473 0 $tvars{data}{email} = $cgiparams{email};
474 0 $tvars{data}{template} = 'mailer/tester-confirm.eml';
475 0 $tvars{thanks} = 1;
476 }
477  
478 0 ▶sub Email {
Subroutine Email: not called CC=4 SCAR=30.0
Pod documented
479 0 ▶ return unless RealmCheck('public','tester','admin');
Branch: 1 branch
BranchTrueFalseTotal
unless RealmCheck("public", "tester", "admin") 0 0 0
480  
481 0 my $userid = $cgiparams{userid};
482 0 my $code;
483  
484 0 my @email = $dbi->GetQuery('hash','CheckConfirmedEmail',$userid,$tvars{data}{'email'});
485 0 ▶ if(@email) {
Branch: 1 branch
BranchTrueFalseTotal
if (@email) { } 0 0 0
486 0 $code = $email[0]->{confirm};
487 } else {
488 0 my $data = $tvars{data}{'email'} . $$ . time . 'ajfpfgjalkshj';
489 0 $code = sha1_hex($data);
490 0 $dbi->DoQuery('UnConfirmedEmail',$userid,$tvars{data}{'email'},$code);
491 }
492  
493 MailSend( template => $tvars{data}{'template'},
494 name => $tvars{data}{'realname'},
495 0 recipient_email => $tvars{data}{'email'},
496 code => "$code/$userid",
497 webpath => "$tvars{docroot}$tvars{webpath}",
498 nowrap => 1
499 );
500  
501 0 ▶ if(!MailSent()) {
Branch: 1 branch
BranchTrueFalseTotal
if (not MailSent()) 0 0 0
502 0 $tvars{errcode} = 'BADMAIL';
503 }
504 }
505  
506 0 ▶sub Remove {
Subroutine Remove: not called CC=11 SCAR=48.8
Pod documented
507 0 ▶ return unless RealmCheck('tester','admin');
Branch: 1 branch
BranchTrueFalseTotal
unless RealmCheck("tester", "admin") 0 0 0
508  
509 0 ▶ return SetCommand('tester-verify') if($cgiparams{confirm});
Branch: 1 branch
BranchTrueFalseTotal
if $Labyrinth::Plugin::CPAN::Tester::cgiparams{"confirm"} 0 0 0
510  
511 0 my $userid = $tvars{'loginid'};
512 0 ▶ $userid = $cgiparams{testerid} if($tvars{realm} eq 'admin' && $cgiparams{testerid});
Branch: 1 branch
BranchTrueFalseTotal
if $Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" and $Labyrinth::Plugin::CPAN::Tester::cgiparams{"testerid"} 0 0 0
Condition0%0/3
$Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" and $Labyrinth::Plugin::CPAN::Tester::cgiparams{"testerid"}
!ll&&!rl&&r
000
MC/DC0%0/2
$Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" and $Labyrinth::Plugin::CPAN::Tester::cgiparams{"testerid"}
$Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" $Labyrinth::Plugin::CPAN::Tester::cgiparams{"testerid"}
Truth table0%0/3
A and B
A= $Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin"B= $Labyrinth::Plugin::CPAN::Tester::cgiparams{"testerid"}
ABresult
0X0
100
111
513 0 ▶ $userid = $tvars{user}{tester} if($tvars{realm} eq 'admin' && $tvars{user}{tester});
Branch: 1 branch
BranchTrueFalseTotal
if $Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" and $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"} 0 0 0
Condition0%0/3
$Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" and $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"}
!ll&&!rl&&r
000
MC/DC0%0/2
$Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" and $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"}
$Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"}
Truth table0%0/3
A and B
A= $Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin"B= $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"}
ABresult
0X0
100
111
514  
515 0 ▶ if($cgiparams{confirm} && $tvars{realm} eq 'admin') {
Branch: 1 branch
BranchTrueFalseTotal
if ($Labyrinth::Plugin::CPAN::Tester::cgiparams{"confirm"} and $Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin") 0 0 0
Condition0%0/3
$Labyrinth::Plugin::CPAN::Tester::cgiparams{"confirm"} and $Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin"
!ll&&!rl&&r
000
MC/DC0%0/2
$Labyrinth::Plugin::CPAN::Tester::cgiparams{"confirm"} and $Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin"
$Labyrinth::Plugin::CPAN::Tester::cgiparams{"confirm"} $Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin"
Truth table0%0/3
A and B
A= $Labyrinth::Plugin::CPAN::Tester::cgiparams{"confirm"}B= $Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin"
ABresult
0X0
100
111
516 0 my $cpan = Labyrinth::Plugin::CPAN->new();
517 0 my $dbx = $cpan->DBX('cpanstats');
518 0 my @rows = $dbx->GetQuery('hash','FindAddresses',$cgiparams{confirm});
519 0 for(@rows) {
520 0 $dbi->DoQuery('MapAddresses',$userid,$_->{addressid});
521 }
522  
523 0 $dbi->DoQuery('ConfirmedEmail',$userid,$cgiparams{confirm});
524 0 return;
525 }
526  
527 0 my @mails = CGIArray('MAILS');
528 0 ▶ return unless @mails;
Branch: 1 branch
BranchTrueFalseTotal
unless @mails 0 0 0
529  
530 0 $dbi->DoQuery('RemoveEmail',{mails => "'" . join("','",@mails) . "'"},$userid);
531 }
532  
533 0 ▶sub Confirm {
Subroutine Confirm: not called CC=6 SCAR=37.4
Pod documented
534 0 my ($code,$userid) = split('/',$cgiparams{code});
535  
536 0 my @confirm = $dbi->GetQuery('hash','CheckConfirmedCode',$code);
537 0 ▶ return unless(@confirm && $confirm[0]->{userid} == $userid);
Branch: 1 branch
BranchTrueFalseTotal
unless @confirm and $confirm[0]{"userid"} == $userid 0 0 0
Condition0%0/3
@confirm and $confirm[0]{"userid"} == $userid
!ll&&!rl&&r
000
MC/DC0%0/2
@confirm and $confirm[0]{"userid"} == $userid
@confirm $confirm[0]{"userid"} == $userid
Truth table0%0/3
A and B
A= @confirmB= $confirm[0]{"userid"} == $userid
ABresult
0X0
100
111
538
539 0 ▶ return SetCommand('tester-unconfirmed') unless(@confirm && $confirm[0]->{userid} == $userid);
Branch: 1 branch
BranchTrueFalseTotal
unless @confirm and $confirm[0]{"userid"} == $userid 0 0 0
Condition0%0/3
@confirm and $confirm[0]{"userid"} == $userid
!ll&&!rl&&r
000
MC/DC0%0/2
@confirm and $confirm[0]{"userid"} == $userid
@confirm $confirm[0]{"userid"} == $userid
Truth table0%0/3
A and B
A= @confirmB= $confirm[0]{"userid"} == $userid
ABresult
0X0
100
111
540  
541 # confirm this email
542 0 $dbi->DoQuery('ConfirmedEmail',$userid,$confirm[0]->{email},$code);
543  
544 # map emails to addresses
545 0 my $cpan = Labyrinth::Plugin::CPAN->new();
546 0 my $dbx = $cpan->DBX('cpanstats');
547 0 my @rows = $dbx->GetQuery('hash','FindAddresses',$confirm[0]->{email});
548 0 for(@rows) {
549 0 $dbi->DoQuery('MapAddresses',$userid,$_->{addressid});
550 }
551 }
552  
553 0 ▶sub Confirmed {
Subroutine Confirmed: not called CC=2 SCAR=17.9
Pod documented
554 0 ▶ return unless RealmCheck('tester');
Branch: 1 branch
BranchTrueFalseTotal
unless RealmCheck("tester") 0 0 0
555 0 $dbi->DoQuery('ConfirmedEmail',$tvars{'loginid'},$cgiparams{email},$cgiparams{code});
556 }
557  
558 0 ▶sub Verify {
Subroutine Verify: not called CC=7 SCAR=40.3
Pod documented
559 0 ▶ return unless RealmCheck('admin');
Branch: 1 branch
BranchTrueFalseTotal
unless RealmCheck("admin") 0 0 0
560 0 my $userid = $tvars{'loginid'};
561 0 ▶ $userid = $cgiparams{testerid} if($tvars{realm} eq 'admin' && $cgiparams{testerid});
Branch: 1 branch
BranchTrueFalseTotal
if $Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" and $Labyrinth::Plugin::CPAN::Tester::cgiparams{"testerid"} 0 0 0
Condition0%0/3
$Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" and $Labyrinth::Plugin::CPAN::Tester::cgiparams{"testerid"}
!ll&&!rl&&r
000
MC/DC0%0/2
$Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" and $Labyrinth::Plugin::CPAN::Tester::cgiparams{"testerid"}
$Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" $Labyrinth::Plugin::CPAN::Tester::cgiparams{"testerid"}
Truth table0%0/3
A and B
A= $Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin"B= $Labyrinth::Plugin::CPAN::Tester::cgiparams{"testerid"}
ABresult
0X0
100
111
562 0 ▶ $userid = $tvars{user}{tester} if($tvars{realm} eq 'admin' && $tvars{user}{tester});
Branch: 1 branch
BranchTrueFalseTotal
if $Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" and $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"} 0 0 0
Condition0%0/3
$Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" and $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"}
!ll&&!rl&&r
000
MC/DC0%0/2
$Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" and $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"}
$Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"}
Truth table0%0/3
A and B
A= $Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin"B= $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"}
ABresult
0X0
100
111
563  
564 0 my @confirm = $dbi->GetQuery('hash','CheckConfirmedEmail',$userid,$cgiparams{confirm});
565 0 ▶ return unless(@confirm);
Branch: 1 branch
BranchTrueFalseTotal
unless @confirm 0 0 0
566  
567 0 $dbi->DoQuery('ConfirmedEmail',$userid,$cgiparams{confirm},$confirm[0]->{confirm});
568 }
569  
570 0 ▶sub Verified {
Subroutine Verified: not called CC=6 SCAR=37.4
Pod documented
571 0 ▶ return unless RealmCheck('tester','admin');
Branch: 1 branch
BranchTrueFalseTotal
unless RealmCheck("tester", "admin") 0 0 0
572 0 ▶ my $userid = $tvars{data}{'userid'} || $tvars{'loginid'};
Condition0%0/3
$Labyrinth::Plugin::CPAN::Tester::tvars{'data'}{'userid'} || $Labyrinth::Plugin::CPAN::Tester::tvars{'loginid'}
l!l&&r!l&&!r
000
MC/DC0%0/2
$Labyrinth::Plugin::CPAN::Tester::tvars{'data'}{'userid'} || $Labyrinth::Plugin::CPAN::Tester::tvars{'loginid'}
$Labyrinth::Plugin::CPAN::Tester::tvars{'data'}{'userid'} $Labyrinth::Plugin::CPAN::Tester::tvars{'loginid'}
Truth table0%0/3
A || B
A= $Labyrinth::Plugin::CPAN::Tester::tvars{'data'}{'userid'}B= $Labyrinth::Plugin::CPAN::Tester::tvars{'loginid'}
ABresult
1X1
011
000
573 0 ▶ $userid = $tvars{user}{tester} if($tvars{realm} eq 'admin' && $tvars{user}{tester});
Branch: 1 branch
BranchTrueFalseTotal
if $Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" and $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"} 0 0 0
Condition0%0/3
$Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" and $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"}
!ll&&!rl&&r
000
MC/DC0%0/2
$Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" and $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"}
$Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"}
Truth table0%0/3
A and B
A= $Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin"B= $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"}
ABresult
0X0
100
111
574 0 my @rows = $dbi->GetQuery('hash','GetTesterAddress',$userid);
575 0 ▶ $tvars{data}{confirmed} = \@rows if(@rows);
Branch: 1 branch
BranchTrueFalseTotal
if @rows 0 0 0
576 }
577  
578 =head2 Admin Interface Methods
579  
580 =over 4
581  
582 =item Admin
583  
584 Prepare Admin login as tester.
585  
586 =item Imposter
587  
588 Allow Admin to login as named tester.
589  
590 =item Clear
591  
592 Clear Imposter status and return to Admin.
593  
594 =item Merge
595  
596 Merge Testers Profiles in testers database.
597  
598 =item Assign
599  
600 Assign tester addresses to a given profile in the testers database.
601  
602 =item Edit
603  
604 Edit Tester Profile in testers database.
605  
606 =back
607  
608 =cut
609  
610 0 ▶sub Admin {
Subroutine Admin: not called CC=2 SCAR=17.9
Pod documented
611 0 ▶ return unless RealmCheck('admin');
Branch: 1 branch
BranchTrueFalseTotal
unless RealmCheck("admin") 0 0 0
612 0 $tvars{where} = "AND u.realm='tester' AND u.userid > 3";
613 }
614  
615 0 ▶sub Imposter {
Subroutine Imposter: not called CC=2 SCAR=17.9
Pod documented
616 0 ▶ return unless RealmCheck('admin');
Branch: 1 branch
BranchTrueFalseTotal
unless RealmCheck("admin") 0 0 0
617 0 UpdateSession('name' => 'imposter:' . $cgiparams{userid});
618 0 $tvars{user}{tester} = $cgiparams{userid};
619 }
620  
621 0 ▶sub Clear {
Subroutine Clear: not called CC=2 SCAR=17.9
Pod documented
622 0 ▶ return unless RealmCheck('admin');
Branch: 1 branch
BranchTrueFalseTotal
unless RealmCheck("admin") 0 0 0
623 0 UpdateSession('name' => 'Admin');
624 0 $tvars{user}{name} = 'Admin';
625 0 delete $tvars{user}{tester};
626 0 delete $tvars{user}{fakename};
627 }
628  
629 0 ▶sub Merge {
Subroutine Merge: not called CC=14 SCAR=53.5
Pod documented
630 0 ▶ return unless RealmCheck('admin');
Branch: 1 branch
BranchTrueFalseTotal
unless RealmCheck("admin") 0 0 0
631  
632 0 my $cpan = Labyrinth::Plugin::CPAN->new();
633 0 my $dbx = $cpan->DBX('cpanstats');
634  
635 0 ▶ $cgiparams{$_} ||= '' for(qw(remp rems merge));
Condition0%0/2
$Labyrinth::Plugin::CPAN::Tester::cgiparams{$_} ||= ""
l!l
00
MC/DC0%0/1
$Labyrinth::Plugin::CPAN::Tester::cgiparams{$_} ||= ""
$Labyrinth::Plugin::CPAN::Tester::cgiparams{$_}
Truth table0%0/2
A
A= $Labyrinth::Plugin::CPAN::Tester::cgiparams{$_}
Aresult
11
00
636  
637 # list primaries
638 0 my (@ids,$ids);
639 0 ▶ if($cgiparams{primary}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($Labyrinth::Plugin::CPAN::Tester::cgiparams{'primary'}) { } 0 0 0
640 0 @ids = ($cgiparams{primary});
641 } else {
642 0 @ids = grep {$_ ne "$cgiparams{remp}"} CGIArray('PRIMARY');
643 }
644 0 ▶ if(@ids) {
Branch: 1 branch
BranchTrueFalseTotal
if (@ids) 0 0 0
645 0 my $ids = join(",",@ids);
646 0 my @rows = $dbx->GetQuery('hash','ListTestersbyID',{ids=>$ids});
647 0 ▶ $tvars{primary} = \@rows if(@rows);
Branch: 1 branch
BranchTrueFalseTotal
if @rows 0 0 0
648 }
649 0 my %ids = map {$_ => 1} @ids, $cgiparams{rems};
650  
651 # list secondaries
652 0 @ids = grep {!$ids{$_}} CGIArray('SECONDARY');
653 0 ▶ if($cgiparams{secondary} && !$ids{$cgiparams{secondary}}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($Labyrinth::Plugin::CPAN::Tester::cgiparams{"secondary"} and not $ids{$Labyrinth::Plugin::CPAN::Tester::cgiparams{"secondary"}}) 0 0 0
Condition0%0/3
$Labyrinth::Plugin::CPAN::Tester::cgiparams{"secondary"} and not $ids{$Labyrinth::Plugin::CPAN::Tester::cgiparams{"secondary"}}
!ll&&!rl&&r
000
MC/DC0%0/2
$Labyrinth::Plugin::CPAN::Tester::cgiparams{"secondary"} and not $ids{$Labyrinth::Plugin::CPAN::Tester::cgiparams{"secondary"}}
$Labyrinth::Plugin::CPAN::Tester::cgiparams{"secondary"} not $ids{$Labyrinth::Plugin::CPAN::Tester::cgiparams{"secondary"}}
Truth table0%0/3
A and not(B)
A= $Labyrinth::Plugin::CPAN::Tester::cgiparams{"secondary"}B= not $ids{$Labyrinth::Plugin::CPAN::Tester::cgiparams{"secondary"}}
ABresult
0X0
100
111
654 0 push @ids, $cgiparams{secondary};
655 }
656 0 ▶ if(@ids) {
Branch: 1 branch
BranchTrueFalseTotal
if (@ids) 0 0 0
657 0 my $ids = join(",",@ids);
658 0 my @rows = $dbx->GetQuery('hash','ListTestersbyID',{ids=>$ids});
659 0 ▶ $tvars{secondary} = \@rows if(@rows);
Branch: 1 branch
BranchTrueFalseTotal
if @rows 0 0 0
660 }
661  
662 0 ▶ if($cgiparams{merge} eq 'merge') {
Branch: 1 branch
BranchTrueFalseTotal
if ($Labyrinth::Plugin::CPAN::Tester::cgiparams{"merge"} eq "merge") 0 0 0
663 0 my $ids = join(",",map {$_->{testerid}} @{$tvars{secondary}});
664 0 $dbx->DoQuery('MergeTesters',{ids=>$ids},$tvars{primary}[0]->{testerid});
665 0 $dbx->DoQuery('DeleteProfile',{ids=>$ids});
666 0 delete $tvars{secondary};
667 }
668  
669 # search for name, pause or email
670 0 ▶ if($cgiparams{name}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($Labyrinth::Plugin::CPAN::Tester::cgiparams{"name"}) 0 0 0
671 0 my @testers = $dbx->GetQuery('hash','FindTesters',"\%$cgiparams{name}\%","\%$cgiparams{name}\%","\%$cgiparams{name}\%");
672 0 ▶ $tvars{results} = \@testers if(@testers);
Branch: 1 branch
BranchTrueFalseTotal
if @testers 0 0 0
673 0 $tvars{search} = $cgiparams{name};
674 }
675 }
676  
677 0 ▶sub Assign {
Subroutine Assign: not called CC=19 SCAR=59.4
Pod documented
678 0 ▶ return unless RealmCheck('admin');
Branch: 1 branch
BranchTrueFalseTotal
unless RealmCheck("admin") 0 0 0
679  
680 0 my $cpan = Labyrinth::Plugin::CPAN->new();
681 0 my $dbx = $cpan->DBX('cpanstats');
682  
683 0 ▶ $cgiparams{$_} ||= '' for(qw(remp rems assign));
Condition0%0/2
$Labyrinth::Plugin::CPAN::Tester::cgiparams{$_} ||= ""
l!l
00
MC/DC0%0/1
$Labyrinth::Plugin::CPAN::Tester::cgiparams{$_} ||= ""
$Labyrinth::Plugin::CPAN::Tester::cgiparams{$_}
Truth table0%0/2
A
A= $Labyrinth::Plugin::CPAN::Tester::cgiparams{$_}
Aresult
11
00
684  
685 # list primaries
686 0 my (@ids,$ids,%primary,%secondary);
687 0 ▶ if($cgiparams{primary}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($Labyrinth::Plugin::CPAN::Tester::cgiparams{'primary'}) { } 0 0 0
688 0 @ids = ($cgiparams{primary});
689 } else {
690 0 @ids = grep {$_ ne "$cgiparams{remp}"} CGIArray('PRIMARY');
691 }
692 0 ▶ if(@ids) {
Branch: 1 branch
BranchTrueFalseTotal
if (@ids) 0 0 0
693 0 $primary{$_} = 1 for(@ids);
694 0 my $ids = join(",",@ids);
695 0 my @rows = $dbx->GetQuery('hash','ListTestersbyID',{ids=>$ids});
696 0 ▶ $tvars{primary} = \@rows if(@rows);
Branch: 1 branch
BranchTrueFalseTotal
if @rows 0 0 0
697 }
698 0 my %ids = map {$_ => 1} @ids, $cgiparams{rems};
699  
700 # list secondaries
701 0 @ids = grep {!$ids{$_}} CGIArray('SECONDARY');
702 0 ▶ if($cgiparams{secondary} && !$ids{$cgiparams{secondary}}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($Labyrinth::Plugin::CPAN::Tester::cgiparams{"secondary"} and not $ids{$Labyrinth::Plugin::CPAN::Tester::cgiparams{"secondary"}}) 0 0 0
Condition0%0/3
$Labyrinth::Plugin::CPAN::Tester::cgiparams{"secondary"} and not $ids{$Labyrinth::Plugin::CPAN::Tester::cgiparams{"secondary"}}
!ll&&!rl&&r
000
MC/DC0%0/2
$Labyrinth::Plugin::CPAN::Tester::cgiparams{"secondary"} and not $ids{$Labyrinth::Plugin::CPAN::Tester::cgiparams{"secondary"}}
$Labyrinth::Plugin::CPAN::Tester::cgiparams{"secondary"} not $ids{$Labyrinth::Plugin::CPAN::Tester::cgiparams{"secondary"}}
Truth table0%0/3
A and not(B)
A= $Labyrinth::Plugin::CPAN::Tester::cgiparams{"secondary"}B= not $ids{$Labyrinth::Plugin::CPAN::Tester::cgiparams{"secondary"}}
ABresult
0X0
100
111
703 0 push @ids, $cgiparams{secondary};
704 }
705 0 ▶ if(@ids) {
Branch: 1 branch
BranchTrueFalseTotal
if (@ids) 0 0 0
706 0 $secondary{$_} = 1 for(@ids);
707 0 my $ids = join(",",@ids);
708 0 my @rows = $dbx->GetQuery('hash','ListAddressbyID',{ids=>$ids});
709 0 ▶ $tvars{secondary} = \@rows if(@rows);
Branch: 1 branch
BranchTrueFalseTotal
if @rows 0 0 0
710 }
711  
712 0 ▶ if($cgiparams{assign} eq 'assign') {
Branch: 1 branch
BranchTrueFalseTotal
if ($Labyrinth::Plugin::CPAN::Tester::cgiparams{"assign"} eq "assign") 0 0 0
713 0 my $ids = join(",",map {$_->{addressid}} @{$tvars{secondary}});
714 0 $dbx->DoQuery('AssignTesters',{ids=>$ids},$tvars{primary}[0]->{testerid});
715 # delete $tvars{secondary};
716  
717 # reset secondary addresses
718 0 my @rows = $dbx->GetQuery('hash','ListAddressbyID',{ids=>$ids});
719 0 ▶ $tvars{secondary} = \@rows if(@rows);
Branch: 1 branch
BranchTrueFalseTotal
if @rows 0 0 0
720 }
721  
722 # search for name, pause or email
723 0 ▶ if($cgiparams{name}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($Labyrinth::Plugin::CPAN::Tester::cgiparams{"name"}) 0 0 0
724 0 my @rows = $dbx->GetQuery('hash','FindTesters',"\%$cgiparams{name}\%","\%$cgiparams{name}\%","\%$cgiparams{name}\%");
725 0 my @profiles = grep { ! $primary{$_->{testerid}} } @rows;
726 0 ▶ $tvars{profiles} = \@profiles if(@profiles);
Branch: 1 branch
BranchTrueFalseTotal
if @profiles 0 0 0
727  
728 0 ▶ if($cgiparams{name} eq 'unassigned') {
Branch: 1 branch
BranchTrueFalseTotal
if ($Labyrinth::Plugin::CPAN::Tester::cgiparams{'name'} eq 'unassigned') { } 0 0 0
729 0 @rows = $dbx->GetQuery('hash','FindAddressUnassigned');
730 } else {
731 0 @rows = $dbx->GetQuery('hash','FindAddress',"\%$cgiparams{name}\%");
732 }
733  
734 0 my @addresses = grep { ! $secondary{$_->{addressid}} } @rows;
735 0 ▶ $tvars{addresses} = \@addresses if(@addresses);
Branch: 1 branch
BranchTrueFalseTotal
if @addresses 0 0 0
736 0 $tvars{search} = $cgiparams{name};
737 }
738 }
739  
740 0 ▶sub Edit {
Subroutine Edit: not called CC=2 SCAR=17.9
Pod documented
741 0 $tvars{body}{success} = 0;
742 0 $tvars{body}{result} = 'failed';
743  
744 #LogDebug("1.".$cgiparams{name});
745 #LogDebug("2.".join(' ', map {ord($_)} split(//,$cgiparams{name})));
746  
747 0 my $cpan = Labyrinth::Plugin::CPAN->new();
748 0 my $dbx = $cpan->DBX('cpanstats');
749  
750 0 ▶ if($cgiparams{testerid}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($Labyrinth::Plugin::CPAN::Tester::cgiparams{'testerid'}) { } 0 0 0
751 0 $dbx->DoQuery('UpdateProfile',$cgiparams{name},$cgiparams{pause},$cgiparams{testerid});
752 } else {
753 0 $dbx->DoQuery('CreateProfile',$cgiparams{name},$cgiparams{pause});
754 }
755  
756 0 $tvars{body}{success} = 1;
757 0 $tvars{body}{result} = 'saved';
758 0 $tvars{realm} = 'json';
759 }
760  
761 0 ▶sub _parse_date {
Subroutine _parse_date: not called CC=6 SCAR=37.4
762 0 my $date = shift;
763 0 my ($Y,$M,$D,$h,$m) = ($date =~ /(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})/);
764 0 ▶ return $date unless($Y && $M && $D);
Branch: 1 branch
BranchTrueFalseTotal
unless $Y and $M and $D 0 0 0
Condition0%0/6
$Y and $M and $D
!ll&&!rl&&r
000
$Y and $M
!ll&&!rl&&r
000
MC/DC0%0/3
$Y and $M and $D
$Y $M $D
Truth table0%0/4
A and B and C
A= $YB= $MC= $D
ABCresult
0XX0
10X0
1100
1111
765  
766 0 ▶ $h ||= 0;
Condition0%0/2
$h ||= 0
l!l
00
MC/DC0%0/1
$h ||= 0
$h
Truth table0%0/2
A
A= $h
Aresult
11
00
767 0 ▶ $m ||= 0;
Condition0%0/2
$m ||= 0
l!l
00
MC/DC0%0/1
$m ||= 0
$m
Truth table0%0/2
A
A= $m
Aresult
11
00
768  
769 0 return sprintf "%02d/%02d/%04d %02d:%02d", $D,$M,$Y, $h,$m;
770 }
771  
772 =head2 Admin Interface Methods : Local Profiles
773  
774 =over 4
775  
776 =item SetTester
777  
778 Set the tester profile to be edited.
779  
780 =item RegisteredEmails
781  
782 Manage tester's registered emails.
783  
784 =item EditProfile
785  
786 Edit tester profile
787  
788 =item SaveProfile
789  
790 Save tester profile
791  
792 =item GetContact
793  
794 Retrieve the current contact address for the current user.
795  
796 =item SetContact
797  
798 Save contact address for te current user.
799  
800 =back
801  
802 =cut
803  
804 0 ▶sub SetTester {
Subroutine SetTester: not called CC=5 SCAR=34.0
Pod documented
805 0 my $userid = $tvars{'loginid'};
806 0 ▶ $userid = $cgiparams{testerid} if($tvars{realm} eq 'admin' && $cgiparams{testerid});
Branch: 1 branch
BranchTrueFalseTotal
if $Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" and $Labyrinth::Plugin::CPAN::Tester::cgiparams{"testerid"} 0 0 0
Condition0%0/3
$Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" and $Labyrinth::Plugin::CPAN::Tester::cgiparams{"testerid"}
!ll&&!rl&&r
000
MC/DC0%0/2
$Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" and $Labyrinth::Plugin::CPAN::Tester::cgiparams{"testerid"}
$Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" $Labyrinth::Plugin::CPAN::Tester::cgiparams{"testerid"}
Truth table0%0/3
A and B
A= $Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin"B= $Labyrinth::Plugin::CPAN::Tester::cgiparams{"testerid"}
ABresult
0X0
100
111
807 0 ▶ $userid = $tvars{user}{tester} if($tvars{realm} eq 'admin' && $tvars{user}{tester});
Branch: 1 branch
BranchTrueFalseTotal
if $Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" and $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"} 0 0 0
Condition0%0/3
$Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" and $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"}
!ll&&!rl&&r
000
MC/DC0%0/2
$Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" and $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"}
$Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"}
Truth table0%0/3
A and B
A= $Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin"B= $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"}
ABresult
0X0
100
111
808 0 $cgiparams{userid} = $userid;
809 }
810  
811 0 ▶sub RegisteredEmails {
Subroutine RegisteredEmails: not called CC=7 SCAR=40.3
Pod documented
812 0 ▶ return unless RealmCheck('tester','admin');
Branch: 1 branch
BranchTrueFalseTotal
unless RealmCheck("tester", "admin") 0 0 0
813  
814 0 my $userid = $tvars{'loginid'};
815 0 ▶ $userid = $cgiparams{testerid} if($tvars{realm} eq 'admin' && $cgiparams{testerid});
Branch: 1 branch
BranchTrueFalseTotal
if $Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" and $Labyrinth::Plugin::CPAN::Tester::cgiparams{"testerid"} 0 0 0
Condition0%0/3
$Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" and $Labyrinth::Plugin::CPAN::Tester::cgiparams{"testerid"}
!ll&&!rl&&r
000
MC/DC0%0/2
$Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" and $Labyrinth::Plugin::CPAN::Tester::cgiparams{"testerid"}
$Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" $Labyrinth::Plugin::CPAN::Tester::cgiparams{"testerid"}
Truth table0%0/3
A and B
A= $Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin"B= $Labyrinth::Plugin::CPAN::Tester::cgiparams{"testerid"}
ABresult
0X0
100
111
816 0 ▶ $userid = $tvars{user}{tester} if($tvars{realm} eq 'admin' && $tvars{user}{tester});
Branch: 1 branch
BranchTrueFalseTotal
if $Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" and $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"} 0 0 0
Condition0%0/3
$Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" and $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"}
!ll&&!rl&&r
000
MC/DC0%0/2
$Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" and $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"}
$Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin" $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"}
Truth table0%0/3
A and B
A= $Labyrinth::Plugin::CPAN::Tester::tvars{"realm"} eq "admin"B= $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"}
ABresult
0X0
100
111
817  
818 0 my @rows = $dbi->GetQuery('hash','RegisteredEmails',$userid);
819 0 ▶ $tvars{data}{confirmed} = \@rows if(@rows);
Branch: 1 branch
BranchTrueFalseTotal
if @rows 0 0 0
820 }
821  
822 0 ▶sub EditProfile {
Subroutine EditProfile: not called CC=4 SCAR=30.0
Pod documented
823 0 ▶ return unless RealmCheck('admin');
Branch: 1 branch
BranchTrueFalseTotal
unless RealmCheck("admin") 0 0 0
824  
825 0 ▶ $cgiparams{userid} = $tvars{user}{tester} or return;
Branch: 1 branch
BranchTrueFalseTotal
$Labyrinth::Plugin::CPAN::Tester::cgiparams{"userid"} = $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"} or return 0 0 0
826  
827 # return unless MasterCheck();
828 0 ▶ return unless AuthorCheck('GetUserByID','userid',ADMIN);
Branch: 1 branch
BranchTrueFalseTotal
unless AuthorCheck("GetUserByID", "userid", 4) 0 0 0
829  
830 0 $tvars{data}{admin} = Authorised(ADMIN);
831 }
832  
833 0 ▶sub GetContact {
Subroutine GetContact: not called CC=3 SCAR=24.8
Pod documented
834 0 my ($row) = $dbi->GetQuery('hash','GetContact',$cgiparams{'userid'});
835 0 ▶ if($row && $row->{testerid}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($row and $row->{"testerid"}) 0 0 0
Condition0%0/3
$row and $row->{"testerid"}
!ll&&!rl&&r
000
MC/DC0%0/2
$row and $row->{"testerid"}
$row $row->{"testerid"}
Truth table0%0/3
A and B
A= $rowB= $row->{"testerid"}
ABresult
0X0
100
111
836 0 $tvars{data}{contact} = $row->{contact};
837 0 $tvars{data}{testerid} = $row->{testerid};
838 }
839 }
840  
841 0 ▶sub SaveProfile {
Subroutine SaveProfile: not called CC=9 SCAR=45.0
Pod documented
842 0 ▶ return unless RealmCheck('admin');
Branch: 1 branch
BranchTrueFalseTotal
unless RealmCheck("admin") 0 0 0
843  
844 0 ▶ $cgiparams{userid} = $tvars{user}{tester} or return;
Branch: 1 branch
BranchTrueFalseTotal
$Labyrinth::Plugin::CPAN::Tester::cgiparams{"userid"} = $Labyrinth::Plugin::CPAN::Tester::tvars{"user"}{"tester"} or return 0 0 0
845 0 ▶ return unless AuthorCheck('GetUserByID','userid',ADMIN);
Branch: 1 branch
BranchTrueFalseTotal
unless AuthorCheck("GetUserByID", "userid", 4) 0 0 0
846  
847 0 for(keys %fields) {
848 0 ▶ if($fields{$_}->{html} == 1) { $cgiparams{$_} = CleanHTML($cgiparams{$_}) }
Branch: 3 branches
BranchTrueFalseTotal
if ($fields{$_}{'html'} == 1) { } 0 0 0
elsif ($fields{$_}{'html'} == 2) { } 0 0 0
elsif ($fields{$_}{'html'} == 3) { } 0 0 0
849 0 elsif($fields{$_}->{html} == 2) { $cgiparams{$_} = CleanTags($cgiparams{$_}) }
850 0 elsif($fields{$_}->{html} == 3) { $cgiparams{$_} = CleanLink($cgiparams{$_}) }
851 }
852  
853 0 ▶ return if FieldCheck(\@allfields,\@mandatory);
Branch: 1 branch
BranchTrueFalseTotal
if FieldCheck(\@allfields, \@mandatory) 0 0 0
854  
855 my @fields = ( $tvars{data}{'nickname'}, $tvars{data}{'realname'},
856 0 $tvars{data}{'email'}, 0
857 );
858  
859 0 $dbi->DoQuery('SaveUser',@fields,$cgiparams{'userid'});
860 }
861  
862 0 ▶sub SetContact {
Subroutine SetContact: not called CC=5 SCAR=34.0
Pod documented
863 $dbi->DoQuery('SetContact',$cgiparams{'contact'},$cgiparams{'testerid'})
864 0 ▶ if($cgiparams{'contact'} && $cgiparams{'testerid'});
Branch: 1 branch
BranchTrueFalseTotal
if $Labyrinth::Plugin::CPAN::Tester::cgiparams{"contact"} and $Labyrinth::Plugin::CPAN::Tester::cgiparams{"testerid"} 0 0 0
Condition0%0/3
$Labyrinth::Plugin::CPAN::Tester::cgiparams{"contact"} and $Labyrinth::Plugin::CPAN::Tester::cgiparams{"testerid"}
!ll&&!rl&&r
000
MC/DC0%0/2
$Labyrinth::Plugin::CPAN::Tester::cgiparams{"contact"} and $Labyrinth::Plugin::CPAN::Tester::cgiparams{"testerid"}
$Labyrinth::Plugin::CPAN::Tester::cgiparams{"contact"} $Labyrinth::Plugin::CPAN::Tester::cgiparams{"testerid"}
Truth table0%0/3
A and B
A= $Labyrinth::Plugin::CPAN::Tester::cgiparams{"contact"}B= $Labyrinth::Plugin::CPAN::Tester::cgiparams{"testerid"}
ABresult
0X0
100
111
865 $dbi->DoQuery('UpdateProfile',$cgiparams{'realname'},$cgiparams{'nickname'},$cgiparams{'testerid'})
866 0 ▶ if($cgiparams{'realname'} && $cgiparams{'testerid'});
Branch: 1 branch
BranchTrueFalseTotal
if $Labyrinth::Plugin::CPAN::Tester::cgiparams{"realname"} and $Labyrinth::Plugin::CPAN::Tester::cgiparams{"testerid"} 0 0 0
Condition0%0/3
$Labyrinth::Plugin::CPAN::Tester::cgiparams{"realname"} and $Labyrinth::Plugin::CPAN::Tester::cgiparams{"testerid"}
!ll&&!rl&&r
000
MC/DC0%0/2
$Labyrinth::Plugin::CPAN::Tester::cgiparams{"realname"} and $Labyrinth::Plugin::CPAN::Tester::cgiparams{"testerid"}
$Labyrinth::Plugin::CPAN::Tester::cgiparams{"realname"} $Labyrinth::Plugin::CPAN::Tester::cgiparams{"testerid"}
Truth table0%0/3
A and B
A= $Labyrinth::Plugin::CPAN::Tester::cgiparams{"realname"}B= $Labyrinth::Plugin::CPAN::Tester::cgiparams{"testerid"}
ABresult
0X0
100
111
867 }
868  
869 2 1;
870  
871 __END__
↑ Summary Labyrinth/Plugin/CPAN/Author.pm »