| 1 | package Labyrinth::Plugin::Articles::Diary; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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 | 5 | $VERSION = '1.05'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | Labyrinth::Plugin::Articles::Diary - Diary plugin for Labyrinth framework | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | Contains all the diary handling functionality for Labyrinth. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | # ------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | # Library Modules | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 5 | ▶ | use base qw(Labyrinth::Plugin::Articles); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 5 | ▶ | use Clone qw(clone); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 5 | ▶ | use Time::Local; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | #use Data::Dumper; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 5 | ▶ | use Labyrinth::Audit; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 5 | ▶ | use Labyrinth::DBUtils; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 5 | ▶ | use Labyrinth::DTUtils; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 5 | ▶ | use Labyrinth::Globals; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 5 | ▶ | use Labyrinth::IPAddr; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 5 | ▶ | use Labyrinth::Metadata; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 5 | ▶ | use Labyrinth::MLUtils; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 5 | ▶ | use Labyrinth::Session; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 5 | ▶ | use Labyrinth::Support; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 5 | ▶ | use Labyrinth::Variables; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 5 | ▶ | use Labyrinth::Writer; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | # ------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | # Variables | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | # type: 0 = optional, 1 = mandatory | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | # html: 0 = none, 1 = text, 2 = textarea | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 5 | my %fields = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | articleid => { type => 0, html => 0 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | quickname => { type => 1, html => 0 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | title => { type => 1, html => 1 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 5 | my (@mandatory,@allfields); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 5 | for(keys %fields) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 15 | ▶ | push @mandatory, $_ if($fields{$_}->{type}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 15 | push @allfields, $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 5 | my $LEVEL = ADMIN; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 5 | my $SECTIONID = 6; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 5 | my %cfields = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | articleid => { type => 0, html => 0 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | commentid => { type => 0, html => 0 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | subject => { type => 0, html => 1 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | body => { type => 1, html => 3 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | author => { type => 1, html => 1 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | href => { type => 0, html => 1 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | publish => { type => 0, html => 0 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 5 | my (@cmandatory,@callfields); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 5 | for(keys %cfields) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 35 | ▶ | push @cmandatory, $_ if($cfields{$_}->{type}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 35 | push @callfields, $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 5 | my ($BLOCK,$ALLOW) = (1,2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | # ------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | # Public Methods | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | =head1 PUBLIC INTERFACE METHODS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | =item Archive | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | Retrieves a list of archived diary entries | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | =item Page | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | Retrieves an set of diary entries, for a given page. Default to first page. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | =item List | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | Retrieves an initial list of diary entries. Primarily used to prepare a front | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | page. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | =item Meta | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | Retrieves a list of diary entries based on given meta tags. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | =item Search | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | Retrieves a list of diary entries based on a given search string. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | =item Cloud | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | Provides the current tag cloud. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | =item Item | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | Provides a single diary entry. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | =item Comment | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | Allow a user to submit a comment. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | =item LatestComments | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | Retrieve the most recent comments, for use in a side panel or similar. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | =item Posted | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | Number of posts posted by the given writer. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | sub Archive { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | ▶ | my $oldid = $cgiparams{sectionid}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Archive: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | $cgiparams{sectionid} = $SECTIONID; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | $cgiparams{section} = 'diary'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | shift->SUPER::Archive(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | $tvars{articles} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | $cgiparams{sectionid} = $oldid; # reset | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | sub Page { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | ▶ | return List() if($cgiparams{volume}); # volumes need to be handled by the List function | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Page: not called CC=2 SCAR=17.9
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | $cgiparams{sectionid} = $SECTIONID; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | $settings{data}{article_pageset} = $settings{diary_pageset}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | shift->SUPER::Page(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | _count_comments(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | sub List { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | ▶ | $cgiparams{sectionid} = $SECTIONID; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
List: not called CC=8 SCAR=42.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | $settings{data}{article_limit} = $settings{diary_limit}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | $settings{data}{article_stop} = $settings{diary_stop}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | ▶ | if($cgiparams{volume}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | $settings{where} = 'createdate > ' . _vol2date($cgiparams{volume}) . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | ' AND createdate < ' . _vol2date($cgiparams{volume} + 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | shift->SUPER::List(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | _count_comments(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | # see if we can do next and previous | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | my $this = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | ▶ | if($cgiparams{volume}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | for my $vol (@{$tvars{archive}{diary}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | ▶ | if($cgiparams{volume} == $vol->{volumeid}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | $this = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | ▶ | $tvars{archive}{volumes}{prev} = $vol if(!$this); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | ▶ | $tvars{archive}{volumes}{next} ||= $vol if($this); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$Labyrinth::Plugin::Articles::Diary::tvars{"archive"}{"volumes"}{"next"} ||= $vol
MC/DC0%0/2
$Labyrinth::Plugin::Articles::Diary::tvars{"archive"}{"volumes"}{"next"} ||= $vol
$Labyrinth::Plugin::Articles::Diary::tvars{"archive"}{"volumes"}{"next"}
$vol
Truth table0%0/3
A ||= B
A= $Labyrinth::Plugin::Articles::Diary::tvars{"archive"}{"volumes"}{"next"}B= $vol
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | sub Meta { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | ▶ | return unless($cgiparams{data}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Meta: not called CC=2 SCAR=17.9
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | my $oldid = $cgiparams{sectionid}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | $cgiparams{sectionid} = $SECTIONID; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | $settings{data}{article_limit} = $settings{diary_limit}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | $settings{data}{article_stop} = $settings{diary_stop}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | shift->SUPER::Meta(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | _count_comments(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | $cgiparams{sectionid} = $oldid; # reset | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | sub Cloud { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | ▶ | my $oldid = $cgiparams{sectionid}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Cloud: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | $cgiparams{sectionid} = $SECTIONID; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | $cgiparams{actcode} = 'diary-meta'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | shift->SUPER::Cloud(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | $cgiparams{sectionid} = $oldid; # reset | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | sub Search { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | ▶ | return unless($cgiparams{data}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Search: not called CC=2 SCAR=17.9
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | my $oldid = $cgiparams{sectionid}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | $cgiparams{sectionid} = $SECTIONID; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 0 | $settings{data}{article_limit} = $settings{diary_limit}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 0 | $settings{data}{article_stop} = $settings{diary_stop}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | shift->SUPER::Search(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | _count_comments(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | $cgiparams{sectionid} = $oldid; # reset | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | sub Item { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | ▶ | my $oldid = $cgiparams{sectionid}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Item: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 0 | $cgiparams{sectionid} = $SECTIONID; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 0 | shift->SUPER::Item(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | $tvars{diary} = $tvars{article}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | my @rows = $dbi->GetQuery('hash','GetDiaryComments',$tvars{diary}->{data}->{articleid}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | for(@rows) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | $_->{postdate} = formatDate(6,$_->{createdate}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | $tvars{comments} = \@rows; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | $cgiparams{sectionid} = $oldid; # reset | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | sub Comment { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | ▶ | my $check = CheckIP(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Comment: not called CC=14 SCAR=53.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 0 | ▶ | if( $check == $BLOCK | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/9
$check == $BLOCK or $Labyrinth::Plugin::Articles::Diary::cgiparams{"typekey"} or not $Labyrinth::Plugin::Articles::Diary::cgiparams{"loopback"} or $Labyrinth::Plugin::Articles::Diary::cgiparams{"loopback"} ne $Labyrinth::Plugin::Articles::Diary::settings{"ipaddr"}
$check == $BLOCK or $Labyrinth::Plugin::Articles::Diary::cgiparams{"typekey"} or not $Labyrinth::Plugin::Articles::Diary::cgiparams{"loopback"}
$check == $BLOCK or $Labyrinth::Plugin::Articles::Diary::cgiparams{"typekey"}
MC/DC0%0/4
$check == $BLOCK or $Labyrinth::Plugin::Articles::Diary::cgiparams{"typekey"} or not $Labyrinth::Plugin::Articles::Diary::cgiparams{"loopback"} or $Labyrinth::Plugin::Articles::Diary::cgiparams{"loopback"} ne $Labyrinth::Plugin::Articles::Diary::settings{"ipaddr"}
$check == $BLOCK
$Labyrinth::Plugin::Articles::Diary::cgiparams{"typekey"}
not $Labyrinth::Plugin::Articles::Diary::cgiparams{"loopback"}
$Labyrinth::Plugin::Articles::Diary::cgiparams{"loopback"} ne $Labyrinth::Plugin::Articles::Diary::settings{"ipaddr"}
Truth table0%0/5
A or B or not(C) or D
A= $check == $BLOCKB= $Labyrinth::Plugin::Articles::Diary::cgiparams{"typekey"}C= not $Labyrinth::Plugin::Articles::Diary::cgiparams{"loopback"}D= $Labyrinth::Plugin::Articles::Diary::cgiparams{"loopback"} ne $Labyrinth::Plugin::Articles::Diary::settings{"ipaddr"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | || $cgiparams{typekey} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | || !$cgiparams{loopback} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | || $cgiparams{loopback} ne $settings{ipaddr}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 0 | $tvars{thanks} = 3; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | # print STDERR "COMMENT SPAM ALERT:\n" . Dumper(\%cgiparams); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 0 | ▶ | $cgiparams{publish} = $check == $ALLOW ? 3 : 2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 0 | for(keys %cfields) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 0 | ▶ | next unless($cfields{$_}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 0 | ▶ | if($cfields{$_}->{html} == 1) { $cgiparams{$_} = CleanHTML($cgiparams{$_}) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 0 | elsif($cfields{$_}->{html} == 2) { $cgiparams{$_} = CleanTags($cgiparams{$_}) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 0 | elsif($cfields{$_}->{html} == 3) { $cgiparams{$_} = CleanTags($cgiparams{$_}) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | ▶ | return if FieldCheck(\@callfields,\@cmandatory); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | ▶ | if($tvars{data}->{subject} eq 'ARRAY(0x84fb748)') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | # print STDERR "COMMENT SPAM ALERT:\n" . Dumper(\%cgiparams); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | $tvars{thanks} = 3; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | my @fields = ( $tvars{data}->{articleid}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | $tvars{data}->{subject}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | formatDate(), # create date | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | $tvars{data}->{body}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | $tvars{data}->{author}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | $tvars{data}->{href}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | $tvars{data}->{publish}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | $settings{ipaddr} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 0 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 0 | $dbi->IDQuery('AddComment',@fields); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | ▶ | $tvars{thanks} = $check == $ALLOW ? 2 : 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | sub LatestComments { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 0 | ▶ | my @rows = $dbi->GetQuery('hash','GetCommentsLatest'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
LatestComments: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 0 | $tvars{latest}->{comments} = \@rows; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | sub Posted { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 0 | ▶ | return unless($cgiparams{'userid'}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Posted: not called CC=3 SCAR=24.8
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | my @rows = $dbi->GetQuery('array','CountPosts',$cgiparams{'userid'}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 0 | ▶ | $tvars{data}{posts} = @rows ? $rows[0]->[0] : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | # ------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | # Admin Methods | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | =head1 ADMIN INTERFACE METHODS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | =item Access | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | Check whether user has the appropriate admin access. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | =item Admin | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | Lists the current set of diary entries. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | Also provides the delete, copy and promote functionality from the main | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | administration page for the given section. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | =item Add | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | Add a diary entry. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | =item Edit | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | Edit a diary entry. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | =item Save | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | Save a diary entry. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | =item Delete | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | Delete a diary entry. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | =item ListComment | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | List current unpublished comments. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | =item EditComment | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | Edit a given comment. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | =item SaveComment | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | Save a given comment. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | =item PromoteComment | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | Promote a given comment. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | =item DeleteComment | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | Delete a given comment. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | =item MarkIP | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | Mark matching comments as appropriate. Actions are block and allow. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 0 | ▶ | sub Access { Authorised($LEVEL) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Access: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | sub Admin { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 0 | ▶ | return unless AccessUser($LEVEL); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Admin: not called CC=4 SCAR=30.0
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 0 | $cgiparams{sectionid} = $SECTIONID; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | 0 | shift->SUPER::Admin(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 0 | for my $article (@{ $tvars{data} }) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 0 | my @rows = $dbi->GetQuery('array','CountDiaryComments',{ids => $article->{articleid}}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | 0 | ▶ | $article->{comments} = @rows ? $rows[0]->[1] : ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | sub Add { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | 0 | ▶ | return unless AccessUser($LEVEL); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Add: not called CC=2 SCAR=17.9
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | 0 | $cgiparams{sectionid} = $SECTIONID; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 0 | $self->SUPER::Add(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 0 | $self->SUPER::Tags(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | sub Edit { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 0 | ▶ | return unless AccessUser($LEVEL); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Edit: not called CC=4 SCAR=30.0
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 0 | $cgiparams{sectionid} = $SECTIONID; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 0 | $self->SUPER::Edit(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 0 | $self->SUPER::Tags(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 0 | my @rows = $dbi->GetQuery('hash','GetDiaryComments',$tvars{article}->{data}->{articleid}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 0 | for(@rows) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 0 | $_->{postdate} = formatDate(6,$_->{createdate}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | 0 | $tvars{articles}->{$tvars{primary}}->{data}{comments} = scalar(@rows); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | 0 | ▶ | $tvars{comments} = \@rows if(@rows); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | sub Save { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | 0 | ▶ | return unless AccessUser($LEVEL); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Save: not called CC=2 SCAR=17.9
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | 0 | $cgiparams{sectionid} = $SECTIONID; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | 0 | $cgiparams{quickname} = formatDate(0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 0 | shift->SUPER::Save(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | sub Delete { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | 0 | ▶ | return unless AccessUser($LEVEL); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Delete: not called CC=2 SCAR=17.9
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 0 | $cgiparams{sectionid} = $SECTIONID; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | 0 | shift->SUPER::Delete(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | sub ListComment { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | 0 | ▶ | return unless AccessUser($LEVEL); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ListComment: not called CC=13 SCAR=52.0
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | 0 | my (@rows); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 0 | ▶ | if($cgiparams{pattern}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | 0 | @rows = $dbi->GetQuery('hash','GetCommentMatches','%'.$cgiparams{pattern}.'%'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | 0 | for my $row (@rows) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 0 | BlockIP($row->{author},$row->{ipaddr}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | 0 | $dbi->DoQuery('DeleteComment',$row->{'commentid'}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | 0 | @rows = $dbi->GetQuery('hash','GetAdminCommentIDs'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | 0 | ▶ | my $start = $cgiparams{start} || 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$Labyrinth::Plugin::Articles::Diary::cgiparams{'start'} || 1
MC/DC0%0/1
$Labyrinth::Plugin::Articles::Diary::cgiparams{'start'} || 1
$Labyrinth::Plugin::Articles::Diary::cgiparams{'start'}
Truth table0%0/2
A
A= $Labyrinth::Plugin::Articles::Diary::cgiparams{'start'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | 0 | ▶ | my $limit = $cgiparams{limit} || $settings{comment_limit} || 100; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/5
$Labyrinth::Plugin::Articles::Diary::cgiparams{'limit'} || $Labyrinth::Plugin::Articles::Diary::settings{'comment_limit'} || 100
$Labyrinth::Plugin::Articles::Diary::cgiparams{"limit"} or $Labyrinth::Plugin::Articles::Diary::settings{"comment_limit"}
MC/DC0%0/2
$Labyrinth::Plugin::Articles::Diary::cgiparams{'limit'} || $Labyrinth::Plugin::Articles::Diary::settings{'comment_limit'} || 100
$Labyrinth::Plugin::Articles::Diary::cgiparams{"limit"}
$Labyrinth::Plugin::Articles::Diary::settings{"comment_limit"}
Truth table0%0/3
A or B
A= $Labyrinth::Plugin::Articles::Diary::cgiparams{"limit"}B= $Labyrinth::Plugin::Articles::Diary::settings{"comment_limit"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | 0 | my $last = int(scalar(@rows) / $limit); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | 0 | my $max = scalar(@rows); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | 0 | LogDebug("start=$start, limit=$limit, last=$last, max=$max"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | 0 | ▶ | if(@rows) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | 0 | my $count = ($start-1) * $limit; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | 0 | ▶ | splice(@rows,0,$count) if($count > 0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | 0 | ▶ | splice(@rows,$limit) if(@rows > $limit); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | 0 | my $ids = join(',',map {$_->{commentid}} @rows); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 0 | @rows = $dbi->GetQuery('hash','GetAdminComments',{ ids => $ids }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | 0 | for(@rows) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | 0 | $_->{postdate} = formatDate(17,$_->{createdate}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | 0 | $tvars{comments} = \@rows; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | 0 | my ($prev,$next) = ($start-1,$start+1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | 0 | ▶ | $prev = 1 if($prev < 1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | 0 | ▶ | $next = $last if($next > $last); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | 0 | $tvars{page}{prev} = $prev; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | 0 | $tvars{page}{start} = $start; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 0 | $tvars{page}{next} = $next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 0 | $tvars{page}{last} = $last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | 0 | $tvars{page}{limit} = $limit; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | 0 | $tvars{page}{comments} = $max; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | sub EditComment { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | 0 | ▶ | return unless AuthorCheck('GetCommentByID','commentid',$LEVEL); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
EditComment: not called CC=2 SCAR=17.9
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | 0 | $tvars{comment} = $tvars{data}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | 0 | $tvars{comment}->{postdate} = formatDate(17,$tvars{comment}->{createdate}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | 0 | $tvars{comment}->{ddpublish} = PublishSelect($tvars{comment}->{publish}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | sub SaveComment { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | 0 | ▶ | return unless AuthorCheck('GetCommentByID','commentid',$LEVEL); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
SaveComment: not called CC=9 SCAR=45.0
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | 0 | for(keys %cfields) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | 0 | ▶ | next unless($cfields{$_}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | 0 | ▶ | if($cfields{$_}->{html} == 1) { $cgiparams{$_} = CleanHTML($cgiparams{$_}) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | 0 | elsif($cfields{$_}->{html} == 2) { $cgiparams{$_} = CleanTags($cgiparams{$_}) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | 0 | elsif($cfields{$_}->{html} == 3) { $cgiparams{$_} = CleanTags($cgiparams{$_}) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | 0 | ▶ | return if FieldCheck(\@callfields,\@cmandatory); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | 0 | ▶ | $tvars{data}->{publish} ||= 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$Labyrinth::Plugin::Articles::Diary::tvars{"data"}{"publish"} ||= 1
MC/DC0%0/1
$Labyrinth::Plugin::Articles::Diary::tvars{"data"}{"publish"} ||= 1
$Labyrinth::Plugin::Articles::Diary::tvars{"data"}{"publish"}
Truth table0%0/2
A
A= $Labyrinth::Plugin::Articles::Diary::tvars{"data"}{"publish"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | my @fields = ( $tvars{data}->{subject}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | $tvars{data}->{body}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | $tvars{data}->{author}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | $tvars{data}->{href}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | $tvars{data}->{publish}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | $tvars{data}->{commentid} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | 0 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | 0 | $dbi->IDQuery('SaveComment',@fields); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | sub PromoteComment { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | 0 | ▶ | return unless AuthorCheck('GetCommentByID','commentid',$LEVEL); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
PromoteComment: not called CC=2 SCAR=17.9
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | 0 | $dbi->DoQuery('PromoteComment',$tvars{data}->{publish}+1,$cgiparams{'commentid'}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | sub DeleteComment { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | 0 | ▶ | return unless AuthorCheck('GetCommentByID','commentid',$LEVEL); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
DeleteComment: not called CC=2 SCAR=17.9
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | 0 | $dbi->DoQuery('DeleteComment',$cgiparams{'commentid'}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | sub MarkIP { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | 0 | ▶ | return unless AuthorCheck('GetCommentByID','commentid',$LEVEL); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
MarkIP: not called CC=8 SCAR=42.8
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | 0 | ▶ | return unless $cgiparams{mark}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | 0 | ▶ | my $mark = $cgiparams{mark} eq 'allow' ? 2 : 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | 0 | ▶ | if($mark == 2) { AllowIP($tvars{data}->{author},$tvars{data}->{ipaddr}) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | 0 | else { BlockIP($tvars{data}->{author},$tvars{data}->{ipaddr}) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | 0 | my @rows = $dbi->GetQuery('hash','GetAdminCommentByIP',$tvars{data}->{ipaddr}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 0 | for my $row (@rows) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | 0 | ▶ | next unless($row->{ipaddr} eq $tvars{data}->{ipaddr}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | 0 | ▶ | if($mark == 2) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | 0 | $dbi->DoQuery('PromoteComment',$tvars{data}->{publish}+1,$row->{'commentid'}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | 0 | $dbi->DoQuery('DeleteComment',$row->{'commentid'}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | # ------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | # Private Methods | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | sub _count_comments { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | 0 | ▶ | my $type = shift || 'mainarts'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_count_comments: not called CC=6 SCAR=37.4
Condition0%0/2
shift() || 'mainarts'
MC/DC0%0/1
shift() || 'mainarts'
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | 0 | ▶ | return unless($tvars{$type} && scalar(@{$tvars{$type}})); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$Labyrinth::Plugin::Articles::Diary::tvars{$type} and scalar @{$Labyrinth::Plugin::Articles::Diary::tvars{$type};}
MC/DC0%0/1
$Labyrinth::Plugin::Articles::Diary::tvars{$type} and scalar @{$Labyrinth::Plugin::Articles::Diary::tvars{$type};}
$Labyrinth::Plugin::Articles::Diary::tvars{$type}
Truth table0%0/2
A
A= $Labyrinth::Plugin::Articles::Diary::tvars{$type}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | 0 | my $ids = join(',', map {$_->{data}{articleid}} @{$tvars{$type}}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | 0 | my @rows = $dbi->GetQuery('array','CountDiaryComments',{ids => $ids}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | 0 | my %rows = map {$_->[0] => $_->[1]} @rows; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | 0 | for my $item (@{$tvars{$type}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | 0 | ▶ | $item->{comments} = $rows{$item->{data}{articleid}} || 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$rows{$item->{'data'}{'articleid'}} || 0
MC/DC0%0/1
$rows{$item->{'data'}{'articleid'}} || 0
$rows{$item->{'data'}{'articleid'}}
Truth table0%0/2
A
A= $rows{$item->{'data'}{'articleid'}}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | sub _vol2date { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | 0 | ▶ | my ($year,$mon) = $_[0] =~ /^(\d{4})(\d{2})/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_vol2date: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | 0 | ▶ | if($mon == 13) { $year++;$mon=1; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | 0 | return timegm(0,0,0,1,$mon-1,$year); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | 5 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | =head1 SEE ALSO | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | L<Labyrinth> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | Barbie, <barbie@missbarbell.co.uk> for | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | Miss Barbell Productions, L<http://www.missbarbell.co.uk/> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | =head1 COPYRIGHT & LICENSE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | Copyright (C) 2002-2014 Barbie for Miss Barbell Productions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | All Rights Reserved. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | This module is free software; you can redistribute it and/or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | modify it under the Artistic License 2.0. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||