blib/lib/AUBBC.pm

filter: Statementstmt 36.0% 116 / 322 Branchbran 17.6% 44 / 250 Conditioncond 10.4% 12 / 115 MC/DCmcdc 0.0% 0 / 71 Subroutinesub 39.4% 15 / 38 Podpod 17.8% 5 / 28 totaltotal 23.3% 192 / 824 CC 173 SCAR 47.8
CC
173
Cov
25%
protect_email
380.0
add_build_tag
380.0
do_all_ubbc
188.6
CRAP 119.1
↑ Summary
1 package AUBBC;
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4
5 1 our $VERSION = '4.06';
6 1 our $BAD_MESSAGE = 'Unathorized';
7 1 our $DEBUG_AUBBC = 0;
8 1 our $MEMOIZE = 1;
9 1 my $msg = '';
10 1 my $aubbc_error = '';
11 1 my $long_regex = '[\w\.\/\-\~\@\:\;\=]+(?:\?[\w\~\.\;\:\,\$\-\+\!\*\?\/\=\&\@\#\%]+?)?';
12 1 my @do_f = (1,1,1,1,1,0,0,0,time.$$.'000','',1);
13 1 my @key64 = ('A'..'Z','a'..'z',0..9,'+','/');
14 1 my %SMILEYS = ();
15 1 my %Build_AUBBC = ();
16 1 my %AUBBC = (
17 aubbc => 1,
18 utf => 1,
19 smileys => 1,
20 highlight => 1,
21 highlight_function => \&code_highlight,
22 no_bypass => 0,
23 for_links => 0,
24 aubbc_escape => 1,
25 no_img => 0,
26 icon_image => 1,
27 image_hight => '60',
28 image_width => '90',
29 image_border => '0',
30 image_wrap => ' ',
31 href_target => ' target="_blank"',
32 images_url => '',
33 html_type => ' /',
34 fix_amp => 1,
35 line_break => '1',
36 code_class => '',
37 code_extra => '',
38 code_download => '^Download above code^',
39 href_class => '',
40 quote_class => '',
41 quote_extra => '',
42 script_escape => 1,
43 protect_email => '0',
44 email_message => 'Contact Email',
45 highlight_class1 => '',
46 highlight_class2 => '',
47 highlight_class3 => '',
48 highlight_class4 => '',
49 highlight_class5 => '',
50 highlight_class6 => '',
51 highlight_class7 => '',
52 highlight_class8 => '',
53 highlight_class9 => '',
54 );
55 1 my @security_levels = ('Guest', 'User', 'Moderator','Administrator');
56 1 my ($user_level, $high_level, $user_key) = ('Guest', 3, 0);
57 1 my %Tag_SecLVL = (
58 code => { level => 0, text => $BAD_MESSAGE, },
59 img => { level => 0, text => $BAD_MESSAGE, },
60 url => { level => 0, text => $BAD_MESSAGE, },
61 );
62
63 0 ▶sub security_levels {
Subroutine security_levels: not called CC=2 SCAR=17.9
Pod undocumented
64 0 my ($self,@s_levels) = @_;
65 0 $do_f[10] = 0;
66 @s_levels
67 0 ▶ ? @security_levels = @s_levels
Branch: 1 branch
BranchTrueFalseTotal
@s_levels ? : 0 0 0
68 : return @security_levels;
69 }
70
71 0 ▶sub user_level {
Subroutine user_level: not called CC=2 SCAR=17.9
Pod undocumented
72 0 my ($self,$u_level) = @_;
73 0 $do_f[10] = 0;
74 0 ▶ defined $u_level
Branch: 1 branch
BranchTrueFalseTotal
defined $u_level ? : 0 0 0
75 ? $user_level = $u_level
76 : return $user_level;
77 }
78
79 0 ▶sub tag_security {
Subroutine tag_security: not called CC=2 SCAR=17.9
Pod undocumented
80 0 my ($self,%s_tags) = @_;
81 0 ▶ %s_tags
Branch: 1 branch
BranchTrueFalseTotal
%s_tags ? : 0 0 0
82 ? %Tag_SecLVL = %s_tags
83 : return %Tag_SecLVL;
84 }
85
86 1 ▶sub check_access {
Subroutine check_access: called CC=7 SCAR=33.2
Pod undocumented
87 1 my $tag = shift;
88 1 ▶ unless ($do_f[10]) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($do_f[10]) 0 1 1
89 0 $do_f[10] = 1;
90 0 ($high_level, $user_key) = (scalar(@security_levels), 0);
91
92 0 ▶ for(my $i = 0; $i < $high_level;) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $high_level) 0 0 0
93 0 ▶ if ($security_levels[$i] eq $user_level) {
Branch: 1 branch
BranchTrueFalseTotal
if ($security_levels[$i] eq $user_level) 0 0 0
94 0 $user_key = $i;
95 0 last;
96 }
97 0 $i++;
98 }
99 }
100
101 1 ▶ if (defined $tag && $do_f[10]) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $tag and $do_f[10]) 0 1 1
Condition33%1/3
defined $tag and $do_f[10]
!ll&&!rl&&r
100
MC/DC0%0/2
defined $tag and $do_f[10]
defined $tag $do_f[10]
Truth table33%1/3
A and B
A= defined $tagB= $do_f[10]
ABresult
0X0
100
111
102 $user_key >= $Tag_SecLVL{$tag}{level}
103 0 ▶ ? return 1
Branch: 1 branch
BranchTrueFalseTotal
$user_key >= $Tag_SecLVL{$tag}{'level'} ? : 0 0 0
104 : return '';
105 }
106 }
107
108 1 ▶sub new {
Subroutine new: called CC=8 SCAR=22.4
Pod undocumented
109 1 ▶warn 'CREATING AUBBC '.$VERSION if $DEBUG_AUBBC;
Branch: 1 branch
BranchTrueFalseTotal
if $AUBBC::DEBUG_AUBBC 0 1 1
110 1 ▶ if ($MEMOIZE && ! $do_f[7]) {
Branch: 1 branch
BranchTrueFalseTotal
if ($AUBBC::MEMOIZE and not $do_f[7]) 1 0 1
Condition33%1/3
$AUBBC::MEMOIZE and not $do_f[7]
!ll&&!rl&&r
001
MC/DC0%0/2
$AUBBC::MEMOIZE and not $do_f[7]
$AUBBC::MEMOIZE not $do_f[7]
Truth table33%1/3
A and not(B)
A= $AUBBC::MEMOIZEB= not $do_f[7]
ABresult
0X0
100
111
111 1 $do_f[7] = 1;
112 1 ▶ eval 'use Memoize' if ! defined $Memoize::VERSION;
Subroutine BEGIN: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
unless defined $Memoize::VERSION 1 0 1
113 1 ▶ unless ($@ || ! defined $Memoize::VERSION) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($@ or not defined $Memoize::VERSION) 1 0 1
Condition33%1/3
$@ or not defined $Memoize::VERSION
l!l&&r!l&&!r
001
MC/DC0%0/2
$@ or not defined $Memoize::VERSION
$@ not defined $Memoize::VERSION
Truth table33%1/3
A or not(B)
A= $@B= not defined $Memoize::VERSION
ABresult
1X1
011
000
114 1 Memoize::memoize('AUBBC::settings');
115 1 Memoize::memoize('AUBBC::smiley_hash');
116 1 Memoize::memoize('AUBBC::add_build_tag');
117 1 Memoize::memoize('AUBBC::do_all_ubbc');
118 1 Memoize::memoize('AUBBC::script_escape');
119 1 Memoize::memoize('AUBBC::html_to_text');
120 }
121 1 ▶ $aubbc_error .= $@."\n" if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 1 1
122 }
123 1 return bless {};
124 }
125
126 1 ▶sub DESTROY {
Subroutine DESTROY: called CC=2 SCAR=7.6
127 1 ▶warn 'DESTROY AUBBC '.$VERSION if $DEBUG_AUBBC;
Branch: 1 branch
BranchTrueFalseTotal
if $AUBBC::DEBUG_AUBBC 0 1 1
128 }
129
130 1 ▶sub settings_prep {
Subroutine settings_prep: called CC=6 SCAR=21.2
Pod undocumented
131 1 ▶$AUBBC{href_target} = $AUBBC{href_target} ? ' target="_blank"' : '';
Branch: 1 branch
BranchTrueFalseTotal
$AUBBC{'href_target'} ? : 1 0 1
132 1 ▶$AUBBC{image_wrap} = $AUBBC{image_wrap} ? ' ' : '';
Branch: 1 branch
BranchTrueFalseTotal
$AUBBC{'image_wrap'} ? : 1 0 1
133 1 ▶$AUBBC{image_border} = $AUBBC{image_border} ? '1' : '0';
Branch: 1 branch
BranchTrueFalseTotal
$AUBBC{'image_border'} ? : 0 1 1
134 1 ▶$AUBBC{html_type} = $AUBBC{html_type} eq 'xhtml' || $AUBBC{html_type} eq ' /' ? ' /' : '';
Branch: 1 branch
BranchTrueFalseTotal
$AUBBC{'html_type'} eq 'xhtml' || $AUBBC{'html_type'} eq ' /' ? : 1 0 1
Condition33%1/3
$AUBBC{"html_type"} eq "xhtml" or $AUBBC{"html_type"} eq " /"
l!l&&r!l&&!r
100
MC/DC0%0/2
$AUBBC{"html_type"} eq "xhtml" or $AUBBC{"html_type"} eq " /"
$AUBBC{"html_type"} eq "xhtml" $AUBBC{"html_type"} eq " /"
Truth table33%1/3
A or B
A= $AUBBC{"html_type"} eq "xhtml"B= $AUBBC{"html_type"} eq " /"
ABresult
1X1
011
000
135 }
136
137 1 ▶sub settings {
Subroutine settings: called CC=6 SCAR=25.0
138 1 my ($self,%s_hash) = @_;
139 1 foreach (keys %s_hash) {
140 1 ▶ if ('highlight_function' eq $_) {
Branch: 1 branch
BranchTrueFalseTotal
if ('highlight_function' eq $_) { } 0 1 1
141 0 $AUBBC{highlight} = 0;
142 0 $s_hash{$_} = check_subroutine($s_hash{$_},'');
143 0 ▶ $AUBBC{highlight_function} = $s_hash{$_} unless ! $s_hash{$_};
Branch: 1 branch
BranchTrueFalseTotal
if $s_hash{$_} 0 0 0
144 } else {
145 1 $AUBBC{$_} = $s_hash{$_};
146 }
147 }
148 1 &settings_prep;
149 1 ▶ if ($DEBUG_AUBBC) {
Branch: 1 branch
BranchTrueFalseTotal
if ($AUBBC::DEBUG_AUBBC) 0 1 1
150 0 my $uabbc_settings = '';
151 0 $uabbc_settings .= $_ . ' =>' . $AUBBC{$_} . ', ' foreach keys %AUBBC;
152 0 warn 'AUBBC Settings Change: '.$uabbc_settings;
153 }
154 }
155
156 1 ▶sub get_setting {
Subroutine get_setting: called CC=2 SCAR=7.2
Pod undocumented
157 1 my ($self,$name) = @_;
158 1 ▶ return $AUBBC{$name} if exists $AUBBC{$name};
Branch: 1 branch
BranchTrueFalseTotal
if exists $AUBBC{$name} 1 0 1
159 }
160
161 0 ▶sub code_highlight {
Subroutine code_highlight: not called CC=5 SCAR=34.0
Pod undocumented
162 0 my $txt = shift;
163 0 ▶ warn 'ENTER code_highlight' if $DEBUG_AUBBC;
Branch: 1 branch
BranchTrueFalseTotal
if $AUBBC::DEBUG_AUBBC 0 0 0
164 0 $txt =~ s/:/&#58;/g;
165 0 $txt =~ s/\[/&#91;/g;
166 0 $txt =~ s/\]/&#93;/g;
167 0 $txt =~ s/\000&#91;/&#91;&#91;/g;
168 0 $txt =~ s/\000&#93;/&#93;&#93;/g;
169 0 $txt =~ s/\{/&#123;/g;
170 0 $txt =~ s/\}/&#125;/g;
171 0 $txt =~ s/%/&#37;/g;
172 0 $txt =~ s/(?<!>)\n/<br$AUBBC{html_type}>\n/g;
173 0 ▶ if ($AUBBC{highlight}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($AUBBC{"highlight"}) 0 0 0
174 0 ▶ warn 'ENTER block highlight' if $DEBUG_AUBBC;
Branch: 1 branch
BranchTrueFalseTotal
if $AUBBC::DEBUG_AUBBC 0 0 0
175 0 ▶ $txt =~ s/\z/<br$AUBBC{html_type}>/ if $txt !~ m/<br$AUBBC{html_type}>\z/;
Branch: 1 branch
BranchTrueFalseTotal
unless $txt =~ /<br$AUBBC{"html_type"}>\z/ 0 0 0
176 0 $txt =~ s/(&#60;&#60;(?:&#39;)?(\w+)(?:&#39;)?&#59;(?s)[^\2]+\b\2\b)/<span$AUBBC{highlight_class1}>$1<\/span>/g;
177 0 $txt =~ s/(?<![\&\$])(\#.*?(?:<br$AUBBC{html_type}>))/<span$AUBBC{highlight_class2}>$1<\/span>/g;
178 0 $txt =~ s/(\bsub\b(?:\s+))(\w+)/$1<span$AUBBC{highlight_class8}>$2<\/span>/g;
179 0 $txt =~ s/(\w+(?:\-&#62;)?(?:\w+)?&#40;(?:.+?)?&#41;(?:&#59;)?)/<span$AUBBC{highlight_class9}>$1<\/span>/g;
180 0 $txt =~ s/((?:&amp;)\w+&#59;)/<span$AUBBC{highlight_class9}>$1<\/span>/g;
181 0 $txt =~ s/(&#39;(?s).*?(?<!&#92;)&#39;)/<span$AUBBC{highlight_class3}>$1<\/span>/g;
182 0 $txt =~ s/(&#34;(?s).*?(?<!&#92;)&#34;)/<span$AUBBC{highlight_class4}>$1<\/span>/g;
183 0 $txt =~ s/(?<![\#|\w])(\d+)(?!\w)/<span$AUBBC{highlight_class5}>$1<\/span>/g;
184 0 $txt =~
185 s/(&#124;&#124;|&amp;&amp;|\b(?:strict|package|return|require|for|my|sub|if|eq|ne|lt|ge|le|gt|or|xor|use|while|foreach|next|last|unless|elsif|else|not|and|until|continue|do|goto)\b)/<span$AUBBC{highlight_class6}>$1<\/span>/g;
186 0 $txt =~ s/(?<!&#92;)((?:&#37;|\$|\@)\w+(?:(?:&#91;.+?&#93;|&#123;.+?&#125;)+|))/<span$AUBBC{highlight_class7}>$1<\/span>/g;
187 }
188 0 return $txt;
189 }
190
191 0 ▶sub code_download {
Subroutine code_download: not called CC=2 SCAR=17.9
Pod documented
192 0 ▶ if ($AUBBC{code_download}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($AUBBC{'code_download'}) { } 0 0 0
193 0 $do_f[8]++;
194 $do_f[9] =
195 0 make_link('javascript:void(0)',$AUBBC{code_download}, "javascript:MyCodePrint('aubbcode$do_f[8]');",'');
196 0 return " id=\"aubbcode$do_f[8]\"";
197 0 } else { return ''; }
198 }
199
200 0 ▶sub code_tag {
Subroutine code_tag: not called CC=3 SCAR=24.8
Pod undocumented
201 0 my ($code,$name) = @_;
202 0 ▶ if (check_access('code')) {
Branch: 1 branch
BranchTrueFalseTotal
if (check_access('code')) { } 0 0 0
203 0 ▶ $name = "# $name:<br$AUBBC{html_type}>\n" if $name;
Branch: 1 branch
BranchTrueFalseTotal
if $name 0 0 0
204 return "$name<div$AUBBC{code_class}".&code_download."><code>\n".
205 $AUBBC{highlight_function}->($code).
206 0 "\n</code></div>".$AUBBC{code_extra}.$do_f[9];
207 }
208 else {
209 0 return $Tag_SecLVL{code}{text};
210 }
211 }
212
213 0 ▶sub make_image {
Subroutine make_image: not called CC=3 SCAR=24.8
Pod undocumented
214 0 my ($align,$src,$width,$height,$alt) = @_;
215 0 my $img = "<img$align src=\"$src\"";
216 0 ▶ $img .= " width=\"$width\"" if $width;
Branch: 1 branch
BranchTrueFalseTotal
if $width 0 0 0
217 0 ▶ $img .= " height=\"$height\"" if $height;
Branch: 1 branch
BranchTrueFalseTotal
if $height 0 0 0
218 0 return $img." alt=\"$alt\" border=\"$AUBBC{image_border}\"$AUBBC{html_type}>";
219 }
220
221 0 ▶sub make_link {
Subroutine make_link: not called CC=4 SCAR=30.0
Pod undocumented
222 0 my ($link,$name,$javas,$targ) = @_;
223 0 my $linkd = "<a href=\"$link\"";
224 0 ▶ $linkd .= " onclick=\"$javas\"" if $javas;
Branch: 1 branch
BranchTrueFalseTotal
if $javas 0 0 0
225 0 ▶ $linkd .= $AUBBC{href_target} if $targ;
Branch: 1 branch
BranchTrueFalseTotal
if $targ 0 0 0
226 0 $linkd .= $AUBBC{href_class}.'>';
227 0 ▶ $linkd .= $name ? $name : $link;
Branch: 1 branch
BranchTrueFalseTotal
$name ? : 0 0 0
228 0 return $linkd.'</a>';
229 }
230
231 1 ▶sub do_ubbc {
Subroutine do_ubbc: called CC=8 SCAR=23.9
Pod undocumented
232 1 ▶ warn 'ENTER do_ubbc' if $DEBUG_AUBBC;
Branch: 1 branch
BranchTrueFalseTotal
if $AUBBC::DEBUG_AUBBC 0 1 1
233 0 $msg =~ s/\[(?:c|code)\](?s)(.+?)\[\/(?:c|code)\]/code_tag($1, '')/ge;
234 0 $msg =~ s/\[(?:c|code)=(.+?)\](?s)(.+?)\[\/(?:c|code)\]/code_tag($2, $1)/ge;
235 1 ▶ $do_f[9] = '' if $do_f[9];
Branch: 1 branch
BranchTrueFalseTotal
if $do_f[9] 0 1 1
236
237 0 ▶ $msg =~ s/\[(img|right_img|left_img)\](.+?)\[\/img\]/fix_image($1, $2)/ge if ! $AUBBC{no_img};
Branch: 1 branch
BranchTrueFalseTotal
unless $AUBBC{"no_img"} 1 0 1
238
239 1 $msg =~ s/\[email\](?![\w\.\-\&\+]+\@[\w\.\-]+).+?\[\/email\]/\[<font color=red>$BAD_MESSAGE<\/font>\]email/g;
240 $AUBBC{protect_email}
241 0 ▶ ? $msg =~ s/\[email\]([\w\.\-\&\+]+\@[\w\.\-]+)\[\/email\]/protect_email($1)/ge
Branch: 1 branch
BranchTrueFalseTotal
$AUBBC{'protect_email'} ? : 0 1 1
242 0 : $msg =~ s/\[email\]([\w\.\-\&\+]+\@[\w\.\-]+)\[\/email\]/link_check("mailto:$1",$1,'','')/ge;
243
244 1 $msg =~ s/\[color=([\w#]+)\](?s)(.+?)\[\/color\]/<span style="color:$1;">$2<\/span>/g;
245
246 1 ▶ 1 while $msg =~
Branch: 1 branch
BranchTrueFalseTotal
$msg =~ s(\[quote=([\w\s]+)\](?s)(.+?)\[/quote\])[<div$AUBBC{"quote_class"}><small><strong>$1:</strong></small><br$AUBBC{"html_type"}>\n$2</div>$AUBBC{"quote_extra"}]g and do { '???' } 0 1 1
247 s/\[quote=([\w\s]+)\](?s)(.+?)\[\/quote\]/<div$AUBBC{quote_class}><small><strong>$1:<\/strong><\/small><br$AUBBC{html_type}>
248 $2<\/div>$AUBBC{quote_extra}/g;
249 1 ▶ 1 while $msg =~
Branch: 1 branch
BranchTrueFalseTotal
$msg =~ s(\[quote\](?s)(.+?)\[/quote\])[<div$AUBBC{"quote_class"}>$1</div>$AUBBC{"quote_extra"}]g and do { '???' } 0 1 1
250 s/\[quote\](?s)(.+?)\[\/quote\]/<div$AUBBC{quote_class}>$1<\/div>$AUBBC{quote_extra}/g;
251
252 1 $msg =~ s/\[(left|right|center)\](?s)(.+?)\[\/\1\]/<div style=\"text-align: $1;\">$2<\/div>/g;
253 1 $msg =~ s/\[li=(\d+)\](?s)(.+?)\[\/li\]/<li value="$1">$2<\/li>/g;
254 1 $msg =~ s/\[u\](?s)(.+?)\[\/u\]/<span style="text-decoration: underline;">$1<\/span>/g;
255 1 $msg =~ s/\[strike\](?s)(.+?)\[\/strike\]/<span style="text-decoration: line-through;">$1<\/span>/g;
256 1 $msg =~ s/\[([bh]r)\]/<$1$AUBBC{html_type}>/g;
257 0 $msg =~ s/\[list\](?s)(.+?)\[\/list\]/fix_list($1)/ge;
258
259 1 ▶ 1 while $msg =~
Branch: 1 branch
BranchTrueFalseTotal
$msg =~ s(\[(blockquote|big|h[123456]|[ou]l|li|em|pre|s(?:mall|trong|u[bp])|[bip])\](?s)(.+?)\[/\1\])[<$1>$2</$1>]g and do { '???' } 0 1 1
260 s/\[(blockquote|big|h[123456]|[ou]l|li|em|pre|s(?:mall|trong|u[bp])|[bip])\](?s)(.+?)\[\/\1\]/<$1>$2<\/$1>/g;
261
262 1 $msg =~ s/(<\/?(?:ol|ul|li|hr)\s?\/?>)\r?\n?<br(?:\s?\/)?>/$1/g;
263
264 0 $msg =~ s/\[url=(\w+\:\/\/$long_regex)\](.+?)\[\/url\]/link_check($1,fix_message($2),'',1)/ge;
265 0 $msg =~ s/(?<!["=\.\/\'\[\{\;])((?:\b\w+\b\:\/\/)$long_regex)/link_check($1,$1,'',1)/ge;
266 }
267
268 0 ▶sub link_check {
Subroutine link_check: not called CC=2 SCAR=17.9
Pod undocumented
269 0 my ($link,$name,$javas,$targ) = @_;
270 check_access('url')
271 ? make_link($link,$name,$javas,$targ)
272 0 ▶ : return $Tag_SecLVL{url}{text};
Branch: 1 branch
BranchTrueFalseTotal
check_access('url') ? : 0 0 0
273 }
274
275 0 ▶sub fix_list {
Subroutine fix_list: not called CC=9 SCAR=45.0
Pod undocumented
276 0 my $list = shift;
277 0 ▶ if ($list =~ m/\[\*/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($list =~ /\[\*/) 0 0 0
278 0 $list =~ s/<br$AUBBC{html_type}>//g;
279 0 my $type = 'ul';
280 0 ▶ $type = 'ol' if $list =~ s/\[\*=(\d+)\]/\[\*\]$1\|/g;
Branch: 1 branch
BranchTrueFalseTotal
if $list =~ s/\[\*=(\d+)\]/[*]$1|/g 0 0 0
281 0 my @clean = split('\[\*\]', $list);
282 0 $list = "<$type>\n";
283 0 foreach (@clean) {
284 0 ▶ if ($_ && $_ =~ s/\A(\d+)\|(?s)(.+?)/$2/) {
Branch: 2 branches
BranchTrueFalseTotal
if ($_ and $_ =~ s/\A(\d+)\|(?s)(.+?)/$2/) { } 0 0 0
elsif ($_ and not $_ =~ /\A\s+|\d+\|\r?\n?\z/) { } 0 0 0
Condition0%0/3
$_ and $_ =~ s/\A(\d+)\|(?s)(.+?)/$2/
!ll&&!rl&&r
000
MC/DC0%0/2
$_ and $_ =~ s/\A(\d+)\|(?s)(.+?)/$2/
$_ $_ =~ s/\A(\d+)\|(?s)(.+?)/$2/
Truth table0%0/3
A and B
A= $_B= $_ =~ s/\A(\d+)\|(?s)(.+?)/$2/
ABresult
0X0
100
111
285 0 ▶ $list .= "<li value=\"$1\">$_<\/li>\n" if $_ !~ m/\A\r?\n?\z/;
Branch: 1 branch
BranchTrueFalseTotal
unless $_ =~ /\A\r?\n?\z/ 0 0 0
286 ▶ } elsif ($_ && $_ !~ m/\A\s+|\d+\|\r?\n?\z/) {
Condition0%0/3
$_ and not $_ =~ /\A\s+|\d+\|\r?\n?\z/
!ll&&!rl&&r
000
MC/DC0%0/2
$_ and not $_ =~ /\A\s+|\d+\|\r?\n?\z/
$_ not $_ =~ /\A\s+|\d+\|\r?\n?\z/
Truth table0%0/3
A and not(B)
A= $_B= not $_ =~ /\A\s+|\d+\|\r?\n?\z/
ABresult
0X0
100
111
287 0 $list .= "<li>$_<\/li>\n";
288 }
289 }
290 0 $list .= "<\/$type>";
291 }
292 0 return $list;
293 }
294
295 0 ▶sub fix_image {
Subroutine fix_image: not called CC=8 SCAR=42.8
Pod undocumented
296 0 my ($tmp2, $tmp) = @_;
297 0 ▶ if (check_access('img')) {
Branch: 1 branch
BranchTrueFalseTotal
if (check_access('img')) { } 0 0 0
298 0 ▶ if ($tmp !~ m/\A\w+:\/\/|\// || $tmp =~ m/\?|\#|\.\bjs\b\z/i) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $tmp =~ m[\A\w+://|/] or $tmp =~ /\?|\#|\.\bjs\b\z/i) { } 0 0 0
Condition0%0/3
not $tmp =~ m[\A\w+://|/] or $tmp =~ /\?|\#|\.\bjs\b\z/i
l!l&&r!l&&!r
000
MC/DC0%0/2
not $tmp =~ m[\A\w+://|/] or $tmp =~ /\?|\#|\.\bjs\b\z/i
not $tmp =~ m[\A\w+://|/] $tmp =~ /\?|\#|\.\bjs\b\z/i
Truth table0%0/3
not(A) or B
A= not $tmp =~ m[\A\w+://|/]B= $tmp =~ /\?|\#|\.\bjs\b\z/i
ABresult
1X1
011
000
299 0 $tmp = "[<font color=red>$BAD_MESSAGE</font>]$tmp2";
300 }
301 else {
302 0 ▶ $tmp2 = '' if $tmp2 eq 'img';
Branch: 1 branch
BranchTrueFalseTotal
if $tmp2 eq "img" 0 0 0
303 0 ▶ $tmp2 = ' align="right"' if $tmp2 eq 'right_img';
Branch: 1 branch
BranchTrueFalseTotal
if $tmp2 eq "right_img" 0 0 0
304 0 ▶ $tmp2 = ' align="left"' if $tmp2 eq 'left_img';
Branch: 1 branch
BranchTrueFalseTotal
if $tmp2 eq "left_img" 0 0 0
305 $tmp = $AUBBC{icon_image}
306 ? make_link($tmp,make_image($tmp2,$tmp,$AUBBC{image_width},
307 $AUBBC{image_hight},''),'',1).$AUBBC{image_wrap}
308 0 ▶ : make_image($tmp2,$tmp,'','','').$AUBBC{image_wrap};
Branch: 1 branch
BranchTrueFalseTotal
$AUBBC{'icon_image'} ? : 0 0 0
309 }
310 0 return $tmp;
311 }
312 else {
313 0 return $Tag_SecLVL{img}{text};
314 }
315 }
316
317 0 ▶sub protect_email {
Subroutine protect_email: not called CC=19 SCAR=59.4
Pod documented
318 0 my $em = shift;
319 0 ▶ if (check_access('url')) {
Branch: 1 branch
BranchTrueFalseTotal
if (check_access('url')) { } 0 0 0
320 0 my ($email1, $email2, $ran_num, $protect_email, @letters) =
321 ('', '', '', '', split (//, $em));
322 0 ▶ $protect_email = '[' if $AUBBC{protect_email} eq 3 || $AUBBC{protect_email} eq 4;
Branch: 1 branch
BranchTrueFalseTotal
if $AUBBC{"protect_email"} eq 3 or $AUBBC{"protect_email"} eq 4 0 0 0
Condition0%0/3
$AUBBC{"protect_email"} eq 3 or $AUBBC{"protect_email"} eq 4
l!l&&r!l&&!r
000
MC/DC0%0/2
$AUBBC{"protect_email"} eq 3 or $AUBBC{"protect_email"} eq 4
$AUBBC{"protect_email"} eq 3 $AUBBC{"protect_email"} eq 4
Truth table0%0/3
A or B
A= $AUBBC{"protect_email"} eq 3B= $AUBBC{"protect_email"} eq 4
ABresult
1X1
011
000
323
324 0 foreach my $character (@letters) {
325 0 ▶ $protect_email .= '&#' . ord($character) . ';' if $AUBBC{protect_email} eq 1 || $AUBBC{protect_email} eq 2;
Branch: 1 branch
BranchTrueFalseTotal
if $AUBBC{"protect_email"} eq 1 or $AUBBC{"protect_email"} eq 2 0 0 0
Condition0%0/3
$AUBBC{"protect_email"} eq 1 or $AUBBC{"protect_email"} eq 2
l!l&&r!l&&!r
000
MC/DC0%0/2
$AUBBC{"protect_email"} eq 1 or $AUBBC{"protect_email"} eq 2
$AUBBC{"protect_email"} eq 1 $AUBBC{"protect_email"} eq 2
Truth table0%0/3
A or B
A= $AUBBC{"protect_email"} eq 1B= $AUBBC{"protect_email"} eq 2
ABresult
1X1
011
000
326 0 ▶ $protect_email .= ord($character) . ',' if $AUBBC{protect_email} eq 3;
Branch: 1 branch
BranchTrueFalseTotal
if $AUBBC{"protect_email"} eq 3 0 0 0
327 0 ▶ $ran_num = int(rand(64)) || 0 if $AUBBC{protect_email} eq 4;
Branch: 1 branch
BranchTrueFalseTotal
if $AUBBC{"protect_email"} eq 4 0 0 0
Condition0%0/2
int rand 64 || 0
l!l
00
MC/DC0%0/1
int rand 64 || 0
int rand 64
Truth table0%0/2
A
A= int rand 64
Aresult
11
00
328 $protect_email .= '\'' . (ord($key64[$ran_num]) ^ ord($character)) . '\',\'' . $key64[$ran_num] . '\','
329 0 ▶ if $AUBBC{protect_email} eq 4;
Branch: 1 branch
BranchTrueFalseTotal
if $AUBBC{"protect_email"} eq 4 0 0 0
330 }
331
332 return make_link("&#109;&#97;&#105;&#108;&#116;&#111;&#58;$protect_email",$protect_email,'','')
333 0 ▶ if $AUBBC{protect_email} eq 1;
Branch: 1 branch
BranchTrueFalseTotal
if $AUBBC{"protect_email"} eq 1 0 0 0
334
335 0 ▶ ($email1, $email2) = split ("&#64;", $protect_email) if $AUBBC{protect_email} eq 2;
Branch: 1 branch
BranchTrueFalseTotal
if $AUBBC{"protect_email"} eq 2 0 0 0
336 0 ▶ $protect_email = "'$email1' + '&#64;' + '$email2'" if $AUBBC{protect_email} eq 2;
Branch: 1 branch
BranchTrueFalseTotal
if $AUBBC{"protect_email"} eq 2 0 0 0
337 0 ▶ $protect_email =~ s/\,\z/]/g if $AUBBC{protect_email} eq 3 || $AUBBC{protect_email} eq 4;
Branch: 1 branch
BranchTrueFalseTotal
if $AUBBC{"protect_email"} eq 3 or $AUBBC{"protect_email"} eq 4 0 0 0
Condition0%0/3
$AUBBC{"protect_email"} eq 3 or $AUBBC{"protect_email"} eq 4
l!l&&r!l&&!r
000
MC/DC0%0/2
$AUBBC{"protect_email"} eq 3 or $AUBBC{"protect_email"} eq 4
$AUBBC{"protect_email"} eq 3 $AUBBC{"protect_email"} eq 4
Truth table0%0/3
A or B
A= $AUBBC{"protect_email"} eq 3B= $AUBBC{"protect_email"} eq 4
ABresult
1X1
011
000
338
339 return make_link('javascript:void(0)',$AUBBC{email_message},"javascript:MyEmCode('$AUBBC{protect_email}',$protect_email);",'')
340 0 ▶ if $AUBBC{protect_email} eq '2' || $AUBBC{protect_email} eq '3' || $AUBBC{protect_email} eq '4';
Branch: 1 branch
BranchTrueFalseTotal
if $AUBBC{"protect_email"} eq 2 or $AUBBC{"protect_email"} eq 3 or $AUBBC{"protect_email"} eq 4 0 0 0
Condition0%0/6
$AUBBC{"protect_email"} eq 2 or $AUBBC{"protect_email"} eq 3 or $AUBBC{"protect_email"} eq 4
l!l&&r!l&&!r
000
$AUBBC{"protect_email"} eq 2 or $AUBBC{"protect_email"} eq 3
l!l&&r!l&&!r
000
MC/DC0%0/3
$AUBBC{"protect_email"} eq 2 or $AUBBC{"protect_email"} eq 3 or $AUBBC{"protect_email"} eq 4
$AUBBC{"protect_email"} eq 2 $AUBBC{"protect_email"} eq 3 $AUBBC{"protect_email"} eq 4
Truth table0%0/4
A or B or C
A= $AUBBC{"protect_email"} eq 2B= $AUBBC{"protect_email"} eq 3C= $AUBBC{"protect_email"} eq 4
ABCresult
1XX1
01X1
0011
0000
341 }
342 else {
343 0 return $Tag_SecLVL{url}{text};
344 }
345 }
346
347 0 ▶sub js_print {
Subroutine js_print: not called CC=1 SCAR=6.9
Pod undocumented
348 0 my $self = shift;
349 0 print <<JS;
350 Content-type: text/javascript
351
352 /*
353 AUBBC v$VERSION
354 JS
355
356 0 print <<'JS';
357 Fully supports dynamic view in XHTML.
358 */
359 function MyEmCode (type, content) {
360 var returner = false;
361 if (type == 4) {
362 var farray= new Array(content.length,1);
363 for(farray[1];farray[1]<farray[0];farray[1]++) { returner+=String.fromCharCode(content[farray[1]].charCodeAt(0)^content[farray[1]-1]);farray[1]++; }
364 } else if (type == 3) {
365 for (i = 0; i < content.length; i++) { returner+=String.fromCharCode(content[i]); }
366 } else if (type == 2) { returner=content; }
367 if (returner) { window.location='mailto:'+returner; }
368 }
369
370 function MyCodePrint (input) {
371 if (input && document.getElementById(input)) {
372 var TheCode = document.getElementById(input).innerHTML;
373 TheCode = TheCode.replace(/<([^br<]+|\/?[puib])>/ig, "");
374 codewin = window.open("", input, "width=800,height=600,resizable=yes,menubar=yes,scrollbars=yes");
375 top.codewin.document.write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n"+
376 "<html>\n<head>\n<title>MyCodePrint</title>\n"+
377 "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\n"+
378 "</head>\n<body>\n<code>"+TheCode+"</code>\n</body>\n</html>\n");
379 top.codewin.document.close();
380 }
381 }
382 JS
383 0 exit(0);
384 }
385
386 0 ▶sub do_build_tag {
Subroutine do_build_tag: not called CC=12 SCAR=50.5
Pod undocumented
387 0 ▶ warn 'ENTER do_build_tag' if $DEBUG_AUBBC;
Branch: 1 branch
BranchTrueFalseTotal
if $AUBBC::DEBUG_AUBBC 0 0 0
388
389 0 foreach (keys %Build_AUBBC) {
390 0 ▶ warn 'ENTER foreach do_build_tag' if $DEBUG_AUBBC;
Branch: 1 branch
BranchTrueFalseTotal
if $AUBBC::DEBUG_AUBBC 0 0 0
391 $msg =~ s/(\[$_\:\/\/([$Build_AUBBC{$_}[0]]+)\])/
392 0 ▶ do_sub( $_, $2 , $Build_AUBBC{$_}[2] ) || $1;
Condition0%0/3
do_sub($_, $2, $Build_AUBBC{$_}[2]) || $1
l!l&&r!l&&!r
000
MC/DC0%0/2
do_sub($_, $2, $Build_AUBBC{$_}[2]) || $1
do_sub($_, $2, $Build_AUBBC{$_}[2]) $1
Truth table0%0/3
A || B
A= do_sub($_, $2, $Build_AUBBC{$_}[2])B= $1
ABresult
1X1
011
000
393 0 ▶ /eg if $Build_AUBBC{$_}[1] eq '1';
Branch: 1 branch
BranchTrueFalseTotal
if $Build_AUBBC{$_}[1] eq 1 0 0 0
394
395 $msg =~ s/(\[$_\](?s)([$Build_AUBBC{$_}[0]]+)\[\/$_\])/
396 0 ▶ do_sub( $_, $2 , $Build_AUBBC{$_}[2] ) || $1;
Condition0%0/3
do_sub($_, $2, $Build_AUBBC{$_}[2]) || $1
l!l&&r!l&&!r
000
MC/DC0%0/2
do_sub($_, $2, $Build_AUBBC{$_}[2]) || $1
do_sub($_, $2, $Build_AUBBC{$_}[2]) $1
Truth table0%0/3
A || B
A= do_sub($_, $2, $Build_AUBBC{$_}[2])B= $1
ABresult
1X1
011
000
397 0 ▶ /eg if $Build_AUBBC{$_}[1] eq '2';
Branch: 1 branch
BranchTrueFalseTotal
if $Build_AUBBC{$_}[1] eq 2 0 0 0
398
399 $msg =~ s/(\[$_\])/
400 0 ▶ do_sub( $_, '' , $Build_AUBBC{$_}[2] ) || $1;
Condition0%0/3
do_sub($_, '', $Build_AUBBC{$_}[2]) || $1
l!l&&r!l&&!r
000
MC/DC0%0/2
do_sub($_, '', $Build_AUBBC{$_}[2]) || $1
do_sub($_, '', $Build_AUBBC{$_}[2]) $1
Truth table0%0/3
A || B
A= do_sub($_, '', $Build_AUBBC{$_}[2])B= $1
ABresult
1X1
011
000
401 0 ▶ /eg if $Build_AUBBC{$_}[1] eq '3';
Branch: 1 branch
BranchTrueFalseTotal
if $Build_AUBBC{$_}[1] eq 3 0 0 0
402
403 $msg =~ s/\[$_\]/
404 0 ▶ check_access($_) ? $Build_AUBBC{$_}[2] : $Tag_SecLVL{$_}{text};
Branch: 1 branch
BranchTrueFalseTotal
check_access($_) ? : 0 0 0
405 0 ▶ /eg if $Build_AUBBC{$_}[1] eq '4';
Branch: 1 branch
BranchTrueFalseTotal
if $Build_AUBBC{$_}[1] eq 4 0 0 0
406 }
407 }
408
409 0 ▶sub do_sub {
Subroutine do_sub: not called CC=4 SCAR=30.0
Pod undocumented
410 0 my ($key, $term, $fun) = @_;
411 0 ▶ warn 'ENTER do_sub' if $DEBUG_AUBBC;
Branch: 1 branch
BranchTrueFalseTotal
if $AUBBC::DEBUG_AUBBC 0 0 0
412 check_access($key)
413 ? return $fun->($key, $term) || ''
414 0 ▶ : return $Tag_SecLVL{$key}{text};
Branch: 1 branch
BranchTrueFalseTotal
check_access($key) ? : 0 0 0
Condition0%0/2
&$fun($key, $term) || ''
l!l
00
MC/DC0%0/1
&$fun($key, $term) || ''
&$fun($key, $term)
Truth table0%0/2
A
A= &$fun($key, $term)
Aresult
11
00
415 }
416
417 0 ▶sub check_subroutine {
Subroutine check_subroutine: not called CC=5 SCAR=34.0
Pod undocumented
418 0 my $name = shift;
419 0 ▶ defined $name && exists &{$name} && (ref $name eq 'CODE' || ref $name eq '')
Condition0%0/3
ref $name eq "CODE" or ref $name eq ""
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $name eq "CODE" or ref $name eq ""
ref $name eq "CODE" ref $name eq ""
Truth table0%0/3
A or B
A= ref $name eq "CODE"B= ref $name eq ""
ABresult
1X1
011
000
420 0 ▶ ? return \&{$name}
Branch: 1 branch
BranchTrueFalseTotal
defined $name && exists &{$name;} && (ref $name eq 'CODE' || ref $name eq '') ? : 0 0 0
Condition0%0/6
defined $name and exists &{$name;} and ref $name eq "CODE" || ref $name eq ""
!ll&&!rl&&r
000
defined $name and exists &{$name;}
!ll&&!rl&&r
000
MC/DC0%0/3
defined $name and exists &{$name;} and ref $name eq "CODE" || ref $name eq ""
defined $name exists &{$name;} ref $name eq "CODE" || ref $name eq ""
Truth table0%0/4
A and B and C
A= defined $nameB= exists &{$name;}C= ref $name eq "CODE" || ref $name eq ""
ABCresult
0XX0
10X0
1100
1111
421 : return '';
422 }
423
424 0 ▶sub add_build_tag {
Subroutine add_build_tag: not called CC=19 SCAR=59.4
425 0 my ($self,%NewTag) = @_;
426 0 ▶ warn 'ENTER add_build_tag' if $DEBUG_AUBBC;
Branch: 1 branch
BranchTrueFalseTotal
if $AUBBC::DEBUG_AUBBC 0 0 0
427
428 0 ▶ $NewTag{function2} = $NewTag{function} || 'undefined!';
Condition0%0/2
$NewTag{'function'} || 'undefined!'
l!l
00
MC/DC0%0/1
$NewTag{'function'} || 'undefined!'
$NewTag{'function'}
Truth table0%0/2
A
A= $NewTag{'function'}
Aresult
11
00
429 $NewTag{function} = check_subroutine($NewTag{function},'')
430 0 ▶ if $NewTag{type} ne '4';
Branch: 1 branch
BranchTrueFalseTotal
if $NewTag{"type"} ne 4 0 0 0
431
432 $self->aubbc_error("Usage: add_build_tag - function 'Undefined subroutine' => $NewTag{function2}")
433 0 ▶ if ! $NewTag{function};
Branch: 1 branch
BranchTrueFalseTotal
unless $NewTag{"function"} 0 0 0
434
435 0 ▶ if ($NewTag{function}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($NewTag{"function"}) 0 0 0
436 0 ▶ $NewTag{pattern} = 'l' if $NewTag{type} eq '3' || $NewTag{type} eq '4';
Branch: 1 branch
BranchTrueFalseTotal
if $NewTag{"type"} eq 3 or $NewTag{"type"} eq 4 0 0 0
Condition0%0/3
$NewTag{"type"} eq 3 or $NewTag{"type"} eq 4
l!l&&r!l&&!r
000
MC/DC0%0/2
$NewTag{"type"} eq 3 or $NewTag{"type"} eq 4
$NewTag{"type"} eq 3 $NewTag{"type"} eq 4
Truth table0%0/3
A or B
A= $NewTag{"type"} eq 3B= $NewTag{"type"} eq 4
ABresult
1X1
011
000
437 0 ▶ if ($NewTag{type} && $NewTag{name} =~ m/\A[\w\-]+\z/ && $NewTag{pattern} =~ m/\A[lns_:\-,]+|all\z/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($NewTag{'type'} and $NewTag{'name'} =~ /\A[\w\-]+\z/ and $NewTag{'pattern'} =~ /\A[lns_:\-,]+|all\z/) { } 0 0 0
Condition0%0/6
$NewTag{"type"} and $NewTag{"name"} =~ /\A[\w\-]+\z/ and $NewTag{"pattern"} =~ /\A[lns_:\-,]+|all\z/
!ll&&!rl&&r
000
$NewTag{"type"} and $NewTag{"name"} =~ /\A[\w\-]+\z/
!ll&&!rl&&r
000
MC/DC0%0/3
$NewTag{"type"} and $NewTag{"name"} =~ /\A[\w\-]+\z/ and $NewTag{"pattern"} =~ /\A[lns_:\-,]+|all\z/
$NewTag{"type"} $NewTag{"name"} =~ /\A[\w\-]+\z/ $NewTag{"pattern"} =~ /\A[lns_:\-,]+|all\z/
Truth table0%0/4
A and B and C
A= $NewTag{"type"}B= $NewTag{"name"} =~ /\A[\w\-]+\z/C= $NewTag{"pattern"} =~ /\A[lns_:\-,]+|all\z/
ABCresult
0XX0
10X0
1100
1111
438
439 0 ▶ if ($NewTag{pattern} eq 'all') {
Branch: 1 branch
BranchTrueFalseTotal
if ($NewTag{'pattern'} eq 'all') { } 0 0 0
440 0 $NewTag{pattern} = '^\[|\]';
441 }
442 else {
443 0 my @pat_split = ();
444 0 my %is_pat = ('l' => 'a-z', 'n' => '\d', '_' => '\_', ':' => '\:', 's' => '\s', '-' => '\-');
445 0 @pat_split = split /\,/, $NewTag{pattern};
446 0 $NewTag{pattern} = '';
447 0 ▶ $NewTag{pattern} .= $is_pat{$_} || '' foreach @pat_split;
Condition0%0/2
$is_pat{$_} || ''
l!l
00
MC/DC0%0/1
$is_pat{$_} || ''
$is_pat{$_}
Truth table0%0/2
A
A= $is_pat{$_}
Aresult
11
00
448 }
449
450 0 $Build_AUBBC{$NewTag{name}} = [$NewTag{pattern}, $NewTag{type}, $NewTag{function}];
451 0 ▶ $NewTag{level} ||= 0;
Condition0%0/2
$NewTag{"level"} ||= 0
l!l
00
MC/DC0%0/1
$NewTag{"level"} ||= 0
$NewTag{"level"}
Truth table0%0/2
A
A= $NewTag{"level"}
Aresult
11
00
452 0 ▶ $NewTag{error} ||= $BAD_MESSAGE;
Condition0%0/3
$NewTag{"error"} ||= $AUBBC::BAD_MESSAGE
l!l&&r!l&&!r
000
MC/DC0%0/2
$NewTag{"error"} ||= $AUBBC::BAD_MESSAGE
$NewTag{"error"} $AUBBC::BAD_MESSAGE
Truth table0%0/3
A ||= B
A= $NewTag{"error"}B= $AUBBC::BAD_MESSAGE
ABresult
1X1
011
000
453 0 $Tag_SecLVL{$NewTag{name}} = {level => $NewTag{level}, text => $NewTag{error},};
454 0 ▶ $do_f[5] = 1 if !$do_f[5];
Branch: 1 branch
BranchTrueFalseTotal
unless $do_f[5] 0 0 0
455 0 ▶ warn 'Added Build_AUBBC Tag '.$Build_AUBBC{$NewTag{name}} if $DEBUG_AUBBC && $Build_AUBBC{$NewTag{name}};
Branch: 1 branch
BranchTrueFalseTotal
if $AUBBC::DEBUG_AUBBC and $Build_AUBBC{$NewTag{"name"}} 0 0 0
Condition0%0/3
$AUBBC::DEBUG_AUBBC and $Build_AUBBC{$NewTag{"name"}}
!ll&&!rl&&r
000
MC/DC0%0/2
$AUBBC::DEBUG_AUBBC and $Build_AUBBC{$NewTag{"name"}}
$AUBBC::DEBUG_AUBBC $Build_AUBBC{$NewTag{"name"}}
Truth table0%0/3
A and B
A= $AUBBC::DEBUG_AUBBCB= $Build_AUBBC{$NewTag{"name"}}
ABresult
0X0
100
111
456 }
457 else {
458 0 $self->aubbc_error('Usage: add_build_tag - Bad name or pattern format');
459 }
460 }
461 }
462
463 0 ▶sub remove_build_tag {
Subroutine remove_build_tag: not called CC=6 SCAR=37.4
Pod documented
464 0 my ($self,$name,$type) = @_;
465 0 ▶ warn 'ENTER remove_build_tag' if $DEBUG_AUBBC;
Branch: 1 branch
BranchTrueFalseTotal
if $AUBBC::DEBUG_AUBBC 0 0 0
466 0 ▶ delete $Build_AUBBC{$name} if exists $Build_AUBBC{$name} && !$type; # clear one
Branch: 1 branch
BranchTrueFalseTotal
if exists $Build_AUBBC{$name} and not $type 0 0 0
Condition0%0/3
exists $Build_AUBBC{$name} and not $type
!ll&&!rl&&r
000
MC/DC0%0/2
exists $Build_AUBBC{$name} and not $type
exists $Build_AUBBC{$name} not $type
Truth table0%0/3
A and not(B)
A= exists $Build_AUBBC{$name}B= not $type
ABresult
0X0
100
111
467 0 ▶ %Build_AUBBC = () if $type && !$name; # clear all
Branch: 1 branch
BranchTrueFalseTotal
if $type and not $name 0 0 0
Condition0%0/3
$type and not $name
!ll&&!rl&&r
000
MC/DC0%0/2
$type and not $name
$type not $name
Truth table0%0/3
A and not(B)
A= $typeB= not $name
ABresult
0X0
100
111
468 }
469
470 1 ▶sub do_unicode{
Subroutine do_unicode: called CC=2 SCAR=7.2
Pod undocumented
471 1 ▶ warn 'ENTER do_unicode' if $DEBUG_AUBBC;
Branch: 1 branch
BranchTrueFalseTotal
if $AUBBC::DEBUG_AUBBC 0 1 1
472 1 $msg =~ s/\[utf:\/\/(\#?\w+)\]/&$1;/g;
473 }
474
475 0 ▶sub do_smileys {
Subroutine do_smileys: not called CC=3 SCAR=24.8
Pod undocumented
476 0 ▶warn 'ENTER do_smileys' if $DEBUG_AUBBC;
Branch: 1 branch
BranchTrueFalseTotal
if $AUBBC::DEBUG_AUBBC 0 0 0
477 $msg =~
478 0 s/\[$_\]/make_image('',"$AUBBC{images_url}\/smilies\/$SMILEYS{$_}",'','',$_).$AUBBC{image_wrap}/ge
479 0 foreach keys %SMILEYS;
480 }
481
482 0 ▶sub smiley_hash {
Subroutine smiley_hash: not called CC=3 SCAR=24.8
483 0 my ($self,%s_hash) = @_;
484 0 ▶ warn 'ENTER smiley_hash' if $DEBUG_AUBBC;
Branch: 1 branch
BranchTrueFalseTotal
if $AUBBC::DEBUG_AUBBC 0 0 0
485 0 ▶ if (keys %s_hash) {
Branch: 1 branch
BranchTrueFalseTotal
if (keys %s_hash) 0 0 0
486 0 %SMILEYS = %s_hash;
487 0 $do_f[6] = 1;
488 }
489 }
490
491 1 ▶sub do_all_ubbc {
Subroutine do_all_ubbc: called CC=29 SCAR=52.4
492 1 my ($self,$message) = @_;
493 1 ▶ warn 'ENTER do_all_ubbc' if $DEBUG_AUBBC;
Branch: 1 branch
BranchTrueFalseTotal
if $AUBBC::DEBUG_AUBBC 0 1 1
494 1 ▶ $msg = defined $message ? $message : '';
Branch: 1 branch
BranchTrueFalseTotal
defined $message ? : 1 0 1
495 1 ▶ if ($msg) {
Branch: 1 branch
BranchTrueFalseTotal
if ($msg) 1 0 1
496 1 check_access();
497 1 ▶ $msg = $self->script_escape($msg,'') if $AUBBC{script_escape};
Branch: 1 branch
BranchTrueFalseTotal
if $AUBBC{"script_escape"} 1 0 1
498 1 ▶ $msg =~ s/&(?!\#?\w+;)/&amp;/g if $AUBBC{fix_amp};
Branch: 1 branch
BranchTrueFalseTotal
if $AUBBC{"fix_amp"} 1 0 1
499 1 ▶ if (!$AUBBC{no_bypass} && $msg =~ m/\A\#no/) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $AUBBC{"no_bypass"} and $msg =~ /\A\#no/) 0 1 1
Condition33%1/3
not $AUBBC{"no_bypass"} and $msg =~ /\A\#no/
!ll&&!rl&&r
010
MC/DC0%0/2
not $AUBBC{"no_bypass"} and $msg =~ /\A\#no/
not $AUBBC{"no_bypass"} $msg =~ /\A\#no/
Truth table33%1/3
not(A) and B
A= not $AUBBC{"no_bypass"}B= $msg =~ /\A\#no/
ABresult
0X0
100
111
500 0 ▶ $do_f[4] = 0 if $msg =~ s/\A\#none//;
Branch: 1 branch
BranchTrueFalseTotal
if $msg =~ s/\A\#none// 0 0 0
501 0 ▶ if ($do_f[4]) {
Branch: 1 branch
BranchTrueFalseTotal
if ($do_f[4]) 0 0 0
502 0 ▶ $do_f[0] = 0 if $msg =~ s/\A\#noubbc//;
Branch: 1 branch
BranchTrueFalseTotal
if $msg =~ s/\A\#noubbc// 0 0 0
503 0 ▶ $do_f[1] = 0 if $msg =~ s/\A\#nobuild//;
Branch: 1 branch
BranchTrueFalseTotal
if $msg =~ s/\A\#nobuild// 0 0 0
504 0 ▶ $do_f[2] = 0 if $msg =~ s/\A\#noutf//;
Branch: 1 branch
BranchTrueFalseTotal
if $msg =~ s/\A\#noutf// 0 0 0
505 0 ▶ $do_f[3] = 0 if $msg =~ s/\A\#nosmileys//;
Branch: 1 branch
BranchTrueFalseTotal
if $msg =~ s/\A\#nosmileys// 0 0 0
506 }
507 0 ▶ warn 'START no_bypass' if $DEBUG_AUBBC && !$do_f[4];
Branch: 1 branch
BranchTrueFalseTotal
if $AUBBC::DEBUG_AUBBC and not $do_f[4] 0 0 0
Condition0%0/3
$AUBBC::DEBUG_AUBBC and not $do_f[4]
!ll&&!rl&&r
000
MC/DC0%0/2
$AUBBC::DEBUG_AUBBC and not $do_f[4]
$AUBBC::DEBUG_AUBBC not $do_f[4]
Truth table0%0/3
A and not(B)
A= $AUBBC::DEBUG_AUBBCB= not $do_f[4]
ABresult
0X0
100
111
508 }
509 1 ▶ if ($do_f[4]) {
Branch: 1 branch
BranchTrueFalseTotal
if ($do_f[4]) 1 0 1
510 1 ▶ escape_aubbc() if $AUBBC{aubbc_escape};
Branch: 1 branch
BranchTrueFalseTotal
if $AUBBC{"aubbc_escape"} 1 0 1
511 1 ▶ if (!$AUBBC{for_links}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($AUBBC{"for_links"}) 1 0 1
512 1 ▶ do_ubbc($msg) if $do_f[0] && $AUBBC{aubbc};
Branch: 1 branch
BranchTrueFalseTotal
if $do_f[0] and $AUBBC{"aubbc"} 1 0 1
Condition33%1/3
$do_f[0] and $AUBBC{"aubbc"}
!ll&&!rl&&r
001
MC/DC0%0/2
$do_f[0] and $AUBBC{"aubbc"}
$do_f[0] $AUBBC{"aubbc"}
Truth table33%1/3
A and B
A= $do_f[0]B= $AUBBC{"aubbc"}
ABresult
0X0
100
111
513 1 ▶ do_build_tag() if $do_f[5] && $do_f[1];
Branch: 1 branch
BranchTrueFalseTotal
if $do_f[5] and $do_f[1] 0 1 1
Condition33%1/3
$do_f[5] and $do_f[1]
!ll&&!rl&&r
100
MC/DC0%0/2
$do_f[5] and $do_f[1]
$do_f[5] $do_f[1]
Truth table33%1/3
A and B
A= $do_f[5]B= $do_f[1]
ABresult
0X0
100
111
514 }
515 1 ▶ do_unicode() if $do_f[2] && $AUBBC{utf};
Branch: 1 branch
BranchTrueFalseTotal
if $do_f[2] and $AUBBC{"utf"} 1 0 1
Condition33%1/3
$do_f[2] and $AUBBC{"utf"}
!ll&&!rl&&r
001
MC/DC0%0/2
$do_f[2] and $AUBBC{"utf"}
$do_f[2] $AUBBC{"utf"}
Truth table33%1/3
A and B
A= $do_f[2]B= $AUBBC{"utf"}
ABresult
0X0
100
111
516 1 ▶ do_smileys() if $do_f[6] && $do_f[3] && $AUBBC{smileys};
Branch: 1 branch
BranchTrueFalseTotal
if $do_f[6] and $do_f[3] and $AUBBC{"smileys"} 0 1 1
Condition33%2/6
$do_f[6] and $do_f[3] and $AUBBC{"smileys"}
!ll&&!rl&&r
100
$do_f[6] and $do_f[3]
!ll&&!rl&&r
100
MC/DC0%0/3
$do_f[6] and $do_f[3] and $AUBBC{"smileys"}
$do_f[6] $do_f[3] $AUBBC{"smileys"}
Truth table25%1/4
A and B and C
A= $do_f[6]B= $do_f[3]C= $AUBBC{"smileys"}
ABCresult
0XX0
10X0
1100
1111
517 }
518 }
519 1 ▶ $msg =~ tr/\000//d if $AUBBC{aubbc_escape};
Branch: 1 branch
BranchTrueFalseTotal
if $AUBBC{"aubbc_escape"} 1 0 1
520 1 return $msg;
521 }
522
523 0 ▶sub fix_message {
Subroutine fix_message: not called CC=1 SCAR=6.9
Pod undocumented
524 0 my $txt = shift;
525 0 $txt =~ s/\./&#46;/g;
526 0 $txt =~ s/\:/&#58;/g;
527 0 return $txt;
528 }
529 1 ▶sub escape_aubbc {
Subroutine escape_aubbc: called CC=2 SCAR=7.1
Pod undocumented
530 1 ▶ warn 'ENTER escape_aubbc' if $DEBUG_AUBBC;
Branch: 1 branch
BranchTrueFalseTotal
if $AUBBC::DEBUG_AUBBC 0 1 1
531 1 $msg =~ s/\[\[/\000&#91;/g;
532 1 $msg =~ s/\]\]/\000&#93;/g;
533 }
534
535 1 ▶sub script_escape {
Subroutine script_escape: called CC=10 SCAR=26.2
536 1 my ($self, $text, $option) = @_;
537 1 ▶ warn 'ENTER html_escape' if $DEBUG_AUBBC;
Branch: 1 branch
BranchTrueFalseTotal
if $AUBBC::DEBUG_AUBBC 0 1 1
538 1 ▶ $text = '' unless defined $text;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $text 0 1 1
539 1 ▶ if ($text) {
Branch: 1 branch
BranchTrueFalseTotal
if ($text) 1 0 1
540 0 ▶ $text =~ s/(&|;)/$1 eq '&' ? '&amp;' : '&#59;'/ge;
Branch: 1 branch
BranchTrueFalseTotal
$1 eq '&' ? : 0 0 0
541 1 ▶ if (!$option) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($option) 1 0 1
542 1 $text =~ s/\t/ \&nbsp; \&nbsp; \&nbsp;/g;
543 1 $text =~ s/ / \&nbsp;/g;
544 }
545 1 $text =~ s/"/&#34;/g;
546 1 $text =~ s/</&#60;/g;
547 1 $text =~ s/>/&#62;/g;
548 1 $text =~ s/'/&#39;/g;
549 1 $text =~ s/\)/&#41;/g;
550 1 $text =~ s/\(/&#40;/g;
551 1 $text =~ s/\\/&#92;/g;
552 1 $text =~ s/\|/&#124;/g;
553 ! $option && $AUBBC{line_break} eq '2'
554 ? $text =~ s/\n/<br$AUBBC{html_type}>/g
555 1 ▶ : $text =~ s/\n/<br$AUBBC{html_type}>\n/g if !$option && $AUBBC{line_break} eq '1';
Branch: 2 branches
BranchTrueFalseTotal
if not $option and $AUBBC{"line_break"} eq 1 1 0 1
!$option && $AUBBC{'line_break'} eq '2' ? : 0 1 1
Condition33%2/6
not $option and $AUBBC{"line_break"} eq 1
!ll&&!rl&&r
001
not $option and $AUBBC{"line_break"} eq 2
!ll&&!rl&&r
010
MC/DC0%0/2
not $option and $AUBBC{"line_break"} eq 1
not $option $AUBBC{"line_break"} eq 1
MC/DC0%0/2
not $option and $AUBBC{"line_break"} eq 2
not $option $AUBBC{"line_break"} eq 2
Truth table33%1/3
not(A) and B
A= not $optionB= $AUBBC{"line_break"} eq 1
ABresult
0X0
100
111
Truth table33%1/3
not(A) and B
A= not $optionB= $AUBBC{"line_break"} eq 2
ABresult
0X0
100
111
556 1 return $text;
557 }
558 }
559
560 0 ▶sub html_to_text {
Subroutine html_to_text: not called CC=6 SCAR=37.4
561 0 my ($self, $html, $option) = @_;
562 0 ▶ warn 'ENTER html_to_text' if $DEBUG_AUBBC;
Branch: 1 branch
BranchTrueFalseTotal
if $AUBBC::DEBUG_AUBBC 0 0 0
563 0 ▶ $html = '' unless defined $html;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $html 0 0 0
564 0 ▶ if ($html) {
Branch: 1 branch
BranchTrueFalseTotal
if ($html) 0 0 0
565 0 $html =~ s/&amp;/&/g;
566 0 $html =~ s/&#59;/;/g;
567 0 ▶ if (!$option) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($option) 0 0 0
568 0 $html =~ s/ \&nbsp; \&nbsp; \&nbsp;/\t/g;
569 0 $html =~ s/ \&nbsp;/ /g;
570 }
571 0 $html =~ s/&#34;/"/g;
572 0 $html =~ s/&#60;/</g;
573 0 $html =~ s/&#62;/>/g;
574 0 $html =~ s/&#39;/'/g;
575 0 $html =~ s/&#41;/\)/g;
576 0 $html =~ s/&#40;/\(/g;
577 0 $html =~ s/&#92;/\\/g;
578 0 $html =~ s/&#124;/\|/g;
579 0 ▶ $html =~ s/<br(?:\s?\/)?>\n?/\n/g if $AUBBC{line_break};
Branch: 1 branch
BranchTrueFalseTotal
if $AUBBC{"line_break"} 0 0 0
580 0 return $html;
581 }
582 }
583
584 1 ▶sub version {
Subroutine version: called CC=1 SCAR=0.0
Pod documented
585 1 my $self = shift;
586 1 return $VERSION;
587 }
588
589 0 ▶sub aubbc_error {
Subroutine aubbc_error: not called CC=3 SCAR=24.8
Pod documented
590 0 my ($self, $error) = @_;
591 0 ▶ defined $error && $error
Branch: 1 branch
BranchTrueFalseTotal
defined $error && $error ? : 0 0 0
Condition0%0/3
defined $error and $error
!ll&&!rl&&r
000
MC/DC0%0/2
defined $error and $error
defined $error $error
Truth table0%0/3
A and B
A= defined $errorB= $error
ABresult
0X0
100
111
592 ? $aubbc_error .= $error . "\n"
593 : return $aubbc_error;
594 }
595
596 1 1;
597
598 __END__
↑ Summary