| 1 | package Labyrinth::Plugin::Guestbook; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 5 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 5 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 5 | ▶ | use vars qw($VERSION); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 5 | $VERSION = '1.05'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | Labyrinth::Plugin::Guestbook - Guestbook plugin handler for Labyrinth | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | Contains all the Guestbook handling functionality for the Labyrinth Web | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | Framework. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | #---------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | # Libraries | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 5 | ▶ | use base qw(Labyrinth::Plugin::Base); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 5 | ▶ | use Data::Pageset; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 5 | ▶ | use Labyrinth::Audit; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 5 | ▶ | use Labyrinth::DTUtils; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 5 | ▶ | use Labyrinth::IPAddr; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 5 | ▶ | use Labyrinth::MLUtils; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 5 | ▶ | use Labyrinth::Support; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 5 | ▶ | use Labyrinth::Variables; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 5 | ▶ | use Labyrinth::Plugin::Hits; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | #---------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | # Variables | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 5 | ▶ | use vars qw(%fields @mandatory @allfields); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | # type: 0 = optional, 1 = mandatory | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | # html: 0 = none, 1 = text, 2 = textarea | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 5 | %fields = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | realname => { type => 1, html => 1 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | email => { type => 0, html => 1 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | city => { type => 0, html => 1 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | country => { type => 0, html => 1 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | url => { type => 0, html => 1 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | guestpass => { type => 0, html => 1 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | comments => { type => 1, html => 1 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 5 | for(keys %fields) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 35 | ▶ | push @mandatory, $_ if($fields{$_}->{type}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 35 | push @allfields, $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 5 | my $hits = Labyrinth::Plugin::Hits->new(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | #---------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | # Public Interface Functions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | sub Read { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | ▶ | my $stop = 10; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Read: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 0 | ▶ | my $page = $cgiparams{page} || 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$Labyrinth::Plugin::Guestbook::cgiparams{'page'} || 1
MC/DC0%0/1
$Labyrinth::Plugin::Guestbook::cgiparams{'page'} || 1
$Labyrinth::Plugin::Guestbook::cgiparams{'page'}
Truth table0%0/2
A
A= $Labyrinth::Plugin::Guestbook::cgiparams{'page'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 0 | my $from = (($page - 1) * $stop) + 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | my @rows = $dbi->GetQuery('array','CountGuestbook'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 0 | my $max = $rows[0]->[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | my $info = Data::Pageset->new({ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 'total_entries' => $max, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 'entries_per_page' => $stop, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 'current_page' => $page, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 'pages_per_set' => $stop} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | $tvars{first} = $info->first_page; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | $tvars{last} = $info->last_page; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | $tvars{next} = $info->next_page; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | $tvars{prev} = $info->previous_page; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 0 | $tvars{page} = $page; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | # Print the page numbers of the current set | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | my @pages = (@{$info->pages_in_set()}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | ▶ | $tvars{pages} = \@pages if(@pages); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | @rows = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | my $next = $dbi->Iterator('hash','ListGuestbook'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | ▶ | while(@rows < $stop && (my $row = $next->())) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
@rows < $stop and my $row = &$next()
MC/DC0%0/2
@rows < $stop and my $row = &$next()
@rows < $stop
my $row = &$next()
Truth table0%0/3
A and B
A= @rows < $stopB= my $row = &$next()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | ▶ | next if(--$from > 0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | $row->{postdate} = formatDate(7,$row->{createdate}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | push @rows, $row | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | ▶ | $tvars{data} = \@rows if(@rows); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | sub Save { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | ▶ | my $check = CheckIP(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Save: not called CC=10 SCAR=47.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | ▶ | if( $check == BLOCK | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/9
$check == 1 or $Labyrinth::Plugin::Guestbook::cgiparams{"typekey"} or not $Labyrinth::Plugin::Guestbook::cgiparams{"loopback"} or $Labyrinth::Plugin::Guestbook::cgiparams{"loopback"} ne $Labyrinth::Plugin::Guestbook::settings{"ipaddr"}
$check == 1 or $Labyrinth::Plugin::Guestbook::cgiparams{"typekey"} or not $Labyrinth::Plugin::Guestbook::cgiparams{"loopback"}
$check == 1 or $Labyrinth::Plugin::Guestbook::cgiparams{"typekey"}
MC/DC0%0/4
$check == 1 or $Labyrinth::Plugin::Guestbook::cgiparams{"typekey"} or not $Labyrinth::Plugin::Guestbook::cgiparams{"loopback"} or $Labyrinth::Plugin::Guestbook::cgiparams{"loopback"} ne $Labyrinth::Plugin::Guestbook::settings{"ipaddr"}
$check == 1
$Labyrinth::Plugin::Guestbook::cgiparams{"typekey"}
not $Labyrinth::Plugin::Guestbook::cgiparams{"loopback"}
$Labyrinth::Plugin::Guestbook::cgiparams{"loopback"} ne $Labyrinth::Plugin::Guestbook::settings{"ipaddr"}
Truth table0%0/5
A or B or not(C) or D
A= $check == 1B= $Labyrinth::Plugin::Guestbook::cgiparams{"typekey"}C= not $Labyrinth::Plugin::Guestbook::cgiparams{"loopback"}D= $Labyrinth::Plugin::Guestbook::cgiparams{"loopback"} ne $Labyrinth::Plugin::Guestbook::settings{"ipaddr"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | || $cgiparams{typekey} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | || !$cgiparams{loopback} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | || $cgiparams{loopback} ne $settings{ipaddr}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | $tvars{thanks} = 3; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | ▶ | $cgiparams{publish} = $check == ALLOW ? 3 : 2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | # Strip out HTML unless we are allowing it. The process_html | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | # sub should take care of everything. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | for(keys %fields) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | ▶ | if($fields{$_}->{html} == 1) { $cgiparams{$_} = CleanHTML($cgiparams{$_}); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | elsif($fields{$_}->{html} == 2) { $cgiparams{$_} = SafeHTML($cgiparams{$_}); } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | #$cgiparams{comments} = LinkSpam($cgiparams{comments}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | # $cgiparams{guestpass} = '' unless(lc($cgiparams{guestpass}) eq 'rubery'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 0 | ▶ | return if FieldCheck(\@allfields,\@mandatory); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | $tvars{data}->{'url'} = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | $tvars{data}->{email} = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | my @fields = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | $tvars{data}->{realname}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | $tvars{data}->{email}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | $tvars{data}->{url}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | $tvars{data}->{city}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | $tvars{data}->{country}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | $tvars{data}->{comments}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | time(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | $tvars{data}->{publish}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | $settings{ipaddr} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | $dbi->DoQuery('SaveGuestbook',@fields); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | $hits->SetUpdates('guest',0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | $tvars{thanks} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | #---------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | # Admistration Interface Functions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | sub List { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | ▶ | return unless AccessUser(EDITOR); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
List: not called CC=5 SCAR=34.0
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | my @rs = $dbi->GetQuery('hash','ListAllGuestbook'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | foreach my $row (@rs) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | $row->{createdate} = formatDate(18,$row->{createdate}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | ▶ | if(length($row->{comments}) > 100) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | $row->{comments} = substr($row->{comments},0,97); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | $row->{comments} .= '...'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | ▶ | if(@rs) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | $tvars{records} = \@rs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | $tvars{count} = scalar(@rs); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | $tvars{count} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | sub MultiBlock { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | ▶ | return unless AccessUser(ADMIN); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
MultiBlock: not called CC=5 SCAR=34.0
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | ▶ | return unless($cgiparams{pattern}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 0 | my @ids; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | my @rs = $dbi->GetQuery('hash','GetGuestbookByText','%'.$cgiparams{pattern}.'%'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | for my $rs (@rs) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | BlockIP($rs->{author},$rs->{ipaddr}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 0 | push @ids, $rs->{'entryid'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | LogDebug('MultiBlock:' . scalar(@ids)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | ▶ | $dbi->DoQuery('DeleteGuestbook',{ids => join(',',@ids)}) if(@ids); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | $tvars{thanks} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | sub Block { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | ▶ | return unless AccessUser(ADMIN); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Block: not called CC=4 SCAR=30.0
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | ▶ | return unless AuthorCheck('GetGuestbookByID','entryid',ADMIN); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | BlockIP($tvars{data}->{author},$tvars{data}->{ipaddr}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | my @rows = $dbi->GetQuery('hash','GetGuestbookByIP',$tvars{data}->{ipaddr}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | ▶ | return unless(@rows); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | my @ids = map {$_->{'entryid'}} @rows; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | $dbi->DoQuery('DeleteGuestbook',{ids => join(',',@ids)}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | $tvars{thanks} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | sub Allow { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | ▶ | return unless AccessUser(ADMIN); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Allow: not called CC=4 SCAR=30.0
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | ▶ | return unless AuthorCheck('GetGuestbookByID','entryid',ADMIN); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | AllowIP($tvars{data}->{author},$tvars{data}->{ipaddr}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | my @rows = $dbi->GetQuery('hash','GetGuestbookByIP',$tvars{data}->{ipaddr}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | ▶ | return unless(@rows); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | my @ids = map {$_->{'entryid'}} @rows; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | $dbi->DoQuery('AcceptGuestbook',{ids => join(',',@ids)}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | $tvars{thanks} = 2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | sub Approve { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | ▶ | return unless AccessUser(ADMIN); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Approve: not called CC=3 SCAR=24.8
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | my @ids = ($cgiparams{entryid}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | ▶ | return unless(@ids); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | $dbi->DoQuery('AcceptGuestbook',{ids => join(',',@ids)}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | $tvars{thanks} = 3; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | sub Delete { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | ▶ | return unless AccessUser(ADMIN); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Delete: not called CC=3 SCAR=24.8
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | my @ids = ($cgiparams{entryid}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 0 | ▶ | return unless(@ids); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 0 | $dbi->DoQuery('DeleteGuestbook',{ids => join(',',@ids)}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | $tvars{thanks} = 4; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | sub Edit { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 0 | ▶ | return unless AccessUser(EDITOR); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Edit: not called CC=3 SCAR=24.8
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 0 | ▶ | return unless AuthorCheck('GetGuestbookByID','entryid',EDITOR); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | sub Update { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 0 | ▶ | return unless AccessUser(EDITOR); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Update: not called CC=7 SCAR=40.3
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | ▶ | return unless AuthorCheck('GetGuestbookByID','entryid',EDITOR); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | # Strip out HTML unless we are allowing it. The process_html | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | # sub should take care of everything. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 0 | for(keys %fields) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 0 | ▶ | if($fields{$_}->{html} == 1) { $cgiparams{$_} = CleanHTML($cgiparams{$_}); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | elsif($fields{$_}->{html} == 2) { $cgiparams{$_} = SafeHTML($cgiparams{$_}); } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | #$cgiparams{comments} = LinkSpam($cgiparams{comments}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | ▶ | return if FieldCheck(\@allfields,\@mandatory); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | $tvars{data}->{'url'} = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 0 | $tvars{data}->{email} = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | $dbi->DoQuery( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 'UpdateGuestbook', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | $tvars{data}->{realname}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | $tvars{data}->{email}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | $tvars{data}->{url}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | $tvars{data}->{city}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | $tvars{data}->{country}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | $tvars{data}->{comments}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | $cgiparams{entryid}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 0 | $tvars{thanks} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 5 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | =head1 PUBLIC INTERFACE METHODS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | =item * Read | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | Lists all the publicly visable posts. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | =item * Save | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | Save a message to be moderated. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | =head1 ADMIN INTERFACE METHODS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | =head2 MP3s Methods | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | =item * List | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | List and manage/moderate messages posted to the guestbook. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | =item * MultiBlock | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | Block the IPs and delete messages based on content. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | =item * Block | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | Block the IP of a single and delete it. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | =item * Allow | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | Allow the IP of a message, and approve all messages with this IP. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | =item * Approve | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | Approve a single message, ignoring the IP. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | =item * Delete | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | Delete a single message, ignoring the IP. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | =item * Edit | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | Edit a post. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | =item * Update | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | Validates the fields returned from the edit page, and saves the record back to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | the database. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | =head1 SEE ALSO | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | Labyrinth | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | Barbie, <barbie@missbarbell.co.uk> for | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | Miss Barbell Productions, L<http://www.missbarbell.co.uk/> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | =head1 COPYRIGHT & LICENSE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | Copyright (C) 2002-2015 Barbie for Miss Barbell Productions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | All Rights Reserved. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | This distribution is free software; you can redistribute it and/or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | modify it under the Artistic License 2.0. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||