| 1 | package Labyrinth::Plugin::Album::Photos; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 3 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||
| 6 | 3 | our $VERSION = '1.12'; | |||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||
| 10 | Labyrinth::Plugin::Album::Photos - Photo album photos handler for Labyrinth | ||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||
| 14 | Contains all the photo album handling functionality for the Labyrinth | ||||||||||||||||||||||||||||||||||||||||||
| 15 | framework. | ||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||
| 17 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||
| 19 | #---------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 20 | # Libraries | ||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||
| 22 | 3 | ▶ | use base qw(Labyrinth::Plugin::Base); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||
| 24 | 3 | ▶ | use Image::Size; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||
| 26 | 3 | ▶ | use Labyrinth::Audit; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 27 | 3 | ▶ | use Labyrinth::DBUtils; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 28 | 3 | ▶ | use Labyrinth::DTUtils; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 29 | 3 | ▶ | use Labyrinth::Media; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 30 | 3 | ▶ | use Labyrinth::MLUtils; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 31 | 3 | ▶ | use Labyrinth::Support; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 32 | 3 | ▶ | use Labyrinth::Variables; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||
| 34 | 3 | ▶ | use Labyrinth::Plugin::Hits; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||
| 36 | #---------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 37 | # Variables | ||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||
| 39 | # type: 0 = optional, 1 = mandatory | ||||||||||||||||||||||||||||||||||||||||||
| 40 | # html: 0 = none, 1 = text, 2 = textarea | ||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||
| 42 | 3 | my %fields = ( | |||||||||||||||||||||||||||||||||||||||||
| 43 | photoid => { type => 1, html => 0 }, | ||||||||||||||||||||||||||||||||||||||||||
| 44 | pageid => { type => 0, html => 0 }, | ||||||||||||||||||||||||||||||||||||||||||
| 45 | thumb => { type => 0, html => 0 }, | ||||||||||||||||||||||||||||||||||||||||||
| 46 | image => { type => 0, html => 0 }, | ||||||||||||||||||||||||||||||||||||||||||
| 47 | tagline => { type => 0, html => 1 }, | ||||||||||||||||||||||||||||||||||||||||||
| 48 | summary => { type => 0, html => 2 }, | ||||||||||||||||||||||||||||||||||||||||||
| 49 | hide => { type => 0, html => 0 }, | ||||||||||||||||||||||||||||||||||||||||||
| 50 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||
| 52 | 3 | my (@mandatory,@allfields); | |||||||||||||||||||||||||||||||||||||||||
| 53 | 3 | for(keys %fields) { | |||||||||||||||||||||||||||||||||||||||||
| 54 | 21 | ▶ | push @mandatory, $_ if($fields{$_}->{type}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 55 | 21 | push @allfields, $_; | |||||||||||||||||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||
| 58 | 3 | my $LEVEL = EDITOR; | |||||||||||||||||||||||||||||||||||||||||
| 59 | 3 | my $INDEXKEY = 'photoid'; | |||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||
| 61 | 3 | my $hits = Labyrinth::Plugin::Hits->new(); | |||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||
| 63 | #---------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 64 | # Public Interface Functions | ||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||
| 66 | =head1 PUBLIC INTERFACE METHODS | ||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||
| 68 | =head2 Public Methods | ||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||
| 70 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||
| 72 | =item List | ||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||
| 74 | Provides a list of all the public photos within a given photo album. | ||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||
| 76 | =item View | ||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||
| 78 | Returns details of a specific photo. | ||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||
| 80 | =item Random | ||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||
| 82 | Stores random images in the $tvars{"irand$inx"} template variable array. | ||||||||||||||||||||||||||||||||||||||||||
| 83 | Number of images stored is determined for configuration settings variable, | ||||||||||||||||||||||||||||||||||||||||||
| 84 | 'random'. If not set, will default to 1 image. | ||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||
| 86 | =item Gallery | ||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||
| 88 | Provides a set of images to be used within a gallery pop-up window. Assumes | ||||||||||||||||||||||||||||||||||||||||||
| 89 | a 3x3 grid of nine images. Includes links for prev & next to further gallery | ||||||||||||||||||||||||||||||||||||||||||
| 90 | images. | ||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||
| 92 | Images returned are determined by the given metadata. | ||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||
| 94 | =item Albums | ||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||
| 96 | Retrieve a collection of albums and their photos. This is particularly useful | ||||||||||||||||||||||||||||||||||||||||||
| 97 | when multiple galleries are being displayed. The results are stored in the | ||||||||||||||||||||||||||||||||||||||||||
| 98 | template variable $tvars{albums}{<album id>}{records}, as an array of the | ||||||||||||||||||||||||||||||||||||||||||
| 99 | photos, as per the List method. | ||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||
| 101 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||
| 103 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | ▶ | sub List { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
List: not called CC=13 SCAR=52.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | my ($pageid,@rs); | |||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | ▶ | if($cgiparams{'pid'} || $cgiparams{'pageid'}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
$Labyrinth::Plugin::Album::Photos::cgiparams{"pid"} or $Labyrinth::Plugin::Album::Photos::cgiparams{"pageid"}
MC/DC0%0/2
$Labyrinth::Plugin::Album::Photos::cgiparams{"pid"} or $Labyrinth::Plugin::Album::Photos::cgiparams{"pageid"}
$Labyrinth::Plugin::Album::Photos::cgiparams{"pid"}
$Labyrinth::Plugin::Album::Photos::cgiparams{"pageid"}
Truth table0%0/3
A or B
A= $Labyrinth::Plugin::Album::Photos::cgiparams{"pid"}B= $Labyrinth::Plugin::Album::Photos::cgiparams{"pageid"}
| |||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | ▶ | $pageid = $cgiparams{'pid'} || $cgiparams{'pageid'}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$Labyrinth::Plugin::Album::Photos::cgiparams{'pid'} || $Labyrinth::Plugin::Album::Photos::cgiparams{'pageid'}
MC/DC0%0/2
$Labyrinth::Plugin::Album::Photos::cgiparams{'pid'} || $Labyrinth::Plugin::Album::Photos::cgiparams{'pageid'}
$Labyrinth::Plugin::Album::Photos::cgiparams{'pid'}
$Labyrinth::Plugin::Album::Photos::cgiparams{'pageid'}
Truth table0%0/3
A || B
A= $Labyrinth::Plugin::Album::Photos::cgiparams{'pid'}B= $Labyrinth::Plugin::Album::Photos::cgiparams{'pageid'}
| |||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | @rs = $dbi->GetQuery('hash','GetPage',$pageid); | |||||||||||||||||||||||||||||||||||||||||
| 110 | } elsif($cgiparams{'path'}) { | ||||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | @rs = $dbi->GetQuery('hash','GetPageByPath',"photos/$cgiparams{'path'}"); | |||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | ▶ | $pageid = $rs[0]->{pageid} if(@rs); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 113 | } | ||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||
| 115 | 0 | ▶ | if(@rs) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 116 | # get page details | ||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | $rs[0]->{month} = isMonth($rs[0]->{month}); | |||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | for(keys %fields) { | |||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | ▶ | if($fields{$_}->{html} == 1) { $rs[0]->{$_} = CleanHTML($rs[0]->{$_}); } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | elsif($fields{$_}->{html} == 2) { $rs[0]->{$_} = CleanTags($rs[0]->{$_}); } | |||||||||||||||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||
| 123 | 0 | $tvars{album}->{page} = $rs[0]; | |||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||
| 125 | # get photo listing | ||||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | my @recs = $dbi->GetQuery('hash','ListPhotos',$pageid); | |||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | my $orderno = 1; | |||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | for my $rec (@recs) { | |||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | ▶ | $rec->{tagline} =~ s/'/\'/g if $rec->{tagline}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | $rec->{orderno} = $orderno++; | |||||||||||||||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | ▶ | $tvars{album}->{records} = \@recs if(@recs); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | $tvars{album}->{iid} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 137 | } | ||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||
| 139 | # image page required | ||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | ▶ | sub View { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
View: not called CC=17 SCAR=57.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | ▶ | my $photoid = $cgiparams{'iid'} || $cgiparams{'photoid'}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$Labyrinth::Plugin::Album::Photos::cgiparams{'iid'} || $Labyrinth::Plugin::Album::Photos::cgiparams{'photoid'}
MC/DC0%0/2
$Labyrinth::Plugin::Album::Photos::cgiparams{'iid'} || $Labyrinth::Plugin::Album::Photos::cgiparams{'photoid'}
$Labyrinth::Plugin::Album::Photos::cgiparams{'iid'}
$Labyrinth::Plugin::Album::Photos::cgiparams{'photoid'}
Truth table0%0/3
A || B
A= $Labyrinth::Plugin::Album::Photos::cgiparams{'iid'}B= $Labyrinth::Plugin::Album::Photos::cgiparams{'photoid'}
| |||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | ▶ | unless($photoid) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | $tvars{errcode} = 'ERROR'; | |||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||
| 148 | # get photo details | ||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | my @rs = $dbi->GetQuery('hash','GetPhotoDetail',$photoid); | |||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | ▶ | unless(@rs) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | $tvars{errcode} = 'ERROR'; | |||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | ▶ | $rs[0]->{tagline} =~ s/'/\'/g if $rs[0]->{tagline}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | $tvars{photo} = $rs[0]; | |||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||
| 158 | # get page details | ||||||||||||||||||||||||||||||||||||||||||
| 159 | 0 | my $pageid = $rs[0]->{pageid}; | |||||||||||||||||||||||||||||||||||||||||
| 160 | 0 | @rs = $dbi->GetQuery('hash','GetPage',$pageid); | |||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | ▶ | unless(@rs) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | $tvars{errcode} = 'ERROR'; | |||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | $rs[0]->{month} = isMonth($rs[0]->{month}); | |||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | for(keys %fields) { | |||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | ▶ | if($fields{$_}->{html} == 1) { $rs[0]->{$_} = CleanHTML($rs[0]->{$_}); } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | elsif($fields{$_}->{html} == 2) { $rs[0]->{$_} = CleanTags($rs[0]->{$_}); } | |||||||||||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | $tvars{page} = $rs[0]; | |||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | my ($orderno,$this,@order) = (0,0); | |||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | @rs = $dbi->GetQuery('hash','ListPhotos',$pageid); | |||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | for my $row (@rs) { | |||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | ▶ | $this = $orderno if($row->{photoid} eq $photoid); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | push @order, $row->{photoid}; | |||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | $orderno++; | |||||||||||||||||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | ▶ | $tvars{photo}->{prev} = $order[$this-1] unless($this == 0); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | ▶ | $tvars{photo}->{next} = $order[$this+1] unless($this == $#order); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | $tvars{ddmonths} = MonthSelect($tvars{month}); | |||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | $tvars{ddyears} = YearSelect($tvars{years}); | |||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | $tvars{today} = formatDate(7); | |||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||
| 188 | # Get the size of image | ||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | ▶ | if($tvars{photo}->{dimensions}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | my ($size_x) = split("x",$tvars{photo}->{dimensions}); | |||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | ▶ | $tvars{photo}->{toobig} = 1 if($size_x > $tvars{maxpicwidth}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 192 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | my $file = "$settings{webdir}/photos/$tvars{photo}->{image}"; | |||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | ▶ | if(-f $file) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | my ($size_x) = imgsize($file); | |||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | ▶ | $tvars{photo}->{toobig} = 1 if($size_x > $tvars{maxpicwidth}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | ▶ | sub Random { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Random: not called CC=15 SCAR=54.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | ▶ | my $count = $settings{random} || 1; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$Labyrinth::Plugin::Album::Photos::settings{'random'} || 1
MC/DC0%0/1
$Labyrinth::Plugin::Album::Photos::settings{'random'} || 1
$Labyrinth::Plugin::Album::Photos::settings{'random'}
Truth table0%0/2
A
A= $Labyrinth::Plugin::Album::Photos::settings{'random'}
| |||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | my @max = $dbi->GetQuery('array','MaxPhotoID'); | |||||||||||||||||||||||||||||||||||||||||
| 204 | 0 | ▶ | return unless(@max); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | my $max = $max[0]->[0]; | |||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | ▶ | if($max <= $count) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | foreach my $index (1..$max) { | |||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | my @rows = $dbi->GetQuery('hash','GetRandomPhoto',$index); | |||||||||||||||||||||||||||||||||||||||||
| 210 | 0 | ▶ | next unless(@rows); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 211 | 0 | $tvars{"irand$index"} = $rows[0]; | |||||||||||||||||||||||||||||||||||||||||
| 212 | } | ||||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | my (%done,@random); | |||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | srand; | |||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | while(1) { | |||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | my $index = int((rand) * $max); | |||||||||||||||||||||||||||||||||||||||||
| 220 | 0 | ▶ | next if($done{$index}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 221 | 0 | my @rows = $dbi->GetQuery('hash','GetRandomPhoto',$index); | |||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | ▶ | next unless(@rows); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||||||||||||
| 224 | # Get the size of image | ||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | ▶ | if($rows[0]->{dimensions}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | my ($size_x) = split("x",$rows[0]->{dimensions}); | |||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | ▶ | $rows[0]->{toobig} = 1 if($size_x > $tvars{randpicwidth}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 228 | } elsif($rows[0]->{image}) { | ||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | my $file = "$settings{webdir}/photos/$rows[0]->{image}"; | |||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | ▶ | if(-f $file) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 231 | 0 | my ($size_x) = imgsize($file); | |||||||||||||||||||||||||||||||||||||||||
| 232 | 0 | ▶ | $rows[0]->{toobig} = 1 if($size_x > $tvars{randpicwidth}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 233 | } | ||||||||||||||||||||||||||||||||||||||||||
| 234 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 236 | } | ||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||
| 238 | 0 | push @random, $rows[0]; | |||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | $done{$index} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 240 | 0 | ▶ | last if(@random >= $count); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 241 | } | ||||||||||||||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||||||||||||
| 243 | 0 | foreach my $inx (1..$count) { | |||||||||||||||||||||||||||||||||||||||||
| 244 | 0 | $tvars{"irand$inx"} = $random[($inx-1)]; | |||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | $tvars{"random"} = \@random; | |||||||||||||||||||||||||||||||||||||||||
| 246 | } | ||||||||||||||||||||||||||||||||||||||||||
| 247 | } | ||||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||
| 249 | 3 | my @blanks = ( | |||||||||||||||||||||||||||||||||||||||||
| 250 | { thumb=>'images/blank.png',tagline=>'' }, | ||||||||||||||||||||||||||||||||||||||||||
| 251 | { thumb=>'images/blank.png',tagline=>'' }, | ||||||||||||||||||||||||||||||||||||||||||
| 252 | { thumb=>'images/blank.png',tagline=>'' }, | ||||||||||||||||||||||||||||||||||||||||||
| 253 | { thumb=>'images/blank.png',tagline=>'' }, | ||||||||||||||||||||||||||||||||||||||||||
| 254 | { thumb=>'images/blank.png',tagline=>'' }, | ||||||||||||||||||||||||||||||||||||||||||
| 255 | { thumb=>'images/blank.png',tagline=>'' }, | ||||||||||||||||||||||||||||||||||||||||||
| 256 | { thumb=>'images/blank.png',tagline=>'' }, | ||||||||||||||||||||||||||||||||||||||||||
| 257 | { thumb=>'images/blank.png',tagline=>'' }, | ||||||||||||||||||||||||||||||||||||||||||
| 258 | { thumb=>'images/blank.png',tagline=>'' }, | ||||||||||||||||||||||||||||||||||||||||||
| 259 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||
| 261 | 0 | ▶ | sub Gallery { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Gallery: not called CC=11 SCAR=48.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 262 | 0 | ▶ | return unless AccessUser(EDITOR); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 263 | 0 | ▶ | my $start = $cgiparams{'start'} || 1; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$Labyrinth::Plugin::Album::Photos::cgiparams{'start'} || 1
MC/DC0%0/1
$Labyrinth::Plugin::Album::Photos::cgiparams{'start'} || 1
$Labyrinth::Plugin::Album::Photos::cgiparams{'start'}
Truth table0%0/2
A
A= $Labyrinth::Plugin::Album::Photos::cgiparams{'start'}
| |||||||||||||||||||||||||||||||||||||||||||
| 264 | 0 | ▶ | my $key = $cgiparams{'searchmeta'} ? 'Meta' : ''; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 265 | 0 | my $where; | |||||||||||||||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||||||||||||||||
| 267 | 0 | ▶ | if($cgiparams{'searchmeta'}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 268 | 0 | $cgiparams{'searchmeta'} =~ s/[,\s]+/,/g; | |||||||||||||||||||||||||||||||||||||||||
| 269 | 0 | $cgiparams{'searchmeta'} = join(",", map {"'$_'"} split(",",$cgiparams{'searchmeta'})); | |||||||||||||||||||||||||||||||||||||||||
| 270 | 0 | ▶ | $where .= " AND m.tag IN ($cgiparams{'searchmeta'})" if($cgiparams{'searchmeta'}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 271 | } | ||||||||||||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||||||||||||
| 273 | 0 | my @rows = $dbi->GetQuery('hash',$key.'Gallery',{where=>$where},$start); | |||||||||||||||||||||||||||||||||||||||||
| 274 | 0 | ▶ | $tvars{next} = $rows[9]->{photoid} unless(@rows < 10); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 275 | 0 | ▶ | for my $row (@rows) { $row->{thumb} = 'photos/' . $row->{thumb} unless($row->{thumb} =~ m!^images/!) } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||||||||||||||||
| 277 | 0 | push @rows, @blanks; | |||||||||||||||||||||||||||||||||||||||||
| 278 | 0 | ▶ | $tvars{data} = \@rows if(@rows); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 279 | 0 | my @prev = $dbi->GetQuery('hash',$key.'GalleryMin',{where=>$where},$start); | |||||||||||||||||||||||||||||||||||||||||
| 280 | 0 | ▶ | $tvars{prev} = $prev[8]->{photoid} unless(@prev < 9); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 281 | } | ||||||||||||||||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||||||||||||||||
| 283 | 0 | ▶ | sub Albums { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Albums: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 284 | 0 | ▶ | return unless($cgiparams{'pages'}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 285 | 0 | my @pages = split(',',$cgiparams{'pages'}); | |||||||||||||||||||||||||||||||||||||||||
| 286 | 0 | for my $page (@pages) { | |||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | $cgiparams{pageid} = $page; | |||||||||||||||||||||||||||||||||||||||||
| 288 | 0 | List(); | |||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | $tvars{albums}{$page}{records} = $tvars{album}->{records}; | |||||||||||||||||||||||||||||||||||||||||
| 290 | } | ||||||||||||||||||||||||||||||||||||||||||
| 291 | } | ||||||||||||||||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||||||||||||||||
| 293 | #---------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 294 | # Administration Interface Functions | ||||||||||||||||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||||||||||||||||
| 296 | =head1 ADMIN INTERFACE METHODS | ||||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||
| 298 | =head2 Administration Methods | ||||||||||||||||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||||||||||||||||
| 300 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||||||||||||||||
| 302 | =item Admin | ||||||||||||||||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||||||||||||||||
| 304 | Provides a list of all photos. | ||||||||||||||||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||||||||||||||||
| 306 | =item Add | ||||||||||||||||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||||||||||||||||
| 308 | Prep for adding a photo. | ||||||||||||||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||||||||||||
| 310 | =item Edit | ||||||||||||||||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||||||||||||||||
| 312 | Edit details of an existing photo. | ||||||||||||||||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||||||||||||||||
| 314 | =item Move | ||||||||||||||||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||||||||||||||||
| 316 | Move a photo between albums. | ||||||||||||||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||||||||||||||
| 318 | =item Save | ||||||||||||||||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||||||||||||||||
| 320 | Saves details of a given photo. | ||||||||||||||||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||||||||||||||||
| 322 | =item Archive | ||||||||||||||||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||||||||||||||||
| 324 | Delete a photo reference if held in the archive photo album, or move to the | ||||||||||||||||||||||||||||||||||||||||||
| 325 | archive photo album, if held in another album. | ||||||||||||||||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||||||||||||||||
| 327 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||||||||||||||||
| 329 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||||||||||||||||
| 331 | 0 | ▶ | sub Admin { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Admin: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 332 | 0 | ▶ | return unless AccessUser($LEVEL); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | my @rs = $dbi->GetQuery('hash','AdminPhotos'); | |||||||||||||||||||||||||||||||||||||||||
| 334 | # foreach my $rec (@rs) { | ||||||||||||||||||||||||||||||||||||||||||
| 335 | # $rec->{title} =~ s/'/\'/g if $rec->{title}; | ||||||||||||||||||||||||||||||||||||||||||
| 336 | # $rec->{tagline} =~ s/'/\'/g if $rec->{tagline}; | ||||||||||||||||||||||||||||||||||||||||||
| 337 | # } | ||||||||||||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||||||||||||
| 339 | 0 | ▶ | $tvars{records} = \@rs if(@rs); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 340 | } | ||||||||||||||||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||||||||||||||||
| 342 | 0 | ▶ | sub Add { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Add: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 343 | 0 | ▶ | return unless AccessUser($LEVEL); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 344 | 0 | my @rs = $dbi->GetQuery('hash','ListPages'); | |||||||||||||||||||||||||||||||||||||||||
| 345 | 0 | ▶ | $tvars{pages} = $rs[0] if(@rs); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 346 | } | ||||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||
| 348 | 0 | ▶ | sub Edit { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Edit: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 349 | 0 | ▶ | return unless AccessUser($LEVEL); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 350 | 0 | my $photoid = $cgiparams{'iid'}; | |||||||||||||||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||||||||||||||||
| 352 | # get page details | ||||||||||||||||||||||||||||||||||||||||||
| 353 | 0 | my @pg = $dbi->GetQuery('hash','ListPages'); | |||||||||||||||||||||||||||||||||||||||||
| 354 | 0 | ▶ | $tvars{pages} = \@pg if(@pg); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 355 | # get photo details | ||||||||||||||||||||||||||||||||||||||||||
| 356 | 0 | my @rs = $dbi->GetQuery('hash','GetPhotoDetail',$photoid); | |||||||||||||||||||||||||||||||||||||||||
| 357 | 0 | ▶ | if(@rs) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 358 | 0 | ▶ | $rs[0]->{tagline} =~ s/'/\'/g if $rs[0]->{tagline}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 359 | 0 | $tvars{record} = $rs[0]; | |||||||||||||||||||||||||||||||||||||||||
| 360 | } | ||||||||||||||||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||||||||||||||||
| 362 | } | ||||||||||||||||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||||||||||||||||
| 364 | 0 | ▶ | sub Move { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Move: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 365 | 0 | ▶ | return unless AccessUser($LEVEL); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 366 | 0 | my $photoid = $cgiparams{'iid'}; | |||||||||||||||||||||||||||||||||||||||||
| 367 | 0 | my $pageid = $cgiparams{'pid'}; | |||||||||||||||||||||||||||||||||||||||||
| 368 | 0 | my $oldid = $cgiparams{'oid'}; | |||||||||||||||||||||||||||||||||||||||||
| 369 | |||||||||||||||||||||||||||||||||||||||||||
| 370 | 0 | ▶ | return unless($photoid && $pageid && $oldid); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$photoid and $pageid and $oldid
$photoid and $pageid
MC/DC0%0/3
$photoid and $pageid and $oldid
$photoid
$pageid
$oldid
Truth table0%0/4
A and B and C
A= $photoidB= $pageidC= $oldid
| |||||||||||||||||||||||||||||||||||||||||||
| 371 | |||||||||||||||||||||||||||||||||||||||||||
| 372 | # get page details | ||||||||||||||||||||||||||||||||||||||||||
| 373 | 0 | $dbi->DoQuery('MovePhoto',$pageid,$oldid,$photoid); | |||||||||||||||||||||||||||||||||||||||||
| 374 | } | ||||||||||||||||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||||||||||||||||
| 376 | 0 | ▶ | sub Save { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Save: not called CC=9 SCAR=45.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 377 | 0 | ▶ | return unless AccessUser($LEVEL); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 378 | 0 | my @fields; | |||||||||||||||||||||||||||||||||||||||||
| 379 | |||||||||||||||||||||||||||||||||||||||||||
| 380 | 0 | for(keys %fields) { | |||||||||||||||||||||||||||||||||||||||||
| 381 | 0 | ▶ | if($fields{$_}->{html} == 1) { $cgiparams{$_} = CleanHTML($cgiparams{$_}) } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 382 | 0 | elsif($fields{$_}->{html} == 2) { $cgiparams{$_} = CleanTags($cgiparams{$_}) } | |||||||||||||||||||||||||||||||||||||||||
| 383 | 0 | elsif($fields{$_}->{html} == 3) { $cgiparams{$_} = CleanLink($cgiparams{$_}) } | |||||||||||||||||||||||||||||||||||||||||
| 384 | } | ||||||||||||||||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||||||||||||||||
| 386 | 0 | ▶ | return if FieldCheck(\@allfields,\@mandatory); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||||||||||||||||
| 388 | 0 | ▶ | $tvars{data}->{hide} = $tvars{data}->{hide} ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 389 | 0 | push @fields, $tvars{data}->{$_} for(qw(pageid thumb image tagline hide photoid)); | |||||||||||||||||||||||||||||||||||||||||
| 390 | 0 | $dbi->DoQuery('UpdatePhoto2',@fields); | |||||||||||||||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||||||||||||||||
| 392 | 0 | $hits->SetUpdates('album',0,$tvars{data}->{pageid}); | |||||||||||||||||||||||||||||||||||||||||
| 393 | 0 | $tvars{thanks_message} = 'Photo saved successfully.'; | |||||||||||||||||||||||||||||||||||||||||
| 394 | } | ||||||||||||||||||||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||||||||||||||||||
| 396 | 0 | ▶ | sub Archive { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Archive: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 397 | 0 | ▶ | return unless AccessUser($LEVEL); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 398 | 0 | ▶ | return unless $cgiparams{$INDEXKEY}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||||||||||||||||
| 400 | 0 | my @rows = $dbi->GetQuery('hash','GetPhotoDetail',$cgiparams{$INDEXKEY}); | |||||||||||||||||||||||||||||||||||||||||
| 401 | 0 | ▶ | if($rows[0]->{pageid} == 1) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 402 | 0 | ▶ | return unless AccessUser(ADMIN); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 403 | 0 | my @photo = $dbi->GetQuery('hash','CheckPhoto',1,$cgiparams{$INDEXKEY}); | |||||||||||||||||||||||||||||||||||||||||
| 404 | 0 | ▶ | if(@photo && $photo[0]->{count} == 1) { # only delete if no others match | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
@photo and $photo[0]{"count"} == 1
MC/DC0%0/2
@photo and $photo[0]{"count"} == 1
@photo
$photo[0]{"count"} == 1
Truth table0%0/3
A and B
A= @photoB= $photo[0]{"count"} == 1
| |||||||||||||||||||||||||||||||||||||||||||
| 405 | 0 | DeleteFile( file => "$settings{webdir}/photos/$rows[0]->{image}" ); | |||||||||||||||||||||||||||||||||||||||||
| 406 | 0 | DeleteFile( file => "$settings{webdir}/photos/$rows[0]->{thumb}" ); | |||||||||||||||||||||||||||||||||||||||||
| 407 | } | ||||||||||||||||||||||||||||||||||||||||||
| 408 | 0 | $dbi->DoQuery('DeletePhoto',$cgiparams{$INDEXKEY}); | |||||||||||||||||||||||||||||||||||||||||
| 409 | 0 | $tvars{thanks_message} = 'Photo deleted successfully.'; | |||||||||||||||||||||||||||||||||||||||||
| 410 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 411 | 0 | $dbi->DoQuery('MovePhoto',1,$cgiparams{$INDEXKEY}); | |||||||||||||||||||||||||||||||||||||||||
| 412 | 0 | $tvars{thanks_message} = 'Photo archived successfully.'; | |||||||||||||||||||||||||||||||||||||||||
| 413 | } | ||||||||||||||||||||||||||||||||||||||||||
| 414 | } | ||||||||||||||||||||||||||||||||||||||||||
| 415 | |||||||||||||||||||||||||||||||||||||||||||
| 416 | 3 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 417 | |||||||||||||||||||||||||||||||||||||||||||
| 418 | __END__ | ||||||||||||||||||||||||||||||||||||||||||